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 # cmframework.requires: performance_nodes_post.yaml,provisioning_done.yml
19 - name: Interface configuration postconfig
20 hosts: baremetal-nodes:!localhost
21 gather_facts: "{{ gather_facts | default(True) }}"
23 - name: Run os-net-config command
24 command: "os-net-config --detailed-exit-codes -v -c /etc/os-net-config/config.json"
25 register: os_net_config_result
26 failed_when: not (os_net_config_result.rc == 0 or os_net_config_result.rc == 2)
27 changed_when: os_net_config_result.rc == 2
29 - debug: var=os_net_config_result.stderr_lines
30 when: os_net_config_result.rc == 2
32 - name: Get os-net-config
34 src: /etc/os-net-config/config.json
35 register: os_net_config_b64
37 - name: Set os_net_config
39 os_net_config: "{{ os_net_config_b64['content'] | b64decode | from_json }}"
41 - name: Get interface names
43 phy_ifaces: "{{ os_net_config | json_query('network_config[*].name') }}"
45 - name: Make sure bridges are up
46 command: "ifup {{item}}"
47 with_items: "{{phy_ifaces}}"
50 - name: Updating the facts due to net changes
53 - name: Check if SR-IOV is configured
55 path: /etc/sriov/sriov.conf
56 register: sriov_result
58 - name: Enable sriov.service
63 when: sriov_result.stat.exists == True
65 - name: Start sriov.service
69 when: sriov_result.stat.exists == True and hostname != installation_controller
71 - name: Check if OVS offload SR-IOV is configured
72 shell: grep "SRIOV_INTERFACES_OFFLOADED" /etc/sriov/sriov.conf | cut -d = -f2 | sed -e 's/^"//' -e 's/"$//'
73 register: offload_result
74 when: sriov_result.stat.exists == True
76 - name: Enable ovsoffloadsriov.service
82 - sriov_result.stat.exists == True
83 - offload_result.stdout != ""
85 - name: Start offload.service
90 - sriov_result.stat.exists == True
91 - offload_result.stdout != "" and hostname != installation_controller
93 - name: Restart nova compute if sr-iov configured except on CAAS nodes
94 hosts: base:!vnf-nodes
95 gather_facts: "{{ gather_facts | default(True) }}"
97 - name: Check if nova-compute service is enabled here
98 shell: "systemctl list-unit-files | grep enabled | grep -w nova-compute | wc -l"
99 register: novacomputeresult
101 - name: Restart nova compute
105 when: sriov_result.stat.exists == True and hostname != installation_controller and novacomputeresult.stdout|int > 0