Reputation: 8942
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
Upvotes: 1
Views: 9124
Reputation: 8942
Instead of copying files directly bertween servers what i have done is i used fetch
module of ansible. In fetch i just had to define source path
and destination path
.
Here is sample
- name: Fetching a file from remote server
fetch:
src: "{{ DEST }}/Documents/Blockchain/network/scripts/file.pb"
dest: /home/fetched/
flat: yes // it will not create dir strcuture as same as source
validate_checksum: false
Upvotes: 1
Reputation: 68144
There are more options.
1) scp from docker to another machine
2) fetch and copy
3) fetch and pull
4) Run scp at another machine ...
Upvotes: 1