| --- |
| - name: Prepare infrastructure and create operation instances |
| hosts: localhost |
| connection: local |
| gather_facts: False |
| roles: |
| - openstack/create_devstack_network |
| - openstack/create_devstack_securitygroup |
| - openstack/create_devstack_keypair |
| - role: openstack/create_devstack_hosts |
| hosts: "{{ operation.hosts }}" |
| operator_key: "dummy" |
| - name: Create cluster operator access keypair |
| hosts: "operator0" |
| gather_facts: False |
| tasks: |
| - name: Wait for system to become reachable |
| wait_for_connection: |
| - name: Generate an OpenSSH keypair with the default values (4096 bits, rsa) |
| community.crypto.openssh_keypair: |
| path: "~/.ssh/{{ keypair.name }}" |
| register: key |
| - name: Create cluster instances |
| hosts: localhost |
| connection: local |
| gather_facts: False |
| roles: |
| - role: openstack/create_devstack_hosts |
| hosts: "{{ cluster.hosts }}" |
| operator_key: "{{ hostvars['operator0']['key']['public_key'] }}" |
| - name: Create cluster operator access information |
| hosts: "operator0" |
| gather_facts: False |
| tasks: |
| - name: Add cluster hostnames to /etc/hosts file |
| lineinfile: |
| path: /etc/hosts |
| line: "{{ item.value + ' ' + item.key }}" |
| become: yes |
| loop: "{{ lookup('dict', hostvars['localhost']['hosts_dict']) }}" |