Skip to content

Instantly share code, notes, and snippets.

Created September 15, 2015 19:42
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 anonymous/0ae390c5e5f11e1adb1c to your computer and use it in GitHub Desktop.
Save anonymous/0ae390c5e5f11e1adb1c to your computer and use it in GitHub Desktop.
salt reload
## Local Variables ##
{% set s3_grains_url = salt['pillar.get']('grains:url', False) %}
{% set s3_grains_sha1 = salt['pillar.get']('grains:sha1', False) %}
{% if s3_grains_url %}
# Sync the grains from S3 if the pillar value exists.
s3_grains_file:
file:
- managed
- name: '/etc/salt/grains'
- source: '{{ s3_grains_url }}'
- source_hash: '{{ s3_grains_sha1 }}'
- user: 'root'
- group: 'root'
- mode: 0400
# Inspect the process tree to kill the current salt-call invocation and start a fresh highstate run.
restart_salt_run:
cmd.run:
- user: 'root'
- cwd: '/root'
- shell: '/bin/bash'
- name: |
pkill --signal SIGTERM "[s]alt-call" && \
salt-call state.highstate > /tmp/grains_reload
- onchanges:
- file: '/etc/salt/grains'
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment