From e4b34d3ad89223ba4f20c18bdf10d133af7a866f Mon Sep 17 00:00:00 2001 From: klention Date: Sat, 21 Dec 2024 19:03:34 +0100 Subject: [PATCH] Updated etcd molecule test to check on different protocols --- automation/inventory | 24 ++++++++++++------------ automation/molecule/tests/etcd/etcd.yml | 9 +++++++-- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/automation/inventory b/automation/inventory index 17bbf3980..cc74e5278 100644 --- a/automation/inventory +++ b/automation/inventory @@ -11,33 +11,33 @@ # if dcs_exists: false and dcs_type: "etcd" [etcd_cluster] # recommendation: 3, or 5-7 nodes -#10.128.64.140 -#10.128.64.142 -#10.128.64.143 +10.16.16.209 +10.16.16.210 +10.16.16.211 # if dcs_exists: false and dcs_type: "consul" [consul_instances] # recommendation: 3 or 5-7 nodes -#10.128.64.140 consul_node_role=server consul_bootstrap_expect=true consul_datacenter=dc1 -#10.128.64.142 consul_node_role=server consul_bootstrap_expect=true consul_datacenter=dc1 -#10.128.64.143 consul_node_role=server consul_bootstrap_expect=true consul_datacenter=dc1 +10.16.16.209 consul_node_role=server consul_bootstrap_expect=true consul_datacenter=dc1 +10.16.16.210 consul_node_role=server consul_bootstrap_expect=true consul_datacenter=dc1 +10.16.16.211 consul_node_role=server consul_bootstrap_expect=true consul_datacenter=dc1 #10.128.64.144 consul_node_role=client consul_datacenter=dc2 #10.128.64.145 consul_node_role=client consul_datacenter=dc2 # if with_haproxy_load_balancing: true [balancers] -#10.128.64.140 # balancer_tags="datacenter=dc1" -#10.128.64.142 # balancer_tags="datacenter=dc1" -#10.128.64.143 # balancer_tags="datacenter=dc1" +10.16.16.209 # balancer_tags="datacenter=dc1" +10.16.16.210 # balancer_tags="datacenter=dc1" +10.16.16.211 # balancer_tags="datacenter=dc1" #10.128.64.144 balancer_tags="datacenter=dc2" #10.128.64.145 balancer_tags="datacenter=dc2" new_node=true # PostgreSQL nodes [master] -#10.128.64.140 hostname=pgnode01 postgresql_exists=false # patroni_tags="datacenter=dc1" +10.16.16.209 hostname=pgnode01 postgresql_exists=false # patroni_tags="datacenter=dc1" [replica] -#10.128.64.142 hostname=pgnode02 postgresql_exists=false # patroni_tags="datacenter=dc1" -#10.128.64.143 hostname=pgnode03 postgresql_exists=false # patroni_tags="datacenter=dc1" +10.16.16.210 hostname=pgnode02 postgresql_exists=false # patroni_tags="datacenter=dc1" +10.16.16.211 hostname=pgnode03 postgresql_exists=false # patroni_tags="datacenter=dc1" #10.128.64.144 hostname=pgnode04 postgresql_exists=false patroni_tags="datacenter=dc2" #10.128.64.145 hostname=pgnode04 postgresql_exists=false patroni_tags="datacenter=dc2" new_node=true diff --git a/automation/molecule/tests/etcd/etcd.yml b/automation/molecule/tests/etcd/etcd.yml index c564cabc6..83cd3684c 100644 --- a/automation/molecule/tests/etcd/etcd.yml +++ b/automation/molecule/tests/etcd/etcd.yml @@ -1,8 +1,13 @@ --- -- name: Check etcd health +- name: Check etcd health with TLS ansible.builtin.uri: - url: "http://{{ inventory_hostname }}:2379/health" + url: "{% if tls_cert_generate | bool %}https{% else %}http{% endif %}://{{ inventory_hostname }}:2379/health" + method: GET return_content: true + validate_certs: "{% if tls_cert_generate | bool %}true{% else %}false{% endif %}" + ca_path: "{% if tls_cert_generate | bool %}/var/lib/pgsql/tls/ca.crt{% else %}''{% endif %}" + client_cert: "{% if tls_cert_generate | bool %}/var/lib/pgsql/tls/server.crt{% else %}''{% endif %}" + client_key: "{% if tls_cert_generate | bool %}/var/lib/pgsql/tls/server.key{% else %}''{% endif %}" register: etcd_health_status failed_when: "(etcd_health_status.content | from_json).health != 'true'" when: dcs_type == "etcd"