diff --git a/roles/base/tasks/main.yml b/roles/base/tasks/main.yml index 56204e4aa2..d32afb8b8c 100644 --- a/roles/base/tasks/main.yml +++ b/roles/base/tasks/main.yml @@ -76,29 +76,12 @@ changed_when: false failed_when: 'if_uuid.stdout == ""' check_mode: no - when: ansible_distribution_major_version|int >=7 and ansible_distribution == 'RedHat' and nmclitest is success and ( not ansible_ifcfg_blacklist ) + when: ansible_distribution_major_version|int >=7 and nmclitest is success and ( not ansible_ifcfg_blacklist ) tags: - config - ifcfg - base -- name: get interface uuid - shell: nmcli -f "DEVICE,UUID" c show --active | grep -E '^eth|^br|^em' - register: if_uuid - changed_when: false - failed_when: 'if_uuid.stdout == ""' - check_mode: no - when: ansible_distribution_major_version|int >=29 and ansible_distribution == 'Fedora' and nmclitest is success and ( not ansible_ifcfg_blacklist ) - tags: - - config - - ifcfg - - base - -- name: debug - debug: var=if_uuid - tags: - - base - - name: copy ifcfg files - non virthost template: src=ifcfg.j2 dest=/etc/sysconfig/network-scripts/ifcfg-{{item}} mode=0644 with_items: diff --git a/roles/base/templates/ifcfg.j2 b/roles/base/templates/ifcfg.j2 index 7658f72d6b..0e7ba2b861 100644 --- a/roles/base/templates/ifcfg.j2 +++ b/roles/base/templates/ifcfg.j2 @@ -22,7 +22,7 @@ ONBOOT="yes" {% endif %} TYPE="Ethernet" DEVICE="{{item}}" -{% for line in if_uuid['stdout_lines'] %} +{% for line in if_uuid.stdout_lines %} {% if line.split()[0] == item %} UUID="{{ line.split()[1] }}" {% endif %}