Maybe finish lineinfile part of libvirt role

This commit is contained in:
Tunui Franken 2022-03-04 09:29:29 +01:00
parent 65eb7c0701
commit 80785e3cd1

View file

@ -21,9 +21,17 @@
append: yes
groups: libvirt
- name: Check if "libvirt libvirt_guest" is in /etc/nsswitch.conf
- 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
register: presence
- name: Put 'libvirt libvirt_guest' in /etc/nsswitch.conf
become: true
# TODO: this keeps adding the line over and over again
lineinfile:
path: /etc/nsswitch.conf
regexp: '^hosts: (.+)'
@ -31,3 +39,4 @@
state: present
backrefs: true
backup: true
when: presence.changed