Skip to content

Commit

Permalink
Support Ubuntu 24.04; Install Patroni via deb/rpm package (#642)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitabaks authored Aug 8, 2024
1 parent 05e360e commit dd07f08
Show file tree
Hide file tree
Showing 17 changed files with 244 additions and 193 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ jobs:
- distro: debian10
tag: latest
namespace: geerlingguy
- distro: ubuntu2404
tag: latest
namespace: geerlingguy
- distro: ubuntu2204
tag: latest
namespace: geerlingguy
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/schedule_pg_ubuntu2404.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: scheduled PostgreSQL (Ubuntu 24.04)

on:
schedule:
- cron: "30 0 * * *"

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Set TERM environment variable
run: echo "TERM=xterm" >> $GITHUB_ENV

- name: Checkout
uses: actions/checkout@v3

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install dependencies
run: make bootstrap-dev

- name: Run Molecule tests
run: make molecule-test
env:
PY_COLORS: "1"
ANSIBLE_FORCE_COLOR: "1"
IMAGE_DISTRO: ubuntu2404
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ RedHat and Debian based distros (x86_64)

###### Supported Linux Distributions:
- **Debian**: 10, 11, 12
- **Ubuntu**: 20.04, 22.04
- **Ubuntu**: 20.04, 22.04, 24.04
- **CentOS Stream**: 9
- **Oracle Linux**: 8, 9
- **Rocky Linux**: 8, 9
Expand Down
1 change: 0 additions & 1 deletion files/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ python-consul>=0.7.1
click>=4.1
prettytable>=0.7
python-dateutil
pysyncobj>=0.3.8
psutil>=2.0.0
ydiff>=1.2.0
pexpect==4.9.0
Expand Down
14 changes: 11 additions & 3 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@
delegate_to: localhost
run_once: true # noqa run-once

# Consul package for OracleLinux, Debian 10 (EOL) missing in HashiCorp repository
# Only the installation of a binary file is supported
- name: "Set variables: 'consul_install_from_repo: false' and 'patroni_installation_method: pip'"
ansible.builtin.set_fact:
consul_install_from_repo: false # whether to install consul from repository as opposed to installing the binary directly
patroni_installation_method: "pip" # the "rpm" method is supported only for consul installed from the repository
when:
- dcs_type == "consul"
- ansible_distribution == "OracleLinux" or
(ansible_distribution == "Debian" and ansible_distribution_major_version == '10')

- name: Set variables for custom PostgreSQL data and WAL directory test
ansible.builtin.set_fact:
postgresql_data_dir: "/pgdata/{{ postgresql_version }}/main"
Expand All @@ -41,9 +52,6 @@
- name: Set variables for TimescaleDB cluster deployment test
ansible.builtin.set_fact:
enable_timescale: true
when:
- not (ansible_distribution == 'Ubuntu' and ansible_distribution_version is version('20.04', '<'))
- not (ansible_distribution == 'Debian' and ansible_distribution_version is version('11', '>')) # TODO Debian 12

- name: Set variables for PostgreSQL Cluster update test
ansible.builtin.set_fact:
Expand Down
16 changes: 12 additions & 4 deletions molecule/pg_upgrade/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,25 @@
delegate_to: localhost
run_once: true # noqa run-once

# Consul package for OracleLinux, Debian 10 (EOL) missing in HashiCorp repository
# Only the installation of a binary file is supported
- name: "Set variables: 'consul_install_from_repo: false' and 'patroni_installation_method: pip'"
ansible.builtin.set_fact:
consul_install_from_repo: false # whether to install consul from repository as opposed to installing the binary directly
patroni_installation_method: "pip" # the "rpm" method is supported only for consul installed from the repository
when:
- dcs_type == "consul"
- ansible_distribution == "OracleLinux" or
(ansible_distribution == "Debian" and ansible_distribution_major_version == '10')

- name: Set variables for custom PostgreSQL data and WAL directory test
ansible.builtin.set_fact:
postgresql_data_dir: "/pgdata/{{ postgresql_version }}/main"
postgresql_wal_dir: "/pgwal/{{ postgresql_version }}/pg_wal"

- name: Set variables for TimescaleDB cluster deployment test
ansible.builtin.set_fact:
enable_timescale: false # TODO (enable when adding PostgreSQL 16 support)
when:
- not (ansible_distribution == 'Ubuntu' and ansible_distribution_version is version('20.04', '<'))
- not (ansible_distribution == 'Debian' and ansible_distribution_version is version('11', '>')) # TODO Debian 12
enable_timescale: true

- name: Set variables for PostgreSQL upgrade test
ansible.builtin.set_fact:
Expand Down
11 changes: 0 additions & 11 deletions roles/consul/files/consul_1.15.8_SHA256SUMS

This file was deleted.

11 changes: 11 additions & 0 deletions roles/consul/files/consul_1.19.1_SHA256SUMS
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
0b3b78d11d31a66938c9a90f5a9361e8363a43688f7f25fe300e37a95373d209 consul_1.19.1_darwin_amd64.zip
f2fc99fa8fb5e193f3ceefc7594f11200fa539ddfa8800c5925c59f62facee48 consul_1.19.1_darwin_arm64.zip
e0294fdcaa198fd15b058b5500c4847ee4d0b002b2b4665b8322e0668e879f94 consul_1.19.1_freebsd_386.zip
2229d8ace4066f3cf51031dae00c4fc05d3025b98bc300def6e717134aafa9c5 consul_1.19.1_freebsd_amd64.zip
87431003ee2c0caf86d827a0dfb43fc285ed9d4864f35d505a116f4744d496ca consul_1.19.1_linux_386.zip
aa48085aaa6f4130d0f1ee98c416dcd51b1b0f980d34f5b91834fd5b3387891c consul_1.19.1_linux_amd64.zip
a4a54fd0ca6991d48d617311dfb1623d6030140a10c005ad33809dad864da239 consul_1.19.1_linux_arm.zip
9699e5a2b85b4447a81b01138c3e0ef42dbcdd9df4f04e9318af9017aae73cc4 consul_1.19.1_linux_arm64.zip
ed81780dd374a00292f864ac457e28feffb637964acc397c9cd2676ca565041b consul_1.19.1_solaris_amd64.zip
5e6cc24d3219c1c331f9b39ade2961b9948c86e254a214751b921b4027f168a5 consul_1.19.1_windows_386.zip
a33bed52d6004c956b5b9a1fa6659477a32db14a07d37425f9ed96a6b1eaeae2 consul_1.19.1_windows_amd64.zip
Binary file not shown.
10 changes: 5 additions & 5 deletions roles/consul/tasks/install_linux_repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
delay: 5
retries: 3
become: true
when: (consul_os_repo_prerequisites)
when: consul_os_repo_prerequisites | default(true) | bool
tags: installation

- name: Gather the package facts
Expand Down Expand Up @@ -49,7 +49,7 @@

- name: Install repository
block:
- name: Add Redhat/CentOS/Fedora/Amazon Linux repository
- name: Add hashicorp repository
ansible.builtin.command: "yum-config-manager --add-repo {{ consul_repo_url }}"
args:
creates: /etc/yum.repos.d/hashicorp.repo
Expand All @@ -67,7 +67,7 @@
state: present
when: "ansible_os_family|lower == 'debian'"

- name: Add Debian/Ubuntu Linux repository
- name: Add hashicorp repository
ansible.builtin.apt_repository:
repo: "deb {{ consul_repo_url }} {{ ansible_distribution_release }} main"
state: present
Expand All @@ -79,8 +79,8 @@

- name: Install consul package
ansible.builtin.package:
name: "consul{{ '=' if ansible_pkg_mgr == 'apt' else '-' }}{{ consul_version }}"
state: present
name: consul
state: latest
register: package_status
until: package_status is success
delay: 5
Expand Down
7 changes: 0 additions & 7 deletions roles/consul/vars/RedHat-8.yml

This file was deleted.

5 changes: 1 addition & 4 deletions roles/consul/vars/RedHat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
# File: RedHat.yml - Red Hat OS variables for Consul

consul_os_packages:
- "{{ 'libselinux-python' if (ansible_distribution == 'Fedora' and ansible_distribution_version is version('28', '<')) or
(ansible_distribution == 'CentOS' and ansible_distribution_version is version('8', '<')) or
(ansible_distribution == 'Amazon' and ansible_distribution_version is version('3', '<')) or
(ansible_distribution == 'OracleLinux' and ansible_distribution_version is version('8', '<')) else 'python3-libselinux' }}"
- python3-libselinux
- unzip

consul_repo_prerequisites:
Expand Down
6 changes: 0 additions & 6 deletions roles/consul/vars/Rocky-8.yml

This file was deleted.

8 changes: 6 additions & 2 deletions roles/cron/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
delay: 5
retries: 3
environment: "{{ proxy_env | default({}) }}"
when: ansible_os_family == "RedHat"
when:
- cron_jobs is defined and cron_jobs | length > 0
- ansible_os_family == "RedHat"
tags: cron

- name: Make sure that the cron package is installed
Expand All @@ -22,7 +24,9 @@
delay: 5
retries: 3
environment: "{{ proxy_env | default({}) }}"
when: ansible_os_family == "Debian"
when:
- cron_jobs is defined and cron_jobs | length > 0
- ansible_os_family == "Debian"
tags: cron

- name: Add cron jobs
Expand Down
Loading

0 comments on commit dd07f08

Please sign in to comment.