5b954219570f1962b3817f18233c8e02734365df
[integration.git] / deployment / noheat / infra-openstack / ansible / create.yml
1 ---
2 - name: Prepare infrastructure and create operation instances
3   hosts: localhost
4   connection: local
5   gather_facts: False
6   roles:
7     - openstack/create_devstack_network
8     - openstack/create_devstack_securitygroup
9     - openstack/create_devstack_keypair
10     - role: openstack/create_devstack_hosts
11       hosts: "{{ operation.hosts }}"
12       operator_key: "dummy"
13 - name: Create cluster operator access keypair
14   hosts: "operator0"
15   gather_facts: False
16   tasks:
17     - name: Wait for system to become reachable
18       wait_for_connection:
19     - name: Generate an OpenSSH keypair with the default values (4096 bits, rsa)
20       community.crypto.openssh_keypair:
21         path: "~/.ssh/{{ keypair.name }}"
22       register: key
23 - name: Create cluster instances
24   hosts: localhost
25   connection: local
26   gather_facts: False
27   roles:
28     - role: openstack/create_devstack_hosts
29       hosts: "{{ cluster.hosts }}"
30       operator_key: "{{ hostvars['operator0']['key']['public_key'] }}"
31 - name: Create cluster operator access information
32   hosts: "operator0"
33   gather_facts: False
34   tasks:
35     - name: Add cluster hostnames to /etc/hosts file
36       lineinfile:
37         path: /etc/hosts
38         line: "{{ item.value + ' ' + item.key }}"
39       become: yes
40       loop: "{{ lookup('dict', hostvars['localhost']['hosts_dict']) }}"