Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support pgbackrest #40

Merged
merged 27 commits into from
Jun 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
61af3e6
add support pgbackrest
vitabaks May 27, 2020
da7f8cc
Wait for the new cluster to initialize before generating the custom p…
vitabaks May 28, 2020
bd84600
Сhange the owner of the pgbackrest.conf file to postgres
vitabaks May 28, 2020
fc53d67
Molecule_CI: update converge.yml
vitabaks May 28, 2020
874a074
Add patroni_cluster_point_in_time_recovery (PITR)
vitabaks May 29, 2020
fa08756
Remove jmespath package dependency
vitabaks May 30, 2020
9735c2f
PITR mode for custom bootsrap
vitabaks Jun 1, 2020
603efbf
patroni.yml fix trailing spaces
vitabaks Jun 1, 2020
8c4b06c
pgbackrest: Start PostgreSQL for Recovery (WAL apply) instead of rein…
vitabaks Jun 4, 2020
a2d088c
patroni.yml: fix condition with wrong order
vitabaks Jun 4, 2020
317896e
pgbackrest: add proxy_env for "install package" task.
vitabaks Jun 5, 2020
ceac03e
PITR: Add the variable ansible_python_interpreter at the task level.
vitabaks Jun 5, 2020
284dc07
Check that the patroni is healthy on the replica server
vitabaks Jun 5, 2020
6a7574e
pgbackrest: Set "--target-action" if "--type" is specified only.
vitabaks Jun 5, 2020
6f01590
Add yedit module for patroni role
vitabaks Jun 10, 2020
c5e6604
Update requirements.txt
vitabaks Jun 10, 2020
00cbd2b
PITR: Make sure the superuser and replication password does not diffe…
vitabaks Jun 10, 2020
2fd6204
pgbackrest: fix libzstd dependency problem for CentOS 8.1
vitabaks Jun 11, 2020
2959084
Patroni PITR: update postgresql authentication only when postgresql_u…
vitabaks Jun 16, 2020
590d8cb
PITR: do not execute block "superuser and replication" for add_pgnode…
vitabaks Jun 16, 2020
d94bfbc
PITR: set hot_standby=off for TASK [patroni : Start PostgreSQL for Re…
vitabaks Jun 16, 2020
7f01016
Set become_user: postgres for TASK [deploy-finish : Get postgresql da…
vitabaks Jun 16, 2020
427f4e9
Add role "etc_hosts"
vitabaks Jun 21, 2020
81c485b
pgbackrest: update repo1-s3-endpoint
vitabaks Jun 22, 2020
f15e6d1
disable pgbackrest bootstrap script
vitabaks Jun 23, 2020
09f0dad
Update vars/main.yml. Delete exmaple pgbackrest conf for S3.
vitabaks Jun 23, 2020
5d894d2
Update the pgbackrest conf path
vitabaks Jun 23, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions add_pgnode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
- vars/main.yml
- vars/system.yml
- "vars/{{ ansible_os_family }}.yml"
vars:
existing_pgcluster: true

pre_tasks:
- name: Checking Linux distribution
Expand Down Expand Up @@ -64,6 +62,7 @@

- role: hostname
- role: resolv_conf
- role: etc_hosts
- role: add-repository
- role: packages
- role: sudo
Expand All @@ -76,6 +75,31 @@
- role: ntp
- role: ssh-keys

- hosts: pgbackrest:postgres_cluster
become: true
become_method: sudo
gather_facts: true
any_errors_fatal: true
vars_files:
- vars/main.yml
- "vars/{{ ansible_os_family }}.yml"
roles:
- role: pgbackrest
when: pgbackrest_install|bool

- hosts: replica
become: true
become_method: sudo
gather_facts: true
any_errors_fatal: true
vars_files:
- vars/main.yml
- vars/system.yml
- "vars/{{ ansible_os_family }}.yml"
vars:
existing_pgcluster: true

roles:
- role: wal-g
when: wal_g_install|bool

Expand Down
24 changes: 24 additions & 0 deletions deploy_pgcluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@

- role: hostname
- role: resolv_conf
- role: etc_hosts
- role: add-repository
- role: packages
- role: sudo
Expand All @@ -89,6 +90,29 @@
- role: ntp
- role: ssh-keys

- hosts: pgbackrest:postgres_cluster
become: true
become_method: sudo
gather_facts: true
any_errors_fatal: true
vars_files:
- vars/main.yml
- "vars/{{ ansible_os_family }}.yml"
roles:
- role: pgbackrest
when: pgbackrest_install|bool

- hosts: postgres_cluster
become: true
become_method: sudo
gather_facts: true
any_errors_fatal: true
vars_files:
- vars/main.yml
- vars/system.yml
- "vars/{{ ansible_os_family }}.yml"

roles:
- role: wal-g
when: wal_g_install|bool

Expand Down
3 changes: 2 additions & 1 deletion files/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
urllib3>=1.24.2,<1.25
boto
PyYAML
requests
six >= 1.7
kazoo>=1.3.1
python-etcd>=0.4.3,<0.5
Expand All @@ -12,3 +11,5 @@ tzlocal
python-dateutil
psutil>=2.0.0
cdiff
pexpect>=4.8.0
ruamel.yaml>=0.16.10
14 changes: 11 additions & 3 deletions inventory
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Please specify the ip addresses and connection settings for your environment
# The specified ip addresses will be used to listen by the cluster components.

# "postgresql_exists='true'" if PostgreSQL is already exists and runing
# "postgresql_exists='true'" if PostgreSQL is already exists and running on master (for initial deployment only)
# "hostname=" variable is optional (used to change the server name)

# if dcs_exists: false and dcs_type: "etcd" (in vars/main.yml)
Expand Down Expand Up @@ -36,12 +36,20 @@ replica
# You can deploy the etcd cluster and the haproxy balancers on other dedicated servers.


# if pgbackrest_install: true and "repo_host" is set (in vars/main.yml)
[pgbackrest] # optional (Dedicated Repository Host)


# Connection settings
[all:vars]
ansible_connection='ssh'
ansible_ssh_port='22'
ansible_user='root'
ansible_ssh_pass='testpas' # "sshpass" package is required for use "ansible_ssh_pass"
#ansible_ssh_private_key_file=
ansible_ssh_pass='secretpassword' # "sshpass" package is required for use "ansible_ssh_pass"
# ansible_ssh_private_key_file=
# ansible_python_interpreter='/usr/bin/python3' # is required for use python3

[pgbackrest:vars]
ansible_user='postgres'
ansible_ssh_pass='secretpassword'

7 changes: 0 additions & 7 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
sysctl_set: false # Added to prevent test failures in CI.
cacheable: true

- name: Prepare | Remove epel-release package
package:
name: epel-release
state: absent
when:
- ansible_os_family == "RedHat"

- name: Prepare | Clean yum cache
command: yum clean all
args:
Expand Down
7 changes: 0 additions & 7 deletions molecule/postgrespro/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
sysctl_set: false # Added to prevent test failures in CI.
cacheable: true

- name: Prepare | Remove epel-release package
package:
name: epel-release
state: absent
when:
- ansible_os_family == "RedHat"

- name: Prepare | Clean yum cache
command: yum clean all
args:
Expand Down
6 changes: 4 additions & 2 deletions roles/deploy-finish/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
debug:
var: patronictl_result.stdout_lines
ignore_errors: true
tags: patroni_status, cluster_info, cluster_status
tags: patroni_status, cluster_info, cluster_status, point_in_time_recovery

- block:
- name: Get postgresql database list
run_once: true
become: true
become_user: postgres
command:
"{{ postgresql_bin_dir }}/psql -p {{ postgresql_port }} -U postgres -c
\"
Expand Down Expand Up @@ -53,7 +55,7 @@
debug:
var: dbs_result.stdout_lines
ignore_errors: true
tags: databases, db_list, cluster_info, cluster_status
tags: databases, db_list, cluster_info, cluster_status, point_in_time_recovery

- block:
- name: PostgreSQL Cluster connection info
Expand Down
15 changes: 15 additions & 0 deletions roles/etc_hosts/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---

- name: Add entries into /etc/hosts file
lineinfile:
path: /etc/hosts
regexp: "^{{ item }}"
line: "{{ item }}"
unsafe_writes: true # to prevent failures in CI
loop: "{{ etc_hosts }}"
when:
- etc_hosts is defined
- etc_hosts | length > 0
tags: etc_hosts

...
Loading