I have an existing unix shell script that does ssh to connect to remote servers to search FAILED key word through logs on the remote server. If the logs contain FAILED key word, sftp to the servers to bring the logs to a central server and analyzes them.
Now we want to launch the unix script from Ansible or in the future from Ansible Tower.
Ansible shell, script and command modules are to copy or run UNIX script on remote servers not on Ansible server. In my case, I don’t want to copy the script to run on remote servers. I want to run the script on Ansible server. Is there a way to accomplish this in Ansible? Thanks.
After I changed the host to local host name in hosts field of yml file. I ran it without error but I don’t see it get logs from remote servers to local /tmp directory. If I ran UNIX script, it takes logs to local /tmp/ directory from remote server.
That is most likely because your script assume some environment variables is set that is not set when using ssh with non-interactive shell.
Since you are using ansidev instead of localhost Ansible most likely is login in to the server with ssh(depending on you inventory).
If using ssh then you are running it under an non-interactive shell that has very few environment variables set.