New version of salt-formula from Saltstack
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

minion.sls 1.0KB

9 anos atrás
123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 %}