Make bootstrap more idempotent

No need to touch the sudoers.d file each time
Creation and mode setting is handled by lineinfile itself

Change-Id: Ia36e21b04d3a08fab3c748f6298f142c1d73ee6d
Signed-off-by: Radosław Piliszek <radoslaw.piliszek@gmail.com>
This commit is contained in:
Radosław Piliszek 2019-06-06 12:34:17 +02:00
parent 41e634e204
commit c8a57d0c19

View File

@ -16,18 +16,12 @@
become: True
when: create_kolla_user | bool
- name: Create sudoers profile for user kolla
file:
path: /etc/sudoers.d/kolla-ansible-users
state: touch
mode: "0640"
become: True
when: create_kolla_user_sudoers | bool
- name: Grant kolla user passwordless sudo
lineinfile:
dest: /etc/sudoers.d/kolla-ansible-users
state: present
create: yes
mode: '0640'
regexp: '^{{ kolla_user }}'
line: '{{ kolla_user }} ALL=(ALL) NOPASSWD: ALL'
become: True