diff options
author | Kristian Lyngstol <kly@kly.no> | 2019-01-29 21:48:54 +0100 |
---|---|---|
committer | Kristian Lyngstol <kly@kly.no> | 2019-01-29 21:48:54 +0100 |
commit | 68d31e02b28487cb5dd552c68efd10b4973f4169 (patch) | |
tree | 24eb002a4966b9ce47aef6c8bcc4c891cb1bb97d /ansible/roles/postgres | |
parent | 3b1ff674784205218c215212fd19d9cffd2ac708 (diff) | |
parent | 4306bc4f9c5ff40a5d56f700a2d753345188605f (diff) |
Merge branch 'master' of github.com:tech-server/gondul
Diffstat (limited to 'ansible/roles/postgres')
-rw-r--r-- | ansible/roles/postgres/files/postgresql.conf | 10 | ||||
-rw-r--r-- | ansible/roles/postgres/tasks/main.yml | 26 |
2 files changed, 22 insertions, 14 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 9adeafe..902eeb9 100644 --- a/ansible/roles/postgres/tasks/main.yml +++ b/ansible/roles/postgres/tasks/main.yml @@ -1,14 +1,13 @@ +# 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: @@ -25,15 +24,24 @@ state: present line: "{{ whoami.stdout }} ALL=(postgres) NOPASSWD: ALL" - name: Make postgres-db - become_user: postgres postgresql_db: name: nms -- name: Ensure a valid postgres-user + become: true become_user: postgres + vars: + ansible_ssh_pipelining: true +- name: Ensure a valid postgres-user postgresql_user: db: nms name: nms password: risbrod -- name: Import SQL + become: true become_user: postgres + vars: + ansible_ssh_pipelining: true +- name: Import SQL shell: psql nms < /opt/gondul/ansible/roles/postgres/files/schema.sql + become: true + become_user: postgres + vars: + ansible_ssh_pipelining: true |