aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/borg-client/tasks
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2019-05-15 13:58:42 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2019-08-08 09:03:00 +0200
commit030305fc22b16851935de4dc52f912c550bdbd09 (patch)
tree3153888a7d1b63468194f0e8334ffbf4ef63dbea /ansible/roles/borg-client/tasks
parent4bd33c6a46f57f8a830042795cfaa68ef91963a9 (diff)
downloadinfra-030305fc22b16851935de4dc52f912c550bdbd09.tar.gz
infra-030305fc22b16851935de4dc52f912c550bdbd09.tar.bz2
infra-030305fc22b16851935de4dc52f912c550bdbd09.tar.xz
infra-030305fc22b16851935de4dc52f912c550bdbd09.zip
o New borg.
Diffstat (limited to 'ansible/roles/borg-client/tasks')
-rw-r--r--ansible/roles/borg-client/tasks/main.yml59
1 files changed, 59 insertions, 0 deletions
diff --git a/ansible/roles/borg-client/tasks/main.yml b/ansible/roles/borg-client/tasks/main.yml
new file mode 100644
index 0000000..d5767cd
--- /dev/null
+++ b/ansible/roles/borg-client/tasks/main.yml
@@ -0,0 +1,59 @@
+- tags: packages
+ apt:
+ name:
+ - borgbackup
+ install_recommends: no
+
+- name: "mkdir /etc/tergum"
+ file:
+ path: "/etc/tergum"
+ state: directory
+ mode: u=rwx,go=
+ owner: root
+ group: root
+
+- copy:
+ dest: /etc/tergum/ssh-key
+ src: "{{ borg_client__ssh_key }}"
+ mode: u=rwx,go=
+ owner: root
+ group: root
+
+- name: "/etc/systemd/system/tergum@.service"
+ copy:
+ dest: "/etc/systemd/system/tergum@.service"
+ content: |
+ [Unit]
+ Description=Borg backup
+
+ [Service]
+ Type=oneshot
+ WorkingDirectory=/
+ ExecStart=-/usr/bin/tergum %i
+ #ExecStartPost=-/usr/bin/tergum-post foo@example.org
+ SuccessExitStatus=0 1
+ EnvironmentFile=/etc/tergum/jobs/%i/env
+ notify:
+ - systemctl daemon-reload
+
+- name: "/etc/systemd/system/tergum@.timer"
+ copy:
+ dest: "/etc/systemd/system/tergum@.timer"
+ content: |
+ [Unit]
+ Description=Borg
+
+ [Install]
+ WantedBy=timers.target
+ notify:
+ - systemctl daemon-reload
+
+- template:
+ dest: "/usr/bin/{{ item }}"
+ src: "bin/{{ item }}"
+ mode: u=rwx,go=rx
+ owner: root
+ group: root
+ with_items:
+ - tergum
+ - tergum-post