init
This commit is contained in:
commit
883f31932e
169 changed files with 5676 additions and 0 deletions
35
ansible/roles/host/tasks/setup-admin.yml
Normal file
35
ansible/roles/host/tasks/setup-admin.yml
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
-
|
||||
name: Create admin user
|
||||
user:
|
||||
name: "{{ admin_user }}"
|
||||
shell: "{{ admin_shell }}"
|
||||
groups: sudo
|
||||
append: yes
|
||||
create_home: yes
|
||||
|
||||
-
|
||||
name: Allow admin user passwordless sudo
|
||||
copy:
|
||||
dest: "/etc/sudoers.d/{{ admin_user }}"
|
||||
content: "{{ admin_user }} ALL=(ALL) NOPASSWD:ALL\n"
|
||||
mode: "0440"
|
||||
validate: "visudo -cf %s"
|
||||
|
||||
-
|
||||
name: Find SSH public keys
|
||||
find:
|
||||
paths: "{{ ssh_pubkey_dir }}"
|
||||
patterns: "*.pub"
|
||||
delegate_to: localhost
|
||||
become: no
|
||||
register: ssh_pubkeys
|
||||
|
||||
-
|
||||
name: Deploy SSH authorized keys
|
||||
authorized_key:
|
||||
user: "{{ admin_user }}"
|
||||
key: "{{ lookup('file', item.path) }}"
|
||||
loop: "{{ ssh_pubkeys.files }}"
|
||||
loop_control:
|
||||
label: "{{ item.path | basename }}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue