I have this TASK in a playbook which should install a bunch of packages on my (rhel8) target rrequired for postgresql
I am shooting my playbok as a user with root priviledges via sudo
In earlier TASKS of the playbook I become a ‘postgres’ user, but would expect this to be ephemeral (so I become the intital user as soon a TASK is finished)
still I am getting an (inexplicable to me) error upon running this playbook, which seems to indicate I am not a root-capable user when trying to install those packages.
* I have this TASK in a playbook <https://pastebin.com/h83HqMn0> which should install a bunch of packages on my (rhel8) target rrequired for postgresql
*
I am shooting my playbok as a user with root priviledges via sudo
Please show the code that you are using for that user in your playbook.
*
In earlier TASKS of the playbook I become a 'postgres' user, but would expect this to be ephemeral (so I become the intital user as soon a TASK is finished)
* I have this TASK in a playbook <https://pastebin.com/h83HqMn0> which should install a bunch of packages on my (rhel8) target rrequired for postgresql
*
I am shooting my playbok as a user with root priviledges via sudo
Please show the code that you are using for that user in your playbook.
actually I figured out in the meantime that aparently my trouble lies exactly there:
I have a defaults.yaml that injects a bunch of variables into the playbook.
In that defaults.yml there is a variable referencing to user ‘postgres’ as ansible_become_user
ansible_become_user: postgres
So I assume I’ll have to figure out how to utilize different become users in a single playbook. I tried or overrule the defaults entry temporarily with …
become: yes
become_user: [root_user]
… inside the TASK, but that apparently was not interpreted in the way I wanted
Sorry, I wanted to see the head of the playbook respective the place in inventory where you set up the
become: variables.
actually I figured out in the meantime that aparently my trouble lies exactly there:
I have a defaults.yaml that injects a bunch of variables into the playbook.
In that defaults.yml there is a variable referencing to user 'postgres' as ansible_become_user
ansible_become_user: postgres
So I assume I'll have to figure out how to utilize different become users in a single playbook. I tried or overrule the defaults entry temporarily with ...
become: yes
become_user: [root_user]
... inside the TASK, but that apparently was not interpreted in the way I wanted
The default for the become_user should be root and you can override it in your tasks.