mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2025-12-17 02:13:06 -06:00
44 lines
1.2 KiB
YAML
44 lines
1.2 KiB
YAML
---
|
|
|
|
- name: Add the official Postgres repo
|
|
yum_repository:
|
|
name: "postgres"
|
|
description: "Official PostgreSQL {{ postgres_version }}"
|
|
baseurl: "https://download.postgresql.org/pub/repos/yum/{{ postgres_version }}/redhat/rhel-7-x86_64"
|
|
gpgcheck: false
|
|
enabled: true
|
|
|
|
- name: Install Postgres package
|
|
yum:
|
|
name:
|
|
- "postgresql{{ postgres_version_short }}"
|
|
- "postgresql{{ postgres_version_short }}-server"
|
|
update_cache: true
|
|
|
|
- name: Initialise database
|
|
command:
|
|
cmd: "/usr/pgsql-{{ postgres_version }}/bin/postgresql{{ postgres_version_short }}-setup initdb"
|
|
creates: "/var/lib/pgsql/{{ postgres_version }}/data/pg_hba.conf"
|
|
|
|
- name: Allow local network connections with password
|
|
postgresql_pg_hba:
|
|
dest: "/var/lib/pgsql/{{ postgres_version }}/data/pg_hba.conf"
|
|
contype: host
|
|
databases: all
|
|
users: all
|
|
address: "127.0.0.1/32"
|
|
method: md5
|
|
|
|
- name: Start Postgres server
|
|
service:
|
|
name: "postgresql-{{ postgres_version }}.service"
|
|
enabled: true
|
|
state: started
|
|
|
|
- name: Set Postgres root user password
|
|
become_user: postgres
|
|
postgresql_user:
|
|
name: "{{ atl_db_root_user }}"
|
|
password: "{{ atl_db_root_password }}"
|
|
role_attr_flags: "SUPERUSER"
|