-
Notifications
You must be signed in to change notification settings - Fork 0
/
init_once.yml
22 lines (22 loc) · 855 Bytes
/
init_once.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
- hosts: all
remote_user: alarm
become: yes
become_method: su
tasks:
- group: name="{{ localuser }}" gid=1001 state=present
- user: name={{ localuser }} group={{ localuser }} groups=log append=yes generate_ssh_key=yes ssh_key_bits=2048 ssh_key_file=.ssh/id_rsa password={{ prompt_pass | password_hash('sha512') }}
- name: copy sudoers file for {{ localuser }}
copy: content="{{ localuser }} ALL=(ALL) ALL" dest=/etc/sudoers.d/{{ localuser }} owner=root group=root mode=0644
- name: set root password
user:
name: root
password: "{{ prompt_pass_root | password_hash('sha512') }}"
vars_prompt:
- name: "prompt_pass"
prompt: "Enter a password for the localuser"
private: yes
confirm: yes
- name: "prompt_pass_root"
prompt: "Enter a password for root"
private: yes
confirm: yes