Compare commits

..

No commits in common. "1c03d6fc0ce37bb53a56ff7b3a8b2cf75f210c0d" and "8c184e269e3f733ef409b8e2d2add8aa12aa5b69" have entirely different histories.

5 changed files with 27 additions and 41 deletions

View File

@ -1,7 +1,4 @@
---
distributed:
children:
pangolin:
hosts:
mini1:
ansible_host: 172.104.128.23

View File

@ -1,5 +1,4 @@
---
ansible_user: ansible
to_set_authorized_keys:
- label: hassallah
key: "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEArNhKFcJ6T08sn7kTTLf+rO9HEvgOvqfhv5HQ2sRf2tFYfjfCb0zHKnMkgW+sy5gMU10Lyx1r7juXCvqRC955uIM97m1B1Xc6sVqASVKuGPhCKfhxEaMAyBcWFdE+HYbCOPYVN+JMrcwWfbblwiZTtK1OCqaEUvDDI7cFeU68noXwggEp46T48eqMUdi541D9Y+BVx9HYAo6OCQz0+6eXwxJL+tpRcAAXIMMWv362CYHoOgIU45R7xVSMLY1k/HLrcEAblwxEaSpduCH5cWUXZE/56IyxpvP44BxZkVhNdqJLmg4hxBQWhoMNYiTZxbLay3W2TwBCM111cAtUx4M/jQ=="
ansible_authorized_keys:
- label : hassallah
key: ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEArNhKFcJ6T08sn7kTTLf+rO9HEvgOvqfhv5HQ2sRf2tFYfjfCb0zHKnMkgW+sy5gMU10Lyx1r7juXCvqRC955uIM97m1B1Xc6sVqASVKuGPhCKfhxEaMAyBcWFdE+HYbCOPYVN+JMrcwWfbblwiZTtK1OCqaEUvDDI7cFeU68noXwggEp46T48eqMUdi541D9Y+BVx9HYAo6OCQz0+6eXwxJL+tpRcAAXIMMWv362CYHoOgIU45R7xVSMLY1k/HLrcEAblwxEaSpduCH5cWUXZE/56IyxpvP44BxZkVhNdqJLmg4hxBQWhoMNYiTZxbLay3W2TwBCM111cAtUx4M/jQ==

View File

@ -1,10 +0,0 @@
$ANSIBLE_VAULT;1.1;AES256
63363932663263346563646533323931303266346338383735666332363465373331653562663262
3837343464366635373863353833316532663539303938310a623664663134633033613839343835
32646630616663323035313563376133396563666434336561363930643832663763353136336135
6630656261323031610a626134346232383266343962393262353962613533373931656561396666
36616666383135663133646462333134653461326634336463353234383632396461663866383836
64316464626236663163323535643734633539653733353039336337626661373234356562653464
62613965616138633234396236656465316663616438326265356363623037663238656464633236
34663832343031663136643063356330366564393362643238386364373461396636363637346434
3937

View File

@ -1,36 +1,35 @@
---
- name: Bootstrap node
hosts: all
become: true
- hosts: all
become: yes
#debugger: on_failed
tasks:
- name: Add the ansible group
ansible.builtin.group:
group:
name: ansible
gid: "1100"
gid: 1100
state: present
- name: Add the ansible user as a system user
ansible.builtin.user:
user:
name: ansible
uid: "1100"
uid: 1100
group: ansible
# Directly generate hash
# Directly generate hash
# https://www.lisenet.com/2019/ansible-generate-crypted-passwords-for-the-user-module/
password: "{{ ansible_crypted_password | password_hash('sha512') }}"
shell: /bin/bash
# Uncomment to prevent password reset
update_password: on_create
system: true
system: yes
home: /home/ansible
state: present
- name: Set ansible user as sudoer
ansible.builtin.copy:
copy:
content: "ansible ALL = (ALL) NOPASSWD:ALL"
dest: /etc/sudoers.d/ansible
owner: root
group: root
mode: "0440"
mode: 0440
- name: Init cache directory
@ -50,21 +49,22 @@
mode: u=rwx,g=rw,o=r
# Inserts public keys of allowed externals users to log in as ansible
# Inserts public keys of allowed externals users to log in as ansible
# e.g. fabio
- name: Create the .ssh directory
ansible.builtin.file:
path: /home/ansible/.ssh
file:
path: /home/ansible/.ssh
owner: ansible
group: ansible
mode: "0700"
mode: 0700
state: directory
- name: Add the mandatory ssh keys to the ansible user
ansible.builtin.template:
src: templates/ansible_auth_keys.j2
dest: /home/ansible/.ssh/authorized_keys
owner: ansible
group: ansible
mode: "0600"
template:
src: templates/ansible_auth_keys.j2
dest: /home/ansible/.ssh/authorized_keys
owner: ansible
group: ansible
mode: 0600

View File

@ -1,4 +1,4 @@
{% for item in to_set_authorized_keys %}
{{ '#' }} Key for {{ item.label }}
{{ item.key }}
{{ item.Key }}
{% endfor %}