Compare commits
5 commits
927b6604c9
...
e8b686c8a8
| Author | SHA1 | Date | |
|---|---|---|---|
| e8b686c8a8 | |||
| aa1860f9ef | |||
| a975c0e2e1 | |||
| a2149bd04c | |||
| 6ce9918171 |
4 changed files with 44 additions and 0 deletions
5
hosts
Normal file
5
hosts
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
[testing]
|
||||
test.band-on.com
|
||||
|
||||
[production]
|
||||
band-on.com
|
||||
15
playbook.yml
Normal file
15
playbook.yml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
- hosts: production
|
||||
become: true
|
||||
# vars_files:
|
||||
# - vars/production/users.yml
|
||||
roles:
|
||||
- users
|
||||
- hosts: testing
|
||||
become: true
|
||||
# vars_files:
|
||||
# - vars/testing/users.yml
|
||||
roles:
|
||||
- users
|
||||
|
||||
|
||||
1
roles/users/files/sudo_group_admins
Normal file
1
roles/users/files/sudo_group_admins
Normal file
|
|
@ -0,0 +1 @@
|
|||
%admins ALL=(ALL) NOPASSWD: ALL
|
||||
23
roles/users/tasks/main.yml
Normal file
23
roles/users/tasks/main.yml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
- name: Ensure group "admins" exists
|
||||
# include_tasks: create_groups.yml
|
||||
ansible.builtin.group:
|
||||
name: admins
|
||||
state: present
|
||||
tags: groups
|
||||
|
||||
- name: Grant sudo without PW to admins group
|
||||
ansible.builtin.file:
|
||||
src: roles/users/files/sudo_group_admins
|
||||
path: /etc/sudoers.d/admins
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0440'
|
||||
|
||||
- name: Ensure user "rulrich" exists
|
||||
ansible.builtin.user:
|
||||
name: rulrich
|
||||
shell: /bin/bash
|
||||
groups: admins
|
||||
append: yes
|
||||
ssh_public_key: "'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEecPevXnWu9Rs7QhDFAdeKl/E6cBPwUno+nEd4qoUAK rulrich@rabbit'\n"
|
||||
Loading…
Add table
Reference in a new issue