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.

46 lines
1.0KB

  1. {%- from "salt/map.jinja" import master with context %}
  2. {%- if master.enabled %}
  3. include:
  4. - salt.master.service
  5. {%- if master.minion is defined %}
  6. /srv/salt/minion_keys:
  7. file.directory:
  8. - makedirs: true
  9. - require:
  10. - pkg: salt_master_packages
  11. {%- for name, environment in master.environment.iteritems() %}
  12. /srv/salt/env/{{ name }}/minion_keys:
  13. file.symlink:
  14. - target: /srv/salt/minion_keys
  15. - require:
  16. - file: /srv/salt/minion_keys
  17. {%- endfor %}
  18. {%- for minion in master.minion %}
  19. generate_key_{{ minion.name }}:
  20. cmd.run:
  21. - name: salt-key --gen-keys={{ minion.name }} --gen-keys-dir=/srv/salt/minion_keys
  22. - unless: "test -e /srv/salt/minion_keys/{{ minion.name}}.pem"
  23. - require:
  24. - file: /srv/salt/minion_keys
  25. copy_generated_key_{{ minion.name }}:
  26. cmd.run:
  27. - name: cp /srv/salt/minion_keys/{{ minion.name }}.pub /etc/salt/pki/master/minions/{{ minion.name }}
  28. - unless: "test -e /etc/salt/pki/master/minions/{{ minion.name }}"
  29. - require:
  30. - cmd: generate_key_{{ minion.name }}
  31. {%- endfor %}
  32. {%- endif %}
  33. {%- endif %}