53 lines
1.1 KiB
YAML
53 lines
1.1 KiB
YAML
---
|
|
- name: Install shit
|
|
hosts: ansibletest
|
|
tasks:
|
|
- name: Std Repo stuff
|
|
apt:
|
|
update_cache: true
|
|
name:
|
|
- vim
|
|
- curl
|
|
- wget
|
|
- sudo
|
|
- net-tools
|
|
- nmap
|
|
- name: Add users
|
|
hosts: ansibletest
|
|
vars:
|
|
users:
|
|
- akis
|
|
- arya
|
|
- devrand
|
|
- midou
|
|
vars_prompt:
|
|
- name: password
|
|
prompt: What is password to be used for all accs?
|
|
encrypt: sha512_crypt
|
|
confirm: true
|
|
salt_size: 6
|
|
|
|
tasks:
|
|
- name: Add user
|
|
ansible.builtin.user:
|
|
name: "{{ item }}"
|
|
group: users
|
|
groups: users,sudo
|
|
password: "{{ password }}"
|
|
shell: /bin/bash
|
|
update_password: on_create
|
|
with_items:
|
|
- "{{ users }}"
|
|
- name: "Add authorized keys"
|
|
authorized_key:
|
|
user: "{{ item }}"
|
|
key: "{{ lookup('file', 'files/'+ item + '.pub') }}"
|
|
with_items:
|
|
- "{{ users }}"
|
|
- name: "Allow admin users to sudo without a password"
|
|
lineinfile:
|
|
dest: "/etc/sudoers" # path: in version 2.3
|
|
state: "present"
|
|
regexp: "^%sudo"
|
|
line: "%sudo ALL=(ALL) NOPASSWD: ALL"
|