I write playbook Copy my bash script to remote host & run it, but on second task i have problem:
TASK [Activate bash script] *****************************************************************************************************************
fatal: [hostname]: FAILED! => {"changed": false, "msg": "Could not find or access 'sh'\nSearched in:\n\t/home/ansible/ansible/playbooks/files/sh\n\t/home/ansible/ansible/playbooks/sh\n\t/home/ansible/ansible/playbooks/files/sh\n\t/home/ansible/ansible/playbooks/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"}
My playbook:
---
- name: install sh script - db cleaner
hosts: all
vars:
ansible_become_user: root
ansible_become_password: password
ansible_become_method: sudo
gather_facts: false
tasks:
- name: Install bash script
raw: wget "http://ip/clear_db_duplo.sh" -O /mnt/azimuth-data/temp/clear_db_duplo.sh && chmod +x /mnt/azimuth-data/temp/clear_db_duplo.sh
- name: Activate bash script
become: yes
script: sh /mnt/azimuth-data/temp/clear_db_duplo.sh
On local use after copy this script are executed
try to use
command:
script:
raw:
I believe you want: