File tree Expand file tree Collapse file tree 11 files changed +154
-2
lines changed
openstack_baremetal/tasks Expand file tree Collapse file tree 11 files changed +154
-2
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ extend-exclude = [
7
7
" python/understack-workflows/tests/json_samples/" ,
8
8
" containers/*/patches" ,
9
9
" go.mod" ,
10
- " ansible/roles/statuses/defaults/main.yaml" ,
11
10
]
12
11
13
12
[default ]
@@ -20,4 +19,4 @@ extend-ignore-identifiers-re = [
20
19
HPE = " HPE"
21
20
fo = " fo"
22
21
sme = " sme"
23
- 4caf50 = " 4caf50 "
22
+ caf = " caf "
Original file line number Diff line number Diff line change
1
+ ---
2
+ # Copyright (c) 2025 Rackspace Technology, Inc.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"); you may
5
+ # not use this file except in compliance with the License. You may obtain
6
+ # a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations
14
+ # under the License.
15
+
16
+ - name : Openstack Network
17
+ hosts : ironic
18
+ connection : local
19
+
20
+ pre_tasks :
21
+ - name : Fail if ENV variables are not set
22
+ ansible.builtin.fail :
23
+ msg : " Environment variable {{ item }} is not set. Exiting playbook."
24
+ when : lookup('env', item) == ''
25
+ loop :
26
+ - OS_CLOUD
27
+
28
+ roles :
29
+ - role : openstack_baremetal
Original file line number Diff line number Diff line change @@ -5,3 +5,4 @@ pynautobot==2.6.2
5
5
jmespath == 1.0.1
6
6
# remove me after the inherited roles workaround can be dropped
7
7
python-openstackclient
8
+ python-ironicclient == 5.11.0
Original file line number Diff line number Diff line change
1
+ ---
2
+
3
+ - name : Enroll infra nodes
4
+ ansible.builtin.include_tasks : node.yml
5
+ loop : " {{ infra_nodes }}"
6
+ loop_control :
7
+ loop_var : node
8
+ vars :
9
+ item : " {{ node }}"
Original file line number Diff line number Diff line change
1
+ ---
2
+
3
+ - name : Enroll infra node {{ item.name }}
4
+ openstack.cloud.baremetal_node :
5
+ name : " {{ item.name }}"
6
+ driver : " {{ item.driver }}"
7
+ driver_info : " {{ item.driver_info }}"
8
+ nics : " {{ item.nics }}"
9
+ state : present
10
+ register : enrolled_node
11
+
12
+ - name : Create baremetal ports for node {{ item.name }}
13
+ ansible.builtin.include_tasks : port.yml
14
+ loop : " {{ item.nics }}"
15
+ loop_control :
16
+ loop_var : port_info
17
+ vars :
18
+ port_node_name : " {{ item.name }}"
19
+
20
+ - name : Create baremetal ports group for node {{ item.name }}
21
+ ansible.builtin.include_tasks : port_group.yml
22
+ loop : " {{ item.port_groups }}"
23
+ loop_control :
24
+ loop_var : port_group
25
+ vars :
26
+ node_id : " {{ enrolled_node.node.id }}"
Original file line number Diff line number Diff line change
1
+ ---
2
+
3
+ - name : Create baremetal port
4
+ openstack.cloud.baremetal_port :
5
+ address : " {{ port_info.mac }}"
6
+ node : " {{ port_node_name }}"
7
+ state : present
Original file line number Diff line number Diff line change
1
+ ---
2
+
3
+ - name : Check if baremetal port group exists
4
+ ansible.builtin.command : openstack baremetal port group show {{ port_group.name }}
5
+ register : port_group_check
6
+ failed_when : false
7
+ changed_when : false
8
+
9
+ - name : Create baremetal port group
10
+ ansible.builtin.shell : >
11
+ openstack baremetal port group create
12
+ --node {{ node_id }}
13
+ --name {{ port_group.name }}
14
+ --mode {{ port_group.mode }}
15
+ when : port_group_check.rc != 0
16
+ register : port_group_created
17
+ changed_when : true
Original file line number Diff line number Diff line change 17
17
loop : " {{ existing_networks.results }}"
18
18
loop_control :
19
19
label : " {{ item.item.network_name }}"
20
+
21
+ - name : Create segment range
22
+ ansible.builtin.include_tasks : segment_range.yml
23
+ loop : " {{ network_segment_ranges }}"
24
+ loop_control :
25
+ loop_var : segment
26
+ vars :
27
+ item : " {{ segment }}"
28
+
29
+ - name : Create subnet pool
30
+ ansible.builtin.include_tasks : subnet_pool.yml
31
+ loop : " {{ subnet_pools }}"
32
+ loop_control :
33
+ loop_var : subnet_pool
34
+ vars :
35
+ item : " {{ subnet_pool }}"
36
+
37
+ - name : Create baremetal ports
38
+ ansible.builtin.include_tasks : port.yml
39
+ loop : " {{ baremetal_ports }}"
40
+ loop_control :
41
+ loop_var : network_ports
42
+ vars :
43
+ ports : " {{ network_ports.ports }}"
44
+ network : " {{ network_ports.network }}"
Original file line number Diff line number Diff line change
1
+ ---
2
+
3
+ - name : Create neutron port for network {{ network }}
4
+ openstack.cloud.port :
5
+ state : present
6
+ name : " {{ item.name }}"
7
+ mac_address : " {{ item.mac_address }}"
8
+ network : " {{ network }}"
9
+ loop : " {{ ports }}"
Original file line number Diff line number Diff line change
1
+ ---
2
+
3
+ - name : Check if segment range exists
4
+ ansible.builtin.command : openstack network segment range show {{ item.name }}
5
+ register : segment_range_check
6
+ failed_when : false
7
+ changed_when : false
8
+
9
+ - name : Create network segment range if missing
10
+ ansible.builtin.shell : >
11
+ openstack network segment range create
12
+ --shared
13
+ --network-type {{ item['network-type'] }}
14
+ --minimum {{ item.range_min }}
15
+ --maximum {{ item.range_max }}
16
+ {% if item.get('physical-network', '') | length > 0 %}
17
+ --physical-network {{ item['physical-network'] }}
18
+ {% endif %}
19
+ {{ item.name }}
20
+ when : segment_range_check.rc != 0
21
+ register : segment_range_created
22
+ changed_when : true
You can’t perform that action at this time.
0 commit comments