mirror of
https://github.com/pigmonkey/spark.git
synced 2026-01-23 02:24:09 +00:00
wrap tarsnapper via backitup
The default period is set to daily, so this doesn't change anything for existing users -- except that now we default to only executing on AC power. If existing users want to match the previous behavior they should set `tarsnapper.ac_power` to `false`.
This commit is contained in:
parent
9a96350452
commit
bcf52c7c29
7 changed files with 58 additions and 45 deletions
62
README.md
62
README.md
|
|
@ -207,26 +207,37 @@ and cache directory, users should recover their jobs files from backups after
|
|||
the Tarsnapper install is complete. See the Tarsnapper documentation for more
|
||||
details.
|
||||
|
||||
### Scheduling Tarsnap
|
||||
### Running Tarsnap
|
||||
|
||||
A systemd unit file and timer are included for Tarsnapper. The timer is set to
|
||||
execute Tarsnapper hourly (configurable through the `tarsnapper.timer.schedule`
|
||||
variable). However, as with `mailsync` this timer is not started or enabled by
|
||||
default. Instead, the timer is added to `/usr/local/etc/trusted_units`, causing
|
||||
the NetworkManager trusted unit dispatcher to activate the timer whenever a
|
||||
A systemd unit file and timer are included for Tarsnapper. Rather than calling
|
||||
it directly, the systemd unit wraps Tarsnapper with [backitup][22].
|
||||
|
||||
The timer is set to execute the unit hourly, but backitup will only call
|
||||
Tarsnapper once within the period defined in the `tarsnapper.period` variable.
|
||||
This defaults to `DAILY`. This increases the likelyhood of completing daily
|
||||
backups by checking each hour if the unit has run succesfully on the current
|
||||
calendar day.
|
||||
|
||||
In addition to the period limitation, backitup defaults to only calling
|
||||
Tarsnapper when it detects the machine ison AC power. To allow Tarsnapper to
|
||||
run when on battery, set the `tarsnapper.ac_only` variable to `False`.
|
||||
|
||||
As with `mailsync`, the timer is not started or enabled by default. Instead,
|
||||
the timer is added to `/usr/local/etc/trusted_units`, causing the
|
||||
NetworkManager trusted unit dispatcher to activate the timer whenever a
|
||||
connection is established to a trusted network. The timer is stopped whenever
|
||||
the network goes down or a connection is established to an untrusted network.
|
||||
|
||||
To have the timer activated at boot, change the `tarsnapper.timer.run_on`
|
||||
variable from `trusted` to `all`.
|
||||
To have the timer activated at boot, change the `tarsnapper.run_on` variable
|
||||
from `trusted` to `all`.
|
||||
|
||||
If the `tarsnapper.tarsnap.run_on` variable is set to anything other than
|
||||
`trusted` or `all`, the timer will never be activated.
|
||||
If the `tarsnapper.run_on` variable is set to anything other than `trusted` or
|
||||
`all`, the timer will never be activated.
|
||||
|
||||
|
||||
## Tor
|
||||
|
||||
[Tor][22] is installed by default. A systemd service unit for Tor is installed,
|
||||
[Tor][23] is installed by default. A systemd service unit for Tor is installed,
|
||||
but not enabled or started. instead, the service is added to
|
||||
`/usr/local/etc/trusted_units`, causing the NetworkManager trusted unit
|
||||
dispatcher to activate the service whenever a connection is established to a
|
||||
|
|
@ -241,14 +252,14 @@ configuration.
|
|||
|
||||
### parcimonie.sh
|
||||
|
||||
[parcimonie.sh][23] is provided to periodically refresh entries in the user's
|
||||
[parcimonie.sh][24] is provided to periodically refresh entries in the user's
|
||||
GnuPG keyring over the Tor network. The service is added to
|
||||
`/usr/local/etc/trusted_units` and respects the `tor.run_on` variable.
|
||||
|
||||
|
||||
## BitlBee
|
||||
|
||||
[BitlBee][24] and [WeeChat][25] are used to provide chat services. A systemd
|
||||
[BitlBee][25] and [WeeChat][26] are used to provide chat services. A systemd
|
||||
service unit for BitlBee is installed, but not enabled or started by default.
|
||||
Instead, the service is added to `/usr/local/etc/trusted_units`, causing the
|
||||
NetworkManager trusted unit dispatcher to activate the service whenever a
|
||||
|
|
@ -267,7 +278,7 @@ remove the `bitlebee.torify` variable or disable Tor entirely by removing the
|
|||
|
||||
## git-annex
|
||||
|
||||
[git-annex][26] is installed for file syncing. A systemd service unit for the
|
||||
[git-annex][27] is installed for file syncing. A systemd service unit for the
|
||||
git-annex assistant is enabled and started by default. To prevent this, remove
|
||||
the `gitannex` variable from the config.
|
||||
|
||||
|
|
@ -287,7 +298,7 @@ networks.
|
|||
|
||||
## PostgreSQL
|
||||
|
||||
[PostgreSQL][27] is installed and enabled by default. If the
|
||||
[PostgreSQL][28] is installed and enabled by default. If the
|
||||
`postgresql.enable` variable is set to anything other than `True` or is not
|
||||
defined, the service will not be started or enabled.
|
||||
|
||||
|
|
@ -301,8 +312,8 @@ database service inappropriate for production use.
|
|||
|
||||
## Himawaripy
|
||||
|
||||
[Himawaripy][28] is provided to fetch near-realtime photos of Earth from the
|
||||
Japanese [Himawari 8][29] weather satellite and set them as the user's desktop
|
||||
[Himawaripy][29] is provided to fetch near-realtime photos of Earth from the
|
||||
Japanese [Himawari 8][30] weather satellite and set them as the user's desktop
|
||||
background via feh. This should provide early warning of the presence of any
|
||||
Vogon constructor fleets appearing over the Eastern Hemisphere.
|
||||
|
||||
|
|
@ -346,11 +357,12 @@ By completely removing the `himawaripy` variable, no related tasks will be run.
|
|||
[19]: https://www.tarsnap.com/
|
||||
[20]: https://www.tarsnap.com/gettingstarted.html
|
||||
[21]: https://github.com/miracle2k/tarsnapper
|
||||
[22]: https://www.torproject.org/
|
||||
[23]: https://github.com/EtiennePerot/parcimonie.sh
|
||||
[24]: https://www.bitlbee.org/main.php/news.r.html
|
||||
[25]: https://weechat.org/
|
||||
[26]: https://git-annex.branchable.com/
|
||||
[27]: http://www.postgresql.org/
|
||||
[28]: https://github.com/boramalper/himawaripy
|
||||
[29]: https://en.wikipedia.org/wiki/Himawari_8
|
||||
[22]: https://github.com/pigmonkey/backitup
|
||||
[23]: https://www.torproject.org/
|
||||
[24]: https://github.com/EtiennePerot/parcimonie.sh
|
||||
[25]: https://www.bitlbee.org/main.php/news.r.html
|
||||
[26]: https://weechat.org/
|
||||
[27]: https://git-annex.branchable.com/
|
||||
[28]: http://www.postgresql.org/
|
||||
[29]: https://github.com/boramalper/himawaripy
|
||||
[30]: https://en.wikipedia.org/wiki/Himawari_8
|
||||
|
|
|
|||
|
|
@ -105,9 +105,9 @@ passwordless_sudo:
|
|||
|
||||
tarsnapper:
|
||||
deltas: 1h 1d 7d 30d 365d
|
||||
timer:
|
||||
schedule: daily
|
||||
run_on: trusted
|
||||
period: DAILY
|
||||
ac_only: True
|
||||
run_on: trusted
|
||||
|
||||
gitannex:
|
||||
stop_on_untrusted: True
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
[Unit]
|
||||
Description=Tarsnapper Backup Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/local/bin/tarsnapper -c /usr/local/etc/tarsnapper.conf make
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
---
|
||||
- name: restart tarsnapper
|
||||
service: name=tarsnapper.timer state=restarted
|
||||
when: tarsnapper.timer.run_on == "all"
|
||||
when: tarsnapper.run_on == "all"
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
template: src=tarsnapper.conf.j2 dest=/usr/local/etc/tarsnapper.conf
|
||||
|
||||
- name: Push Tarsnapper service file
|
||||
copy: src=tarsnapper.service dest=/etc/systemd/system/tarsnapper.service
|
||||
template: src=tarsnapper.service.j2 dest=/etc/systemd/system/tarsnapper.service
|
||||
notify:
|
||||
- reload systemd config
|
||||
|
||||
|
|
@ -42,20 +42,20 @@
|
|||
|
||||
- name: Enable and start Tarsnapper timer
|
||||
service: name=tarsnapper.timer enabled=yes state=started
|
||||
when: tarsnapper.timer.run_on == "all"
|
||||
when: tarsnapper.run_on == "all"
|
||||
|
||||
- name: Remove Tarsnapper from trusted unit list
|
||||
lineinfile: dest=/usr/local/etc/trusted_units
|
||||
state=absent
|
||||
line=tarsnapper.timer
|
||||
when: tarsnapper.timer.run_on == "all"
|
||||
when: tarsnapper.run_on == "all"
|
||||
|
||||
- name: Disable Tarsnapper timer
|
||||
service: name=tarsnapper.timer enabled=no
|
||||
when: tarsnapper.timer.run_on == "trusted"
|
||||
when: tarsnapper.run_on == "trusted"
|
||||
|
||||
- name: Add Tarsnapper to trusted unit list
|
||||
lineinfile: dest=/usr/local/etc/trusted_units
|
||||
state=present
|
||||
line=tarsnapper.timer
|
||||
when: tarsnapper.timer.run_on == "trusted"
|
||||
when: tarsnapper.run_on == "trusted"
|
||||
|
|
|
|||
10
roles/tarsnap/templates/tarsnapper.service.j2
Normal file
10
roles/tarsnap/templates/tarsnapper.service.j2
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# {{ ansible_managed }}
|
||||
[Unit]
|
||||
Description=Tarsnapper Backup Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/local/bin/backitup {% if tarsnapper.ac_only %}-a {% endif %}-p {{ tarsnapper.period }} -l /usr/local/etc/tarsnapper.lastrun -b "/usr/local/bin/tarsnapper -c /usr/local/etc/tarsnapper.conf make"
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
# {{ ansible_managed }}
|
||||
[Unit]
|
||||
Description=Tarsnapper Synchronization Timer
|
||||
Description=Tarsnapper Backup Service Timer
|
||||
|
||||
[Timer]
|
||||
Unit=tarsnapper.service
|
||||
OnCalendar={{ tarsnapper.timer.schedule }}
|
||||
OnCalendar=hourly
|
||||
Persistent=True
|
||||
|
||||
[Install]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue