Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mysql 8.4 #718

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
- [Apt] Add Mysql 8.4 support
- [Apt] Add Galera 4.21 and MySQL wsrep 8.4.3 repositories
- [MySQL] Mysql 8.4 support
- [MySQL] Change `manala_mysql_install_python_packages` from `python3-mysqldb` to `python3-pymysql`. (See https://github.com/ansible-collections/community.mysql/pull/655 and https://github.com/ansible-collections/community.mysql/issues/659)

## [4.3.0] - 2024-10-09
### Added
Expand Down
354 changes: 1 addition & 353 deletions molecule/mysql.8.0/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@

- name: Default
tags: [default]
hosts:
- debian.buster
- debian.bullseye
hosts: debian
tasks:
- block: # noqa: name[missing]
- name: Role
Expand All @@ -34,353 +32,3 @@
cmd: goss --gossfile - validate
stdin: "{{ lookup('ansible.builtin.template', 'goss/default.yaml.j2') }}"
changed_when: false

##########
# Client #
##########

- name: Client
tags: [client]
hosts:
- debian.buster
- debian.bullseye
tasks:
- name: Packages absent
ansible.builtin.apt:
name:
- mysql-server
- mysql-client
state: absent
- block: # noqa: name[missing]
- name: Role
ansible.builtin.import_role:
name: manala.roles.mysql
vars:
manala_mysql_server: false
always:
- name: Goss
ansible.builtin.command:
cmd: goss --gossfile - validate
stdin: "{{ lookup('ansible.builtin.template', 'goss/client.yaml.j2') }}"
changed_when: false

##########
# Config #
##########

- name: Config
tags: [config]
hosts:
- debian.buster
- debian.bullseye
vars:
tests_dir: /molecule/mysql/config
tasks:
- name: Clean tests dir
ansible.builtin.file: # noqa: risky-file-permissions
path: "{{ tests_dir }}"
state: "{{ item }}"
loop: [absent, directory]
- block: # noqa: name[missing]
- name: Role - Dict
ansible.builtin.import_role:
# Play role fully on first run, so that handlers don't breaks
name: manala.roles.mysql
vars:
manala_mysql_config_file: "{{ tests_dir }}/dict"
manala_mysql_config_template: ~
manala_mysql_config:
mysqld:
bind-address: 1.2.3.4
pid-file: /var/run/mysqld/mysqld.pid
- name: Role - Content
ansible.builtin.import_role:
name: manala.roles.mysql
tasks_from: config
vars:
manala_mysql_config_file: "{{ tests_dir }}/content"
manala_mysql_config_template: ~
manala_mysql_config: |
Content
- name: Role - Template
ansible.builtin.import_role:
name: manala.roles.mysql
tasks_from: config
vars:
manala_mysql_config_file: "{{ tests_dir }}/template"
manala_mysql_config_template: fixtures/template.j2
manala_mysql_config: ~
always:
- name: Goss
ansible.builtin.command:
cmd: goss --gossfile - validate
stdin: "{{ lookup('ansible.builtin.template', 'goss/config.yaml.j2') }}"
changed_when: false

###########
# Configs #
###########

- name: Configs
tags: [configs]
hosts:
- debian.buster
- debian.bullseye
vars:
tests_dir: /molecule/mysql/configs
tasks:
- name: Clean tests dir
ansible.builtin.file: # noqa: risky-file-permissions
path: "{{ tests_dir }}/{{ item.0 }}"
state: "{{ item.1 }}"
loop: "{{ ['default', 'defaults', 'exclusive'] | product(['absent', 'directory']) }}"
- name: Touch existing files
ansible.builtin.file: # noqa: risky-file-permissions
path: "{{ tests_dir }}/{{ item }}"
state: touch
loop: [
default/state_absent_existing, default/state_ignore_existing,
exclusive/existing, exclusive/existing_present, exclusive/existing_ignore,
]
- block: # noqa: name[missing]
- name: Role - Default
ansible.builtin.import_role:
# Play role fully on first run, so that handlers don't breaks
name: manala.roles.mysql
vars:
manala_mysql_configs_exclusive: false
manala_mysql_configs_dir: "{{ tests_dir }}/default"
manala_mysql_configs_defaults: {}
manala_mysql_configs:
# Dict
- file: dict
config:
mysqld:
user: mysql
query_cache_size: 0
gtid_mode: true
enforce_gtid_consistency: false
# Content
- file: content
config: |
Content
# Template
- file: template
template: fixtures/template.j2
- template: fixtures/template_file.j2
# Flatten
-
- file: flatten
# State
- file: state_present_implicit
- file: state_present
state: present
- file: state_absent
state: absent
- file: state_absent_existing
state: absent
- file: state_ignore
state: ignore
- file: state_ignore_existing
state: ignore
- name: Role - Defaults
ansible.builtin.import_role:
name: manala.roles.mysql
tasks_from: configs
vars:
manala_mysql_configs_exclusive: false
manala_mysql_configs_dir: "{{ tests_dir }}/defaults"
manala_mysql_configs_defaults:
template: fixtures/template.j2
manala_mysql_configs:
- file: template
- template: fixtures/template_file.j2
- file: template_overwrite
template: fixtures/template_file.j2
- name: Role - Exclusive
ansible.builtin.import_role:
name: manala.roles.mysql
tasks_from: configs
vars:
manala_mysql_configs_exclusive: true
manala_mysql_configs_dir: "{{ tests_dir }}/exclusive"
manala_mysql_configs_defaults: {}
manala_mysql_configs:
- file: existing_present
- file: existing_ignore
state: ignore
- file: ignore
state: ignore
always:
- name: Goss
ansible.builtin.command:
cmd: goss --gossfile - validate
stdin: "{{ lookup('ansible.builtin.template', 'goss/configs.yaml.j2') }}"
changed_when: false

########
# Data #
########

- name: Data
tags: [data]
hosts:
- debian.buster
- debian.bullseye
vars:
tests_dir: /molecule/mysql/data
tasks:
- name: Clean tests dir
ansible.builtin.file: # noqa: risky-file-permissions
path: "{{ tests_dir }}"
state: "{{ item }}"
loop: [absent, directory]
- block: # noqa: name[missing]
- name: Role
ansible.builtin.import_role:
name: manala.roles.mysql
vars:
manala_mysql_config: |
[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
log-error = /var/log/mysql/error.log
datadir = {{ tests_dir }}/data
# Use native authentication plugin
default-authentication-plugin = mysql_native_password
manala_mysql_data_dir: "{{ tests_dir }}/data"
manala_mysql_data_dir_user: mysql
manala_mysql_data_dir_group: root
manala_mysql_data_dir_mode: "0700"
always:
- name: Goss
ansible.builtin.command:
cmd: goss --gossfile - validate
stdin: "{{ lookup('ansible.builtin.template', 'goss/data.yaml.j2') }}"
changed_when: false

#########
# Users #
#########

- name: Users
tags: [users]
hosts:
- debian.buster
- debian.bullseye
tasks:
- name: Role - Default
ansible.builtin.import_role:
# Play role fully on first run, to install python modules
name: manala.roles.mysql
vars:
manala_mysql_configs:
# Use native authentication plugin
- file: auth.cnf
config:
mysqld:
default-authentication-plugin: mysql_native_password
manala_mysql_users:
- name: bar
state: absent
- name: Create users to absent/ignore later
community.mysql.mysql_user:
user: "{{ item }}"
state: present
loop: [
state_absent_existing, state_ignore_existing,
]
- block: # noqa: name[missing]
- name: Role
ansible.builtin.import_role:
name: manala.roles.mysql
vars:
manala_mysql_users:
# Privileges and password
- name: foo
password: foo
host: localhost
priv: "*.*:ALL,GRANT"
# States
- name: state_present_implicit
- name: state_present
state: present
- name: state_absent
state: absent
- name: state_absent_existing
state: absent
- name: state_ignored
state: ignore
- name: state_ignore_existing
state: ignore
# Flatten
-
- name: baz
password: baz
host: localhost
priv: "*.*:ALL,GRANT"
always:
- name: Goss
ansible.builtin.command:
cmd: goss --gossfile - validate
stdin: "{{ lookup('ansible.builtin.template', 'goss/users.yaml.j2') }}"
changed_when: false

#############
# Databases #
#############

- name: Databases
tags: [databases]
hosts:
- debian.buster
- debian.bullseye
tasks:
- name: Role - Default
ansible.builtin.import_role:
# Play role fully on first run, to install python modules
name: manala.roles.mysql
vars:
manala_mysql_configs:
# Use native authentication plugin
- file: auth.cnf
config:
mysqld:
default-authentication-plugin: mysql_native_password
manala_mysql_databases:
- name: bar
state: absent
- name: Create databases to absent/ignore later
community.mysql.mysql_db:
name: "{{ item }}"
state: present
loop: [
state_absent_existing, state_ignore_existing,
]
- block: # noqa: name[missing]
- name: Role
ansible.builtin.import_role:
name: manala.roles.mysql
vars:
manala_mysql_databases:
# States
- name: state_present_implicit
- name: state_present
state: present
- name: state_absent
state: absent
- name: state_absent_existing
state: absent
- name: state_ignored
state: ignore
- name: state_ignore_existing
state: ignore
# Flatten
-
- name: baz
always:
- name: Goss
ansible.builtin.command:
cmd: goss --gossfile - validate
stdin: "{{ lookup('ansible.builtin.template', 'goss/databases.yaml.j2') }}"
changed_when: false
4 changes: 1 addition & 3 deletions molecule/mysql.8.0/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

- name: Prepare
tags: [always]
hosts:
- debian.buster
- debian.bullseye
hosts: debian
tasks:
- name: Apt
ansible.builtin.import_role:
Expand Down
Loading
Loading