I am developing a web interface that will eventually be fetching information using ansible jobs.
The language I am using for the web interface is PHP.
I am trying to write a PHP script that will run an ansible playbook and eventually return the jobs results on my screen.
The question is PHP script is running everything as apache user. How can I switch over to ansible user inside my php flow.
My php script looks like:
<?php chdir('/home/ansible/ansible'); $output = shell_exec('pwd'); echo "$output"; shell_exec('ansible-playbook si-report-api-count.yml -i production'); $output = shell_exec('cat /tmp/log'); echo "
$output"; ?>
When I run this, it doesnt run the playbook. Im suspecting that the apache user cant do that. It is not even switching over to the ansible directory.
Any ideas?