ANXS / postgresql

Fairly full featured Ansible role for Postgresql.
http://anxs.io/
MIT License
848 stars 573 forks source link

Add support for RHEL 8 #509

Closed Chilinot closed 3 years ago

Chilinot commented 3 years ago

Tested manually on CentOS 8 server. Needs proper testing, but seems to work fine now.

Solves #471

gclough commented 3 years ago

@Chilinot , the Travis tests still fail... so any idea on how to fix that? I'm not a Docker-er, but I figured it was something related:

TASK [Gathering Facts] *********************************************************
fatal: [postgresql-9.5]: FAILED! => {"changed": false, "failed": true, "module_stderr": "/bin/sh: python: command not found\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 0}
fatal: [postgresql-9.6]: FAILED! => {"changed": false, "failed": true, "module_stderr": "/bin/sh: python: command not found\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 0}
fatal: [postgresql-12]: FAILED! => {"changed": false, "failed": true, "module_stderr": "/bin/sh: python: command not found\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 0}
fatal: [postgresql-10]: FAILED! => {"changed": false, "failed": true, "module_stderr": "/bin/sh: python: command not found\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 0}
fatal: [postgresql-11]: FAILED! => {"changed": false, "failed": true, "module_stderr": "/bin/sh: python: command not found\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 0}
    to retry, use: --limit @/home/travis/build/ANXS/postgresql/tests/docker/site.retry

I have stripped most OS support out in #504, with the idea that we can add them back in one by one. (Like this merge)

Chilinot commented 3 years ago

The tests failed because in RHEL8 they no longer setup python by default as they no longer wanted to pick a default python version. I fixed it by installing python3 and linking /usr/bin/python.

Chilinot commented 3 years ago

Now it fails because there are locale issues. Whats up with removing and masking a bunch of systemd parts? It seems to cause issues.

Chilinot commented 3 years ago

The Centos:8 image does not bundle locales by default, causing the issues noted here.

Chilinot commented 3 years ago

The tests work fine when i run them on my laptop, it's weird they fail in travis and complains about missing python2 modules. Im building and testing the same docker images. Only difference i can note is that im running the latest ansible locally, while travis is running a very old version.

maglub commented 3 years ago

I like the approach in this pull request, and we should port it to use molecule as soon as we have pulled that merge request. I will be back in a day or so.

maglub commented 3 years ago

You are on the right way. I just cloned your project and ran a test:

git clone https://github.com/scrive/postgresql.git
cd postgresql
git checkout support-centos8
MOLECULE_DISTRO=centos8 molecule destroy
MOLECULE_DISTRO=centos8 molecule converge

...
TASK [postgresql : PostgreSQL | Initialize the database | RedHat] **************
fatal: [postgresql-11]: FAILED! => {"changed": true, "cmd": ["/usr/pgsql-11/bin/initdb", "-D", "/var/lib/pgsql/11/data", "--locale=en_US.UTF-8", "--encoding=UTF-8"], "delta": "0:00:00.018636", "end": "2021-03-25 12:04:44.454567", "msg": "non-zero return code", "rc": 1, "start": "2021-03-25 12:04:44.435931", "stderr": "initdb: invalid locale name \"en_US.UTF-8\"", "stderr_lines": ["initdb: invalid locale name \"en_US.UTF-8\""], "stdout": "The files belonging to this database system will be owned by user \"postgres\".\nThis user must also own the server process.", "stdout_lines": ["The files belonging to this database system will be owned by user \"postgres\".", "This user must also own the server process."]}
fatal: [postgresql-12]: FAILED! => {"changed": true, "cmd": ["/usr/pgsql-12/bin/initdb", "-D", "/var/lib/pgsql/12/data", "--locale=en_US.UTF-8", "--encoding=UTF-8"], "delta": "0:00:00.042010", "end": "2021-03-25 12:04:44.453337", "msg": "non-zero return code", "rc": 1, "start": "2021-03-25 12:04:44.411327", "stderr": "initdb: error: invalid locale name \"en_US.UTF-8\"", "stderr_lines": ["initdb: error: invalid locale name \"en_US.UTF-8\""], "stdout": "The files belonging to this database system will be owned by user \"postgres\".\nThis user must also own the server process.", "stdout_lines": ["The files belonging to this database system will be owned by user \"postgres\".", "This user must also own the server process."]}
fatal: [postgresql-10]: FAILED! => {"changed": true, "cmd": ["/usr/pgsql-10/bin/initdb", "-D", "/var/lib/pgsql/10/data", "--locale=en_US.UTF-8", "--encoding=UTF-8"], "delta": "0:00:00.034807", "end": "2021-03-25 12:04:44.476488", "msg": "non-zero return code", "rc": 1, "start": "2021-03-25 12:04:44.441681", "stderr": "initdb: invalid locale name \"en_US.UTF-8\"", "stderr_lines": ["initdb: invalid locale name \"en_US.UTF-8\""], "stdout": "The files belonging to this database system will be owned by user \"postgres\".\nThis user must also own the server process.", "stdout_lines": ["The files belonging to this database system will be owned by user \"postgres\".", "This user must also own the server process."]}
fatal: [postgresql-13]: FAILED! => {"changed": true, "cmd": ["/usr/pgsql-13/bin/initdb", "-D", "/var/lib/pgsql/13/data", "--locale=en_US.UTF-8", "--encoding=UTF-8"], "delta": "0:00:00.020453", "end": "2021-03-25 12:04:44.580359", "msg": "non-zero return code", "rc": 1, "start": "2021-03-25 12:04:44.559906", "stderr": "initdb: error: invalid locale name \"en_US.UTF-8\"", "stderr_lines": ["initdb: error: invalid locale name \"en_US.UTF-8\""], "stdout": "The files belonging to this database system will be owned by user \"postgres\".\nThis user must also own the server process.", "stdout_lines": ["The files belonging to this database system will be owned by user \"postgres\".", "This user must also own the server process."]}
fatal: [postgresql-9_6]: FAILED! => {"changed": true, "cmd": ["/usr/pgsql-9.6/bin/initdb", "-D", "/var/lib/pgsql/9.6/data", "--locale=en_US.UTF-8", "--encoding=UTF-8"], "delta": "0:00:00.022013", "end": "2021-03-25 12:04:44.594750", "msg": "non-zero return code", "rc": 1, "start": "2021-03-25 12:04:44.572737", "stderr": "initdb: invalid locale name \"en_US.UTF-8\"", "stderr_lines": ["initdb: invalid locale name \"en_US.UTF-8\""], "stdout": "The files belonging to this database system will be owned by user \"postgres\".\nThis user must also own the server process.", "stdout_lines": ["The files belonging to this database system will be owned by user \"postgres\".", "This user must also own the server process."]}

If you locally run the MOLECULE_DISTRO=centos8 molecule destroy once, then run MOLECULE_DISTRO=centos8 molecule converge until you get through your playbook, you will save a lot of time testing on your side (since you only test against centos8).

maglub commented 3 years ago

Looks good to me! You should also update the README.md table and add green checks for Centos8.

maglub commented 3 years ago

I think this looks good. What about you, @gclough ?