#9236 Create a playbook to copy from one host to another
Opened a month ago by mohanboddu. Modified 24 days ago

Describe what you would like us to do:


With ssh forwarding turned off and even if we turn it on for the time being, bastion doesn't support agent forwarding. So, the easiest way to do it right now, become root on batcave and scp the content to batcave as root and then from there copy to another host.

This is very convoluted for a simple task. It would be greatly beneficial to have a playbook to copy content from host A to host B.

When do you need this to be done by? (YYYY/MM/DD)

Not urgent (but can we add this as an easy task)


Metadata Update from @zlopez:
- Issue tagged with: easyfix, low-trouble, medium-gain

a month ago

Metadata Update from @zlopez:
- Issue tagged with: groomed

a month ago

Metadata Update from @zlopez:
- Issue priority set to: Waiting on Assignee (was: Needs Review)

a month ago

Metadata Update from @nb:
- Issue assigned to hyperreal

a month ago

The more I think about it, maybe a shell/python script running as root on batcave seems like an easier option as root on batcave has ssh access to all the infra.

What could a shell/python script accomplish that scp from root on batcave cannot? Are the files that need to be copied always going to be the same? A shell script would seem to be suitable if it will always copy contents from, say, /tmp/staging to specified hosts. Will it always be the same host(s), or would you like to supply the hosts as an argument to the shell script?

I am planning to supply two hosts and two locations (one for source and one for dest). So, the source file or source dir on source host needs to be copied to dest location on dest host. root on batcave have ssh access to all the hosts, which is why I thought a script might be useful rather than having to copy from batcave all the time.

Sounds good. I'll get to work on it.

I am not sure if delegate_to works since only the control_node has access to both the source and dest hosts.

I'll just write up a script. The script would take two arguments, one for src host and directory and the other for dest host and directory.

@mohanboddu Does this work for you? https://gist.github.com/hyperreal42/e861a40768248c958725d1e893386ab2

This could work, I guess using --extra-vars to provide the arguments at runtime should work.

@mohanboddu Does this work for you? https://gist.github.com/hyperreal42/e861a40768248c958725d1e893386ab2

This could work, I guess using --extra-vars to provide the arguments at runtime should work.

Would it be better to add those arguments into the playbook, or will they be different every time? If this is acceptable, how do I mark this issue as Closed, or does someone else do that?

Would it be better to add those arguments into the playbook, or will they be different every time? If this is acceptable, how do I mark this issue as Closed, or does someone else do that?

They will be always different. So, its better to use --extra-vars

Login to comment on this ticket.

Metadata
Boards 1
dev Status: In Review