59 lines
No EOL
1.4 KiB
YAML
59 lines
No EOL
1.4 KiB
YAML
---
|
|
- name: 'Install required packages'
|
|
pkgng: name={{item}} state=present
|
|
with_items:
|
|
- sudo
|
|
when: ansible_facts['os_family'] == 'FreeBSD'
|
|
|
|
- name: 'Allow wheel group to do passwordless sudo'
|
|
lineinfile:
|
|
dest: /usr/local/etc/sudoers
|
|
state: present
|
|
regexp: '^%wheel'
|
|
line: '%wheel ALL=(ALL) NOPASSWD:ALL'
|
|
validate: visudo -cf %s
|
|
when: ansible_facts['os_family'] == 'FreeBSD'
|
|
|
|
- name: 'Allow wheel group to do passwordless sudo'
|
|
lineinfile:
|
|
dest: /etc/sudoers
|
|
state: present
|
|
regexp: '^%wheel'
|
|
line: '%wheel ALL=(ALL) NOPASSWD:ALL'
|
|
validate: visudo -cf %s
|
|
when: ansible_facts['os_family'] == 'Debian'
|
|
|
|
- name: 'Create users with corresponding groups'
|
|
user:
|
|
name: "{{ item }}"
|
|
groups: users
|
|
with_items: "{{ users }}"
|
|
|
|
- name: 'Add corresponding authorized_keys to each user'
|
|
authorized_key:
|
|
user: "{{ item }}"
|
|
state: present
|
|
key: "{{ lookup('file', 'public_keys/id_{{ item }}.pub') }}"
|
|
with_items: "{{ users }}"
|
|
ignore_errors: yes
|
|
|
|
- name: 'Ensure that wheel group is existing'
|
|
group:
|
|
name: wheel
|
|
state: present
|
|
|
|
- name: 'Add sudoers user to wheel group'
|
|
user:
|
|
name: "{{ item }}"
|
|
groups: wheel
|
|
append: yes
|
|
with_items: "{{ sudoers }}"
|
|
|
|
- name: Copy tmux config
|
|
copy:
|
|
src: files/tmux.conf
|
|
dest: /home/{{ item }}/.tmux.conf
|
|
mode: 0644
|
|
owner: "{{ item }}"
|
|
group: "{{ item }}"
|
|
with_items: "{{ users }}" |