2021-02-03 10:43:08 -05:00
|
|
|
---
|
|
|
|
- name: Start postgres container
|
2021-02-23 18:37:56 -05:00
|
|
|
become: yes
|
2021-02-03 10:43:08 -05:00
|
|
|
docker_container:
|
|
|
|
name: postgres
|
|
|
|
image: postgres:13.1
|
|
|
|
state: started
|
2021-03-02 10:42:25 -05:00
|
|
|
hostname: postgres
|
2021-02-03 10:43:08 -05:00
|
|
|
env:
|
|
|
|
POSTGRES_USER: newsblur
|
|
|
|
POSTGRES_PASSWORD: newsblur
|
|
|
|
restart_policy: unless-stopped
|
|
|
|
ports:
|
|
|
|
- '5432:5432'
|
|
|
|
volumes:
|
|
|
|
- /srv/newsblur/docker/volumes/postgres:/var/lib/postgresql/data
|
2021-06-19 12:35:28 -06:00
|
|
|
- /backup/:/backup/
|
2021-02-03 10:43:08 -05:00
|
|
|
|
2021-02-15 19:13:23 -05:00
|
|
|
- name: Register postgres in consul
|
2021-02-23 19:30:28 -05:00
|
|
|
tags: consul
|
2021-02-15 19:13:23 -05:00
|
|
|
become: yes
|
|
|
|
template:
|
|
|
|
src: consul_service.json
|
|
|
|
dest: /etc/consul.d/postgres.json
|
|
|
|
notify:
|
|
|
|
- reload consul
|
2021-06-07 15:44:59 -04:00
|
|
|
|
2021-06-18 14:57:29 -06:00
|
|
|
- name: Add sanity checkers cronjob for disk usage
|
2021-06-07 15:44:59 -04:00
|
|
|
become: yes
|
2021-06-18 14:57:29 -06:00
|
|
|
cron:
|
|
|
|
name: disk_usage_sanity_checker
|
2021-06-25 11:42:21 -06:00
|
|
|
user: root
|
|
|
|
cron_file: /etc/cron.hourly/disk_usage_sanity_checker
|
2021-06-18 14:57:29 -06:00
|
|
|
job: docker pull newsblur/newsblur_python3:latest;
|
2021-06-25 11:46:09 -06:00
|
|
|
docker run --rm -it
|
|
|
|
OUTPUT=$(eval sudo df / | head -n 2 | tail -1);
|
2021-06-18 14:57:29 -06:00
|
|
|
-v /srv/newsblur:/srv/newsblur
|
2021-06-25 11:42:21 -06:00
|
|
|
--network=newsblurnet
|
|
|
|
--hostname {{ ansible_hostname }}
|
2021-06-25 11:46:09 -06:00
|
|
|
newsblur/newsblur_python3 /srv/newsblur/utils/monitor_disk_usage.py $OUTPUT
|
2021-06-19 12:35:28 -06:00
|
|
|
|
|
|
|
- name: Add postgres backup
|
|
|
|
cron:
|
|
|
|
name: postgres backup
|
|
|
|
minute: "0"
|
|
|
|
hour: "4"
|
2021-06-19 13:01:38 -06:00
|
|
|
job:
|
|
|
|
docker run --rm
|
|
|
|
-v /srv/newsblur:/srv/newsblur
|
|
|
|
-v /backup/:/backup/
|
|
|
|
--network=newsblurnet
|
|
|
|
/srv/newsblur/utils/backups/backup_psql.py
|