possibility to absent public key from server and crons
PROD-17856
Change-Id: I7d7246d8074d84e041891a0d46c5ca45afa5e693
diff --git a/cassandra/backup.sls b/cassandra/backup.sls
index 2301888..93a5ce1 100644
--- a/cassandra/backup.sls
+++ b/cassandra/backup.sls
@@ -42,13 +42,12 @@
- group: root
- makedirs: true
+{%- if backup.cron %}
+
cassandra_backup_runner_cron:
cron.present:
- name: /usr/local/bin/cassandra-backup-runner-call.sh
- user: root
-{%- if not backup.cron %}
- - commented: True
-{%- endif %}
{%- if backup.client.backup_times is defined %}
{%- if backup.client.backup_times.dayOfWeek is defined %}
- dayweek: {{ backup.client.backup_times.dayOfWeek }}
@@ -79,6 +78,14 @@
- file: cassandra_backup_runner_script
- file: cassandra_call_backup_runner_script
+{%- else %}
+
+cassandra_backup_runner_cron:
+ cron.absent:
+ - name: /usr/local/bin/cassandra-backup-runner-call.sh
+ - user: root
+
+{%- endif %}
{%- if backup.client.restore_latest is defined %}
@@ -168,6 +175,13 @@
- require:
- file: {{ backup.backup_dir }}/full
+{%- else %}
+
+cassandra_key_{{ key.key }}:
+ ssh_auth.absent:
+ - user: cassandra
+ - name: {{ key.key }}
+
{%- endif %}
{%- endfor %}
@@ -181,18 +195,26 @@
- require:
- pkg: cassandra_backup_server_packages
+{%- if backup.cron %}
+
cassandra_server_cron:
cron.present:
- name: /usr/local/bin/cassandra-backup-runner.sh
- user: cassandra
-{%- if not backup.cron %}
- - commented: True
-{%- endif %}
- minute: 0
- hour: 2
- require:
- file: cassandra_server_script
+{%- else %}
+
+cassandra_server_cron:
+ cron.absent:
+ - name: /usr/local/bin/cassandra-backup-runner.sh
+ - user: cassandra
+
+{%- endif %}
+
cassandra_server_call_restore_script:
file.managed:
- name: /usr/local/bin/cassandra-restore-call.sh