blob: d999a2f2287d4a951ac2ec66935cf888690d02f3 [file] [log] [blame]
{% raw %}
# enroll nodes using bifrost
- hosts: baremetal
name: "Enroll nodes into Ironic"
become: no
gather_facts: no
vars:
multinode_testing: true
inventory_dhcp: true
inventory_dhcp_static_ip: true
{% endraw %}
network_interface: "{{ engine.pxe_interface }}"
{% raw %}
roles:
- role: ironic-enroll-dynamic
delegate_to: "{{ groups['target'][0] if groups['target'] is defined else 'localhost' }}"
# - role: ironic-inspect-node
# delegate_to: "{{ groups['target'][0] if groups['target'] is defined else 'localhost' }}"
environment:
http_proxy: "{{ lookup('env','http_proxy') }}"
https_proxy: "{{ lookup('env','https_proxy') }}"
no_proxy: "{{ lookup('env','no_proxy') }}"
# TODO: this is necessary to install the OS in the correct drive. This workaround can be removed once Ansible v2.8 is released, which will support
# the root_device property in its ironic python module.
- hosts: localhost
connection: local
become: no
gather_facts: no
tasks:
{% endraw %}
{% for hostname, role in hosts.items() %}
{% set node = nodes | selectattr('name', 'equalto', hostname) | first %}
- name: Add root_device hints to enrolled ironic nodes
command: "openstack --os-cloud bifrost baremetal node set {{ role }} --property root_device='{\"size\": \"{{ node.disks[0].disk_capacity.rstrip("G") }}\" }'"
{% endfor %}
{% raw %}
- hosts: localhost
connection: local
become: no
gather_facts: no
tasks:
- name: Get nodes from Ironic
command: openstack --os-cloud bifrost baremetal node list
register: ironic_nodes
- name: List Ironic nodes
debug:
msg: "{{ ironic_nodes.stdout_lines }}"
{% endraw %}
# deploy nodes using bifrost
{% raw %}
- hosts: baremetal
name: Create configuration drive files and deploy machines from inventory
become: no
gather_facts: no
vars:
{% endraw %}
network_interface: "{{ engine.pxe_interface }}"
multinode_testing: true
write_interfaces_file: true
addressing_mode: dhcp
inventory_dhcp: true
inventory_dhcp_static_ip: true
wait_for_node_deploy: true
wait_timeout: 1800
{% raw %}
roles:
- role: bifrost-configdrives-dynamic
delegate_to: "{{ groups['target'][0] if groups['target'] is defined else 'localhost' }}"
- role: bifrost-deploy-nodes-dynamic
delegate_to: "{{ groups['target'][0] if groups['target'] is defined else 'localhost' }}"
- hosts: localhost
connection: local
become: no
gather_facts: no
tasks:
- name: Get nodes from Ironic
command: openstack --os-cloud bifrost baremetal node list
register: ironic_nodes
- name: List Ironic nodes
debug:
msg: "{{ ironic_nodes.stdout_lines }}"
- hosts: localhost
connection: local
become: no
gather_facts: no
{% endraw %}
vars_files:
- "{{ bifrost_inventory_source }}"
{% raw %}
tasks:
- name: Wait for hosts to be reachable via SSH
local_action:
module: wait_for
host: "{{ item }}"
delay: 15
state: started
port: 22
connect_timeout: 10
timeout: 1000
with_items: "{{ vars.groups.baremetal }}"
{% endraw %}