Generic remote user name

set_fact: user_name is needed to display the var value in the task name
This commit is contained in:
Sebastian Haderecker 2019-06-30 14:25:24 +00:00
parent ec7c6a4ba4
commit 399d0e1e6e

View file

@ -13,12 +13,13 @@
- name: Prepare to set user password - name: Prepare to set user password
set_fact: set_fact:
user_name: "{{ ansible_user }}"
user_password: "{{ linux_pass }}" user_password: "{{ linux_pass }}"
user_salt: "s0mew1ck3dTpoT" user_salt: "s0mew1ck3dTpoT"
- name: Changing password for user linux to {{ user_password }} - name: Changing password for user {{ user_name }} to {{ user_password }}
user: user:
name: "linux" name: "{{ ansible_user }}"
password: "{{ user_password | password_hash('sha512', user_salt) }}" password: "{{ user_password | password_hash('sha512', user_salt) }}"
state: present state: present
shell: /bin/bash shell: /bin/bash