New version of salt-formula from Saltstack
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1.7KB

  1. {%- from "salt/map.jinja" import master, syndic with context %}
  2. {%- if syndic.enabled %}
  3. include:
  4. - salt.master.service
  5. salt_syndic_packages:
  6. pkg.installed:
  7. - names: {{ syndic.pkgs }}
  8. /etc/salt/master.d/_syndic.conf:
  9. file.managed:
  10. - source: salt://salt/files/_syndic.conf
  11. - user: root
  12. - template: jinja
  13. - watch_in:
  14. - service: salt_master_service
  15. - service: salt_syndic_service
  16. salt_syndic_service:
  17. service.running:
  18. - name: {{ syndic.service }}
  19. - enable: true
  20. {%- if master.minion_data_cache == 'localfs' %}
  21. {%- for master in syndic.get('masters', []) %}
  22. salt_syndic_master_{{ master }}_fingerprint:
  23. ssh_known_hosts.present:
  24. - name: {{ master.host }}
  25. - user: root
  26. salt_syndic_master_{{ master }}_sync_cache:
  27. rsync.synchronized:
  28. - name: {{ master.host }}:/var/cache/salt/master/minions
  29. - source: /var/cache/salt/master/minions/
  30. - prepare: True
  31. - update: True
  32. salt_syndic_master_{{ master }}_sync_keys:
  33. rsync.synchronized:
  34. - name: {{ master.host }}:/etc/salt/pki/master/minions
  35. - source: /etc/salt/pki/master/minions/
  36. - prepare: True
  37. - update: True
  38. {%- else %}
  39. salt_syndic_master_fingerprint:
  40. ssh_known_hosts.present:
  41. - name: {{ syndic.master.host }}
  42. - user: root
  43. salt_syndic_master_sync_cache:
  44. rsync.synchronized:
  45. - name: {{ syndic.master.host }}:/var/cache/salt/master/minions
  46. - source: /var/cache/salt/master/minions/
  47. - prepare: True
  48. - update: True
  49. salt_syndic_master_sync_keys:
  50. rsync.synchronized:
  51. - name: {{ syndic.master.host }}:/etc/salt/pki/master/minions
  52. - source: /etc/salt/pki/master/minions/
  53. - prepare: True
  54. - update: True
  55. {%- endfor %}
  56. {%- endif %}
  57. {%- endif %}