Problem:
I want to execute a command on remote host with the shell Ansible module and i need to execute this command with specific user like that:
- name: test
become: yes
become_user: {{ my_user }}
shell: |
whoami >> /home/fic.txt
But whoami return me that i executed the command with root user while the variable “user” value is not root.
How i can execute command with specific user with Ansible playbook from job template?
Versions
foreman_ansible 2.1.2
remote_execution 1.7