From e3a4c72965f7c647ea361c56ecc1df341aa8be41 Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Fri, 19 Feb 2021 13:46:22 +0100 Subject: [PATCH 1/2] Make use of github actions --- .ansible-lint | 3 +- .github/workflows/ci.yml | 80 +++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 20 +++++++++ .travis.yml | 84 ----------------------------------- .yamllint | 15 +++++++ Dockerfile | 3 +- README.md | 2 +- Vagrantfile | 26 +++-------- meta/main.yml | 4 +- molecule/default/converge.yml | 6 +++ molecule/default/molecule.yml | 19 ++++++++ molecule/default/prepare.yml | 5 +++ molecule/default/verify.yml | 5 +++ tasks/main.yml | 64 +++++++++++++------------- tests/post.yml | 5 --- tests/test.yml | 2 - tests/vagrant.yml | 2 - 17 files changed, 195 insertions(+), 150 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .travis.yml create mode 100644 .yamllint create mode 100644 molecule/default/converge.yml create mode 100644 molecule/default/molecule.yml create mode 100644 molecule/default/prepare.yml create mode 100644 molecule/default/verify.yml delete mode 100644 tests/post.yml diff --git a/.ansible-lint b/.ansible-lint index 4778564..dc2585f 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -1,2 +1,3 @@ -skip_list: +warn_list: + - '106' - '306' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..bf43d29 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,80 @@ +--- +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[core] + + - 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 + - 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 0e2328d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,84 +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 - - # Remove parallel - - sudo apt-get remove --purge --yes parallel || true - -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: "bhUfZAhsmgx8aEIWWUmnZqDdrLlT4kfo6QzH3T0YKbUIgi2EGIxrkVjlWkOCQEj3gu/n5DE16Pt1/B3OxfbltkOQFnh7o4/ZUcuQOnsOAFtvrn+SMk+j2o5fXMToEbbN4pvwfHdKv4rZv7fTJ0w9Xk3+x1ny+v31ksH3bkpM2Dwn1nVtB4IiGPpZ3HkPCinfS5a2XOOq2rA1nkdIjIEyNPxHhsi5rlungJd1WGc7TfNQPPZyvO8t1W0VNyhRAZ0USfFTma7HGWbDYi0ZURr2ukayNBB3Dy2VuL73SKmtPW6V3Tm8SaWe2OrqEp3dG0+74bVC0Lo1Inn9VKeDeETh5mP8TihJTgo6ZJy+OEpeErqSvzr5ISA8qhUNmXx+ZDFi0Rj//T5TJ5cl4t4o9OOVR43uUYd2UP6ggSvNXk0dnzojCkU9buY7X0PC3cHDYNHbMZrvarGIs25DJErO/Fn0VEczadW/V8K0ivPWq0/aOHqQL0ny4szcnjXlpwgVF0i604CHJ1JINUALiFWrgIHEzr4iw9SglvDsXHJCHGx7qPDf+vhP8unmIG/TFYLqpHWcX4J8qsG7HT7wrWA2EkPaHYGVKwEo3ZK7oyDj854CVukQptynQnnbQpd1Pe+IpTz7hgeWlCmJJZ5yWE8i01lpTNSDuwe0P1H2TsPb678x9+E=" 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 1c2caba..fc89ab2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,11 +11,10 @@ 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 -ENV USER=root COPY . /etc/ansible/roles/ansible-role WORKDIR /etc/ansible/roles/ansible-role RUN ansible-playbook -i tests/inventory tests/test.yml --connection=local diff --git a/README.md b/README.md index 4ed87c7..6ecd8c0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## gnu-parallel -[![Build Status](https://travis-ci.org/Oefenweb/ansible-gnu-parallel.svg?branch=master)](https://travis-ci.org/Oefenweb/ansible-gnu-parallel) +[![CI](https://github.com/Oefenweb/ansible-gnu-parallel/workflows/CI/badge.svg)](https://github.com/Oefenweb/ansible-gnu-parallel/actions?query=workflow%3ACI) [![Ansible Galaxy](http://img.shields.io/badge/ansible--galaxy-gnu--parallel-blue.svg)](https://galaxy.ansible.com/Oefenweb/gnu-parallel) Set up the latest version of [GNU Parallel](https://www.gnu.org/software/parallel/) in Debian-like systems. 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/meta/main.yml b/meta/main.yml index 1c5b7ca..b3e110d 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/main.yml b/tasks/main.yml index 923e377..6446bc7 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -90,44 +90,38 @@ - gnu-parallel-install - gnu-parallel-install-build -- name: configure - command: > - ./configure - args: - chdir: "{{ gnu_parallel_build_path }}/{{ _version_check.stdout }}" - when: _unarchive is changed - tags: - - configuration - - gnu-parallel - - gnu-parallel-install - - gnu-parallel-install-build - - gnu-parallel-install-build-configure +- block: -- name: make - command: > - make -j{{ ansible_processor_cores + 1 }} - args: - chdir: "{{ gnu_parallel_build_path }}/{{ _version_check.stdout }}" - when: _unarchive is changed - tags: - - configuration - - gnu-parallel - - gnu-parallel-install - - gnu-parallel-install-build - - gnu-parallel-install-build-make + - name: configure + command: > + ./configure + args: + chdir: "{{ gnu_parallel_build_path }}/{{ _version_check.stdout }}" + tags: + - gnu-parallel-install-build-configure + + - name: make + command: > + make -j{{ ansible_processor_cores + 1 }} + args: + chdir: "{{ gnu_parallel_build_path }}/{{ _version_check.stdout }}" + tags: + - gnu-parallel-install-build-make + + - name: make install + command: > + make install + args: + chdir: "{{ gnu_parallel_build_path }}/{{ _version_check.stdout }}" + tags: + - gnu-parallel-install-build-make-install -- name: make install - command: > - make install - args: - chdir: "{{ gnu_parallel_build_path }}/{{ _version_check.stdout }}" when: _unarchive is changed tags: - configuration - gnu-parallel - gnu-parallel-install - gnu-parallel-install-build - - gnu-parallel-install-build-make-install - name: silence citation notice copy: @@ -140,3 +134,13 @@ - configuration - gnu-parallel - gnu-parallel-silence-citation-notice + +- name: verify + command: > + parallel --version + changed_when: false + tags: + - configuration + - gnu-parallel + - gnu-parallel-install + - gnu-parallel-install-verify diff --git a/tests/post.yml b/tests/post.yml deleted file mode 100644 index 9b09b92..0000000 --- a/tests/post.yml +++ /dev/null @@ -1,5 +0,0 @@ -# post test file for gnu-parallel ---- -- name: post | test installation - command: parallel --version - changed_when: false diff --git a/tests/test.yml b/tests/test.yml index 0b053e4..3ad6e67 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -5,5 +5,3 @@ become: true roles: - ../../ - post_tasks: - - include: post.yml diff --git a/tests/vagrant.yml b/tests/vagrant.yml index 9cba743..4aba2e5 100644 --- a/tests/vagrant.yml +++ b/tests/vagrant.yml @@ -5,5 +5,3 @@ become: true roles: - ../../ - post_tasks: - - include: post.yml From 67d8988fb1d126dfc1944a255ae06b389602561d Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Fri, 19 Feb 2021 13:54:01 +0100 Subject: [PATCH 2/2] Consistency changes --- tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/main.yml b/tasks/main.yml index 6446bc7..561d5fa 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -17,7 +17,7 @@ name: parallel state: absent purge: true - when: gnu_parallel_remove_distro_version + when: gnu_parallel_remove_distro_version | bool tags: - configuration - gnu-parallel