summaryrefslogtreecommitdiff
path: root/baserock_backup/instance-config.yml
blob: 8ccbb58403d092aa31db53b6b2d4c2de8a970e44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Configuration for a machine that runs data backups of baserock.org.
#
# The current backup machine is not a reproducible deployment, but this
# playbook should be easily adaptable to produce a properly reproducible
# one.
---
- hosts: baserock-backup1
  gather_facts: false
  tasks:
    - name: user for running backups
      user: name=backup

    # You'll need to copy in the SSH key manually for this user.

    - name: SSH config for backup user
      copy: src=ssh_config dest=/home/backup/.ssh/config

    - name: backup script
      copy: src=backup.sh dest=/home/backup/backup.sh mode=755

    # You will need https://github.com/ansible/ansible-modules-core/pull/986
    # for this to work.
    - name: backup cron job, runs every day at midnight
      cron:
        hour: 00
        minute: 00
        job: /home/backup/backup.sh
        name: baserock.org data backup
        user: backup

    # As the .service file says, running the backup script via 'cron' is
    # a workaround for what may be a bug in systemd. I don't have the energy
    # to investigate the problem right now.
    - name: .service file for Busybox 'cron' daemon
      copy: src=crond.service dest=/etc/systemd/system mode=644

    - name: service for Busybox 'cron' daemon
      service: name=crond enabled=yes state=started