base: collapse second uuid getter
Signed-off-by: Rick Elrod <relrod@redhat.com>
This commit is contained in:
parent
1f1fda4b3e
commit
e0fab09b47
2 changed files with 2 additions and 19 deletions
|
@ -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:
|
||||
|
|
|
@ -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 %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue