-
Notifications
You must be signed in to change notification settings - Fork 0
/
users.yml
63 lines (54 loc) · 1.48 KB
/
users.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
- hosts: all
become: true
remote_user: ansible
#remote_user: tbowling
vars_files: vault.yml
vars:
ansible_become_password: '{{ my_become_password }}'
#ansible_become_password: "{{ install_password }}"
roles:
tasks:
- name: Configure root
ansible.builtin.user:
name: root
password_lock: true
state: present
- name: Add/configure user myadmin
ansible.builtin.user:
name: myadmin
comment: My Admin
groups: wheel
append: true
password: "{{ demo_password_encrypted }}"
update_password: always
state: present
- name: Add/configure user tbowling
ansible.builtin.user:
name: tbowling
comment: Terry Bowling
groups: wheel
append: true
password: "{{ demo_password_encrypted }}"
update_password: always
state: present
- name: Set authorized key took from file
ansible.posix.authorized_key:
user: "{{ item }}"
state: present
key: "{{ lookup('file', '/home/tbowling/.ssh/id_rsa_demo.pub') }}"
exclusive: true
loop:
- root
- ansible
- myadmin
- tbowling
## Must do this last because become_password changes
- name: Add/configure user ansible
ansible.builtin.user:
name: ansible
groups: wheel
append: true
password: "{{ demo_password_encrypted }}"
update_password: always
state: present