Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different nginx configs based on branch/host/tags #191

Open
tkgalk opened this issue Oct 24, 2017 · 1 comment
Open

Different nginx configs based on branch/host/tags #191

tkgalk opened this issue Oct 24, 2017 · 1 comment

Comments

@tkgalk
Copy link

tkgalk commented Oct 24, 2017

My case looks like this: in site.yml I run the role as:

- role: jdauphant.nginx
  become: yes
  tags: [provision]

In ansible/group_vars/nginx.yml I have all the configuration for nginx sites. What I wish to do (and can't really wrap my head around) is to have slightly different nginx configuration on one of my hosts to make no-www -> www redirection on production and the other way on develop and staging.

The way I run the script is by a shell script with tags: ./deploy production, etc.

Is it possible to load different sets of variables based on a tag? Something like:

- role: jdauphant.nginx
  become: yes
  tags: [provision, production]

- role: jdauphant.nginx
  become: yes
  tags: [provision, develop, staging]   

With some sort of way to point to the correct set of variables?

@jdauphant
Copy link
Owner

You can use different inventory to manage staging and production.
My way to do that can be seen here: https://gist.github.com/jdauphant/10023858

People tend to differentiate with inventories or groups, I don't think it's a good way to use tags but you may have a specific reason to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants