diff --git a/.github/workflows/molecule.yml b/.github/workflows/molecule.yml index a7668ec..2309138 100644 --- a/.github/workflows/molecule.yml +++ b/.github/workflows/molecule.yml @@ -46,7 +46,7 @@ jobs: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - name: molecule - uses: robertdebock/molecule-action@2.6.8 + uses: robertdebock/molecule-action@6.0.1 with: image: "${{ matrix.image }}" options: parallel diff --git a/meta/main.yml b/meta/main.yml index 26d39a8..16579b3 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,5 +1,7 @@ --- galaxy_info: + namespace: acromedia + role_name: mariadb author: Matt Breden description: Installs MariaDB on Ubuntu company: Acro Media Inc. @@ -11,5 +13,7 @@ galaxy_info: - trusty - xenial - bionic + - jammy + - noble galaxy_tags: [] dependencies: [] diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index c2c02bd..62452d2 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -11,6 +11,9 @@ platforms: - /sys/fs/cgroup:/sys/fs/cgroup:ro privileged: true pre_build_image: true + tmpfs: + - /run + - /tmp provisioner: name: ansible playbooks: diff --git a/tasks/main.yml b/tasks/main.yml index 370e92e..c97cc0a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,9 +1,16 @@ +- set_fact: + _supported_ubuntu_versions: + - '18.04' + - '20.04' + - '22.04' + - '24.04' + - name: Check if OS is Ubuntu LTS - fail: msg="Server must be Ubuntu LTS" - when: ansible_distribution != 'Ubuntu' - or (ansible_distribution_version != '18.04' - and ansible_distribution_version != '20.04' - and ansible_distribution_version != '22.04') + assert: + that: + - ansible_distribution == 'Ubuntu' + - ansible_distribution_version in _supported_ubuntu_versions + fail_msg: Server must be Ubuntu LTS - name: Check for existence of /root/.my.cnf stat: path=/root/.my.cnf @@ -62,11 +69,20 @@ - block: - name: Ensure mysql is running and starts on boot + when: ansible_distribution == 'Ubuntu' and ansible_distribution_version is version("24.04", "<") service: name: mysql state: started enabled: true + # Service name changes in newer Ubuntu versions + - name: Ensure mariadb is running and starts on boot + when: ansible_distribution == 'Ubuntu' and ansible_distribution_version is version("24.04", ">=") + service: + name: mariadb + state: started + enabled: true + - name: Get list of hosts for the anonymous user. command: mysql -NBe 'SELECT Host FROM mysql.user WHERE User = ""' register: mysql_anonymous_hosts