Merge pull request 'rulrich-setup-ansible1' (#1) from rulrich-setup-ansible1 into main
Reviewed-on: #1
This commit is contained in:
commit
e8b686c8a8
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