From 0907c178bb3241a824ae77a67e15f236b39157f0 Mon Sep 17 00:00:00 2001 From: Aneesh Joseph Date: Sun, 24 Jul 2016 00:44:49 +0530 Subject: [PATCH 1/2] update galaxy docs update galaxy docs to indicate that multiple roles can be downloaded from the same source --- docsite/rst/galaxy.rst | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/docsite/rst/galaxy.rst b/docsite/rst/galaxy.rst index 65d3b4f784c..a6e218a7f88 100644 --- a/docsite/rst/galaxy.rst +++ b/docsite/rst/galaxy.rst @@ -130,7 +130,29 @@ And here's an example showing some specific version downloads from multiple sour version: 0.1.0 As you can see in the above, there are a large amount of controls available -to customize where roles can be pulled from, and what to save roles as. +to customize where roles can be pulled from, and what to save roles as. + +You can also pull down multiple roles from a single source(just make sure that you have a meta/main.yml file at the root level). +:: + meta\main.yml + common-role1\tasks\main.yml + common-role2\tasks\main.yml + +For example, if the above common roles are published to a git repo, you can pull them down using: +:: + # multiple roles from the same repo + - src: git@gitlab.company.com:mygroup/ansible-common.git + name: common-roles + scm: git + version: master + +You could then use these common roles in your plays +:: + --- + - hosts: webservers + roles: + - common-roles/common-role1 + - common-roles/common-role2 Roles pulled from galaxy work as with other SCM sourced roles above. To download a role with dependencies, and automatically install those dependencies, the role must be uploaded to the Ansible Galaxy website. From 8a1fd737984c0c5bc9be76459c573df4900e7ffe Mon Sep 17 00:00:00 2001 From: Aneesh Joseph Date: Sun, 24 Jul 2016 01:01:47 +0530 Subject: [PATCH 2/2] fix formatting issues --- docsite/rst/galaxy.rst | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/docsite/rst/galaxy.rst b/docsite/rst/galaxy.rst index a6e218a7f88..db7bb5ee575 100644 --- a/docsite/rst/galaxy.rst +++ b/docsite/rst/galaxy.rst @@ -72,22 +72,24 @@ Installing Multiple Roles From Multiple Files ============================================= At a basic level, including requirements files allows you to break up bits of configuration policy into smaller files. Role includes pull in roles from other files. - - ansible-galaxy install -r requirements.yml - - # from galaxy - - src: yatesr.timezone - - - include: webserver.yml +:: + ansible-galaxy install -r requirements.yml + +Content of requirements.yml +:: + # from github + - src: yatesr.timezone + + - include: webserver.yml Content of the webserver.yml file. - - # from github - - src: https://github.com/bennojoy/nginx - - # from github installing to a relative path - - src: https://github.com/bennojoy/nginx +:: + # from github + - src: https://github.com/bennojoy/nginx + + # from github installing to a relative path + - src: https://github.com/bennojoy/nginx path: vagrant/roles/ Advanced Control over Role Requirements Files