I've run into a bit of a brick wall with Ansible.
As part of my playbook I've created an "application daemon" user. This user is responsible for running any software deployed to the provisioned machine. Its not a sudoer.
I'm trying to execute some post deployment tasks and one of them is to run a program I've installed as the application user. Everything else in the playbook is executed as root (using sudo from vagrant user) e.g.
---
- hosts: vagrant
sudo: true
sudo_user: root
To run the program I'm using the shell module e.g.
- shell: node cli <job-name>
sudo_user: <appuser>
sudo: true
However, it hangs.
I can verify that it works normally by sshing to my vm as vagrant and then sudo to <appuser>. I'm using the -i flag to ensure <appuser> environment is loaded (~/.profile)
I'm fairly positive the issue lies with it still asking me for a password.
If I dont sudo in the task, then it will run it as root but the environmental variables I need are not set.
Can anyone elighten me at the actual command Ansible runs when using the sudo flag?
Any help would be greatly appreciated!