I'm generally not a fan of keeping production/stage variance differed by branch.
The reason for this is merging is a "fun" exercise and then diff across branches is complicated. I'd look towards branches as you do in software projects and use them for different versions of things, but think of prod vs stage as two different models, rather than branches. So what is a "stage webserver" vs a "production webserver" is not really different from the question (to a degree) of how a stage webserver is different from a production webserver -- they are both machines built out of the same repo, using slightly different parameters. --Michael On Thu, Apr 3, 2014 at 5:24 AM, Tomasz Kontusz <[email protected]>wrote: > > > Michael DeHaan <[email protected]> napisał: > >I would not recommend using a seperate branch unless there are seperate > >versions of the product, branching is great for versions, not great for > >environments. > What do you think about having a staging branch that's followed by a > production one? Then production would have an easy to see "lag", and could > even have custom hotfixes. I've seen this model work for web apps > versioning, and I wonder if it's recommended for Ansible. > > It would still use the standard mechanisms (separate inventories, > group/host vars) for differences between those environments in > configuration, but not for difference in time when the configuration was > deployed. > > >Differences in environment should be modelled by differences in > >group_variables where possible -- and possibly in a slightly different > >top > >level playbook, all leveraging many common roles. > > > >Then it's just > > > >ansible-playbook site.yml -i production > > > >vs > > > >ansible-playbook site.yml -i stage > > > > > > > > > >On Tue, Apr 1, 2014 at 5:35 PM, Alex King <[email protected]> wrote: > > > >> Hi, I'm new to ansible but liking what I see so far. I'm using it to > >> configure a bunch of machines acting as routers across a region, and > >I like > >> the model so far. > >> > >> Now I'm trying to set up a couple of machines as a staging > >environment so > >> I can check out configuration changes before I push them to > >production > >> machines. > >> > >> In http://docs.ansible.com/playbooks_best_practices.html a separate > >> inventory file for stage and production is recommended. > >> OK, but how do I actually apply a different configuration to the > >staging > >> machines from production? I see further down it's recommended to > >keep the > >> playbooks and inventory files in git. Am I supposed to branch the > >whole > >> thing and use a test branch which gets applied to staging machines? > >Or is > >> there an ansible feature to switch between staging and production? > >> > >> I have a simple file copy which I want to do different on staging vs. > >> production. I could set up a template and choose different content > >> depending on whether we're deploying to staging or production, but > >that > >> seems the wrong way to do it. It's really just a different version > >of the > >> same file, and I want to choose one version for staging servers and > >another > >> for production. > >> > >> How do others do this? > >> > >> Cheers, > >> Alex > >> > >> -- > >> You received this message because you are subscribed to the Google > >Groups > >> "Ansible Project" group. > >> To unsubscribe from this group and stop receiving emails from it, > >send an > >> email to [email protected]. > >> To post to this group, send email to > >[email protected]. > >> To view this discussion on the web visit > >> > > > https://groups.google.com/d/msgid/ansible-project/2423c0ad-5a15-4d32-be13-0535344fe7bd%40googlegroups.com > < > https://groups.google.com/d/msgid/ansible-project/2423c0ad-5a15-4d32-be13-0535344fe7bd%40googlegroups.com?utm_medium=email&utm_source=footer > > > >> . > >> For more options, visit https://groups.google.com/d/optout. > >> > > -- > Wysłane za pomocą K-9 Mail. > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/9b731735-3c6c-4c85-be2d-cc9a8434e5be%40email.android.com > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAEVJ8QOWVEGUqJt9fF7Zo8Qg9JH9%3DMob-WpJ86qZEzBffUFXKQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
