Here is the problem statement for the task:
On jump host
itself there is a list of users in ~/playbooks/data/users.yml
file and there are two groups — admins
and developers
—that have list of different users. Create a playbook ~/playbooks/add_users.yml
on jump host
to perform the following tasks on app server 3
in Stratos DC
.
a. Add all users given in the users.yml
file on app server 3
.
b. Also add developers
and admins
groups on the same server.
c. As per the list given in the users.yml
file, make each user member of the respective group they are listed under.
d. Make sure home directory for all of the users under developers
group is /var/www
(not the default i.e /var/www/{USER}
). Users under admins
group should use the default home directory (i.e /home/devid
for user devid
).
e. Set password ksH85UJjhb
for all of the users under developers
group and TmPcZjtRQx
for of the users under admins
group. Make sure to use the password given in the ~/playbooks/secrets/vault.txt
file as Ansible vault password to encrypt the original password strings. You can use ~/playbooks/secrets/vault.txt
file as a vault secret file while running the playbook (make necessary changes in ~/playbooks/ansible.cfg
file).
f. All users under admins
group must be added as sudo users. To do so, simply make them member of the wheel
group as well.
Here is my issue and question:
For setting the password, it seems the task only passes if we set the following in the playbook under the ansible “user” module:
password: “{{ ‘ksH85UJjhb’ | password_hash(‘sha512’) }}”
My question is, what is the point of encrypting a password with a password stored in a vault if we are going to show the password in plain-text in the playbook?