From 030305fc22b16851935de4dc52f912c550bdbd09 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Wed, 15 May 2019 13:58:42 +0200 Subject: o New borg. --- ansible/roles/borg-client/tasks/main.yml | 59 ++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 ansible/roles/borg-client/tasks/main.yml (limited to 'ansible/roles/borg-client/tasks') 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 -- cgit v1.2.3