On Mon, 18 Sept 2023 at 21:43, 'Ansible Project' via Ansible Project <
[email protected]> wrote:

> Hi - I'm trying to use the ansible.builtin.user module to set the user's
> password as it creates a new user account. My task contains:
>
> - name: Create oracle user
>   ansible.builtin.user:
>     name: oracle
>     state: present
>     uid: 54321
>     group: oinstall
>     groups: dba,asmdba,backupdba,dgdba,kmdba,racdba
>     password: "{{ 'ansible_password' | password_hash('sha512'),
> 'mysecretsalt' }}"
>
> The value of 'ansible_password' is set in the inventory file; the password
> contains letters, numbers and special characters.
>

The code you posted uses the quoted literal string 'ansible_password' as
the password.
If you want the use the variable, then don't use quotes:

     password: "{{ ansible_password | password_hash('sha512'),
'mysecretsalt' }}"

Another problem could be that the variable name you picked is reserved:
https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#connecting-to-hosts-behavioral-inventory-parameters
So pick something else, for example oracle_user_password.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAF8BbLZmK%2BY%2B05YAeRTUA6WoN7wS__YJsBQ2LN4K%3De0vpotdZA%40mail.gmail.com.

Reply via email to