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)
~~~~~~~~~~~~
- 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
~~~~~~~~~~~~
- 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
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:
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']) }}"
operation:
name: "operation0"
+ inventory: "~/inventory.ini"
hosts:
- name: "operator0"
image: *image_name
operation:
name: "operation0"
+ inventory: "~/inventory.ini"
hosts:
- name: "operator0"
image: *image_name
--- /dev/null
+[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'