5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 - name: Write os_net_config to tmp files
18 content: "{{ ironic_node_details.driver_info.power.os_net_config }}"
19 dest: "/tmp/{{ironic_node_details.name}}_config.yaml"
22 - name: Create baremetal ironic nodes
24 OS_AUTH_TOKEN: "fake-token"
25 IRONIC_URL: "{{ ironic_service_adminurl }}"
29 ironic_url: "{{ ironic_service_adminurl }}"
31 name: "{{ ironic_node_details.name }}"
32 driver: "{{ ironic_node_details.driver }}"
33 nics: "{{ ironic_node_details.nics }}"
34 properties: "{{ ironic_node_details.properties }}"
35 driver_info: "{{ ironic_node_details.driver_info | combine({'power': {'os_net_config': lookup('file', '/tmp/'+ironic_node_details.name+'_config.yaml'), 'ipmi_terminal_port': hosts[ironic_node_details.name]['ipmi_terminal_port'] }}, recursive=True ) }}"
36 driver_info: "{{ ironic_node_details.driver_info | combine({'power': {'os_net_config': lookup('file', '/tmp/'+ironic_node_details.name+'_config.yaml'), 'ipmi_terminal_port': hosts[ironic_node_details.name]['ipmi_terminal_port'], 'provisioning_server_http_port': golden_image_http_port }}, recursive=True ) }}"
38 register: baremetal_ironic_nodes_results
39 when: installation_phase == "provisioning-started"
41 - name: Create node datastructure if its not in active state and not the installation controller.
43 baremetal_ironic_node_id: {"uuid": "{{baremetal_ironic_nodes_results.uuid}}", "name": "{{ironic_node_details.name}}" }
45 - installation_phase == "provisioning-started"
46 - hosts[ironic_node_details.name]['installation_host'] is undefined
47 - baremetal_ironic_nodes_results.provision_state != 'active'
49 - name: Create baremetal ironic nodes
52 endpoint_type: internal
55 name: "{{ ironic_node_details.name }}"
56 driver: "{{ ironic_node_details.driver }}"
57 nics: "{{ ironic_node_details.nics }}"
58 properties: "{{ ironic_node_details.properties }}"
59 driver_info: "{{ ironic_node_details.driver_info | combine({'power': {'os_net_config': lookup('file', '/tmp/'+ironic_node_details.name+'_config.yaml'), 'ipmi_terminal_port': hosts[ironic_node_details.name]['ipmi_terminal_port'], 'provisioning_server_http_port': golden_image_http_port }}, recursive=True ) }}"
60 register: baremetal_ironic_nodes_results
61 when: (installation_phase != "provisioning-started" and reinitialized_nodes is not defined and scaled_out_nodes is not defined) or (reinitialized_nodes is defined and ironic_node_details.name in reinitialized_nodes) or (scaled_out_nodes is defined and ironic_node_details.name in scaled_out_nodes)
63 - name: Create node datastructure if its not in active state and not the installation controller.
65 baremetal_ironic_node_id: {"uuid": "{{baremetal_ironic_nodes_results.uuid}}", "name": "{{ironic_node_details.name}}" }
67 - installation_phase != "provisioning-started"
68 - (hosts[ironic_node_details.name]['installation_host'] is undefined and reinitialized_nodes is not defined and scaled_out_nodes is not defined) or (reinitialized_nodes is defined and ironic_node_details.name in reinitialized_nodes) or (scaled_out_nodes is defined and ironic_node_details.name in scaled_out_nodes)
69 - baremetal_ironic_nodes_results.provision_state != 'active'