From 2599b05bee9ccd992bd231c99b2b64287395551a Mon Sep 17 00:00:00 2001 From: Michael Buluma Date: Sun, 5 Nov 2023 17:43:22 +0300 Subject: [PATCH] Updated Ansible files --- .ansible-lint | 23 ++++++---- .github/FUNDING.yml | 2 + .github/ISSUE_TEMPLATE/bug_report.md | 2 + .github/ISSUE_TEMPLATE/feature_request.md | 2 + .github/settings.yml | 2 +- .github/workflows/galaxy.yml | 4 +- .github/workflows/molecule.yml | 31 ++++++------- .github/workflows/requirements2png.yml | 18 +++----- .github/workflows/todo.yml | 11 ++--- .gitignore | 1 - .gitlab-ci.yml | 55 +++++------------------ .pre-commit-config.yaml | 5 +-- CONTRIBUTING.md | 2 + LICENSE | 4 +- README.md | 44 ++++++++++-------- SECURITY.md | 12 ++--- molecule/default/molecule.yml | 43 +----------------- requirements.txt | 19 ++++---- tox.ini | 20 +++++---- 19 files changed, 117 insertions(+), 183 deletions(-) create mode 100644 .github/FUNDING.yml diff --git a/.ansible-lint b/.ansible-lint index d39bb5d..fa67b68 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -3,11 +3,18 @@ # 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 + - meta/preferences.yml + - molecule/default/prepare.yml + - molecule/default/converge.yml + - molecule/default/verify.yml + - molecule/default/collections.yml + - .tox + - .cache + - .github + - requirements.yml + +skip_list: + - yaml[truthy] + +enable_list: + - name[prefix] diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..5dafe2e --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +--- +github: buluma diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index f8b0654..01ce68e 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -28,3 +28,5 @@ Show at least the error, possible related output, maybe just all the output. - Control node OS: [e.g. Debian 9] (`cat /etc/os-release`) - Control node Ansible version: [e.g. 2.9.1] (`ansible --version`) - Managed node OS: [e.g. CentOS 7] (`cat /etc/os-release`) + +Please consider [sponsoring me](https://github.com/sponsors/buluma). diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index e0512b0..83e7a9f 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -15,3 +15,5 @@ Why is this feature required? ## Additional context Add any other context about the feature request here. + +Please consider [sponsoring me](https://github.com/sponsors/buluma). diff --git a/.github/settings.yml b/.github/settings.yml index 8b5daa7..53de0fd 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -5,4 +5,4 @@ repository: description: Install and configure keepalived homepage: https://buluma.github.io/ - topics: keepalived, ansible, molecule, tox, playbook, hacktoberfest + topics: keepalived, ansible, molecule, tox, playbook diff --git a/.github/workflows/galaxy.yml b/.github/workflows/galaxy.yml index 7e3ea4e..38eca22 100644 --- a/.github/workflows/galaxy.yml +++ b/.github/workflows/galaxy.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-20.04 steps: - name: galaxy - uses: buluma/galaxy-action@v6.25.22 + # uses: buluma/galaxy-action@v6.25.22 # TODO: rebuild action + uses: robertdebock/galaxy-action@1.2.1 with: galaxy_api_key: ${{ secrets.galaxy_api_key }} - git_branch: master diff --git a/.github/workflows/molecule.yml b/.github/workflows/molecule.yml index 9f3b563..ee3e004 100644 --- a/.github/workflows/molecule.yml +++ b/.github/workflows/molecule.yml @@ -6,10 +6,6 @@ name: Ansible Molecule on: - # Schedule updates (once weekly) - schedule: - - cron: '21 11/5 * * 3,4' - workflow_dispatch: push: branches: - master @@ -18,6 +14,11 @@ on: paths-ignore: - '**/README.md' - '**/CHANGELOG.md' + tags_ignore: + - '*' + pull_request: + schedule: + - cron: '21 11 11 * *' concurrency: group: ${{ github.ref }}-${{ github.workflow }} @@ -28,13 +29,9 @@ jobs: runs-on: ubuntu-20.04 steps: - name: checkout - uses: actions/checkout@v3 - with: - path: "${{ github.repository }}" - - name: molecule - uses: buluma/molecule-action@v5.0.1 - with: - command: lint + uses: actions/checkout@v4 + - name: ansible-lint + uses: ansible-community/ansible-lint-action@main test: needs: - lint @@ -50,11 +47,9 @@ jobs: - image: "debian-systemd" tag: "latest" - image: "debian-systemd" - tag: "buster" + tag: "bullseye" - image: "fedora-systemd" - tag: "35" - - image: "fedora-systemd" - tag: "34" + tag: "37" - image: "fedora-systemd" tag: "latest" - image: "docker-opensuse-systemd" @@ -65,9 +60,11 @@ jobs: tag: "focal" - image: "docker-ubuntu-systemd" tag: "bionic" + - image: "docker-ubuntu-systemd" + tag: "lunar" steps: - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: "${{ github.repository }}" - name: disable apparmor for mysql @@ -75,7 +72,7 @@ jobs: - name: parse apparmor for mysql run: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - name: molecule - uses: buluma/molecule-action@v5.0.1 + uses: buluma/molecule-action@v5.0.9 with: image: ${{ matrix.config.image }} tag: ${{ matrix.config.tag }} diff --git a/.github/workflows/requirements2png.yml b/.github/workflows/requirements2png.yml index 604a171..a510c4d 100644 --- a/.github/workflows/requirements2png.yml +++ b/.github/workflows/requirements2png.yml @@ -4,26 +4,23 @@ # on: - workflow_dispatch: - push: {branches: ["master", "main"]} - - -concurrency: - group: ${{ github.ref }}-${{ github.workflow }} - cancel-in-progress: true - + push: + paths: + - '.github/workflows/requirements2png.yml' name: Ansible Graphviz jobs: build: runs-on: ubuntu-20.04 + permissions: + contents: write steps: - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: ${{ github.repository }} - name: create png - uses: buluma/graphviz-action@1.0.0 + uses: buluma/graphviz-action@1.0.0 # TODO: Update action - name: Commit files run: | cd ${{ github.repository }} @@ -34,7 +31,6 @@ jobs: - name: save to png branch uses: ad-m/github-push-action@master with: - github_token: ${{ secrets.GITHUB_TOKEN }} directory: ${{ github.repository }} force: true branch: png diff --git a/.github/workflows/todo.yml b/.github/workflows/todo.yml index c6347d7..7837717 100644 --- a/.github/workflows/todo.yml +++ b/.github/workflows/todo.yml @@ -8,18 +8,13 @@ name: "TODO 2 Issue" on: push: -concurrency: - group: ${{ github.ref }}-${{ github.workflow }} - cancel-in-progress: true - jobs: build: runs-on: "ubuntu-20.04" steps: - - uses: "actions/checkout@v3" + - uses: "actions/checkout@master" - name: "TODO to Issue" - uses: "buluma/todo-to-issue-action@v1.0.1" + uses: "alstr/todo-to-issue-action@v2.3" # TODO: Update buluma/todo-to-issue-action@v1.0.1 @buluma id: "todo" with: - USER_PROJECTS: buluma/Ansible/To do - PROJECTS_SECRET: ${{ secrets.PROJECTS_SECRET }} + TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 21ed080..ad73ff6 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,3 @@ .tox .cache .DS_Store -./molecule_tests.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 556aa97..24586a8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,22 +1,15 @@ --- -image: "buluma/github-action-molecule:4.0.9" - -services: - - docker:dind +image: "buluma/github-action-molecule:5.0.9" variables: - DOCKER_HOST: "tcp://docker:2375" PY_COLORS: 1 molecule: - stage: build - allow_failure: true script: - - if [ -f tox.ini ] ; then tox ; fi - - if [ ! -f tox.ini ] ; then molecule test ; fi + - molecule test rules: - if: $CI_COMMIT_REF_NAME == "master" - retry: 1 + allow_failure: true parallel: matrix: - image: "alpine-openrc" @@ -26,11 +19,9 @@ molecule: - image: "debian-systemd" tag: "latest" - image: "debian-systemd" - tag: "bookworm" - - image: "fedora-systemd" - tag: "35" + tag: "bullseye" - image: "fedora-systemd" - tag: "34" + tag: "37" - image: "fedora-systemd" tag: "latest" - image: "docker-opensuse-systemd" @@ -41,37 +32,11 @@ molecule: tag: "focal" - image: "docker-ubuntu-systemd" tag: "bionic" + - image: "docker-ubuntu-systemd" + tag: "lunar" -testing: - stage: test - needs: [] +galaxy: script: - - if [ -f tox.ini ] ; then tox ; fi - - if [ ! -f tox.ini ] ; then molecule test ; fi + - ansible-galaxy role import --api-key ${GALAXY_API_KEY} buluma ${CI_PROJECT_NAME} rules: - - if: $CI_COMMIT_REF_NAME == "testing" - retry: 1 - parallel: - matrix: - - image: "alpine-openrc" - tag: "latest" - - image: "enterpriselinux" - tag: "8" - - image: "debian-systemd" - tag: "latest" - - image: "debian-systemd" - tag: "bookworm" - - image: "fedora-systemd" - tag: "35" - - image: "fedora-systemd" - tag: "34" - - image: "fedora-systemd" - tag: "latest" - - image: "docker-opensuse-systemd" - tag: "latest" - - image: "docker-ubuntu-systemd" - tag: "latest" - - image: "docker-ubuntu-systemd" - tag: "focal" - - image: "docker-ubuntu-systemd" - tag: "bionic" + - if: $CI_COMMIT_TAG != null diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ca34123..6f3deda 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,14 +1,14 @@ --- repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.4.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer - id: check-added-large-files - repo: https://github.com/adrienverge/yamllint - rev: v1.26.3 + rev: v1.32.0 hooks: - id: yamllint args: [-c=.yamllint] @@ -19,7 +19,6 @@ repos: - id: ansible_role_find_unused_variable - id: ansible_role_find_empty_files - id: ansible_role_find_empty_directories - - id: ansible_role_fix_readability - id: ansible_role_find_undefined_handlers - id: ansible_role_find_unquoted_values - id: ansible_role_find_horizontal_when diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0910f26..37355f8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -72,3 +72,5 @@ In the comment-box, you can [refer to the issue number](https://help.github.com/ Now I'll get a message that you've added some code. Thank you, really. CI starts to test your changes. You can follow the progress on GitHub. + +Please consider [sponsoring me](https://github.com/sponsors/buluma). diff --git a/LICENSE b/LICENSE index a179aa6..5bb4321 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ Apache License - Version 2.0, 08 2022 + Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2022 Michael Buluma (me@buluma.me.ke) + Copyright 2023 Shadow Walker (bulumaknight@gmail.com) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index 2f3745d..27cf703 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,14 @@ Install and configure keepalived -|GitHub|GitLab|Quality|Downloads|Version|Issues|Pull Requests| -|------|------|-------|---------|-------|------|-------------| -|[![github](https://github.com/buluma/ansible-role-keepalived/workflows/Ansible%20Molecule/badge.svg)](https://github.com/buluma/ansible-role-keepalived/actions)|[![gitlab](https://gitlab.com/buluma/ansible-role-keepalived/badges/master/pipeline.svg)](https://gitlab.com/buluma/ansible-role-keepalived)|[![quality](https://img.shields.io/ansible/quality/59138)](https://galaxy.ansible.com/buluma/keepalived)|[![downloads](https://img.shields.io/ansible/role/d/59138)](https://galaxy.ansible.com/buluma/keepalived)|[![Version](https://img.shields.io/github/release/buluma/ansible-role-keepalived.svg)](https://github.com/buluma/ansible-role-keepalived/releases/)|[![Issues](https://img.shields.io/github/issues/buluma/ansible-role-keepalived.svg)](https://github.com/buluma/ansible-role-keepalived/issues/)|[![PullRequests](https://img.shields.io/github/issues-pr-closed-raw/buluma/ansible-role-keepalived.svg)](https://github.com/buluma/ansible-role-keepalived/pulls/)| +|GitHub|GitLab|Downloads|Version|Issues|Pull Requests| +|------|------|-------|-------|------|-------------| +|[![github](https://github.com/buluma/ansible-role-keepalived/workflows/Ansible%20Molecule/badge.svg)](https://github.com/buluma/ansible-role-keepalived/actions)|[![gitlab](https://gitlab.com/shadowwalker/ansible-role-keepalived/badges/master/pipeline.svg)](https://gitlab.com/shadowwalker/ansible-role-keepalived)|[![downloads](https://img.shields.io/ansible/role/d/4745)](https://galaxy.ansible.com/buluma/keepalived)|[![Version](https://img.shields.io/github/release/buluma/ansible-role-keepalived.svg)](https://github.com/buluma/ansible-role-keepalived/releases/)|[![Issues](https://img.shields.io/github/issues/buluma/ansible-role-keepalived.svg)](https://github.com/buluma/ansible-role-keepalived/issues/)|[![PullRequests](https://img.shields.io/github/issues-pr-closed-raw/buluma/ansible-role-keepalived.svg)](https://github.com/buluma/ansible-role-keepalived/pulls/)| ## [Example Playbook](#example-playbook) -This example is taken from `molecule/default/converge.yml` and is tested on each push, pull request and release. +This example is taken from [`molecule/default/converge.yml`](https://github.com/buluma/ansible-role-keepalived/blob/master/molecule/default/converge.yml) and is tested on each push, pull request and release. + ```yaml --- - name: converge @@ -34,7 +35,8 @@ This example is taken from `molecule/default/converge.yml` and is tested on each cidr: 16 ``` -The machine needs to be prepared. In CI this is done using `molecule/default/prepare.yml`: +The machine needs to be prepared. In CI this is done using [`molecule/default/prepare.yml`](https://github.com/buluma/ansible-role-keepalived/blob/master/molecule/default/prepare.yml): + ```yaml --- - name: prepare @@ -46,10 +48,12 @@ The machine needs to be prepared. In CI this is done using `molecule/default/pre - role: buluma.bootstrap ``` +Also see a [full explanation and example](https://buluma.github.io/how-to-use-these-roles.html) on how to use these roles. ## [Role Variables](#role-variables) -The default values for the variables are set in `defaults/main.yml`: +The default values for the variables are set in [`defaults/main.yml`](https://github.com/buluma/ansible-role-keepalived/blob/master/defaults/main.yml): + ```yaml --- # defaults file for keepalived @@ -95,15 +99,15 @@ keepalived_vrrp_instances: [] ## [Requirements](#requirements) -- pip packages listed in [requirements.txt](https://github.com/buluma/ansible-role-keepalived/blob/main/requirements.txt). +- pip packages listed in [requirements.txt](https://github.com/buluma/ansible-role-keepalived/blob/master/requirements.txt). -## [Status of used roles](#status-of-requirements) +## [State of used roles](#state-of-used-roles) The following roles are used to prepare a system. You can prepare your system in another way. | Requirement | GitHub | GitLab | |-------------|--------|--------| -|[buluma.bootstrap](https://galaxy.ansible.com/buluma/bootstrap)|[![Build Status GitHub](https://github.com/buluma/ansible-role-bootstrap/workflows/Ansible%20Molecule/badge.svg)](https://github.com/buluma/ansible-role-bootstrap/actions)|[![Build Status GitLab ](https://gitlab.com/buluma/ansible-role-bootstrap/badges/master/pipeline.svg)](https://gitlab.com/buluma/ansible-role-bootstrap)| +|[buluma.bootstrap](https://galaxy.ansible.com/buluma/bootstrap)|[![Build Status GitHub](https://github.com/buluma/ansible-role-bootstrap/workflows/Ansible%20Molecule/badge.svg)](https://github.com/buluma/ansible-role-bootstrap/actions)|[![Build Status GitLab](https://gitlab.com/shadowwalker/ansible-role-bootstrap/badges/master/pipeline.svg)](https://gitlab.com/shadowwalker/ansible-role-bootstrap)| ## [Context](#context) @@ -119,12 +123,12 @@ This role has been tested on these [container images](https://hub.docker.com/u/b |container|tags| |---------|----| -|alpine|all| -|el|8| -|debian|all| -|fedora|all| -|opensuse|all| -|ubuntu|all| +|[Alpine](https://hub.docker.com/repository/docker/buluma/alpine/general)|all| +|[EL](https://hub.docker.com/repository/docker/buluma/enterpriselinux/general)|8| +|[Debian](https://hub.docker.com/repository/docker/buluma/debian/general)|all| +|[Fedora](https://hub.docker.com/repository/docker/buluma/fedora/general)|all| +|[opensuse](https://hub.docker.com/repository/docker/buluma/opensuse/general)|all| +|[Ubuntu](https://hub.docker.com/repository/docker/buluma/ubuntu/general)|all| The minimum version of Ansible required is 2.10, tests have been done to: @@ -132,8 +136,6 @@ The minimum version of Ansible required is 2.10, tests have been done to: - The current version. - The development version. - - If you find issues, please register them in [GitHub](https://github.com/buluma/ansible-role-keepalived/issues) ## [Changelog](#changelog) @@ -142,8 +144,14 @@ If you find issues, please register them in [GitHub](https://github.com/buluma/a ## [License](#license) -Apache-2.0 +[Apache-2.0](https://github.com/buluma/ansible-role-keepalived/blob/master/LICENSE). ## [Author Information](#author-information) [buluma](https://buluma.github.io/) + +Please consider [sponsoring me](https://github.com/sponsors/buluma). + +### [Special Thanks](#special-thanks) + +Template inspired by [Robert de Bock](https://github.com/robertdebock) diff --git a/SECURITY.md b/SECURITY.md index b2d35fc..bda3391 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -4,15 +4,13 @@ This software implements other software, it's not very likely that this software ## [Supported Versions](#supported-versions) -The current major version is supported. For example if the current version is 3.4.1: +These version of [ansible](https://pypi.org/project/ansible/) are supported: | Version | Supported | | ------- | ------------------ | -| 3.4.1 | :white_check_mark: | -| 3.4.x | :white_check_mark: | -| 3.x.x | :white_check_mark: | -| 2.0.0 | :x: | -| 1.0.0 | :x: | +| 7 | :white_check_mark: | +| 6 | :white_check_mark: | +| 5 | :white_check_mark: | ## [Reporting a Vulnerability](#reporting-a-vulnarability) @@ -21,3 +19,5 @@ Please [open an issue](https://github.com/buluma/ansible-role-keepalived/issues) Tell them where to go, how often they can expect to get an update on a reported vulnerability, what to expect if the vulnerability is accepted or declined, etc. + +Please consider [sponsoring me](https://github.com/sponsors/buluma). diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index b9ac8bf..3913e78 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -18,50 +18,11 @@ platforms: image: "${namespace:-buluma}/${image:-fedora}:${tag:-latest}" command: /sbin/init volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro + - /sys/fs/cgroup:/sys/fs/cgroup:rw + cgroupns_mode: host privileged: yes pre_build_image: yes - tty: true - environment: - container: docker provisioner: name: ansible - config_options: - defaults: - interpreter_python: auto_legacy_silent - ssh_connection: - pipelining: true verifier: name: ansible -scenario: - create_sequence: - - create - - prepare - check_sequence: - - cleanup - - destroy - - create - - prepare - - converge - - check - - destroy - converge_sequence: - - create - - prepare - - converge - destroy_sequence: - - cleanup - - destroy - test_sequence: - - lint - - cleanup - - destroy - - syntax - - create - - prepare - - converge - - idempotence - - side_effect - - verify - - cleanup - - destroy diff --git a/requirements.txt b/requirements.txt index b0bf89c..09b3a84 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,8 @@ -# These role have been tested with these PIP component. -# To install the required version yourself, use a command as: -# `python -m pip --user install -r requirements.txt` -# See the pip requirements file documentation for details: -# https://pip.pypa.io/en/stable/user_guide/#requirements-files -# -# Tests run on the previous and current (latest) version of Ansible. -ansible>=2.10 -# Some Jinja2 filters are used that are available in the newer releases. -jinja2>=2.11.2 -jmespath +# Pinning ansible-compat version due to [bug](https://github.com/ansible-community/molecule/issues/3903) +ansible-compat == 3.0.2 +molecule == 5.* +molecule-plugins[docker] == 23.* +ansible-lint == 6.* +paramiko == 3.* +# Pinning requests version due to [bug](https://github.com/docker/docker-py/issues/3113) +requests == 2.28.1 diff --git a/tox.ini b/tox.ini index d9a487a..699c9eb 100644 --- a/tox.ini +++ b/tox.ini @@ -2,19 +2,17 @@ # Ansible managed # [tox] -minversion = 3.21.4 -envlist = py{310}-ansible-{4,5,6} +minversion = 4.2.4 +envlist = py3-ansible{6,7,8} skipsdist = true [testenv] deps = - 4: ansible == 4.* - 5: ansible == 5.* - 6: ansible == 6.* - molecule[docker] - docker == 5.* - ansible-lint == 5.* + -rrequirements.txt + ansible6: ansible == 6.* + ansible7: ansible == 7.* + ansible8: ansible == 8.* commands = molecule test setenv = TOX_ENVNAME={envname} @@ -22,4 +20,8 @@ setenv = ANSIBLE_FORCE_COLOR=1 ANSIBLE_ROLES_PATH=../ -passenv = namespace image tag DOCKER_HOST +passenv = + namespace + image + tag + DOCKER_HOST