diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 0000000..c099c60 --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,2 @@ +warn_list: + - '106' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..73f127a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,81 @@ +--- +name: CI +'on': + pull_request: + push: + branches: + - master + schedule: + - cron: '30 1 * * 3' + +jobs: + + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Check out the codebase + uses: actions/checkout@v2 + + - name: Set up Python 3 + uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: Install test dependencies + run: pip install yamllint ansible-lint + + - name: Lint code + run: | + yamllint . + ansible-lint + + molecule: + name: Molecule + runs-on: ubuntu-latest + defaults: + run: + working-directory: "${{ github.repository }}" + needs: + - lint + strategy: + fail-fast: false + matrix: + include: + - distro: debian8 + ansible-version: '<2.10' + - distro: debian9 + - distro: debian10 + - distro: ubuntu1604 + ansible-version: '>=2.8, <2.9' + - distro: ubuntu1604 + ansible-version: '>=2.9, <2.10' + - distro: ubuntu1604 + ansible-version: '>=2.10, <2.11' + - distro: ubuntu1604 + - distro: ubuntu1804 + - distro: ubuntu2004 + + steps: + - name: Check out the codebase + uses: actions/checkout@v2 + with: + path: "${{ github.repository }}" + + - name: Set up Python 3 + uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: Install test dependencies + run: pip install 'ansible${{ matrix.ansible-version }}' molecule[docker] docker + + - name: Run Molecule tests + run: | + molecule test + env: + ANSIBLE_FORCE_COLOR: '1' + ANSIBLE_VERBOSITY: '2' + MOLECULE_DEBUG: '1' + MOLECULE_DISTRO: "${{ matrix.distro }}" + PY_COLORS: '1' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2354e68 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,20 @@ +--- +name: Release +'on': + push: + tags: + - '*' + +jobs: + + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Check out the codebase + uses: actions/checkout@v2 + + - name: Publish to Galaxy + uses: robertdebock/galaxy-action@1.1.0 + with: + galaxy_api_key: ${{ secrets.GALAXY_API_KEY }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index dbc9e3a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,81 +0,0 @@ ---- -sudo: required -dist: xenial - -language: python -python: - - "2.7" - - "3.5" - -env: - - ANSIBLE_VERSION=latest - - ANSIBLE_VERSION=2.10.2 - - ANSIBLE_VERSION=2.10.1 - - ANSIBLE_VERSION=2.10.0 - - ANSIBLE_VERSION=2.9.14 - - ANSIBLE_VERSION=2.9.13 - - ANSIBLE_VERSION=2.9.12 - - ANSIBLE_VERSION=2.9.11 - - ANSIBLE_VERSION=2.9.10 - - ANSIBLE_VERSION=2.9.9 - - ANSIBLE_VERSION=2.9.8 - - ANSIBLE_VERSION=2.9.7 - - ANSIBLE_VERSION=2.9.6 - - ANSIBLE_VERSION=2.9.5 - - ANSIBLE_VERSION=2.9.4 - - ANSIBLE_VERSION=2.9.3 - - ANSIBLE_VERSION=2.9.2 - - ANSIBLE_VERSION=2.9.1 - - ANSIBLE_VERSION=2.9.0 - - ANSIBLE_VERSION=2.8.16 - - ANSIBLE_VERSION=2.8.15 - - ANSIBLE_VERSION=2.8.14 - - ANSIBLE_VERSION=2.8.13 - - ANSIBLE_VERSION=2.8.12 - - ANSIBLE_VERSION=2.8.11 - - ANSIBLE_VERSION=2.8.10 - - ANSIBLE_VERSION=2.8.9 - - ANSIBLE_VERSION=2.8.8 - - ANSIBLE_VERSION=2.8.7 - - ANSIBLE_VERSION=2.8.6 - - ANSIBLE_VERSION=2.8.5 - - ANSIBLE_VERSION=2.8.4 - - ANSIBLE_VERSION=2.8.3 - - ANSIBLE_VERSION=2.8.2 - - ANSIBLE_VERSION=2.8.1 - - ANSIBLE_VERSION=2.8.0 - -branches: - only: - - master - -before_install: - - sudo apt-get update -qq - -install: - # Install Ansible. - - if [ "$ANSIBLE_VERSION" = "latest" ]; then pip install ansible; else pip install ansible==$ANSIBLE_VERSION; fi - - if [ "$ANSIBLE_VERSION" = "latest" ]; then pip install ansible-lint; fi - -script: - # Check the role/playbook's syntax. - - ansible-playbook -i tests/inventory tests/test.yml --syntax-check - - # Run the role/playbook with ansible-playbook. - - ansible-playbook -i tests/inventory tests/test.yml -vvvv - - # Run the role/playbook again, checking to make sure it's idempotent. - - > - ansible-playbook -i tests/inventory tests/test.yml - | grep -q 'changed=0.*failed=0' - && (echo 'Idempotence test: pass' && exit 0) - || (echo 'Idempotence test: fail' && exit 1) - - - if [ "$ANSIBLE_VERSION" = "latest" ]; then ansible-lint tests/test.yml; fi - -notifications: - email: false - webhooks: https://galaxy.ansible.com/api/v1/notifications/ - slack: - rooms: - secure: "AlvpgrPkKaEAPV8XXKBOZATTvlmc9Cvdi1rZYV8GMLDMogU1NBElH2M99R1Badz3pEWpBi9FiSKrm1SLhjn0+5Nb+M9sBXaLLnl8uYx/F9xmL+3wqzRRxYl1uKddDrzvsmJW2pShcstup6Y7T4SOlDF61KOkp+OQrvatP2jsAzy5p2LHNn1w51MW8YE4bjo/uCmzmDS/JY8a2aXylY5Jq4hNRxG6ENIouNE+4LVdpnw2IM8qFhaKmHt6SkSQWa7wAqS8g7m5PSLmRhoK65Sw+FkCazJBJpZuLGIdwXnn5K4H1v+SJwOXkNhaGd+tODPBFX6ifnHBGmSKnfZ5VeHG7sn4+pOE4e5JJ1Omq6LzQT2Z4mdHomtk0kNKSj3R2TsTK2JtBRi2gOKkNJFsiPxCcHMASl/D+9JLz15rNR7mgCpFib8bW/o00yqR8YiwwnTxTsqsMKVJ8VF043TI9alUVri2DBgseTEsFj35wJflmDg1KtQtDaQNVGXMvjYkvzg/T+iJWH3b4yvuOYGQdV/N24KViervLiTONnY5eJZhy5M9Xjm6QwAKsRs6OawMt6R9R+1Tjj12hlxvElOPorcNOzjUBqHHIeZ32ChaKFEx7RrDiv41G1Frb2PPebbpPnam9z/Zi2GFQZqWbiJf/6hZuEIZsaK/od4BOMDN0uYSdRw=" diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..894450c --- /dev/null +++ b/.yamllint @@ -0,0 +1,15 @@ +--- +extends: default + +rules: + braces: + max-spaces-inside: 1 + level: error + brackets: + max-spaces-inside: 1 + level: error + line-length: disable + truthy: disable + +ignore: | + .tox/ diff --git a/Dockerfile b/Dockerfile index 78650c6..fc89ab2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ RUN rm -rf $HOME/.cache # ansible RUN DEBIAN_FRONTEND=noninteractive apt-get install -y gcc libffi-dev libssl-dev && \ apt-get clean -RUN pip install ansible==2.9.14 +RUN pip install ansible==2.9.15 RUN rm -rf $HOME/.cache # provision diff --git a/README.md b/README.md index 0c910c6..f6d2cf8 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,18 @@ -## percona-client +## percona-client -[![Build Status](https://travis-ci.org/Oefenweb/ansible-percona-client.svg?branch=master)](https://travis-ci.org/Oefenweb/ansible-percona-client) +[![CI](https://github.com/Oefenweb/ansible-percona-client/workflows/CI/badge.svg)](https://github.com/Oefenweb/ansible-percona-client/actions?query=workflow%3ACI) [![Ansible Galaxy](http://img.shields.io/badge/ansible--galaxy-percona--client-blue.svg)](https://galaxy.ansible.com/Oefenweb/percona-client) Set up a [percona-server](https://www.percona.com/software/mysql-database/percona-server) client in Debian-like systems. #### Requirements -None +* `software-properties-common` (will be installed) +* `dirmngr` (will be installed) #### Variables -* `percona_client_version`: [default: `5.6`]: Version to install (e.g. `5.6`) +* `percona_client_version`: [default: `5.6`]: Version to install (e.g. `5.7`) * `percona_client_install`: [default: `[]`]: Additional packages to install * `percona_client_my_cnf_files`: [default: `[]`]: `.my.cnf` files to configure diff --git a/Vagrantfile b/Vagrantfile index 3517233..a0182a0 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -4,40 +4,26 @@ role = File.basename(File.expand_path(File.dirname(__FILE__))) boxes = [ - { - :name => "ubuntu-1204", - :box => "bento/ubuntu-12.04", - :ip => '10.0.0.11', - :cpu => "50", - :ram => "256" - }, - { - :name => "ubuntu-1404", - :box => "bento/ubuntu-14.04", - :ip => '10.0.0.12', - :cpu => "50", - :ram => "256" - }, { :name => "ubuntu-1604", :box => "bento/ubuntu-16.04", - :ip => '10.0.0.13', + :ip => '10.0.0.12', :cpu => "50", :ram => "256" }, { :name => "ubuntu-1804", :box => "bento/ubuntu-18.04", - :ip => '10.0.0.14', + :ip => '10.0.0.13', :cpu => "50", :ram => "384" }, { - :name => "debian-7", - :box => "bento/debian-7", - :ip => '10.0.0.15', + :name => "ubuntu-2004", + :box => "bento/ubuntu-20.04", + :ip => '10.0.0.14', :cpu => "50", - :ram => "256" + :ram => "384" }, { :name => "debian-8", diff --git a/defaults/main.yml b/defaults/main.yml index d521237..ccccb51 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,6 +1,6 @@ # defaults file for percona-client --- -percona_client_version: 5.6 +percona_client_version: 5.7 percona_client_install: [] percona_client_my_cnf_files: [] percona_client_ssl_map: {} diff --git a/meta/main.yml b/meta/main.yml index 14cf8da..a3ed28c 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -10,13 +10,11 @@ galaxy_info: platforms: - name: Ubuntu versions: - - precise - - trusty - xenial - bionic + - focal - name: Debian versions: - - wheezy - jessie - stretch - buster diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml new file mode 100644 index 0000000..be762b2 --- /dev/null +++ b/molecule/default/converge.yml @@ -0,0 +1,6 @@ +--- +- name: Converge + hosts: all + become: true + roles: + - ../../../ diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml new file mode 100644 index 0000000..fbb7120 --- /dev/null +++ b/molecule/default/molecule.yml @@ -0,0 +1,19 @@ +--- +dependency: + name: galaxy +driver: + name: docker +platforms: + - name: instance + image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu1604}-ansible:latest" + command: ${MOLECULE_DOCKER_COMMAND:-""} + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:ro + privileged: true + pre_build_image: true +provisioner: + name: ansible + playbooks: + prepare: prepare.yml + converge: converge.yml + verify: verify.yml diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml new file mode 100644 index 0000000..9a6673d --- /dev/null +++ b/molecule/default/prepare.yml @@ -0,0 +1,5 @@ +--- +- name: Prepare + hosts: all + become: true + tasks: [] diff --git a/molecule/default/verify.yml b/molecule/default/verify.yml new file mode 100644 index 0000000..44debad --- /dev/null +++ b/molecule/default/verify.yml @@ -0,0 +1,5 @@ +--- +- name: Verify + hosts: all + become: true + tasks: [] diff --git a/tasks/repository.yml b/tasks/repository.yml index 016b5a1..5ab8684 100644 --- a/tasks/repository.yml +++ b/tasks/repository.yml @@ -1,15 +1,11 @@ # tasks file for percona-client --- -- name: repository | install | dependencies +- name: repository | install | dependencies (pre) apt: - name: - - dirmngr + name: "{{ percona_client_dependencies_pre }}" state: "{{ apt_install_state | default('latest') }}" update_cache: true cache_valid_time: "{{ apt_update_cache_valid_time | default(3600) }}" - when: - - ansible_distribution == 'Debian' - - ansible_distribution_version is version('9', '>=') tags: - percona-client-repository-install - percona-client-repository-install-dependencies diff --git a/vars/main.yml b/vars/main.yml index e0efe9a..c9a8fe7 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -7,11 +7,15 @@ percona_client_versions_supported: percona_client_repositories: - type: deb - url: "http://repo.percona.com/apt {{ ansible_lsb.codename }}" + url: "http://repo.percona.com/apt {{ ansible_distribution_release }}" component: main - type: deb-src - url: "http://repo.percona.com/apt {{ ansible_lsb.codename }}" + url: "http://repo.percona.com/apt {{ ansible_distribution_release }}" component: main +percona_client_dependencies_pre: + - software-properties-common + - dirmngr + percona_client_dependencies: - "percona-server-client-{{ percona_client_version }}"