Synchronization of files from syndic node to master of masters for localfs cache backend (default)
Change-Id: Id84434f5e0b699a00d0165a3e2318f4ad54f530d
diff --git a/salt/map.jinja b/salt/map.jinja
index 097db7e..8920fa6 100644
--- a/salt/map.jinja
+++ b/salt/map.jinja
@@ -22,6 +22,7 @@
pillar:
engine: salt
max_event_size: 100000000
+ minion_data_cache: 'localfs'
{%- endload %}
{%- load_yaml as master_specific %}
diff --git a/salt/syndic.sls b/salt/syndic.sls
index 9858b3c..0b1867a 100644
--- a/salt/syndic.sls
+++ b/salt/syndic.sls
@@ -1,4 +1,4 @@
-{%- from "salt/map.jinja" import syndic with context %}
+{%- from "salt/map.jinja" import master, syndic with context %}
{%- if syndic.enabled %}
include:
@@ -22,4 +22,53 @@
- name: {{ syndic.service }}
- enable: true
-{%- endif %}
\ No newline at end of file
+{%- if master.minion_data_cache == 'localfs' %}
+
+{%- for master in syndic.get('masters', []) %}
+
+salt_syndic_master_{{ master }}_fingerprint:
+ ssh_known_hosts.present:
+ - name: {{ master.host }}
+ - user: root
+
+salt_syndic_master_{{ master }}_sync_cache:
+ rsync.synchronized:
+ - name: {{ master.host }}:/var/cache/salt/master/minions
+ - source: /var/cache/salt/master/minions/
+ - prepare: True
+ - update: True
+
+salt_syndic_master_{{ master }}_sync_keys:
+ rsync.synchronized:
+ - name: {{ master.host }}:/etc/salt/pki/master/minions
+ - source: /etc/salt/pki/master/minions/
+ - prepare: True
+ - update: True
+
+{%- else %}
+
+salt_syndic_master_fingerprint:
+ ssh_known_hosts.present:
+ - name: {{ syndic.master.host }}
+ - user: root
+
+salt_syndic_master_sync_cache:
+ rsync.synchronized:
+ - name: {{ syndic.master.host }}:/var/cache/salt/master/minions
+ - source: /var/cache/salt/master/minions/
+ - prepare: True
+ - update: True
+
+salt_syndic_master_sync_keys:
+ rsync.synchronized:
+ - name: {{ syndic.master.host }}:/etc/salt/pki/master/minions
+ - source: /etc/salt/pki/master/minions/
+ - prepare: True
+ - update: True
+
+{%- endfor %}
+
+{%- endif %}
+
+{%- endif %}
+