incorporate sudo in common role
This commit is contained in:
parent
231bc6752e
commit
645128198e
@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
- name: "Fix ansible sudo stuff"
|
|
||||||
hosts: all
|
|
||||||
roles:
|
|
||||||
- ansible-sudo
|
|
||||||
...
|
|
@ -1,4 +1,4 @@
|
|||||||
---
|
---
|
||||||
ansible_become: true
|
ansible_become: true
|
||||||
ansible_user: tormakris
|
ansible_user: ansible
|
||||||
...
|
...
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
---
|
|
||||||
- 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
|
|
||||||
...
|
|
@ -33,6 +33,22 @@
|
|||||||
owner: ansible
|
owner: ansible
|
||||||
group: 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"
|
- name: "Update authorized_keys of tormakris"
|
||||||
ansible.posix.authorized_key:
|
ansible.posix.authorized_key:
|
||||||
user: tormakris
|
user: tormakris
|
||||||
|
Loading…
Reference in New Issue
Block a user