Add instructions for the simulator wrapper
[integration.git] / deployment / noheat / infra-openstack / ansible / roles / openstack / create_devstack_hosts / tasks / create_host.yml
1 ---
2 - name: Create host
3   os_server:
4     state: present
5     name: "{{ host.name }}"
6     image: "{{ host.image }}"
7     flavor: "{{ host.flavor }}"
8     key_name: "{{ host.keypair }}"
9     network: "{{ host.network }}"
10     security_groups:
11       - "{{ host.securitygroup }}"
12     auto_ip: "{{ host.auto_ip | default(true) }}"
13     boot_from_volume: true
14     terminate_volume: true
15     volume_size: "{{ host.volume_size | default(10) }}"
16     userdata: |
17       #cloud-config
18       ssh_authorized_keys:
19         - "{{ operator_key }}"
20   register: new_host
21
22 - name: Add host to inventory
23   add_host:
24     hostname: "{{ new_host.server.name }}"
25     groups: "{{ cluster.name }}"
26     ansible_ssh_host: "{{ new_host.server.public_v4 }}"
27     ansible_ssh_user: "{{ image.user }}"
28     ansible_ssh_extra_args: "-o StrictHostKeyChecking=no"
29     ansible_ssh_private_key_file: "~/.ssh/{{ keypair.key.name }}"
30
31 - name: Add host to hosts dict
32   set_fact:
33     hosts_dict: "{{ hosts_dict|default({}) | combine( {new_host.server.name: new_host.server.private_v4} ) }}"