Skip to content
This repository was archived by the owner on Aug 13, 2024. It is now read-only.
This repository was archived by the owner on Aug 13, 2024. It is now read-only.

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

@tkgalk

Description

@tkgalk

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions