Commit 3fb7ccd9 authored by Lars Beckers's avatar Lars Beckers
Browse files

postgres: allow for disabling frequently snapshots

parent 26f6160e
---
postgres_enable_frequently: True
---
# file: roles/postgres/tasks/main.yml
- name: ensure postgres packages are installed
apt: name={{ item }} state=latest
apt:
name: "{{ item }}"
state: present
with_items:
- postgresql
- python-psycopg2
- python3-psycopg2
- libpq-dev
tags:
- packages
- postgres
- name: ensure postgres is started
service: name=postgresql state=started enabled=yes
service:
name: postgresql
state: started
enabled: yes
tags:
- service
- postgres
- name: ensure we have rsnapshot
apt: name=rsnapshot state=latest
apt:
name: rsnapshot
state: present
tags:
- packages
- postgres
- rsnapshot
- backup
- name: ensure we have our postgres backup script
copy: src=pgbackup.sh dest=/usr/local/bin/ owner=root group=root mode=0755
copy:
src: pgbackup.sh
dest: /usr/local/bin/
owner: root
group: root
mode: 0755
tags:
- postgres
- rsnapshot
- backup
- name: ensure we have our rsnapshot config
copy: src=rsnapshot.conf dest=/etc/ owner=root group=root mode=0644
template:
src: rsnapshot.conf.j2
dest: /etc/
owner: root
group: root
mode: 0644
tags:
- postgres
- rsnapshot
- backup
- config
- name: ensure rsnapshot is running regularly
copy: src=crontab dest=/etc/cron.d/postgres-snapshot owner=root group=root mode=0644
template:
src: crontab.j2
dest: /etc/cron.d/postgres-snapshot
owner: root
group: root
mode: 0644
tags:
- postgres
- rsnapshot
- backup
- cron
- config
{% if postgres_enable_frequently %}
5,20,35,50 * * * * root /usr/bin/rsnapshot frequently
{% endif %}
3 * * * * root /usr/bin/rsnapshot hourly
51 23 * * * root /usr/bin/rsnapshot daily
41 23 * * 6 root /usr/bin/rsnapshot weekly
......
......@@ -90,7 +90,9 @@ cmd_logger /usr/bin/logger
# e.g. alpha, beta, gamma, etc. #
#########################################
{% if postgres_enable_frequently %}
retain frequently 4
{% endif %}
retain hourly 6
retain daily 7
retain weekly 4
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment