New version of salt-formula from Saltstack
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

grains.sls 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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_placeholder:
  14. file.managed:
  15. - name: /etc/salt/grains.d/placeholder
  16. - replace: false
  17. - require:
  18. - file: salt_minion_grains_dir
  19. {#
  20. TODO: we need to be idempotent but reload salt-minion when grains are
  21. changed. So for now, adding new grains requires removal of /etc/salt/grains
  22. file and execution of salt state again
  23. This can be possibly solved by custom module for grains management or native
  24. support for grains.d in salt
  25. #}
  26. salt_minion_grains_file:
  27. cmd.run:
  28. - name: cat /etc/salt/grains.d/* > /etc/salt/grains
  29. - creates: /etc/salt/grains
  30. - require:
  31. - file: salt_minion_grains_placeholder
  32. - watch_in:
  33. - service: salt_minion_service
  34. salt_minion_grains_publish:
  35. module.wait:
  36. - name: mine.send
  37. - name: grains.items
  38. - watch:
  39. - service: salt_minion_service
  40. - cmd: salt_minion_grains_file
  41. {%- endif %}