Skip to content
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

Add support for PostgreSQL-11 on Ubuntu 18.04 #384

Closed
wants to merge 1 commit into from

Conversation

irionr
Copy link

@irionr irionr commented Oct 20, 2018

Add support for PostgreSQL11 with Ubuntu18.04.
Updated minor version for PostgreSQL-9.6 and PostgreSQL-10.

@thbar
Copy link
Contributor

thbar commented Nov 2, 2018

Thanks @irionr! Do you know roughly what it would take to support Ubuntu 16.04 as well?

@gclough
Copy link
Collaborator

gclough commented Nov 5, 2018

@irionr, can this be updated to support all OS's that the current role supports please?

@irionr
Copy link
Author

irionr commented Nov 5, 2018 via email

@Rylon
Copy link

Rylon commented Mar 4, 2019

Hi @gclough I have a local fork of the repo and have applied this PR (along with #395) and tested in the following Vagrant environments. I don't think any of the errors found are to do with the pull request, they appear to be existing errors.

bionic64 (Ubuntu 18.04)

postgres@vagrant-ubuntu-bionic64:~$ psql
psql (11.2 (Ubuntu 11.2-1.pgdg18.04+1))
Type "help" for help.

postgres=#

xenial64 (Ubuntu 16.04)

postgres@vagrant-ubuntu-xenial64:~$ psql
psql (11.2 (Ubuntu 11.2-1.pgdg16.04+1))
Type "help" for help.

postgres=# 

trusty64 (Ubuntu 14.04)

Shows the following error which doesn't seem to be related to this PR, perhaps this is currently broken anyway?

TASK [postgresql : PostgreSQL | Update systemd | Debian] ***********************
fatal: [ubuntu-trusty]: FAILED! => {"changed": false, "cmd": "systemctl daemon-reload", "msg": "[Errno 2] No such file or directory", "rc": 2}

If I proceed to start the service manually it works:

root@vagrant-ubuntu-trusty64:~# /etc/init.d/postgresql start
 * Starting PostgreSQL 11 database server                                                                [ OK ] 
root@vagrant-ubuntu-trusty64:~# su -l postgres
postgres@vagrant-ubuntu-trusty64:~$ psql
psql (11.2 (Ubuntu 11.2-1.pgdg14.04+1))
Type "help" for help.

postgres=#

For Debian you specify Debian v8 and v9 on your README, but the Vagrantfile specified Jessie and Wheezy, which is v7 and v8, so I tested it with v7, v8 and v9 to be sure.

stretch64 (Debian 9)

postgres@vagrant-debian-stretch64:~$ psql
psql (11.2 (Debian 11.2-1.pgdg90+1))
Type "help" for help.

postgres=#

jessie64 (Debian 8)

vagrant@vagrant-debian-jessie64:~$ sudo su -l postgres
postgres@vagrant-debian-jessie64:~$ psql
psql (11.2 (Debian 11.2-1.pgdg80+1))

wheezy64 (Debian 7)

Fails due to wrong/malformed Apt source:

TASK [postgresql : PostgreSQL | Add PostgreSQL repository | apt] ***************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: , E:Some index files failed to download. They have been ignored, or old ones used instead.
fatal: [debian-wheezy]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"<stdin>\", line 113, in <module>\n  File \"<stdin>\", line 105, in _ansiballz_main\n  File \"<stdin>\", line 48, in invoke_module\n  File \"/tmp/ansible_apt_repository_payload_xf0nkv/__main__.py\", line 550, in <module>\n  File \"/tmp/ansible_apt_repository_payload_xf0nkv/__main__.py\", line 542, in main\n  File \"/usr/lib/python2.7/dist-packages/apt/cache.py\", line 418, in update\n    raise FetchFailedException(e)\napt.cache.FetchFailedException: W:Failed to fetch http://apt.postgresql.org/pub/repos/apt/dists/wheezy-pgdg/Release  Unable to find expected entry '11/binary-amd64/Packages' in Release file (Wrong sources.list entry or malformed file)\n, E:Some index files failed to download. They have been ignored, or old ones used instead.\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

CentOS 6

Fails due to the following errors:

TASK [postgresql : PostgreSQL | Setup service users profile | yum] *************
fatal: [centos-6]: FAILED! => {"msg": "The conditional check 'postgresql_service_user_pgsql_profile' failed. The error was: error while evaluating conditional (postgresql_service_user_pgsql_profile): 'postgresql_service_user_pgsql_profile' is undefined\n\nThe error appears to have been in '/Users/ryan/code/ansible/roles/postgresql/tasks/install_yum.yml': line 37, column 9, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n      - name: PostgreSQL | Setup service users profile | yum\n        ^ here\n"}

I found several tasks referencing when: postgresql_service_user_pgsql_profile but the variable doesn't seem to be defined anywhere, so I changed the condition to when: postgresql_service_user_pgsql_profile is defined and re-run the playbook.

This then resulted in the following error:

TASK [postgresql : PostgreSQL | Reload all conf files] *************************
fatal: [centos-6]: FAILED! => {"changed": false, "msg": "\n/var/lib/pgsql/11/data is missing. Use \"service postgresql-11 initdb\" to initialize the cluster first.\n[FAILED]\r\n"}

If I run the initialisation it all works:

[root@vagrant-centos-6 ~]# service postgresql-11 initdb
Initializing database:                                     [  OK  ]
[root@vagrant-centos-6 ~]# /etc/init.d/postgresql-11 restart
Stopping postgresql-11 service:                            [  OK  ]
Starting postgresql-11 service:                            [  OK  ]
[root@vagrant-centos-6 ~]# su -l postgres
-bash-4.1$ psql
psql (11.2)
Type "help" for help.

postgres=# 

CentOS7

Also fails due to the following error:

TASK [postgresql : PostgreSQL | Setup service users profile | yum] *************
fatal: [centos-7]: FAILED! => {"msg": "The conditional check 'postgresql_service_user_pgsql_profile' failed. The error was: error while evaluating conditional (postgresql_service_user_pgsql_profile): 'postgresql_service_user_pgsql_profile' is undefined\n\nThe error appears to have been in '/Users/ryan/code/ansible/roles/postgresql/tasks/install_yum.yml': line 37, column 9, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n      - name: PostgreSQL | Setup service users profile | yum\n        ^ here\n"}

I found several tasks referencing when: postgresql_service_user_pgsql_profile but the variable doesn't seem to be defined anywhere, so I changed the condition to when: postgresql_service_user_pgsql_profile is defined and re-run the playbook, which then worked:

[vagrant@vagrant-centos-7 ~]$ sudo su -l postgres
-bash-4.2$ psql
psql (11.2)
Type "help" for help.

@@ -751,42 +751,46 @@ postgresql_pgdg_releases:
9.3: 3,
9.4: 3,
9.5: 3,
9.6: 3,
10: 2,
9.6: 10,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These aren't the patch versions, but are the YUM repo versions. They rarely change once the product has been released GA.

@@ -8,6 +8,7 @@ Vagrant.configure('2') do |config|
config.ssh.private_key_path = '~/.vagrant.d/insecure_private_key'

config.vm.define 'anxs' do |machine|
#machine.vm.box = "generic/ubuntu1804"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The addition of Ubuntu 18 is welcome, but it's probably best to do that as a separate PR rather than mixing it with the v11 update.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also make sure you update the Vagrant files, so that the new version gets tested. This PR was only run against:

846.1
Python: 2.7
IMAGE_NAME="ubuntu-upstart:14.04"
7 min 10 sec

846.2
Python: 2.7
IMAGE_NAME="ubuntu:16.04-builded"
6 min 21 sec

846.3
Python: 2.7
IMAGE_NAME="debian:8-builded"
7 min 30 sec

846.4
Python: 2.7
IMAGE_NAME="debian:9-builded"
6 min 6 sec

846.5
Python: 2.7
IMAGE_NAME="centos:7-builded"
5 min 10 sec

846.6
Python: 2.7
IMAGE_NAME="centos:6-builded"
21 min 36 sec

@gclough
Copy link
Collaborator

gclough commented Mar 8, 2019

Hi @irionr . I took and old PR of mine #333 and refreshed it into #405. This is now merged, so the role supports v11. That supersedes this, so I hope you don't mind if I close it?

Getting Ubuntu 18.04 support would be nice, but I think it would make more sense to branch the current master and add it to there as a new PR. Could you do that?

Cheers,
Greg.

@gclough gclough closed this Mar 8, 2019
@nchudleigh nchudleigh mentioned this pull request Mar 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants