vitabaks / postgresql_cluster

PostgreSQL High-Availability Cluster (based on Patroni). Automating with Ansible.
https://postgresql-cluster.org
MIT License
1.54k stars 402 forks source link

HAPROXY is not starting #682

Closed Ashishveer0710 closed 1 month ago

Ashishveer0710 commented 3 months ago

While executing the playbook I am getting below error:

TASK [haproxy : selinux | make sure the python3-libsemanage, python3-policycoreutils packages is present] ****************************
ok: [167.71.227.220]
ok: [143.110.249.159]

TASK [haproxy : selinux | set haproxy_connect_any flag to enable tcp connections] ****************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'semanage'
fatal: [143.110.249.159]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (libsemanage-python or python3-libsemanage) on ashish2's Python /usr/bin/python3. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"}
...ignoring
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'semanage'
fatal: [167.71.227.220]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (libsemanage-python or python3-libsemanage) on ashish3's Python /usr/bin/python3. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"}
...ignoring

TASK [haproxy : selinux | change the haproxy_t domain to permissive] *****************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'seobject'
fatal: [167.71.227.220]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (policycoreutils-python) on ashish3's Python /usr/bin/python3. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"}
...ignoring
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'seobject'
fatal: [143.110.249.159]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (policycoreutils-python) on ashish2's Python /usr/bin/python3. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"}
...ignoring

TASK [confd : Download and copy "confd" binary file to /usr/local/bin/] **************************************************************
ok: [167.71.227.220] => (item=https://github.com/kelseyhightower/confd/releases/download/v0.16.0/confd-0.16.0-linux-amd64)
ok: [143.110.249.159] => (item=https://github.com/kelseyhightower/confd/releases/download/v0.16.0/confd-0.16.0-linux-amd64)

TASK [confd : Create conf directories] ***********************************************************************************************
ok: [143.110.249.159] => (item=/etc/confd/conf.d)
ok: [167.71.227.220] => (item=/etc/confd/conf.d)
ok: [143.110.249.159] => (item=/etc/confd/templates)
ok: [167.71.227.220] => (item=/etc/confd/templates)

TASK [confd : Generate conf file "/etc/confd/confd.toml"] ****************************************************************************
ok: [143.110.249.159]
ok: [167.71.227.220]

TASK [confd : Generate conf file "/etc/confd/conf.d/haproxy.toml"] *******************************************************************
ok: [143.110.249.159]
ok: [167.71.227.220]

TASK [confd : Generate template "/etc/confd/templates/haproxy.tmpl"] *****************************************************************
ok: [143.110.249.159]
ok: [167.71.227.220]

TASK [confd : Copy systemd service file] *********************************************************************************************
ok: [143.110.249.159]
ok: [167.71.227.220]

RUNNING HANDLER [haproxy : Restart haproxy service] **********************************************************************************
fatal: [143.110.249.159]: FAILED! => {"changed": false, "msg": "Unable to start service haproxy: Job for haproxy.service failed because the control process exited with error code.\nSee \"systemctl status haproxy.service\" and \"journalctl -xeu haproxy.service\" for details.\n"}
fatal: [167.71.227.220]: FAILED! => {"changed": false, "msg": "Unable to start service haproxy: Job for haproxy.service failed because the control process exited with error code.\nSee \"systemctl status haproxy.service\" and \"journalctl -xeu haproxy.service\" for details.\n"}

NO MORE HOSTS LEFT *******************************************************************************************************************

PLAY RECAP ***************************************************************************************************************************
139.59.89.66               : ok=35   changed=2    unreachable=0    failed=0    skipped=42   rescued=0    ignored=0
143.110.249.159            : ok=104  changed=5    unreachable=0    failed=1    skipped=173  rescued=0    ignored=2
167.71.227.220             : ok=108  changed=5    unreachable=0    failed=1    skipped=183  rescued=0    ignored=2

[deployer@ashish1 postgresql_cluster]$

OS : Centos 9

I am installing semanage but still the HAProxy is not coming up and there are no logs for the same as well .

Please assist here. is this because of some firewall rule ?

my netstat -lntp looks something like this :

[root@ashish3 bin]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:35432           0.0.0.0:*               LISTEN      158563/postgres
tcp        0      0 167.71.227.220:2379     0.0.0.0:*               LISTEN      61009/etcd
tcp        0      0 167.71.227.220:2380     0.0.0.0:*               LISTEN      61009/etcd
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      91839/sshd: /usr/sb
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1/systemd
tcp        0      0 127.0.0.1:2379          0.0.0.0:*               LISTEN      61009/etcd
tcp        0      0 0.0.0.0:8008            0.0.0.0:*               LISTEN      158523/python3.11
tcp        0      0 0.0.0.0:15432           0.0.0.0:*               LISTEN      143501/pgbouncer
tcp6       0      0 :::22                   :::*                    LISTEN      91839/sshd: /usr/sb
tcp6       0      0 :::111                  :::*                    LISTEN      1/systemd
vitabaks commented 3 months ago

and there are no logs for the same as well .

please try sudo journalctl -u haproxy | tail -n 100

vitabaks commented 2 months ago

@Ashishveer0710 is the problem still relevant?