From c64038d6d95d5cf939f168e04bfa9e7b16f7409c Mon Sep 17 00:00:00 2001 From: Faustin Lammler Date: Fri, 14 Oct 2022 09:56:51 +0200 Subject: [PATCH] Implement MDBF cluster deployment Add a new CI task to deploy MDBF MariaDB versions in a cluster. --- .github/workflows/test_cluster.yml | 3 -- .github/workflows/test_cluster_mdbf.yml | 67 +++++++++++++++++++++++++ .github/workflows/test_default.yml | 5 +- .github/workflows/test_mdbf.yml | 6 +-- molecule/cluster/mdbf.yml | 11 ++++ tasks/setup_redhat.yml | 4 +- 6 files changed, 83 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/test_cluster_mdbf.yml create mode 100644 molecule/cluster/mdbf.yml diff --git a/.github/workflows/test_cluster.yml b/.github/workflows/test_cluster.yml index c0eee0f..ade685d 100644 --- a/.github/workflows/test_cluster.yml +++ b/.github/workflows/test_cluster.yml @@ -45,8 +45,6 @@ jobs: - almalinux-9 - rockylinux-8 # - rockylinux-9 - playbook: - - converge.yml steps: - uses: actions/checkout@v3 - name: Install requirements @@ -66,4 +64,3 @@ jobs: PY_COLORS: "1" ANSIBLE_FORCE_COLOR: "1" MOLECULE_DISTRO: ${{ matrix.distro }} - MOLECULE_PLAYBOOK: ${{ matrix.playbook }} diff --git a/.github/workflows/test_cluster_mdbf.yml b/.github/workflows/test_cluster_mdbf.yml new file mode 100644 index 0000000..aa16d4f --- /dev/null +++ b/.github/workflows/test_cluster_mdbf.yml @@ -0,0 +1,67 @@ +--- +name: Cluster MDBF + +on: + push: + paths: + - .github/workflows/test_cluster_mdbf.yml + - requirements.txt + - "files/**" + - "handlers/**" + - "molecule/cluster/**" + - "tasks/**" + - "templates/**" + - "vars/**" + pull_request: + paths: + - .github/workflows/test_cluster_mdbf.yml + - requirements.txt + - "files/**" + - "handlers/**" + - "molecule/cluster/**" + - "tasks/**" + - "templates/**" + - "vars/**" + schedule: + - cron: "30 5 * * 2" + +jobs: + molecule-cluster-pkg: + name: Cluster MDBF + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + distro: + - ubuntu-22.04 + - debian-11 + - fedora-36 + - almalinux-8 + - rockylinux-9 + mariadb-version: + - "10.6" + - "10.7" + - "10.8" + - "10.9" + - "10.10" + steps: + - uses: actions/checkout@v3 + - name: Install requirements + run: | + python3 -m pip install --upgrade pip + python3 -m pip install -r requirements.txt + # This is necessary on GH Actions to allow running systemd in rootless containers + # see: https://github.com/actions/virtual-environments/issues/3536 + # see: https://github.com/ansible-community/molecule/discussions/3155 + - name: Start systemd user service + run: | + loginctl enable-linger $(whoami) + sleep 1 + - name: Run molecule + run: molecule test -s cluster + env: + PY_COLORS: "1" + ANSIBLE_FORCE_COLOR: "1" + MOLECULE_DISTRO: ${{ matrix.distro }} + MOLECULE_PLAYBOOK: mdbf.yml + MARIADB_VERSION: ${{ matrix.mariadb-version }} diff --git a/.github/workflows/test_default.yml b/.github/workflows/test_default.yml index 99989f8..a95548e 100644 --- a/.github/workflows/test_default.yml +++ b/.github/workflows/test_default.yml @@ -27,7 +27,7 @@ on: jobs: molecule-distrib-pkg: - name: Default + name: Default deployment runs-on: ubuntu-latest strategy: fail-fast: false @@ -45,8 +45,6 @@ jobs: - almalinux-9 - rockylinux-8 - rockylinux-9 - playbook: - - converge.yml steps: - uses: actions/checkout@v3 - name: Install requirements @@ -66,4 +64,3 @@ jobs: PY_COLORS: "1" ANSIBLE_FORCE_COLOR: "1" MOLECULE_DISTRO: ${{ matrix.distro }} - MOLECULE_PLAYBOOK: ${{ matrix.playbook }} diff --git a/.github/workflows/test_mdbf.yml b/.github/workflows/test_mdbf.yml index 20608a4..8b3389b 100644 --- a/.github/workflows/test_mdbf.yml +++ b/.github/workflows/test_mdbf.yml @@ -23,7 +23,7 @@ on: - "templates/**" - "vars/**" schedule: - - cron: "0 5 * * 2" + - cron: "10 5 * * 2" jobs: molecule-mdbf-pkg: @@ -45,8 +45,6 @@ jobs: - almalinux-9 - rockylinux-8 - rockylinux-9 - playbook: - - mdbf.yml mariadb-version: - "10.3" - "10.4" @@ -111,5 +109,5 @@ jobs: PY_COLORS: "1" ANSIBLE_FORCE_COLOR: "1" MOLECULE_DISTRO: ${{ matrix.distro }} - MOLECULE_PLAYBOOK: ${{ matrix.playbook }} + MOLECULE_PLAYBOOK: mdbf.yml MARIADB_VERSION: ${{ matrix.mariadb-version }} diff --git a/molecule/cluster/mdbf.yml b/molecule/cluster/mdbf.yml new file mode 100644 index 0000000..c8074e5 --- /dev/null +++ b/molecule/cluster/mdbf.yml @@ -0,0 +1,11 @@ +--- +- name: Converge + hosts: all + gather_facts: true + vars: + mariadb_use_official_repo: true + mariadb_use_official_repo_url: https://deb.mariadb.org + mariadb_use_official_repo_version: "{{ lookup('env', 'MARIADB_VERSION') }}" + + roles: + - role: ansible-role-mariadb diff --git a/tasks/setup_redhat.yml b/tasks/setup_redhat.yml index a0c49f9..f2058a9 100644 --- a/tasks/setup_redhat.yml +++ b/tasks/setup_redhat.yml @@ -8,9 +8,9 @@ [mariadb] name = MariaDB {% if ansible_distribution == "Fedora" %} - baseurl = https://yum.mariadb.org/{{ mariadb_use_official_repo_version }}/fedora{{ ansible_distribution_major_version }}-amd64 + baseurl = https://rpm.mariadb.org/{{ mariadb_use_official_repo_version }}/fedora{{ ansible_distribution_major_version }}-amd64 {% else %} - baseurl = https://yum.mariadb.org/{{ mariadb_use_official_repo_version }}/rhel{{ ansible_distribution_major_version }}-amd64 + baseurl = https://rpm.mariadb.org/{{ mariadb_use_official_repo_version }}/rhel{{ ansible_distribution_major_version }}-amd64 {% endif %} gpgkey = https://yum.mariadb.org/RPM-GPG-KEY-MariaDB module_hotfixes = 1