main.yml 767 Bytes
Newer Older
Robin Sonnabend's avatar
Robin Sonnabend committed
1
2
3
---

- name: ensure postgres packages are installed
4
  apt:
Robin Sonnabend's avatar
Robin Sonnabend committed
5
    name:
6
      - postgresql{{ "-{}".format(postgres_version) if postgres_version is defined }}
Robin Sonnabend's avatar
Robin Sonnabend committed
7
8
9
      - python-psycopg2
      - python3-psycopg2
      - libpq-dev
10
    state: present
Robin Sonnabend's avatar
Robin Sonnabend committed
11

Robin Sonnabend's avatar
Robin Sonnabend committed
12
- name: ensure postgres is started
13
14
15
  service:
    name: postgresql
    state: started
Lars Beckers's avatar
Lars Beckers committed
16
    enabled: true
17
18

- name: ensure we have our postgres backup script
19
20
21
22
23
  copy:
    src: pgbackup.sh
    dest: /usr/local/bin/
    owner: root
    group: root
Lars Beckers's avatar
Lars Beckers committed
24
    mode: '0755'
25
26

- name: ensure we have our rsnapshot config
27
28
  copy:
    src: rsnapshot.conf
29
    dest: /etc/rsnapshot.d/postgres.conf
30
31
    owner: root
    group: root
Lars Beckers's avatar
Lars Beckers committed
32
    mode: '0644'
33

34
35
36
37
- name: remove obsolete crontab
  file:
    path: /etc/cron.d/postgres-snapshot
    state: absent