diff --git a/configs.yml b/configs.yml index a52933d..f7ee496 100644 --- a/configs.yml +++ b/configs.yml @@ -11,14 +11,6 @@ etckeeper: - run: - sudo etckeeper commit "First commit" -gitea_backup_rsync: - - run: - - sudo ln -rsi dotfiles/systemd/gitea_backup_rsync.timer /etc/systemd/system/gitea_backup_rsync.timer - - run: - - sudo ln -rsi dotfiles/systemd/gitea_backup_rsync.service /etc/systemd/system/gitea_backup_rsync.service - - run: - - sudo systemctl enable gitea_backup_rsync.timer - gaming: - run: command: sudo cp /etc/pacman.conf /etc/pacman.conf.backup diff --git a/dotfiles/systemd/gitea_backup_rsync.service b/dotfiles/systemd/gitea_backup_rsync.service deleted file mode 100644 index 6ec854e..0000000 --- a/dotfiles/systemd/gitea_backup_rsync.service +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=Fetch gitea dumps from Lime2 with rsync -Wants=network-online.target -After=network-online.target nss-lookup.target - -[Service] -Type=simple -ExecStart=sudo -u flyingscorpio /usr/bin/rsync -zvva --delete tunuifranken.info:/home/git/gitea-dumps /run/media/flyingscorpio/spare/backups/rsync-backups/lime2 diff --git a/playbook.yml b/playbook.yml index 02cb377..d84858a 100644 --- a/playbook.yml +++ b/playbook.yml @@ -29,3 +29,4 @@ - { role: libvirt, tags: libvirt } - { role: mariadb, tags: mariadb } - { role: rsync-backup, tags: rsync-backup } + - { role: gitea-backup, tags: gitea-backup } diff --git a/dotfiles/systemd/gitea_backup_rsync.timer b/roles/gitea-backup/files/gitea-backup.timer similarity index 88% rename from dotfiles/systemd/gitea_backup_rsync.timer rename to roles/gitea-backup/files/gitea-backup.timer index 7bb0064..904f8b3 100644 --- a/dotfiles/systemd/gitea_backup_rsync.timer +++ b/roles/gitea-backup/files/gitea-backup.timer @@ -7,3 +7,5 @@ Persistent=true [Install] WantedBy=timers.target + +# vim: ft=systemd diff --git a/roles/gitea-backup/handlers/main.yml b/roles/gitea-backup/handlers/main.yml new file mode 100644 index 0000000..76c7c97 --- /dev/null +++ b/roles/gitea-backup/handlers/main.yml @@ -0,0 +1,11 @@ +--- +- name: Run daemon-reload + systemd: + daemon-reload: true + scope: user + +- name: Enable gitea-backup timer + systemd: + name: gitea-backup.timer + enabled: true + scope: user diff --git a/roles/gitea-backup/tasks/main.yml b/roles/gitea-backup/tasks/main.yml new file mode 100644 index 0000000..36b9a9c --- /dev/null +++ b/roles/gitea-backup/tasks/main.yml @@ -0,0 +1,14 @@ +--- +- name: Copy gitea-backup timer + copy: + src: gitea-backup.timer + dest: ~/.config/systemd/user/gitea-backup.timer + notify: + - Run daemon-reload + - Enable gitea-backup timer + +- name: Copy gitea-backup service + template: + src: gitea-backup.service.j2 + dest: ~/.config/systemd/user/gitea-backup.service + notify: Run daemon-reload diff --git a/roles/gitea-backup/templates/gitea-backup.service.j2 b/roles/gitea-backup/templates/gitea-backup.service.j2 new file mode 100644 index 0000000..7a2069c --- /dev/null +++ b/roles/gitea-backup/templates/gitea-backup.service.j2 @@ -0,0 +1,8 @@ +[Unit] +Description=Fetch gitea dumps from Lime2 with rsync +Wants=network-online.target +After=network-online.target nss-lookup.target + +[Service] +Type=simple +ExecStart=/usr/bin/rsync -zvva --delete tunuifranken.info:/home/git/gitea-dumps /run/media/{{ ansible_facts['env']['USER'] }}/spare/backups/rsync-backups/lime2