Skip to content

Instantly share code, notes, and snippets.

@oc
Last active January 3, 2016 21:49
Show Gist options
  • Save oc/8524664 to your computer and use it in GitHub Desktop.
Save oc/8524664 to your computer and use it in GitHub Desktop.
{% for site in pillar['nginx_sites'] %}
#...
{%- if site.get('root', False) %}
{{ site.root }}:
file.directory:
- user: www-data
- group: www-data
- mode: 775
- makedirs: True
- recurse:
- group
{%- endif %}
{% endfor %}
# pillar
nginx_sites:
- fqdn: cdn2.foo.bar
root: /var/www/default
- fqdn: cdn1.foo.bar
root: /var/www/default
- fqdn: foo.bar
alias: www.foo.bar
root: /var/www/default
- fqdn: othersite.bar
alias: www.othersite.bar
root: /var/www/othersite.bar
root@mgmt:/srv/salt# git pull && salt -v "www1.foo*" saltutil.refresh_pillar && salt "www1.foo*" state.highstate
remote: Counting objects: 13, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 7 (delta 3), reused 7 (delta 3)
Unpacking objects: 100% (7/7), done.
From github.com:uppercase/infrastructure
1c79b33..6e2159b master -> origin/master
Updating 1c79b33..6e2159b
Fast-forward
pillar/bar/foo/www1/init.sls | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
Executing job with jid 20140120182522661836
-------------------------------------------
www1.foo.bar:
None
www1.foo.bar:
Data failed to compile:
----------
Rendering SLS "base:nginx.sites" failed: Conflicting ID "/var/www/default"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment