Can I write a shell script in handler and call it again and again?
Hi Shantanu,
A handler is just like any other task, so you can use the “shell” module to run shell commands. If you script is small, you can just include it in-line, like this:
name: my script
shell: |
echo line 1
echo more stuff {{ variable }}
cd /some/dir
do stuff
if [ condition ]; then action; fi
Regards,
Anand