2024-10-01 12:14:51 +00:00
|
|
|
- name: Generate a random root password
|
|
|
|
set_fact:
|
2024-10-07 17:29:20 +00:00
|
|
|
root_password: "{{ lookup('password', '/dev/null length=18 chars=ascii_letters,digits') }}"
|
2024-10-07 16:39:47 +00:00
|
|
|
- name: Save root password into Passbolt
|
2024-10-07 16:42:54 +00:00
|
|
|
set_fact:
|
2024-10-07 16:39:47 +00:00
|
|
|
msg: >
|
|
|
|
{{
|
|
|
|
lookup(passbolt, inventory_hostname_short,
|
|
|
|
username='root',
|
|
|
|
password=root_password,
|
2024-10-07 17:26:29 +00:00
|
|
|
uri='ssh://'+hostname_fqdn
|
2024-10-07 16:39:47 +00:00
|
|
|
)
|
|
|
|
}}
|
|
|
|
environment:
|
|
|
|
PASSBOLT_CREATE_NEW_RESOURCE: true
|
|
|
|
- name: Save the root password to file
|
2024-10-01 12:14:51 +00:00
|
|
|
copy:
|
|
|
|
content: "{{ root_password }}\n"
|
|
|
|
dest: /root/root_password.txt
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: '0600'
|
|
|
|
- name: Change root password
|
|
|
|
user:
|
|
|
|
name: root
|
|
|
|
password: "{{ root_password | password_hash('sha512') }}"
|