New version of salt-formula from Saltstack
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

45 lines
911B

  1. {%- from "salt/map.jinja" import minion with context %}
  2. {%- if minion.enabled %}
  3. include:
  4. - salt.minion.service
  5. salt_minion_grains_dir:
  6. file.directory:
  7. - name: /etc/salt/grains.d
  8. - mode: 700
  9. - makedirs: true
  10. - user: root
  11. - require:
  12. - {{ minion.install_state }}
  13. salt_minion_grains_files:
  14. file.managed:
  15. - names:
  16. - /etc/salt/grains
  17. - /etc/salt/grains.d/placeholder
  18. - replace: False
  19. - require:
  20. - file: salt_minion_grains_dir
  21. {%- set new_grains = salt['cmd.run']('cat /etc/salt/grains.d/*') %}
  22. {%- set old_grains = salt['cmd.run']('cat /etc/salt/grains') %}
  23. {%- if new_grains != old_grains %}
  24. salt_minion_grains_file:
  25. cmd.run:
  26. - name: cat /etc/salt/grains.d/* > /etc/salt/grains
  27. - require:
  28. - file: salt_minion_grains_files
  29. salt_minion_grains_publish:
  30. module.run:
  31. - name: mine.update
  32. - require:
  33. - cmd: salt_minion_grains_file
  34. {%- endif %}
  35. {%- endif %}