Преглед изворни кода

update cloud-backups to handle chloe nas

Blaine Story пре 1 дан
родитељ
комит
a47949c2c5
1 измењених фајлова са 15 додато и 0 уклоњено
  1. 15 0
      roles/cloud-backups/templates/backup-to-b2.sh.j2

+ 15 - 0
roles/cloud-backups/templates/backup-to-b2.sh.j2

@@ -7,6 +7,10 @@ rm -f /opt/backups/*
 
 {% if backups is defined and 'containers' in backups %}
 {% if containers is defined %}
+{% if "chloe-testnas" in ansible_hostname %}
+echo "Stopping VPN." | ts >> "$LOG_FILE"
+nordvpn d
+{% endif %}
 {% for container in containers %}
 {% if container.volumes is defined %}
 {% for volume in container.volumes %}
@@ -27,9 +31,11 @@ if [[ $? > 0 ]]; then
     https://ntfy.warchildstory.com/{{ ntfy_server_notifications }}
 fi
 echo "Finished backup of '{{ container.name }}:{{ volume | regex_replace(':.*') }}'." | ts >> "$LOG_FILE"
+{% if "chloe-testnas" not in ansible_hostname %}
 echo "Starting '{{ container.name }}' service..." | ts >> "$LOG_FILE"
 systemctl start {{ container.name }}
 echo "Service '{{ container.name }}' started." | ts >> "$LOG_FILE"
+{% endif %}
 
 {% endif %}
 {% endfor %}
@@ -42,6 +48,15 @@ echo "Backing up tarballs to B2..." | ts >> "$LOG_FILE"
     --log-file="$LOG_FILE" -v
 echo "Finished backing up tarballs to B2." | ts >> "$LOG_FILE"
 
+{% if "chloe-testnas" in ansible_hostname %}
+echo "Starting VPN..." | ts >> "$LOG_FILE"
+nordvpn c
+{% for container in containers %}
+echo "Starting {{ container.name }}." | ts >> "$LOG_FILE"
+systemctl start {{ container.name }}
+{% endfor %}
+{% endif %}
+
 {% endif %} 
 {% endif %}