Created
September 20, 2013 03:44
-
-
Save mech422/6633041 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
## salt '*' grains.setval key val | |
## salt '*' grains.setval key "{'sub-key': 'val', 'sub-key2': 'val2'}" | |
## | |
{% set id = grains.id %} | |
{% set os = grains.os %} | |
{% set node_type = pillar.node_type %} | |
{% set node_role = pillar.node_role %} | |
{% set key = id + '-sls-base-nginx-_action' %} | |
{% set _action = salt['grains.get'](key,'foo') %} | |
## Move this to a map file... | |
{% set default_server = 'nginx' %} | |
{% from "nginx/pkgconfig.jinja" import pkg_conf with context %} | |
{% if _action == 'install' %} | |
install_nginx: | |
pkg: | |
- installed | |
- name: {{ pkg_conf.server }} | |
service: | |
- running | |
- name: {{ pkg_conf.service }} | |
- enable: True | |
{{ key }}: | |
grains: | |
- present | |
- value: 'install_complete' | |
- watch: | |
- service: install_nginx | |
{% endif %} | |
{% if _action == 'remove' %} | |
remove_nginx: | |
pkg: | |
- removed | |
- name: {{ pkg_conf.service }} | |
{% endif %} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## salt '*' grains.setval key "{'sub-key': 'val', 'sub-key2': 'val2'}" | |
{% set id = grains.id %} | |
{% set key = id + '-sls-base-nginx-_action' %} | |
{% set tmp = salt['grains.setval']( key, 'install' ) %} | |
## This will include nginx/init.sls by default | |
include: | |
- nginx | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## salt '*' grains.setval key "{'sub-key': 'val', 'sub-key2': 'val2'}" | |
{% set id = grains.id %} | |
{% set key = id + '-sls-base-nginx-_action' %} | |
{% set tmp = salt['grains.setval']( key, 'remove' ) %} | |
## This will include nginx/init.sls by default | |
include: | |
- nginx | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
salt '*' grains.setval key val
salt '*' grains.setval key "{'sub-key': 'val', 'sub-key2': 'val2'}"
{% set pkg_conf = salt['grains.filter_by']({
'default': {
'server': 'nginx'
},
'Debian': {
'server': 'nginx',
'service': 'nginx',
'vhostdir': '/etc/nginx/sites-available',
'confdir': '/etc/nginx/conf.d',
'logdir': '/var/log/nginx',
},
'Ubuntu': {
'server': 'nginx',
'service': 'nginx',
},
}) %}
}, merge=salt'pillar.get') % }