aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/postgresql-server
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2018-08-27 09:50:56 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2018-08-27 09:50:56 +0200
commite7073180c18b8bc3d416cf370a8cd9181bccfecf (patch)
treec33b980dd14a4bd443ea7c7603c61cca20c0cada /ansible/roles/postgresql-server
parent3928d6e6d38b7f0c0a00b00ad312cfbcbc3db3ba (diff)
downloadinfra-e7073180c18b8bc3d416cf370a8cd9181bccfecf.tar.gz
infra-e7073180c18b8bc3d416cf370a8cd9181bccfecf.tar.bz2
infra-e7073180c18b8bc3d416cf370a8cd9181bccfecf.tar.xz
infra-e7073180c18b8bc3d416cf370a8cd9181bccfecf.zip
o Adding postgresql-server role.
Diffstat (limited to 'ansible/roles/postgresql-server')
-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
+ }