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.
17 - name: Checking the details of Provisioning images
23 - "/opt/images/guest-image.img"
27 - name: Change ownership of provisioning images
29 path: "{{ item.stat.path }}"
32 with_items: "{{stat_list.results}}"
33 when: item.stat.pw_name != 'ironic'
36 - name: Write os_net_config to tmp files
38 content: "{{ item.driver_info.power.os_net_config }}"
39 dest: "/tmp/{{item.name}}_config.yaml"
41 with_items: "{{ baremetal_ironic_nodes }}"
43 label: "{{ item.name }}"
45 - name: Create baremetal ironic nodes
47 OS_AUTH_TOKEN: "fake-token"
48 IRONIC_URL: "{{ ironic_service_adminurl }}"
52 ironic_url: "{{ ironic_service_adminurl }}"
54 name: "{{ item.1.name }}"
55 driver: "{{ item.1.driver }}"
56 nics: "{{ item.1.nics }}"
57 properties: "{{ item.1.properties }}"
58 driver_info: "{{ item.1.driver_info | combine({'power': {'os_net_config': lookup('file', '/tmp/'+item.1.name+'_config.yaml'), 'ipmi_terminal_port': hosts[item.1.name]['ipmi_terminal_port'] }}, recursive=True ) }}"
59 with_indexed_items: "{{ baremetal_ironic_nodes }}"
60 register: baremetal_ironic_nodes_results
61 when: installation_phase == "provisioning-started"
63 label: "{{ item.1.name }}"
65 - name: Create list of nodes which are not in active state and not the installation controller.
67 baremetal_ironic_nodes_ids: "{{ baremetal_ironic_nodes_ids + [{'uuid': item.uuid, 'name': item.item.1.name}] }}"
68 with_items: "{{ baremetal_ironic_nodes_results.results }}"
70 - installation_phase == "provisioning-started"
71 - hosts[item.item.1.name]['installation_host'] is undefined
72 - item.provision_state != 'active'
75 - name: Create baremetal ironic nodes
78 endpoint_type: internal
81 name: "{{ item.1.name }}"
82 driver: "{{ item.1.driver }}"
83 nics: "{{ item.1.nics }}"
84 properties: "{{ item.1.properties }}"
85 driver_info: "{{ item.1.driver_info | combine({'power': {'os_net_config': lookup('file', '/tmp/'+item.1.name+'_config.yaml'), 'ipmi_terminal_port': hosts[item.1.name]['ipmi_terminal_port'] }}, recursive=True ) }}"
86 with_indexed_items: "{{ baremetal_ironic_nodes }}"
87 register: baremetal_ironic_nodes_results
88 when: (installation_phase != "provisioning-started" and reinitialized_nodes is not defined and scaled_out_nodes is not defined) or (reinitialized_nodes is defined and item.1.name in reinitialized_nodes) or (scaled_out_nodes is defined and item.1.name in scaled_out_nodes)
90 label: "{{ item.1.name }}"
92 - name: Create list of nodes which are not in active state and not the installation controller.
94 baremetal_ironic_nodes_ids: "{{ baremetal_ironic_nodes_ids + [{'uuid': item.uuid, 'name': item.item.1.name}] }}"
95 with_items: "{{ baremetal_ironic_nodes_results.results }}"
97 - installation_phase != "provisioning-started"
98 - (hosts[item.item.1.name]['installation_host'] is undefined and reinitialized_nodes is not defined and scaled_out_nodes is not defined) or (reinitialized_nodes is defined and item.item.1.name in reinitialized_nodes) or (scaled_out_nodes is defined and item.item.1.name in scaled_out_nodes)
99 - item.provision_state != 'active'