Merge "Implement installation method selection for MariaDB role"
This commit is contained in:
commit
90294f065a
@ -89,6 +89,9 @@ galera_additional_users: []
|
||||
# priv: "*.*:USAGE"
|
||||
# state: present
|
||||
|
||||
# Choose 'distro' or 'external_repo'
|
||||
galera_install_method: external_repo
|
||||
|
||||
# Enable or disable the installation of galera development packages
|
||||
galera_install_devel: false
|
||||
|
||||
|
@ -44,3 +44,5 @@ dependencies:
|
||||
apt_package_pinning_file_name: "galera_pin.pref"
|
||||
when:
|
||||
- ansible_facts['pkg_mgr'] == 'apt'
|
||||
- galera_install_method == 'external_repo'
|
||||
- galera_repo | default(True)
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Added variable ``galera_install_method`` to control whether external
|
||||
repositories should be configured or role should attempt to install
|
||||
from distro default ones instead.
|
@ -17,47 +17,53 @@
|
||||
package:
|
||||
name: "{{ galera_mariadb_distro_packages_remove | default([]) }}"
|
||||
state: absent
|
||||
when: galera_install_method == 'external_repo'
|
||||
|
||||
- name: If a keyfile is provided, copy the gpg keyfile to the key location
|
||||
copy:
|
||||
src: "gpg/{{ item.id }}"
|
||||
dest: "{{ item.file }}"
|
||||
mode: '0644'
|
||||
with_items: "{{ galera_gpg_keys | selectattr('file', 'defined') | list }}"
|
||||
- name: Configure repositories for MariaDB installation
|
||||
when:
|
||||
- galera_install_method == 'external_repo'
|
||||
- galera_repo
|
||||
block:
|
||||
- name: If a keyfile is provided, copy the gpg keyfile to the key location
|
||||
copy:
|
||||
src: "gpg/{{ item.id }}"
|
||||
dest: "{{ item.file }}"
|
||||
mode: '0644'
|
||||
with_items: "{{ galera_gpg_keys | selectattr('file', 'defined') | list }}"
|
||||
|
||||
- name: Install gpg keys
|
||||
apt_key:
|
||||
data: "{{ key['data'] | default(omit) }}"
|
||||
file: "{{ key['file'] | default(omit) }}"
|
||||
id: "{{ key['id'] | default(omit) }}"
|
||||
state: "{{ key['state'] | default(omit) }}"
|
||||
url: "{{ key['url'] | default(omit) }}"
|
||||
validate_certs: "{{ key['validate_certs'] | default(omit) }}"
|
||||
with_items: "{{ galera_gpg_keys }}"
|
||||
loop_control:
|
||||
loop_var: key
|
||||
register: _add_apt_keys
|
||||
until: _add_apt_keys is success
|
||||
retries: 5
|
||||
delay: 2
|
||||
- name: Install gpg keys
|
||||
apt_key:
|
||||
data: "{{ key['data'] | default(omit) }}"
|
||||
file: "{{ key['file'] | default(omit) }}"
|
||||
id: "{{ key['id'] | default(omit) }}"
|
||||
state: "{{ key['state'] | default(omit) }}"
|
||||
url: "{{ key['url'] | default(omit) }}"
|
||||
validate_certs: "{{ key['validate_certs'] | default(omit) }}"
|
||||
with_items: "{{ galera_gpg_keys }}"
|
||||
loop_control:
|
||||
loop_var: key
|
||||
register: _add_apt_keys
|
||||
until: _add_apt_keys is success
|
||||
retries: 5
|
||||
delay: 2
|
||||
|
||||
- name: Remove old repos
|
||||
lineinfile:
|
||||
dest: "/etc/apt/sources.list.d/{{ item.name }}.list"
|
||||
regexp: "^((?!{{ item.repo }}).*)$"
|
||||
state: absent
|
||||
with_items:
|
||||
- { name: "MariaDB", repo: "{{ galera_repo.repo }}" }
|
||||
when: galera_repo.repo is defined
|
||||
- name: Remove old repos
|
||||
lineinfile:
|
||||
dest: "/etc/apt/sources.list.d/{{ item.name }}.list"
|
||||
regexp: "^((?!{{ item.repo }}).*)$"
|
||||
state: absent
|
||||
with_items:
|
||||
- { name: "MariaDB", repo: "{{ galera_repo.repo }}" }
|
||||
when: galera_repo.repo is defined
|
||||
|
||||
- name: Add galera repo
|
||||
apt_repository:
|
||||
repo: "{{ galera_repo.repo }}"
|
||||
filename: "{{ galera_repo.filename | default(omit) }}"
|
||||
state: "{{ galera_repo.state }}"
|
||||
update_cache: yes
|
||||
register: add_galera_repo
|
||||
when: galera_repo.repo is defined
|
||||
- name: Add galera repo
|
||||
apt_repository:
|
||||
repo: "{{ galera_repo.repo }}"
|
||||
filename: "{{ galera_repo.filename | default(omit) }}"
|
||||
state: "{{ galera_repo.state }}"
|
||||
update_cache: yes
|
||||
register: add_galera_repo
|
||||
when: galera_repo.repo is defined
|
||||
|
||||
- name: Preseed galera password(s)
|
||||
debconf:
|
||||
|
@ -32,6 +32,7 @@
|
||||
register: _remove_existing_mariadb_packages
|
||||
changed_when: _remove_existing_mariadb_packages.rc == 2
|
||||
failed_when: _remove_existing_mariadb_packages.rc not in [0, 2]
|
||||
when: galera_install_method == 'external_repo'
|
||||
args:
|
||||
executable: /bin/bash
|
||||
|
||||
@ -85,35 +86,38 @@
|
||||
state: "link"
|
||||
force: true
|
||||
|
||||
- name: If a keyfile is provided, copy the gpg keyfile to the key location
|
||||
copy:
|
||||
src: "gpg/{{ item.key | basename }}"
|
||||
dest: "{{ item.key }}"
|
||||
mode: '0644'
|
||||
with_items: "{{ galera_gpg_keys }}"
|
||||
- name: Configure repositories for MariaDB installation
|
||||
when:
|
||||
- galera_install_method == 'external_repo'
|
||||
- galera_repo
|
||||
block:
|
||||
- name: If a keyfile is provided, copy the gpg keyfile to the key location
|
||||
copy:
|
||||
src: "gpg/{{ item.key | basename }}"
|
||||
dest: "{{ item.key }}"
|
||||
mode: '0644'
|
||||
with_items: "{{ galera_gpg_keys }}"
|
||||
|
||||
- name: Add galera repo
|
||||
yum_repository:
|
||||
name: "{{ galera_repo.name }}"
|
||||
description: "{{ galera_repo.description }}"
|
||||
baseurl: "{{ galera_repo.baseurl }}"
|
||||
gpgkey: "{{ galera_repo.gpgkey | default(omit) }}"
|
||||
gpgcheck: yes
|
||||
enabled: yes
|
||||
priority: 25
|
||||
when: galera_repo != {}
|
||||
register: add_galera_repos
|
||||
until: add_galera_repos is success
|
||||
retries: 5
|
||||
delay: 2
|
||||
- name: Add galera repo
|
||||
yum_repository:
|
||||
name: "{{ galera_repo.name }}"
|
||||
description: "{{ galera_repo.description }}"
|
||||
baseurl: "{{ galera_repo.baseurl }}"
|
||||
gpgkey: "{{ galera_repo.gpgkey | default(omit) }}"
|
||||
gpgcheck: yes
|
||||
enabled: yes
|
||||
priority: 25
|
||||
register: add_galera_repos
|
||||
until: add_galera_repos is success
|
||||
retries: 5
|
||||
delay: 2
|
||||
|
||||
- name: Enable module_hotfixes
|
||||
lineinfile:
|
||||
dest: "/etc/yum.repos.d/{{ galera_repo.name }}.repo"
|
||||
line: "module_hotfixes=1"
|
||||
regexp: "^module_hotfixes"
|
||||
insertafter: "^enabled"
|
||||
when: galera_repo != {}
|
||||
- name: Enable module_hotfixes
|
||||
lineinfile:
|
||||
dest: "/etc/yum.repos.d/{{ galera_repo.name }}.repo"
|
||||
line: "module_hotfixes=1"
|
||||
regexp: "^module_hotfixes"
|
||||
insertafter: "^enabled"
|
||||
|
||||
# When changing the repo URL, the metadata does
|
||||
# not reliably update, resulting in the right
|
||||
|
@ -30,21 +30,21 @@ galera_server_required_distro_packages:
|
||||
- libstdc++
|
||||
- libgcc
|
||||
- libgcrypt
|
||||
- MariaDB-client
|
||||
- MariaDB-devel
|
||||
- "{{ (galera_install_method == 'external_repo') | ternary('MariaDB-client', 'mariadb') }}"
|
||||
- "{{ (galera_install_method == 'external_repo') | ternary('MariaDB-devel', 'mariadb-connector-c-devel') }}"
|
||||
- python3-PyMySQL
|
||||
|
||||
galera_etc_conf_file: "/etc/mysql/my.cnf"
|
||||
galera_etc_include_dir: "/etc/mysql/conf.d"
|
||||
galera_var_run_socket: "{{ galera_data_dir }}/mysql.sock"
|
||||
|
||||
_galera_mariadb_server_package: "MariaDB-server"
|
||||
_galera_mariadb_server_package: "{{ (galera_install_method == 'external_repo') | ternary('MariaDB-server', 'mariadb-server') }}"
|
||||
|
||||
galera_server_mariadb_distro_packages:
|
||||
- which
|
||||
- "{{ galera_mariadb_server_package }}"
|
||||
- MariaDB-backup
|
||||
- MariaDB-shared
|
||||
- "{{ (galera_install_method == 'external_repo') | ternary('MariaDB-backup', 'mariadb-backup') }}"
|
||||
- "{{ (galera_install_method == 'external_repo') | ternary('MariaDB-shared', 'galera') }}"
|
||||
- rsync
|
||||
- socat
|
||||
|
||||
@ -56,9 +56,9 @@ galera_mariadb_distro_packages_remove:
|
||||
|
||||
# The packages to uninstall during an upgrade from a previous version
|
||||
galera_server_upgrade_packages_remove:
|
||||
- galera-*
|
||||
- galera*
|
||||
- MariaDB-Galera-server
|
||||
- MariaDB-server
|
||||
- "{{ galera_mariadb_server_package }}"
|
||||
|
||||
_galera_repo_url: "http://{{ galera_repo_host }}/MariaDB/mariadb-{{ galera_major_version }}.{{ galera_minor_version }}/yum/rhel/$releasever/$basearch"
|
||||
_galera_repo:
|
||||
@ -67,12 +67,13 @@ _galera_repo:
|
||||
baseurl: "{{ galera_repo_url }}"
|
||||
gpgkey: "file://{{ galera_gpg_keys | map(attribute='key') | join('file://') }}"
|
||||
|
||||
galera_wsrep_provider: "/usr/lib64/galera-4/libgalera_smm.so"
|
||||
# NOTE: CentOS Stream/Rocky 9 still ship mariadb 10.5 out of their default repos
|
||||
galera_wsrep_provider: "/usr/lib64/{{ (galera_install_method == 'external_repo') | ternary('galera-4', 'galera') }}/libgalera_smm.so"
|
||||
|
||||
galera_client_distro_packages:
|
||||
- MariaDB-client
|
||||
- "{{ (galera_install_method == 'external_repo') | ternary('MariaDB-client', 'mariadb') }}"
|
||||
|
||||
galera_devel_distro_packages:
|
||||
- MariaDB-devel
|
||||
- "{{ (galera_install_method == 'external_repo') | ternary('MariaDB-devel', 'mariadb-connector-c-devel') }}"
|
||||
|
||||
galera_unix_socket: "{{ galera_data_dir }}/mysql.sock"
|
||||
|
Loading…
x
Reference in New Issue
Block a user