-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from rmondegar/master
Adapts the roles to includes suuport to new combination versions
- Loading branch information
Showing
6 changed files
with
78 additions
and
16 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
34 changes: 34 additions & 0 deletions
34
roles/postgres-cluster-data-initialize-new/tasks/register_node_1.6.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,34 @@ | ||
--- | ||
- name: "compute monitor_nodes_list" | ||
vars: | ||
monitor_node_ip : "{{ hostvars[item]['host_ip'] | default(hostvars[item]['ansible_host']) }}" | ||
set_fact: | ||
postgresql_cluster_monitor_node_ips: "{{ (postgresql_cluster_monitor_node_ips | default([])) + [monitor_node_ip] }}" | ||
with_items: "{{ groups['postgres_cluster'] | default([]) }}" | ||
|
||
|
||
# TODO: add support for crl files | ||
# FIXME: monitor port may be wrong if its overridden on a per host basis !!! | ||
#--group {{ postgresql_cluster_group | default('0') }} \ | ||
|
||
- name: "run pg_autoctl create postgres" | ||
become_user: "{{ postgresql_cluster_user }}" | ||
# by default allow up to 5 hours for this command until it times out | ||
async: "{{ postgresql_cluster_new_node_creation_timeout | default(18000) | int }}" | ||
# poll every 10 seconds to see if we are finished | ||
poll: 10 | ||
vars: | ||
first_monitor_node: "{{ postgresql_cluster_monitor_node_ips | first }}" | ||
shell: > | ||
PATH="$PATH:{{ postgresql_cluster_bin_path }}" pg_autoctl create postgres \ | ||
--pgdata "{{ postgresql_cluster_data_dir }}" \ | ||
--skip-pg-hba \ | ||
--formation {{ postgresql_cluster_formation | default('default') }} \ | ||
--ssl-ca-file "{{ postgresql_cluster_ssl_ca_file | default('/data/ansible/certs/postgres_server/rootCA.crt') }}" \ | ||
--server-key "{{ postgresql_cluster_server_key | default('/data/ansible/certs/postgres_server/server.key') }}" \ | ||
--server-cert "{{ postgresql_cluster_server_cert | default('/data/ansible/certs/postgres_server/server.crt') }}" \ | ||
--name "{{ host_ip }}" \ | ||
--hostname "{{ host_ip }}" \ | ||
--pgport "{{ postgresql_cluster_port | default('5433') }}" \ | ||
--monitor postgres://autoctl_node@{{ first_monitor_node }}:{{ postgresql_cluster_port | default('5433') }}/pg_auto_failover | ||
when: not (postgresql_cluster_is_monitor | default('False') | bool) |
12 changes: 12 additions & 0 deletions
12
roles/postgres-cluster-monitor-initialize/tasks/monitor_init_1.6.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,12 @@ | ||
--- | ||
- name: "run pg_autoctl create monitor" | ||
become_user: "{{ postgresql_cluster_user }}" | ||
shell: > | ||
PATH="$PATH:{{ postgresql_cluster_bin_path }}" pg_autoctl create monitor \ | ||
--pgdata "{{ postgresql_cluster_data_dir }}" \ | ||
--skip-pg-hba \ | ||
--ssl-ca-file "{{ postgresql_cluster_ssl_ca_file | default('/data/ansible/certs/postgres_server/rootCA.crt') }}" \ | ||
--server-key "{{ postgresql_cluster_server_key | default('/data/ansible/certs/postgres_server/server.key') }}" \ | ||
--server-cert "{{ postgresql_cluster_server_cert | default('/data/ansible/certs/postgres_server/server.crt') }}" \ | ||
--hostname "{{ host_ip }}" \ | ||
--pgport "{{ postgresql_cluster_port | default('5433') }}" |
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