{# j2lint: disable=jinja-variable-format #} # {{ ansible_managed }} # {% if valkey_instance.name is defined %} # Valkey configuration for {{ valkey_instance.name }} {% else %} # Valkey configuration {% endif %} {# Config loop, turn the dictionary into a key, value list #} {% for valkey_var_pair in valkey_instance.config | ansible.builtin.dict2items %} {# Description from the argument specification #} {% if valkey_argument_spec_options[valkey_var_pair.key].description is defined %} {{ valkey_argument_spec_options[valkey_var_pair.key].description | wordwrap(78) | ansible.builtin.comment(prefix_count=0,postfix_count=0) }} {% else %} # The {{ valkey_var_pair.key }} variable appears to be missing from the meta/argument_specs.yml # if it was present the variable description would be printed here. {% endif %} {# If the value is a list repeat the key for each list item #} {% if valkey_var_pair.value | ansible.builtin.type_debug == "list" %} {% for valkey_var_pair_value in valkey_var_pair.value %} {# If the value is a boolean use yes or no as values #} {% if valkey_var_pair.value | ansible.builtin.type_debug == "bool" %} {% if valkey_var_pair.value | bool %} {# replace underscores with dashes in the key name #} {{ valkey_var_pair.key | ansible.builtin.regex_replace('_', '-') }} yes {% else %} {{ valkey_var_pair.key | ansible.builtin.regex_replace('_', '-') }} no {% endif %} {# If the value is not a interger and is an empty string print a pair of double quotes #} {% elif valkey_var_pair.value | ansible.builtin.type_debug != "int" and valkey_var_pair.value | length == 0 %} {{ valkey_var_pair.key | ansible.builtin.regex_replace('_', '-') }} "" {% else %} {{ valkey_var_pair.key | ansible.builtin.regex_replace('_', '-') }} {{ valkey_var_pair_value }} {% endif %} {% endfor %} {% else %} {# If the value is a boolean use yes or no as values #} {% if valkey_var_pair.value | ansible.builtin.type_debug == "bool" %} {% if valkey_var_pair.value | bool %} {{ valkey_var_pair.key | ansible.builtin.regex_replace('_', '-') }} yes {% else %} {{ valkey_var_pair.key | ansible.builtin.regex_replace('_', '-') }} no {% endif %} {# If the value in an empty string print a pair of double quotes #} {% elif valkey_var_pair.value | ansible.builtin.type_debug != "int" and valkey_var_pair.value | length == 0 %} {{ valkey_var_pair.key | ansible.builtin.regex_replace('_', '-') }} "" {% else %} {{ valkey_var_pair.key | ansible.builtin.regex_replace('_', '-') }} {{ valkey_var_pair.value }} {% endif %} {% endif %} {% endfor %} {# vim: syntax=jinja2 #}