Use Git repository hosted on S3 instead of Github/Stash in ansible-pull command

267 Views Asked by At

The ansible-pull command looks like this:

ansible-pull common.yml -C develop -U $REPO -fi localhost

If I use REPO="ssh://[email protected]/xyz/xyz.git", it works fine.

But if I use REPO="amazon-s3://.jgit@xyz-bucket/xyz/xyz.git", it isn't working obviously as amazon-s3 isn't a protocol and only jgit recognizes it.

For reference, I am using this guide to create a git repository on S3.

Any hacks or solutions are welcome.

1

There are 1 best solutions below

0
On

By default, most tools work with the standard C command-line version of Git (that is, the git binary) and not JGit (the jgit binary). It sounds like you have a plugin or other functionality in JGit that allows you to use the amazon-s3 scheme, but you don't have a generic protocol helper for Git that allows you to do the same thing.

You have two choices here: either symlink jgit to git somewhere in your PATH, or find and install a suitable protocol helper for Git. Assuming you have a directory called bin in your home directory in your PATH, run ln -s $(which jgit) ~/bin/git. Then, when you (or Ansible) invoke the git program, you'll really be using jgit, which will cause things to work.

Having said that, the documentation you linked to states that JGit doesn't support the pull subcommand; if so, and if ansible-pull uses that subcommand, then what you want to do isn't possible with the commands above and you'll need to find and install an equivalent protocol helper for S3 for regular Git.