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.

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.
>

-- 
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/CAEVJ8QN_0%2Bd3nsX92dY3P5xzY29n%3Dyg3AmH2ZpQT_p7eDmvWSA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to