aboutsummaryrefslogtreecommitdiffstats
path: root/ansible/roles/postgres
diff options
context:
space:
mode:
authorSimen Linderud <simen.linderud@gmail.com>2019-01-19 19:26:41 +0100
committerGitHub <noreply@github.com>2019-01-19 19:26:41 +0100
commit54419582734d0fb820c8c08a7847eb6961f481c5 (patch)
treed1a22a24322d2a26dcddb79347fab4061be49eac /ansible/roles/postgres
parentf11803f365ec8729d3056642468e975c3cf8a85b (diff)
parentbb1cc93d51efcd24d77b51187638e9616c061ed6 (diff)
Merge pull request #194 from lasseh/master
Update ansible play for Debian 9
Diffstat (limited to 'ansible/roles/postgres')
-rw-r--r--ansible/roles/postgres/files/postgresql.conf10
-rw-r--r--ansible/roles/postgres/tasks/main.yml16
2 files changed, 8 insertions, 18 deletions
diff --git a/ansible/roles/postgres/files/postgresql.conf b/ansible/roles/postgres/files/postgresql.conf
index cf6e67e..7c45ea4 100644
--- a/ansible/roles/postgres/files/postgresql.conf
+++ b/ansible/roles/postgres/files/postgresql.conf
@@ -38,15 +38,15 @@
# The default values of these variables are driven from the -D command-line
# option or PGDATA environment variable, represented here as ConfigDir.
-data_directory = '/var/lib/postgresql/9.4/main' # use data in another directory
+data_directory = '/var/lib/postgresql/9.6/main' # use data in another directory
# (change requires restart)
-hba_file = '/etc/postgresql/9.4/main/pg_hba.conf' # host-based authentication file
+hba_file = '/etc/postgresql/9.6/main/pg_hba.conf' # host-based authentication file
# (change requires restart)
-ident_file = '/etc/postgresql/9.4/main/pg_ident.conf' # ident configuration file
+ident_file = '/etc/postgresql/9.6/main/pg_ident.conf' # ident configuration file
# (change requires restart)
# If external_pid_file is not explicitly set, no extra PID file is written.
-external_pid_file = '/var/run/postgresql/9.4-main.pid' # write an extra PID file
+external_pid_file = '/var/run/postgresql/9.6-main.pid' # write an extra PID file
# (change requires restart)
@@ -450,7 +450,7 @@ log_timezone = 'UTC'
#track_functions = none # none, pl, all
#track_activity_query_size = 1024 # (change requires restart)
#update_process_title = on
-stats_temp_directory = '/var/run/postgresql/9.4-main.pg_stat_tmp'
+stats_temp_directory = '/var/run/postgresql/9.6-main.pg_stat_tmp'
# - Statistics Monitoring -
diff --git a/ansible/roles/postgres/tasks/main.yml b/ansible/roles/postgres/tasks/main.yml
index 6283a75..902eeb9 100644
--- a/ansible/roles/postgres/tasks/main.yml
+++ b/ansible/roles/postgres/tasks/main.yml
@@ -1,17 +1,13 @@
-# Postgres
+# Postgres
# https://github.com/ansible/ansible/issues/16048#issuecomment-229012509
#
- name: Install db-packages
apt:
- name: "{{ item }}"
+ name: ['postgresql', 'python-psycopg2', 'sudo']
state: present
- with_items:
- - postgresql-9.4
- - python-psycopg2
- - sudo
- name: Drop postgresql-config
copy:
- dest: /etc/postgresql/9.4/main/postgresql.conf
+ dest: /etc/postgresql/9.6/main/postgresql.conf
src: postgresql.conf
- name: Add db to hosts
lineinfile:
@@ -28,29 +24,23 @@
state: present
line: "{{ whoami.stdout }} ALL=(postgres) NOPASSWD: ALL"
- name: Make postgres-db
- become_user: postgres
postgresql_db:
name: nms
- # https://github.com/ansible/ansible/issues/16048#issuecomment-229012509
become: true
become_user: postgres
vars:
ansible_ssh_pipelining: true
- name: Ensure a valid postgres-user
- become_user: postgres
postgresql_user:
db: nms
name: nms
password: risbrod
- # https://github.com/ansible/ansible/issues/16048#issuecomment-229012509
become: true
become_user: postgres
vars:
ansible_ssh_pipelining: true
- name: Import SQL
- become_user: postgres
shell: psql nms < /opt/gondul/ansible/roles/postgres/files/schema.sql
- # https://github.com/ansible/ansible/issues/16048#issuecomment-229012509
become: true
become_user: postgres
vars: