incorporate sudo in common role

This commit is contained in:
2022-04-17 14:38:46 +02:00
parent 231bc6752e
commit 645128198e
4 changed files with 17 additions and 24 deletions

View File

@ -33,6 +33,22 @@
owner: ansible
group: ansible
- name: Check if ansible is already nopasswd in sudoers
lineinfile:
state: absent
path: /etc/sudoers
regexp: "^ansible"
check_mode: true
changed_when: false
register: checkallowusers
- name: Define ansible nopasswd in sudoers
lineinfile:
state: present
path: /etc/sudoers
line: "ansible ALL=(ALL:ALL) NOPASSWD"
when: checkallowusers.found == 0
- name: "Update authorized_keys of tormakris"
ansible.posix.authorized_key:
user: tormakris