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 committed Nov 19, 2023
2 parents 1e285fb + b9e41c8 commit 0a817bb
Show file tree
Hide file tree
Showing 22 changed files with 291 additions and 146 deletions.
25 changes: 17 additions & 8 deletions add_balancer.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
---
- name: add_balancer.yml | Add haproxy balancer node (to the cluster "{{ patroni_cluster_name }}")
- name: add_balancer.yml | Add HAProxy balancer node
hosts: balancers
become: true
become_method: sudo
any_errors_fatal: true
gather_facts: true
vars_files:
- vars/main.yml
- vars/system.yml

pre_tasks:
- name: Include main variables
ansible.builtin.include_vars: "vars/main.yml"
tags: always

- name: Include system variables
ansible.builtin.include_vars: "vars/system.yml"
tags: always

- name: Include OS-specific variables
ansible.builtin.include_vars: "vars/{{ ansible_os_family }}.yml"
tags: always
Expand Down Expand Up @@ -122,13 +126,18 @@
become_method: sudo
gather_facts: true
any_errors_fatal: true
vars_files:
- vars/main.yml
- vars/system.yml
vars:
add_balancer: true

pre_tasks:
- name: Include main variables
ansible.builtin.include_vars: "vars/main.yml"
tags: always

- name: Include system variables
ansible.builtin.include_vars: "vars/system.yml"
tags: always

- name: Include OS-specific variables
ansible.builtin.include_vars: "vars/{{ ansible_os_family }}.yml"
tags: always
Expand Down
41 changes: 29 additions & 12 deletions add_pgnode.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
---
- name: add_pgnode.yml | PostgreSQL High-Availability Cluster Scaling (add a replica node to the cluster "{{ patroni_cluster_name }}")
- name: add_pgnode.yml | PostgreSQL HA Cluster Scaling (add a replica node)
hosts: postgres_cluster
become: true
become_method: sudo
any_errors_fatal: true
gather_facts: true
handlers:
- ansible.builtin.import_tasks: roles/patroni/handlers/main.yml
vars_files:
- vars/main.yml
- vars/system.yml

pre_tasks:
- name: Include main variables
ansible.builtin.include_vars: "vars/main.yml"
tags: always

- name: Include system variables
ansible.builtin.include_vars: "vars/system.yml"
tags: always

- name: Include OS-specific variables
ansible.builtin.include_vars: "vars/{{ ansible_os_family }}.yml"
tags: always
Expand Down Expand Up @@ -134,11 +139,16 @@
become_method: sudo
gather_facts: true
any_errors_fatal: true
vars_files:
- vars/main.yml
- vars/system.yml

pre_tasks:
- name: Include main variables
ansible.builtin.include_vars: "vars/main.yml"
tags: always

- name: Include system variables
ansible.builtin.include_vars: "vars/system.yml"
tags: always

- name: Include OS-specific variables
ansible.builtin.include_vars: "vars/{{ ansible_os_family }}.yml"
tags: always
Expand All @@ -165,9 +175,11 @@
become_method: sudo
gather_facts: true
any_errors_fatal: true
vars_files:
- vars/main.yml
pre_tasks:
- name: Include main variables
ansible.builtin.include_vars: "vars/main.yml"
tags: always

- name: Include OS-specific variables
ansible.builtin.include_vars: "vars/{{ ansible_os_family }}.yml"
tags: always
Expand All @@ -187,13 +199,18 @@
become_method: sudo
gather_facts: true
any_errors_fatal: true
vars_files:
- vars/main.yml
- vars/system.yml
vars:
existing_pgcluster: true

pre_tasks:
- name: Include main variables
ansible.builtin.include_vars: "vars/main.yml"
tags: always

- name: Include system variables
ansible.builtin.include_vars: "vars/system.yml"
tags: always

- name: Include OS-specific variables
ansible.builtin.include_vars: "vars/{{ ansible_os_family }}.yml"
tags: always
Expand Down
13 changes: 9 additions & 4 deletions balancers.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
---
- name: balancers.yml | Configure load balancers
- name: balancers.yml | Configure HAProxy load balancers
hosts: balancers
become: true
become_method: sudo
any_errors_fatal: true
gather_facts: true
vars_files:
- vars/main.yml
- vars/system.yml
vars:
vip_manager_disable: false # or 'true' for disable vip-manager service (if installed)

pre_tasks:
- name: Include main variables
ansible.builtin.include_vars: "vars/main.yml"
tags: always

- name: Include system variables
ansible.builtin.include_vars: "vars/system.yml"
tags: always

- name: Include OS-specific variables
ansible.builtin.include_vars: "vars/{{ ansible_os_family }}.yml"
tags: always
Expand Down
62 changes: 35 additions & 27 deletions config_pgcluster.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
---
- name: config_pgcluster.yml | Configuration PostgreSQL HA Cluster (based on "Patroni" and "{{ dcs_type }}")
hosts: localhost
gather_facts: true
any_errors_fatal: true
vars_files:
- vars/main.yml
roles:
- role: cloud-resources
when: provision | lower != 'none'
tags: always

- name: config_pgcluster.yml | Check the PostgreSQL cluster state and perform pre-checks
- name: config_pgcluster.yml | Configuration PostgreSQL HA Cluster (based on "Patroni")
hosts: postgres_cluster
become: true
become_method: sudo
gather_facts: true
vars_files:
- vars/main.yml
- vars/system.yml
pre_tasks:
- name: Include main variables
ansible.builtin.include_vars: "vars/main.yml"

