diff --git a/roles/borg_client/templates/borg-backup-offsite.service.j2 b/roles/borg_client/files/borg-backup-offsite.service similarity index 73% rename from roles/borg_client/templates/borg-backup-offsite.service.j2 rename to roles/borg_client/files/borg-backup-offsite.service index 73bc8ad1bb99289e1d99b7551aa2c23e07624491..5321ca84ea19434572ffca3ae5cce013e291bff1 100644 --- a/roles/borg_client/templates/borg-backup-offsite.service.j2 +++ b/roles/borg_client/files/borg-backup-offsite.service @@ -3,5 +3,4 @@ Description=Borg backup (offsite) [Service] Type=oneshot -{% include 'borg-backup-cpu-quota.j2' %} ExecStart=/usr/local/bin/borg-backup-offsite.sh diff --git a/roles/borg_client/templates/borg-backup.service.j2 b/roles/borg_client/files/borg-backup.service similarity index 80% rename from roles/borg_client/templates/borg-backup.service.j2 rename to roles/borg_client/files/borg-backup.service index be2d3450d9359ba6decc547013ab93fadc47f997..616b10e93cda19a3f2337538fb61165f8568652d 100644 --- a/roles/borg_client/templates/borg-backup.service.j2 +++ b/roles/borg_client/files/borg-backup.service @@ -6,5 +6,4 @@ Before=borg-backup-offsite.service [Service] Type=oneshot -{% include 'borg-backup-cpu-quota.j2' %} ExecStart=/usr/local/bin/borg-backup.sh diff --git a/roles/borg_client/tasks/main.yml b/roles/borg_client/tasks/main.yml index 6311f9893bcc825ce54b601d222c2d789fc4ebea..d0848d5a47e80082597626390475ce194e33dd1e 100644 --- a/roles/borg_client/tasks/main.yml +++ b/roles/borg_client/tasks/main.yml @@ -48,14 +48,12 @@ - name: Create mysql backup directory file: path={{ backup_mysql_dir }} state=directory owner=root group=root mode=0755 -- name: Install systemd services for backup - template: src={{ item }}.j2 dest=/etc/systemd/system/{{ item }} owner=root group=root mode=0644 +- name: Install systemd timer and services for backup + copy: src={{ item }} dest=/etc/systemd/system/{{ item }} owner=root group=root mode=0644 with_items: + - borg-backup.timer - borg-backup.service - borg-backup-offsite.service -- name: Install systemd timer for backup - copy: src=borg-backup.timer dest=/etc/systemd/system/borg-backup.timer owner=root group=root mode=0644 - - name: Activate systemd timer for backup systemd: name=borg-backup.timer enabled=yes state=started daemon-reload=yes diff --git a/roles/borg_client/templates/borg-backup-cpu-quota.j2 b/roles/borg_client/templates/borg-backup-cpu-quota.j2 deleted file mode 100644 index 5d264b34594a19122061c55fbac37227d8c32c15..0000000000000000000000000000000000000000 --- a/roles/borg_client/templates/borg-backup-cpu-quota.j2 +++ /dev/null @@ -1,4 +0,0 @@ -{% if ansible_processor_vcpus == 1 %} -{# Limit CPU usage to avoid triggering a HostHighCpuLoad alert #} -CPUQuota=50% -{% endif %}