Hi All,
Can someone give an idea about to run the script in local? My script having
yes/no question. If I give "Yes" it'll run the script, "NO" it will
terminate the script. So I need a playbook to execute this scenario. It's
quite an urgency.
- hosts: test
tasks:
- name: Running Script
run_once: true
local_action: script /data/scripts/script.sh
register: history
I have tried above playbook. it's not working and the throwing the error
ansible-playbook testing.yml
PLAY [test]
************************************************************************************************************************************************************************************************
TASK [Gathering Facts]
*************************************************************************************************************************************************************************************
ok: [unixpgtest1]
TASK [Running Script]
*************************************************************************************************************************************************
fatal: [unixpgtest1 -> localhost]: FAILED! => {"changed": true, "msg":
"non-zero return code", "rc": 1, "stderr": "", "stdout": "\u001b[5m
############################################################\n\u001b[15m
Hello Admin... Welcome to Script\n\u001b[5m
############################################################\n\u001b[0m\n\nNo
server Arguments to the script are found.\n\nThe script will use the
servers mentioned in the file \"\".\n\nBelow are the servers mentioned in
the file /data/scripts/OS_PATCHING/Patching_Servers.txt\nunixpgtest1 test
auto \n\n\nExiting....\n", "stdout_lines": ["\u001b[5m
############################################################", "\u001b[15m
Hello Admin... Welcome to Script", "\u001b[5m
############################################################", "\u001b[0m",
"", "No server Arguments to the script are found.", "", "The script will
use the servers mentioned in the file \"\".", "", "Below are the servers
mentioned in the file", "unixpgtest1 test auto ", "", "", "Exiting...."]}
NO MORE HOSTS LEFT
*****************************************************************************************************************************************************************************************
to retry, use: --limit @/etc/ansible/playbook/testing.retry
PLAY RECAP
*************************************************************************************************************************************************************************************************
unixpgtest1 : ok=1 changed=0 unreachable=0 failed=1
--
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/65398e2b-7308-4507-bce8-0589db811320%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.