New version of salt-formula from Saltstack
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. {%- from "salt/map.jinja" import minion with context %}
  2. {%- if minion.enabled %}
  3. salt_minion_packages:
  4. pkg.latest:
  5. - names: {{ minion.pkgs }}
  6. salt_minion_grains_dir:
  7. file.directory:
  8. - name: /etc/salt/grains.d
  9. - mode: 700
  10. - makedirs: true
  11. - user: root
  12. salt_minion_grains_placeholder:
  13. file.touch:
  14. - name: /etc/salt/grains.d/placeholder
  15. - require:
  16. - file: salt_minion_grains_dir
  17. salt_minion_grains_file:
  18. cmd.run:
  19. - name: cat /etc/salt/grains.d/* > /etc/salt/grains
  20. - require:
  21. - file: salt_minion_grains_placeholder
  22. /etc/salt/minion.d/minion.conf:
  23. file.managed:
  24. - source: salt://salt/files/minion.conf
  25. - user: root
  26. - group: root
  27. - template: jinja
  28. - require:
  29. - pkg: salt_minion_packages
  30. - file: salt_minion_grains_dir
  31. - watch_in:
  32. - service: salt_minion_service
  33. salt_minion_service:
  34. service.running:
  35. - name: {{ minion.service }}
  36. - enable: true
  37. {%- if minion.graph_states %}
  38. salt_graph_packages:
  39. pkg.latest:
  40. - names: {{ minion.graph_pkgs }}
  41. - require:
  42. - pkg: salt_minion_packages
  43. salt_graph_states_packages:
  44. pkg.latest:
  45. - names: {{ minion.graph_states_pkgs }}
  46. /root/salt-state-graph.py:
  47. file.managed:
  48. - source: salt://salt/files/salt-state-graph.py
  49. - require:
  50. - pkg: salt_graph_packages
  51. /root/salt-state-graph.sh:
  52. file.managed:
  53. - source: salt://salt/files/salt-state-graph.sh
  54. - require:
  55. - pkg: salt_graph_packages
  56. {%- endif %}
  57. {%- endif %}