Ensure that ansible_processor_vcpus always has a default value

In some cases Ansible does not detect the number of CPU's on the
target host. This patch ensures that in such cases there is always
a usable value.

Change-Id: I504d2ae34ce587a3ea6639e182d29303667139e3
This commit is contained in:
Jesse Pretorius 2016-01-13 12:57:13 +00:00
parent f6fb63f347
commit f7f3b5007a
3 changed files with 3 additions and 3 deletions

View File

@ -51,7 +51,7 @@ galera_innodb_log_buffer_size: 128M
galera_wsrep_address: "{{ ansible_ssh_host }}"
galera_wsrep_cluster_address: "{% for host in groups['galera_all'] %}{{ hostvars[host]['ansible_ssh_host'] }}{% if not loop.last %},{% endif %}{% endfor %}"
galera_wsrep_node_incoming_address: "{{ galera_wsrep_address }}"
galera_wsrep_slave_threads: "{{ ansible_processor_vcpus }}"
galera_wsrep_slave_threads: "{{ ansible_processor_vcpus | default(2) }}"
galera_wsrep_retry_autocommit: 3
galera_wsrep_debug: 0
galera_wsrep_sst_method: xtrabackup-v2

View File

@ -1,6 +1,6 @@
{%- set all_calculated_max_connections = [] %}
{%- for galera_node in groups['galera_all'] %}
{%- if all_calculated_max_connections.append(hostvars[galera_node]['ansible_processor_vcpus'] * 100) %}
{%- if all_calculated_max_connections.append(hostvars[galera_node]['ansible_processor_vcpus'] | default(2) * 100) %}
{%- endif %}
{%- endfor %}
{%- set calculated_max_connections = all_calculated_max_connections|sort %}

View File

@ -2,7 +2,7 @@
{%- set all_calculated_max_connections = [] %}
{%- for galera_node in groups['galera_all'] %}
{%- set _ = all_calculated_max_connections.append(hostvars[galera_node]['ansible_processor_vcpus'] * 100) %}
{%- set _ = all_calculated_max_connections.append(hostvars[galera_node]['ansible_processor_vcpus'] | default(2) * 100) %}
{%- endfor %}
{%- set calculated_min_connections = all_calculated_max_connections | min %}
{%- set calculated_max_connections = galera_max_connections | default(calculated_min_connections) %}