Skip to content

empty bridged network fails with: 'nic_name' is undefined #406

@andreaskaris

Description

@andreaskaris
fatal: [hypervisor]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'nic_name' is undefined\n\nThe error appears to be in '/home/infrared/.infrared/plugins/virsh/tasks/bridged_network.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n# https://jamielinux.com/docs/libvirt-networking-handbook/bridged-network.html#bridged-network\n- name: validate required nic is present\n  ^ here\n"}

- name: create bridged network

    - name: create bridged network
      include_tasks: tasks/bridged_network.yml
      vars:
          nic_settings: "{{ item }}"
          nic_data: "{{ (item.nic == '') | ternary(hostvars[inventory_hostname]['ansible_' + ansible_default_ipv4.interface],
              hostvars[inventory_hostname]['ansible_' + item.nic]|default('')) }}"
      with_items:
          "{{ networks.values() | selectattr('forward', 'defined') | selectattr('forward', 'equalto', 'bridge') | list }}"
      when: "networks is defined"

msg: "Cannot find bridge nic: {{ nic_name }}"

- name: validate required nic is present
  fail:
      msg: "Cannot find bridge nic: {{ nic_name }}"
  when: nic_data == ''

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions