Prepare operation machine for in-cluster deployment stage 21/121021/1
authorPawel Wieczorek <p.wieczorek2@samsung.com>
Wed, 28 Apr 2021 13:08:30 +0000 (15:08 +0200)
committerMorgan Richomme <morgan.richomme@orange.com>
Fri, 30 Apr 2021 09:38:15 +0000 (09:38 +0000)
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)

deployment/noheat/README.rst
deployment/noheat/infra-openstack/README.rst
deployment/noheat/infra-openstack/ansible/create.yml
deployment/noheat/infra-openstack/ansible/group_vars/all.yml.sample
deployment/noheat/infra-openstack/ansible/group_vars/all.yml.sm-onap
deployment/noheat/infra-openstack/ansible/templates/inventory.ini.j2 [new file with mode: 0644]

index 287dc9f..f3c7fb8 100644 (file)
@@ -25,6 +25,11 @@ Dependencies
 ~~~~~~~~~~~~
 
 - Ansible: tested on 2.9.9 (using Python 3.5.2)
+    - Collections
+        - community.crypto: tested on 1.3.0
+        - ansible.posix: tested on 1.1.1
+    - Roles
+        - geerlingguy.ansible: tested on 2.1.0
 - openstacksdk_: tested on 0.46.0 (using Python 3.5.2)
 
 .. _openstacksdk: https://pypi.org/project/openstacksdk
index cb7cb93..1ac9539 100644 (file)
@@ -23,6 +23,11 @@ Dependencies
 ~~~~~~~~~~~~
 
 - Ansible: tested on 2.9.9 (using Python 3.5.2)
+    - Collections
+        - community.crypto: tested on 1.3.0
+        - ansible.posix: tested on 1.1.1
+    - Roles
+        - geerlingguy.ansible: tested on 2.1.0
 - openstacksdk_: tested on 0.46.0 (using Python 3.5.2)
 
 .. _openstacksdk: https://pypi.org/project/openstacksdk
index 69ecd1d..a088662 100644 (file)
@@ -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']) }}"
index 72d37a3..470c2b1 100644 (file)
@@ -18,6 +18,7 @@ image:
 
 operation:
   name: "operation0"
+  inventory: "~/inventory.ini"
   hosts:
     - name: "operator0"
       image: *image_name
index 744f918..fb4f208 100644 (file)
@@ -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 (file)
index 0000000..421c9c2
--- /dev/null
@@ -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'