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.

57 lines
1.3KB

  1. {%- from "salt/map.jinja" import master with context %}
  2. {%- if master.enabled %}
  3. include:
  4. - salt.master.service
  5. /etc/salt/minion.d/_orchestration.conf:
  6. file.managed:
  7. - source: salt://salt/files/_orchestration.conf
  8. - user: root
  9. - group: root
  10. - mode: 600
  11. - template: jinja
  12. - makedirs: true
  13. - require:
  14. - {{ master.install_state }}
  15. {%- if master.minion is defined %}
  16. /srv/salt/minion_keys:
  17. file.directory:
  18. - makedirs: true
  19. - require:
  20. - {{ master.install_state }}
  21. {%- for name, environment in master.environment.iteritems() %}
  22. /srv/salt/env/{{ name }}/minion_keys:
  23. file.symlink:
  24. - target: /srv/salt/minion_keys
  25. - require:
  26. - file: /srv/salt/minion_keys
  27. {%- endfor %}
  28. {%- for minion in master.minion %}
  29. generate_key_{{ minion.name }}:
  30. cmd.run:
  31. - name: salt-key --gen-keys={{ minion.name }} --gen-keys-dir=/srv/salt/minion_keys
  32. - unless: "test -e /srv/salt/minion_keys/{{ minion.name}}.pem"
  33. - require:
  34. - file: /srv/salt/minion_keys
  35. copy_generated_key_{{ minion.name }}:
  36. cmd.run:
  37. - name: cp /srv/salt/minion_keys/{{ minion.name }}.pub /etc/salt/pki/master/minions/{{ minion.name }}
  38. - unless: "test -e /etc/salt/pki/master/minions/{{ minion.name }}"
  39. - require:
  40. - cmd: generate_key_{{ minion.name }}
  41. {%- endfor %}
  42. {%- endif %}
  43. {%- endif %}