Skip to content

Instantly share code, notes, and snippets.

@ipmb
Last active June 13, 2017 23:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ipmb/96553c27003f381b54c086c9baea3bca to your computer and use it in GitHub Desktop.
Save ipmb/96553c27003f381b54c086c9baea3bca to your computer and use it in GitHub Desktop.
Salt orchestration
{% set branch = pillar.name.split('.', 1)[0] %}
{{ branch }} db:
salt.function:
- name: state.apply
- tgt: salt.example.local
- arg:
- projects.test.dbs.generate_from_template
- kwarg:
pillar:
db_name: {{ branch }}
{{ pillar.name }}:
salt.function:
- name: cloud.profile
- tgt: salt.es.local
- kwarg:
profile: lxc_test
names:
- {{ pillar.name }}
config_dir: /etc/salt
{{ pillar.name }} up:
salt.function:
- name: test.ping
- tgt: {{ pillar.name }}
limit {{ pillar.name }} memory:
salt.function:
- tgt: test.es.local
- name: lxc.set_parameter
- arg:
- {{ pillar.name }}
- memory.soft_limit_in_bytes
- 3G
{{ pillar.name }} DNS:
salt.function:
- tgt: salt.es.local
- name: cmd.run
- arg:
- /usr/local/sbin/update-internal-dns {{ pillar.name }}
- require:
- salt: {{ pillar.name }} up
{{ pillar.name }} grains:
salt.function:
- tgt: {{ pillar.name }}
- name: grains.set
- arg:
- branch
- {{ branch }}
- require:
- salt: {{ pillar.name }} up
{{ pillar.name }} highstate:
salt.state:
- tgt: {{ pillar.name }}
- highstate: True
- require:
- salt: {{ pillar.name }} grains
/etc/haproxy/haproxy.cfg:
salt.state:
- tgt: test.example.local
- sls:
- packages.haproxy
- test.haproxy_config
- require:
- salt: {{ pillar.name }} up
- {{ pillar.name }} DNS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment