diff --git a/roles/setup_haproxy/README.md b/roles/setup_haproxy/README.md index 457be91b..b67cca75 100644 --- a/roles/setup_haproxy/README.md +++ b/roles/setup_haproxy/README.md @@ -110,4 +110,63 @@ all: proxy_location: 'zone_1' etcd: true etcd_cluster_name: 'patroni-etcd' -``` \ No newline at end of file +``` + +### How to include the `setup_haproxy` role in your Playbook + +Below is an example of how to include the `setup_haproxy` role: + +```yaml +--- +- hosts: all + name: Deploy haproxy + become: yes + gather_facts: yes + any_errors_fatal: true + + collections: + - edb_devops.edb_postgres + + pre_tasks: + - name: Initialize the user defined variables + set_fact: + pg_version: 15 + pg_type: "PG" + + roles: + - role: setup_repo + when: "'setup_repo' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)" + - role: install_dbserver + when: "'install_dbserver' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)" + - role: setup_etcd + when: "'setup_etcd' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)" + - role: setup_patroni + when: "'setup_patroni' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)" + - role: setup_pgbouncer + when: "'setup_pgbouncer' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)" + - role: setup_haproxy + when: "'setup_haproxy' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)" + - role: manage_pgbouncer + when: "'manage_pgbouncer' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)" + - role: manage_dbserver + when: "'manage_dbserver' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)" +``` + +Defining and adding variables is done in the `set_fact` of the `pre_tasks`. + +All the variables are available at: + +* [/roles/setup_haproxy/defaults/main.yml](./defaults/main.yml) + +## License + +BSD + +## Author information + +Author: + + * Hannah Stoik + * Vibhor Kumar (Reviewer) + * EDB Postgres + * edb-devops@enterprisedb.com www.enterprisedb.com \ No newline at end of file diff --git a/roles/setup_haproxy/tasks/haproxy_configure.yml b/roles/setup_haproxy/tasks/haproxy_configure.yml index 257b419d..ea23d5a2 100644 --- a/roles/setup_haproxy/tasks/haproxy_configure.yml +++ b/roles/setup_haproxy/tasks/haproxy_configure.yml @@ -9,7 +9,7 @@ haproxy_server_lines: >- {{ haproxy_server_lines | default([]) + [ "server " + node.inventory_hostname + " " + node.private_ip | string + ":" + pg_port | string + " " + - "maxconn 100 check port " + patroni_rest_api_port | string + "maxconn " + haproxy_global_maxconn | string + " check port " + patroni_rest_api_port | string ] }} loop: "{{ haproxy_backend_nodes }}"