aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2019-02-19 16:05:48 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2019-02-19 16:05:48 +0100
commitd4de905ae685c750fa7f0b8f65db579d4aeec193 (patch)
tree5d8065380459cad047a7f4910698626c2eb5f750
parentc48017bd76aa68513468a61e83dced9d0105bfba (diff)
downloadinfra-d4de905ae685c750fa7f0b8f65db579d4aeec193.tar.gz
infra-d4de905ae685c750fa7f0b8f65db579d4aeec193.tar.bz2
infra-d4de905ae685c750fa7f0b8f65db579d4aeec193.tar.xz
infra-d4de905ae685c750fa7f0b8f65db579d4aeec193.zip
borg-client: Making sure we're online before doing backup.
-rw-r--r--ansible/roles/borg-client/handlers/main.yml2
-rw-r--r--ansible/roles/borg-client/tasks/borg-client.yml10
-rw-r--r--ansible/roles/borg-client/templates/bin/create-backup-send-email1
3 files changed, 6 insertions, 7 deletions
diff --git a/ansible/roles/borg-client/handlers/main.yml b/ansible/roles/borg-client/handlers/main.yml
index 6e31199..2b4b222 100644
--- a/ansible/roles/borg-client/handlers/main.yml
+++ b/ansible/roles/borg-client/handlers/main.yml
@@ -1,4 +1,4 @@
-- name: systemd daemon-reload
+- name: systemctl daemon-reload
become: yes
systemd:
daemon_reload: true
diff --git a/ansible/roles/borg-client/tasks/borg-client.yml b/ansible/roles/borg-client/tasks/borg-client.yml
index 3d2d74a..4ddad49 100644
--- a/ansible/roles/borg-client/tasks/borg-client.yml
+++ b/ansible/roles/borg-client/tasks/borg-client.yml
@@ -78,6 +78,8 @@
content: |
[Unit]
Description=Create backup
+ After=network-online.target
+ Wants=network-online.target
[Service]
Type=oneshot
@@ -85,10 +87,8 @@
ExecStart=-/usr/local/bin/create-backup
ExecStartPost=-/usr/local/bin/create-backup-send-email root@trygvis.io
SuccessExitStatus=0 1
- After=network-online.target
- Wants=network-online.target
notify:
- - systemd daemon-reload
+ - systemctl daemon-reload
- name: /etc/systemd/system/create-backup.timer
copy:
@@ -103,7 +103,7 @@
[Install]
WantedBy=timers.target
notify:
- - systemd daemon-reload
+ - systemctl daemon-reload
- service start create-backup.timer
# TODO: remove
@@ -112,4 +112,4 @@
state: absent
register: create_backup_send_email_service
notify:
- - systemd daemon-reload
+ - systemctl daemon-reload
diff --git a/ansible/roles/borg-client/templates/bin/create-backup-send-email b/ansible/roles/borg-client/templates/bin/create-backup-send-email
index 65286b1..7665571 100644
--- a/ansible/roles/borg-client/templates/bin/create-backup-send-email
+++ b/ansible/roles/borg-client/templates/bin/create-backup-send-email
@@ -4,7 +4,6 @@ set -euo pipefail
cd /
-
/usr/sbin/sendmail -t <<ERRMAIL
To: $1
From: systemd <root@$HOSTNAME>