From 5204358a201d922121ce2867f571a1ca3814326e Mon Sep 17 00:00:00 2001 From: Bertrand Lanson Date: Fri, 22 Mar 2024 01:00:04 +0100 Subject: [PATCH] feat(proxy): add consul agents to proxies and register haproxy service to consul is consul is enabled --- docs/architecture_guide.md.md | 2 +- docs/consul_clusters.md | 3 +++ playbooks/group_vars/all/vault.yml | 1 + playbooks/tasks/haproxy/haproxy_deploy.yml | 11 +++++++++++ 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 docs/consul_clusters.md diff --git a/docs/architecture_guide.md.md b/docs/architecture_guide.md.md index 915c9b2..f8e9b29 100644 --- a/docs/architecture_guide.md.md +++ b/docs/architecture_guide.md.md @@ -94,4 +94,4 @@ graph TD nomad -->|Service registration| consul ``` -> **Note**: you can substract the haproxy part if using an external load-balancing solution, like AWS ALB,or any other LB technology, for connecting to your platform. \ No newline at end of file +> **Note**: you can substract the haproxy part if using an external load-balancing solution, like AWS ALB,or any other LB technology, for connecting to your platform. diff --git a/docs/consul_clusters.md b/docs/consul_clusters.md new file mode 100644 index 0000000..462dd91 --- /dev/null +++ b/docs/consul_clusters.md @@ -0,0 +1,3 @@ +# Deploying a Consul cluster + +This documentation explains each steps necessary to successfully deploy a Consul cluster using the ednz_cloud.hashistack ansible collection. diff --git a/playbooks/group_vars/all/vault.yml b/playbooks/group_vars/all/vault.yml index 27271c3..a9f1519 100644 --- a/playbooks/group_vars/all/vault.yml +++ b/playbooks/group_vars/all/vault.yml @@ -55,6 +55,7 @@ vault_service_registration_configuration: consul: address: "127.0.0.1:8500" scheme: "http" + token: "" ######### # plugins diff --git a/playbooks/tasks/haproxy/haproxy_deploy.yml b/playbooks/tasks/haproxy/haproxy_deploy.yml index 9ed5660..1bdbe2e 100644 --- a/playbooks/tasks/haproxy/haproxy_deploy.yml +++ b/playbooks/tasks/haproxy/haproxy_deploy.yml @@ -7,3 +7,14 @@ - name: "Include ednz_cloud.deploy_keepalived" ansible.builtin.include_role: name: ednz_cloud.deploy_keepalived + + - name: "Register haproxy services in consul" + when: enable_consul | bool + block: + - name: "Register haproxy services in consul" + community.general.consul: + token: "{{ _consul_cluster_config.root_token.secret_id }}" + service_name: haproxy + service_port: 80 + interval: 20s + http: http://localhost:9000/health