kostiantyn-nemchenko / ansible-role-patroni

:elephant: Ansible Role for Patroni
https://galaxy.ansible.com/kostiantyn-nemchenko/patroni
MIT License
68 stars 44 forks source link

Install patroni from pgdg #82

Closed wilfriedroset closed 3 years ago

wilfriedroset commented 4 years ago

Hello,

Thank you for this role.

I would like to suggest that this role provide a way to install patroni from pgdg repository (or simply replace pip installation). This would save the work from creating users, directory, service file and so on. You already have this repository installed for both Debian and Red-Hat: https://github.com/kostiantyn-nemchenko/ansible-role-patroni/blob/2fceaebec88494a749855ba36b6ef0df8d7832de/vars/Debian.yml#L4 https://github.com/kostiantyn-nemchenko/ansible-role-patroni/blob/2fceaebec88494a749855ba36b6ef0df8d7832de/vars/RedHat.yml#L3

That way we would be able to leverage pgdg contribution, make this role usable for those working behind a strict firewall where allowing pypi is not possible.

I think it would be doable by removing pip usage and adding patroni to patroni_postgresql_packages: https://github.com/kostiantyn-nemchenko/ansible-role-patroni/blob/2fceaebec88494a749855ba36b6ef0df8d7832de/vars/Debian.yml#L12-L16

Let me know what you think about this. Cheers, W.

kostiantyn-nemchenko commented 4 years ago

@wilfriedroset Thank you for your interest! This looks like a reasonable suggestion to me. IMO the role should support both methods to not introduce any breaking change for those who already using it. If you would like to contribute - feel free to open a PR. I would be happy to review any input to this project. Otherwise, I will try to add pgdg support as soon as I have enough free time.

wilfriedroset commented 4 years ago

Following #83 it became possible to install patroni from pgdg. Example

patroni_bin_dir: /usr/bin
patroni_config_file: "config.yml"
patroni_log_destination: not_stderr
patroni_restapi_listen: "{{ private_ip }}:8008"
patroni_restapi_connect_address: "{{ private_ip }}:8008"

# Don't want to install anything from pip
patroni_system_packages: []
patroni_pip_packages: []

# Patroni is in pgdg repository
patroni_postgresql_packages:
  - {name: "postgresql-{{ patroni_postgresql_version }}", state: "present"}
  - {name: "postgresql-client-{{ patroni_postgresql_version }}", state: "present"}
  - {name: "postgresql-contrib-{{ patroni_postgresql_version }}", state: "present"}
  - {name: "patroni", state: "present"}
  - {name: "python3-consul", state: "present"}
  - {name: "postgresql-{{ patroni_postgresql_version }}-pglogical", state: "present"}
  - {name: "timescaledb-postgresql-{{ patroni_postgresql_version }}", state: "present"}
  - {name: "postgresql-{{ patroni_postgresql_version }}-postgis-3", state: "present"}

With this we could make it a bit more straight forward. What do you think about having two files install-pip.yml, install-package.yml included in https://github.com/kostiantyn-nemchenko/ansible-role-patroni/blob/master/tasks/install.yml according to a flag install_method who can have two value pip or package?

kostiantyn-nemchenko commented 4 years ago

Yeah, making the installation process a bit more straight forward and clear sounds good to me.