Skip to content

Commit 2e0349a

Browse files
Greg CloughUnderGreen
Greg Clough
authored andcommitted
Rpm variable name change to 340 (ANXS#352)
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 (ANXS#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 (ANXS#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) (ANXS#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… (ANXS#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 (ANXS#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
1 parent f7554dc commit 2e0349a

File tree

5 files changed

+36
-37
lines changed

5 files changed

+36
-37
lines changed

defaults/main.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -786,17 +786,18 @@ postgresql_fedora_releases:
786786
}
787787

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

790+
# YUM repository locations
791+
postgresql_yum_repository_url: "http://yum.postgresql.org"
792+
postgresql_pgdg_repository_url: "https://download.postgresql.org/pub/repos/yum/"
794793

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

797-
postgresql_dnf_repository_url: "{{ postgresql_yum_repository_base_url }}/{{ postgresql_version }}/fedora/fedora-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}"
798-
799-
postgresql_yum_repository_url_pgdg: "{{ postgresql_pgdg_repository_base_url }}/RPM-GPG-KEY-PGDG-{{ postgresql_version_terse }}"
798+
# DNF (Fedora) baseurl/gpgkey
799+
postgresql_dnf_repository_baseurl: "{{ postgresql_yum_repository_url }}/{{ postgresql_version }}/fedora/fedora-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}"
800+
postgresql_dnf_repository_gpgkey: "{{ postgresql_yum_repository_gpgkey }}"
800801

801802
postgresql_apt_py3_dependencies: ["python3-psycopg2", "locales"]
802803
postgresql_apt_py2_dependencies: ["python-psycopg2", "python-pycurl", "locales"]

tasks/install.yml renamed to tasks/install_apt.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
1-
# file: postgresql/tasks/install.yml
1+
# file: postgresql/tasks/install_apt.yml
22

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

10-
- name: PostgreSQL | Add PostgreSQL repository apt-key
10+
- name: PostgreSQL | Add PostgreSQL repository apt-key | apt
1111
apt_key:
1212
id: "{{ postgresql_apt_key_id }}"
1313
url: "{{ postgresql_apt_key_url }}"
1414
state: present
1515
when: postgresql_apt_key_url and postgresql_apt_key_id and postgresql_install_repository
1616

17-
- name: PostgreSQL | Add PostgreSQL repository
17+
- name: PostgreSQL | Add PostgreSQL repository | apt
1818
apt_repository:
1919
repo: "{{ postgresql_apt_repository }}"
2020
state: present
2121
when: postgresql_apt_repository | default('') != '' and postgresql_install_repository
2222

23-
- name: PostgreSQL | Add PostgreSQL repository preferences
23+
- name: PostgreSQL | Add PostgreSQL repository preferences | apt
2424
template:
2525
src: etc_apt_preferences.d_apt_postgresql_org_pub_repos_apt.pref.j2
2626
dest: /etc/apt/preferences.d/apt_postgresql_org_pub_repos_apt.pref
2727
when: postgresql_apt_pin_priority and postgresql_install_repository
2828

29-
- name: PostgreSQL | Make sure the dependencies are installed
29+
- name: PostgreSQL | Make sure the dependencies are installed | apt
3030
apt:
3131
pkg: "{{item}}"
3232
state: present
3333
update_cache: yes
3434
cache_valid_time: "{{apt_cache_valid_time | default (3600)}}"
3535
with_items: "{{postgresql_apt_dependencies}}"
3636

37-
- name: PostgreSQL | Install PostgreSQL
37+
- name: PostgreSQL | Install PostgreSQL | apt
3838
apt:
3939
name: "{{item}}"
4040
state: present
@@ -47,7 +47,7 @@
4747
- "postgresql-client-{{postgresql_version}}"
4848
- "postgresql-contrib-{{postgresql_version}}"
4949

50-
- name: PostgreSQL | PGTune
50+
- name: PostgreSQL | PGTune | apt
5151
apt:
5252
name: pgtune
5353
state: present
Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,32 @@
1-
# file: postgresql/tasks/install_yum.yml
1+
# file: postgresql/tasks/install_dnf.yml
22

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

66
- block:
7-
- name: PostgrSQL | Install all the required depedencies
7+
- name: PostgrSQL | Install all the required depedencies | dnf
88
dnf:
99
name: "ca-certificates, python-pycurl, glibc-common,libselinux-python"
1010
state: present
1111

12-
- name: PostgreSQL | Add yum Repository
12+
- name: PostgreSQL | Add yum Repository | dnf
1313
yum_repository:
14-
name: "{{ postgresql_dnf_repository_url }}"
1514
name: postgresql
1615
state: present
1716
description: postgresql yum repo
18-
baseurl: "{{ postgresql_dnf_repository_url }}"
19-
gpgkey: "{{ postgresql_yum_repository_url_pgdg }}"
17+
baseurl: "{{ postgresql_dnf_repository_baseurl }}"
18+
gpgkey: "{{ postgresql_dnf_repository_gpgkey }}"
2019
when: postgresql_install_repository
2120

22-
- name: PostgreSQL | Install PostgreSQL
21+
- name: PostgreSQL | Install PostgreSQL | dnf
2322
dnf:
2423
name: "postgresql{{ postgresql_version_terse }}-server,postgresql{{ postgresql_version_terse }},postgresql{{ postgresql_version_terse }}-contrib"
2524
state: present
2625
environment: "{{ postgresql_env }}"
2726

28-
- name: PostgreSQL | PGTune
27+
- name: PostgreSQL | PGTune | dnf
2928
dnf:
3029
name: pgtune
3130
state: present
3231
environment: "{{ postgresql_env }}"
3332
when: postgresql_pgtune
34-

tasks/install_yum.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
# file: postgresql/tasks/install_yum.yml
22

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

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

12-
- name: PostgreSQL | Add PostgreSQL repository
12+
- name: PostgreSQL | Add PostgreSQL repository | yum
1313
yum_repository:
1414
name: postgresql
1515
description: postgresql yum repo
16-
baseurl: "{{ postgresql_yum_repository_url }}"
17-
gpgkey: "{{ postgresql_yum_repository_url_pgdg }}"
16+
baseurl: "{{ postgresql_yum_repository_baseurl }}"
17+
gpgkey: "{{ postgresql_yum_repository_gpgkey }}"
1818
when: postgresql_install_repository
1919

20-
- name: PostgreSQL | Make sure the dependencies are installed
20+
- name: PostgreSQL | Make sure the dependencies are installed | yum
2121
yum:
2222
name: "{{ item }}"
2323
state: present
2424
update_cache: yes
2525
with_items: ["python-psycopg2", "python-pycurl", "glibc-common","libselinux-python"]
2626

27-
- name: PostgreSQL | Install PostgreSQL
27+
- name: PostgreSQL | Install PostgreSQL | yum
2828
yum:
2929
name: "{{ item }}"
3030
state: present
@@ -34,7 +34,7 @@
3434
- "postgresql{{ postgresql_version_terse }}"
3535
- "postgresql{{ postgresql_version_terse }}-contrib"
3636

37-
- name: PostgreSQL | PGTune
37+
- name: PostgreSQL | PGTune | yum
3838
yum:
3939
name: pgtune
4040
state: present

tasks/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
- "../vars/empty.yml"
77
tags: [always]
88

9-
- import_tasks: install.yml
9+
- import_tasks: install_apt.yml
1010
when: ansible_pkg_mgr == "apt"
1111
tags: [postgresql, postgresql-install]
1212

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

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

0 commit comments

Comments
 (0)