I want make VM qcow2 image by packer and install some app like docker and kubectl on by ansible. everything is OK and I can install some packages I need on VM like docker…
but I want ansible copy one bash script from my local to VM and run that script after copy.
but I get this error
qemu.template: TASK [Copy repair.sh to server] **************************************************
qemu.template: An exception occurred during task execution. To see the full traceback, use -vvv. The error was: If you are using a module and expect the file to exist on the remote, see the remote_src option
qemu.template: fatal: [127.0.0.1]: FAILED! => {"changed": false, "msg": "Could not find or access '/root/repair.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"}
Permission of file is OK, but I do not know why I get this error.
this is my task on playbook
- name : Copy repair.sh to server
ansible.builtin.copy:
src: /root/repair.sh
dest: /home/ubuntu/repair mode=0777
remote_src: yes
owner: root
- name: Run script
command: sh /home/ubuntu/repair.sh