Skip to content

Commit

Permalink
Rpm variable name change to 340 (#352)
Browse files Browse the repository at this point in the history
Squashed, original work from @gclough 

* Fixed wrong handler name

* change vagrantfile to point to the official centos images since those support different providers.

* changed the vagrant file to use become since sudo is going away and added default verbose.

* changed install_yum.yml to use a block to reduce the transactions made.

* added retry files to gitignore.

* added systemctl handler to restart when using OS that use systemctl.

* changed to use the handlers to restart the services and enable the services during boot instead of having extra tasks. I removed them since they are not necessary.

* Convert from using "psql" to using the Ansible module "postgresql_ext", which I suspect
is a more reliable method.

* changed to check for systemd.

* Added extra tests for travis to create extensions in "foobar" database

* Increase the travis test coverage to include popular options (#305)

* Increse the travis test coverage to include popular options

* Fixed a missing quote...

* Fixed syntax for options, and make postgis.yml RedHat compatible... ish

* Looks like pgtune won't install either, as the epel repo isn't in the docker image.  Taking it out too..

* Changing parameters to be in JSON format, for consumption on the command line

* Adding a space to trigger a travis build

* Remove the space, as travis didn't build anyway... :-/

* Debugging... why don't travis kick in...

* Revert travis changes, to try and get it to trigger

* Fixed typo in JSON parameters

* Removed travis updates, and put parameters into postgresql.yml

* Squashing all commits.  Increases travis coverage, but not all are enabled yet. Other pull requests need to be merged first, as the tests for them fail.

* Added meta data for CentOS and RedHat, plus added tags to help with searches

* Fixed CenOS/RedHat naming... should be EL.  Also added tags to help people find it on Galaxy

* Quote all string variables, and add spaces around variables "{{ var }}" instead of "{{var}""

* Crosschecked, and found some that I missed.

* Octal numbers need to be quoted, otherwise they get converted to Decimal

* Extended and adapted to install PostgreSQL 10 for CentOS and Ubuntu (#267)

* Extended and adapted to install PostgreSQL 10 for CentOS and Ubuntu

Tested with ansible 2.4.1 for Ubuntu 16.04 and CentOS-7.4

- replaced deprecated 'include:' by 'include_tasks:' for ansible 2.4.1
- added config and config template for postgresql 10
- adapted defaults.yml
- adapted templates/etc_systemd_system_postgresql.service.d_custom.conf.j2
  for PostgreSQL 10 the template outputs the wrong line:
	ExecStartPre=/usr/pgsql-10/bin/postgresql10-check-db-dir
  the correct one must include an additional '-':
	ExecStartPre=/usr/pgsql-10/bin/postgresql-10-check-db-dir

* Removed tabs from defaults/main.yml.

* Adapted .travis.yml and yml files to run tests successfully for all given ansible versions.

- added a test for ansible 2.4.2.0/posgresql 10.

- replaced newer 'include_task' by 'include' again so that the role can be used with older
  ansible versions. NOTE: 'include' is deprecated and will be removed in ansible 2.8.

- commeted out docker based tests because they do not run successfully and I do not know
  docker ;-)

* Bug fix. Removed remains for my local teste in test/playbook.yml.

* Bug fix and refinement for postgresql.conf-10.* .

- added max_parallel_workers to postgresql.conf-10.j2 (forgotten/deleted in previous version)
- hard coded value for wal_retrieve_retry_interval in postgresql.conf-10.j2 replaced by ansible variable

Changes to be committed:
	modified:   Vagrantfile
	modified:   defaults/main.yml
	modified:   templates/postgresql.conf-10.j2
	modified:   vagrant-inventory

* Added suggestions from gclough.

 Changes to be committed:
	modified:   Vagrantfile
	modified:   defaults/main.yml
	modified:   templates/HOWTO.postgresql.conf
	modified:   templates/etc_systemd_system_postgresql.service.d_custom.conf.j2
	modified:   tests/playbook.yml
	modified:   tests/vars.yml
	modified:   vagrant-inventory

* Replaced vagrant setup by project's master branch.

* Updated tests/docker/group_vars/all.yml to include version 10.

* Uncommented 'no_log: true' in users.yml.

* Uncommented user baz in tests/docker/group_vars/postgresql.yml.

* Recreated user baz but without passwd. We need him as database owner :-).

* Added encrypted passwd for user baz.

* Commented need for encrypted password if version >= 10.

* Reenabled no_log: true for task  PostgreSQL | Make sure the PostgreSQL users are present
Fixed text in templates/HOWTO.posgresql.conf

* Just to trigger a new build on github. Added blank in README.md.

* Second try to trigger a rebuild. Blank in README.md deleted.

* Prepare for PostgreSQL v10 (and v11) (#308)

* Adding future scope for v10 (already out), and v11 (Sep/18)

* Fixed "CentOS" spelling, and put a request for help

* fixed the syntax on dev_headers

* added all the required dependencies together and deleted a tasks. Make less transactions

* the other night when I started this. I forgot to add  since it was a long night

* accidently deleted vagrantfile

* Reload conf parameters after install, so that pg_hba.conf is re-read

* Updated README to show v10 support, added top 10 contributors, and li… (#330)

* Updated README to show v10 support, added top 10 contributors, and linked to defaults/main.yml

* Fixed typo in contributors

* Reload conf parameters after install, so that pg_hba.conf is re-read

* Fixed wrong handler name

* Added libselinux-python dependency for selinux enabled redhat systems.

* Honour those that created the role in the first place, and those that maintain it (#336)

* Fixing local master

* More merging of master...

* Fixing it to match the *REAL* "master"

* Tidied up variable and filenames for install_*.yml

* Don't restrict apt/yum/dnf to specific OS types, and disable Fedora Travis

* Fixed merging problems

* Fixed mistake in comments

* Reinstate "ansible_distribution" tests

* Removed extra "and"

* Removed duplicate 'name:' for dns repository
  • Loading branch information
Greg Clough authored and UnderGreen committed Apr 26, 2018
1 parent f7554dc commit 2e0349a
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 37 deletions.
17 changes: 9 additions & 8 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -786,17 +786,18 @@ postgresql_fedora_releases:
}

postgresql_version_terse: "{{ postgresql_version | replace('.', '') }}"
postgresql_yum_repository_base_url: "http://yum.postgresql.org"
postgresql_pgdg_repository_base_url: "https://download.postgresql.org/pub/repos/yum/"
postgresql_yum_repository_url: "{{ postgresql_yum_repository_base_url }}/{{ postgresql_version }}/{{ ansible_os_family | lower }}/rhel-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}"
postgresql_yum_repository_url_pgdg: "{{ postgresql_pgdg_repository_base_url }}/RPM-GPG-KEY-PGDG-{{ postgresql_version_terse }}"

# YUM repository locations
postgresql_yum_repository_url: "http://yum.postgresql.org"
postgresql_pgdg_repository_url: "https://download.postgresql.org/pub/repos/yum/"

postgresql_pgdg_repository_base_url: "https://download.postgresql.org/pub/repos/yum/"
# YUM (RedHat, CentOS, etc.) baseurl/gpgkey
postgresql_yum_repository_baseurl: "{{ postgresql_yum_repository_url }}/{{ postgresql_version }}/{{ ansible_os_family | lower }}/rhel-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}"
postgresql_yum_repository_gpgkey: "{{ postgresql_pgdg_repository_url }}/RPM-GPG-KEY-PGDG-{{ postgresql_version_terse }}"

postgresql_dnf_repository_url: "{{ postgresql_yum_repository_base_url }}/{{ postgresql_version }}/fedora/fedora-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}"

postgresql_yum_repository_url_pgdg: "{{ postgresql_pgdg_repository_base_url }}/RPM-GPG-KEY-PGDG-{{ postgresql_version_terse }}"
# DNF (Fedora) baseurl/gpgkey
postgresql_dnf_repository_baseurl: "{{ postgresql_yum_repository_url }}/{{ postgresql_version }}/fedora/fedora-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}"
postgresql_dnf_repository_gpgkey: "{{ postgresql_yum_repository_gpgkey }}"

postgresql_apt_py3_dependencies: ["python3-psycopg2", "locales"]
postgresql_apt_py2_dependencies: ["python-psycopg2", "python-pycurl", "locales"]
Expand Down
16 changes: 8 additions & 8 deletions tasks/install.yml → tasks/install_apt.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
# file: postgresql/tasks/install.yml
# file: postgresql/tasks/install_apt.yml

# The standard ca-certs are needed because without them apt_key will fail to
# validate www.postgresql.org (or probably any other source).
- name: PostgreSQL | Make sure the CA certificates are available
- name: PostgreSQL | Make sure the CA certificates are available | apt
apt:
pkg: ca-certificates
state: present

- name: PostgreSQL | Add PostgreSQL repository apt-key
- name: PostgreSQL | Add PostgreSQL repository apt-key | apt
apt_key:
id: "{{ postgresql_apt_key_id }}"
url: "{{ postgresql_apt_key_url }}"
state: present
when: postgresql_apt_key_url and postgresql_apt_key_id and postgresql_install_repository

- name: PostgreSQL | Add PostgreSQL repository
- name: PostgreSQL | Add PostgreSQL repository | apt
apt_repository:
repo: "{{ postgresql_apt_repository }}"
state: present
when: postgresql_apt_repository | default('') != '' and postgresql_install_repository

- name: PostgreSQL | Add PostgreSQL repository preferences
- name: PostgreSQL | Add PostgreSQL repository preferences | apt
template:
src: etc_apt_preferences.d_apt_postgresql_org_pub_repos_apt.pref.j2
dest: /etc/apt/preferences.d/apt_postgresql_org_pub_repos_apt.pref
when: postgresql_apt_pin_priority and postgresql_install_repository

- name: PostgreSQL | Make sure the dependencies are installed
- name: PostgreSQL | Make sure the dependencies are installed | apt
apt:
pkg: "{{item}}"
state: present
update_cache: yes
cache_valid_time: "{{apt_cache_valid_time | default (3600)}}"
with_items: "{{postgresql_apt_dependencies}}"

- name: PostgreSQL | Install PostgreSQL
- name: PostgreSQL | Install PostgreSQL | apt
apt:
name: "{{item}}"
state: present
Expand All @@ -47,7 +47,7 @@
- "postgresql-client-{{postgresql_version}}"
- "postgresql-contrib-{{postgresql_version}}"

- name: PostgreSQL | PGTune
- name: PostgreSQL | PGTune | apt
apt:
name: pgtune
state: present
Expand Down
18 changes: 8 additions & 10 deletions tasks/fedora.yml → tasks/install_dnf.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
# file: postgresql/tasks/install_yum.yml
# file: postgresql/tasks/install_dnf.yml

# The standard ca-certs are needed because without them apt_key will fail to
# The standard ca-certs are needed because without them dnf will fail to
# validate www.postgresql.org (or probably any other source).

- block:
- name: PostgrSQL | Install all the required depedencies
- name: PostgrSQL | Install all the required depedencies | dnf
dnf:
name: "ca-certificates, python-pycurl, glibc-common,libselinux-python"
state: present

- name: PostgreSQL | Add yum Repository
- name: PostgreSQL | Add yum Repository | dnf
yum_repository:
name: "{{ postgresql_dnf_repository_url }}"
name: postgresql
state: present
description: postgresql yum repo
baseurl: "{{ postgresql_dnf_repository_url }}"
gpgkey: "{{ postgresql_yum_repository_url_pgdg }}"
baseurl: "{{ postgresql_dnf_repository_baseurl }}"
gpgkey: "{{ postgresql_dnf_repository_gpgkey }}"
when: postgresql_install_repository

- name: PostgreSQL | Install PostgreSQL
- name: PostgreSQL | Install PostgreSQL | dnf
dnf:
name: "postgresql{{ postgresql_version_terse }}-server,postgresql{{ postgresql_version_terse }},postgresql{{ postgresql_version_terse }}-contrib"
state: present
environment: "{{ postgresql_env }}"

- name: PostgreSQL | PGTune
- name: PostgreSQL | PGTune | dnf
dnf:
name: pgtune
state: present
environment: "{{ postgresql_env }}"
when: postgresql_pgtune

16 changes: 8 additions & 8 deletions tasks/install_yum.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
# file: postgresql/tasks/install_yum.yml

# The standard ca-certs are needed because without them apt_key will fail to
# The standard ca-certs are needed because without them yum will fail to
# validate www.postgresql.org (or probably any other source).

- block:
- name: PostgreSQL | Install all the required dependencies
- name: PostgreSQL | Install all the required dependencies | yum
yum:
name: ["ca-certificates","python-psycopg2", "python-pycurl", "glibc-common","epel-release","libselinux-python"]
state: present

- name: PostgreSQL | Add PostgreSQL repository
- name: PostgreSQL | Add PostgreSQL repository | yum
yum_repository:
name: postgresql
description: postgresql yum repo
baseurl: "{{ postgresql_yum_repository_url }}"
gpgkey: "{{ postgresql_yum_repository_url_pgdg }}"
baseurl: "{{ postgresql_yum_repository_baseurl }}"
gpgkey: "{{ postgresql_yum_repository_gpgkey }}"
when: postgresql_install_repository

- name: PostgreSQL | Make sure the dependencies are installed
- name: PostgreSQL | Make sure the dependencies are installed | yum
yum:
name: "{{ item }}"
state: present
update_cache: yes
with_items: ["python-psycopg2", "python-pycurl", "glibc-common","libselinux-python"]

- name: PostgreSQL | Install PostgreSQL
- name: PostgreSQL | Install PostgreSQL | yum
yum:
name: "{{ item }}"
state: present
Expand All @@ -34,7 +34,7 @@
- "postgresql{{ postgresql_version_terse }}"
- "postgresql{{ postgresql_version_terse }}-contrib"

- name: PostgreSQL | PGTune
- name: PostgreSQL | PGTune | yum
yum:
name: pgtune
state: present
Expand Down
6 changes: 3 additions & 3 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
- "../vars/empty.yml"
tags: [always]

- import_tasks: install.yml
- import_tasks: install_apt.yml
when: ansible_pkg_mgr == "apt"
tags: [postgresql, postgresql-install]

- import_tasks: install_yum.yml
when: ansible_pkg_mgr == "yum" and ansible_distribution == "RedHat"
when: ansible_pkg_mgr == "yum" and ( ansible_distribution == "RedHat" or ansible_distribution == "CentOS" )
tags: [postgresql, postgresql-install]

- import_tasks: fedora.yml
- import_tasks: install_dnf.yml
when: ansible_pkg_mgr == "dnf" and ansible_distribution == "Fedora"
tags: [postgresql, postgresql-install]

Expand Down

0 comments on commit 2e0349a

Please sign in to comment.