diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 0000000..646669b --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,7 @@ +skip_list: + - 'empty-string-compare' + - 'braces' + - 'yaml' + +exclude_paths: +- molecule/ diff --git a/.github/workflows/molecule.yml b/.github/workflows/molecule.yml new file mode 100644 index 0000000..8d5b7bd --- /dev/null +++ b/.github/workflows/molecule.yml @@ -0,0 +1,49 @@ +--- +name: molecule + +on: + push: + pull_request: + schedule: + - cron: "0 5 * * 2" + +jobs: + molecule: + name: Molecule + runs-on: ubuntu-latest + strategy: + matrix: + include: + - distro: ubuntu-18.04 + playbook: converge.yml + - distro: ubuntu-18.04 + playbook: converge-mdbf.yml + - distro: ubuntu-20.04 + playbook: converge.yml + - distro: ubuntu-20.04 + playbook: converge-mdbf.yml + - distro: ubuntu-20.10 + playbook: converge.yml + - distro: ubuntu-20.10 + playbook: converge-mdbf.yml + - distro: debian-10 + playbook: converge.yml + - distro: debian-10 + playbook: converge-mdbf.yml + - distro: debian-sid + playbook: converge.yml + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - name: Install requirements + run: pip3 install -r requirements.txt + + - name: Run molecule + run: molecule test + env: + PY_COLORS: "1" + ANSIBLE_FORCE_COLOR: "1" + DRIVER_NAME: "docker" + MOLECULE_DISTRO: ${{ matrix.distro }} + MOLECULE_PLAYBOOK: ${{ matrix.playbook }} diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..e77ceba --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,14 @@ +--- +name: pre-commit + +on: + pull_request: + push: + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - uses: pre-commit/action@v2.0.3 diff --git a/.github/workflows/trigger-galaxy.yml b/.github/workflows/trigger-galaxy.yml new file mode 100644 index 0000000..26f5013 --- /dev/null +++ b/.github/workflows/trigger-galaxy.yml @@ -0,0 +1,17 @@ +--- +name: trigger galaxy import + +on: + push: + branches: + - master + +jobs: + trigger: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Galaxy + uses: robertdebock/galaxy-action@1.1.0 + with: + galaxy_api_key: ${{ secrets.galaxy_api_key }} diff --git a/.travis-pre-commit-config.yaml b/.pre-commit-config.yaml similarity index 81% rename from .travis-pre-commit-config.yaml rename to .pre-commit-config.yaml index 6a293fe..e9c1f0d 100644 --- a/.travis-pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,11 +1,13 @@ --- repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.3.0 + rev: v4.0.1 hooks: + - id: check-added-large-files - id: check-ast - id: check-case-conflict - id: check-executables-have-shebangs + - id: check-merge-conflict - id: check-yaml name: Check yaml files - id: debug-statements @@ -14,21 +16,25 @@ repos: name: Check trailing whitespace args: [--markdown-linebreak-ext=md] - repo: https://gitlab.com/pycqa/flake8.git - rev: 3.8.4 + rev: 3.9.2 hooks: - id: flake8 name: Check python (flake8) args: ["--ignore=E501,E226"] - repo: https://github.com/adrienverge/yamllint.git - rev: v1.25.0 + rev: v1.26.1 hooks: - id: yamllint name: Check yaml files (yamllint) - repo: https://github.com/ansible/ansible-lint.git - rev: v4.3.7 + rev: v5.0.11 hooks: - id: ansible-lint - name: Check yaml files (ansible-lint) + name: Check ansible files (ansible-lint) + # https://github.com/ansible/ansible-lint/issues/1066 + always_run: false + # args: ["-x", "602"] + exclude_types: [markdown, shell] types: [yaml] - repo: local hooks: @@ -39,7 +45,7 @@ repos: types: [markdown] - id: docker-shell-shfmt name: Run shfmt with docker - entry: mvdan/shfmt:v3.2.0 -d -i 2 -ci + entry: mvdan/shfmt:v3.3.0 -d -i 2 -ci language: docker_image types: [shell] - id: docker-shell-lint diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9fe39d8..0000000 --- a/.travis.yml +++ /dev/null @@ -1,44 +0,0 @@ ---- -language: python -services: docker - -env: - global: - - ROLE_NAME: mariadb - - DRIVER_NAME: docker - matrix: - - MOLECULE_DISTRO: debian-10 - - MOLECULE_DISTRO: debian-sid - - MOLECULE_DISTRO: ubuntu-18.04 - - MOLECULE_DISTRO: ubuntu-20.04 - - MOLECULE_DISTRO: ubuntu-20.10 - -before_install: - - | - if ! git diff --name-only HEAD^ | grep -vE '(.md)|(.pdf)' - then - echo "Only doc files were updated, not running the CI." - exit - fi - -cache: - directories: - - $HOME/.cache/pre-commit - -jobs: - include: - - name: lint with pre-commit - install: skip - before_install: skip - script: - - pip install pre-commit - - pre-commit run -c .travis-pre-commit-config.yaml -a - -script: - - export ANSIBLE_STRATEGY=mitogen_linear - - export ANSIBLE_STRATEGY_PLUGINS=${VIRTUAL_ENV}/lib/python${TRAVIS_PYTHON_VERSION}/site-packages/ansible_mitogen/plugins/strategy - - molecule --version - - molecule test - -notifications: - webhooks: https://galaxy.ansible.com/api/v1/notifications/ diff --git a/README.md b/README.md index bd057b1..49f1cd5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Ansible role: MariaDB -[![travis build status](https://img.shields.io/travis/fauust/ansible-role-mariadb?logo=travis)](https://travis-ci.com/fauust/ansible-role-mariadb) +[![GitHub Actions](https://github.com/fauust/ansible-role-mariadb/workflows/pre-commit/badge.svg?branch=master)](https://github.com/fauust/ansible-role-mariadb/actions?query=workflow%3A%22pre-commit%22) +[![GitHub Actions](https://github.com/fauust/ansible-role-mariadb/workflows/build/badge.svg?branch=master)](https://github.com/fauust/ansible-role-mariadb/actions?query=workflow%3A%22molecule%22) Install and configure MariaDB Server on Debian/Ubuntu. @@ -38,7 +39,7 @@ Available variables are listed below, along with default values (see ```yaml mariadb_use_official_repo: false mariadb_use_official_repo_url: http://ftp.igh.cnrs.fr/pub/mariadb/repo -mariadb_use_official_repo_version: 10.4 +mariadb_use_official_repo_version: 10.5 ``` You may deploy the MariaDB Server version that comes with your distribution diff --git a/defaults/main.yml b/defaults/main.yml index 9982e90..9cf6281 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -2,7 +2,7 @@ # Configure the following to use official MariaDB repository # see: https://downloads.mariadb.org/mariadb/repositories mariadb_use_official_repo: false -mariadb_use_official_repo_url: http://ftp.igh.cnrs.fr/pub/mariadb/repo +mariadb_use_official_repo_url: https://ftp.igh.cnrs.fr/pub/mariadb/repo mariadb_use_official_repo_version: 10.5 mariadb_enabled_on_startup: true diff --git a/molecule/default/converge-mdbf.yml b/molecule/default/converge-mdbf.yml new file mode 100644 index 0000000..ab532fb --- /dev/null +++ b/molecule/default/converge-mdbf.yml @@ -0,0 +1,13 @@ +--- +- name: Converge + hosts: all + gather_facts: true + vars: + ansible_python_interpreter: /usr/bin/python3 + mariadb_use_official_repo: true + mariadb_use_official_repo_url: https://ftp.igh.cnrs.fr/pub/mariadb/repo + mariadb_use_official_repo_version: 10.5 + vars_files: vars/testvars.yml + + roles: + - role: ansible-role-mariadb diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index e2c9b2b..25e1da4 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -4,7 +4,7 @@ gather_facts: true vars: ansible_python_interpreter: /usr/bin/python3 - vars_files: testvars.yml + vars_files: vars/testvars.yml roles: - role: ansible-role-mariadb diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index bd18a79..ae42523 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -16,5 +16,7 @@ provisioner: ANSIBLE_GATHERING: explicit ANSIBLE_FORCE_COLOR: true ANSIBLE_PYTHON_INTERPRETER: /usr/bin/python3 + playbooks: + converge: ${MOLECULE_PLAYBOOK:-converge.yml} verifier: name: testinfra diff --git a/molecule/default/tests/test_default.py b/molecule/default/tests/test_default.py index bdce1b0..a3fe220 100644 --- a/molecule/default/tests/test_default.py +++ b/molecule/default/tests/test_default.py @@ -1,5 +1,6 @@ import os +# pylint: disable=import-error import testinfra.utils.ansible_runner testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( diff --git a/molecule/default/testvars.yml b/molecule/default/vars/testvars.yml similarity index 100% rename from molecule/default/testvars.yml rename to molecule/default/vars/testvars.yml