- name: Include system variables
ansible.builtin.include_vars: "vars/system.yml"

- name: Include OS-specific variables
ansible.builtin.include_vars: "vars/{{ ansible_os_family }}.yml"

Expand Down Expand Up @@ -89,10 +81,15 @@
handlers:
- ansible.builtin.import_tasks: roles/patroni/handlers/main.yml
- ansible.builtin.import_tasks: roles/pgbouncer/handlers/main.yml
vars_files:
- vars/main.yml
- vars/system.yml
pre_tasks:
- name: Include main variables
ansible.builtin.include_vars: "vars/main.yml"
tags: always

- name: Include system variables
ansible.builtin.include_vars: "vars/system.yml"
tags: always

- name: Include OS-specific variables
ansible.builtin.include_vars: "vars/{{ ansible_os_family }}.yml"
tags: always
Expand Down Expand Up @@ -168,9 +165,11 @@
become_method: sudo
gather_facts: true
any_errors_fatal: true
vars_files:
- vars/main.yml
pre_tasks:
- name: Include main variables
ansible.builtin.include_vars: "vars/main.yml"
tags: always

- name: Include OS-specific variables
ansible.builtin.include_vars: "vars/{{ ansible_os_family }}.yml"
tags: always
Expand All @@ -185,9 +184,11 @@
become: true
become_method: sudo
any_errors_fatal: true
vars_files:
- vars/main.yml
pre_tasks:
- name: Include main variables
ansible.builtin.include_vars: "vars/main.yml"
tags: always

- name: Include OS-specific variables
ansible.builtin.include_vars: "vars/{{ ansible_os_family }}.yml"
tags: always
Expand Down Expand Up @@ -234,9 +235,11 @@
become_method: sudo
any_errors_fatal: true
environment: "{{ proxy_env | default({}) }}"
vars_files:
- vars/main.yml
pre_tasks:
- name: Include main variables
ansible.builtin.include_vars: "vars/main.yml"
tags: always

- name: Include OS-specific variables
ansible.builtin.include_vars: "vars/{{ ansible_os_family }}.yml"
tags: always
Expand Down Expand Up @@ -290,9 +293,14 @@
become_method: sudo
gather_facts: true
any_errors_fatal: true
vars_files:
- vars/main.yml
- vars/system.yml
pre_tasks:
- name: Include main variables
ansible.builtin.include_vars: "vars/main.yml"
tags: always

- name: Include system variables
ansible.builtin.include_vars: "vars/system.yml"
tags: always
roles:
# finish (info)
- role: deploy-finish
52 changes: 30 additions & 22 deletions consul.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,40 @@
---
- name: consul.yml | Consul Playbook
hosts: localhost
- name: consul.yml | Configure Consul instances
hosts: consul_instances
become: true
become_method: sudo
any_errors_fatal: true
gather_facts: false
vars_files:
- vars/main.yml
tasks:
gather_facts: true
environment: "{{ proxy_env | default({}) }}"

pre_tasks:
- name: Include main variables
ansible.builtin.include_vars: "vars/main.yml"
tags: always

- name: Include system variables
ansible.builtin.include_vars: "vars/system.yml"
tags: always

- name: Include OS-specific variables
ansible.builtin.include_vars: "vars/{{ ansible_os_family }}.yml"
tags: always

- name: Check if the consul role requirements (ansible.utils) are installed
ansible.builtin.command: ansible-galaxy collection list ansible.utils
changed_when: false
failed_when: false
register: ansible_utils_result
delegate_to: localhost
run_once: true # noqa run-once

- name: Consul role requirements
ansible.builtin.fail:
msg:
- "Please install consul role requirements (ansible.utils)"
- "ansible-galaxy install -r roles/consul/requirements.yml"
delegate_to: localhost
run_once: true # noqa run-once
when:
- ansible_utils_result.stderr is search("unable to find")

Expand All @@ -28,6 +46,8 @@
until: package_status is success
delay: 5
retries: 3
delegate_to: localhost
run_once: true # noqa run-once
when: ansible_distribution != "MacOSX"

- name: Make sure the python3-pip package are present on the control host
Expand All @@ -38,6 +58,8 @@
until: package_status is success
delay: 5
retries: 3
delegate_to: localhost
run_once: true # noqa run-once
when: ansible_distribution != "MacOSX"

- name: Install netaddr dependency on the control host
Expand All @@ -47,22 +69,8 @@
become: false
environment:
PIP_BREAK_SYSTEM_PACKAGES: "1"

- name: consul.yml | Configure Consul instances
hosts: consul_instances
become: true
become_method: sudo
any_errors_fatal: true
gather_facts: true
vars_files:
- vars/main.yml
- vars/system.yml
environment: "{{ proxy_env | default({}) }}"

pre_tasks:
- name: Include OS-specific variables
ansible.builtin.include_vars: "vars/{{ ansible_os_family }}.yml"
tags: always
delegate_to: localhost
run_once: true # noqa run-once

- name: Update apt cache
ansible.builtin.apt:
Expand Down
Loading

0 comments on commit 0a817bb

Please sign in to comment.