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
|
changed_when: false
|
||||||
failed_when: 'if_uuid.stdout == ""'
|
failed_when: 'if_uuid.stdout == ""'
|
||||||
check_mode: no
|
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:
|
tags:
|
||||||
- config
|
- config
|
||||||
- ifcfg
|
- ifcfg
|
||||||
- base
|
- 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
|
- name: copy ifcfg files - non virthost
|
||||||
template: src=ifcfg.j2 dest=/etc/sysconfig/network-scripts/ifcfg-{{item}} mode=0644
|
template: src=ifcfg.j2 dest=/etc/sysconfig/network-scripts/ifcfg-{{item}} mode=0644
|
||||||
with_items:
|
with_items:
|
||||||
|
|
|
@ -22,7 +22,7 @@ ONBOOT="yes"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
TYPE="Ethernet"
|
TYPE="Ethernet"
|
||||||
DEVICE="{{item}}"
|
DEVICE="{{item}}"
|
||||||
{% for line in if_uuid['stdout_lines'] %}
|
{% for line in if_uuid.stdout_lines %}
|
||||||
{% if line.split()[0] == item %}
|
{% if line.split()[0] == item %}
|
||||||
UUID="{{ line.split()[1] }}"
|
UUID="{{ line.split()[1] }}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue