2 - name: Prepare infrastructure and create operation instances
11 hosts: "{{ operation.hosts }}"
14 - name: Get operator Openstack info
15 openstack.cloud.server_info:
17 register: operator_info
18 - name: Create directory for artifacts
23 - name: Save operator access information
25 content: "{{ operator_info['openstack_servers'][0]['public_v4'] }},{{ image['user'] }},~/.ssh/{{ keypair['key']['name'] }}"
26 dest: "artifacts/operator.csv"
28 - name: Create cluster operator access keypair
32 - name: Wait for system to become reachable
34 - name: Generate an OpenSSH keypair with the default values (4096 bits, rsa)
35 community.crypto.openssh_keypair:
36 path: "~/.ssh/{{ keypair.name }}"
38 - name: Add operator0 public key to it's authorized keys
39 ansible.posix.authorized_key:
40 key: "{{ key['public_key'] }}"
42 user: "{{ ansible_user }}"
43 - name: Create OpenStack instances
49 hosts: "{{ openstack.hosts }}"
50 operator_key: "{{ hostvars['operator0']['key']['public_key'] }}"
51 - name: Create cluster instances
57 hosts: "{{ cluster.hosts }}"
58 operator_key: "{{ hostvars['operator0']['key']['public_key'] }}"
59 - name: Create cluster operator access information
62 - ../../common-vars.yml
64 - name: Add cluster hostnames to /etc/hosts file
67 line: "{{ item.value + ' ' + item.key }}"
69 loop: "{{ lookup('dict', hostvars['localhost']['hosts_dict']) }}"
70 - name: Create inventory for in-cluster deployment stage
72 src: templates/inventory.ini.j2
73 dest: "{{ operation.inventory }}"
75 hosts: "{{ lookup('dict', hostvars['localhost']['hosts_dict']) }}"
76 - name: Push in-cluster deployment stage description to the next Ansible control host
78 src: ../../cluster-rke
80 - name: Push Devstack deployment stage description to the next Ansible control host
84 - name: Push common variables to the next Ansible control host
86 src: ../../common-vars.yml
88 - name: Push Devstack vars to the next Ansible control host (for Devstack stage)
90 src: "templates/openstack.yml.j2"
91 dest: ~/devstack/ansible/group_vars/all/openstack.yml
93 - name: Push Devstack vars to the next Ansible control host (for cluster-rke stage)
95 src: "templates/openstack.yml.j2"
96 dest: ~/deploy/cluster-rke/ansible/group_vars/all/openstack.yml
98 - name: Create Devstack config directory
100 path: ~/.config/openstack/
103 - name: Generate Devstack clouds.yml file
105 src: "templates/clouds.yaml.j2"
106 dest: ~/.config/openstack/clouds.yml
109 - name: Install python dependencies
115 - default-jdk-headless
118 - name: Install community.kubernetes.k8s Ansible collection dependencies
121 - ansible-core==2.13.5
124 # Major version of Python k8s libraty matches minor version of k8s.
125 - kubernetes~={{ k8s_version | regex_search("[^^.][0-9]+[^$]") ~ "0" }}
128 - name: Copy ansible-galaxy requirements file
130 src: operator-requirements.yml
131 dest: ~/requirements.yml
133 - name: Install ansible-galaxy collections
134 community.general.ansible_galaxy_install:
135 requirements_file: ~/requirements.yml