You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.1 KiB
46 lines
1.1 KiB
5 years ago
|
---
|
||
|
|
||
|
- include_vars: ../postgresql_server/defaults/main.yml
|
||
|
tags: wapt
|
||
|
|
||
|
- name: Install packages
|
||
|
yum:
|
||
|
name:
|
||
|
- postgresql96-server
|
||
|
- postgresql96-contrib
|
||
|
tags: wapt
|
||
|
|
||
|
- name: Check if postgres is initialized
|
||
|
stat: path=/var/lib/pgsql/9.6/data/PG_VERSION
|
||
|
register: wapt_pg_version
|
||
|
tags: wapt
|
||
|
|
||
|
- name: Init postgres
|
||
|
command: /usr/pgsql-9.6/bin/postgresql96-setup initdb
|
||
|
when: not wapt_pg_version.stat.exists
|
||
|
environment:
|
||
|
- LANG: en_US.utf8 # This is important of wapt DB creation will fail
|
||
|
tags: wapt
|
||
|
|
||
|
- name: Deploy postgresql conf
|
||
|
template: src=../postgresql_server/templates/{{ item }}.j2 dest=/var/lib/pgsql/9.6/data/{{ item }}
|
||
|
with_items:
|
||
|
- pg_hba.conf
|
||
|
- postgresql.conf
|
||
|
notify: restart postgresql
|
||
|
tags: wapt
|
||
|
|
||
|
- name: Start and enable postgresql
|
||
|
service: name=postgresql-9.6 state=started enabled=True
|
||
|
tags: wapt
|
||
|
|
||
|
- name: Create postgresql admin role
|
||
|
postgresql_user:
|
||
|
name: "sqladmin"
|
||
|
password: "{{ pg_admin_pass }}"
|
||
|
role_attr_flags: SUPERUSER,CREATEROLE,CREATEDB
|
||
|
become_user: postgres
|
||
|
tags: wapt
|
||
|
|
||
|
|