
To complete our transition to borg backups, remove bup-related bits from backup hosts. All hosts have been backing up with borg since Ic3adfd162fa9bedd84402e3c25b5c1bebb21f3cb. Change-Id: Ie99f8cee9befee28bcf74bff9f9994c4b17b87ff
58 lines
1.2 KiB
YAML
58 lines
1.2 KiB
YAML
- name: Generate bup username for this host
|
|
set_fact:
|
|
bup_username: 'bup-{{ inventory_hostname.split(".", 1)[0] }}'
|
|
when: bup_username is not defined
|
|
|
|
- debug:
|
|
var: bup_username
|
|
|
|
- name: Install bup
|
|
package:
|
|
name:
|
|
- bup
|
|
state: absent
|
|
|
|
- name: Remove old keypair
|
|
file:
|
|
path: /root/.ssh/id_backup_ed25519
|
|
state: absent
|
|
|
|
- name: Remove old keypair
|
|
file:
|
|
path: /root/.ssh/id_backup_ed25519.pub
|
|
state: absent
|
|
|
|
- name: Remove old config directory
|
|
file:
|
|
path: /root/.bup
|
|
state: absent
|
|
|
|
- name: Remove ssh config
|
|
blockinfile:
|
|
path: /root/.ssh/config
|
|
state: absent
|
|
create: false
|
|
block: |
|
|
Host {{ item }}
|
|
HostName {{ item }}
|
|
IdentityFile /root/.ssh/id_backup_ed25519
|
|
User {{ bup_username }}
|
|
mode: 0600
|
|
with_inventory_hostnames: backup-server
|
|
ignore_errors: True
|
|
|
|
- name: Remove /etc/bup-excludes
|
|
file:
|
|
path: /etc/bup-excludes
|
|
state: absent
|
|
|
|
- name: Remove backup cronjob
|
|
cron:
|
|
name: "Run bup backup"
|
|
job: "tar -X /etc/bup-excludes -cPF - / | bup split -r {{ bup_username }}@{{ item }}: -n root -q"
|
|
user: root
|
|
hour: '5'
|
|
minute: '{{ 59|random(seed=item) }}'
|
|
state: absent
|
|
with_inventory_hostnames: backup-server
|