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

Fix molecule tests which spontaneously broke (and test noble 22.04) #16

Merged
merged 31 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0c01076
fix: 24.04 support
jseniuk May 28, 2024
95e254e
fix: actions and molecule tweaks
jseniuk May 28, 2024
c67192a
fix: action version
jseniuk May 28, 2024
4089988
fix: namespace and role name
jseniuk May 28, 2024
65e4ea0
Remove outdated versions
dale-c-anderson May 29, 2024
0db2110
Update versions and images
dale-c-anderson May 29, 2024
0b973da
Match molecule with one that has working tests
dale-c-anderson May 29, 2024
3871cf2
Welp. So much for linting with molecule.
dale-c-anderson May 29, 2024
641d823
Downgrade molecule-action version to see if that solves it
dale-c-anderson May 29, 2024
d7a2a05
Switch to an image that actually exists
dale-c-anderson May 30, 2024
82ae1e3
Woops
dale-c-anderson May 30, 2024
5c0bd38
Try a few more things
dale-c-anderson May 30, 2024
a5cd361
Try a few more things
dale-c-anderson May 30, 2024
58ffe8c
Merge branch 'add-noble' of github.com:AcroMedia/ansible-role-mariadb…
dale-c-anderson May 30, 2024
0149f78
Try things Robert's way
dale-c-anderson May 30, 2024
732b1a6
Fix lint later
dale-c-anderson May 30, 2024
de1ca6a
Fix wrong requirements file
dale-c-anderson May 30, 2024
e962fe0
Noble doesn't exist yet.
dale-c-anderson May 30, 2024
7f204a6
Add some more requirements
dale-c-anderson May 30, 2024
f930e03
Fix broken boostrap
dale-c-anderson May 30, 2024
d315d82
Duh
dale-c-anderson May 30, 2024
089d9c8
Update Mariadb service name change transition version
dale-c-anderson May 30, 2024
c5662a3
Adjust lower
dale-c-anderson May 30, 2024
4d373ec
Find out why service is hanging
dale-c-anderson May 30, 2024
cc65e1f
Last attempt for mariadb service timing out on focal
dale-c-anderson May 30, 2024
83c98d1
Add forgotten flush
dale-c-anderson May 30, 2024
879ad54
Disable focal from molecule tests.
dale-c-anderson May 30, 2024
d286bfd
Enable molecule on cron
dale-c-anderson May 30, 2024
5413d6b
Noble is supported. Yay.
dale-c-anderson May 30, 2024
bed2955
Remove unneeded stuff
dale-c-anderson May 30, 2024
3f634d1
Update min requirement
dale-c-anderson May 30, 2024
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
16 changes: 16 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
#
# Ansible managed
#
exclude_paths:
- molecule/default/prepare.yml
- molecule/default/converge.yml
- molecule/default/verify.yml
- molecule/default/collections.yml
- .tox
- .cache
- .github
- requirements.yml

enable_list:
- name[prefix]
59 changes: 24 additions & 35 deletions .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,37 @@ on:
pull_request:
branches:
- master
schedule:
- cron: '5 4 */14 * *' # Twice / month, at 4:05 AM.
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
with:
path: "${{ github.repository }}"
- name: molecule
uses: robertdebock/molecule-action@2.6.8
with:
command: lint
# lint:
# runs-on: ubuntu-20.04
# steps:
# - name: checkout
# uses: actions/checkout@v4
# - name: ansible-lint
# uses: ansible-community/ansible-lint-action@main
test:
needs:
- lint
runs-on: ubuntu-latest
# needs:
# - lint
runs-on: ubuntu-20.04
strategy:
fail-fast: true
matrix:
image:
- geerlingguy/docker-ubuntu2204-ansible:latest
- geerlingguy/docker-ubuntu2004-ansible:latest
- geerlingguy/docker-ubuntu1804-ansible:latest
config:
- image: "ubuntu"
tag: "latest" # latest == noble, as of this writing.
- image: "ubuntu"
tag: "jammy"
# - image: "ubuntu"
# tag: "focal" # Service start times out in molecule tests. No idea why. :-(
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
path: "${{ github.repository }}"

- name: Disable apparmor on the runner because of an alleged bug which
interferes with mysql service commands. See
https://github.com/geerlingguy/ansible-role-mysql/issues/422
run: |
set -x
sudo apt-get install apparmor-profiles
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
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
env:
MOLECULE_DOCKER_IMAGE: "${{ matrix.image }}"
max_failures: 1
image: ${{ matrix.config.image }}
tag: ${{ matrix.config.tag }}
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

17 changes: 17 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
extends: default

rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
line-length: disable
truthy:
check-keys: false

ignore: |
.tox/
.cache/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ For setting up MariaDB on Ubuntu.

Requirements
------------
* Ubuntu 14.04 or newer.
* Ubuntu 20.04 or newer.

Role Variables
--------------
Expand Down
4 changes: 4 additions & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
service:
name: mysql
state: restarted

- name: armdb systemctl daemon-reexec
ansible.builtin.systemd:
daemon_reexec: true
8 changes: 5 additions & 3 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
galaxy_info:
namespace: acromedia
role_name: mariadb
author: Matt Breden
description: Installs MariaDB on Ubuntu
company: Acro Media Inc.
Expand All @@ -8,8 +10,8 @@ galaxy_info:
platforms:
- name: Ubuntu
versions:
- trusty
- xenial
- bionic
- focal
- jammy
- noble
galaxy_tags: []
dependencies: []
15 changes: 10 additions & 5 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
requirements-file: requirements.yml
lint: |
set -e
yamllint .
ansible-lint
driver:
name: docker
platforms:
- name: instance
image: ${MOLECULE_DOCKER_IMAGE:-'geerlingguy/docker-ubuntu1804-ansible:latest'}
command: ${MOLECULE_DOCKER_COMMAND:-""}
- name: "mariadb-${image:-ubuntu}-${tag:-latest}${TOX_ENVNAME}"
image: "${namespace:-robertdebock}/${image:-ubuntu}:${tag:-latest}"
command: /sbin/init
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
privileged: true
pre_build_image: true
provisioner:
name: ansible
playbooks:
converge: ${MOLECULE_PLAYBOOK:-converge.yml}
verifier:
name: ansible
9 changes: 7 additions & 2 deletions molecule/default/prepare.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
- name: Bootstrap
hosts: all
become: true
gather_facts: false
roles:
- role: robertdebock.bootstrap

- name: Prepare
hosts: all
become: true
gather_facts: yes
tasks:

- name: Update cache
apt: update_cache=true cache_valid_time=600
changed_when: false
Expand All @@ -14,4 +20,3 @@
name: dirmngr
state: present
when: ansible_os_family == 'Debian'

5 changes: 5 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ansible-compat == 4.*
molecule == 6.*
molecule-plugins[docker] == 23.*
ansible-lint == 6.*
paramiko == 3.*
4 changes: 4 additions & 0 deletions requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
roles:
- name: robertdebock.bootstrap
collections:
21 changes: 14 additions & 7 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -61,9 +68,9 @@
state: present

- block:
- name: Ensure mysql is running and starts on boot
- name: Ensure mariadb service is running and starts on boot
service:
name: mysql
name: mariadb
state: started
enabled: true

Expand Down