1
0
Fork 0
home-ansible/roles/administrators/tasks/main.yml

24 lines
495 B
YAML
Raw Permalink Normal View History

2022-12-21 22:56:39 -05:00
---
- name: Allow passwordless sudo
lineinfile:
path: /etc/sudoers
regexp: '^%sudo'
line: '%sudo ALL=(ALL) NOPASSWD: ALL'
validate: 'visudo -cf %s'
state: present
- name: Add administrators
user:
name: "{{ item }}"
groups: sudo
shell: /bin/bash
state: present
with_items: "{{ users }}"
- name: Add SSH keys
authorized_key:
user: "{{ item }}"
key: "{{ lookup('file', 'files/{{ item }}.pub') }}"
state: present
with_items: "{{ users }}"