How to transfer the files between remotes machines with ansible - ansible

With Ansible, I want to transfer a file from windows environment remote to linux environment remote without going through the controller machine.

Related

how to copy directories from remote machines to localhost?

In ansible playbook, fetch module only copies file from target machine to local.
copy/synchronize modules can copy directories/files from local to target machine.
Then how to copy direcotries from remote target machines
Acording to ducumentation :
synchronize – A wrapper around rsync
mode(string) Choices: {pull,push}
Specify the direction of the synchronization.
In push mode the localhost or delegate is the source.
In pull mode the remote host in context is the source.
This is not specific to ansible but you can use scp:
scp me#my-host /path/to/remote/folder /path/to/local/folder
This will copy the folder from your remote machine to a local folder.

Git for windows setting different permissions on files in same repo

I have a local repository on my host machine. I need to clone this repo from the host machine to a vm running debian. Folders are shared, files are accessible.
But git seems to set different permission for different parts of the repo.
So while most files have my windows user set to Full control, the individual files in ./.git/objects//* have just the SYSTEM/Admin/Administrator permissions and not my windows user. Mind you, the folders in ./.git/objects/* have my windows user set, but the files within not.
Because of this git clone fails for these files. Is there a way to tell git to add my windows user to any file it creates?

Deploy the directories to remote windows server

Am using Teamcity as my CI, after checking out a repo from Github i need to deploy the files and directories to one of the remote windows machine
Note: Both my Teamcity agent and remote machine are having windows OS
Please help me to achieve the same with command line or by any of the plugins.
You can use the TeamCity Deployer plugin to gather artifacts and deploy them to a network share or FTP.
Create new network share on your target Windows machine and configure correct write permissions for the share and NTFS folder. Use the network share address in TeamCity build configuration. The machine running TeamCity agent must have access to the network share.

Copying files built on Unix back to Windows Jenkins workspace

I have a jenkins Job in which I build my application on Unix box by making SSH connection to it and run the build script on Unix box. My Jenkins is on windows I want to generate PMD reports on windows so, i want to copy pmd.xml file from Unix box to Windows machine.
Right now my windows Jenkins workspace is empty because I do SVN checkout, Build and generation of binaries on Unix box. for this purpose I am using Jenkins SSH plugin.
Is there any way to copy Unix contents back to Windows Jenkins Workspace?
I have tried Jenkins SCP plugin but confused with source and SCP site. Please suggest.
Thanks in Advance.
You can use plink.exe and pscp.exe to interface from Windows to Linux. These should be part of your PuTTY distribution.
However, if your slave is already connecting to the Linux machine, you can use the same connection to bring the file back to slave's workspace. Then use Copy to Slave plugin (nevermind the name, it does both directions) to move the file from slave to master workspace
I Added Linux machine as slave to windows master and then used Copy-to-Slave plugin to copy generated reports from linux to windows workspace its working fine.

Backup of SVN repository, located on Linux server, to Windows Client

I try to create a backup of my SVN repository, located on Linux server, from Windows command-line Subversion Client:
C:\project>svnadmin hotcopy svn://"URL_of_my_SVN_repository"/ C:/BACKUP
and receive following error:
svnadmin: E205000: 'svn://"URL_of_my_SVN_repository"/' is a URL when it should be a local path
How I can solve it? I need to initiate a backup my SVN repository from Windows PC (due to our network policy I have access to the Linux server port 3690 (SVN) only).
According to the documentation, you can't run svnadmin from a remote machine:
Since svnadmin works via direct repository access (and thus can only be used on the machine that holds the repository), it refers to the repository with a path, not a URL.
The standard approach to backing up to a remote location is to combine multiple tools:
Run svnadmin on the machine which serves svn.
Use a tool like rsync to copy that repo dump from the svn server to the machine which will be backed up.
If your network policy allows you to run an svn server on a machine, but not to schedule svnadmin backup jobs on that machine, then I think you need to re-consider your network policy.

Resources