Managing a large amount of Ansible roles












0














We are working on converting our project to Ansible. Due to the scale of the project, we will need a large amount of roles (30+). Where we're running into problems is how to store and manage these roles. Things we have considered:



1) Github repo per role -> This is unrealistic. We don't want to manage 30+ git repositories simply for the purpose of maintaining our roles
2) Ansible Galaxy -> This would be valuable if we could have a local instance of Ansible Galaxy, but the central instance won't work
3) We can simply store the roles in a flat directory, however we lose the benefit of being able to version them in this case. There is also the matter of how to automatically push our ansible roles directories to the ansible controller host into the correct directory



Is there a solution I'm missing?










share|improve this question






















  • Is there any issue having all the roles in a git repo? Is because you want to have a requirements.yml for those roles?
    – imjoseangel
    Nov 16 '18 at 5:49










  • Are the roles truly functionally separate? If not, then it may make sense to combine some of them into a few roles using tags or conditionals to manage execution.
    – Michael Gardner
    Nov 16 '18 at 12:13
















0














We are working on converting our project to Ansible. Due to the scale of the project, we will need a large amount of roles (30+). Where we're running into problems is how to store and manage these roles. Things we have considered:



1) Github repo per role -> This is unrealistic. We don't want to manage 30+ git repositories simply for the purpose of maintaining our roles
2) Ansible Galaxy -> This would be valuable if we could have a local instance of Ansible Galaxy, but the central instance won't work
3) We can simply store the roles in a flat directory, however we lose the benefit of being able to version them in this case. There is also the matter of how to automatically push our ansible roles directories to the ansible controller host into the correct directory



Is there a solution I'm missing?










share|improve this question






















  • Is there any issue having all the roles in a git repo? Is because you want to have a requirements.yml for those roles?
    – imjoseangel
    Nov 16 '18 at 5:49










  • Are the roles truly functionally separate? If not, then it may make sense to combine some of them into a few roles using tags or conditionals to manage execution.
    – Michael Gardner
    Nov 16 '18 at 12:13














0












0








0







We are working on converting our project to Ansible. Due to the scale of the project, we will need a large amount of roles (30+). Where we're running into problems is how to store and manage these roles. Things we have considered:



1) Github repo per role -> This is unrealistic. We don't want to manage 30+ git repositories simply for the purpose of maintaining our roles
2) Ansible Galaxy -> This would be valuable if we could have a local instance of Ansible Galaxy, but the central instance won't work
3) We can simply store the roles in a flat directory, however we lose the benefit of being able to version them in this case. There is also the matter of how to automatically push our ansible roles directories to the ansible controller host into the correct directory



Is there a solution I'm missing?










share|improve this question













We are working on converting our project to Ansible. Due to the scale of the project, we will need a large amount of roles (30+). Where we're running into problems is how to store and manage these roles. Things we have considered:



1) Github repo per role -> This is unrealistic. We don't want to manage 30+ git repositories simply for the purpose of maintaining our roles
2) Ansible Galaxy -> This would be valuable if we could have a local instance of Ansible Galaxy, but the central instance won't work
3) We can simply store the roles in a flat directory, however we lose the benefit of being able to version them in this case. There is also the matter of how to automatically push our ansible roles directories to the ansible controller host into the correct directory



Is there a solution I'm missing?







ansible ansible-role






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 15 '18 at 17:04









pasquerspasquers

239217




239217












  • Is there any issue having all the roles in a git repo? Is because you want to have a requirements.yml for those roles?
    – imjoseangel
    Nov 16 '18 at 5:49










  • Are the roles truly functionally separate? If not, then it may make sense to combine some of them into a few roles using tags or conditionals to manage execution.
    – Michael Gardner
    Nov 16 '18 at 12:13


















  • Is there any issue having all the roles in a git repo? Is because you want to have a requirements.yml for those roles?
    – imjoseangel
    Nov 16 '18 at 5:49










  • Are the roles truly functionally separate? If not, then it may make sense to combine some of them into a few roles using tags or conditionals to manage execution.
    – Michael Gardner
    Nov 16 '18 at 12:13
















Is there any issue having all the roles in a git repo? Is because you want to have a requirements.yml for those roles?
– imjoseangel
Nov 16 '18 at 5:49




Is there any issue having all the roles in a git repo? Is because you want to have a requirements.yml for those roles?
– imjoseangel
Nov 16 '18 at 5:49












