title: ansible unable to find or access script
body: <p>I have an ansible playbook containing the following code:</p>
  
  <pre><code>---
  - name: This is an example of successfully running a command on a server
  hosts: user@myServer
    tasks:
    - name: create the file ansibleMadeThis
      command: touch ansibleMadeThis
  </code></pre>
  
  <p>I have set up ssh keys and when I run this playbook a file is made on myServer</p>
  
  <p>However I would like to run a script on the server, so I read about the script module <a href="https://docs.ansible.com/ansible/latest/modules/script_module.html" rel="nofollow noreferrer">here</a> and wrote this playbook:</p>
  
  <pre><code>---
  - name: This is an attempt to run a script called script.sh on a remote server
    hosts: user@myServer
    tasks:
    - name: Run script
      script: /home/user/script.sh
  </code></pre>
  
  <p>On the server I have a script in ~ (aka /home/user) called script.sh. script.sh contains the following:</p>
  
  <pre><code>touch ansibleCalledTheScriptThatMadeThis
  </code></pre>
  
  <p>When logged into the server myself as user, running this script works fine, however when I run the playbook with the following command I get the following error:</p>
  
  <pre><code>ansible-playbook runScript.yml
  </code></pre>
  
  <p>error message:</p>
  
  <pre><code>fatal: [user@myServer]: FAILED! =&gt; {"changed": false, "msg": "Could not find or access '/home/user/script.sh' on the Ansible Controller.\nIf you are using a module and expect the file to exist on the remote, see the remote_src option"}
  </code></pre>
  
  <p>Also I have tried running the following:</p>
  
  <pre><code>---
  - name: This is an attempt to run a script called script.sh on a remote server
    hosts: user@myServer
    tasks:
    - name: Run script
      command: /home/maxdeploy/script.sh
  </code></pre>
  
  <p>However it gives me this error:</p>
  
  <pre><code>fatal: [user@server]: FAILED! =&gt; {"changed": false, "cmd": "/home/user/script.sh", "msg": "[Errno 8] Exec format error", "rc": 8}
  </code></pre>
  
  <p>Please note that I have the permissions on the file script.sh set to 777 (I did chmod 777 script.sh) so there shouldn't be any permissions problems.</p>