I am trying to run an ansible script to execute a script using the shell module, and it completes the ansible playbook with a status of 'SUCCESS', but the script has not been executed for some reason.
Playbook:
- hosts: '{{ hosts }}'
tasks:
- name: Copy a dummy file to /tmp folder
command: "cp /apps/tomcat-web/LICENSE /tmp/LICENSE-{{ ansible_date_time.iso8601 }}"
- name: Start email service
shell: ./start.sh >> /tmp/log.txt
args:
chdir: /email-service/
Console Output:
+ ansible-playbook deploy/test-ansible.yml --extra-vars hosts=mut
PLAY [mut] ****************************************************************
TASK [setup] *******************************************************************
ok: [ftp2]
TASK [Copy a dummy file to /tmp folder] ****************************************
changed: [ftp2]
TASK [Start email service] *****************************************************
changed: [ftp2]
PLAY RECAP *********************************************************************
ftp2 : ok=3 changed=2 unreachable=0 failed=0
Finished: SUCCESS
The first step in the playbook (creating a license file) is being done properly. But the second step (executing start.sh) is not being done. Can anyone explain? Will be much appreciated.
Note: The script's full path is /email-service/start.sh Thanks!
-vvvto see what's happening withstart.sh.