Skip to content

Commit

Permalink
Include credential parameters in YAML file
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasz-antoniak committed Jul 4, 2024
1 parent bc6e085 commit c2d9c84
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 38 deletions.
48 changes: 24 additions & 24 deletions ansible/templates/zdm_proxy_immutable_config_file.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,69 +4,69 @@
{% for host in groups['proxies'] %}
{{ zdm_proxy_address_list.append(host) }}
{% endfor %}
proxy_topology_index:{{ groups['proxies'].index(hostvars[inventory_hostname]['ansible_default_ipv4']['address']) }}
proxy_topology_addresses:{{ zdm_proxy_address_list|join(',') }}
proxy_topology_index: {{ groups['proxies'].index(hostvars[inventory_hostname]['ansible_default_ipv4']['address']) }}
proxy_topology_addresses: {{ zdm_proxy_address_list|join(',') }}

{% if ( origin_contact_points is defined ) %}
origin_contact_points:{{ origin_contact_points }}
origin_contact_points: {{ origin_contact_points }}
{% if ( origin_port is defined ) %}
origin_port:{{ origin_port }}
origin_port: {{ origin_port }}
{% endif %}
{% elif ( ( origin_scb_downloaded is defined and origin_scb_downloaded == 'success' ) or ( origin_scb_provided is defined and origin_scb_provided == 'success' ) )%}
origin_secure_connect_bundle_path:{{ zdm_proxy_home_dir }}/{{ zdm_proxy_shared_assets_dir_name }}/origin_scb.zip
origin_secure_connect_bundle_path: {{ zdm_proxy_home_dir }}/{{ zdm_proxy_shared_assets_dir_name }}/origin_scb.zip
{% endif %}
{% if ( origin_local_datacenter is defined ) %}
origin_local_datacenter:{{ origin_local_datacenter }}
origin_local_datacenter: {{ origin_local_datacenter }}
{% endif %}

{% if ( target_contact_points is defined ) %}
target_contact_points:{{ target_contact_points }}
target_contact_points: {{ target_contact_points }}
{% if ( target_port is defined ) %}
target_port:{{ target_port }}
target_port: {{ target_port }}
{% endif %}
{% elif ( target_scb_downloaded is defined and target_scb_downloaded == 'success' ) or ( target_scb_provided is defined and target_scb_provided == 'success' ) %}
target_secure_connect_bundle_path:{{ zdm_proxy_home_dir }}/{{ zdm_proxy_shared_assets_dir_name }}/target_scb.zip
target_secure_connect_bundle_path: {{ zdm_proxy_home_dir }}/{{ zdm_proxy_shared_assets_dir_name }}/target_scb.zip
{% endif %}
{% if ( target_local_datacenter is defined ) %}
target_local_datacenter:{{ target_local_datacenter }}
target_local_datacenter: {{ target_local_datacenter }}
{% endif %}

