Try libvirt nsswitch with grep

This commit is contained in:
flyingscorpio@clevo 2022-03-05 00:23:35 +01:00
parent 80785e3cd1
commit ebbc0ad3ec

View file

@ -22,13 +22,9 @@
groups: libvirt
- name: Check if 'libvirt libvirt_guest' is in /etc/nsswitch.conf
become: true
lineinfile:
path: /etc/nsswitch.conf
line: libvirt libvirt_guest
state: present
check_mode: true
command: grep -c 'libvirt libvirt_guest' /etc/nsswitch.conf
register: presence
changed_when: presence.stdout == '0'
- name: Put 'libvirt libvirt_guest' in /etc/nsswitch.conf
become: true
@ -39,4 +35,4 @@
state: present
backrefs: true
backup: true
when: presence.changed
when: presence.stdout == '0'