Merge "Use var galera_cluster_members to identify cluster"
This commit is contained in:
commit
a14b39cbbb
@ -16,7 +16,8 @@
|
||||
## APT Cache Options
|
||||
cache_timeout: 600
|
||||
|
||||
galera_server_bootstrap_node: "{{ groups['galera_all'][0] }}"
|
||||
galera_cluster_members: "{{ groups['galera_all'] }}"
|
||||
galera_server_bootstrap_node: "{{ galera_cluster_members[0] }}"
|
||||
galera_ignore_cluster_state: false
|
||||
galera_upgrade: false
|
||||
|
||||
@ -53,7 +54,7 @@ galera_innodb_log_buffer_size: 128M
|
||||
|
||||
## wsrep configuration
|
||||
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_cluster_address: "{% for host in galera_cluster_members %}{{ 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 | default(2) }}"
|
||||
galera_wsrep_retry_autocommit: 3
|
||||
|
@ -19,7 +19,7 @@
|
||||
state: restarted
|
||||
sleep: 2
|
||||
pattern: mysql
|
||||
args: "{{ (not galera_existing_cluster | bool and inventory_hostname == galera_server_bootstrap_node) or (groups['galera_all'] | length == 1) | ternary('--wsrep-new-cluster', '') }}"
|
||||
args: "{{ (not galera_existing_cluster | bool and inventory_hostname == galera_server_bootstrap_node) or (galera_cluster_members | length == 1) | ternary('--wsrep-new-cluster', '') }}"
|
||||
environment:
|
||||
MYSQLD_STARTUP_TIMEOUT: 180
|
||||
when: not galera_running_and_bootstrapped | bool
|
||||
@ -46,7 +46,7 @@
|
||||
state: restarted
|
||||
sleep: 2
|
||||
pattern: mysql
|
||||
args: "{{ (not galera_existing_cluster | bool and inventory_hostname == galera_server_bootstrap_node) or (groups['galera_all'] | length == 1) | ternary('--wsrep-new-cluster', '') }}"
|
||||
args: "{{ (not galera_existing_cluster | bool and inventory_hostname == galera_server_bootstrap_node) or (galera_cluster_members | length == 1) | ternary('--wsrep-new-cluster', '') }}"
|
||||
environment:
|
||||
MYSQLD_STARTUP_TIMEOUT: 180
|
||||
when: galera_restart | failed
|
||||
|
@ -31,4 +31,5 @@ galaxy_info:
|
||||
- openstack
|
||||
dependencies:
|
||||
- apt_package_pinning
|
||||
- galera_client
|
||||
- role: galera_client
|
||||
galera_client_drop_config_file: true
|
||||
|
@ -13,6 +13,10 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- fail:
|
||||
msg: "The host {{ inventory_hostname }} must be in galera_cluster_members."
|
||||
when: inventory_hostname not in galera_cluster_members
|
||||
|
||||
- name: Fail if the galera root password is not provided
|
||||
fail:
|
||||
msg: |
|
||||
|
@ -1,5 +1,5 @@
|
||||
{%- set all_calculated_max_connections = [] %}
|
||||
{%- for galera_node in groups['galera_all'] %}
|
||||
{%- for galera_node in galera_cluster_members %}
|
||||
{%- if all_calculated_max_connections.append(hostvars[galera_node]['ansible_processor_vcpus'] | default(2) * 100) %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
|
@ -1,7 +1,7 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
{%- set all_calculated_max_connections = [] %}
|
||||
{%- for galera_node in groups['galera_all'] %}
|
||||
{%- for galera_node in galera_cluster_members %}
|
||||
{%- 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 %}
|
||||
|
@ -14,7 +14,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
- name: Playbook for testing
|
||||
hosts: galera_all
|
||||
hosts: galera_test_hosts
|
||||
user: root
|
||||
gather_facts: true
|
||||
vars:
|
||||
|
@ -88,7 +88,7 @@
|
||||
# done for functional testing.
|
||||
- name: Create container hosts
|
||||
add_host:
|
||||
groups: "all,all_containers,galera_all"
|
||||
groups: "all,all_containers,galera_test_hosts"
|
||||
hostname: "{{ item.name }}"
|
||||
inventory_hostname: "{{ item.name }}"
|
||||
ansible_ssh_host: "{{ item.address }}"
|
||||
|
@ -21,11 +21,12 @@
|
||||
|
||||
# Deploy the environment
|
||||
- name: Playbook for role testing
|
||||
hosts: galera_all
|
||||
hosts: galera_test_hosts
|
||||
serial: 1
|
||||
user: root
|
||||
gather_facts: true
|
||||
vars:
|
||||
galera_cluster_members: "{{ groups['galera_test_hosts'] }}"
|
||||
galera_root_password: secrete
|
||||
galera_root_user: root
|
||||
galera_innodb_buffer_pool_size: 512M
|
||||
@ -48,11 +49,12 @@
|
||||
|
||||
# Deploy the environment running a 5.5 to 10.0 upgrade
|
||||
- name: Playbook for role upgrade testing
|
||||
hosts: galera_all
|
||||
hosts: galera_test_hosts
|
||||
serial: 1
|
||||
user: root
|
||||
gather_facts: true
|
||||
vars:
|
||||
galera_cluster_members: "{{ groups['galera_test_hosts'] }}"
|
||||
galera_root_password: secrete
|
||||
galera_root_user: root
|
||||
galera_innodb_buffer_pool_size: 512M
|
||||
@ -75,11 +77,12 @@
|
||||
|
||||
# Deploy the environment running a 5.5 to 10.0 upgrade
|
||||
- name: Playbook for role upgrade testing
|
||||
hosts: galera_all
|
||||
hosts: galera_test_hosts
|
||||
serial: 1
|
||||
user: root
|
||||
gather_facts: true
|
||||
vars:
|
||||
galera_cluster_members: "{{ groups['galera_test_hosts'] }}"
|
||||
galera_root_password: secrete
|
||||
galera_root_user: root
|
||||
galera_innodb_buffer_pool_size: 512M
|
||||
|
Loading…
x
Reference in New Issue
Block a user