|
|
|
@ -1,31 +1,16 @@ |
|
|
|
|
--- |
|
|
|
|
|
|
|
|
|
- name: Configure PostgreSQL repository |
|
|
|
|
yum_repository: |
|
|
|
|
name: postgresql |
|
|
|
|
description: PostgreSQL |
|
|
|
|
baseurl: https://download.postgresql.org/pub/repos/yum/{{ pg_version }}/redhat/rhel-$releasever-$basearch |
|
|
|
|
gpgcheck: True |
|
|
|
|
gpgkey: https://download.postgresql.org/pub/repos/yum/RPM-GPG-KEY-PGDG-{{ pg_version }} |
|
|
|
|
state: "{{ (pg_version != 'default') | ternary('present','absent') }}" |
|
|
|
|
register: pg_repo |
|
|
|
|
tags: pg,repo |
|
|
|
|
|
|
|
|
|
- name: Clear PostgreSQL repo cache |
|
|
|
|
file: path=/var/cache/yum/{{ ansible_architecture }}/{{ ansible_distribution_major_version }}/postgresql/{{ item }} state=absent |
|
|
|
|
loop: |
|
|
|
|
- cachecookie |
|
|
|
|
- repomd.xml |
|
|
|
|
when: pg_repo.changed |
|
|
|
|
tags: pg |
|
|
|
|
|
|
|
|
|
- name: Install dependencies |
|
|
|
|
- include_vars: "{{ item }}" |
|
|
|
|
with_first_found: |
|
|
|
|
- vars/{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml |
|
|
|
|
- vars/{{ ansible_distribution }}.yml |
|
|
|
|
- vars/{{ ansible_os_family }}.yml |
|
|
|
|
- vars/defaults.yml |
|
|
|
|
tags: pg |
|
|
|
|
|
|
|
|
|
- name: Install Postgresql packages |
|
|
|
|
yum: |
|
|
|
|
name: |
|
|
|
|
- postgresql{{ (pg_version != 'default') | ternary(pg_version | string,'') }} |
|
|
|
|
- postgresql{{ (pg_version != 'default') | ternary(pg_version | string,'') }}-server |
|
|
|
|
- postgresql{{ (pg_version != 'default') | ternary(pg_version | string,'') }}-contrib |
|
|
|
|
- python-psycopg2 |
|
|
|
|
name: "{{ pg_packages }}" |
|
|
|
|
tags: pg |
|
|
|
|
|
|
|
|
|
- name: Check if PG_VERSION exists |
|
|
|
|