diff --git a/templates/my.cnf.j2 b/templates/my.cnf.j2 index 08b04846..ed089ed0 100644 --- a/templates/my.cnf.j2 +++ b/templates/my.cnf.j2 @@ -1,6 +1,7 @@ {%- set all_calculated_max_connections = [] %} {%- for galera_node in galera_cluster_members %} - {%- if all_calculated_max_connections.append((hostvars[galera_node]['ansible_processor_vcpus'] | int > 0) | ternary (ansible_processor_vcpus, 2) * 100) %} + {%- set vcpus = hostvars[galera_node]['ansible_processor_vcpus'] %} + {%- if all_calculated_max_connections.append((vcpus | int > 0) | ternary (vcpus, 2) * 100) %} {%- endif %} {%- endfor %} {%- set calculated_max_connections = all_calculated_max_connections|sort %} diff --git a/templates/mysql_defaults.j2 b/templates/mysql_defaults.j2 index c0ac18d5..3483d540 100644 --- a/templates/mysql_defaults.j2 +++ b/templates/mysql_defaults.j2 @@ -2,7 +2,8 @@ {%- set all_calculated_max_connections = [] %} {%- for galera_node in galera_cluster_members %} - {%- set _ = all_calculated_max_connections.append((hostvars[galera_node]['ansible_processor_vcpus'] | int > 0) | ternary (ansible_processor_vcpus, 2) * 100) %} + {%- set vcpus = hostvars[galera_node]['ansible_processor_vcpus'] %} + {%- set _ = all_calculated_max_connections.append((vcpus | int > 0) | ternary (vcpus, 2) * 100) %} {%- endfor %} {%- set calculated_min_connections = all_calculated_max_connections | min %} {%- set calculated_max_connections = galera_max_connections | default(calculated_min_connections) %} diff --git a/templates/systemd.limits.conf.j2 b/templates/systemd.limits.conf.j2 index b01a1663..310c8582 100644 --- a/templates/systemd.limits.conf.j2 +++ b/templates/systemd.limits.conf.j2 @@ -2,7 +2,8 @@ {%- set all_calculated_max_connections = [] %} {%- for galera_node in galera_cluster_members %} - {%- set _ = all_calculated_max_connections.append((hostvars[galera_node]['ansible_processor_vcpus'] | int > 0) | ternary (ansible_processor_vcpus, 2) * 100) %} + {%- set vcpus = hostvars[galera_node]['ansible_processor_vcpus'] %} + {%- set _ = all_calculated_max_connections.append((vcpus | int > 0) | ternary (vcpus, 2) * 100) %} {%- endfor %} {%- set calculated_min_connections = all_calculated_max_connections | min %} {%- set calculated_max_connections = galera_max_connections | default(calculated_min_connections) %}