Feature proposal: ansible-galaxy roles file to include git url and target versions

232 views
Skip to first unread message

Ben Kersten

unread,
Mar 27, 2014, 8:48:42 PM3/27/14
to ansible...@googlegroups.com
Hi,

I'm looking to use Ansible at our organisation and in order for us to share roles across projects there are some changes needed to the ansible-galaxy command line tool.

The limitations of ansible-galaxy that I wish to address are:
 * Roles must be published on galaxy.ansible.com or a similar server in order to download the tarball
 * Roles must be hosted on github.com
 * Roles must be in a public repository

I've seen the role files which attempt to emulate Gemfiles or Podfiles, but I find them lacking. I propose a yaml format which lists roles with the optional addition of a git url and branch/tag/commit.

---
- role: 'bennojoy.memcached'

- role: 'bennojoy.nginx'
  git: "https://github.com/bennojoy/nginx
"

- role: 'bkersten2.ansible-gunicorn'
  git:
    url: "https://bitbucket.org/bkersten2/ansible-gunicorn"
    tag: "v1.0"

- role: 'bkersten.ansible-foo'
  git:
    url: "https://github.com/bkersten/ansible-foo"
    branch: "bar"


The format allows for the inclusion of private repositories on Github or another git service that can be accessed over https. It also has finer grained control over versions.

To download tarballs from private Github/Bitbucket repositories, authentication credentials are added to the command line options.

Options:

  --git-token=GIT_TOKEN
                        Authorization token for access to private git
                        repositories
  -b BITBUCKET_HEADERS, --bitbucket-header=BITBUCKET_HEADERS
                        HTTP header to pass through when accessing
                        repositories on bitbucket.org

eg.

  ansible-galaxy install -r roles.yml -b "Cookie: bb_session=ikjuakjdhfjkahdsfjk35"


Acquiring the Github token is easy and can be found under Account settings -> Applications -> Personal access tokens. Bitbucket however is a pain and the easiest way I found was to set a header for cookies containing the session token. Attempting http digest auth was not successful. Any help improving this would be much appreciated.


I don't have any private repositories on Github so that specific code path has not been tested.

Let me know if this is something we could eventually see merged into Ansible.

Best regards,
Ben


Reply all
Reply to author
Forward
0 new messages