Host password change via Ansible?

During the installation the Root Password of the host is set and will be used from the input form of “Host Root Password” on the Ansible GUI. Is there any chance to change this password in the GUI and use the value of this variable then in Ansible Roles / Playbooks? How I can do this?

Here in the forum I only found, that this would be possible with Puppet ENC, but we are not using Puppet for history reasons…

Thanks and have a nice day

Tobias

I resolved this issue on my own. If anyone comes across this question and would like to solve it as well, here is the solution:

Ansible is using the foreman variables per default. The variable “{{ foreman }}” has some interesting items, one of them is root_pw. So we can use this:

- name: Change Root Password
  ansible.builtin.user:
    name: "root"
    state: present
    password: "{{ foreman.root_pw }}"

in a task of a role and then the root password will be changed to the entry in the OS Tab of the Host in the ForeMan WebGUI