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.

119 lines
2.4KB

  1. {%- from "salt/map.jinja" import master, renderer with context %}
  2. {%- if master.enabled %}
  3. {%- if master.source.get('engine', 'pkg') == 'pkg' %}
  4. salt_master_packages:
  5. pkg.installed:
  6. - names: {{ master.pkgs }}
  7. {%- if master.source.version is defined %}
  8. - version: {{ master.source.version }}
  9. {%- endif %}
  10. {%- elif master.source.get('engine', 'pkg') == 'pip' %}
  11. salt_master_packages:
  12. pip.installed:
  13. - name: salt{% if master.source.version is defined %}=={{ master.source.version }}{% endif %}
  14. {%- endif %}
  15. /etc/salt/master.d/master.conf:
  16. file.managed:
  17. - source: salt://salt/files/master.conf
  18. - user: root
  19. - template: jinja
  20. - require:
  21. - {{ master.install_state }}
  22. - watch_in:
  23. - service: salt_master_service
  24. {%- if master.cache is defined %}
  25. /etc/salt/master.d/_{{ master.cache.plugin }}.conf:
  26. file.managed:
  27. - source: salt://salt/files/cache/_{{ master.cache.plugin }}.conf
  28. - user: root
  29. - template: jinja
  30. - require:
  31. - {{ master.install_state }}
  32. - watch_in:
  33. - service: salt_master_service
  34. {%- endif %}
  35. {%- if master.user is defined %}
  36. /etc/salt/master.d/_acl.conf:
  37. file.managed:
  38. - source: salt://salt/files/_acl.conf
  39. - user: root
  40. - template: jinja
  41. - require:
  42. - {{ master.install_state }}
  43. - watch_in:
  44. - service: salt_master_service
  45. {%- endif %}
  46. {%- if master.engine is defined %}
  47. /etc/salt/master.d/_engine.conf:
  48. file.managed:
  49. - source: salt://salt/files/_engine.conf
  50. - user: root
  51. - template: jinja
  52. - require:
  53. - {{ master.install_state }}
  54. - watch_in:
  55. - service: salt_master_service
  56. {%- endif %}
  57. {%- if master.peer is defined %}
  58. /etc/salt/master.d/_peer.conf:
  59. file.managed:
  60. - source: salt://salt/files/_peer.conf
  61. - user: root
  62. - template: jinja
  63. - require:
  64. - {{ master.install_state }}
  65. - watch_in:
  66. - service: salt_master_service
  67. {%- endif %}
  68. {%- if renderer | length > 0 %}
  69. /etc/salt/master.d/_renderer.conf:
  70. file.managed:
  71. - source: salt://salt/files/_renderer.conf
  72. - user: root
  73. - template: jinja
  74. - require:
  75. - {{ master.install_state }}
  76. - watch_in:
  77. - service: salt_master_service
  78. {%- endif %}
  79. salt_master_service:
  80. service.running:
  81. - name: {{ master.service }}
  82. - enable: True
  83. {%- if grains['saltversioninfo'][0] >= 2017 and grains['saltversioninfo'][1] >= 7 %}
  84. - retry:
  85. attempts: 2
  86. interval: 5
  87. splay: 5
  88. {%- endif %}
  89. /srv/salt/env:
  90. file.directory:
  91. - user: root
  92. - mode: 755
  93. - makedirs: true
  94. {%- endif %}