Skip to content

Commit

Permalink
Merge branch 'master' into cloud
Browse files Browse the repository at this point in the history
  • Loading branch information
vitabaks authored Sep 29, 2023
2 parents 3e498ae + ee46387 commit cd5ed6d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
14 changes: 12 additions & 2 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
gather_facts: true

tasks:
- name: Set variables for Patroni cluster deployment test
- name: Set variables for PostgreSQL Cluster deployment test
ansible.builtin.set_fact:
firewall_enabled_at_boot: false
firewall_enable_ipv6: false # Added to prevent test failures in CI.
Expand All @@ -30,6 +30,10 @@
- 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:
target: system # includes updates to Postgres, Patroni, and all system packages

- name: Clean yum cache (molecule containers)
ansible.builtin.command: yum clean all
when:
Expand Down Expand Up @@ -71,5 +75,11 @@
path: /run/nologin
state: absent

- name: Deploy PostgreSQL Cluster
- name: Deploy PostgreSQL Cluster test
ansible.builtin.import_playbook: ../../deploy_pgcluster.yml

- name: Config PostgreSQL Cluster test
ansible.builtin.import_playbook: ../../config_pgcluster.yml

- name: Update PostgreSQL Cluster test
ansible.builtin.import_playbook: ../../update_pgcluster.yml
5 changes: 2 additions & 3 deletions molecule/tests/postgres/replication.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
---
- name: Check PostgreSQL replication status
postgresql_query:
query: "SELECT * FROM pg_stat_wal_receiver;"
query: "SELECT pg_is_in_recovery(), count(*) FROM pg_stat_wal_receiver;"
login_unix_socket: "{{ postgresql_unix_socket_dir }}"
login_port: "{{ postgresql_port }}"
login_user: "{{ patroni_superuser_username }}"
login_db: template1
register: pg_replication_status
failed_when: "pg_replication_status.rowcount == 0"
when: "'replica' in group_names"
failed_when: "pg_replication_status.query_result[0].pg_is_in_recovery and pg_replication_status.query_result[0].count == 0"
5 changes: 2 additions & 3 deletions roles/confd/templates/confd.toml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ nodes = [
]
{% if dcs_exists|bool and dcs_type == 'etcd' %}
{% if patroni_etcd_username | default('') | length > 0 %}
basic_auth = true
username = "{{ patroni_etcd_username | default('') }}"
{% endif %}
{% if patroni_etcd_password | default('') | length > 0 %}
password = "{{ patroni_etcd_password }}"
password = "{{ patroni_etcd_password | default('') }}"
{% endif %}
{% endif %}
2 changes: 2 additions & 0 deletions update_pgcluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
become: true
become_user: postgres
any_errors_fatal: true
vars_files:
- vars/main.yml
vars:
max_replication_lag_bytes: 10485760 # 10 MiB
max_transaction_sec: 15 # seconds
Expand Down

0 comments on commit cd5ed6d

Please sign in to comment.