Are the roles truly functionally separate? If not, then it may make sense to combine some of them into a few roles using tags or conditionals to manage execution.
– Michael Gardner
Nov 16 '18 at 12:13




Are the roles truly functionally separate? If not, then it may make sense to combine some of them into a few roles using tags or conditionals to manage execution.
– Michael Gardner
Nov 16 '18 at 12:13












1 Answer
1






active

oldest

votes


















2














I would suggest keeping the roles in a single git repo.



For the automatic push to the ansible controller, you could either create a standalone playbook that uses the git module to retrieve the appropriate version of the roles. This could then be run on a regular basis (or scheduled via cron).



Alternatively, you could add the git retrieval to your existing playbooks, and then it would check/update the roles prior to executing them.






share|improve this answer

















  • 1




    I concur. I had close to 100 different Ansible roles and around a dozen playbooks using those roles for one project I worked on. All of them were stored in a single repo. Worked just fine. I didn't automatically pick up the new roles when running the playbooks. I made sure the directory was up to date manually, but it was just me and one other. So, we didn't have to worry a lot about not knowing when there were updates. :)
    – Lewis M
    Nov 16 '18 at 12:34










  • One followup to this, is how do you manage individual versions of the roles? For example certain roles require significantly different configuration based off of the version (Tomcat is a good example). So to install a specific role version we need to be able to reference it by version
    – pasquers
    Nov 16 '18 at 14:49










  • @pasquers So typically I use Tagging, and/or Variables that will retrieve the specific configuration values that I want. Then you can have multiple variable files under /var or /default that get referenced based on Tags or Version settings. Using jinja templates would be another possiblity.
    – Michael Gardner
    Nov 20 '18 at 13:50











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53324561%2fmanaging-a-large-amount-of-ansible-roles%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














I would suggest keeping the roles in a single git repo.



For the automatic push to the ansible controller, you could either create a standalone playbook that uses the git module to retrieve the appropriate version of the roles. This could then be run on a regular basis (or scheduled via cron).



Alternatively, you could add the git retrieval to your existing playbooks, and then it would check/update the roles prior to executing them.






share|improve this answer

















  • 1




    I concur. I had close to 100 different Ansible roles and around a dozen playbooks using those roles for one project I worked on. All of them were stored in a single repo. Worked just fine. I didn't automatically pick up the new roles when running the playbooks. I made sure the directory was up to date manually, but it was just me and one other. So, we didn't have to worry a lot about not knowing when there were updates. :)
    – Lewis M
    Nov 16 '18 at 12:34










  • One followup to this, is how do you manage individual versions of the roles? For example certain roles require significantly different configuration based off of the version (Tomcat is a good example). So to install a specific role version we need to be able to reference it by version
    – pasquers
    Nov 16 '18 at 14:49










  • @pasquers So typically I use Tagging, and/or Variables that will retrieve the specific configuration values that I want. Then you can have multiple variable files under /var or /default that get referenced based on Tags or Version settings. Using jinja templates would be another possiblity.
    – Michael Gardner
    Nov 20 '18 at 13:50
















2














I would suggest keeping the roles in a single git repo.



For the automatic push to the ansible controller, you could either create a standalone playbook that uses the git module to retrieve the appropriate version of the roles. This could then be run on a regular basis (or scheduled via cron).



Alternatively, you could add the git retrieval to your existing playbooks, and then it would check/update the roles prior to executing them.






share|improve this answer

















  • 1




    I concur. I had close to 100 different Ansible roles and around a dozen playbooks using those roles for one project I worked on. All of them were stored in a single repo. Worked just fine. I didn't automatically pick up the new roles when running the playbooks. I made sure the directory was up to date manually, but it was just me and one other. So, we didn't have to worry a lot about not knowing when there were updates. :)
    – Lewis M
    Nov 16 '18 at 12:34










  • One followup to this, is how do you manage individual versions of the roles? For example certain roles require significantly different configuration based off of the version (Tomcat is a good example). So to install a specific role version we need to be able to reference it by version
    – pasquers
    Nov 16 '18 at 14:49










  • @pasquers So typically I use Tagging, and/or Variables that will retrieve the specific configuration values that I want. Then you can have multiple variable files under /var or /default that get referenced based on Tags or Version settings. Using jinja templates would be another possiblity.
    – Michael Gardner
    Nov 20 '18 at 13:50














2












2








2






I would suggest keeping the roles in a single git repo.



For the automatic push to the ansible controller, you could either create a standalone playbook that uses the git module to retrieve the appropriate version of the roles. This could then be run on a regular basis (or scheduled via cron).



