-
Notifications
You must be signed in to change notification settings - Fork 580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extended and adapted to install PostgreSQL 10 for CentOS and Ubuntu #267
Extended and adapted to install PostgreSQL 10 for CentOS and Ubuntu #267
Conversation
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
I tested on ArchLinux, and everything seems to work with postgresql 10.1. |
defaults/main.yml
Outdated
|
||
# These settings are ignored on a publisher. | ||
|
||
postgresql_max_logical_replication_workers: 4 # (>= 10) taken from max_worker_processes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tabs here and on the changes throw a syntax error for me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Ben,
I removed the tabs and hope it now works. Strangley on my system (Ubuntu 16.04/ansible 2.4.2.0) I had no trouble.
Tabs removed. |
thanks @WolfgangPecho ! i think you accidentally closed this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you,
Can you enable tests for this by editing .travis.yml
?
-> https://github.com/ANXS/postgresql/blob/master/.travis.yml#L15
templates/HOWTO.postgresql.conf
Outdated
@@ -19,4 +21,6 @@ and save it under the 'templates' role directory | |||
|
|||
5) If there are new options or some of them removed, update the 'default/main.yml' file and add a "(>= 9.X)" or "(<= 9.X)" comment to them. | |||
|
|||
6) Update the '.travis.yml' file to test its new version. | |||
7) For yum based installation add version and minor version of postgresql in 'default/main.yml' under '# YUM settings' at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You skipped the point 6) (5 to 7)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Sébastien,
all ansible tests now pass including a new one for ansible 2.4.2.0/posgresql10.
Docker tests currently commented out - do not know docker ;-).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that @sebalix was saying that in the file, there is now no step 6
- (SHOULD THIS BE STEP 6?)
…iven 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 ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@WolfgangPecho well done! Yes running tests in a Docker container was experimental and has never been stabilized. This role could use LXD instead (to get a real system with an init) to tests this role on multiple distributions, I use this here: https://travis-ci.org/OCA/ansible-odoo but it is a subject for another PR.
When can this get merged in if it is passing the tests? |
Does this surplant #262 ? |
- 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
@taybin: I compared the two pull requests (merifiiri and mine). Both do their job. Differeneces are ( wp #267 <-> merifiri #262 ):
Some idea what to do ? |
@WolfgangPecho Well, I like this one, personally, and would like to see it get merged! |
.travis.yml
Outdated
@@ -43,8 +44,8 @@ script: | |||
- ./tests/idempotence_check.sh idempotence_out | |||
|
|||
# Testing with docker (experimental) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is experimental @WolfgangPecho, then should we remove it and put it into a separate PR?
Vagrantfile
Outdated
@@ -7,8 +7,9 @@ Vagrant.configure('2') do |config| | |||
config.ssh.insert_key = false | |||
config.ssh.private_key_path = '~/.vagrant.d/insecure_private_key' | |||
|
|||
config.vm.define 'anxs' do |machine| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this related to the PostgreSQL v10 update? It looks interesting, but isn't related to this Pull Request, right?
defaults/main.yml
Outdated
@@ -1,7 +1,7 @@ | |||
# file: postgresql/defaults/main.yml | |||
|
|||
# Basic settings | |||
postgresql_version: 9.3 | |||
postgresql_version: 9.6 # if you use postgis too check whether the postgresql/postgis versions work together |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably don't need that postgis comment in there. There is a PR #310 , which will give reasonable defaults for PostGIS now.
defaults/main.yml
Outdated
@@ -117,6 +117,7 @@ postgresql_ssl_ciphers: | |||
postgresql_ssl_prefer_server_ciphers: on | |||
postgresql_ssl_ecdh_curve: 'prime256v1' | |||
postgresql_ssl_renegotiation_limit: 512MB # amount of data between renegotiations | |||
postgresal_ssl_dh_params_file: '' # (>= 10) specify file name for custom OpenSSL DH parameters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in parameter name sal
... should be sql
.
defaults/main.yml
Outdated
@@ -199,6 +200,7 @@ postgresql_bgwriter_flush_after: 0 # (>= 9.6) 0 disables, | |||
postgresql_effective_io_concurrency: 1 # 1-1000; 0 disables prefetching | |||
postgresql_max_worker_processes: 8 # (change requires restart) | |||
postgresql_max_parallel_workers_per_gather: 0 # (>= 9.6) taken from max_worker_processes | |||
postgresql_max_parallel_workers: 8 # (>= 9.6) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is >=10... not 9.6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -347,7 +358,9 @@ postgresql_cpu_index_tuple_cost: 0.005 # same scale as above | |||
postgresql_cpu_operator_cost: 0.0025 # same scale as above | |||
postgresql_parallel_tuple_cost: 0.1 # same scale as above (>= 9.6) | |||
postgresql_parallel_setup_cost: 1000.0 # same scale as above (>= 9.6) | |||
postgresql_min_parallel_relation_size: 8MB # (>= 9.6) | |||
postgresql_min_parallel_relation_size: 8MB # (= 9.6) replaced by below two parameters in 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the comment about "replaced below"? I'm not sure if that matches the style of the others, which normally just list > < = and the version, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be helpful as a reminder if transitioning from 9.6 to 10.
defaults/main.yml
Outdated
@@ -499,11 +512,13 @@ postgresql_log_line_prefix: '%t ' | |||
# log lock waits >= deadlock_timeout | |||
postgresql_log_lock_waits: off | |||
postgresql_log_statement: none # none, ddl, mod, all | |||
postgresql_log_replication_commands: off # (>= 10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was introduced in v9.5, not v10:
https://www.postgresql.org/docs/9.5/static/runtime-config-logging.html#GUC-LOG-REPLICATION-COMMANDS
I've added #314 to backport this
defaults/main.yml
Outdated
# log temporary files equal or larger | ||
postgresql_log_temp_files: -1 | ||
postgresql_log_timezone: UTC | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the 3rd blank line?
defaults/main.yml
Outdated
@@ -587,7 +602,8 @@ postgresql_vacuum_multixact_freeze_table_age: 150000000 # (>= 9.3) | |||
postgresql_bytea_output: hex # hex, escape | |||
postgresql_xmlbinary: base64 | |||
postgresql_xmloption: content | |||
postgresql_gin_fuzzy_search_limit: 0 # (<= 9.2) | |||
postgresql_gin_fuzzy_search_limit: 0 # (<= 9.2, >=10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This parameter has been around at least since 9.0... and still exists in 10. We should remove the entire comment about version ranges.
https://www.postgresql.org/docs/10/static/runtime-config-client.html
defaults/main.yml
Outdated
@@ -587,7 +602,8 @@ postgresql_vacuum_multixact_freeze_table_age: 150000000 # (>= 9.3) | |||
postgresql_bytea_output: hex # hex, escape | |||
postgresql_xmlbinary: base64 | |||
postgresql_xmloption: content | |||
postgresql_gin_fuzzy_search_limit: 0 # (<= 9.2) | |||
postgresql_gin_fuzzy_search_limit: 0 # (<= 9.2, >=10) | |||
postgresql_gin_pending_list_limit: 4MB # (>= 10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was added in v9.5, not in v10. I've added that to #314 too.
@@ -639,6 +655,11 @@ postgresql_max_locks_per_transaction: 64 # min 10 | |||
# lock table slots. | |||
postgresql_max_pred_locks_per_transaction: 64 # min 10 | |||
|
|||
postgresql_max_pred_locks_per_relation: -2 # (>= 10) negative values mean | |||
# (max_pred_locks_per_transaction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need these comments in this file? If someone wants to know what it does, then they can check the doco, or the postresql.conf
itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. Same for other comments taken from the original config file. May be for less exerienced people like me helpful to read it here too :-).
I'm just excited to see this get so close to merging. I'm not able to help test it at the moment though. |
im gonna see if i have some cycles to test on centos in the next week or so. |
… users are present Fixed text in templates/HOWTO.posgresql.conf
Just tested this on a Debian Stretch environment, it's working fine. It remains some glitch to fix, after that 👍 |
Hmm ... ubuntu-upstart:14.04 failed. The others are ok. On my account all travis builds passed.
Can I restart the build somehow ? Close/Reopen the pullrequest forces a rebuild ;-) |
@WolfgangPecho ... I'm not sure how. Previously I've added a space... committed, and then removed the space. It's pretty awful, but I don't know of another way. Maybe @UnderGreen can help? |
sorry, the only way I know is closing and reopening. |
looks like the build failed in
|
Yeap build failed. It's a bit strange. If I test with vagrant using bento/ubuntu-14.04 the tests/playbook.yml installs without any error. The travis job triggered on my github repo passes |
Ok the result so far is:
Have we a timing issue ? Install for ubuntu-14.04 is slow. |
alright so I tested on centos 7 and it installed successfully. I ran again to check idempotent and 100% ok. If no one has any issues I'll merge in an hour.
|
🎉 |
🙌 |
Tnx to all who helped with this pull request. |
Anyone get a chance to update the readme? Still shows 9.6 as the latest :) thanks for the excellent work! |
I merged a PR that updated it. |
@WolfgangPecho ... how did you fix this error:
I'm getting the same thing now on #291, and it doesn't make sense. :o( |
@Drewster727, and @jlozadad ... actually PR #308 was just to prepare the readme in expectation of this PR being merged. Now that it's done, I've made #330 to show we've got support... and done some other tidy ups. |
@gclough I could not fix the 'Perer authentification failed ...' error ;-). See my comment
5 days ago before jiozadad decided to merge the pull request. |
No, it's working now. I've committed #331 which fixes that. If you have any easy steps to get Travis and Docker working, I'd certainly appreciate them! |
…NXS#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.
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
Tested with ansible 2.4.1 for Ubuntu 16.04 and CentOS-7.4
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
Hope you find it useful.