Compare commits
5 Commits
8c184e269e
...
1c03d6fc0c
| Author | SHA1 | Date |
|---|---|---|
|
|
1c03d6fc0c | |
|
|
b9fc6a9e8b | |
|
|
889a74ec3a | |
|
|
5a9ed4ba1a | |
|
|
af712d45d3 |
|
|
@ -1,4 +1,7 @@
|
|||
---
|
||||
distributed:
|
||||
children:
|
||||
|
||||
pangolin:
|
||||
hosts:
|
||||
mini1:
|
||||
ansible_host: 172.104.128.23
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
ansible_authorized_keys:
|
||||
- label : hassallah
|
||||
key: ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEArNhKFcJ6T08sn7kTTLf+rO9HEvgOvqfhv5HQ2sRf2tFYfjfCb0zHKnMkgW+sy5gMU10Lyx1r7juXCvqRC955uIM97m1B1Xc6sVqASVKuGPhCKfhxEaMAyBcWFdE+HYbCOPYVN+JMrcwWfbblwiZTtK1OCqaEUvDDI7cFeU68noXwggEp46T48eqMUdi541D9Y+BVx9HYAo6OCQz0+6eXwxJL+tpRcAAXIMMWv362CYHoOgIU45R7xVSMLY1k/HLrcEAblwxEaSpduCH5cWUXZE/56IyxpvP44BxZkVhNdqJLmg4hxBQWhoMNYiTZxbLay3W2TwBCM111cAtUx4M/jQ==
|
||||
ansible_user: ansible
|
||||
to_set_authorized_keys:
|
||||
- label: hassallah
|
||||
key: "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEArNhKFcJ6T08sn7kTTLf+rO9HEvgOvqfhv5HQ2sRf2tFYfjfCb0zHKnMkgW+sy5gMU10Lyx1r7juXCvqRC955uIM97m1B1Xc6sVqASVKuGPhCKfhxEaMAyBcWFdE+HYbCOPYVN+JMrcwWfbblwiZTtK1OCqaEUvDDI7cFeU68noXwggEp46T48eqMUdi541D9Y+BVx9HYAo6OCQz0+6eXwxJL+tpRcAAXIMMWv362CYHoOgIU45R7xVSMLY1k/HLrcEAblwxEaSpduCH5cWUXZE/56IyxpvP44BxZkVhNdqJLmg4hxBQWhoMNYiTZxbLay3W2TwBCM111cAtUx4M/jQ=="
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
$ANSIBLE_VAULT;1.1;AES256
|
||||
63363932663263346563646533323931303266346338383735666332363465373331653562663262
|
||||
3837343464366635373863353833316532663539303938310a623664663134633033613839343835
|
||||
32646630616663323035313563376133396563666434336561363930643832663763353136336135
|
||||
6630656261323031610a626134346232383266343962393262353962613533373931656561396666
|
||||
36616666383135663133646462333134653461326634336463353234383632396461663866383836
|
||||
64316464626236663163323535643734633539653733353039336337626661373234356562653464
|
||||
62613965616138633234396236656465316663616438326265356363623037663238656464633236
|
||||
34663832343031663136643063356330366564393362643238386364373461396636363637346434
|
||||
3937
|
||||
|
|
@ -1,35 +1,36 @@
|
|||
- hosts: all
|
||||
become: yes
|
||||
#debugger: on_failed
|
||||
---
|
||||
- name: Bootstrap node
|
||||
hosts: all
|
||||
become: true
|
||||
tasks:
|
||||
- name: Add the ansible group
|
||||
group:
|
||||
ansible.builtin.group:
|
||||
name: ansible
|
||||
gid: 1100
|
||||
gid: "1100"
|
||||
state: present
|
||||
|
||||
- name: Add the ansible user as a system user
|
||||
user:
|
||||
ansible.builtin.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: yes
|
||||
system: true
|
||||
home: /home/ansible
|
||||
state: present
|
||||
|
||||
- name: Set ansible user as sudoer
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
content: "ansible ALL = (ALL) NOPASSWD:ALL"
|
||||
dest: /etc/sudoers.d/ansible
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0440
|
||||
mode: "0440"
|
||||
|
||||
|
||||
- name: Init cache directory
|
||||
|
|
@ -49,22 +50,21 @@
|
|||
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
|
||||
file:
|
||||
path: /home/ansible/.ssh
|
||||
ansible.builtin.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
|
||||
template:
|
||||
src: templates/ansible_auth_keys.j2
|
||||
dest: /home/ansible/.ssh/authorized_keys
|
||||
owner: ansible
|
||||
group: ansible
|
||||
mode: 0600
|
||||
|
||||
ansible.builtin.template:
|
||||
src: templates/ansible_auth_keys.j2
|
||||
dest: /home/ansible/.ssh/authorized_keys
|
||||
owner: ansible
|
||||
group: ansible
|
||||
mode: "0600"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{% for item in to_set_authorized_keys %}
|
||||
{{ '#' }} Key for {{ item.label }}
|
||||
{{ item.Key }}
|
||||
{{ item.key }}
|
||||
{% endfor %}
|
||||
Loading…
Reference in New Issue