diff --git a/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml b/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml index bc86c7fb3..cd3772c52 100644 --- a/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml +++ b/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml @@ -73,6 +73,12 @@ delegate_to: localhost ignore_errors: yes +- name: "Delete default network interface if not running" + shell: ip link del $(virsh net-info default | awk '$1 == "Bridge:" { print $2 }') + when: virsh_network_status.rc != 0 + ignore_errors: yes + delegate_to: localhost + - name: "Start default network if not running" command: virsh net-start default when: virsh_network_status.rc != 0 @@ -85,8 +91,7 @@ msg: "Unable to verify the libvirt default network is available" when: > virsh_network_status.rc != 0 and - task_start_default_net.rc != 0 and - 'File exists' not in task_start_default_net.stderr + task_start_default_net.rc != 0 - name: "Create virtual machines" script: create_vm_nodes-for-role.sh diff --git a/playbooks/roles/bifrost-ironic-install/tasks/ironic_config.yml b/playbooks/roles/bifrost-ironic-install/tasks/ironic_config.yml index 62313940b..b770b5223 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/ironic_config.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/ironic_config.yml @@ -13,6 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. --- +- name: "Fail if the network interface does not exist" + fail: + msg: > + The configured network interface {{ network_interface }} does + not exist + when: "{{ 'ansible_' ~ ans_network_interface not in hostvars[inventory_hostname] }}" +- name: "Fail if the network interface has no IP address assigned" + fail: + msg: > + The configured network interface {{ network_interface }} does + not have an IP address assigned + when: "{{ not hostvars[inventory_hostname]['ansible_' ~ ans_network_interface].get('ipv4', {}).get('address') }}" - name: "Update driver list if PXE drivers are enabled" set_fact: enabled_drivers: "{{ enabled_drivers }},{{ pxe_drivers }}"