parametrize client restrictions
Change-Id: Idfe4036a558204cb839bb3542b7bd9cdb1277a1d
diff --git a/README.rst b/README.rst
index ef4d3de..f8834b6 100644
--- a/README.rst
+++ b/README.rst
@@ -63,7 +63,6 @@
.. note:: full_backups_to_keep param states how many backup will be stored locally on zookeeper client
-
Backup server rsync
.. code-block:: yaml
@@ -79,6 +78,14 @@
enabled: true
key: ssh_rsa
+Backup server without strict client restriction
+
+.. code-block:: yaml
+
+ zookeeper:
+ backup:
+ restrict_clients: false
+
Client restore from local backup:
.. code-block:: yaml
diff --git a/zookeeper/backup.sls b/zookeeper/backup.sls
index 3be7180..f060dd4 100644
--- a/zookeeper/backup.sls
+++ b/zookeeper/backup.sls
@@ -106,16 +106,18 @@
{%- if key.get('enabled', False) %}
{%- set clients = [] %}
-{%- for node_name, node_grains in salt['mine.get']('*', 'grains.items').iteritems() %}
-{%- if node_grains.get('zookeeper', {}).get('backup', {}).get('client') %}
-{%- set client = node_grains.get('zookeeper').get('backup').get('client') %}
-{%- if client.get('addresses') and client.get('addresses', []) is iterable %}
-{%- for address in client.addresses %}
-{%- do clients.append(address|string) %}
-{%- endfor %}
+{%- if backup.restrict_clients %}
+ {%- for node_name, node_grains in salt['mine.get']('*', 'grains.items').iteritems() %}
+ {%- if node_grains.get('zookeeper', {}).get('backup', {}).get('client') %}
+ {%- set client = node_grains.get('zookeeper').get('backup').get('client') %}
+ {%- if client.get('addresses') and client.get('addresses', []) is iterable %}
+ {%- for address in client.addresses %}
+ {%- do clients.append(address|string) %}
+ {%- endfor %}
+ {%- endif %}
+ {%- endif %}
+ {%- endfor %}
{%- endif %}
-{%- endif %}
-{%- endfor %}
zookeeper_key_{{ key.key }}:
ssh_auth.present:
diff --git a/zookeeper/map.jinja b/zookeeper/map.jinja
index 83b2f1a..04eafe4 100644
--- a/zookeeper/map.jinja
+++ b/zookeeper/map.jinja
@@ -25,11 +25,13 @@
- rsync
backup_dir: '/var/backups/zookeeper'
cron: True
+ restrict_clients: True
RedHat:
pkgs:
- rsync
backup_dir: '/var/backups/zookeeper'
cron: True
+ restrict_clients: True
{%- endload %}