Git Product home page Git Product logo

ansible-role-patroni's Introduction

Ansible Role for Patroni

Build Status Ansible Galaxy

An Ansible role which installs and configures Patroni - HA solution for PostgreSQL.

Help Wanted! If you encountered any difficulties with deploying the role into your environment, noticed a bug or a missing feature or just have an idea of how this project could be enhanced, please feel free to file an issue.

Requirements

This role requires root privileges, so tell ansible to use become: true in any convenient way for you.

Role Variables

Coming soon.

Dependencies

There are no dependencies for the role, but Patroni itself needs a DCS (Etcd, Consul, ZooKeeper or Exhibitor) to be installed and configured properly and it's your responsibility to make it up and running before using this role. Currently, it is supposed that a DCS is prepared. Otherwise, you can try one of the following roles (just uncomment respective section here and set patroni_dcs_exists variable to false):

Example Playbook

- hosts: postgresql-servers
  become: yes
  roles:
    - kostiantyn-nemchenko.patroni

License

MIT

Author Information

Kostiantyn Nemchenko [email protected]

ansible-role-patroni's People

Contributors

alge0 avatar daamien avatar dimentr avatar dzubchik avatar jsecchiero avatar kostiantyn-nemchenko avatar litewhatever avatar patsevanton avatar smutel avatar tacy-octo avatar veselahouba avatar wilfriedroset avatar zorlin avatar

Stargazers

 avatar

Forkers

pc-admin

ansible-role-patroni's Issues

Debian 12 introduces new obstacle for getting pip packages

Had this role fail on Bookwork due to the new pip package restrictions that are in place:

TASK [zorlin.patroni : Install pip packages for patroni] ****************************************************************************************************************************************
failed: [postgres01.penholder.xyz] (item={'name': 'setuptools', 'state': 'latest', 'umask': '0022', 'executable': 'pip3'}) => {"ansible_loop_var": "item", "changed": false, "cmd": ["/usr/bin/pip3", "install", "-U", "setuptools"], "item": {"executable": "pip3", "name": "setuptools", "state": "latest", "umask": "0022"}, "msg": "\n:stderr: error: externally-managed-environment\n\n× This environment is externally managed\n╰─> To install Python packages system-wide, try apt install\n    python3-xyz, where xyz is the package you are trying to\n    install.\n    \n    If you wish to install a non-Debian-packaged Python package,\n    create a virtual environment using python3 -m venv path/to/venv.\n    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make\n    sure you have python3-full installed.\n    \n    If you wish to install a non-Debian packaged Python application,\n    it may be easiest to use pipx install xyz, which will manage a\n    virtual environment for you. Make sure you have pipx installed.\n    \n    See /usr/share/doc/python3.11/README.venv for more information.\n\nnote: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.\nhint: See PEP 668 for the detailed specification.\n"}
failed: [postgres01.penholder.xyz] (item={'name': 'patroni[etcd]', 'state': 'present', 'umask': '0022', 'executable': 'pip3'}) => {"ansible_loop_var": "item", "changed": false, "cmd": ["/usr/bin/pip3", "install", "patroni[etcd]"], "item": {"executable": "pip3", "name": "patroni[etcd]", "state": "present", "umask": "0022"}, "msg": "\n:stderr: error: externally-managed-environment\n\n× This environment is externally managed\n╰─> To install Python packages system-wide, try apt install\n    python3-xyz, where xyz is the package you are trying to\n    install.\n    \n    If you wish to install a non-Debian-packaged Python package,\n    create a virtual environment using python3 -m venv path/to/venv.\n    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make\n    sure you have python3-full installed.\n    \n    If you wish to install a non-Debian packaged Python application,\n    it may be easiest to use pipx install xyz, which will manage a\n    virtual environment for you. Make sure you have pipx installed.\n    \n    See /usr/share/doc/python3.11/README.venv for more information.\n\nnote: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.\nhint: See PEP 668 for the detailed specification.\n"}

Occurs with this module:

- name: Install pip packages for patroni

This is due to a new prescribed method for installing and using pip packages with virtual environments which is now being enforced:

pcadmin@postgres01:~$ pip install gzip
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.
    
    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.
    
    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.
    
    See /usr/share/doc/python3.11/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

Forcing you to either start using virtual environments (which the ansible module supports) or use this dangerous looking flag:

pcadmin@postgres01:~$ pip install setuptools --break-system-packages
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (66.1.1)
pcadmin@postgres01:~$ pip install patroni[etcd] --break-system-packages
Defaulting to user installation because normal site-packages is not writeable
Collecting patroni[etcd]
  Downloading patroni-3.0.2-py3-none-any.whl (216 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 216.4/216.4 kB 7.4 MB/s eta 0:00:00
Requirement already satisfied: urllib3!=1.21

It would be great to get support for the Debian 12 on-wards with this Ansible role. Cheers.

Watchdog tasks still execute despite `patroni_install_watchdog_loader: false`

With patroni_install_watchdog_loader: false set in group_vars in the above playbook, I still manage to get this bug:

TASK [zorlin.patroni : meta] **************************************************************************************************************************************************************************************

TASK [zorlin.patroni : meta] **************************************************************************************************************************************************************************************

TASK [zorlin.patroni : meta] **************************************************************************************************************************************************************************************

RUNNING HANDLER [zorlin.patroni : restart patroni-watchdog] *******************************************************************************************************************************************************
changed: [postgres02.penholder.xyz]
changed: [postgres03.penholder.xyz]
changed: [postgres01.penholder.xyz]

RUNNING HANDLER [zorlin.patroni : restart watchdog] ***************************************************************************************************************************************************************
fatal: [postgres02.penholder.xyz]: FAILED! => {"changed": false, "msg": "Unable to restart service watchdog: Job for watchdog.service canceled.\n"}
fatal: [postgres03.penholder.xyz]: FAILED! => {"changed": false, "msg": "Unable to restart service watchdog: Job for watchdog.service canceled.\n"}
fatal: [postgres01.penholder.xyz]: FAILED! => {"changed": false, "msg": "Unable to restart service watchdog: Job for watchdog.service canceled.\n"}

PLAY RECAP ********************************************************************************************************************************************************************************************************
localhost                  : ok=10   changed=4    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
postgres01.penholder.xyz   : ok=58   changed=33   unreachable=0    failed=1    skipped=13   rescued=0    ignored=0   
postgres02.penholder.xyz   : ok=58   changed=33   unreachable=0    failed=1    skipped=12   rescued=0    ignored=0   
postgres03.penholder.xyz   : ok=57   changed=32   unreachable=0    failed=1    skipped=12   rescued=0    ignored=0   

Running it again... works after a re-try each time.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.