my ansible command won't run using shell_exec function in php but the other commands like ls, pwd works just fine note that my php code is hosted on nginx web server and i am logged in as a 'user' in both machines my local machine and my remote server which has this name 'dockerengine'
<%php
shell_exec("ansible dockerengine -m shell -a 'echo hello > /home/user/hello.txt'")
%>
when i execute the command ansible dockerengine ... (dockerengine is my remote server) in terminal it works perfectly
note also i configured ssh keys and sudoers file on my remote server to escalate privileges auto
//this code contained in a file with root priv hosted on nginx
<%php shell_exec("ansible dockerengine -m shell -a 'echo hello > /home/user/hello.txt'") %>
// this line is written in the sudoers file of my remote server (dockerengine)
user ALL=(ALL) NOPASSWD:ALL
// this line is written in the /etc/ansible/hosts file in my local machine
[docker]
dockerengine ansible_user=user