proxy_listen_address:{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}
proxy_listen_port:{{ zdm_proxy_listen_port }}
proxy_listen_address: {{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}
proxy_listen_port: {{ zdm_proxy_listen_port }}

metrics_address:{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}
metrics_port:{{ metrics_port }}
metrics_address: {{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}
metrics_port: {{ metrics_port }}

{% if ( origin_tls_user_dir_path is defined and origin_tls_server_ca_filename is defined ) %}
origin_tls_server_ca_path:{{ zdm_proxy_home_dir }}/{{ zdm_proxy_shared_assets_dir_name }}/{{ origin_tls_dest_dir_name }}/{{ origin_tls_server_ca_filename }}
origin_tls_server_ca_path: {{ zdm_proxy_home_dir }}/{{ zdm_proxy_shared_assets_dir_name }}/{{ origin_tls_dest_dir_name }}/{{ origin_tls_server_ca_filename }}
{% endif %}
{% if ( origin_tls_user_dir_path is defined and origin_tls_client_cert_filename is defined ) %}
origin_tls_client_cert_path:{{ zdm_proxy_home_dir }}/{{ zdm_proxy_shared_assets_dir_name }}/{{ origin_tls_dest_dir_name }}/{{ origin_tls_client_cert_filename }}
origin_tls_client_cert_path: {{ zdm_proxy_home_dir }}/{{ zdm_proxy_shared_assets_dir_name }}/{{ origin_tls_dest_dir_name }}/{{ origin_tls_client_cert_filename }}
{% endif %}
{% if ( origin_tls_user_dir_path is defined and origin_tls_client_key_filename is defined ) %}
origin_tls_client_key_path:{{ zdm_proxy_home_dir }}/{{ zdm_proxy_shared_assets_dir_name }}/{{ origin_tls_dest_dir_name }}/{{ origin_tls_client_key_filename }}
origin_tls_client_key_path: {{ zdm_proxy_home_dir }}/{{ zdm_proxy_shared_assets_dir_name }}/{{ origin_tls_dest_dir_name }}/{{ origin_tls_client_key_filename }}
{% endif %}

{% if ( target_tls_user_dir_path is defined and target_tls_server_ca_filename is defined ) %}
target_tls_server_ca_path:{{ zdm_proxy_home_dir }}/{{ zdm_proxy_shared_assets_dir_name }}/{{ target_tls_dest_dir_name }}/{{ target_tls_server_ca_filename }}
target_tls_server_ca_path: {{ zdm_proxy_home_dir }}/{{ zdm_proxy_shared_assets_dir_name }}/{{ target_tls_dest_dir_name }}/{{ target_tls_server_ca_filename }}
{% endif %}
{% if ( target_tls_user_dir_path is defined and target_tls_client_cert_filename is defined ) %}
target_tls_client_cert_path:{{ zdm_proxy_home_dir }}/{{ zdm_proxy_shared_assets_dir_name }}/{{ target_tls_dest_dir_name }}/{{ target_tls_client_cert_filename }}
target_tls_client_cert_path: {{ zdm_proxy_home_dir }}/{{ zdm_proxy_shared_assets_dir_name }}/{{ target_tls_dest_dir_name }}/{{ target_tls_client_cert_filename }}
{% endif %}
{% if ( target_tls_user_dir_path is defined and target_tls_client_key_filename is defined ) %}
target_tls_client_key_path:{{ zdm_proxy_home_dir }}/{{ zdm_proxy_shared_assets_dir_name }}/{{ target_tls_dest_dir_name }}/{{ target_tls_client_key_filename }}
target_tls_client_key_path: {{ zdm_proxy_home_dir }}/{{ zdm_proxy_shared_assets_dir_name }}/{{ target_tls_dest_dir_name }}/{{ target_tls_client_key_filename }}
{% endif %}

{% if ( zdm_proxy_tls_user_dir_path is defined and zdm_proxy_tls_ca_filename is defined ) %}
proxy_tls_ca_path:{{ zdm_proxy_home_dir }}/{{ zdm_proxy_shared_assets_dir_name }}/{{ zdm_proxy_tls_dest_dir_name }}/{{ zdm_proxy_tls_ca_filename }}
proxy_tls_ca_path: {{ zdm_proxy_home_dir }}/{{ zdm_proxy_shared_assets_dir_name }}/{{ zdm_proxy_tls_dest_dir_name }}/{{ zdm_proxy_tls_ca_filename }}
{% endif %}
{% if ( zdm_proxy_tls_user_dir_path is defined and zdm_proxy_tls_cert_filename is defined ) %}
proxy_tls_cert_path:{{ zdm_proxy_home_dir }}/{{ zdm_proxy_shared_assets_dir_name }}/{{ zdm_proxy_tls_dest_dir_name }}/{{ zdm_proxy_tls_cert_filename }}
proxy_tls_cert_path: {{ zdm_proxy_home_dir }}/{{ zdm_proxy_shared_assets_dir_name }}/{{ zdm_proxy_tls_dest_dir_name }}/{{ zdm_proxy_tls_cert_filename }}
{% endif %}
{% if ( zdm_proxy_tls_user_dir_path is defined and zdm_proxy_tls_key_filename is defined ) %}
proxy_tls_key_path:{{ zdm_proxy_home_dir }}/{{ zdm_proxy_shared_assets_dir_name }}/{{ zdm_proxy_tls_dest_dir_name }}/{{ zdm_proxy_tls_key_filename }}
proxy_tls_key_path: {{ zdm_proxy_home_dir }}/{{ zdm_proxy_shared_assets_dir_name }}/{{ zdm_proxy_tls_dest_dir_name }}/{{ zdm_proxy_tls_key_filename }}
{% endif %}
{% if ( zdm_proxy_tls_require_client_auth is defined ) %}
proxy_tls_require_client_auth:{{ zdm_proxy_tls_require_client_auth }}
proxy_tls_require_client_auth: {{ zdm_proxy_tls_require_client_auth }}
{% endif %}

33 changes: 19 additions & 14 deletions ansible/templates/zdm_proxy_mutable_config_file.j2
Original file line number Diff line number Diff line change
@@ -1,53 +1,58 @@
#jinja2: lstrip_blocks: "True", trim_blocks: "True"

{% if ( primary_cluster is defined ) %}
primary_cluster:{{ primary_cluster }}
primary_cluster: {{ primary_cluster }}
{% endif %}

{% if ( read_mode is defined ) %}
read_mode:{{ read_mode }}
read_mode: {{ read_mode }}
{% endif %}

{% if ( log_level is defined ) %}
log_level:{{ log_level }}
log_level: {{ log_level }}
{% endif %}

origin_username: {{ origin_username | default('') }}
origin_password: {{ origin_password | default('') }}
target_username: {{ target_username | default('') }}
target_password: {{ target_password | default('') }}

{% if ( zdm_proxy_max_clients_connections is defined ) %}
proxy_max_client_connections:{{ zdm_proxy_max_clients_connections }}
proxy_max_client_connections: {{ zdm_proxy_max_clients_connections }}
{% endif %}

{% if ( zdm_proxy_request_timeout_ms is defined ) %}
proxy_request_timeout_ms:{{ zdm_proxy_request_timeout_ms }}
proxy_request_timeout_ms: {{ zdm_proxy_request_timeout_ms }}
{% endif %}
{% if ( origin_connection_timeout_ms is defined ) %}
origin_connection_timeout_ms:{{ origin_connection_timeout_ms }}
origin_connection_timeout_ms: {{ origin_connection_timeout_ms }}
{% endif %}
{% if ( target_connection_timeout_ms is defined ) %}
target_connection_timeout_ms:{{ target_connection_timeout_ms }}
target_connection_timeout_ms: {{ target_connection_timeout_ms }}
{% endif %}
{% if ( async_handshake_timeout_ms is defined ) %}
async_handshake_timeout_ms:{{ async_handshake_timeout_ms }}
async_handshake_timeout_ms: {{ async_handshake_timeout_ms }}
{% endif %}
{% if ( heartbeat_interval_ms is defined ) %}
heartbeat_interval_ms:{{ heartbeat_interval_ms }}
heartbeat_interval_ms: {{ heartbeat_interval_ms }}
{% endif %}
{% if ( zdm_proxy_max_stream_ids is defined ) %}
proxy_max_stream_ids:{{ zdm_proxy_max_stream_ids }}
proxy_max_stream_ids: {{ zdm_proxy_max_stream_ids }}
{% endif %}

{% if ( metrics_enabled is defined ) %}
metrics_enabled:{{ metrics_enabled }}
metrics_enabled: {{ metrics_enabled }}
{% endif %}

{% if ( system_queries_mode is defined ) %}
system_queries_mode:{{ system_queries_mode }}
system_queries_mode: {{ system_queries_mode }}
{% endif %}

{% if ( replace_cql_functions is defined ) %}
replace_cql_functions:{{ replace_cql_functions }}
replace_cql_functions: {{ replace_cql_functions }}
{% endif %}

{% if ( forward_client_credentials_to_origin is defined ) %}
forward_client_credentials_to_origin:{{ forward_client_credentials_to_origin }}
forward_client_credentials_to_origin: {{ forward_client_credentials_to_origin }}
{% endif %}

0 comments on commit c2d9c84

Please sign in to comment.