I have executed a ansible script on my machine. What is does is
1.Copy a file from my machine to a docker container running on a remote machine
file.pb
2.Execute a command on docker container. That command uses the copied file & sign it.
This is the command
peer channel signconfigtx -f file.pb
Now i want to again copy this signed file to another machine after it is signed in the same ansible script from the docker container where it is now.
I want try SCP
but not sure how it will work because it will ask for password.
Can anyone suggest me how can i do this ?
EDIT:
I tried on my local machine to fetch files from remote server but it i get below error
fatal: [user1]: FAILED! => {"msg": "Unable to create local directories(/home/dhiraj/ansible_practise/playlist/fetched/user1/home/user1/Documents/Blockchain/network/scripts): [Errno 20] Not a directory: '/home/dhiraj/ansible_practise/playlist/fetched/user1'"}
below is my ansible script
- name: Fetching a file from remote server
fetch:
src: "/home/user1/Documents/Blockchain/network/scripts/file.pb"
dest: fetched
mkdir fetched
to create destdest: fetched
. Do you want toscp files to / from
docker container running in which machine? sameansible server
orremote machine
? What is thedocker image
which is running? You will need ssh server in that image. Please update the question with these details. However, I would suggest to use apersistent volume
in the host machine (where docker container runs) and use it, instead of complicating. – Prakash Krishna