generated from onaio/ansible-role
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
204 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# dedicated-repository-host-ssh | ||
This demonstrates how one can configure dedicated host (backup server) with a postgresql host with ssh. | ||
|
1 change: 1 addition & 0 deletions
1
example/dedicated-repository-host-ssh/inventory/group_vars/all/vars.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
48 changes: 48 additions & 0 deletions
48
example/dedicated-repository-host-ssh/inventory/host_vars/pg1-host/vars.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
pgbackrest_is_pg_host: true | ||
pgbackrest_is_repository_host: false | ||
|
||
pgbackrest_create_user: true | ||
pgbackrest_user: postgres | ||
pgbackrest_user_group: postgres | ||
pgbackrest_user_home: "/var/lib/postgresql" | ||
pgbackrest_user_password: "" | ||
|
||
pgbackrest_stanza_conf: | ||
- name: main | ||
content: | ||
repo1-host: 192.168.15.25 | ||
pg1-path: /var/lib/postgresql/14/main | ||
pg1-user: postgres | ||
repo1-host-user: pgbackrest | ||
log-level-file: detail | ||
|
||
pgbackrest_conf: | ||
- name: global | ||
content: | ||
compress-level: 3 | ||
|
||
pgbackrest_pg_host_users: | ||
- name: postgres | ||
group: postgres | ||
password: "" | ||
|
||
pgbackrest_ssh_pub_keys_to_import: | ||
- src_host: 192.168.15.25 | ||
authorized_keys_path: "{{ pgbackrest_user_home }}/.ssh/authorized_keys" | ||
owner: "{{ pgbackrest_user }}" | ||
group: "{{ pgbackrest_user_group }}" | ||
|
||
pgbackrest_cronjob: | ||
- name: pgbackrest_full_backup | ||
minute: "10" | ||
hour: "06" | ||
day: "*" | ||
month: "*" | ||
weekday: "0" | ||
user: "{{ pgbackrest_user }}" | ||
job: "pgbackrest --type=full --stanza=main backup" | ||
cron_file: pgbackrest | ||
|
||
pgbackrest_pgpass_entries: | ||
- "locahost:5432:postgres:pgbackrest:pgbackrest" |
46 changes: 46 additions & 0 deletions
46
example/dedicated-repository-host-ssh/inventory/host_vars/repo1-host/vars.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
pgbackrest_is_repository_host: true | ||
pgbackrest_is_pg_host: false | ||
|
||
pgbackrest_stanza_conf: | ||
- name: main | ||
content: | ||
pg1-host: 192.168.15.24 | ||
pg1-path: /var/lib/postgresql/14/main | ||
repo1-block: y | ||
repo1-bundle: y | ||
compress-level: 3 | ||
repo1-path: /var/lib/pgbackrest | ||
repo1-cipher-pass: zWaf6XtpjIVZC5444yXB+cgFDFl7MxGlgkZSaoPvTGirhPygu4jOKOXf9LO4vjfO | ||
repo1-cipher-type: aes-256-cbc | ||
repo1-retention-full: 1 | ||
log-level-file: detail | ||
start-fast: y | ||
pg1-host-user: postgres | ||
|
||
pgbackrest_conf: | ||
- name: global | ||
content: | ||
compress-level: 3 | ||
|
||
pgbackrest_repo_host_users: | ||
- name: pgbackrest | ||
group: pgbackrest | ||
password: "" | ||
|
||
pgbackrest_ssh_pub_keys_to_import: | ||
- src_host: 192.168.15.24 | ||
authorized_keys_path: "{{ pgbackrest_user_home }}/.ssh/authorized_keys" | ||
owner: "{{ pgbackrest_user }}" | ||
group: "{{ pgbackrest_user_group }}" | ||
|
||
pgbackrest_cronjob: | ||
- name: pgbackrest_full_backup | ||
minute: "10" | ||
hour: "06" | ||
day: "*" | ||
month: "*" | ||
weekday: "0" | ||
user: pgbackrest | ||
job: "pgbackrest --type=full --stanza=main backup" | ||
cron_file: pgbackrest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pg1-host ansible_host=192.168.15.24 | ||
repo1-host ansible_host=192.168.15.25 | ||
|
||
[all] | ||
pg1-host | ||
repo1-host |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
- name: Set Up host | ||
hosts: pg1-host,repo1-host | ||
become: true | ||
roles: | ||
- role: ../../../ansible-pgbackrest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
- name: Set up tls | create pgbackrest cert directory | ||
ansible.builtin.file: | ||
path: "{{ pgbackrest_cert_directory }}" | ||
state: directory | ||
mode: '0750' | ||
owner: "{{ pgbackrest_user }}" | ||
group: "{{ pgbackrest_user_group }}" | ||
tags: | ||
- pgbackrest-set-up-tls-create-cert-directory | ||
- pgbackrest-set-up-tls | ||
|
||
- name: Set up tls | import pgbackrest certificates | ||
ansible.builtin.copy: | ||
src: "{{ item }}" | ||
dest: "{{ pgbackrest_cert_directory }}" | ||
owner: "{{ pgbackrest_user }}" | ||
group: "{{ pgbackrest_user_group }}" | ||
mode: "0600" | ||
with_items: | ||
- "{{ pgbackrest_certificate_ca }}" | ||
- "{{ pgbackrest_certificate_files }}" | ||
tags: | ||
- pgbackrest-set-up-tls-import-pgbackrest-certificates | ||
- pgbackrest-set-up-tls | ||
|
||
- name: Set up tls | setup pgbackrest.service | ||
ansible.builtin.template: | ||
src: "{{ pgbackrest_service_template }}" | ||
dest: "{{ pgbackrest_service_path }}" | ||
owner: "{{ pgbackrest_user }}" | ||
group: "{{ pgbackrest_user_group }}" | ||
mode: 0640 | ||
tags: | ||
- pgbackrest-set-up-tls-set-up-pgbackrest-service | ||
- pgbackrest-set-up-tls | ||
|
||
- name: Set up tls | start pgbackrest.service | ||
ansible.builtin.systemd_service: | ||
state: started | ||
daemon_reload: true | ||
enabled: true | ||
name: pgbackrest | ||
tags: | ||
- pgbackrest-set-up-tls-set-up-pgbackrest-service | ||
- pgbackrest-set-up-tls-set-up-start-pgbackrest-service | ||
- pgbackrest-set-up-tls |
Oops, something went wrong.