New version of salt-formula from Saltstack
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

55 líneas
1.2KB

  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. - template: jinja
  10. - makedirs: true
  11. - require:
  12. - {{ master.install_state }}
  13. {%- if master.minion is defined %}
  14. /srv/salt/minion_keys:
  15. file.directory:
  16. - makedirs: true
  17. - require:
  18. - {{ master.install_state }}
  19. {%- for name, environment in master.environment.iteritems() %}
  20. /srv/salt/env/{{ name }}/minion_keys:
  21. file.symlink:
  22. - target: /srv/salt/minion_keys
  23. - require:
  24. - file: /srv/salt/minion_keys
  25. {%- endfor %}
  26. {%- for minion in master.minion %}
  27. generate_key_{{ minion.name }}:
  28. cmd.run:
  29. - name: salt-key --gen-keys={{ minion.name }} --gen-keys-dir=/srv/salt/minion_keys
  30. - unless: "test -e /srv/salt/minion_keys/{{ minion.name}}.pem"
  31. - require:
  32. - file: /srv/salt/minion_keys
  33. copy_generated_key_{{ minion.name }}:
  34. cmd.run:
  35. - name: cp /srv/salt/minion_keys/{{ minion.name }}.pub /etc/salt/pki/master/minions/{{ minion.name }}
  36. - unless: "test -e /etc/salt/pki/master/minions/{{ minion.name }}"
  37. - require:
  38. - cmd: generate_key_{{ minion.name }}
  39. {%- endfor %}
  40. {%- endif %}
  41. {%- endif %}