diff options
author | Pawel Wieczorek <p.wieczorek2@samsung.com> | 2021-04-28 15:08:30 +0200 |
---|---|---|
committer | Morgan Richomme <morgan.richomme@orange.com> | 2021-04-30 09:38:15 +0000 |
commit | 7df9a28f41a11afc2572c0a1f2558503f07a907e (patch) | |
tree | 4d1e3429601821686bf045b5ecbad23b28fd7ee1 /deployment/noheat/infra-openstack/ansible | |
parent | b922d75d7d66baae5cf5b13dc79f4e57bb7e4f36 (diff) |
Prepare operation machine for in-cluster deployment stage
This patch creates an in-cluster inventory based on the dynamic one from
creating OpenStack VMs. It will be used at the next deployment stage.
This patch also adds missing documentation on required software to run
these Ansible playbooks.
Issue-ID: INT-1601
Change-Id: Ibf009a2530de989b1927a7a4a2f328fa61c1dd55
Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
(cherry picked from commit 0ad5c702b4e62d3223f0c2d2c382f18a441beb8e)
Diffstat (limited to 'deployment/noheat/infra-openstack/ansible')
4 files changed, 19 insertions, 1 deletions
diff --git a/deployment/noheat/infra-openstack/ansible/create.yml b/deployment/noheat/infra-openstack/ansible/create.yml index 69ecd1dd9..a088662b2 100644 --- a/deployment/noheat/infra-openstack/ansible/create.yml +++ b/deployment/noheat/infra-openstack/ansible/create.yml @@ -30,7 +30,9 @@ operator_key: "{{ hostvars['operator0']['key']['public_key'] }}" - name: Create cluster operator access information hosts: "operator0" - gather_facts: False + roles: + - role: geerlingguy.ansible + become: yes tasks: - name: Add cluster hostnames to /etc/hosts file lineinfile: @@ -38,3 +40,9 @@ line: "{{ item.value + ' ' + item.key }}" become: yes loop: "{{ lookup('dict', hostvars['localhost']['hosts_dict']) }}" + - name: Create inventory for in-cluster deployment stage + template: + src: templates/inventory.ini.j2 + dest: "{{ operation.inventory }}" + vars: + hosts: "{{ lookup('dict', hostvars['localhost']['hosts_dict']) }}" diff --git a/deployment/noheat/infra-openstack/ansible/group_vars/all.yml.sample b/deployment/noheat/infra-openstack/ansible/group_vars/all.yml.sample index 72d37a303..470c2b120 100644 --- a/deployment/noheat/infra-openstack/ansible/group_vars/all.yml.sample +++ b/deployment/noheat/infra-openstack/ansible/group_vars/all.yml.sample @@ -18,6 +18,7 @@ image: operation: name: "operation0" + inventory: "~/inventory.ini" hosts: - name: "operator0" image: *image_name diff --git a/deployment/noheat/infra-openstack/ansible/group_vars/all.yml.sm-onap b/deployment/noheat/infra-openstack/ansible/group_vars/all.yml.sm-onap index 744f91839..fb4f20861 100644 --- a/deployment/noheat/infra-openstack/ansible/group_vars/all.yml.sm-onap +++ b/deployment/noheat/infra-openstack/ansible/group_vars/all.yml.sm-onap @@ -17,6 +17,7 @@ image: operation: name: "operation0" + inventory: "~/inventory.ini" hosts: - name: "operator0" image: *image_name diff --git a/deployment/noheat/infra-openstack/ansible/templates/inventory.ini.j2 b/deployment/noheat/infra-openstack/ansible/templates/inventory.ini.j2 new file mode 100644 index 000000000..421c9c21f --- /dev/null +++ b/deployment/noheat/infra-openstack/ansible/templates/inventory.ini.j2 @@ -0,0 +1,8 @@ +[all] +{% for item in hosts %} +{{ item.key }} ansible_host={{ item.value }} +{% endfor %} + +[all:vars] +ansible_ssh_private_key_file="~/.ssh/{{ keypair.name }}" +ansible_ssh_common_args='-o StrictHostKeyChecking=no' |