Execute a bash script with arguments in Ansible

Viewed 26401

I am new to Ansible. I have a bash script which has three arguments to be passed. I have to run this bash script on the remote server from Ansible.

Basically, I want to declare the hostname, duration and the comment fields as arguments while executing the Ansible command. I don't want to edit the file, as I am doing it from a Slack channel.

- hosts: nagiosserver

  tasks:
   - name: Executing a script
     command: sh /home/aravind/downtime.sh {hostname} {duration} {comments}
1 Answers
Related