|
1 | 1 | --- |
2 | 2 |
|
3 | 3 | - name: Register baremetal compute nodes |
4 | | - hosts: "{{ groups['controllers'][0] }}" |
| 4 | + hosts: "{{ groups['controllers'][0] }}" |
5 | 5 | vars: |
6 | 6 | venv: "{{ virtualenv_path }}/openstack-cli" |
7 | 7 | tasks: |
|
40 | 40 | fail_msg: One or more Ironic variables are undefined. |
41 | 41 |
|
42 | 42 | - block: |
43 | | - - name: Show baremetal node |
44 | | - ansible.builtin.command: |
45 | | - cmd: "{{ venv }}/bin/openstack baremetal node show {{ inventory_hostname }}" |
46 | | - register: node_show |
47 | | - failed_when: |
48 | | - - '"HTTP 404" not in node_show.stderr' |
49 | | - - node_show.rc != 0 |
50 | | - changed_when: false |
| 43 | + - name: Show baremetal node |
| 44 | + ansible.builtin.command: |
| 45 | + cmd: "{{ venv }}/bin/openstack baremetal node show {{ inventory_hostname }}" |
| 46 | + register: node_show |
| 47 | + failed_when: |
| 48 | + - '"HTTP 404" not in node_show.stderr' |
| 49 | + - node_show.rc != 0 |
| 50 | + changed_when: false |
51 | 51 |
|
52 | | - # NOTE: The openstack.cloud.baremetal_node module cannot be used in this |
53 | | - # script due to requiring a MAC address pre-defined, instead, this should |
54 | | - # be discovered by inpsection following this script. |
55 | | - # |
56 | | - # NOTE: IPMI address must be passed with Redfish address to ensure existing |
57 | | - # Ironic nodes match with new nodes during inspection. |
58 | | - - name: Create baremetal nodes |
59 | | - ansible.builtin.shell: |
60 | | - cmd: | |
61 | | - {{ venv }}/bin/openstack baremetal node create \ |
62 | | - --name {{ inventory_hostname }} \ |
63 | | - --driver {{ ironic_driver }} \ |
64 | | - --driver-info redfish_system_id={{ ironic_redfish_system_id }} \ |
65 | | - --driver-info redfish_address={{ ironic_redfish_address }} \ |
66 | | - --driver-info redfish_username={{ ironic_redfish_username }} \ |
67 | | - --driver-info redfish_password={{ ironic_redfish_password }} \ |
68 | | - --driver-info redfish_verify_ca={{ ironic_redfish_verify_ca }} \ |
69 | | - {% for key, value in ironic_properties.items() %} |
70 | | - --property {{ key }}={{ value }} \ |
71 | | - {% endfor %} |
72 | | - --resource-class {{ ironic_resource_class }} |
73 | | - {% if ironic_boot_interface %} |
74 | | - --boot-interface {{ ironic_boot_interface }} |
75 | | - {% endif %} |
76 | | - {% if ironic_inspect_interface %} |
77 | | - --inspect-interface {{ ironic_inspect_interface }} |
78 | | - {% endif %} |
79 | | - {% if ironic_management_interface %} |
80 | | - --management-interface {{ ironic_management_interface }} |
81 | | - {% endif %} |
82 | | - {% if ironic_network_interface %} |
83 | | - --network-interface {{ ironic_network_interface }} |
84 | | - {% endif %} |
85 | | - {% if ironic_raid_interface %} |
86 | | - --raid-interface {{ ironic_raid_interface }} |
87 | | - {% endif %} |
88 | | - when: |
89 | | - - node_show.rc != 0 |
| 52 | + # NOTE: The openstack.cloud.baremetal_node module cannot be used in this |
| 53 | + # script due to requiring a MAC address pre-defined, instead, this should |
| 54 | + # be discovered by inpsection following this script. |
| 55 | + # |
| 56 | + # NOTE: IPMI address must be passed with Redfish address to ensure existing |
| 57 | + # Ironic nodes match with new nodes during inspection. |
| 58 | + - name: Create baremetal nodes |
| 59 | + ansible.builtin.shell: |
| 60 | + cmd: | |
| 61 | + {{ venv }}/bin/openstack baremetal node create \ |
| 62 | + --name {{ inventory_hostname }} \ |
| 63 | + --driver {{ ironic_driver }} \ |
| 64 | + --driver-info redfish_system_id={{ ironic_redfish_system_id }} \ |
| 65 | + --driver-info redfish_address={{ ironic_redfish_address }} \ |
| 66 | + --driver-info redfish_username={{ ironic_redfish_username }} \ |
| 67 | + --driver-info redfish_password={{ ironic_redfish_password }} \ |
| 68 | + --driver-info redfish_verify_ca={{ ironic_redfish_verify_ca }} \ |
| 69 | + {% for key, value in ironic_properties.items() %} |
| 70 | + --property {{ key }}={{ value }} \ |
| 71 | + {% endfor %} |
| 72 | + --resource-class {{ ironic_resource_class }} |
| 73 | + {% if ironic_boot_interface %} |
| 74 | + --boot-interface {{ ironic_boot_interface }} |
| 75 | + {% endif %} |
| 76 | + {% if ironic_inspect_interface %} |
| 77 | + --inspect-interface {{ ironic_inspect_interface }} |
| 78 | + {% endif %} |
| 79 | + {% if ironic_management_interface %} |
| 80 | + --management-interface {{ ironic_management_interface }} |
| 81 | + {% endif %} |
| 82 | + {% if ironic_network_interface %} |
| 83 | + --network-interface {{ ironic_network_interface }} |
| 84 | + {% endif %} |
| 85 | + {% if ironic_raid_interface %} |
| 86 | + --raid-interface {{ ironic_raid_interface }} |
| 87 | + {% endif %} |
| 88 | + when: |
| 89 | + - node_show.rc != 0 |
90 | 90 |
|
91 | | - - name: Manage baremetal nodes |
92 | | - ansible.builtin.command: |
93 | | - cmd: "{{ venv }}/bin/openstack baremetal node manage {{ inventory_hostname }} --wait" |
94 | | - when: |
95 | | - - node_show.rc != 0 |
| 91 | + - name: Manage baremetal nodes |
| 92 | + ansible.builtin.command: |
| 93 | + cmd: "{{ venv }}/bin/openstack baremetal node manage {{ inventory_hostname }} --wait" |
| 94 | + when: |
| 95 | + - node_show.rc != 0 |
96 | 96 | delegate_to: "{{ controller_host }}" |
97 | 97 | vars: |
98 | 98 | # NOTE: Without this, the controller's ansible_host variable will not |
|
0 commit comments