First commit

This commit is contained in:
VC
2019-09-04 09:06:55 +02:00
commit dded46ff64
144 changed files with 7495 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
- name: install postgresql
package:
name: postgresql
state: present
- name: create pgsql directory
file:
path: /srv/postgresql
owner: postgres
group: postgres
state: directory
- name: populate postgresql directory
command: "/usr/lib/postgresql/{{ pg_version }}/bin/initdb -E UTF-8 /srv/postgresql/"
become: yes
become_user: postgres
args:
creates: /srv/postgresql/PG_VERSION
notify: restart postgres
- name: replace main conffile
copy:
src: files/postgresql.conf
dest: "/etc/postgresql/{{ pg_version }}/main/postgresql.conf"
notify: restart postgres
- name: replace pg_hba file
copy:
src: files/pg_hba.conf
dest: "/etc/postgresql/{{ pg_version }}/main/pg_hba.conf"
notify: restart postgres
- name: create backup dir
file:
path: /srv/backup/pgsql
owner: postgres
group: postgres
state: directory
- name: backup pg databases
cron:
user: postgres
minute: "0"
hour: "4"
name: PG Backup
job: "/usr/bin/pg_dumpall | gzip -c > /srv/backup/pgsql/all.dbs.gz"