Hi, all

We have an application stop/start script that starts/stops application 
without root privilege and with 'sudo'. 
If I am on the host, I login as the application user and then run the 
script to stop/start application as 'sudo application_stop_start.sh 
stop/start'.

On the ansible server (v2.7), I created a simple test file. The application 
user ID is the same on ansible host and remote node (ssh authentication has 
no problem)

  tasks:
    - name: run script to stop/start application
      command: sudo /usr/local/bin/application_stop_start.sh stop

It ran successfully on the remote host with a warning message.

PLAY [Stop application] 
*********************************************************************************************************************************************************************************************************************
TASK [Gathering Facts] 
**********************************************************************************************************************************************************************************************************************
ok: [host1]
TASK [run application_stop_start.sh script to stop application] 
**********************************************************************************************************************************************************************************************
 [WARNING]: Consider using 'become', 'become_method', and 'become_user' 
rather than running sudo
changed: [host1]
PLAY RECAP 
**********************************************************************************************************************************************************************************************************************************
host1               : ok=2    changed=1    unreachable=0    failed=0

I don't need 'become' and 'become_user' at least since the UID is the same. 
Tried to use 'become_method = sudo' and remove 'sudo' from 'command: 
/usr/local/bin/application_stop_start.sh stop' and it did not work. Does 
anyone have any suggestions? 
Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ff766cb2-195f-480f-90c8-dea378289399%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to