Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Features:
- supported distributions: 6 and 7 versions of Redhat, CentOS, Scientific Linux.
- Oracle Linux also supported but uses RHEL repositories.
- supported PostgreSQL versions: 8.4, 9.0, 9.1, 9.2, 9.3, 9.4, 9.5, 9.6.
- supported PostgreSQL versions: 8.4, 9.0, 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 10.0
- allows specify users and databases which would be created after install.
- ability to determine a set of postgresql.conf parameters and absense postgresql.conf template. Template is not used due to the fact that the postgresql.conf differs from version to version on a set of parameters.
- ability to specify another cluster directory and setup symlink into /var/lib/pgsql/x.y/data location.
Expand Down
14 changes: 7 additions & 7 deletions tasks/databases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

- name: "Stage 4 add databases"
postgresql_db:
state= present
name= "{{ item.name }}"
template= "{{ item.template }}"
encoding= "{{ item.encoding }}"
lc_collate= "{{ item.collate }}"
lc_ctype= "{{ item.ctype }}"
owner= "{{ item.owner }}"
state: "present"
name: "{{ item.name }}"
template: "{{ item.template }}"
encoding: "{{ item.encoding }}"
lc_collate: "{{ item.collate }}"
lc_ctype: "{{ item.ctype }}"
owner: "{{ item.owner }}"
with_items: "{{ postgresql_databases }}"
when: postgresql_databases|length > 0

Expand Down
6 changes: 3 additions & 3 deletions tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

- name: "Stage 1a: install repository package on CentOS"
package: name="{{ item.repo }}" state=present
when: item.version == "{{ postgresql_version }}" and ansible_distribution == "CentOS"
when: item.version == postgresql_version and ansible_distribution == "CentOS"
with_items: "{{ postgresql_repo_CentOS }}"

- name: "Stage 1b: install repository package on RedHat"
package: name="{{ item }}" state=present
when: item.version == "{{ postgresql_version }}" and ansible_distribution == "RedHat"
when: item.version == postgresql_version and ansible_distribution == "RedHat"
with_items: "{{ postgresql_repo_RedHat }}"

- name: "Stage 1c: install repository package on Scientific"
package: name="{{ item }}" state=present
when: item.version == "{{ postgresql_version }}" and ansible_distribution == "Scientific"
when: item.version == postgresql_version and ansible_distribution == "Scientific"
with_items: "{{ postgresql_repo_Scientific }}"

- name: "Stage 1: install postgresql packages"
Expand Down
8 changes: 4 additions & 4 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
debug: msg="The following packet manager {{ ansible_pkg_mgr }} is not supported" fail=yes
when: not ansible_pkg_mgr == "yum"

- include: install.yml
- include: configure.yml
- include: users.yml
- include: databases.yml
- import_tasks: install.yml
- import_tasks: configure.yml
- import_tasks: users.yml
- import_tasks: databases.yml
when: postgresql_databases.0 is defined
3 changes: 3 additions & 0 deletions vars/repo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# file: roles/install-postgresql-on-el6/vars/main.yml -- here are the variables that you don't want to change unnecessarily.

postgresql_repo_RedHat:
- { version: "10.0", repo: "https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-redhat10-10-2.noarch.rpm" }
- { version: "9.6", repo: "http://yum.postgresql.org/9.6/redhat/rhel-{{ el_version }}-x86_64/pgdg-redhat96-9.6-3.noarch.rpm" }
- { version: "9.5", repo: "http://yum.postgresql.org/9.5/redhat/rhel-{{ el_version }}-x86_64/pgdg-redhat95-9.5-3.noarch.rpm" }
- { version: "9.4", repo: "http://yum.postgresql.org/9.4/redhat/rhel-{{ el_version }}-x86_64/pgdg-redhat94-9.4-3.noarch.rpm" }
Expand All @@ -11,6 +12,7 @@ postgresql_repo_RedHat:
- { version: "8.4", repo: "http://yum.postgresql.org/8.4/redhat/rhel-{{ el_version }}-x86_64/pgdg-redhat-8.4-3.noarch.rpm" }

postgresql_repo_Scientific:
- { version: "10.0", repo: "https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-sl10-10-2.noarch.rpm" }
- { version: "9.6", repo: "http://yum.postgresql.org/9.6/redhat/rhel-{{ el_version }}-x86_64/pgdg-sl96-9.6-3.noarch.rpm" }
- { version: "9.5", repo: "http://yum.postgresql.org/9.5/redhat/rhel-{{ el_version }}-x86_64/pgdg-sl95-9.5-3.noarch.rpm" }
- { version: "9.4", repo: "http://yum.postgresql.org/9.4/redhat/rhel-{{ el_version }}-x86_64/pgdg-sl94-9.4-3.noarch.rpm" }
Expand All @@ -21,6 +23,7 @@ postgresql_repo_Scientific:
- { version: "8.4", repo: "http://yum.postgresql.org/8.4/redhat/rhel-{{ el_version }}-x86_64/pgdg-sl84-8.4-4.noarch.rpm" }

postgresql_repo_CentOS:
- { version: "10.0", repo: "https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm" }
- { version: "9.6", repo: "http://yum.postgresql.org/9.6/redhat/rhel-{{ el_version }}-x86_64/pgdg-centos96-9.6-3.noarch.rpm" }
- { version: "9.5", repo: "http://yum.postgresql.org/9.5/redhat/rhel-{{ el_version }}-x86_64/pgdg-centos95-9.5-3.noarch.rpm" }
- { version: "9.4", repo: "http://yum.postgresql.org/9.4/redhat/rhel-{{ el_version }}-x86_64/pgdg-centos94-9.4-3.noarch.rpm" }
Expand Down