DEV Community


Posted on

On-prem ansible galaxy

Generic ansible roles can be shared through ansible galaxy, however, its hard to access ansible-galaxy from within corporate network. A good alternative is to host something similar to ansible-galaxy on-prem.

On-prem galaxy repository

  • For this blog stash is considered (, however, gitlab, gogs or similar should work as well
  • Create a new project on stash Ansible Galaxy with key AG
  • Create repo for each generic ansbile role.
  • All generic ansbile roles can be browsed at
  • Now these roles can be used with multiple ansible playbooks.


  • Create a new file requirements.yml alongside ansible playbook.yml.
  • For this blog purposes I am considering awscli as an generic ansible role with its own repo, which resides in our newly created stash project Ansible Galaxy (AG)
  • Copy/paste below content to requirements.yml
  name: awscli
  src: git+
  version: master
  path: ~/.ansible/roles

  # name - name of role
  # src - location of role
  # version - which branch the role should be installed from
  # path - where we want to install roles
Enter fullscreen mode Exit fullscreen mode
  • The requirements.yml files acts as a role dependency list for our playbook.yml


  • Once we define our ansible playbook dependencies, its time to install them.
  sudo ansible-galaxy install -r requirements.yml
  # NOTE: no need to install ansible-galaxy seperately, it ships with default ansible installation
Enter fullscreen mode Exit fullscreen mode
  • Done! all the roles are now installed and ready to be used by our playbook.yml

Top comments (0)