Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for Ansible 2.15 and newer #23

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tasks/cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@
--cluster-yes
{% if redis_configurations[0]['redis_tls_cluster'] is defined
and redis_configurations[0]['redis_tls_cluster'] == 'yes' %}
--tls --cert {{ redis_configurations [0]['redis_tls_cert_file'] }}
--key {{ redis_configurations [0]['redis_tls_key_file'] }}
--cacert {{ redis_configurations [0]['redis_tls_ca_cert_file'] }}
--tls --cert {{ redis_configurations[0]['redis_tls_cert_file'] }}
--key {{ redis_configurations[0]['redis_tls_key_file'] }}
--cacert {{ redis_configurations[0]['redis_tls_ca_cert_file'] }}
{% endif %}
tags: redis_cluster

- name: print redis command

Check warning on line 30 in tasks/cluster.yml

View workflow job for this annotation

GitHub Actions / lint_full

name[casing]

All names should start with an uppercase letter.
debug:
var: redis_cluster_command
tags: redis_cluster

- name: Get redis cluster info

Check warning on line 35 in tasks/cluster.yml

View workflow job for this annotation

GitHub Actions / lint_full

jinja[spacing]

Jinja2 spacing could be improved: redis-cli -h {{ ansible_default_ipv4.address|default(ansible_all_ipv4_addresses[0]) }} -p {% if redis_configurations[0]['redis_tls_cluster'] is defined and redis_configurations[0]['redis_tls_cluster'] == 'yes' %} {{ redis_configurations[0]['redis_tls_port'] }} {% else %} {{ redis_configurations[0]['redis_port'] }} {% endif %} {% if redis_configurations[0]['redis_tls_cluster'] is defined and redis_configurations[0]['redis_tls_cluster'] == 'yes' %} --tls --cert {{ redis_configurations[0]['redis_tls_cert_file'] }} --key {{ redis_configurations[0]['redis_tls_key_file'] }} --cacert {{ redis_configurations[0]['redis_tls_ca_cert_file'] }} {% endif %} -a {{ redis_requirepass }} CLUSTER INFO -> redis-cli -h {{ ansible_default_ipv4.address | default(ansible_all_ipv4_addresses[0]) }} -p {% if redis_configurations[0]['redis_tls_cluster'] is defined and redis_configurations[0]['redis_tls_cluster'] == 'yes' %} {{ redis_configurations[0]['redis_tls_port'] }} {% else %} {{ redis_configurations[0]['redis_port'] }} {% endif %} {% if redis_configurations[0]['redis_tls_cluster'] is defined and redis_configurations[0]['redis_tls_cluster'] == 'yes' %} --tls --cert {{ redis_configurations[0]['redis_tls_cert_file'] }} --key {{ redis_configurations[0]['redis_tls_key_file'] }} --cacert {{ redis_configurations[0]['redis_tls_ca_cert_file'] }} {% endif %} -a {{ redis_requirepass }} CLUSTER INFO
command: "redis-cli -h {{ ansible_default_ipv4.address|default(ansible_all_ipv4_addresses[0]) }} -p {% if redis_configurations [0]['redis_tls_cluster'] is defined and redis_configurations[0]['redis_tls_cluster'] == 'yes' %} {{ redis_configurations [0]['redis_tls_port'] }} {% else %} {{ redis_configurations [0]['redis_port'] }} {% endif %} {% if redis_configurations[0]['redis_tls_cluster'] is defined and redis_configurations[0]['redis_tls_cluster'] == 'yes' %} --tls --cert {{ redis_configurations [0]['redis_tls_cert_file'] }} --key {{ redis_configurations [0]['redis_tls_key_file'] }} --cacert {{ redis_configurations [0]['redis_tls_ca_cert_file'] }} {% endif %} -a {{ redis_requirepass }} CLUSTER INFO"
command: "redis-cli -h {{ ansible_default_ipv4.address|default(ansible_all_ipv4_addresses[0]) }} -p {% if redis_configurations[0]['redis_tls_cluster'] is defined and redis_configurations[0]['redis_tls_cluster'] == 'yes' %} {{ redis_configurations[0]['redis_tls_port'] }} {% else %} {{ redis_configurations[0]['redis_port'] }} {% endif %} {% if redis_configurations[0]['redis_tls_cluster'] is defined and redis_configurations[0]['redis_tls_cluster'] == 'yes' %} --tls --cert {{ redis_configurations[0]['redis_tls_cert_file'] }} --key {{ redis_configurations[0]['redis_tls_key_file'] }} --cacert {{ redis_configurations[0]['redis_tls_ca_cert_file'] }} {% endif %} -a {{ redis_requirepass }} CLUSTER INFO"
register: cluster_info
changed_when: false
failed_when: false
Expand Down
16 changes: 9 additions & 7 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@
redis_ports: >-
{%- set redis_ports = [] -%}
{%- for i in redis_configurations -%}
{%- if i['redis_tls_port'] is defined -%}
{%- set redis_port = i['redis_tls_port'] -%}
{%- else -%}
{%- set redis_port = i['redis_port'] -%}
{%- if i['redis_port'] is defined -%}
{%- set port = i['redis_port'] -%}
{{ redis_ports.append(port) }}
{%- endif -%}
{{ redis_ports.append(redis_port) }}
{%- if redis_installation_scenario == 'cluster' -%}
{{ redis_ports.append(redis_port |int + 10000) }}
{%- if i['redis_tls_port'] is defined -%}
{%- set port = i['redis_tls_port'] -%}
{{ redis_ports.append(port) }}
{%- if redis_installation_scenario == 'cluster' -%}
{{ redis_ports.append(port|int + 10000) }}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{{ redis_ports | join(',') }}
Expand Down
Loading