Skip to content
Advertisement

unable to copy file from local machine to ec2 instance in ansible playbook

So I am running scp -i ~/Downloads/ansible-benchmark.pem ~/Documents/cis-playbook/section-1.yaml ubuntu@ec2-18-170-77-90.eu-west-2.compute.amazonaws.com:~/etc/ansible/playbooks/

to transfer an ansible playbook I created with VSCODE the section-1.yaml file,

but I am coming up with an error scp: /home/ubuntu/etc/ansible/playbooks/: No such file or directory

the directory definitely exists in the ec2 instance, I did install ansible, but for some reason I don’t know why it isn’t recognising the directory.

Advertisement

Answer

For the first one, you can check if is available

/home/ubuntu/etc/ansible/playbooks/

if that part is not available on target/source, you can use create a folder on ansible first then you can go for copy on target

You can use this issue Ansible: find file and loop over paths

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement