aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ansible/roles/postgresql-server/handlers/main.yml4
-rw-r--r--ansible/roles/postgresql-server/tasks/main.yml47
2 files changed, 51 insertions, 0 deletions
diff --git a/ansible/roles/postgresql-server/handlers/main.yml b/ansible/roles/postgresql-server/handlers/main.yml
new file mode 100644
index 0000000..03ed878
--- /dev/null
+++ b/ansible/roles/postgresql-server/handlers/main.yml
@@ -0,0 +1,4 @@
+---
+- name: update apt cache
+ apt:
+ update_cache: yes
diff --git a/ansible/roles/postgresql-server/tasks/main.yml b/ansible/roles/postgresql-server/tasks/main.yml
new file mode 100644
index 0000000..9f13e53
--- /dev/null
+++ b/ansible/roles/postgresql-server/tasks/main.yml
@@ -0,0 +1,47 @@
+---
+- name: postgresql-server
+ tags:
+ - postgresql-server
+ block:
+ - name: Install PostgreSQL APT key
+ tags: pg
+ notify: update apt cache
+ apt_key:
+ id: ACCC4CF8
+ keyserver: keyserver.ubuntu.com
+
+ - name: PostgreSQL APT repository
+ tags: pg
+ notify: update apt cache
+ copy:
+ dest: /etc/apt/sources.list.d/postgresql.list
+ content: 'deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main'
+
+- meta: flush_handlers
+
+- tags:
+ - postgresql-server
+ block:
+ - name: packages
+ apt:
+ name: "{{ item }}"
+ install_recommends: no
+ with_items:
+ - postgresql-10
+ - postgresql-client-10
+
+ - name: Logrotate
+ copy:
+ dest: /etc/logrotate.d/postgresql-common
+ content: |
+ # Managed by Ansible
+ /var/log/postgresql/*.log {
+ daily
+ dateext
+ copytruncate
+ delaycompress
+ compress
+ notifempty
+ missingok
+ su root root
+ }