Alternatively, you could add the git retrieval to your existing playbooks, and then it would check/update the roles prior to executing them.






share|improve this answer












I would suggest keeping the roles in a single git repo.



For the automatic push to the ansible controller, you could either create a standalone playbook that uses the git module to retrieve the appropriate version of the roles. This could then be run on a regular basis (or scheduled via cron).



Alternatively, you could add the git retrieval to your existing playbooks, and then it would check/update the roles prior to executing them.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 16 '18 at 12:25









Michael GardnerMichael Gardner

5,08951829




5,08951829








  • 1




    I concur. I had close to 100 different Ansible roles and around a dozen playbooks using those roles for one project I worked on. All of them were stored in a single repo. Worked just fine. I didn't automatically pick up the new roles when running the playbooks. I made sure the directory was up to date manually, but it was just me and one other. So, we didn't have to worry a lot about not knowing when there were updates. :)
    – Lewis M
    Nov 16 '18 at 12:34










  • One followup to this, is how do you manage individual versions of the roles? For example certain roles require significantly different configuration based off of the version (Tomcat is a good example). So to install a specific role version we need to be able to reference it by version
    – pasquers
    Nov 16 '18 at 14:49










  • @pasquers So typically I use Tagging, and/or Variables that will retrieve the specific configuration values that I want. Then you can have multiple variable files under /var or /default that get referenced based on Tags or Version settings. Using jinja templates would be another possiblity.
    – Michael Gardner
    Nov 20 '18 at 13:50














  • 1




    I concur. I had close to 100 different Ansible roles and around a dozen playbooks using those roles for one project I worked on. All of them were stored in a single repo. Worked just fine. I didn't automatically pick up the new roles when running the playbooks. I made sure the directory was up to date manually, but it was just me and one other. So, we didn't have to worry a lot about not knowing when there were updates. :)
    – Lewis M
    Nov 16 '18 at 12:34










  • One followup to this, is how do you manage individual versions of the roles? For example certain roles require significantly different configuration based off of the version (Tomcat is a good example). So to install a specific role version we need to be able to reference it by version
    – pasquers
    Nov 16 '18 at 14:49










  • @pasquers So typically I use Tagging, and/or Variables that will retrieve the specific configuration values that I want. Then you can have multiple variable files under /var or /default that get referenced based on Tags or Version settings. Using jinja templates would be another possiblity.
    – Michael Gardner
    Nov 20 '18 at 13:50








1




1




I concur. I had close to 100 different Ansible roles and around a dozen playbooks using those roles for one project I worked on. All of them were stored in a single repo. Worked just fine. I didn't automatically pick up the new roles when running the playbooks. I made sure the directory was up to date manually, but it was just me and one other. So, we didn't have to worry a lot about not knowing when there were updates. :)
– Lewis M
Nov 16 '18 at 12:34




I concur. I had close to 100 different Ansible roles and around a dozen playbooks using those roles for one project I worked on. All of them were stored in a single repo. Worked just fine. I didn't automatically pick up the new roles when running the playbooks. I made sure the directory was up to date manually, but it was just me and one other. So, we didn't have to worry a lot about not knowing when there were updates. :)
– Lewis M
Nov 16 '18 at 12:34












One followup to this, is how do you manage individual versions of the roles? For example certain roles require significantly different configuration based off of the version (Tomcat is a good example). So to install a specific role version we need to be able to reference it by version
– pasquers
Nov 16 '18 at 14:49




One followup to this, is how do you manage individual versions of the roles? For example certain roles require significantly different configuration based off of the version (Tomcat is a good example). So to install a specific role version we need to be able to reference it by version
– pasquers
Nov 16 '18 at 14:49












@pasquers So typically I use Tagging, and/or Variables that will retrieve the specific configuration values that I want. Then you can have multiple variable files under /var or /default that get referenced based on Tags or Version settings. Using jinja templates would be another possiblity.
– Michael Gardner
Nov 20 '18 at 13:50




@pasquers So typically I use Tagging, and/or Variables that will retrieve the specific configuration values that I want. Then you can have multiple variable files under /var or /default that get referenced based on Tags or Version settings. Using jinja templates would be another possiblity.
– Michael Gardner
Nov 20 '18 at 13:50


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53324561%2fmanaging-a-large-amount-of-ansible-roles%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Guess what letter conforming each word

Port of Spain

Run scheduled task as local user group (not BUILTIN)