2023-03-18 22:52:37 +05:30
|
|
|
---
|
|
|
|
- name: Install shit
|
2023-03-18 00:06:52 +05:30
|
|
|
hosts: ansibletest
|
|
|
|
tasks:
|
2023-03-18 22:52:37 +05:30
|
|
|
- name: Std Repo stuff
|
|
|
|
apt:
|
|
|
|
update_cache: true
|
|
|
|
name:
|
|
|
|
- vim
|
|
|
|
- curl
|
|
|
|
- wget
|
|
|
|
- sudo
|
|
|
|
- name: Add users
|
|
|
|
hosts: ansibletest
|
|
|
|
vars:
|
|
|
|
users:
|
|
|
|
- akis
|
|
|
|
- arya
|
|
|
|
- devrand
|
|
|
|
- midou
|
|
|
|
tasks:
|
|
|
|
- name: Add user
|
|
|
|
ansible.builtin.user:
|
|
|
|
name: "{{ item }}"
|
|
|
|
group: users
|
|
|
|
groups: users,sudo
|
|
|
|
password: $1$cGVmF3CO$CoJyouR8KHiol1xm8zF3l.
|
|
|
|
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"
|