Skip to content

Instantly share code, notes, and snippets.

@mamercad
Created September 20, 2021 17:06
Show Gist options
  • Save mamercad/e21bd1a67dab6acda11970c1a154a7aa to your computer and use it in GitHub Desktop.
Save mamercad/e21bd1a67dab6acda11970c1a154a7aa to your computer and use it in GitHub Desktop.
wal-g ansible tasks
- name: Deploy wal-g service
ansible.builtin.copy:
dest: /etc/systemd/system/wal-g.service
owner: root
group: root
mode: 0644
content: |
[Unit]
Description=wal-g backup-push
[Service]
Type=oneshot
ExecStart=/usr/bin/envdir /etc/wal-g.d/default /bin/sh -c 'wal-g backup-push $PGDATA'
ExecStart=/usr/bin/envdir /etc/wal-g.d/default /bin/sh -c 'wal-g delete retain FULL 7 --confirm'
User=postgres
become: true
notify: reload systemd
- name: Deploy wal-g timer
ansible.builtin.copy:
dest: /etc/systemd/system/wal-g.timer
owner: root
group: root
mode: 0644
content: |
[Unit]
Description=Run wal-g backup-push daily
[Timer]
OnCalendar=daily
Persistent=true
[Install]
WantedBy=timers.target
become: true
notify: reload systemd
- name: Enable wal-g backup-push oneshot service
ansible.builtin.systemd:
name: wal-g.service
enabled: true
become: true
- name: Enable and start the wal-g backup-push daily timer
ansible.builtin.systemd:
name: wal-g.timer
enabled: true
state: started
become: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment