|
|
|
|
|
|
|
|
- require: |
|
|
- require: |
|
|
- {{ minion.install_state }} |
|
|
- {{ minion.install_state }} |
|
|
|
|
|
|
|
|
salt_minion_grains_placeholder: |
|
|
|
|
|
file.touch: |
|
|
|
|
|
- name: /etc/salt/grains.d/placeholder |
|
|
|
|
|
|
|
|
salt_minion_grains_files: |
|
|
|
|
|
file.managed: |
|
|
|
|
|
- names: |
|
|
|
|
|
- /etc/salt/grains |
|
|
|
|
|
- /etc/salt/grains.d/placeholder |
|
|
|
|
|
- replace: False |
|
|
- require: |
|
|
- require: |
|
|
- file: salt_minion_grains_dir |
|
|
- file: salt_minion_grains_dir |
|
|
|
|
|
|
|
|
|
|
|
{%- set new_grains = salt['cmd.run']('cat /etc/salt/grains.d/*') %} |
|
|
|
|
|
{%- set old_grains = salt['cmd.run']('cat /etc/salt/grains') %} |
|
|
|
|
|
|
|
|
|
|
|
{%- if new_grains != old_grains %} |
|
|
|
|
|
|
|
|
salt_minion_grains_file: |
|
|
salt_minion_grains_file: |
|
|
cmd.run: |
|
|
cmd.run: |
|
|
- name: cat /etc/salt/grains.d/* > /etc/salt/grains |
|
|
- name: cat /etc/salt/grains.d/* > /etc/salt/grains |
|
|
- require: |
|
|
- require: |
|
|
- file: salt_minion_grains_placeholder |
|
|
|
|
|
- watch_in: |
|
|
|
|
|
- service: salt_minion_service |
|
|
|
|
|
|
|
|
- file: salt_minion_grains_files |
|
|
|
|
|
|
|
|
salt_minion_grains_publish: |
|
|
salt_minion_grains_publish: |
|
|
module.run: |
|
|
module.run: |
|
|
- name: mine.send |
|
|
|
|
|
- name: grains.items |
|
|
|
|
|
|
|
|
- name: mine.update |
|
|
- require: |
|
|
- require: |
|
|
- cmd: salt_minion_grains_file |
|
|
- cmd: salt_minion_grains_file |
|
|
|
|
|
|
|
|
{%- endif %} |
|
|
{%- endif %} |
|
|
|
|
|
|
|
|
|
|
|
{%- endif %} |