aboutsummaryrefslogtreecommitdiffstats
path: root/deployment/noheat/infra-openstack/ansible/roles/openstack/create_devstack_hosts/tasks/create_host.yml
blob: 7fed5785949b9023c3c98fe500c6ff8651c4c91d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
---
- name: Create host
  os_server:
    state: present
    name: "{{ host.name }}"
    image: "{{ host.image }}"
    flavor: "{{ host.flavor }}"
    key_name: "{{ host.keypair }}"
    network: "{{ host.network }}"
    security_groups:
      - "{{ host.securitygroup }}"
    auto_ip: "{{ host.auto_ip | default(true) }}"
    boot_from_volume: true
    terminate_volume: true
    volume_size: "{{ host.volume_size | default(10) }}"
  register: new_host

- name: Add host to inventory
  add_host:
    hostname: "{{ new_host.server.name }}"
    groups: "{{ cluster.name }}"
    ansible_ssh_host: "{{ new_host.server.public_v4 }}"
    ansible_ssh_user: "{{ image.user }}"
    ansible_ssh_extra_args: "-o StrictHostKeyChecking=no"
    ansible_ssh_private_key_file: "~/.ssh/{{ keypair.key.name }}"