Skip to content

Commit

Permalink
Merge pull request #23 from tbumke/main
Browse files Browse the repository at this point in the history
Fixes for Ansible 2.15 and newer
  • Loading branch information
widhalmt authored Feb 13, 2024
2 parents c894061 + 62412f5 commit bf7b0ec
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
8 changes: 4 additions & 4 deletions tasks/cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
--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

Expand All @@ -33,7 +33,7 @@
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

0 comments on commit bf7b0ec

Please sign in to comment.