From 4f792f71ebc529c50ccd8ee5a380241cd266d1eb Mon Sep 17 00:00:00 2001 From: Robert de Bock Date: Sun, 21 Mar 2021 08:00:28 +0100 Subject: [PATCH] New stuff. --- .gitignore | 1 + inventory/group_vars/all.yml | 136 ++++++++++++++ lijst.txt | 68 +++++++ roles/ansible/.ansible-lint | 4 + roles/ansible/.github 2/FUNDING.yml | 2 - .../.github 2/pull_request_template.md | 11 -- roles/ansible/.github 2/settings.yml | 7 - roles/ansible/.github/settings.yml | 1 + roles/ansible/.github/workflows/galaxy.yml | 12 +- roles/ansible/.github/workflows/molecule.yml | 19 +- roles/ansible/.gitignore | 1 + roles/ansible/.gitignore 2 | 4 - roles/ansible/.travis.yml | 29 +-- roles/ansible/.yamllint | 1 + roles/ansible/LICENSE | 2 +- roles/ansible/README.md | 84 ++------- roles/ansible/meta 2/.galaxy_install_info | 2 - roles/ansible/meta 2/exception.yml | 4 - roles/ansible/meta 2/preferences.yml | 2 - roles/ansible/meta/.galaxy_install_info | 4 +- roles/ansible/meta/main.yml | 7 +- roles/ansible/molecule 2/default/converge.yml | 8 - roles/ansible/molecule 2/default/prepare.yml | 11 -- roles/ansible/molecule 2/default/verify.yml | 11 -- roles/ansible/molecule/default/molecule.yml | 2 + roles/ansible/requirements 2.yml | 5 - roles/ansible/requirements.yml | 11 +- roles/ansible/tasks/assert.yml | 9 +- roles/ansible/tasks/main.yml | 15 +- roles/ansible/tox.ini | 22 +-- roles/ansible_lint/.ansible-lint | 4 + roles/ansible_lint/.github 2/FUNDING.yml | 2 - .../.github 2/pull_request_template.md | 11 -- roles/ansible_lint/.github 2/settings.yml | 7 - roles/ansible_lint/.github/settings.yml | 1 + .../ansible_lint/.github/workflows/galaxy.yml | 12 +- .../.github/workflows/molecule.yml | 15 +- roles/ansible_lint/.gitignore | 1 + roles/ansible_lint/.gitignore 2 | 4 - roles/ansible_lint/.travis.yml | 25 +-- roles/ansible_lint/.yamllint | 1 + roles/ansible_lint/LICENSE | 2 +- roles/ansible_lint/README.md | 82 ++------ .../ansible_lint/meta 2/.galaxy_install_info | 2 - roles/ansible_lint/meta 2/exception.yml | 6 - roles/ansible_lint/meta 2/preferences.yml | 2 - roles/ansible_lint/meta/.galaxy_install_info | 4 +- roles/ansible_lint/meta/main.yml | 12 +- .../molecule/default/molecule.yml | 1 + roles/ansible_lint/requirements 2.yml | 5 - roles/ansible_lint/requirements.yml | 9 +- roles/ansible_lint/tasks/main.yml | 3 +- roles/ansible_lint/tox.ini | 22 +-- roles/ansible_lint/vars 2/main.yml | 5 - roles/ara/.ansible-lint | 4 + roles/ara/.github 2/FUNDING.yml | 2 - roles/ara/.github 2/pull_request_template.md | 11 -- roles/ara/.github 2/settings.yml | 7 - roles/ara/.github/settings.yml | 1 + roles/ara/.github/workflows/galaxy.yml | 12 +- roles/ara/.github/workflows/molecule.yml | 13 +- roles/ara/.gitignore | 1 + roles/ara/.gitignore 2 | 4 - roles/ara/.travis.yml | 23 +-- roles/ara/.yamllint | 1 + roles/ara/LICENSE | 2 +- roles/ara/README.md | 84 ++------- roles/ara/handlers/main.yml | 7 +- roles/ara/meta 2/.galaxy_install_info | 2 - roles/ara/meta 2/preferences.yml | 2 - roles/ara/meta/.galaxy_install_info | 4 +- roles/ara/meta/exception.yml | 4 +- roles/ara/meta/main.yml | 6 +- roles/ara/molecule 2/default/converge.yml | 8 - roles/ara/molecule 2/default/prepare.yml | 11 -- roles/ara/molecule 2/default/verify.yml | 9 - roles/ara/molecule/default/molecule.yml | 2 + roles/ara/requirements.yml | 13 +- roles/ara/tasks/assert.yml | 17 +- roles/ara/tasks/main.yml | 72 +++---- roles/ara/tox.ini | 22 +-- roles/ara/vars/main.yml | 6 - roles/atom/.ansible-lint | 4 + roles/atom/.github 2/FUNDING.yml | 2 - roles/atom/.github 2/pull_request_template.md | 11 -- roles/atom/.github 2/settings.yml | 7 - roles/atom/.github/settings.yml | 1 + roles/atom/.github/workflows/galaxy.yml | 12 +- roles/atom/.github/workflows/molecule.yml | 17 +- roles/atom/.gitignore | 1 + roles/atom/.gitignore 2 | 4 - roles/atom/.travis.yml | 26 +-- roles/atom/.yamllint | 1 + roles/atom/LICENSE | 2 +- roles/atom/README.md | 77 ++------ roles/atom/meta 2/.galaxy_install_info | 2 - roles/atom/meta 2/exception.yml | 6 - roles/atom/meta 2/preferences.yml | 2 - roles/atom/meta/.galaxy_install_info | 4 +- roles/atom/meta/exception.yml | 2 + roles/atom/meta/main.yml | 10 +- roles/atom/molecule 2/default/converge.yml | 8 - roles/atom/molecule 2/default/prepare.yml | 8 - roles/atom/molecule 2/default/verify.yml | 9 - roles/atom/molecule/default/molecule.yml | 2 + roles/atom/requirements 2.yml | 2 - roles/atom/requirements.yml | 5 +- roles/atom/tasks/assert.yml | 4 +- roles/atom/tasks/main.yml | 24 +-- roles/atom/tox.ini | 22 +-- roles/atom/vars/main.yml | 4 +- roles/bootstrap/.ansible-lint | 5 + roles/bootstrap/.ansible-lint 2 | 7 - roles/bootstrap/.github 2/FUNDING.yml | 2 - .../.github 2/pull_request_template.md | 11 -- roles/bootstrap/.github 2/settings.yml | 7 - roles/bootstrap/.github/settings.yml | 1 + roles/bootstrap/.github/workflows/galaxy.yml | 12 +- .../bootstrap/.github/workflows/molecule.yml | 21 +-- roles/bootstrap/.gitignore | 1 + roles/bootstrap/.gitignore 2 | 4 - roles/bootstrap/.travis.yml | 30 +-- roles/bootstrap/.yamllint | 1 + roles/bootstrap/LICENSE | 2 +- roles/bootstrap/README.md | 83 ++------- roles/bootstrap/defaults/main.yml | 3 - roles/bootstrap/meta 2/.galaxy_install_info | 2 - roles/bootstrap/meta 2/preferences.yml | 2 - roles/bootstrap/meta/.galaxy_install_info | 4 +- roles/bootstrap/meta/main.yml | 25 +-- .../bootstrap/molecule 2/default/converge.yml | 8 - roles/bootstrap/molecule 2/default/verify.yml | 9 - roles/bootstrap/molecule/default/molecule.yml | 1 + roles/bootstrap/molecule/default/verify.yml | 5 + roles/bootstrap/tasks/assert.yml | 21 +-- roles/bootstrap/tasks/gather_facts.yml | 9 +- roles/bootstrap/tasks/main.yml | 33 ++-- roles/bootstrap/tox.ini | 22 +-- roles/bootstrap/vars/main.yml | 2 +- roles/buildtools/.ansible-lint | 4 + roles/buildtools/.github 2/FUNDING.yml | 2 - .../.github 2/pull_request_template.md | 11 -- roles/buildtools/.github 2/settings.yml | 7 - roles/buildtools/.github/settings.yml | 1 + roles/buildtools/.github/workflows/galaxy.yml | 12 +- .../buildtools/.github/workflows/molecule.yml | 19 +- roles/buildtools/.gitignore | 1 + roles/buildtools/.gitignore 2 | 4 - roles/buildtools/.travis.yml | 30 +-- roles/buildtools/.yamllint | 1 + roles/buildtools/LICENSE | 2 +- roles/buildtools/README.md | 97 ++-------- roles/buildtools/meta 2/.galaxy_install_info | 2 - roles/buildtools/meta 2/exception.yml | 4 - roles/buildtools/meta 2/preferences.yml | 2 - roles/buildtools/meta/.galaxy_install_info | 4 +- roles/buildtools/meta/main.yml | 9 +- .../molecule 2/default/converge.yml | 8 - .../buildtools/molecule 2/default/prepare.yml | 8 - .../buildtools/molecule/default/molecule.yml | 1 + roles/buildtools/molecule/default/verify.yml | 12 -- roles/buildtools/requirements 2.yml | 2 - roles/buildtools/requirements.yml | 3 +- roles/buildtools/tasks/main.yml | 3 +- roles/buildtools/tox.ini | 22 +-- roles/common/.ansible-lint | 4 + roles/common/.github 2/FUNDING.yml | 2 - .../common/.github 2/pull_request_template.md | 11 -- roles/common/.github 2/settings.yml | 7 - roles/common/.github/settings.yml | 1 + roles/common/.github/workflows/galaxy.yml | 12 +- roles/common/.github/workflows/molecule.yml | 19 +- roles/common/.gitignore | 1 + roles/common/.gitignore 2 | 4 - roles/common/.travis.yml | 30 +-- roles/common/.yamllint | 1 + roles/common/LICENSE | 2 +- roles/common/README.md | 76 ++------ roles/common/handlers/main.yml | 7 +- roles/common/meta 2/.galaxy_install_info | 2 - roles/common/meta 2/exception.yml | 4 - roles/common/meta 2/preferences.yml | 2 - roles/common/meta/.galaxy_install_info | 4 +- roles/common/meta/main.yml | 12 +- roles/common/molecule 2/default/converge.yml | 8 - roles/common/molecule 2/default/prepare.yml | 8 - roles/common/molecule 2/default/verify.yml | 9 - roles/common/molecule/default/molecule.yml | 2 + roles/common/requirements 2.yml | 2 - roles/common/requirements.yml | 5 +- roles/common/tasks/assert.yml | 15 +- roles/common/tasks/main.yml | 78 ++++---- roles/common/templates/hosts.j2 | 2 +- roles/common/tox.ini | 22 +-- roles/docker/.ansible-lint | 4 + roles/docker/.github 2/FUNDING.yml | 2 - .../docker/.github 2/pull_request_template.md | 11 -- roles/docker/.github 2/settings.yml | 7 - roles/docker/.github/settings.yml | 1 + roles/docker/.github/workflows/galaxy.yml | 12 +- roles/docker/.github/workflows/molecule.yml | 21 +-- roles/docker/.gitignore | 1 + roles/docker/.gitignore 2 | 4 - roles/docker/.travis.yml | 29 +-- roles/docker/.yamllint | 1 + roles/docker/LICENSE | 2 +- roles/docker/README.md | 91 ++------- roles/docker/handlers/main.yml | 3 +- roles/docker/meta 2/.galaxy_install_info | 2 - roles/docker/meta 2/exception.yml | 6 - roles/docker/meta 2/preferences.yml | 2 - roles/docker/meta/.galaxy_install_info | 4 +- roles/docker/meta/main.yml | 9 +- roles/docker/molecule 2/default/converge.yml | 8 - roles/docker/molecule 2/default/prepare.yml | 12 -- roles/docker/molecule 2/default/verify.yml | 15 -- roles/docker/molecule/default/molecule.yml | 1 + roles/docker/requirements.yml | 11 +- roles/docker/tasks/main.yml | 9 +- roles/docker/tox.ini | 22 +-- roles/docker/vars/main.yml | 4 - roles/epel/.ansible-lint | 4 + roles/epel/.ansible-lint 2 | 7 - roles/epel/.github 2/FUNDING.yml | 2 - roles/epel/.github 2/pull_request_template.md | 11 -- roles/epel/.github 2/settings.yml | 7 - roles/epel/.github/settings.yml | 1 + roles/epel/.github/workflows/galaxy.yml | 12 +- roles/epel/.github/workflows/molecule.yml | 13 +- roles/epel/.gitignore | 1 + roles/epel/.gitignore 2 | 4 - roles/epel/.travis.yml | 21 +-- roles/epel/.yamllint | 1 + roles/epel/LICENSE | 2 +- roles/epel/README.md | 76 ++------ roles/epel/handlers 2/main.yml | 5 - roles/epel/handlers/main.yml | 3 +- roles/epel/meta 2/.galaxy_install_info | 2 - roles/epel/meta 2/preferences.yml | 2 - roles/epel/meta/.galaxy_install_info | 4 +- roles/epel/meta/main.yml | 8 +- roles/epel/molecule 2/default/converge.yml | 8 - roles/epel/molecule 2/default/prepare.yml | 8 - roles/epel/molecule 2/default/verify.yml | 11 -- roles/epel/molecule/default/molecule.yml | 1 + roles/epel/requirements 2.yml | 2 - roles/epel/requirements.yml | 3 +- roles/epel/tasks/main.yml | 30 +-- roles/epel/tox.ini | 22 +-- roles/fail2ban/.ansible-lint | 4 + roles/fail2ban/.github 2/FUNDING.yml | 2 - .../.github 2/pull_request_template.md | 11 -- roles/fail2ban/.github 2/settings.yml | 7 - roles/fail2ban/.github/settings.yml | 1 + roles/fail2ban/.github/workflows/galaxy.yml | 12 +- roles/fail2ban/.github/workflows/molecule.yml | 19 +- roles/fail2ban/.gitignore | 1 + roles/fail2ban/.gitignore 2 | 4 - roles/fail2ban/.travis.yml | 28 +-- roles/fail2ban/.yamllint | 1 + roles/fail2ban/LICENSE | 2 +- roles/fail2ban/README.md | 83 ++------- roles/fail2ban/handlers/main.yml | 5 +- roles/fail2ban/meta 2/.galaxy_install_info | 2 - roles/fail2ban/meta 2/exception.yml | 6 - roles/fail2ban/meta 2/preferences.yml | 2 - roles/fail2ban/meta/.galaxy_install_info | 4 +- roles/fail2ban/meta/exception.yml | 4 +- roles/fail2ban/meta/main.yml | 10 +- .../fail2ban/molecule 2/default/converge.yml | 8 - roles/fail2ban/molecule 2/default/prepare.yml | 9 - roles/fail2ban/molecule 2/default/verify.yml | 9 - roles/fail2ban/molecule/default/molecule.yml | 2 + roles/fail2ban/requirements 2.yml | 3 - roles/fail2ban/requirements.yml | 7 +- roles/fail2ban/tasks/assert.yml | 65 ++++--- roles/fail2ban/tasks/main.yml | 17 +- roles/fail2ban/tox.ini | 22 +-- roles/git/.ansible-lint | 4 + roles/git/.ansible-lint 2 | 7 - roles/git/.github 2/FUNDING.yml | 2 - roles/git/.github 2/pull_request_template.md | 11 -- roles/git/.github 2/settings.yml | 7 - roles/git/.github/settings.yml | 1 + roles/git/.github/workflows/galaxy.yml | 12 +- roles/git/.github/workflows/molecule.yml | 19 +- roles/git/.gitignore | 1 + roles/git/.gitignore 2 | 4 - roles/git/.travis.yml | 30 +-- roles/git/.yamllint | 1 + roles/git/LICENSE | 2 +- roles/git/README.md | 76 ++------ roles/git/meta 2/.galaxy_install_info | 2 - roles/git/meta 2/preferences.yml | 2 - roles/git/meta/.galaxy_install_info | 4 +- roles/git/meta/main.yml | 10 +- roles/git/molecule/default/molecule.yml | 1 + roles/git/requirements 2.yml | 2 - roles/git/requirements.yml | 3 +- roles/git/tasks/assert.yml | 61 +----- roles/git/tasks/main.yml | 17 +- roles/git/templates 2/gitconfig.j2 | 3 - roles/git/templates/gitconfig.j2 | 2 + roles/git/tox.ini | 22 +-- roles/git/vars 2/main.yml | 5 - roles/investigate/.ansible-lint | 4 + roles/investigate/.ansible-lint 2 | 7 - roles/investigate/.github 2/FUNDING.yml | 2 - .../.github 2/pull_request_template.md | 11 -- roles/investigate/.github 2/settings.yml | 7 - roles/investigate/.github/settings.yml | 1 + .../investigate/.github/workflows/galaxy.yml | 12 +- .../.github/workflows/molecule.yml | 19 +- roles/investigate/.gitignore | 1 + roles/investigate/.gitignore 2 | 4 - roles/investigate/.travis.yml | 30 +-- roles/investigate/.yamllint | 1 + roles/investigate/LICENSE | 2 +- roles/investigate/README.md | 78 ++------ roles/investigate/meta 2/.galaxy_install_info | 2 - roles/investigate/meta 2/preferences.yml | 2 - roles/investigate/meta/.galaxy_install_info | 4 +- roles/investigate/meta/main.yml | 9 +- .../investigate/molecule/default/molecule.yml | 1 + roles/investigate/requirements 2.yml | 3 - roles/investigate/requirements.yml | 5 +- roles/investigate/tasks/main.yml | 3 +- roles/investigate/tox.ini | 22 +-- roles/molecule/.ansible-lint | 4 + roles/molecule/.github 2/FUNDING.yml | 2 - .../.github 2/pull_request_template.md | 11 -- roles/molecule/.github 2/settings.yml | 7 - roles/molecule/.github/settings.yml | 1 + roles/molecule/.github/workflows/galaxy.yml | 12 +- roles/molecule/.github/workflows/molecule.yml | 17 +- roles/molecule/.gitignore | 1 + roles/molecule/.gitignore 2 | 4 - roles/molecule/.travis.yml | 25 +-- roles/molecule/.yamllint | 1 + roles/molecule/LICENSE | 2 +- roles/molecule/README.md | 82 ++------ roles/molecule/meta 2/.galaxy_install_info | 2 - roles/molecule/meta 2/preferences.yml | 2 - roles/molecule/meta/.galaxy_install_info | 4 +- roles/molecule/meta/exception.yml | 6 +- roles/molecule/meta/main.yml | 9 +- .../molecule/molecule 2/default/converge.yml | 8 - roles/molecule/molecule 2/default/prepare.yml | 11 -- roles/molecule/molecule 2/default/verify.yml | 9 - roles/molecule/molecule/default/molecule.yml | 1 + roles/molecule/requirements 2.yml | 5 - roles/molecule/requirements.yml | 9 +- roles/molecule/tasks/assert.yml | 8 - roles/molecule/tasks/main.yml | 8 +- roles/molecule/tox.ini | 22 +-- roles/molecule/vars/main.yml | 8 +- roles/postfix/.ansible-lint | 4 + roles/postfix/.github 2/FUNDING.yml | 2 - .../.github 2/pull_request_template.md | 11 -- roles/postfix/.github 2/settings.yml | 7 - roles/postfix/.github/settings.yml | 1 + roles/postfix/.github/workflows/galaxy.yml | 12 +- roles/postfix/.github/workflows/molecule.yml | 15 +- roles/postfix/.gitignore | 1 + roles/postfix/.gitignore 2 | 4 - roles/postfix/.travis.yml | 27 +-- roles/postfix/.yamllint | 1 + roles/postfix/LICENSE | 2 +- roles/postfix/README.md | 95 +++------- roles/postfix/defaults/main.yml | 5 +- roles/postfix/files/my-postfix.te | 10 - roles/postfix/handlers/main.yml | 27 +-- roles/postfix/meta 2/.galaxy_install_info | 2 - roles/postfix/meta 2/exception.yml | 6 - roles/postfix/meta 2/preferences.yml | 2 - roles/postfix/meta/.galaxy_install_info | 4 +- roles/postfix/meta/main.yml | 7 +- roles/postfix/molecule/default/converge.yml | 1 + roles/postfix/molecule/default/molecule.yml | 1 + roles/postfix/requirements 2.yml | 3 - roles/postfix/requirements.yml | 5 +- roles/postfix/tasks/assert.yml | 39 ++-- roles/postfix/tasks/main.yml | 69 +++---- roles/postfix/templates/main.cf.j2 | 14 +- roles/postfix/tox.ini | 22 +-- roles/postfix/vars/main.yml | 8 +- roles/python_pip/.ansible-lint | 4 + roles/python_pip/.github 2/FUNDING.yml | 2 - .../.github 2/pull_request_template.md | 11 -- roles/python_pip/.github 2/settings.yml | 7 - roles/python_pip/.github/settings.yml | 1 + roles/python_pip/.github/workflows/galaxy.yml | 12 +- .../python_pip/.github/workflows/molecule.yml | 21 +-- roles/python_pip/.gitignore | 1 + roles/python_pip/.gitignore 2 | 4 - roles/python_pip/.travis.yml | 29 +-- roles/python_pip/.yamllint | 1 + roles/python_pip/LICENSE | 2 +- roles/python_pip/README.md | 107 +++-------- roles/python_pip/defaults/main.yml | 6 + roles/python_pip/meta 2/.galaxy_install_info | 2 - roles/python_pip/meta 2/exception.yml | 6 - roles/python_pip/meta 2/preferences.yml | 2 - roles/python_pip/meta/.galaxy_install_info | 4 +- roles/python_pip/meta/exception.yml | 10 +- roles/python_pip/meta/main.yml | 11 +- .../molecule 2/default/converge.yml | 8 - .../python_pip/molecule 2/default/prepare.yml | 10 - .../python_pip/molecule/default/molecule.yml | 2 + roles/python_pip/molecule/default/verify.yml | 21 +++ roles/python_pip/requirements 2.yml | 4 - roles/python_pip/requirements.yml | 9 +- roles/python_pip/tasks/assert.yml | 46 +++-- roles/python_pip/tasks/main.yml | 26 ++- roles/python_pip/tox.ini | 22 +-- roles/python_pip/vars/main.yml | 9 +- roles/reboot/.ansible-lint | 4 + roles/reboot/.ansible-lint 2 | 7 - roles/reboot/.github 2/FUNDING.yml | 2 - .../reboot/.github 2/pull_request_template.md | 11 -- roles/reboot/.github 2/settings.yml | 7 - roles/reboot/.github/settings.yml | 1 + roles/reboot/.github/workflows/galaxy.yml | 12 +- roles/reboot/.github/workflows/molecule.yml | 19 +- roles/reboot/.gitignore | 1 + roles/reboot/.gitignore 2 | 4 - roles/reboot/.travis.yml | 30 +-- roles/reboot/.yamllint | 1 + roles/reboot/LICENSE | 2 +- roles/reboot/README.md | 76 ++------ roles/reboot/meta 2/.galaxy_install_info | 2 - roles/reboot/meta 2/preferences.yml | 2 - roles/reboot/meta/.galaxy_install_info | 4 +- roles/reboot/meta/main.yml | 10 +- roles/reboot/molecule 2/default/converge.yml | 8 - roles/reboot/molecule 2/default/prepare.yml | 8 - roles/reboot/molecule 2/default/verify.yml | 9 - roles/reboot/requirements 2.yml | 2 - roles/reboot/requirements.yml | 3 +- roles/reboot/tasks/assert.yml | 21 ++- roles/reboot/tasks/main.yml | 49 +++-- roles/reboot/tasks/reboot.yml | 10 +- roles/reboot/tox.ini | 19 +- roles/ruby/.ansible-lint | 5 + roles/ruby/.ansible-lint 2 | 6 - roles/ruby/.github 2/FUNDING.yml | 2 - roles/ruby/.github 2/pull_request_template.md | 11 -- roles/ruby/.github 2/settings.yml | 7 - roles/ruby/.github/settings.yml | 1 + roles/ruby/.github/workflows/galaxy.yml | 12 +- roles/ruby/.github/workflows/molecule.yml | 19 +- roles/ruby/.gitignore | 1 + roles/ruby/.gitignore 2 | 4 - roles/ruby/.travis.yml | 30 +-- roles/ruby/.yamllint | 4 + roles/ruby/LICENSE | 2 +- roles/ruby/README.md | 76 ++------ roles/ruby/meta 2/.galaxy_install_info | 2 - roles/ruby/meta 2/preferences.yml | 2 - roles/ruby/meta/.galaxy_install_info | 4 +- roles/ruby/meta/main.yml | 10 +- roles/ruby/molecule 2/default/converge.yml | 8 - roles/ruby/molecule 2/default/prepare.yml | 8 - roles/ruby/molecule 2/default/verify.yml | 9 - roles/ruby/molecule/default/molecule.yml | 6 +- roles/ruby/molecule/default/verify.yml | 2 +- roles/ruby/requirements 2.yml | 2 - roles/ruby/requirements.yml | 3 +- roles/ruby/tasks 2/main.yml | 5 - roles/ruby/tasks/main.yml | 3 +- roles/ruby/tox.ini | 22 +-- roles/ruby/vars 2/main.yml | 5 - roles/service/.ansible-lint | 4 + roles/service/.ansible-lint 2 | 7 - roles/service/.github 2/FUNDING.yml | 2 - .../.github 2/pull_request_template.md | 11 -- roles/service/.github 2/settings.yml | 7 - roles/service/.github/settings.yml | 1 + roles/service/.github/workflows/galaxy.yml | 12 +- roles/service/.github/workflows/molecule.yml | 21 +-- roles/service/.gitignore | 1 + roles/service/.gitignore 2 | 4 - roles/service/.travis.yml | 30 +-- roles/service/.yamllint | 1 + roles/service/LICENSE | 2 +- roles/service/README.md | 175 +++++++----------- roles/service/handlers/main.yml | 5 +- roles/service/meta 2/.galaxy_install_info | 2 - roles/service/meta 2/preferences.yml | 2 - roles/service/meta/.galaxy_install_info | 4 +- roles/service/meta/main.yml | 14 +- roles/service/molecule/default/converge.yml | 78 ++++---- roles/service/molecule/default/molecule.yml | 2 +- roles/service/molecule/default/prepare.yml | 7 + roles/service/molecule/default/verify.yml | 21 ++- roles/service/requirements 2.yml | 2 - roles/service/requirements.yml | 3 +- roles/service/tasks/assert.yml | 102 ++++------ roles/service/tasks/main.yml | 29 ++- roles/service/templates/systemd.j2 | 6 + roles/service/templates/sysvinit.j2 | 16 +- roles/service/tox.ini | 22 +-- roles/service/vars/main.yml | 6 +- roles/travis/.ansible-lint | 5 + roles/travis/.github 2/FUNDING.yml | 2 - .../travis/.github 2/pull_request_template.md | 11 -- roles/travis/.github 2/settings.yml | 7 - roles/travis/.github/settings.yml | 1 + roles/travis/.github/workflows/galaxy.yml | 12 +- roles/travis/.github/workflows/molecule.yml | 15 +- roles/travis/.gitignore | 1 + roles/travis/.gitignore 2 | 4 - roles/travis/.travis.yml | 26 +-- roles/travis/.yamllint | 4 + roles/travis/LICENSE | 2 +- roles/travis/README.md | 81 ++------ roles/travis/meta 2/.galaxy_install_info | 2 - roles/travis/meta 2/exception.yml | 6 - roles/travis/meta 2/preferences.yml | 2 - roles/travis/meta/.galaxy_install_info | 4 +- roles/travis/meta/exception.yml | 6 +- roles/travis/meta/main.yml | 4 +- roles/travis/molecule 2/default/converge.yml | 8 - roles/travis/molecule 2/default/prepare.yml | 10 - roles/travis/molecule 2/default/verify.yml | 9 - roles/travis/molecule/default/molecule.yml | 7 +- roles/travis/molecule/default/verify.yml | 2 +- roles/travis/requirements 2.yml | 4 - roles/travis/requirements.yml | 9 +- roles/travis/tasks/main.yml | 5 +- roles/travis/tox.ini | 22 +-- roles/update/.ansible-lint | 5 + roles/update/.github 2/FUNDING.yml | 2 - .../update/.github 2/pull_request_template.md | 11 -- roles/update/.github 2/settings.yml | 7 - roles/update/.github/settings.yml | 1 + roles/update/.github/workflows/galaxy.yml | 12 +- roles/update/.github/workflows/molecule.yml | 19 +- roles/update/.gitignore | 1 + roles/update/.gitignore 2 | 4 - roles/update/.travis.yml | 30 +-- roles/update/.yamllint | 4 + roles/update/LICENSE | 2 +- roles/update/README.md | 76 ++------ roles/update/handlers/main.yml | 3 +- roles/update/meta 2/.galaxy_install_info | 2 - roles/update/meta 2/exception.yml | 4 - roles/update/meta 2/preferences.yml | 2 - roles/update/meta/.galaxy_install_info | 4 +- roles/update/meta/main.yml | 11 +- roles/update/molecule 2/default/converge.yml | 8 - roles/update/molecule 2/default/prepare.yml | 8 - roles/update/molecule 2/default/verify.yml | 9 - roles/update/molecule/default/molecule.yml | 7 +- roles/update/molecule/default/verify.yml | 2 +- roles/update/requirements 2.yml | 2 - roles/update/requirements.yml | 5 +- roles/update/tasks/assert.yml | 21 ++- roles/update/tasks/main.yml | 118 ++++++------ roles/update/tox.ini | 22 +-- roles/users/.ansible-lint | 4 + roles/users/.ansible-lint 2 | 7 - roles/users/.github 2/FUNDING.yml | 2 - .../users/.github 2/pull_request_template.md | 11 -- roles/users/.github 2/settings.yml | 7 - roles/users/.github/settings.yml | 1 + roles/users/.github/workflows/galaxy.yml | 12 +- roles/users/.github/workflows/molecule.yml | 19 +- roles/users/.gitignore | 1 + roles/users/.gitignore 2 | 4 - roles/users/.travis.yml | 30 +-- roles/users/.yamllint | 1 + roles/users/LICENSE | 2 +- roles/users/README.md | 91 +++------ roles/users/defaults/main.yml | 3 + roles/users/meta 2/.galaxy_install_info | 2 - roles/users/meta 2/preferences.yml | 2 - roles/users/meta/.galaxy_install_info | 4 +- roles/users/meta/main.yml | 11 +- roles/users/molecule/default/converge.yml | 4 + roles/users/molecule/default/molecule.yml | 1 + roles/users/molecule/default/verify.yml | 14 +- roles/users/requirements 2.yml | 3 - roles/users/requirements.yml | 5 +- roles/users/tasks/assert.yml | 160 ++++++---------- roles/users/tasks/group.yml | 3 +- roles/users/tasks/main.yml | 21 ++- roles/users/tasks/user.yml | 24 +-- roles/users/tasks/user_authorized_key.yml | 2 + roles/users/templates 2/.gitkeep | 0 roles/users/templates 2/cron.allow.j2 | 10 - roles/users/templates 2/sudo.j2 | 2 - roles/users/tox.ini | 22 +-- roles/vagrant/.ansible-lint | 4 + roles/vagrant/.github 2/FUNDING.yml | 2 - .../.github 2/pull_request_template.md | 11 -- roles/vagrant/.github 2/settings.yml | 7 - roles/vagrant/.github/settings.yml | 1 + roles/vagrant/.github/workflows/galaxy.yml | 12 +- roles/vagrant/.github/workflows/molecule.yml | 17 +- roles/vagrant/.gitignore | 1 + roles/vagrant/.gitignore 2 | 4 - roles/vagrant/.travis.yml | 27 +-- roles/vagrant/.yamllint | 1 + roles/vagrant/LICENSE | 2 +- roles/vagrant/README.md | 84 ++------- roles/vagrant/meta 2/.galaxy_install_info | 2 - roles/vagrant/meta 2/exception.yml | 4 - roles/vagrant/meta 2/preferences.yml | 2 - roles/vagrant/meta/.galaxy_install_info | 4 +- roles/vagrant/meta/main.yml | 8 +- roles/vagrant/molecule 2/default/converge.yml | 8 - roles/vagrant/molecule 2/default/prepare.yml | 12 -- roles/vagrant/molecule 2/default/verify.yml | 9 - roles/vagrant/molecule/default/molecule.yml | 2 + roles/vagrant/requirements.yml | 13 +- roles/vagrant/tasks/assert.yml | 9 +- roles/vagrant/tasks/main.yml | 25 ++- roles/vagrant/tox.ini | 22 +-- 619 files changed, 2506 insertions(+), 5001 deletions(-) create mode 100644 lijst.txt delete mode 100644 roles/ansible/.github 2/FUNDING.yml delete mode 100644 roles/ansible/.github 2/pull_request_template.md delete mode 100644 roles/ansible/.github 2/settings.yml delete mode 100644 roles/ansible/.gitignore 2 delete mode 100644 roles/ansible/meta 2/.galaxy_install_info delete mode 100644 roles/ansible/meta 2/exception.yml delete mode 100644 roles/ansible/meta 2/preferences.yml delete mode 100644 roles/ansible/molecule 2/default/converge.yml delete mode 100644 roles/ansible/molecule 2/default/prepare.yml delete mode 100644 roles/ansible/molecule 2/default/verify.yml delete mode 100644 roles/ansible/requirements 2.yml delete mode 100644 roles/ansible_lint/.github 2/FUNDING.yml delete mode 100644 roles/ansible_lint/.github 2/pull_request_template.md delete mode 100644 roles/ansible_lint/.github 2/settings.yml delete mode 100644 roles/ansible_lint/.gitignore 2 delete mode 100644 roles/ansible_lint/meta 2/.galaxy_install_info delete mode 100644 roles/ansible_lint/meta 2/exception.yml delete mode 100644 roles/ansible_lint/meta 2/preferences.yml delete mode 100644 roles/ansible_lint/requirements 2.yml delete mode 100644 roles/ansible_lint/vars 2/main.yml delete mode 100644 roles/ara/.github 2/FUNDING.yml delete mode 100644 roles/ara/.github 2/pull_request_template.md delete mode 100644 roles/ara/.github 2/settings.yml delete mode 100644 roles/ara/.gitignore 2 delete mode 100644 roles/ara/meta 2/.galaxy_install_info delete mode 100644 roles/ara/meta 2/preferences.yml delete mode 100644 roles/ara/molecule 2/default/converge.yml delete mode 100644 roles/ara/molecule 2/default/prepare.yml delete mode 100644 roles/ara/molecule 2/default/verify.yml delete mode 100644 roles/atom/.github 2/FUNDING.yml delete mode 100644 roles/atom/.github 2/pull_request_template.md delete mode 100644 roles/atom/.github 2/settings.yml delete mode 100644 roles/atom/.gitignore 2 delete mode 100644 roles/atom/meta 2/.galaxy_install_info delete mode 100644 roles/atom/meta 2/exception.yml delete mode 100644 roles/atom/meta 2/preferences.yml delete mode 100644 roles/atom/molecule 2/default/converge.yml delete mode 100644 roles/atom/molecule 2/default/prepare.yml delete mode 100644 roles/atom/molecule 2/default/verify.yml delete mode 100644 roles/atom/requirements 2.yml delete mode 100644 roles/bootstrap/.ansible-lint 2 delete mode 100644 roles/bootstrap/.github 2/FUNDING.yml delete mode 100644 roles/bootstrap/.github 2/pull_request_template.md delete mode 100644 roles/bootstrap/.github 2/settings.yml delete mode 100644 roles/bootstrap/.gitignore 2 delete mode 100644 roles/bootstrap/meta 2/.galaxy_install_info delete mode 100644 roles/bootstrap/meta 2/preferences.yml delete mode 100644 roles/bootstrap/molecule 2/default/converge.yml delete mode 100644 roles/bootstrap/molecule 2/default/verify.yml delete mode 100644 roles/buildtools/.github 2/FUNDING.yml delete mode 100644 roles/buildtools/.github 2/pull_request_template.md delete mode 100644 roles/buildtools/.github 2/settings.yml delete mode 100644 roles/buildtools/.gitignore 2 delete mode 100644 roles/buildtools/meta 2/.galaxy_install_info delete mode 100644 roles/buildtools/meta 2/exception.yml delete mode 100644 roles/buildtools/meta 2/preferences.yml delete mode 100644 roles/buildtools/molecule 2/default/converge.yml delete mode 100644 roles/buildtools/molecule 2/default/prepare.yml delete mode 100644 roles/buildtools/requirements 2.yml delete mode 100644 roles/common/.github 2/FUNDING.yml delete mode 100644 roles/common/.github 2/pull_request_template.md delete mode 100644 roles/common/.github 2/settings.yml delete mode 100644 roles/common/.gitignore 2 delete mode 100644 roles/common/meta 2/.galaxy_install_info delete mode 100644 roles/common/meta 2/exception.yml delete mode 100644 roles/common/meta 2/preferences.yml delete mode 100644 roles/common/molecule 2/default/converge.yml delete mode 100644 roles/common/molecule 2/default/prepare.yml delete mode 100644 roles/common/molecule 2/default/verify.yml delete mode 100644 roles/common/requirements 2.yml delete mode 100644 roles/docker/.github 2/FUNDING.yml delete mode 100644 roles/docker/.github 2/pull_request_template.md delete mode 100644 roles/docker/.github 2/settings.yml delete mode 100644 roles/docker/.gitignore 2 delete mode 100644 roles/docker/meta 2/.galaxy_install_info delete mode 100644 roles/docker/meta 2/exception.yml delete mode 100644 roles/docker/meta 2/preferences.yml delete mode 100644 roles/docker/molecule 2/default/converge.yml delete mode 100644 roles/docker/molecule 2/default/prepare.yml delete mode 100644 roles/docker/molecule 2/default/verify.yml delete mode 100644 roles/epel/.ansible-lint 2 delete mode 100644 roles/epel/.github 2/FUNDING.yml delete mode 100644 roles/epel/.github 2/pull_request_template.md delete mode 100644 roles/epel/.github 2/settings.yml delete mode 100644 roles/epel/.gitignore 2 delete mode 100644 roles/epel/handlers 2/main.yml delete mode 100644 roles/epel/meta 2/.galaxy_install_info delete mode 100644 roles/epel/meta 2/preferences.yml delete mode 100644 roles/epel/molecule 2/default/converge.yml delete mode 100644 roles/epel/molecule 2/default/prepare.yml delete mode 100644 roles/epel/molecule 2/default/verify.yml delete mode 100644 roles/epel/requirements 2.yml delete mode 100644 roles/fail2ban/.github 2/FUNDING.yml delete mode 100644 roles/fail2ban/.github 2/pull_request_template.md delete mode 100644 roles/fail2ban/.github 2/settings.yml delete mode 100644 roles/fail2ban/.gitignore 2 delete mode 100644 roles/fail2ban/meta 2/.galaxy_install_info delete mode 100644 roles/fail2ban/meta 2/exception.yml delete mode 100644 roles/fail2ban/meta 2/preferences.yml delete mode 100644 roles/fail2ban/molecule 2/default/converge.yml delete mode 100644 roles/fail2ban/molecule 2/default/prepare.yml delete mode 100644 roles/fail2ban/molecule 2/default/verify.yml delete mode 100644 roles/fail2ban/requirements 2.yml delete mode 100644 roles/git/.ansible-lint 2 delete mode 100644 roles/git/.github 2/FUNDING.yml delete mode 100644 roles/git/.github 2/pull_request_template.md delete mode 100644 roles/git/.github 2/settings.yml delete mode 100644 roles/git/.gitignore 2 delete mode 100644 roles/git/meta 2/.galaxy_install_info delete mode 100644 roles/git/meta 2/preferences.yml delete mode 100644 roles/git/requirements 2.yml delete mode 100644 roles/git/templates 2/gitconfig.j2 delete mode 100644 roles/git/vars 2/main.yml delete mode 100644 roles/investigate/.ansible-lint 2 delete mode 100644 roles/investigate/.github 2/FUNDING.yml delete mode 100644 roles/investigate/.github 2/pull_request_template.md delete mode 100644 roles/investigate/.github 2/settings.yml delete mode 100644 roles/investigate/.gitignore 2 delete mode 100644 roles/investigate/meta 2/.galaxy_install_info delete mode 100644 roles/investigate/meta 2/preferences.yml delete mode 100644 roles/investigate/requirements 2.yml delete mode 100644 roles/molecule/.github 2/FUNDING.yml delete mode 100644 roles/molecule/.github 2/pull_request_template.md delete mode 100644 roles/molecule/.github 2/settings.yml delete mode 100644 roles/molecule/.gitignore 2 delete mode 100644 roles/molecule/meta 2/.galaxy_install_info delete mode 100644 roles/molecule/meta 2/preferences.yml delete mode 100644 roles/molecule/molecule 2/default/converge.yml delete mode 100644 roles/molecule/molecule 2/default/prepare.yml delete mode 100644 roles/molecule/molecule 2/default/verify.yml delete mode 100644 roles/molecule/requirements 2.yml delete mode 100644 roles/molecule/tasks/assert.yml delete mode 100644 roles/postfix/.github 2/FUNDING.yml delete mode 100644 roles/postfix/.github 2/pull_request_template.md delete mode 100644 roles/postfix/.github 2/settings.yml delete mode 100644 roles/postfix/.gitignore 2 delete mode 100644 roles/postfix/files/my-postfix.te delete mode 100644 roles/postfix/meta 2/.galaxy_install_info delete mode 100644 roles/postfix/meta 2/exception.yml delete mode 100644 roles/postfix/meta 2/preferences.yml delete mode 100644 roles/postfix/requirements 2.yml delete mode 100644 roles/python_pip/.github 2/FUNDING.yml delete mode 100644 roles/python_pip/.github 2/pull_request_template.md delete mode 100644 roles/python_pip/.github 2/settings.yml delete mode 100644 roles/python_pip/.gitignore 2 delete mode 100644 roles/python_pip/meta 2/.galaxy_install_info delete mode 100644 roles/python_pip/meta 2/exception.yml delete mode 100644 roles/python_pip/meta 2/preferences.yml delete mode 100644 roles/python_pip/molecule 2/default/converge.yml delete mode 100644 roles/python_pip/molecule 2/default/prepare.yml delete mode 100644 roles/python_pip/requirements 2.yml delete mode 100644 roles/reboot/.ansible-lint 2 delete mode 100644 roles/reboot/.github 2/FUNDING.yml delete mode 100644 roles/reboot/.github 2/pull_request_template.md delete mode 100644 roles/reboot/.github 2/settings.yml delete mode 100644 roles/reboot/.gitignore 2 delete mode 100644 roles/reboot/meta 2/.galaxy_install_info delete mode 100644 roles/reboot/meta 2/preferences.yml delete mode 100644 roles/reboot/molecule 2/default/converge.yml delete mode 100644 roles/reboot/molecule 2/default/prepare.yml delete mode 100644 roles/reboot/molecule 2/default/verify.yml delete mode 100644 roles/reboot/requirements 2.yml delete mode 100644 roles/ruby/.ansible-lint 2 delete mode 100644 roles/ruby/.github 2/FUNDING.yml delete mode 100644 roles/ruby/.github 2/pull_request_template.md delete mode 100644 roles/ruby/.github 2/settings.yml delete mode 100644 roles/ruby/.gitignore 2 delete mode 100644 roles/ruby/meta 2/.galaxy_install_info delete mode 100644 roles/ruby/meta 2/preferences.yml delete mode 100644 roles/ruby/molecule 2/default/converge.yml delete mode 100644 roles/ruby/molecule 2/default/prepare.yml delete mode 100644 roles/ruby/molecule 2/default/verify.yml delete mode 100644 roles/ruby/requirements 2.yml delete mode 100644 roles/ruby/tasks 2/main.yml delete mode 100644 roles/ruby/vars 2/main.yml delete mode 100644 roles/service/.ansible-lint 2 delete mode 100644 roles/service/.github 2/FUNDING.yml delete mode 100644 roles/service/.github 2/pull_request_template.md delete mode 100644 roles/service/.github 2/settings.yml delete mode 100644 roles/service/.gitignore 2 delete mode 100644 roles/service/meta 2/.galaxy_install_info delete mode 100644 roles/service/meta 2/preferences.yml delete mode 100644 roles/service/requirements 2.yml delete mode 100644 roles/travis/.github 2/FUNDING.yml delete mode 100644 roles/travis/.github 2/pull_request_template.md delete mode 100644 roles/travis/.github 2/settings.yml delete mode 100644 roles/travis/.gitignore 2 delete mode 100644 roles/travis/meta 2/.galaxy_install_info delete mode 100644 roles/travis/meta 2/exception.yml delete mode 100644 roles/travis/meta 2/preferences.yml delete mode 100644 roles/travis/molecule 2/default/converge.yml delete mode 100644 roles/travis/molecule 2/default/prepare.yml delete mode 100644 roles/travis/molecule 2/default/verify.yml delete mode 100644 roles/travis/requirements 2.yml delete mode 100644 roles/update/.github 2/FUNDING.yml delete mode 100644 roles/update/.github 2/pull_request_template.md delete mode 100644 roles/update/.github 2/settings.yml delete mode 100644 roles/update/.gitignore 2 delete mode 100644 roles/update/meta 2/.galaxy_install_info delete mode 100644 roles/update/meta 2/exception.yml delete mode 100644 roles/update/meta 2/preferences.yml delete mode 100644 roles/update/molecule 2/default/converge.yml delete mode 100644 roles/update/molecule 2/default/prepare.yml delete mode 100644 roles/update/molecule 2/default/verify.yml delete mode 100644 roles/update/requirements 2.yml delete mode 100644 roles/users/.ansible-lint 2 delete mode 100644 roles/users/.github 2/FUNDING.yml delete mode 100644 roles/users/.github 2/pull_request_template.md delete mode 100644 roles/users/.github 2/settings.yml delete mode 100644 roles/users/.gitignore 2 delete mode 100644 roles/users/meta 2/.galaxy_install_info delete mode 100644 roles/users/meta 2/preferences.yml delete mode 100644 roles/users/requirements 2.yml delete mode 100644 roles/users/templates 2/.gitkeep delete mode 100644 roles/users/templates 2/cron.allow.j2 delete mode 100644 roles/users/templates 2/sudo.j2 delete mode 100644 roles/vagrant/.github 2/FUNDING.yml delete mode 100644 roles/vagrant/.github 2/pull_request_template.md delete mode 100644 roles/vagrant/.github 2/settings.yml delete mode 100644 roles/vagrant/.gitignore 2 delete mode 100644 roles/vagrant/meta 2/.galaxy_install_info delete mode 100644 roles/vagrant/meta 2/exception.yml delete mode 100644 roles/vagrant/meta 2/preferences.yml delete mode 100644 roles/vagrant/molecule 2/default/converge.yml delete mode 100644 roles/vagrant/molecule 2/default/prepare.yml delete mode 100644 roles/vagrant/molecule 2/default/verify.yml diff --git a/.gitignore b/.gitignore index c44b579..cbee34f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ id_rsa +roles/* !roles/requirements.yml files/ssh_keys .vagrant diff --git a/inventory/group_vars/all.yml b/inventory/group_vars/all.yml index c70c18c..5a23aab 100644 --- a/inventory/group_vars/all.yml +++ b/inventory/group_vars/all.yml @@ -385,3 +385,139 @@ git_repositories: dest: ansible-role-zabbix_server - repo: ssh://git@github.com/robertdebock/ansible-role-zabbix_web.git dest: ansible-role-zabbix_web + - repo: ssh://git@github.com/robertdebock/ansible-collection-roles.git + dest: ansible-collection-roles + - repo: ssh://git@github.com/robertdebock/ansible-collection-rundeck.git + dest: ansible-collection-rundeck + - repo: ssh://git@github.com/robertdebock/ansible-generator.git + dest: ansible-generator + - repo: ssh://git@github.com/robertdebock/ansible-integration.git + dest: ansible-integration + - repo: ssh://git@github.com/robertdebock/ansible-playbook-bios_update.git + dest: ansible-playbook-bios_update + - repo: ssh://git@github.com/robertdebock/ansible-playbook-cloudtop.git + dest: ansible-playbook-cloudtop + - repo: ssh://git@github.com/robertdebock/ansible-playbook-gitlab_runner.git + dest: ansible-playbook-gitlab_runner + - repo: ssh://git@github.com/robertdebock/ansible-playbook-haproxy.git + dest: ansible-playbook-haproxy + - repo: ssh://git@github.com/robertdebock/ansible-playbook-jitsi.git + dest: ansible-playbook-jitsi + - repo: ssh://git@github.com/robertdebock/ansible-playbook-keepalived.git + dest: ansible-playbook-keepalived + - repo: ssh://git@github.com/robertdebock/ansible-playbook-libvirt.git + dest: ansible-playbook-libvirt + - repo: ssh://git@github.com/robertdebock/ansible-playbook-mylucie.git + dest: ansible-playbook-mylucie + - repo: ssh://git@github.com/robertdebock/ansible-playbook-nextcloud.git + dest: ansible-playbook-nextcloud + - repo: ssh://git@github.com/robertdebock/ansible-playbook-nomad.git + dest: ansible-playbook-nomad + - repo: ssh://git@github.com/robertdebock/ansible-playbook-rancher.git + dest: ansible-playbook-rancher + - repo: ssh://git@github.com/robertdebock/ansible-playbook-saltstack.git + dest: ansible-playbook-saltstack + - repo: ssh://git@github.com/robertdebock/ansible-playbook-terraform.git + dest: ansible-playbook-terraform + - repo: ssh://git@github.com/robertdebock/ansible-playbook-tester.git + dest: ansible-playbook-tester + - repo: ssh://git@github.com/robertdebock/ansible-playbook-vault.git + dest: ansible-playbook-vault + - repo: ssh://git@github.com/robertdebock/ansible-playbook-zabbix.git + dest: ansible-playbook-zabbix + - repo: ssh://git@github.com/robertdebock/ansible-probe.git + dest: ansible-probe + - repo: ssh://git@github.com/robertdebock/docker-amazonlinux-systemd.git + dest: docker-amazonlinux-systemd + - repo: ssh://git@github.com/robertdebock/docker-archlinux-systemd.git + dest: docker-archlinux-systemd + - repo: ssh://git@github.com/robertdebock/docker-centos-openssh.git + dest: docker-centos-openssh + - repo: ssh://git@github.com/robertdebock/docker-centos-systemd.git + dest: docker-centos-systemd + - repo: ssh://git@github.com/robertdebock/docker-cntlm.git + dest: docker-cntlm + - repo: ssh://git@github.com/robertdebock/docker-debian-systemd.git + dest: docker-debian-systemd + - repo: ssh://git@github.com/robertdebock/docker-fedora-systemd.git + dest: docker-fedora-systemd + - repo: ssh://git@github.com/robertdebock/docker-github-action-galaxy.git + dest: docker-github-action-galaxy + - repo: ssh://git@github.com/robertdebock/docker-github-action-graphviz.git + dest: docker-github-action-graphviz + - repo: ssh://git@github.com/robertdebock/docker-github-action-molecule.git + dest: docker-github-action-molecule + - repo: ssh://git@github.com/robertdebock/docker-github-action-rpmbuild.git + dest: docker-github-action-rpmbuild + - repo: ssh://git@github.com/robertdebock/docker-opensuse-systemd.git + dest: docker-opensuse-systemd + - repo: ssh://git@github.com/robertdebock/docker-oraclelinux-systemd.git + dest: docker-oraclelinux-systemd + - repo: ssh://git@github.com/robertdebock/docker-redhat-systemd.git + dest: docker-redhat-systemd + - repo: ssh://git@github.com/robertdebock/docker-revealmd.git + dest: docker-revealmd + - repo: ssh://git@github.com/robertdebock/docker-ubuntu-systemd.git + dest: docker-ubuntu-systemd + - repo: ssh://git@github.com/robertdebock/galaxy-action.git + dest: galaxy-action + - repo: ssh://git@github.com/robertdebock/graphviz-action.git + dest: graphviz-action + - repo: ssh://git@github.com/robertdebock/katacoda-scenarios.git + dest: katacoda-scenarios + - repo: ssh://git@github.com/robertdebock/learn-terraform.git + dest: learn-terraform + - repo: ssh://git@github.com/robertdebock/learn-terraform-azure.git + dest: learn-terraform-azure + - repo: ssh://git@github.com/robertdebock/mirror.git + dest: mirror + - repo: ssh://git@github.com/robertdebock/molecule-action.git + dest: molecule-action + - repo: ssh://git@github.com/robertdebock/move_to_collections.git + dest: move_to_collections + - repo: ssh://git@github.com/robertdebock/packer-centos.git + dest: packer-centos + - repo: ssh://git@github.com/robertdebock/packer-fedora.git + dest: packer-fedora + - repo: ssh://git@github.com/robertdebock/packer-opensuse.git + dest: packer-opensuse + - repo: ssh://git@github.com/robertdebock/pre-commit.git + dest: pre-commit + - repo: ssh://git@github.com/robertdebock/presentations.git + dest: presentations + - repo: ssh://git@github.com/robertdebock/rpmbuild-action.git + dest: rpmbuild-action + - repo: ssh://git@github.com/robertdebock/ansible-role-skeleton.git + dest: skeleton + - repo: ssh://git@github.com/robertdebock/terraform-action.git + dest: terraform-action + - repo: ssh://git@github.com/robertdebock/terraform-aws-vpc-bootstrap.git + dest: terraform-aws-vpc-bootstrap + - repo: ssh://git@github.com/robertdebock/terraform-azurerm-azurerm_network_interface.git + dest: terraform-azurerm-azurerm_network_interface + - repo: ssh://git@github.com/robertdebock/terraform-azurerm-azurerm_network_security_group.git + dest: terraform-azurerm-azurerm_network_security_group + - repo: ssh://git@github.com/robertdebock/terraform-azurerm-azurerm_network_security_rule.git + dest: terraform-azurerm-azurerm_network_security_rule + - repo: ssh://git@github.com/robertdebock/terraform-azurerm-azurerm_public_ip.git + dest: terraform-azurerm-azurerm_public_ip + - repo: ssh://git@github.com/robertdebock/terraform-azurerm-azurerm_resource_group.git + dest: terraform-azurerm-azurerm_resource_group + - repo: ssh://git@github.com/robertdebock/terraform-azurerm-azurerm_subnet.git + dest: terraform-azurerm-azurerm_subnet + - repo: ssh://git@github.com/robertdebock/terraform-azurerm-azurerm_virtual_network.git + dest: terraform-azurerm-azurerm_virtual_network + - repo: ssh://git@github.com/robertdebock/terraform-cloudflare-record.git + dest: terraform-cloudflare-record + - repo: ssh://git@github.com/robertdebock/terraform-demo.git + dest: terraform-demo + - repo: ssh://git@github.com/robertdebock/terraform-digitalocean-droplet.git + dest: terraform-digitalocean-droplet + - repo: ssh://git@github.com/robertdebock/terraform-digitalocean-ssh_key.git + dest: terraform-digitalocean-ssh_key + - repo: ssh://git@github.com/robertdebock/terraform-digitalocean-vpc.git + dest: terraform-digitalocean-vpc + - repo: ssh://git@github.com/robertdebock/terraform-use-case-azure-loadbalanced-service.git + dest: terraform-use-case-azure-loadbalanced-service + - repo: ssh://git@github.com/robertdebock/terragrunt-demo.git + dest: terragrunt-demo diff --git a/lijst.txt b/lijst.txt new file mode 100644 index 0000000..da3beab --- /dev/null +++ b/lijst.txt @@ -0,0 +1,68 @@ +ansible-collection-roles +ansible-collection-rundeck +ansible-generator +ansible-integration +ansible-playbook-bios_update +ansible-playbook-cloudtop +ansible-playbook-gitlab_runner +ansible-playbook-haproxy +ansible-playbook-jitsi +ansible-playbook-keepalived +ansible-playbook-libvirt +ansible-playbook-mylucie +ansible-playbook-nextcloud +ansible-playbook-nomad +ansible-playbook-rancher +ansible-playbook-saltstack +ansible-playbook-terraform +ansible-playbook-tester +ansible-playbook-vault +ansible-playbook-zabbix +ansible-probe +docker-amazonlinux-systemd +docker-archlinux-systemd +docker-centos-openssh +docker-centos-systemd +docker-cntlm +docker-debian-systemd +docker-fedora-systemd +docker-github-action-galaxy +docker-github-action-graphviz +docker-github-action-molecule +docker-github-action-rpmbuild +docker-opensuse-systemd +docker-oraclelinux-systemd +docker-redhat-systemd +docker-revealmd +docker-ubuntu-systemd +galaxy-action +graphviz-action +katacoda-scenarios +learn-terraform +learn-terraform-azure +mirror +molecule-action +move_to_collections +packer-centos +packer-fedora +packer-opensuse +pre-commit +presentations +rpmbuild-action +ansible-role-skeleton +terraform-action +terraform-aws-vpc-bootstrap +terraform-azurerm-azurerm_network_interface +terraform-azurerm-azurerm_network_security_group +terraform-azurerm-azurerm_network_security_rule +terraform-azurerm-azurerm_public_ip +terraform-azurerm-azurerm_resource_group +terraform-azurerm-azurerm_subnet +terraform-azurerm-azurerm_virtual_network +terraform-cloudflare-record +terraform-demo +terraform-digitalocean-droplet +terraform-digitalocean-ssh_key +terraform-digitalocean-vpc +terraform-use-case-azure-loadbalanced-service +terragrunt-demo diff --git a/roles/ansible/.ansible-lint b/roles/ansible/.ansible-lint index eba57d1..7a17121 100644 --- a/roles/ansible/.ansible-lint +++ b/roles/ansible/.ansible-lint @@ -4,5 +4,9 @@ exclude_paths: - ./meta/exception.yml - ./meta/preferences.yml + - ./molecule/default/prepare.yml + - ./molecule/default/converge.yml - ./molecule/default/verify.yml + - ./molecule/default/collections.yml - ./.tox + - ./.cache diff --git a/roles/ansible/.github 2/FUNDING.yml b/roles/ansible/.github 2/FUNDING.yml deleted file mode 100644 index 67320f0..0000000 --- a/roles/ansible/.github 2/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -github: robertdebock diff --git a/roles/ansible/.github 2/pull_request_template.md b/roles/ansible/.github 2/pull_request_template.md deleted file mode 100644 index b1578c0..0000000 --- a/roles/ansible/.github 2/pull_request_template.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: Pull request -about: Describe the proposed change - ---- - -**Describe the change** -A clear and concise description of what the pull request is. - -**Testing** -In case a feature was added, how were tests performed? diff --git a/roles/ansible/.github 2/settings.yml b/roles/ansible/.github 2/settings.yml deleted file mode 100644 index 5019e26..0000000 --- a/roles/ansible/.github 2/settings.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# -# Ansible managed -# -repository: - description: Install and configure ansible on your system. - homepage: https://robertdebock.nl/ diff --git a/roles/ansible/.github/settings.yml b/roles/ansible/.github/settings.yml index 5019e26..b8a0101 100644 --- a/roles/ansible/.github/settings.yml +++ b/roles/ansible/.github/settings.yml @@ -5,3 +5,4 @@ repository: description: Install and configure ansible on your system. homepage: https://robertdebock.nl/ + topics: ansible, ansible, molecule, tox, playbook, hacktoberfest diff --git a/roles/ansible/.github/workflows/galaxy.yml b/roles/ansible/.github/workflows/galaxy.yml index 46a2556..1d36b74 100644 --- a/roles/ansible/.github/workflows/galaxy.yml +++ b/roles/ansible/.github/workflows/galaxy.yml @@ -6,17 +6,13 @@ name: Release to Ansible Galaxy on: - push: - tags: - - '*' - schedule: - - cron: '1 1 1 * *' - + release: + types: [created, edited, published, released] jobs: release: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: galaxy - uses: robertdebock/galaxy-action@1.0.1 + uses: robertdebock/galaxy-action@1.1.0 with: galaxy_api_key: ${{ secrets.galaxy_api_key }} diff --git a/roles/ansible/.github/workflows/molecule.yml b/roles/ansible/.github/workflows/molecule.yml index a7b03b3..711c0ee 100644 --- a/roles/ansible/.github/workflows/molecule.yml +++ b/roles/ansible/.github/workflows/molecule.yml @@ -15,30 +15,26 @@ on: jobs: lint: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: checkout uses: actions/checkout@v2 with: path: "${{ github.repository }}" - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: command: lint test: needs: - lint - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: config: - image: "alpine" tag: "latest" - - image: "alpine" - tag: "edge" - - image: "centos" - tag: "7" - image: "centos" tag: "latest" - image: "debian" @@ -46,7 +42,7 @@ jobs: - image: "debian" tag: "bullseye" - image: "fedora" - tag: "31" + tag: "32" - image: "fedora" tag: "latest" - image: "opensuse" @@ -55,8 +51,6 @@ jobs: tag: "latest" - image: "ubuntu" tag: "bionic" - - image: "ubuntu" - tag: "xenial" steps: - name: checkout uses: actions/checkout@v2 @@ -67,10 +61,7 @@ jobs: - name: parse apparmor for mysql run: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: image: ${{ matrix.config.image }} tag: ${{ matrix.config.tag }} - options: "--parallel all" - env: - TOX_PARALLEL_NO_SPINNER: 1 diff --git a/roles/ansible/.gitignore b/roles/ansible/.gitignore index 982db11..c15d16a 100644 --- a/roles/ansible/.gitignore +++ b/roles/ansible/.gitignore @@ -2,3 +2,4 @@ *.log *.swp .tox +.cache diff --git a/roles/ansible/.gitignore 2 b/roles/ansible/.gitignore 2 deleted file mode 100644 index 982db11..0000000 --- a/roles/ansible/.gitignore 2 +++ /dev/null @@ -1,4 +0,0 @@ -.molecule -*.log -*.swp -.tox diff --git a/roles/ansible/.travis.yml b/roles/ansible/.travis.yml index bcf2b82..21201e1 100644 --- a/roles/ansible/.travis.yml +++ b/roles/ansible/.travis.yml @@ -8,42 +8,23 @@ os: linux dist: xenial python: - - "3.8" + - "3.9" services: - docker -env: - global: - namespace="robertdebock" - jobs: - - image="alpine" tag="latest" - - image="alpine" tag="edge" - - image="centos" tag="7" - - image="centos" tag="latest" - - image="debian" tag="latest" - - image="debian" tag="bullseye" - - image="fedora" tag="31" - - image="fedora" tag="latest" - - image="opensuse" tag="latest" - - image="ubuntu" tag="latest" - - image="ubuntu" tag="bionic" - - image="ubuntu" tag="xenial" - cache: - pip install: - pip install --upgrade pip - - pip install tox + - pip install yamllint + - pip install ansible-lint script: - - function retry { counter=0 ; until "$@" ; do exit=$? ; counter=$(($counter + 1)) ; if [ $counter -ge 3 ] ; then return $exit ; fi ; done ; return 0; } ; retry tox --parallel all + - yamllint . + - ansible-lint notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ - slack: - secure: "TrlwhHG0+mcoQ1GI0ormhAX3DN6hR60B4dlVlkwRUqnJYJGh9BFuJChNegVAmidXSbpNB5KsvVvlXQlB3OypQniBhrS3P9mn2wd4HOrMDWDjZLPrXCZphDUHC1uN/1vqnsmgVeB6tyJkwN9hj6pYM86FqKXW0MP3Bt2MkFj3pK9VN8eyFeNXDMzfDRv/rayUoYAwyOyNVqKVQWqyEF4MdZ2VQAU/La9QXzeLUBmP+53JXrTeljavWx4DvYtDdbZDLYT/rmdCxkE7mkBrOSAd9wB1AjGU2sH0dxMHAmDtfiKZTwFxgToFD1K95c21SJXMOvIQXw0quQmgvuJtHuR3z6PyTmJ5gbezkRmiMcJOqlGiRYsVXhyr+qB43e0HpaSAEOk/CsdCefIwUyfUJuVV2qjl2w/L4oyLpLPJJRi7eJrDOrZbaTSvi/RQHGLW+it4gBQS+sxfUvwi6r5gwm4m2EHTd/IcvNcOsvQPL7VEVPjZYhq3BNU9CpJy8suMrLPWUOOYFvyJ90vVAAjzyYHOXLv3rqtsQqA6W0aO33om8CoNINOj/gi3TFdJY+GKr59y08ZUapM6/OYZAuOFgZPb/AsFprzhapciOP15cHu3octzpyW1GlJH0SGN3qGdvrm7SaChOw0+Fbh1fbnihnGS7tz2qFvze2XPNA5tk/va3K4=" - on_success: change - template: "%{result}: %{repository_slug}@%{branch}, build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}>)" email: false diff --git a/roles/ansible/.yamllint b/roles/ansible/.yamllint index 894450c..a7ff098 100644 --- a/roles/ansible/.yamllint +++ b/roles/ansible/.yamllint @@ -13,3 +13,4 @@ rules: ignore: | .tox/ + .cache/ diff --git a/roles/ansible/LICENSE b/roles/ansible/LICENSE index bd15893..e770af8 100644 --- a/roles/ansible/LICENSE +++ b/roles/ansible/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 Robert de Bock (robert@meinit.nl) + Copyright 2021 Robert de Bock (robert@meinit.nl) 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/roles/ansible/README.md b/roles/ansible/README.md index 9e7864f..e5f0d3a 100644 --- a/roles/ansible/README.md +++ b/roles/ansible/README.md @@ -2,9 +2,9 @@ Install and configure ansible on your system. -|Travis|GitHub|Quality|Downloads|Version| +|GitHub|GitLab|Quality|Downloads|Version| |------|------|-------|---------|-------| -|[![travis](https://travis-ci.com/robertdebock/ansible-role-ansible.svg?branch=master)](https://travis-ci.com/robertdebock/ansible-role-ansible)|[![github](https://github.com/robertdebock/ansible-role-ansible/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-ansible/actions)|[![quality](https://img.shields.io/ansible/quality/35944)](https://galaxy.ansible.com/robertdebock/ansible)|[![downloads](https://img.shields.io/ansible/role/d/35944)](https://galaxy.ansible.com/robertdebock/ansible)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-ansible.svg)](https://github.com/robertdebock/ansible-role-ansible/releases/)| +|[![github](https://github.com/robertdebock/ansible-role-ansible/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-ansible/actions)|[![gitlab](https://gitlab.com/robertdebock/ansible-role-ansible/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-ansible)|[![quality](https://img.shields.io/ansible/quality/35944)](https://galaxy.ansible.com/robertdebock/ansible)|[![downloads](https://img.shields.io/ansible/role/d/35944)](https://galaxy.ansible.com/robertdebock/ansible)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-ansible.svg)](https://github.com/robertdebock/ansible-role-ansible/releases/)| ## [Example Playbook](#example-playbook) @@ -20,7 +20,7 @@ This example is taken from `molecule/resources/converge.yml` and is tested on ea - role: robertdebock.ansible ``` -The machine may need to be prepared using `molecule/resources/prepare.yml`: +The machine needs to be prepared in CI this is done using `molecule/resources/prepare.yml`: ```yaml --- - name: Prepare @@ -35,21 +35,6 @@ The machine may need to be prepared using `molecule/resources/prepare.yml`: - role: robertdebock.python_pip ``` -For verification `molecule/resources/verify.yml` runs after the role has been applied. -```yaml ---- -- name: Verify - hosts: all - become: no - gather_facts: no - - tasks: - - name: run ansible - shell: ansible --version > ansible.version - args: - creates: ansible.version -``` - Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles. ## [Role Variables](#role-variables) @@ -74,26 +59,25 @@ ansible_configuration: ## [Requirements](#requirements) -- Access to a repository containing packages, likely on the internet. -- A recent version of Ansible. (Tests run on the current, previous and next release of Ansible.) +- pip packages listed in [requirements.txt](https://github.com/robertdebock/ansible-role-ansible/blob/master/requirements.txt). -The following roles can be installed to ensure all requirements are met, using `ansible-galaxy install -r requirements.yml`: +## [Status of requirements](#status-of-requirements) -```yaml ---- -- robertdebock.bootstrap -- robertdebock.buildtools -- robertdebock.epel -- robertdebock.python_pip +The following roles are used to prepare a system. You may choose to prepare your system in another way, I have tested these roles as well. -``` +| Requirement | GitHub | GitLab | +|-------------|--------|--------| +| [robertdebock.bootstrap](https://galaxy.ansible.com/robertdebock/bootstrap) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-bootstrap/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-bootstrap/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-bootstrap/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-bootstrap) +| [robertdebock.buildtools](https://galaxy.ansible.com/robertdebock/buildtools) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-buildtools/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-buildtools/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-buildtools/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-buildtools) +| [robertdebock.epel](https://galaxy.ansible.com/robertdebock/epel) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-epel/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-epel/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-epel/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-epel) +| [robertdebock.python_pip](https://galaxy.ansible.com/robertdebock/python_pip) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-python_pip/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-python_pip/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-python_pip/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-python_pip) ## [Context](#context) This role is a part of many compatible roles. Have a look at [the documentation of these roles](https://robertdebock.nl/) for further information. Here is an overview of related roles: -![dependencies](https://raw.githubusercontent.com/robertdebock/drawings/artifacts/ansible.png "Dependency") +![dependencies](https://raw.githubusercontent.com/robertdebock/ansible-role-ansible/png/requirements.png "Dependencies") ## [Compatibility](#compatibility) @@ -102,15 +86,15 @@ This role has been tested on these [container images](https://hub.docker.com/u/r |container|tags| |---------|----| |alpine|all| -|el|7, 8| +|el|8| |debian|buster, bullseye| -|fedora|31, 32| +|fedora|all| |opensuse|all| -|ubuntu|focal, bionic, xenial| +|ubuntu|focal, bionic| -The minimum version of Ansible required is 2.8 but tests have been done to: +The minimum version of Ansible required is 2.10, tests have been done to: -- The previous version, on version lower. +- The previous version. - The current version. - The development version. @@ -123,40 +107,8 @@ Some variarations of the build matrix do not work. These are the variations and | amazonlinux:1 | No package matching 'python3-pip' | -## [Testing](#testing) - -[Unit tests](https://travis-ci.com/robertdebock/ansible-role-ansible) are done on every commit, pull request, release and periodically. - If you find issues, please register them in [GitHub](https://github.com/robertdebock/ansible-role-ansible/issues) -Testing is done using [Tox](https://tox.readthedocs.io/en/latest/) and [Molecule](https://github.com/ansible/molecule): - -[Tox](https://tox.readthedocs.io/en/latest/) tests multiple ansible versions. -[Molecule](https://github.com/ansible/molecule) tests multiple distributions. - -To test using the defaults (any installed ansible version, namespace: `robertdebock`, image: `fedora`, tag: `latest`): - -``` -molecule test - -# Or select a specific image: -image=ubuntu molecule test -# Or select a specific image and a specific tag: -image="debian" tag="stable" tox -``` - -Or you can test multiple versions of Ansible, and select images: -Tox allows multiple versions of Ansible to be tested. To run the default (namespace: `robertdebock`, image: `fedora`, tag: `latest`) tests: - -``` -tox - -# To run CentOS (namespace: `robertdebock`, tag: `latest`) -image="centos" tox -# Or customize more: -image="debian" tag="stable" tox -``` - ## [License](#license) Apache-2.0 diff --git a/roles/ansible/meta 2/.galaxy_install_info b/roles/ansible/meta 2/.galaxy_install_info deleted file mode 100644 index f7195d6..0000000 --- a/roles/ansible/meta 2/.galaxy_install_info +++ /dev/null @@ -1,2 +0,0 @@ -install_date: Mon Sep 28 13:21:49 2020 -version: 2.3.3 diff --git a/roles/ansible/meta 2/exception.yml b/roles/ansible/meta 2/exception.yml deleted file mode 100644 index 95e813f..0000000 --- a/roles/ansible/meta 2/exception.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -exceptions: - - variation: amazonlinux:1 - reason: "No package matching 'python3-pip'" diff --git a/roles/ansible/meta 2/preferences.yml b/roles/ansible/meta 2/preferences.yml deleted file mode 100644 index e7fdebf..0000000 --- a/roles/ansible/meta 2/preferences.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -tox_parallel: yes diff --git a/roles/ansible/meta/.galaxy_install_info b/roles/ansible/meta/.galaxy_install_info index f7195d6..600039b 100644 --- a/roles/ansible/meta/.galaxy_install_info +++ b/roles/ansible/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Mon Sep 28 13:21:49 2020 -version: 2.3.3 +install_date: Sun Mar 21 06:59:14 2021 +version: 3.0.2 diff --git a/roles/ansible/meta/main.yml b/roles/ansible/meta/main.yml index ac105b8..9620ceb 100644 --- a/roles/ansible/meta/main.yml +++ b/roles/ansible/meta/main.yml @@ -5,7 +5,7 @@ galaxy_info: description: Install and configure ansible on your system. license: Apache-2.0 company: none - min_ansible_version: 2.8 + min_ansible_version: "2.10" platforms: - name: Alpine @@ -13,7 +13,6 @@ galaxy_info: - all - name: EL versions: - - 7 - 8 - name: Debian versions: @@ -21,8 +20,7 @@ galaxy_info: - bullseye - name: Fedora versions: - - 31 - - 32 + - all - name: OpenSUSE versions: - all @@ -30,7 +28,6 @@ galaxy_info: versions: - focal - bionic - - xenial galaxy_tags: - ansible diff --git a/roles/ansible/molecule 2/default/converge.yml b/roles/ansible/molecule 2/default/converge.yml deleted file mode 100644 index 935c6b8..0000000 --- a/roles/ansible/molecule 2/default/converge.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Converge - hosts: all - become: yes - gather_facts: yes - - roles: - - role: ansible-role-ansible diff --git a/roles/ansible/molecule 2/default/prepare.yml b/roles/ansible/molecule 2/default/prepare.yml deleted file mode 100644 index fcdc074..0000000 --- a/roles/ansible/molecule 2/default/prepare.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -- name: Prepare - hosts: all - gather_facts: no - become: yes - - roles: - - role: robertdebock.bootstrap - - role: robertdebock.epel - - role: robertdebock.buildtools - - role: robertdebock.python_pip diff --git a/roles/ansible/molecule 2/default/verify.yml b/roles/ansible/molecule 2/default/verify.yml deleted file mode 100644 index 4733d21..0000000 --- a/roles/ansible/molecule 2/default/verify.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -- name: Verify - hosts: all - become: no - gather_facts: no - - tasks: - - name: run ansible - shell: ansible --version > ansible.version - args: - creates: ansible.version diff --git a/roles/ansible/molecule/default/molecule.yml b/roles/ansible/molecule/default/molecule.yml index 1762dfe..6240c30 100644 --- a/roles/ansible/molecule/default/molecule.yml +++ b/roles/ansible/molecule/default/molecule.yml @@ -6,9 +6,11 @@ dependency: name: galaxy options: role-file: requirements.yml + requirements-file: requirements.yml lint: | set -e yamllint . + ansible-lint driver: name: docker platforms: diff --git a/roles/ansible/requirements 2.yml b/roles/ansible/requirements 2.yml deleted file mode 100644 index 2fd552b..0000000 --- a/roles/ansible/requirements 2.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- robertdebock.bootstrap -- robertdebock.buildtools -- robertdebock.epel -- robertdebock.python_pip diff --git a/roles/ansible/requirements.yml b/roles/ansible/requirements.yml index 2fd552b..9838d2a 100644 --- a/roles/ansible/requirements.yml +++ b/roles/ansible/requirements.yml @@ -1,5 +1,8 @@ --- -- robertdebock.bootstrap -- robertdebock.buildtools -- robertdebock.epel -- robertdebock.python_pip +roles: + - name: robertdebock.bootstrap + - name: robertdebock.buildtools + - name: robertdebock.epel + - name: robertdebock.python_pip +collections: + - name: community.general diff --git a/roles/ansible/tasks/assert.yml b/roles/ansible/tasks/assert.yml index 7c58d45..d8fcb22 100644 --- a/roles/ansible/tasks/assert.yml +++ b/roles/ansible/tasks/assert.yml @@ -1,20 +1,19 @@ --- + - name: test if ansible_configuration is set correctly - assert: + ansible.builtin.assert: that: - - ansible_configuration | length > 0 - ansible_configuration is iterable quiet: yes when: - ansible_configuration is defined - name: test if item in ansible_configuration is set correctly - assert: + ansible.builtin.assert: that: - item.option is defined - - item.option | length > 0 + - item.option is string - item.value is defined - - item.value | length > 0 quiet: yes loop: "{{ ansible_configuration }}" loop_control: diff --git a/roles/ansible/tasks/main.yml b/roles/ansible/tasks/main.yml index 2132e07..738c030 100644 --- a/roles/ansible/tasks/main.yml +++ b/roles/ansible/tasks/main.yml @@ -1,28 +1,31 @@ --- # tasks file for ansible + - name: include assert.yml - include_tasks: assert.yml + import_tasks: assert.yml + run_once: yes + delegate_to: localhost - name: install ansible block: - name: install ansible package (allowed to fail) - package: + ansible.builtin.package: name: "{{ ansible_packages }}" state: present rescue: - name: install ansible pip - pip: + ansible.builtin.pip: name: ansible state: present - name: ensure the ansible directory exists - file: + ansible.builtin.file: path: "{{ ansible_configuration_directory }}" state: directory mode: "0755" - name: mark configuration file as ansible managed - lineinfile: + ansible.builtin.lineinfile: path: "{{ ansible_configuration_directory }}/{{ ansible_configuration_file }}" create: yes insertbefore: BOF @@ -30,7 +33,7 @@ mode: "0644" - name: configure ansible - ini_file: + community.general.ini_file: path: "{{ ansible_configuration_directory }}/{{ ansible_configuration_file }}" section: "{{ item.section | default('defaults') }}" option: "{{ item.option }}" diff --git a/roles/ansible/tox.ini b/roles/ansible/tox.ini index c1bc1d4..f57553b 100644 --- a/roles/ansible/tox.ini +++ b/roles/ansible/tox.ini @@ -2,25 +2,25 @@ # Ansible managed # [tox] -minversion = 3.7 -# Disabled "next" because of: -# https://github.com/ansible-community/molecule/issues/2626. -# envlist = py{38}-ansible-{previous,current,next} -envlist = py{38}-ansible-{previous,current} +minversion = 3.21.4 +# 2.11 has been disabled: couldn't resolve module/action 'docker_container'. +envlist = py{39}-ansible-{2.9,2.10} + skipsdist = true [testenv] deps = - previous: ansible>=2.8, <2.9 - current: ansible>=2.9 - next: git+https://github.com/ansible/ansible.git@devel - molecule[lint]>=3, <4 - docker>=4.2, <4.3 + 2.9: ansible == 2.9.* + 2.10: ansible == 2.10.* + 2.11: git+https://github.com/ansible/ansible.git@devel + molecule[docker] + docker == 4.* + ansible-lint == 5.* commands = molecule test setenv = TOX_ENVNAME={envname} - MOLECULE_EPHEMERAL_DIRECTORY=/tmp/.molecule/{env:image:fedora}-{env:tag:latest}/{envname} PY_COLORS=1 ANSIBLE_FORCE_COLOR=1 + ANSIBLE_ROLES_PATH=../ passenv = namespace image tag diff --git a/roles/ansible_lint/.ansible-lint b/roles/ansible_lint/.ansible-lint index eba57d1..7a17121 100644 --- a/roles/ansible_lint/.ansible-lint +++ b/roles/ansible_lint/.ansible-lint @@ -4,5 +4,9 @@ exclude_paths: - ./meta/exception.yml - ./meta/preferences.yml + - ./molecule/default/prepare.yml + - ./molecule/default/converge.yml - ./molecule/default/verify.yml + - ./molecule/default/collections.yml - ./.tox + - ./.cache diff --git a/roles/ansible_lint/.github 2/FUNDING.yml b/roles/ansible_lint/.github 2/FUNDING.yml deleted file mode 100644 index 67320f0..0000000 --- a/roles/ansible_lint/.github 2/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -github: robertdebock diff --git a/roles/ansible_lint/.github 2/pull_request_template.md b/roles/ansible_lint/.github 2/pull_request_template.md deleted file mode 100644 index b1578c0..0000000 --- a/roles/ansible_lint/.github 2/pull_request_template.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: Pull request -about: Describe the proposed change - ---- - -**Describe the change** -A clear and concise description of what the pull request is. - -**Testing** -In case a feature was added, how were tests performed? diff --git a/roles/ansible_lint/.github 2/settings.yml b/roles/ansible_lint/.github 2/settings.yml deleted file mode 100644 index 2ae14d3..0000000 --- a/roles/ansible_lint/.github 2/settings.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# -# Ansible managed -# -repository: - description: Install ansible-lint on your system. - homepage: https://robertdebock.nl/ diff --git a/roles/ansible_lint/.github/settings.yml b/roles/ansible_lint/.github/settings.yml index 2ae14d3..a687d55 100644 --- a/roles/ansible_lint/.github/settings.yml +++ b/roles/ansible_lint/.github/settings.yml @@ -5,3 +5,4 @@ repository: description: Install ansible-lint on your system. homepage: https://robertdebock.nl/ + topics: ansiblelint, ansible, lint, ansible, molecule, tox, playbook, hacktoberfest diff --git a/roles/ansible_lint/.github/workflows/galaxy.yml b/roles/ansible_lint/.github/workflows/galaxy.yml index 46a2556..1d36b74 100644 --- a/roles/ansible_lint/.github/workflows/galaxy.yml +++ b/roles/ansible_lint/.github/workflows/galaxy.yml @@ -6,17 +6,13 @@ name: Release to Ansible Galaxy on: - push: - tags: - - '*' - schedule: - - cron: '1 1 1 * *' - + release: + types: [created, edited, published, released] jobs: release: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: galaxy - uses: robertdebock/galaxy-action@1.0.1 + uses: robertdebock/galaxy-action@1.1.0 with: galaxy_api_key: ${{ secrets.galaxy_api_key }} diff --git a/roles/ansible_lint/.github/workflows/molecule.yml b/roles/ansible_lint/.github/workflows/molecule.yml index feae771..1fcbed7 100644 --- a/roles/ansible_lint/.github/workflows/molecule.yml +++ b/roles/ansible_lint/.github/workflows/molecule.yml @@ -15,20 +15,20 @@ on: jobs: lint: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: checkout uses: actions/checkout@v2 with: path: "${{ github.repository }}" - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: command: lint test: needs: - lint - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: @@ -40,15 +40,13 @@ jobs: - image: "debian" tag: "bullseye" - image: "fedora" - tag: "31" + tag: "32" - image: "fedora" tag: "latest" - image: "ubuntu" tag: "latest" - image: "ubuntu" tag: "bionic" - - image: "ubuntu" - tag: "xenial" steps: - name: checkout uses: actions/checkout@v2 @@ -59,10 +57,7 @@ jobs: - name: parse apparmor for mysql run: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: image: ${{ matrix.config.image }} tag: ${{ matrix.config.tag }} - options: "--parallel all" - env: - TOX_PARALLEL_NO_SPINNER: 1 diff --git a/roles/ansible_lint/.gitignore b/roles/ansible_lint/.gitignore index 982db11..c15d16a 100644 --- a/roles/ansible_lint/.gitignore +++ b/roles/ansible_lint/.gitignore @@ -2,3 +2,4 @@ *.log *.swp .tox +.cache diff --git a/roles/ansible_lint/.gitignore 2 b/roles/ansible_lint/.gitignore 2 deleted file mode 100644 index 982db11..0000000 --- a/roles/ansible_lint/.gitignore 2 +++ /dev/null @@ -1,4 +0,0 @@ -.molecule -*.log -*.swp -.tox diff --git a/roles/ansible_lint/.travis.yml b/roles/ansible_lint/.travis.yml index 4a1cd07..21201e1 100644 --- a/roles/ansible_lint/.travis.yml +++ b/roles/ansible_lint/.travis.yml @@ -8,38 +8,23 @@ os: linux dist: xenial python: - - "3.8" + - "3.9" services: - docker -env: - global: - namespace="robertdebock" - jobs: - - image="centos" tag="latest" - - image="debian" tag="latest" - - image="debian" tag="bullseye" - - image="fedora" tag="31" - - image="fedora" tag="latest" - - image="ubuntu" tag="latest" - - image="ubuntu" tag="bionic" - - image="ubuntu" tag="xenial" - cache: - pip install: - pip install --upgrade pip - - pip install tox + - pip install yamllint + - pip install ansible-lint script: - - function retry { counter=0 ; until "$@" ; do exit=$? ; counter=$(($counter + 1)) ; if [ $counter -ge 3 ] ; then return $exit ; fi ; done ; return 0; } ; retry tox --parallel all + - yamllint . + - ansible-lint notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ - slack: - secure: "FjNc+FnNGmc/0LZQl1KY1yB/yFL1AdcD/qlaqQXSxogbtvXP/UmP/lgCBXBLIGUfoyJY0xM/pNSYucijdAkqpAD9LBFlV1StBdzBXM2c5LIklzZFJtWVu5OeymItyZ8Nyz8aFlbv3Q7vApXNNNSF6TMCgysIq7ODbIcCx5+7JtxMJEUBlXe2Xggye0BAxd4IAdYRK72/Zsp5YNYIB3VbhdA9dAxLVj9oUU4z1I0W0WQEl6sS9L/vy8jOHNo/Qw7j4RksrPzGsGQK4bcRqHtC+QnU5p4WlQE4uSAs+x6ohwZg9qT3jZHkzF0TwCcwaigVDmrDrudFnfu7/ymU/YvF/8RV2Dcr8T4HjceFGpGy4GusXxJf3K0mDCL0ULfBI9Hu35xVXJ7ARqhi/DqUzvxnqQTr6v/NfnajqOEC7aSME7CR8QnvBml3JLAnMZTpJ+F98/rf21UZ6zRlfZwyRAQa1PX7kBaCXLuPJqmtL40eREryNqno9sFXgwJlvfgrsMR91nYLPwBaYxHVRqzLUZjYQEDAnozidzf4qhdXyhYDNFqLIhpYPlII4nf0qsufm3tQjarV0A8X/hySHD6xoZmYSH4r0nNJcXizENkK9ILgsw+F2LWHkZx81Bv9mZP3fKCZ7iY1Ruce5k+EAEIehVmlEfZte4OdrWRH5ABYvnqJ0b4=" - on_success: change - template: "%{result}: %{repository_slug}@%{branch}, build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}>)" email: false diff --git a/roles/ansible_lint/.yamllint b/roles/ansible_lint/.yamllint index 894450c..a7ff098 100644 --- a/roles/ansible_lint/.yamllint +++ b/roles/ansible_lint/.yamllint @@ -13,3 +13,4 @@ rules: ignore: | .tox/ + .cache/ diff --git a/roles/ansible_lint/LICENSE b/roles/ansible_lint/LICENSE index bd15893..e770af8 100644 --- a/roles/ansible_lint/LICENSE +++ b/roles/ansible_lint/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 Robert de Bock (robert@meinit.nl) + Copyright 2021 Robert de Bock (robert@meinit.nl) 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/roles/ansible_lint/README.md b/roles/ansible_lint/README.md index d733896..71300a7 100644 --- a/roles/ansible_lint/README.md +++ b/roles/ansible_lint/README.md @@ -2,9 +2,9 @@ Install ansible-lint on your system. -|Travis|GitHub|Quality|Downloads|Version| +|GitHub|GitLab|Quality|Downloads|Version| |------|------|-------|---------|-------| -|[![travis](https://travis-ci.com/robertdebock/ansible-role-ansible_lint.svg?branch=master)](https://travis-ci.com/robertdebock/ansible-role-ansible_lint)|[![github](https://github.com/robertdebock/ansible-role-ansible_lint/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-ansible_lint/actions)|[![quality](https://img.shields.io/ansible/quality/35946)](https://galaxy.ansible.com/robertdebock/ansible_lint)|[![downloads](https://img.shields.io/ansible/role/d/35946)](https://galaxy.ansible.com/robertdebock/ansible_lint)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-ansible_lint.svg)](https://github.com/robertdebock/ansible-role-ansible_lint/releases/)| +|[![github](https://github.com/robertdebock/ansible-role-ansible_lint/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-ansible_lint/actions)|[![gitlab](https://gitlab.com/robertdebock/ansible-role-ansible_lint/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-ansible_lint)|[![quality](https://img.shields.io/ansible/quality/35946)](https://galaxy.ansible.com/robertdebock/ansible_lint)|[![downloads](https://img.shields.io/ansible/role/d/35946)](https://galaxy.ansible.com/robertdebock/ansible_lint)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-ansible_lint.svg)](https://github.com/robertdebock/ansible-role-ansible_lint/releases/)| ## [Example Playbook](#example-playbook) @@ -20,7 +20,7 @@ This example is taken from `molecule/resources/converge.yml` and is tested on ea - role: robertdebock.ansible_lint ``` -The machine may need to be prepared using `molecule/resources/prepare.yml`: +The machine needs to be prepared in CI this is done using `molecule/resources/prepare.yml`: ```yaml --- - name: Prepare @@ -35,44 +35,30 @@ The machine may need to be prepared using `molecule/resources/prepare.yml`: - role: robertdebock.python_pip ``` -For verification `molecule/resources/verify.yml` runs after the role has been applied. -```yaml ---- -- name: Verify - hosts: all - become: yes - gather_facts: no - - tasks: - - name: check if connection still works - ping: -``` - Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles. ## [Requirements](#requirements) -- Access to a repository containing packages, likely on the internet. -- A recent version of Ansible. (Tests run on the current, previous and next release of Ansible.) +- pip packages listed in [requirements.txt](https://github.com/robertdebock/ansible-role-ansible_lint/blob/master/requirements.txt). -The following roles can be installed to ensure all requirements are met, using `ansible-galaxy install -r requirements.yml`: +## [Status of requirements](#status-of-requirements) -```yaml ---- -- robertdebock.bootstrap -- robertdebock.buildtools -- robertdebock.epel -- robertdebock.python_pip +The following roles are used to prepare a system. You may choose to prepare your system in another way, I have tested these roles as well. -``` +| Requirement | GitHub | GitLab | +|-------------|--------|--------| +| [robertdebock.bootstrap](https://galaxy.ansible.com/robertdebock/bootstrap) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-bootstrap/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-bootstrap/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-bootstrap/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-bootstrap) +| [robertdebock.buildtools](https://galaxy.ansible.com/robertdebock/buildtools) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-buildtools/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-buildtools/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-buildtools/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-buildtools) +| [robertdebock.epel](https://galaxy.ansible.com/robertdebock/epel) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-epel/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-epel/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-epel/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-epel) +| [robertdebock.python_pip](https://galaxy.ansible.com/robertdebock/python_pip) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-python_pip/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-python_pip/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-python_pip/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-python_pip) ## [Context](#context) This role is a part of many compatible roles. Have a look at [the documentation of these roles](https://robertdebock.nl/) for further information. Here is an overview of related roles: -![dependencies](https://raw.githubusercontent.com/robertdebock/drawings/artifacts/ansible_lint.png "Dependency") +![dependencies](https://raw.githubusercontent.com/robertdebock/ansible-role-ansible_lint/png/requirements.png "Dependencies") ## [Compatibility](#compatibility) @@ -81,13 +67,13 @@ This role has been tested on these [container images](https://hub.docker.com/u/r |container|tags| |---------|----| |el|8| -|debian|buster, bullseye| -|fedora|31, 32| -|ubuntu|focal, bionic, xenial| +|debian|all| +|fedora|all| +|ubuntu|focal, bionic| -The minimum version of Ansible required is 2.8 but tests have been done to: +The minimum version of Ansible required is 2.10, tests have been done to: -- The previous version, on version lower. +- The previous version. - The current version. - The development version. @@ -101,40 +87,8 @@ Some variarations of the build matrix do not work. These are the variations and | amazonlinux | No module named pkg_resources | -## [Testing](#testing) - -[Unit tests](https://travis-ci.com/robertdebock/ansible-role-ansible_lint) are done on every commit, pull request, release and periodically. - If you find issues, please register them in [GitHub](https://github.com/robertdebock/ansible-role-ansible_lint/issues) -Testing is done using [Tox](https://tox.readthedocs.io/en/latest/) and [Molecule](https://github.com/ansible/molecule): - -[Tox](https://tox.readthedocs.io/en/latest/) tests multiple ansible versions. -[Molecule](https://github.com/ansible/molecule) tests multiple distributions. - -To test using the defaults (any installed ansible version, namespace: `robertdebock`, image: `fedora`, tag: `latest`): - -``` -molecule test - -# Or select a specific image: -image=ubuntu molecule test -# Or select a specific image and a specific tag: -image="debian" tag="stable" tox -``` - -Or you can test multiple versions of Ansible, and select images: -Tox allows multiple versions of Ansible to be tested. To run the default (namespace: `robertdebock`, image: `fedora`, tag: `latest`) tests: - -``` -tox - -# To run CentOS (namespace: `robertdebock`, tag: `latest`) -image="centos" tox -# Or customize more: -image="debian" tag="stable" tox -``` - ## [License](#license) Apache-2.0 diff --git a/roles/ansible_lint/meta 2/.galaxy_install_info b/roles/ansible_lint/meta 2/.galaxy_install_info deleted file mode 100644 index f2ff1d7..0000000 --- a/roles/ansible_lint/meta 2/.galaxy_install_info +++ /dev/null @@ -1,2 +0,0 @@ -install_date: Mon Sep 28 13:21:51 2020 -version: 2.3.12 diff --git a/roles/ansible_lint/meta 2/exception.yml b/roles/ansible_lint/meta 2/exception.yml deleted file mode 100644 index 0f73f3c..0000000 --- a/roles/ansible_lint/meta 2/exception.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -exceptions: - - variation: amazonlinux:1 - reason: "No package matching 'python3-pip'" - - variation: amazonlinux - reason: "No module named pkg_resources" diff --git a/roles/ansible_lint/meta 2/preferences.yml b/roles/ansible_lint/meta 2/preferences.yml deleted file mode 100644 index e7fdebf..0000000 --- a/roles/ansible_lint/meta 2/preferences.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -tox_parallel: yes diff --git a/roles/ansible_lint/meta/.galaxy_install_info b/roles/ansible_lint/meta/.galaxy_install_info index f2ff1d7..2af0e02 100644 --- a/roles/ansible_lint/meta/.galaxy_install_info +++ b/roles/ansible_lint/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Mon Sep 28 13:21:51 2020 -version: 2.3.12 +install_date: Sun Mar 21 06:59:18 2021 +version: 3.0.1 diff --git a/roles/ansible_lint/meta/main.yml b/roles/ansible_lint/meta/main.yml index bec2ed2..53b5281 100644 --- a/roles/ansible_lint/meta/main.yml +++ b/roles/ansible_lint/meta/main.yml @@ -5,7 +5,7 @@ galaxy_info: description: Install ansible-lint on your system. license: Apache-2.0 company: none - min_ansible_version: 2.8 + min_ansible_version: "2.10" platforms: - name: EL @@ -13,20 +13,18 @@ galaxy_info: - 8 - name: Debian versions: - - buster - - bullseye + - all - name: Fedora versions: - - 31 - - 32 + - all - name: Ubuntu versions: - focal - bionic - - xenial galaxy_tags: - ansiblelint - - centos + - ansible + - lint dependencies: [] diff --git a/roles/ansible_lint/molecule/default/molecule.yml b/roles/ansible_lint/molecule/default/molecule.yml index d0c5bf0..e40d794 100644 --- a/roles/ansible_lint/molecule/default/molecule.yml +++ b/roles/ansible_lint/molecule/default/molecule.yml @@ -9,6 +9,7 @@ dependency: lint: | set -e yamllint . + ansible-lint driver: name: docker platforms: diff --git a/roles/ansible_lint/requirements 2.yml b/roles/ansible_lint/requirements 2.yml deleted file mode 100644 index 2fd552b..0000000 --- a/roles/ansible_lint/requirements 2.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- robertdebock.bootstrap -- robertdebock.buildtools -- robertdebock.epel -- robertdebock.python_pip diff --git a/roles/ansible_lint/requirements.yml b/roles/ansible_lint/requirements.yml index 2fd552b..d7e7d73 100644 --- a/roles/ansible_lint/requirements.yml +++ b/roles/ansible_lint/requirements.yml @@ -1,5 +1,6 @@ --- -- robertdebock.bootstrap -- robertdebock.buildtools -- robertdebock.epel -- robertdebock.python_pip +roles: + - name: robertdebock.bootstrap + - name: robertdebock.buildtools + - name: robertdebock.epel + - name: robertdebock.python_pip diff --git a/roles/ansible_lint/tasks/main.yml b/roles/ansible_lint/tasks/main.yml index 84ee2dd..997174e 100644 --- a/roles/ansible_lint/tasks/main.yml +++ b/roles/ansible_lint/tasks/main.yml @@ -1,6 +1,7 @@ --- # tasks file for ansible_lint + - name: install ansible_lint - pip: + ansible.builtin.pip: name: "{{ ansible_lint_packages }}" state: present diff --git a/roles/ansible_lint/tox.ini b/roles/ansible_lint/tox.ini index c1bc1d4..f57553b 100644 --- a/roles/ansible_lint/tox.ini +++ b/roles/ansible_lint/tox.ini @@ -2,25 +2,25 @@ # Ansible managed # [tox] -minversion = 3.7 -# Disabled "next" because of: -# https://github.com/ansible-community/molecule/issues/2626. -# envlist = py{38}-ansible-{previous,current,next} -envlist = py{38}-ansible-{previous,current} +minversion = 3.21.4 +# 2.11 has been disabled: couldn't resolve module/action 'docker_container'. +envlist = py{39}-ansible-{2.9,2.10} + skipsdist = true [testenv] deps = - previous: ansible>=2.8, <2.9 - current: ansible>=2.9 - next: git+https://github.com/ansible/ansible.git@devel - molecule[lint]>=3, <4 - docker>=4.2, <4.3 + 2.9: ansible == 2.9.* + 2.10: ansible == 2.10.* + 2.11: git+https://github.com/ansible/ansible.git@devel + molecule[docker] + docker == 4.* + ansible-lint == 5.* commands = molecule test setenv = TOX_ENVNAME={envname} - MOLECULE_EPHEMERAL_DIRECTORY=/tmp/.molecule/{env:image:fedora}-{env:tag:latest}/{envname} PY_COLORS=1 ANSIBLE_FORCE_COLOR=1 + ANSIBLE_ROLES_PATH=../ passenv = namespace image tag diff --git a/roles/ansible_lint/vars 2/main.yml b/roles/ansible_lint/vars 2/main.yml deleted file mode 100644 index 0a1756c..0000000 --- a/roles/ansible_lint/vars 2/main.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -# vars file for ansible_lint - -ansible_lint_packages: - - ansible-lint diff --git a/roles/ara/.ansible-lint b/roles/ara/.ansible-lint index eba57d1..7a17121 100644 --- a/roles/ara/.ansible-lint +++ b/roles/ara/.ansible-lint @@ -4,5 +4,9 @@ exclude_paths: - ./meta/exception.yml - ./meta/preferences.yml + - ./molecule/default/prepare.yml + - ./molecule/default/converge.yml - ./molecule/default/verify.yml + - ./molecule/default/collections.yml - ./.tox + - ./.cache diff --git a/roles/ara/.github 2/FUNDING.yml b/roles/ara/.github 2/FUNDING.yml deleted file mode 100644 index 67320f0..0000000 --- a/roles/ara/.github 2/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -github: robertdebock diff --git a/roles/ara/.github 2/pull_request_template.md b/roles/ara/.github 2/pull_request_template.md deleted file mode 100644 index b1578c0..0000000 --- a/roles/ara/.github 2/pull_request_template.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: Pull request -about: Describe the proposed change - ---- - -**Describe the change** -A clear and concise description of what the pull request is. - -**Testing** -In case a feature was added, how were tests performed? diff --git a/roles/ara/.github 2/settings.yml b/roles/ara/.github 2/settings.yml deleted file mode 100644 index e9e274a..0000000 --- a/roles/ara/.github 2/settings.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# -# Ansible managed -# -repository: - description: Install and configure ara on your system. - homepage: https://robertdebock.nl/ diff --git a/roles/ara/.github/settings.yml b/roles/ara/.github/settings.yml index e9e274a..3fa2afd 100644 --- a/roles/ara/.github/settings.yml +++ b/roles/ara/.github/settings.yml @@ -5,3 +5,4 @@ repository: description: Install and configure ara on your system. homepage: https://robertdebock.nl/ + topics: ansiblerecordsansible, ara, arareportsansible, cloud, development, monitoring, reporting, ansible, molecule, tox, playbook, hacktoberfest diff --git a/roles/ara/.github/workflows/galaxy.yml b/roles/ara/.github/workflows/galaxy.yml index 46a2556..1d36b74 100644 --- a/roles/ara/.github/workflows/galaxy.yml +++ b/roles/ara/.github/workflows/galaxy.yml @@ -6,17 +6,13 @@ name: Release to Ansible Galaxy on: - push: - tags: - - '*' - schedule: - - cron: '1 1 1 * *' - + release: + types: [created, edited, published, released] jobs: release: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: galaxy - uses: robertdebock/galaxy-action@1.0.1 + uses: robertdebock/galaxy-action@1.1.0 with: galaxy_api_key: ${{ secrets.galaxy_api_key }} diff --git a/roles/ara/.github/workflows/molecule.yml b/roles/ara/.github/workflows/molecule.yml index 0e236c8..b6587d7 100644 --- a/roles/ara/.github/workflows/molecule.yml +++ b/roles/ara/.github/workflows/molecule.yml @@ -15,20 +15,20 @@ on: jobs: lint: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: checkout uses: actions/checkout@v2 with: path: "${{ github.repository }}" - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: command: lint test: needs: - lint - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: @@ -40,7 +40,7 @@ jobs: - image: "debian" tag: "bullseye" - image: "fedora" - tag: "31" + tag: "32" - image: "fedora" tag: "latest" - image: "ubuntu" @@ -55,10 +55,7 @@ jobs: - name: parse apparmor for mysql run: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: image: ${{ matrix.config.image }} tag: ${{ matrix.config.tag }} - options: "--parallel all" - env: - TOX_PARALLEL_NO_SPINNER: 1 diff --git a/roles/ara/.gitignore b/roles/ara/.gitignore index 982db11..c15d16a 100644 --- a/roles/ara/.gitignore +++ b/roles/ara/.gitignore @@ -2,3 +2,4 @@ *.log *.swp .tox +.cache diff --git a/roles/ara/.gitignore 2 b/roles/ara/.gitignore 2 deleted file mode 100644 index 982db11..0000000 --- a/roles/ara/.gitignore 2 +++ /dev/null @@ -1,4 +0,0 @@ -.molecule -*.log -*.swp -.tox diff --git a/roles/ara/.travis.yml b/roles/ara/.travis.yml index a32aefa..21201e1 100644 --- a/roles/ara/.travis.yml +++ b/roles/ara/.travis.yml @@ -8,36 +8,23 @@ os: linux dist: xenial python: - - "3.8" + - "3.9" services: - docker -env: - global: - namespace="robertdebock" - jobs: - - image="centos" tag="latest" - - image="debian" tag="latest" - - image="debian" tag="bullseye" - - image="fedora" tag="31" - - image="fedora" tag="latest" - - image="ubuntu" tag="bionic" - cache: - pip install: - pip install --upgrade pip - - pip install tox + - pip install yamllint + - pip install ansible-lint script: - - function retry { counter=0 ; until "$@" ; do exit=$? ; counter=$(($counter + 1)) ; if [ $counter -ge 3 ] ; then return $exit ; fi ; done ; return 0; } ; retry tox --parallel all + - yamllint . + - ansible-lint notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ - slack: - secure: "dACQ6+hjrlymJb+XtpgegARWoz/k5ngOmpcPXfttkYmocU07ergyvn7xFF2PwCyw2wCds+E/iK2tOTMZ9yN6wbjGHfWbPsIJEzU6TyIYCoH5NJRn4j32Iql1y9lEGxYg1eaH7FIN0MLRMPuDLK6IINCBxaHR4GqIrIwrBIuGUInkzGQZhSDQ5xRYef+EfZIdmyQNOH7pW5n9zjbF1csy3bhZoem9/JLIfy7I+o08ddZYepdk7qYFmSEgR7TB1stTVZuCthRHdLZhgoW5tYrIpWXJD2OlIywaLMsJEfhW7EIfhd8aU8qbE8B7gjDkAYcaqK6D3zJr0TLI4u0ZLyMRwFDQSiMpr3IUeeR/Gtefu9KeSdxtPTDWZd0XA5sDmgRNe5m6FUNOnVZSwExdq5fWyzzaTqtqYu6YpWYXOa/zaodvHnouXlAeOWWFrmoV/I8MBF2ut5LwaiEK6XYfFt3o57RZynWe4z4KpLInwuBjjnaadYKzl1MMRFD+iNZQCP3BqbCR3pJcEash3yXFx/RW9eyVYnLSNnt5HJW99Eu5lEp9rdfc8GObZhlulVgwOAFVjbamP8AV7BjqLOqVjasVM85/op9s6bBy3x4DEG3yFhf6tc3fp1y44r4781NPhe92qrbq/a/rF0Drzza3CNmyZhZ0jVsamz8gQBby4RLY0iQ=" - on_success: change - template: "%{result}: %{repository_slug}@%{branch}, build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}>)" email: false diff --git a/roles/ara/.yamllint b/roles/ara/.yamllint index 894450c..a7ff098 100644 --- a/roles/ara/.yamllint +++ b/roles/ara/.yamllint @@ -13,3 +13,4 @@ rules: ignore: | .tox/ + .cache/ diff --git a/roles/ara/LICENSE b/roles/ara/LICENSE index bd15893..e770af8 100644 --- a/roles/ara/LICENSE +++ b/roles/ara/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 Robert de Bock (robert@meinit.nl) + Copyright 2021 Robert de Bock (robert@meinit.nl) 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/roles/ara/README.md b/roles/ara/README.md index 283e61d..d8c04ce 100644 --- a/roles/ara/README.md +++ b/roles/ara/README.md @@ -2,9 +2,9 @@ Install and configure ara on your system. -|Travis|GitHub|Quality|Downloads|Version| +|GitHub|GitLab|Quality|Downloads|Version| |------|------|-------|---------|-------| -|[![travis](https://travis-ci.com/robertdebock/ansible-role-ara.svg?branch=master)](https://travis-ci.com/robertdebock/ansible-role-ara)|[![github](https://github.com/robertdebock/ansible-role-ara/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-ara/actions)|[![quality](https://img.shields.io/ansible/quality/24687)](https://galaxy.ansible.com/robertdebock/ara)|[![downloads](https://img.shields.io/ansible/role/d/24687)](https://galaxy.ansible.com/robertdebock/ara)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-ara.svg)](https://github.com/robertdebock/ansible-role-ara/releases/)| +|[![github](https://github.com/robertdebock/ansible-role-ara/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-ara/actions)|[![gitlab](https://gitlab.com/robertdebock/ansible-role-ara/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-ara)|[![quality](https://img.shields.io/ansible/quality/24687)](https://galaxy.ansible.com/robertdebock/ara)|[![downloads](https://img.shields.io/ansible/role/d/24687)](https://galaxy.ansible.com/robertdebock/ara)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-ara.svg)](https://github.com/robertdebock/ansible-role-ara/releases/)| ## [Example Playbook](#example-playbook) @@ -20,7 +20,7 @@ This example is taken from `molecule/resources/converge.yml` and is tested on ea - role: robertdebock.ara ``` -The machine may need to be prepared using `molecule/resources/prepare.yml`: +The machine needs to be prepared in CI this is done using `molecule/resources/prepare.yml`: ```yaml --- - name: Prepare @@ -35,19 +35,6 @@ The machine may need to be prepared using `molecule/resources/prepare.yml`: - role: robertdebock.python_pip ``` -For verification `molecule/resources/verify.yml` runs after the role has been applied. -```yaml ---- -- name: Verify - hosts: all - become: yes - gather_facts: no - - tasks: - - name: check if connection still works - ping: -``` - Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles. ## [Role Variables](#role-variables) @@ -77,27 +64,26 @@ ara_user: root ## [Requirements](#requirements) -- Access to a repository containing packages, likely on the internet. -- A recent version of Ansible. (Tests run on the current, previous and next release of Ansible.) +- pip packages listed in [requirements.txt](https://github.com/robertdebock/ansible-role-ara/blob/master/requirements.txt). -The following roles can be installed to ensure all requirements are met, using `ansible-galaxy install -r requirements.yml`: +## [Status of requirements](#status-of-requirements) -```yaml ---- -- robertdebock.bootstrap -- robertdebock.buildtools -- robertdebock.epel -- robertdebock.python_pip -- robertdebock.service +The following roles are used to prepare a system. You may choose to prepare your system in another way, I have tested these roles as well. -``` +| Requirement | GitHub | GitLab | +|-------------|--------|--------| +| [robertdebock.bootstrap](https://galaxy.ansible.com/robertdebock/bootstrap) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-bootstrap/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-bootstrap/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-bootstrap/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-bootstrap) +| [robertdebock.buildtools](https://galaxy.ansible.com/robertdebock/buildtools) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-buildtools/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-buildtools/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-buildtools/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-buildtools) +| [robertdebock.epel](https://galaxy.ansible.com/robertdebock/epel) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-epel/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-epel/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-epel/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-epel) +| [robertdebock.python_pip](https://galaxy.ansible.com/robertdebock/python_pip) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-python_pip/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-python_pip/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-python_pip/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-python_pip) +| [robertdebock.service](https://galaxy.ansible.com/robertdebock/service) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-service/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-service/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-service/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-service) ## [Context](#context) This role is a part of many compatible roles. Have a look at [the documentation of these roles](https://robertdebock.nl/) for further information. Here is an overview of related roles: -![dependencies](https://raw.githubusercontent.com/robertdebock/drawings/artifacts/ara.png "Dependency") +![dependencies](https://raw.githubusercontent.com/robertdebock/ansible-role-ara/png/requirements.png "Dependencies") ## [Compatibility](#compatibility) @@ -107,12 +93,12 @@ This role has been tested on these [container images](https://hub.docker.com/u/r |---------|----| |el|8| |debian|buster, bullseye| -|fedora|31, 32| +|fedora|all| |ubuntu|bionic| -The minimum version of Ansible required is 2.8 but tests have been done to: +The minimum version of Ansible required is 2.10, tests have been done to: -- The previous version, on version lower. +- The previous version. - The current version. - The development version. @@ -122,46 +108,14 @@ Some variarations of the build matrix do not work. These are the variations and | variation | reason | |---------------------------|------------------------| -| Alpine | Could not find a version that satisfies the requirement Django>=2.1.5 | -| CentOS | No matching distribution found for Django>=2.1.5 | +| alpine | Could not find a version that satisfies the requirement Django>=2.1.5 | +| centos:7 | No matching distribution found for Django>=2.1.5 | | amazonlinux:1 | No package matching 'python3-pip' | | amazonlinux | No module named pkg_resources | -## [Testing](#testing) - -[Unit tests](https://travis-ci.com/robertdebock/ansible-role-ara) are done on every commit, pull request, release and periodically. - If you find issues, please register them in [GitHub](https://github.com/robertdebock/ansible-role-ara/issues) -Testing is done using [Tox](https://tox.readthedocs.io/en/latest/) and [Molecule](https://github.com/ansible/molecule): - -[Tox](https://tox.readthedocs.io/en/latest/) tests multiple ansible versions. -[Molecule](https://github.com/ansible/molecule) tests multiple distributions. - -To test using the defaults (any installed ansible version, namespace: `robertdebock`, image: `fedora`, tag: `latest`): - -``` -molecule test - -# Or select a specific image: -image=ubuntu molecule test -# Or select a specific image and a specific tag: -image="debian" tag="stable" tox -``` - -Or you can test multiple versions of Ansible, and select images: -Tox allows multiple versions of Ansible to be tested. To run the default (namespace: `robertdebock`, image: `fedora`, tag: `latest`) tests: - -``` -tox - -# To run CentOS (namespace: `robertdebock`, tag: `latest`) -image="centos" tox -# Or customize more: -image="debian" tag="stable" tox -``` - ## [License](#license) Apache-2.0 diff --git a/roles/ara/handlers/main.yml b/roles/ara/handlers/main.yml index f9f1544..a87f64a 100644 --- a/roles/ara/handlers/main.yml +++ b/roles/ara/handlers/main.yml @@ -1,13 +1,16 @@ --- # handlers file for ara + - name: restart ara - service: + ansible.builtin.service: name: ara state: restarted become: yes + when: + - not ansible_check_mode | bool - name: systemctl daemon-reload - systemd: + ansible.builtin.systemd: daemon_reload: yes become: yes notify: diff --git a/roles/ara/meta 2/.galaxy_install_info b/roles/ara/meta 2/.galaxy_install_info deleted file mode 100644 index ebc4342..0000000 --- a/roles/ara/meta 2/.galaxy_install_info +++ /dev/null @@ -1,2 +0,0 @@ -install_date: Mon Sep 28 13:21:56 2020 -version: 2.5.2 diff --git a/roles/ara/meta 2/preferences.yml b/roles/ara/meta 2/preferences.yml deleted file mode 100644 index e7fdebf..0000000 --- a/roles/ara/meta 2/preferences.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -tox_parallel: yes diff --git a/roles/ara/meta/.galaxy_install_info b/roles/ara/meta/.galaxy_install_info index ebc4342..166850e 100644 --- a/roles/ara/meta/.galaxy_install_info +++ b/roles/ara/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Mon Sep 28 13:21:56 2020 -version: 2.5.2 +install_date: Sun Mar 21 06:59:21 2021 +version: 3.0.3 diff --git a/roles/ara/meta/exception.yml b/roles/ara/meta/exception.yml index 1cb5a7c..f8ab796 100644 --- a/roles/ara/meta/exception.yml +++ b/roles/ara/meta/exception.yml @@ -1,8 +1,8 @@ --- exceptions: - - variation: Alpine + - variation: alpine reason: "Could not find a version that satisfies the requirement Django>=2.1.5" - - variation: CentOS + - variation: centos:7 reason: No matching distribution found for Django>=2.1.5 - variation: amazonlinux:1 reason: "No package matching 'python3-pip'" diff --git a/roles/ara/meta/main.yml b/roles/ara/meta/main.yml index 83fd29d..ea8d1df 100644 --- a/roles/ara/meta/main.yml +++ b/roles/ara/meta/main.yml @@ -5,7 +5,7 @@ galaxy_info: description: Install and configure ara on your system. license: Apache-2.0 company: none - min_ansible_version: 2.8 + min_ansible_version: "2.10" platforms: - name: EL @@ -17,8 +17,7 @@ galaxy_info: - bullseye - name: Fedora versions: - - 31 - - 32 + - all - name: Ubuntu versions: - bionic @@ -28,7 +27,6 @@ galaxy_info: - ara - arareportsansible - cloud - - centos - development - monitoring - reporting diff --git a/roles/ara/molecule 2/default/converge.yml b/roles/ara/molecule 2/default/converge.yml deleted file mode 100644 index 2b8d6e5..0000000 --- a/roles/ara/molecule 2/default/converge.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Converge - hosts: all - become: yes - gather_facts: yes - - roles: - - role: ansible-role-ara diff --git a/roles/ara/molecule 2/default/prepare.yml b/roles/ara/molecule 2/default/prepare.yml deleted file mode 100644 index b7ec2fa..0000000 --- a/roles/ara/molecule 2/default/prepare.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -- name: Prepare - hosts: all - become: yes - gather_facts: no - - roles: - - role: robertdebock.bootstrap - - role: robertdebock.buildtools - - role: robertdebock.epel - - role: robertdebock.python_pip diff --git a/roles/ara/molecule 2/default/verify.yml b/roles/ara/molecule 2/default/verify.yml deleted file mode 100644 index b9dc6f8..0000000 --- a/roles/ara/molecule 2/default/verify.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -- name: Verify - hosts: all - become: yes - gather_facts: no - - tasks: - - name: check if connection still works - ping: diff --git a/roles/ara/molecule/default/molecule.yml b/roles/ara/molecule/default/molecule.yml index a698dd3..7cbac1b 100644 --- a/roles/ara/molecule/default/molecule.yml +++ b/roles/ara/molecule/default/molecule.yml @@ -6,9 +6,11 @@ dependency: name: galaxy options: role-file: requirements.yml + requirements-file: requirements.yml lint: | set -e yamllint . + ansible-lint driver: name: docker platforms: diff --git a/roles/ara/requirements.yml b/roles/ara/requirements.yml index 7e6f377..3832035 100644 --- a/roles/ara/requirements.yml +++ b/roles/ara/requirements.yml @@ -1,6 +1,9 @@ --- -- robertdebock.bootstrap -- robertdebock.buildtools -- robertdebock.epel -- robertdebock.python_pip -- robertdebock.service +roles: + - name: robertdebock.bootstrap + - name: robertdebock.buildtools + - name: robertdebock.epel + - name: robertdebock.python_pip + - name: robertdebock.service +collections: + - name: community.general diff --git a/roles/ara/tasks/assert.yml b/roles/ara/tasks/assert.yml index 3dd6326..61d99b6 100644 --- a/roles/ara/tasks/assert.yml +++ b/roles/ara/tasks/assert.yml @@ -1,34 +1,33 @@ --- + - name: test if ara_configuration_file is set correctly - assert: + ansible.builtin.assert: that: - ara_configuration_file is defined - - ara_configuration_file | length > 0 + - ara_configuration_file is string quiet: yes - name: test if ara_user is set correctly - assert: + ansible.builtin.assert: that: - ara_user is defined - - ara_user | length > 0 + - ara_user is string quiet: yes - name: test if ara_configuration is set correctly - assert: + ansible.builtin.assert: that: - - ara_configuration | length > 0 - ara_configuration is iterable quiet: yes when: - ara_configuration is defined - name: test if item in ara_configuration is set correctly - assert: + ansible.builtin.assert: that: - item.option is defined - - item.option | length > 0 + - item.option is string - item.value is defined - - item.value | length > 0 quiet: yes loop: "{{ ara_configuration }}" loop_control: diff --git a/roles/ara/tasks/main.yml b/roles/ara/tasks/main.yml index ee5107c..5d3277a 100644 --- a/roles/ara/tasks/main.yml +++ b/roles/ara/tasks/main.yml @@ -1,61 +1,71 @@ --- # tasks file for ara + - name: include assert.yml - include_tasks: assert.yml + import_tasks: assert.yml + run_once: yes + delegate_to: localhost - name: install ara - pip: + ansible.builtin.pip: name: ara[server] state: present - name: create ara service - import_role: - name: service + ansible.builtin.import_role: + name: robertdebock.service + vars: + service_list: + - name: ara + description: Ansible Reports Ara + start_command: "{{ ara_binary_location }}/ara-manage runserver" + user_name: "{{ ara_user }}" - name: find callback_plugins path block: - name: try python2 - command: "{{ ara_setup_command_python2 }}" + ansible.builtin.command: "{{ ara_setup_command_python2 }}" register: ara_callback_plugins changed_when: no check_mode: no rescue: - name: try python3 - command: "{{ ara_setup_command_python3 }}" + ansible.builtin.command: "{{ ara_setup_command_python3 }}" register: ara_callback_plugins changed_when: no -- name: configure ansible to use ara - ini_file: - path: "{{ ara_configuration_file }}" - section: defaults - option: callback_plugins - value: "{{ ara_callback_plugins.stdout }}" - mode: "0644" - notify: - - restart ara - when: - - ara_configuration_file is defined - - ara_callback_plugins.stdout is defined +- name: configure ansible and ara + block: + - name: configure ansible to use ara + community.general.ini_file: + path: "{{ ara_configuration_file }}" + section: defaults + option: callback_plugins + value: "{{ ara_callback_plugins.stdout }}" + mode: "0644" + notify: + - restart ara + when: + - ara_callback_plugins.stdout is defined -- name: configure ara - ini_file: - path: "{{ ara_configuration_file }}" - section: ara - option: "{{ item.option }}" - value: "{{ item.value }}" - mode: "0644" - notify: - - restart ara - loop: "{{ ara_configuration }}" + - name: configure ara + community.general.ini_file: + path: "{{ ara_configuration_file }}" + section: ara + option: "{{ item.option }}" + value: "{{ item.value }}" + mode: "0644" + notify: + - restart ara + loop: "{{ ara_configuration }}" + loop_control: + label: "{{ item.option }}" when: - ara_configuration is defined - loop_control: - label: "{{ item.option }}" - name: start and enable ara - service: + ansible.builtin.service: name: ara state: started enabled: yes diff --git a/roles/ara/tox.ini b/roles/ara/tox.ini index c1bc1d4..f57553b 100644 --- a/roles/ara/tox.ini +++ b/roles/ara/tox.ini @@ -2,25 +2,25 @@ # Ansible managed # [tox] -minversion = 3.7 -# Disabled "next" because of: -# https://github.com/ansible-community/molecule/issues/2626. -# envlist = py{38}-ansible-{previous,current,next} -envlist = py{38}-ansible-{previous,current} +minversion = 3.21.4 +# 2.11 has been disabled: couldn't resolve module/action 'docker_container'. +envlist = py{39}-ansible-{2.9,2.10} + skipsdist = true [testenv] deps = - previous: ansible>=2.8, <2.9 - current: ansible>=2.9 - next: git+https://github.com/ansible/ansible.git@devel - molecule[lint]>=3, <4 - docker>=4.2, <4.3 + 2.9: ansible == 2.9.* + 2.10: ansible == 2.10.* + 2.11: git+https://github.com/ansible/ansible.git@devel + molecule[docker] + docker == 4.* + ansible-lint == 5.* commands = molecule test setenv = TOX_ENVNAME={envname} - MOLECULE_EPHEMERAL_DIRECTORY=/tmp/.molecule/{env:image:fedora}-{env:tag:latest}/{envname} PY_COLORS=1 ANSIBLE_FORCE_COLOR=1 + ANSIBLE_ROLES_PATH=../ passenv = namespace image tag diff --git a/roles/ara/vars/main.yml b/roles/ara/vars/main.yml index 131206f..666fdaf 100644 --- a/roles/ara/vars/main.yml +++ b/roles/ara/vars/main.yml @@ -10,9 +10,3 @@ ara_binary_location: "{{ _ara_binary_location[ansible_os_family] | default(_ara_ ara_setup_command_python2: python -m ara.setup.callback_plugins ara_setup_command_python3: python3 -m ara.setup.callback_plugins - -service_list: - - name: ara - description: Ansible Reports Ara - start_command: "{{ ara_binary_location }}/ara-manage runserver" - user_name: "{{ ara_user }}" diff --git a/roles/atom/.ansible-lint b/roles/atom/.ansible-lint index eba57d1..7a17121 100644 --- a/roles/atom/.ansible-lint +++ b/roles/atom/.ansible-lint @@ -4,5 +4,9 @@ exclude_paths: - ./meta/exception.yml - ./meta/preferences.yml + - ./molecule/default/prepare.yml + - ./molecule/default/converge.yml - ./molecule/default/verify.yml + - ./molecule/default/collections.yml - ./.tox + - ./.cache diff --git a/roles/atom/.github 2/FUNDING.yml b/roles/atom/.github 2/FUNDING.yml deleted file mode 100644 index 67320f0..0000000 --- a/roles/atom/.github 2/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -github: robertdebock diff --git a/roles/atom/.github 2/pull_request_template.md b/roles/atom/.github 2/pull_request_template.md deleted file mode 100644 index b1578c0..0000000 --- a/roles/atom/.github 2/pull_request_template.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: Pull request -about: Describe the proposed change - ---- - -**Describe the change** -A clear and concise description of what the pull request is. - -**Testing** -In case a feature was added, how were tests performed? diff --git a/roles/atom/.github 2/settings.yml b/roles/atom/.github 2/settings.yml deleted file mode 100644 index 45c678d..0000000 --- a/roles/atom/.github 2/settings.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# -# Ansible managed -# -repository: - description: Install atom on your system. - homepage: https://robertdebock.nl/ diff --git a/roles/atom/.github/settings.yml b/roles/atom/.github/settings.yml index 45c678d..5bfe154 100644 --- a/roles/atom/.github/settings.yml +++ b/roles/atom/.github/settings.yml @@ -5,3 +5,4 @@ repository: description: Install atom on your system. homepage: https://robertdebock.nl/ + topics: atom, ide, ansible, molecule, tox, playbook, hacktoberfest diff --git a/roles/atom/.github/workflows/galaxy.yml b/roles/atom/.github/workflows/galaxy.yml index 46a2556..1d36b74 100644 --- a/roles/atom/.github/workflows/galaxy.yml +++ b/roles/atom/.github/workflows/galaxy.yml @@ -6,17 +6,13 @@ name: Release to Ansible Galaxy on: - push: - tags: - - '*' - schedule: - - cron: '1 1 1 * *' - + release: + types: [created, edited, published, released] jobs: release: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: galaxy - uses: robertdebock/galaxy-action@1.0.1 + uses: robertdebock/galaxy-action@1.1.0 with: galaxy_api_key: ${{ secrets.galaxy_api_key }} diff --git a/roles/atom/.github/workflows/molecule.yml b/roles/atom/.github/workflows/molecule.yml index 28c9841..54b2c5e 100644 --- a/roles/atom/.github/workflows/molecule.yml +++ b/roles/atom/.github/workflows/molecule.yml @@ -15,32 +15,30 @@ on: jobs: lint: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: checkout uses: actions/checkout@v2 with: path: "${{ github.repository }}" - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: command: lint test: needs: - lint - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: config: - - image: "centos" - tag: "7" - image: "centos" tag: "latest" - image: "debian" tag: "latest" - image: "fedora" - tag: "31" + tag: "32" - image: "fedora" tag: "latest" - image: "opensuse" @@ -49,8 +47,6 @@ jobs: tag: "latest" - image: "ubuntu" tag: "bionic" - - image: "ubuntu" - tag: "xenial" steps: - name: checkout uses: actions/checkout@v2 @@ -61,10 +57,7 @@ jobs: - name: parse apparmor for mysql run: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: image: ${{ matrix.config.image }} tag: ${{ matrix.config.tag }} - options: "--parallel all" - env: - TOX_PARALLEL_NO_SPINNER: 1 diff --git a/roles/atom/.gitignore b/roles/atom/.gitignore index 982db11..c15d16a 100644 --- a/roles/atom/.gitignore +++ b/roles/atom/.gitignore @@ -2,3 +2,4 @@ *.log *.swp .tox +.cache diff --git a/roles/atom/.gitignore 2 b/roles/atom/.gitignore 2 deleted file mode 100644 index 982db11..0000000 --- a/roles/atom/.gitignore 2 +++ /dev/null @@ -1,4 +0,0 @@ -.molecule -*.log -*.swp -.tox diff --git a/roles/atom/.travis.yml b/roles/atom/.travis.yml index 381df31..21201e1 100644 --- a/roles/atom/.travis.yml +++ b/roles/atom/.travis.yml @@ -8,39 +8,23 @@ os: linux dist: xenial python: - - "3.8" + - "3.9" services: - docker -env: - global: - namespace="robertdebock" - jobs: - - image="centos" tag="7" - - image="centos" tag="latest" - - image="debian" tag="latest" - - image="fedora" tag="31" - - image="fedora" tag="latest" - - image="opensuse" tag="latest" - - image="ubuntu" tag="latest" - - image="ubuntu" tag="bionic" - - image="ubuntu" tag="xenial" - cache: - pip install: - pip install --upgrade pip - - pip install tox + - pip install yamllint + - pip install ansible-lint script: - - function retry { counter=0 ; until "$@" ; do exit=$? ; counter=$(($counter + 1)) ; if [ $counter -ge 3 ] ; then return $exit ; fi ; done ; return 0; } ; retry tox --parallel all + - yamllint . + - ansible-lint notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ - slack: - secure: "YzJVJjKrJ6/mOCRGmFlaLWW1U9/sVQGuFd9ENj2ErPas+Yb4RTGR3+3HgRD9mqS77jkcbCUOjr9vlZpqXaWLMCVDQfLpk3XlyhcifLR6gCPH7DW/pdsvtDRXSbldPb2yMJFM4cHZvqWHq2rXaN0VuI8MHpV54hXc6f8f2pIl2SyBeLmSDAs6yrs0LGvJfWEMcXNqe25MX2YdsCuu8CsVeXOzqVgaRAhSP3nB/eF85ElxrpXyca+s2osGYPuhKLfkss/oqp9Z8Bk4uWe//dAKuGbCWK5C89htCZvYygx8iS1PGLCHGVAhRiKWynVURMx0K6AEqinRy3Mow44TXdY3A4ots3QZeZUNB4le5JZTCrP4+QAtbM31O1Fk8LNxoVQnXB7tuZUJYWX5jrYIxlzAC43DsPcBQsF0Uz1xnNQAhJVtOGzwDjz2lq82cH6ENvUJbQE49mxcFMdvmMrPcxuQBr31N5/UB4txOzl6W41iE/XXOiR5sm0ksNLRN3Uadaefcpy+Sijr0g4HX3tB2ycMIWHV5WfluYyifor2dEar2VsTkTtTiyjaBGutk8vIwQGdoPhTAMu5AwQJOclLjup9vhX8wNG5X/GjmNtny0xVCvxoI5Qw/kbNdCnre2AqqzEvNw8q6mXHyJlaOJ+MnT1CdewzC0UNW/Y1Q67qtmdKpAE=" - on_success: change - template: "%{result}: %{repository_slug}@%{branch}, build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}>)" email: false diff --git a/roles/atom/.yamllint b/roles/atom/.yamllint index 894450c..a7ff098 100644 --- a/roles/atom/.yamllint +++ b/roles/atom/.yamllint @@ -13,3 +13,4 @@ rules: ignore: | .tox/ + .cache/ diff --git a/roles/atom/LICENSE b/roles/atom/LICENSE index bd15893..e770af8 100644 --- a/roles/atom/LICENSE +++ b/roles/atom/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 Robert de Bock (robert@meinit.nl) + Copyright 2021 Robert de Bock (robert@meinit.nl) 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/roles/atom/README.md b/roles/atom/README.md index 45b68d8..f21b6ea 100644 --- a/roles/atom/README.md +++ b/roles/atom/README.md @@ -2,9 +2,9 @@ Install atom on your system. -|Travis|GitHub|Quality|Downloads|Version| +|GitHub|GitLab|Quality|Downloads|Version| |------|------|-------|---------|-------| -|[![travis](https://travis-ci.com/robertdebock/ansible-role-atom.svg?branch=master)](https://travis-ci.com/robertdebock/ansible-role-atom)|[![github](https://github.com/robertdebock/ansible-role-atom/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-atom/actions)|[![quality](https://img.shields.io/ansible/quality/36572)](https://galaxy.ansible.com/robertdebock/atom)|[![downloads](https://img.shields.io/ansible/role/d/36572)](https://galaxy.ansible.com/robertdebock/atom)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-atom.svg)](https://github.com/robertdebock/ansible-role-atom/releases/)| +|[![github](https://github.com/robertdebock/ansible-role-atom/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-atom/actions)|[![gitlab](https://gitlab.com/robertdebock/ansible-role-atom/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-atom)|[![quality](https://img.shields.io/ansible/quality/36572)](https://galaxy.ansible.com/robertdebock/atom)|[![downloads](https://img.shields.io/ansible/role/d/36572)](https://galaxy.ansible.com/robertdebock/atom)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-atom.svg)](https://github.com/robertdebock/ansible-role-atom/releases/)| ## [Example Playbook](#example-playbook) @@ -20,7 +20,7 @@ This example is taken from `molecule/resources/converge.yml` and is tested on ea - role: robertdebock.atom ``` -The machine may need to be prepared using `molecule/resources/prepare.yml`: +The machine needs to be prepared in CI this is done using `molecule/resources/prepare.yml`: ```yaml --- - name: Prepare @@ -32,19 +32,6 @@ The machine may need to be prepared using `molecule/resources/prepare.yml`: - role: robertdebock.bootstrap ``` -For verification `molecule/resources/verify.yml` runs after the role has been applied. -```yaml ---- -- name: Verify - hosts: all - become: yes - gather_facts: no - - tasks: - - name: check if atom exists works - command: file /usr/bin/atom -``` - Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles. ## [Role Variables](#role-variables) @@ -63,23 +50,22 @@ atom_apm_packages: ## [Requirements](#requirements) -- Access to a repository containing packages, likely on the internet. -- A recent version of Ansible. (Tests run on the current, previous and next release of Ansible.) +- pip packages listed in [requirements.txt](https://github.com/robertdebock/ansible-role-atom/blob/master/requirements.txt). -The following roles can be installed to ensure all requirements are met, using `ansible-galaxy install -r requirements.yml`: +## [Status of requirements](#status-of-requirements) -```yaml ---- -- robertdebock.bootstrap +The following roles are used to prepare a system. You may choose to prepare your system in another way, I have tested these roles as well. -``` +| Requirement | GitHub | GitLab | +|-------------|--------|--------| +| [robertdebock.bootstrap](https://galaxy.ansible.com/robertdebock/bootstrap) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-bootstrap/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-bootstrap/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-bootstrap/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-bootstrap) ## [Context](#context) This role is a part of many compatible roles. Have a look at [the documentation of these roles](https://robertdebock.nl/) for further information. Here is an overview of related roles: -![dependencies](https://raw.githubusercontent.com/robertdebock/drawings/artifacts/atom.png "Dependency") +![dependencies](https://raw.githubusercontent.com/robertdebock/ansible-role-atom/png/requirements.png "Dependencies") ## [Compatibility](#compatibility) @@ -87,15 +73,15 @@ This role has been tested on these [container images](https://hub.docker.com/u/r |container|tags| |---------|----| -|el|7, 8| +|el|8| |debian|buster| -|fedora|31, 32| +|fedora|all| |opensuse|all| -|ubuntu|focal, bionic, xenial| +|ubuntu|focal, bionic| -The minimum version of Ansible required is 2.8 but tests have been done to: +The minimum version of Ansible required is 2.10, tests have been done to: -- The previous version, on version lower. +- The previous version. - The current version. - The development version. @@ -107,42 +93,11 @@ Some variarations of the build matrix do not work. These are the variations and |---------------------------|------------------------| | amazonlinux:1 | Package: atom ... Requires: libsecret-1.so.0 ... and ... polkit | | debian:bullseye | An error occurred during the test sequence action: 'idempotence'. Cleaning up. | +| centos:7 | /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found | -## [Testing](#testing) - -[Unit tests](https://travis-ci.com/robertdebock/ansible-role-atom) are done on every commit, pull request, release and periodically. - If you find issues, please register them in [GitHub](https://github.com/robertdebock/ansible-role-atom/issues) -Testing is done using [Tox](https://tox.readthedocs.io/en/latest/) and [Molecule](https://github.com/ansible/molecule): - -[Tox](https://tox.readthedocs.io/en/latest/) tests multiple ansible versions. -[Molecule](https://github.com/ansible/molecule) tests multiple distributions. - -To test using the defaults (any installed ansible version, namespace: `robertdebock`, image: `fedora`, tag: `latest`): - -``` -molecule test - -# Or select a specific image: -image=ubuntu molecule test -# Or select a specific image and a specific tag: -image="debian" tag="stable" tox -``` - -Or you can test multiple versions of Ansible, and select images: -Tox allows multiple versions of Ansible to be tested. To run the default (namespace: `robertdebock`, image: `fedora`, tag: `latest`) tests: - -``` -tox - -# To run CentOS (namespace: `robertdebock`, tag: `latest`) -image="centos" tox -# Or customize more: -image="debian" tag="stable" tox -``` - ## [License](#license) Apache-2.0 diff --git a/roles/atom/meta 2/.galaxy_install_info b/roles/atom/meta 2/.galaxy_install_info deleted file mode 100644 index 6564449..0000000 --- a/roles/atom/meta 2/.galaxy_install_info +++ /dev/null @@ -1,2 +0,0 @@ -install_date: Mon Sep 28 13:21:59 2020 -version: 2.5.1 diff --git a/roles/atom/meta 2/exception.yml b/roles/atom/meta 2/exception.yml deleted file mode 100644 index aaa4bb6..0000000 --- a/roles/atom/meta 2/exception.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -exceptions: - - variation: amazonlinux:1 - reason: "Package: atom ... Requires: libsecret-1.so.0 ... and ... polkit" - - variation: debian:bullseye - reason: "An error occurred during the test sequence action: 'idempotence'. Cleaning up." diff --git a/roles/atom/meta 2/preferences.yml b/roles/atom/meta 2/preferences.yml deleted file mode 100644 index e7fdebf..0000000 --- a/roles/atom/meta 2/preferences.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -tox_parallel: yes diff --git a/roles/atom/meta/.galaxy_install_info b/roles/atom/meta/.galaxy_install_info index 6564449..aec17fd 100644 --- a/roles/atom/meta/.galaxy_install_info +++ b/roles/atom/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Mon Sep 28 13:21:59 2020 -version: 2.5.1 +install_date: Sun Mar 21 06:59:24 2021 +version: 3.0.3 diff --git a/roles/atom/meta/exception.yml b/roles/atom/meta/exception.yml index aaa4bb6..4dec61a 100644 --- a/roles/atom/meta/exception.yml +++ b/roles/atom/meta/exception.yml @@ -4,3 +4,5 @@ exceptions: reason: "Package: atom ... Requires: libsecret-1.so.0 ... and ... polkit" - variation: debian:bullseye reason: "An error occurred during the test sequence action: 'idempotence'. Cleaning up." + - variation: centos:7 + reason: "/lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found" diff --git a/roles/atom/meta/main.yml b/roles/atom/meta/main.yml index 4ef20dd..23ef5f7 100644 --- a/roles/atom/meta/main.yml +++ b/roles/atom/meta/main.yml @@ -1,24 +1,23 @@ --- galaxy_info: author: Robert de Bock + namespace: robertdebock role_name: atom description: Install atom on your system. license: Apache-2.0 company: none - min_ansible_version: 2.8 + min_ansible_version: "2.10" platforms: - name: EL versions: - - 7 - 8 - name: Debian versions: - buster - name: Fedora versions: - - 31 - - 32 + - all - name: OpenSUSE versions: - all @@ -26,10 +25,9 @@ galaxy_info: versions: - focal - bionic - - xenial galaxy_tags: - atom - - centos + - ide dependencies: [] diff --git a/roles/atom/molecule 2/default/converge.yml b/roles/atom/molecule 2/default/converge.yml deleted file mode 100644 index 0e76e11..0000000 --- a/roles/atom/molecule 2/default/converge.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Converge - hosts: all - become: yes - gather_facts: yes - - roles: - - role: ansible-role-atom diff --git a/roles/atom/molecule 2/default/prepare.yml b/roles/atom/molecule 2/default/prepare.yml deleted file mode 100644 index feb7d81..0000000 --- a/roles/atom/molecule 2/default/prepare.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Prepare - hosts: all - gather_facts: no - become: yes - - roles: - - role: robertdebock.bootstrap diff --git a/roles/atom/molecule 2/default/verify.yml b/roles/atom/molecule 2/default/verify.yml deleted file mode 100644 index 303c2a7..0000000 --- a/roles/atom/molecule 2/default/verify.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -- name: Verify - hosts: all - become: yes - gather_facts: no - - tasks: - - name: check if atom exists works - command: file /usr/bin/atom diff --git a/roles/atom/molecule/default/molecule.yml b/roles/atom/molecule/default/molecule.yml index 5e39405..60cbc1e 100644 --- a/roles/atom/molecule/default/molecule.yml +++ b/roles/atom/molecule/default/molecule.yml @@ -6,9 +6,11 @@ dependency: name: galaxy options: role-file: requirements.yml + requirements-file: requirements.yml lint: | set -e yamllint . + ansible-lint driver: name: docker platforms: diff --git a/roles/atom/requirements 2.yml b/roles/atom/requirements 2.yml deleted file mode 100644 index 46dec9d..0000000 --- a/roles/atom/requirements 2.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- robertdebock.bootstrap diff --git a/roles/atom/requirements.yml b/roles/atom/requirements.yml index 46dec9d..4971e35 100644 --- a/roles/atom/requirements.yml +++ b/roles/atom/requirements.yml @@ -1,2 +1,5 @@ --- -- robertdebock.bootstrap +roles: + - name: robertdebock.bootstrap +collections: + - name: community.general diff --git a/roles/atom/tasks/assert.yml b/roles/atom/tasks/assert.yml index 450df5d..2172a60 100644 --- a/roles/atom/tasks/assert.yml +++ b/roles/atom/tasks/assert.yml @@ -1,8 +1,8 @@ --- + - name: test if atom_apm_packages is set correctly - assert: + ansible.builtin.assert: that: - - atom_apm_packages | length > 0 - atom_apm_packages is iterable quiet: yes when: diff --git a/roles/atom/tasks/main.yml b/roles/atom/tasks/main.yml index 03dbf21..567f8e9 100644 --- a/roles/atom/tasks/main.yml +++ b/roles/atom/tasks/main.yml @@ -1,10 +1,13 @@ --- # tasks file for atom + - name: include assert.yml - include_tasks: assert.yml + import_tasks: assert.yml + run_once: yes + delegate_to: localhost - name: install requirements - package: + ansible.builtin.package: name: "{{ atom_requirements }}" state: present when: @@ -12,26 +15,23 @@ - ansible_pkg_mgr == "apt" - name: download atom - get_url: + ansible.builtin.get_url: url: "{{ atom_package_url }}" dest: "/tmp/{{ atom_package }}" checksum: "{{ atom_checksum }}" validate_certs: no when: - - ansible_pkg_mgr == "apt" or - ansible_pkg_mgr == "dnf" or - ansible_pkg_mgr == "yum" or - ansible_pkg_mgr == "zypper" + - ansible_pkg_mgr in [ "apt", "dnf", "yum", "zypper" ] - name: install atom deb - apt: + ansible.builtin.apt: deb: "/tmp/{{ atom_package }}" state: present when: - ansible_pkg_mgr == "apt" - name: install atom rpm dnf - dnf: + ansible.builtin.dnf: name: "/tmp/{{ atom_package }}" state: present disable_gpg_check: yes @@ -39,7 +39,7 @@ - ansible_pkg_mgr == "dnf" - name: install atom rpm yum - yum: + ansible.builtin.yum: name: "/tmp/{{ atom_package }}" state: present disable_gpg_check: yes @@ -47,7 +47,7 @@ - ansible_pkg_mgr == "yum" - name: install atom rpm zypper - zypper: + community.general.zypper: name: "/tmp/{{ atom_package }}" state: present disable_gpg_check: yes @@ -55,7 +55,7 @@ - ansible_pkg_mgr == "zypper" - name: install apm packages - command: apm install {{ item }} + ansible.builtin.command: apm install {{ item }} args: creates: /root/.atom/packages/linter loop: "{{ atom_apm_packages }}" diff --git a/roles/atom/tox.ini b/roles/atom/tox.ini index c1bc1d4..f57553b 100644 --- a/roles/atom/tox.ini +++ b/roles/atom/tox.ini @@ -2,25 +2,25 @@ # Ansible managed # [tox] -minversion = 3.7 -# Disabled "next" because of: -# https://github.com/ansible-community/molecule/issues/2626. -# envlist = py{38}-ansible-{previous,current,next} -envlist = py{38}-ansible-{previous,current} +minversion = 3.21.4 +# 2.11 has been disabled: couldn't resolve module/action 'docker_container'. +envlist = py{39}-ansible-{2.9,2.10} + skipsdist = true [testenv] deps = - previous: ansible>=2.8, <2.9 - current: ansible>=2.9 - next: git+https://github.com/ansible/ansible.git@devel - molecule[lint]>=3, <4 - docker>=4.2, <4.3 + 2.9: ansible == 2.9.* + 2.10: ansible == 2.10.* + 2.11: git+https://github.com/ansible/ansible.git@devel + molecule[docker] + docker == 4.* + ansible-lint == 5.* commands = molecule test setenv = TOX_ENVNAME={envname} - MOLECULE_EPHEMERAL_DIRECTORY=/tmp/.molecule/{env:image:fedora}-{env:tag:latest}/{envname} PY_COLORS=1 ANSIBLE_FORCE_COLOR=1 + ANSIBLE_ROLES_PATH=../ passenv = namespace image tag diff --git a/roles/atom/vars/main.yml b/roles/atom/vars/main.yml index 1f06b5b..f637038 100644 --- a/roles/atom/vars/main.yml +++ b/roles/atom/vars/main.yml @@ -24,9 +24,9 @@ atom_package: "{{ _atom_package[ansible_pkg_mgr]['name'] }}" # role on second runs as it calculates the (local) checksum and uses the results # to see if the artifact would need to be downloaded again. _atom_checksum: - dnf: &rpmchecksum "sha256:c281cbf02e0640b0cefc6232bd16ddfc8841a81ed1b6a9d7e5fc7d135ac7d831" + dnf: &rpmchecksum "sha256:e68d293033741f1f76650b73ea896dbfa94f2ebcaef9330a25001362f5523b7e" yum: *rpmchecksum zypper: *rpmchecksum - apt: "sha256:ea1517f928916e09108fc1a0e6942304fcaa0dc9a920e0eb2de45d128dc1f331" + apt: "sha256:e1c650fcfdfc09aafef0ecfe041d254ad9007fb3ca797dafd21c8333fd0b1340" atom_checksum: "{{ _atom_checksum[ansible_pkg_mgr] }}" diff --git a/roles/bootstrap/.ansible-lint b/roles/bootstrap/.ansible-lint index cb2872e..7a17121 100644 --- a/roles/bootstrap/.ansible-lint +++ b/roles/bootstrap/.ansible-lint @@ -2,6 +2,11 @@ # Ansible managed # exclude_paths: + - ./meta/exception.yml - ./meta/preferences.yml + - ./molecule/default/prepare.yml + - ./molecule/default/converge.yml - ./molecule/default/verify.yml + - ./molecule/default/collections.yml - ./.tox + - ./.cache diff --git a/roles/bootstrap/.ansible-lint 2 b/roles/bootstrap/.ansible-lint 2 deleted file mode 100644 index cb2872e..0000000 --- a/roles/bootstrap/.ansible-lint 2 +++ /dev/null @@ -1,7 +0,0 @@ -# -# Ansible managed -# -exclude_paths: - - ./meta/preferences.yml - - ./molecule/default/verify.yml - - ./.tox diff --git a/roles/bootstrap/.github 2/FUNDING.yml b/roles/bootstrap/.github 2/FUNDING.yml deleted file mode 100644 index 67320f0..0000000 --- a/roles/bootstrap/.github 2/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -github: robertdebock diff --git a/roles/bootstrap/.github 2/pull_request_template.md b/roles/bootstrap/.github 2/pull_request_template.md deleted file mode 100644 index b1578c0..0000000 --- a/roles/bootstrap/.github 2/pull_request_template.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: Pull request -about: Describe the proposed change - ---- - -**Describe the change** -A clear and concise description of what the pull request is. - -**Testing** -In case a feature was added, how were tests performed? diff --git a/roles/bootstrap/.github 2/settings.yml b/roles/bootstrap/.github 2/settings.yml deleted file mode 100644 index eaf6fb8..0000000 --- a/roles/bootstrap/.github 2/settings.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# -# Ansible managed -# -repository: - description: Prepare your system to be managed by Ansible. - homepage: https://robertdebock.nl/ diff --git a/roles/bootstrap/.github/settings.yml b/roles/bootstrap/.github/settings.yml index eaf6fb8..4729c2c 100644 --- a/roles/bootstrap/.github/settings.yml +++ b/roles/bootstrap/.github/settings.yml @@ -5,3 +5,4 @@ repository: description: Prepare your system to be managed by Ansible. homepage: https://robertdebock.nl/ + topics: bootstrap, python, sudo, ansible, molecule, tox, playbook, hacktoberfest diff --git a/roles/bootstrap/.github/workflows/galaxy.yml b/roles/bootstrap/.github/workflows/galaxy.yml index 7ff6f4b..1d36b74 100644 --- a/roles/bootstrap/.github/workflows/galaxy.yml +++ b/roles/bootstrap/.github/workflows/galaxy.yml @@ -6,17 +6,13 @@ name: Release to Ansible Galaxy on: - push: - tags: - - '*' - schedule: - - cron: '2 2 2 * *' - + release: + types: [created, edited, published, released] jobs: release: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: galaxy - uses: robertdebock/galaxy-action@1.0.1 + uses: robertdebock/galaxy-action@1.1.0 with: galaxy_api_key: ${{ secrets.galaxy_api_key }} diff --git a/roles/bootstrap/.github/workflows/molecule.yml b/roles/bootstrap/.github/workflows/molecule.yml index 98b4d68..dd9107f 100644 --- a/roles/bootstrap/.github/workflows/molecule.yml +++ b/roles/bootstrap/.github/workflows/molecule.yml @@ -15,30 +15,26 @@ on: jobs: lint: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: checkout uses: actions/checkout@v2 with: path: "${{ github.repository }}" - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: command: lint test: needs: - lint - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: config: - - image: "alpine" - tag: "latest" - - image: "alpine" - tag: "edge" - image: "amazonlinux" - tag: "1" + tag: "latest" - image: "centos" tag: "7" - image: "centos" @@ -48,7 +44,7 @@ jobs: - image: "debian" tag: "bullseye" - image: "fedora" - tag: "31" + tag: "32" - image: "fedora" tag: "latest" - image: "opensuse" @@ -57,8 +53,6 @@ jobs: tag: "latest" - image: "ubuntu" tag: "bionic" - - image: "ubuntu" - tag: "xenial" steps: - name: checkout uses: actions/checkout@v2 @@ -69,10 +63,7 @@ jobs: - name: parse apparmor for mysql run: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: image: ${{ matrix.config.image }} tag: ${{ matrix.config.tag }} - options: "--parallel all" - env: - TOX_PARALLEL_NO_SPINNER: 1 diff --git a/roles/bootstrap/.gitignore b/roles/bootstrap/.gitignore index 982db11..c15d16a 100644 --- a/roles/bootstrap/.gitignore +++ b/roles/bootstrap/.gitignore @@ -2,3 +2,4 @@ *.log *.swp .tox +.cache diff --git a/roles/bootstrap/.gitignore 2 b/roles/bootstrap/.gitignore 2 deleted file mode 100644 index 982db11..0000000 --- a/roles/bootstrap/.gitignore 2 +++ /dev/null @@ -1,4 +0,0 @@ -.molecule -*.log -*.swp -.tox diff --git a/roles/bootstrap/.travis.yml b/roles/bootstrap/.travis.yml index f2adf09..21201e1 100644 --- a/roles/bootstrap/.travis.yml +++ b/roles/bootstrap/.travis.yml @@ -8,43 +8,23 @@ os: linux dist: xenial python: - - "3.8" + - "3.9" services: - docker -env: - global: - namespace="robertdebock" - jobs: - - image="alpine" tag="latest" - - image="alpine" tag="edge" - - image="amazonlinux" tag="1" - - image="centos" tag="7" - - image="centos" tag="latest" - - image="debian" tag="latest" - - image="debian" tag="bullseye" - - image="fedora" tag="31" - - image="fedora" tag="latest" - - image="opensuse" tag="latest" - - image="ubuntu" tag="latest" - - image="ubuntu" tag="bionic" - - image="ubuntu" tag="xenial" - cache: - pip install: - pip install --upgrade pip - - pip install tox + - pip install yamllint + - pip install ansible-lint script: - - function retry { counter=0 ; until "$@" ; do exit=$? ; counter=$(($counter + 1)) ; if [ $counter -ge 3 ] ; then return $exit ; fi ; done ; return 0; } ; retry tox --parallel all + - yamllint . + - ansible-lint notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ - slack: - secure: "c/7w29ATfGyTJDowxJ61F/a2KhWrqIS726AXFLlzhMMlMcdXpRem04GLDCKQeVeqxGhvsCHqjvYEvtEpjQE/j3l3vpkAT2yeqoztPUS6r7VJZ0ykhNKwqTv1cUvhGIj3inMVOb2gg05n0LwfjnKfJfWPsxGqnA3lxU1O/skLUdBYsM/fN92cqRwI26CIwCn1BsvMrueqZzwltxZcI0q4RFyR7Boe6KgalfzRq00EP2O2uGLPjmAkghWvXIJe7Kl9t6OO08+ITp3LbHZ6oLGPbBxd2YB4nW9GvJRRYw0Bz1jKMeLVNNsyyMFXqJep2Y2+gwaOLo/miK4hJhi19+p+ftiayae+58UMgw4s5huNIAoYga1AdPNUzE0LL82X6Ig/Gxt+fPEzkH5ivrP0LK46Ef65amhtHD117IugTdaXWM43GyQxPgx/DVb7CBP82OC8BOUJg5uiunGdld4UsyJ4BDfV21x5vN1IEund8poevz2/mq4h55cLI6DtiuQsupCI2fmQ3LQ593QPmXG2n8BhcuaJda8JXwwyx3OMuXqQaHQjvWMpnqgpV79MutwDZM9t0Ym5s83xMP6Ti7rCXGAn5EdUrsF9tjsJRPbi0EJFAkrIRsqpu/gHeLrIfnn1MkDJvmF1BsoaPzlQ0hrgPocBBJnvmrzye4m9N5sUA3uYSac=" - on_success: change - template: "%{result}: %{repository_slug}@%{branch}, build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}>)" email: false diff --git a/roles/bootstrap/.yamllint b/roles/bootstrap/.yamllint index 894450c..a7ff098 100644 --- a/roles/bootstrap/.yamllint +++ b/roles/bootstrap/.yamllint @@ -13,3 +13,4 @@ rules: ignore: | .tox/ + .cache/ diff --git a/roles/bootstrap/LICENSE b/roles/bootstrap/LICENSE index bd15893..e770af8 100644 --- a/roles/bootstrap/LICENSE +++ b/roles/bootstrap/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 Robert de Bock (robert@meinit.nl) + Copyright 2021 Robert de Bock (robert@meinit.nl) 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/roles/bootstrap/README.md b/roles/bootstrap/README.md index 071dcd4..fd155f5 100644 --- a/roles/bootstrap/README.md +++ b/roles/bootstrap/README.md @@ -2,9 +2,9 @@ Prepare your system to be managed by Ansible. -|Travis|GitHub|Quality|Downloads|Version| +|GitHub|GitLab|Quality|Downloads|Version| |------|------|-------|---------|-------| -|[![travis](https://travis-ci.com/robertdebock/ansible-role-bootstrap.svg?branch=master)](https://travis-ci.com/robertdebock/ansible-role-bootstrap)|[![github](https://github.com/robertdebock/ansible-role-bootstrap/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-bootstrap/actions)|[![quality](https://img.shields.io/ansible/quality/21642)](https://galaxy.ansible.com/robertdebock/bootstrap)|[![downloads](https://img.shields.io/ansible/role/d/21642)](https://galaxy.ansible.com/robertdebock/bootstrap)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-bootstrap.svg)](https://github.com/robertdebock/ansible-role-bootstrap/releases/)| +|[![github](https://github.com/robertdebock/ansible-role-bootstrap/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-bootstrap/actions)|[![gitlab](https://gitlab.com/robertdebock/ansible-role-bootstrap/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-bootstrap)|[![quality](https://img.shields.io/ansible/quality/21642)](https://galaxy.ansible.com/robertdebock/bootstrap)|[![downloads](https://img.shields.io/ansible/role/d/21642)](https://galaxy.ansible.com/robertdebock/bootstrap)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-bootstrap.svg)](https://github.com/robertdebock/ansible-role-bootstrap/releases/)| ## [Example Playbook](#example-playbook) @@ -20,24 +20,6 @@ This example is taken from `molecule/resources/converge.yml` and is tested on ea - role: robertdebock.bootstrap ``` -The machine may need to be prepared using `molecule/resources/prepare.yml`: -```yaml -No preparation required. -``` - -For verification `molecule/resources/verify.yml` runs after the role has been applied. -```yaml ---- -- name: Verify - hosts: all - become: no - gather_facts: no - - tasks: - - name: test connection - ping: -``` - Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles. ## [Role Variables](#role-variables) @@ -55,28 +37,19 @@ bootstrap_wait_for_host: no # The number of seconds you want to wait during connection test before failing. bootstrap_timeout: 3 - -# The number of retries during installation -bootstrap_retries: 3 ``` ## [Requirements](#requirements) -- Access to a repository containing packages, likely on the internet. -- A recent version of Ansible. (Tests run on the current, previous and next release of Ansible.) +- pip packages listed in [requirements.txt](https://github.com/robertdebock/ansible-role-bootstrap/blob/master/requirements.txt). -The following roles can be installed to ensure all requirements are met, using `ansible-galaxy install -r requirements.yml`: - -```yaml -- none -``` ## [Context](#context) This role is a part of many compatible roles. Have a look at [the documentation of these roles](https://robertdebock.nl/) for further information. Here is an overview of related roles: -![dependencies](https://raw.githubusercontent.com/robertdebock/drawings/artifacts/bootstrap.png "Dependency") +![dependencies](https://raw.githubusercontent.com/robertdebock/ansible-role-bootstrap/png/requirements.png "Dependencies") ## [Compatibility](#compatibility) @@ -84,56 +57,30 @@ This role has been tested on these [container images](https://hub.docker.com/u/r |container|tags| |---------|----| -|alpine|all| -|amazon|2018.03| +|amazon|Candidate| |el|7, 8| -|debian|buster, bullseye| -|fedora|31, 32| +|debian|all| +|fedora|all| |opensuse|all| -|ubuntu|focal, bionic, xenial| +|ubuntu|focal, bionic| -The minimum version of Ansible required is 2.8 but tests have been done to: +The minimum version of Ansible required is 2.10, tests have been done to: -- The previous version, on version lower. +- The previous version. - The current version. - The development version. +## [Exceptions](#exceptions) +Some variarations of the build matrix do not work. These are the variations and reasons why the build won't work: -## [Testing](#testing) +| variation | reason | +|---------------------------|------------------------| +| alpine:edge | Failed to create temporary directory. | -[Unit tests](https://travis-ci.com/robertdebock/ansible-role-bootstrap) are done on every commit, pull request, release and periodically. If you find issues, please register them in [GitHub](https://github.com/robertdebock/ansible-role-bootstrap/issues) -Testing is done using [Tox](https://tox.readthedocs.io/en/latest/) and [Molecule](https://github.com/ansible/molecule): - -[Tox](https://tox.readthedocs.io/en/latest/) tests multiple ansible versions. -[Molecule](https://github.com/ansible/molecule) tests multiple distributions. - -To test using the defaults (any installed ansible version, namespace: `robertdebock`, image: `fedora`, tag: `latest`): - -``` -molecule test - -# Or select a specific image: -image=ubuntu molecule test -# Or select a specific image and a specific tag: -image="debian" tag="stable" tox -``` - -Or you can test multiple versions of Ansible, and select images: -Tox allows multiple versions of Ansible to be tested. To run the default (namespace: `robertdebock`, image: `fedora`, tag: `latest`) tests: - -``` -tox - -# To run CentOS (namespace: `robertdebock`, tag: `latest`) -image="centos" tox -# Or customize more: -image="debian" tag="stable" tox -``` - ## [License](#license) Apache-2.0 diff --git a/roles/bootstrap/defaults/main.yml b/roles/bootstrap/defaults/main.yml index 4e0673c..6c8972a 100644 --- a/roles/bootstrap/defaults/main.yml +++ b/roles/bootstrap/defaults/main.yml @@ -9,6 +9,3 @@ bootstrap_wait_for_host: no # The number of seconds you want to wait during connection test before failing. bootstrap_timeout: 3 - -# The number of retries during installation -bootstrap_retries: 3 diff --git a/roles/bootstrap/meta 2/.galaxy_install_info b/roles/bootstrap/meta 2/.galaxy_install_info deleted file mode 100644 index 7ed929e..0000000 --- a/roles/bootstrap/meta 2/.galaxy_install_info +++ /dev/null @@ -1,2 +0,0 @@ -install_date: Mon Sep 28 13:22:02 2020 -version: 4.2.7 diff --git a/roles/bootstrap/meta 2/preferences.yml b/roles/bootstrap/meta 2/preferences.yml deleted file mode 100644 index e7fdebf..0000000 --- a/roles/bootstrap/meta 2/preferences.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -tox_parallel: yes diff --git a/roles/bootstrap/meta/.galaxy_install_info b/roles/bootstrap/meta/.galaxy_install_info index 7ed929e..bf763d7 100644 --- a/roles/bootstrap/meta/.galaxy_install_info +++ b/roles/bootstrap/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Mon Sep 28 13:22:02 2020 -version: 4.2.7 +install_date: Sun Mar 21 06:59:27 2021 +version: 5.0.3 diff --git a/roles/bootstrap/meta/main.yml b/roles/bootstrap/meta/main.yml index 3710070..22b8b53 100644 --- a/roles/bootstrap/meta/main.yml +++ b/roles/bootstrap/meta/main.yml @@ -5,27 +5,26 @@ galaxy_info: description: Prepare your system to be managed by Ansible. license: Apache-2.0 company: none - min_ansible_version: 2.8 + min_ansible_version: "2.10" platforms: - - name: Alpine - versions: - - all + # Broken: idempotence, gather_facts: Failed to create temporary directory. + # - name: Alpine + # versions: + # - all - name: Amazon versions: - - 2018.03 + - Candidate - name: EL versions: - 7 - 8 - name: Debian versions: - - buster - - bullseye + - all - name: Fedora versions: - - 31 - - 32 + - all - name: OpenSUSE versions: - all @@ -33,14 +32,10 @@ galaxy_info: versions: - focal - bionic - - xenial galaxy_tags: - bootstrap - - centos - - installer - - server - - system - - oraclelinux + - python + - sudo dependencies: [] diff --git a/roles/bootstrap/molecule 2/default/converge.yml b/roles/bootstrap/molecule 2/default/converge.yml deleted file mode 100644 index 3cd3d54..0000000 --- a/roles/bootstrap/molecule 2/default/converge.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Converge - hosts: all - become: yes - gather_facts: no - - roles: - - role: ansible-role-bootstrap diff --git a/roles/bootstrap/molecule 2/default/verify.yml b/roles/bootstrap/molecule 2/default/verify.yml deleted file mode 100644 index 3bb4ea3..0000000 --- a/roles/bootstrap/molecule 2/default/verify.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -- name: Verify - hosts: all - become: no - gather_facts: no - - tasks: - - name: test connection - ping: diff --git a/roles/bootstrap/molecule/default/molecule.yml b/roles/bootstrap/molecule/default/molecule.yml index 142890e..82a49e1 100644 --- a/roles/bootstrap/molecule/default/molecule.yml +++ b/roles/bootstrap/molecule/default/molecule.yml @@ -9,6 +9,7 @@ dependency: lint: | set -e yamllint . + ansible-lint driver: name: docker platforms: diff --git a/roles/bootstrap/molecule/default/verify.yml b/roles/bootstrap/molecule/default/verify.yml index 3bb4ea3..ff3ec4e 100644 --- a/roles/bootstrap/molecule/default/verify.yml +++ b/roles/bootstrap/molecule/default/verify.yml @@ -7,3 +7,8 @@ tasks: - name: test connection ping: + + - name: try the package module + package: + name: gzip + state: present diff --git a/roles/bootstrap/tasks/assert.yml b/roles/bootstrap/tasks/assert.yml index a8ababe..7e50081 100644 --- a/roles/bootstrap/tasks/assert.yml +++ b/roles/bootstrap/tasks/assert.yml @@ -1,28 +1,23 @@ --- + - name: test if bootstrap_user is set correctly - assert: + ansible.builtin.assert: that: - bootstrap_user is defined - - bootstrap_user | length > 0 + - bootstrap_user is string quiet: yes - name: test if bootstrap_wait_for_host is set correctly - assert: + ansible.builtin.assert: that: - bootstrap_wait_for_host is defined - - bootstrap_wait_for_host | type_debug == "bool" + - bootstrap_wait_for_host is boolean quiet: yes - name: test if bootstrap_timeout is set correctly - assert: + ansible.builtin.assert: that: - bootstrap_timeout is defined - - bootstrap_timeout | int >= 0 - quiet: yes - -- name: test if bootstrap_retries is set correctly - assert: - that: - - bootstrap_retries is defined - - bootstrap_retries | int >= 0 + - bootstrap_timeout is number + - bootstrap_timeout >= 0 quiet: yes diff --git a/roles/bootstrap/tasks/gather_facts.yml b/roles/bootstrap/tasks/gather_facts.yml index 3985d5b..e9bb2bf 100644 --- a/roles/bootstrap/tasks/gather_facts.yml +++ b/roles/bootstrap/tasks/gather_facts.yml @@ -1,7 +1,7 @@ --- - name: lookup bootstrap facts become: no - raw: "cat /etc/os-release" + ansible.builtin.raw: "cat /etc/os-release" check_mode: no register: bootstrap_facts changed_when: no @@ -9,7 +9,7 @@ ansible_user: "{{ bootstrap_user }}" - name: set bootstrap facts (I) - set_fact: + ansible.builtin.set_fact: bootstrap_distribution: "{{ item }}" bootstrap_distribution_major_version: "{{ bootstrap_facts.stdout_lines | join(',') | regex_replace( '^.*VERSION_ID=\"(\\d{1,2})(\\.\\d{1,4})*?\".*$','\\1') | default('NA') }}" @@ -20,9 +20,10 @@ - bootstrap_facts.stdout is regex('PRETTY_NAME=.'~ bootstrap_search[item] | default(item) ~'.*') - name: set bootstrap facts (II) - set_fact: + ansible.builtin.set_fact: bootstrap_os_family: "{{ item.key }}" loop: "{{ bootstrap_os_family_map | dict2items }}" loop_control: label: "{{ item.key }}" - when: bootstrap_distribution in item.value + when: + - bootstrap_distribution in item.value diff --git a/roles/bootstrap/tasks/main.yml b/roles/bootstrap/tasks/main.yml index b1a165e..9d0134d 100644 --- a/roles/bootstrap/tasks/main.yml +++ b/roles/bootstrap/tasks/main.yml @@ -1,53 +1,56 @@ --- # tasks file for bootstrap + - name: include assert.yml - include_tasks: assert.yml + import_tasks: assert.yml + run_once: yes + delegate_to: localhost - name: wait for host - wait_for: + ansible.builtin.wait_for: port: "{{ ansible_port | default('22') }}" host: "{{ (ansible_ssh_host | default(ansible_host) | default(inventory_hostname)) }}" connection: local become: no when: - ansible_connection is defined - - ansible_connection != "docker" - - ansible_connection != "container" + - ansible_connection not in [ "docker", "container" ] - bootstrap_wait_for_host | bool - name: prepare system block: - name: test connection - wait_for_connection: + ansible.builtin.wait_for_connection: timeout: "{{ bootstrap_timeout }}" register: bootstrap_connect changed_when: no rescue: - name: gather bootstrap facts - include_tasks: "gather_facts.yml" + ansible.builtin.include_tasks: gather_facts.yml - name: install bootstrap packages - raw: "{{ bootstrap_install.raw }}" + ansible.builtin.raw: "{{ bootstrap_install.raw }}" register: bootstrap_install_packages - changed_when: (bootstrap_install.stdout_regex in bootstrap_install_packages.stdout and - bootstrap_os_family in ['Alpine', 'Archlinux', 'Gentoo']) or ( - bootstrap_install.stdout_regex not in bootstrap_install_packages.stdout and - bootstrap_os_family in ['Debian', 'RedHat', 'Suse']) + changed_when: + - (bootstrap_install.stdout_regex in bootstrap_install_packages.stdout and + bootstrap_os_family in [ "Alpine", "Archlinux", "Gentoo" ]) or + (bootstrap_install.stdout_regex not in bootstrap_install_packages.stdout and + bootstrap_os_family in [ "Debian", "RedHat", "Suse" ]) vars: ansible_user: "{{ bootstrap_user }}" always: - - name: set bootstrap ansible_user - set_fact: + - name: set bootstrap_ansible_user + ansible.builtin.set_fact: bootstrap_ansible_user: "{{ ansible_user | default(omit) if bootstrap_connect is succeeded else bootstrap_user }}" changed_when: no - name: ensure system is prepared block: - name: gather ansible facts - setup: + ansible.builtin.setup: - name: install bootstrap packages - package: + ansible.builtin.package: name: "{{ item }}" state: present loop: "{{ bootstrap_facts_packages.split() }}" diff --git a/roles/bootstrap/tox.ini b/roles/bootstrap/tox.ini index c1bc1d4..f57553b 100644 --- a/roles/bootstrap/tox.ini +++ b/roles/bootstrap/tox.ini @@ -2,25 +2,25 @@ # Ansible managed # [tox] -minversion = 3.7 -# Disabled "next" because of: -# https://github.com/ansible-community/molecule/issues/2626. -# envlist = py{38}-ansible-{previous,current,next} -envlist = py{38}-ansible-{previous,current} +minversion = 3.21.4 +# 2.11 has been disabled: couldn't resolve module/action 'docker_container'. +envlist = py{39}-ansible-{2.9,2.10} + skipsdist = true [testenv] deps = - previous: ansible>=2.8, <2.9 - current: ansible>=2.9 - next: git+https://github.com/ansible/ansible.git@devel - molecule[lint]>=3, <4 - docker>=4.2, <4.3 + 2.9: ansible == 2.9.* + 2.10: ansible == 2.10.* + 2.11: git+https://github.com/ansible/ansible.git@devel + molecule[docker] + docker == 4.* + ansible-lint == 5.* commands = molecule test setenv = TOX_ENVNAME={envname} - MOLECULE_EPHEMERAL_DIRECTORY=/tmp/.molecule/{env:image:fedora}-{env:tag:latest}/{envname} PY_COLORS=1 ANSIBLE_FORCE_COLOR=1 + ANSIBLE_ROLES_PATH=../ passenv = namespace image tag diff --git a/roles/bootstrap/vars/main.yml b/roles/bootstrap/vars/main.yml index 1636f76..f5bc44a 100644 --- a/roles/bootstrap/vars/main.yml +++ b/roles/bootstrap/vars/main.yml @@ -7,7 +7,7 @@ _bootstrap_packages: Debian: python3 sudo gnupg python3-apt Gentoo: python sudo gentoolkit RedHat: python3 sudo - Suse: python python-xml sudo + Suse: python3 python3-xml sudo Amazon: python sudo CentOS_7: python sudo Debian_8: python sudo gnupg diff --git a/roles/buildtools/.ansible-lint b/roles/buildtools/.ansible-lint index eba57d1..7a17121 100644 --- a/roles/buildtools/.ansible-lint +++ b/roles/buildtools/.ansible-lint @@ -4,5 +4,9 @@ exclude_paths: - ./meta/exception.yml - ./meta/preferences.yml + - ./molecule/default/prepare.yml + - ./molecule/default/converge.yml - ./molecule/default/verify.yml + - ./molecule/default/collections.yml - ./.tox + - ./.cache diff --git a/roles/buildtools/.github 2/FUNDING.yml b/roles/buildtools/.github 2/FUNDING.yml deleted file mode 100644 index 67320f0..0000000 --- a/roles/buildtools/.github 2/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -github: robertdebock diff --git a/roles/buildtools/.github 2/pull_request_template.md b/roles/buildtools/.github 2/pull_request_template.md deleted file mode 100644 index b1578c0..0000000 --- a/roles/buildtools/.github 2/pull_request_template.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: Pull request -about: Describe the proposed change - ---- - -**Describe the change** -A clear and concise description of what the pull request is. - -**Testing** -In case a feature was added, how were tests performed? diff --git a/roles/buildtools/.github 2/settings.yml b/roles/buildtools/.github 2/settings.yml deleted file mode 100644 index 4d5d933..0000000 --- a/roles/buildtools/.github 2/settings.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# -# Ansible managed -# -repository: - description: Install buildtools on your system. - homepage: https://robertdebock.nl/ diff --git a/roles/buildtools/.github/settings.yml b/roles/buildtools/.github/settings.yml index 4d5d933..9a9707a 100644 --- a/roles/buildtools/.github/settings.yml +++ b/roles/buildtools/.github/settings.yml @@ -5,3 +5,4 @@ repository: description: Install buildtools on your system. homepage: https://robertdebock.nl/ + topics: development, installer, packages, system, ansible, molecule, tox, playbook, hacktoberfest diff --git a/roles/buildtools/.github/workflows/galaxy.yml b/roles/buildtools/.github/workflows/galaxy.yml index 7ff6f4b..1d36b74 100644 --- a/roles/buildtools/.github/workflows/galaxy.yml +++ b/roles/buildtools/.github/workflows/galaxy.yml @@ -6,17 +6,13 @@ name: Release to Ansible Galaxy on: - push: - tags: - - '*' - schedule: - - cron: '2 2 2 * *' - + release: + types: [created, edited, published, released] jobs: release: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: galaxy - uses: robertdebock/galaxy-action@1.0.1 + uses: robertdebock/galaxy-action@1.1.0 with: galaxy_api_key: ${{ secrets.galaxy_api_key }} diff --git a/roles/buildtools/.github/workflows/molecule.yml b/roles/buildtools/.github/workflows/molecule.yml index 98b4d68..1334938 100644 --- a/roles/buildtools/.github/workflows/molecule.yml +++ b/roles/buildtools/.github/workflows/molecule.yml @@ -15,30 +15,28 @@ on: jobs: lint: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: checkout uses: actions/checkout@v2 with: path: "${{ github.repository }}" - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: command: lint test: needs: - lint - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: config: - image: "alpine" tag: "latest" - - image: "alpine" - tag: "edge" - image: "amazonlinux" - tag: "1" + tag: "latest" - image: "centos" tag: "7" - image: "centos" @@ -48,7 +46,7 @@ jobs: - image: "debian" tag: "bullseye" - image: "fedora" - tag: "31" + tag: "32" - image: "fedora" tag: "latest" - image: "opensuse" @@ -57,8 +55,6 @@ jobs: tag: "latest" - image: "ubuntu" tag: "bionic" - - image: "ubuntu" - tag: "xenial" steps: - name: checkout uses: actions/checkout@v2 @@ -69,10 +65,7 @@ jobs: - name: parse apparmor for mysql run: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: image: ${{ matrix.config.image }} tag: ${{ matrix.config.tag }} - options: "--parallel all" - env: - TOX_PARALLEL_NO_SPINNER: 1 diff --git a/roles/buildtools/.gitignore b/roles/buildtools/.gitignore index 982db11..c15d16a 100644 --- a/roles/buildtools/.gitignore +++ b/roles/buildtools/.gitignore @@ -2,3 +2,4 @@ *.log *.swp .tox +.cache diff --git a/roles/buildtools/.gitignore 2 b/roles/buildtools/.gitignore 2 deleted file mode 100644 index 982db11..0000000 --- a/roles/buildtools/.gitignore 2 +++ /dev/null @@ -1,4 +0,0 @@ -.molecule -*.log -*.swp -.tox diff --git a/roles/buildtools/.travis.yml b/roles/buildtools/.travis.yml index 8be381a..21201e1 100644 --- a/roles/buildtools/.travis.yml +++ b/roles/buildtools/.travis.yml @@ -8,43 +8,23 @@ os: linux dist: xenial python: - - "3.8" + - "3.9" services: - docker -env: - global: - namespace="robertdebock" - jobs: - - image="alpine" tag="latest" - - image="alpine" tag="edge" - - image="amazonlinux" tag="1" - - image="centos" tag="7" - - image="centos" tag="latest" - - image="debian" tag="latest" - - image="debian" tag="bullseye" - - image="fedora" tag="31" - - image="fedora" tag="latest" - - image="opensuse" tag="latest" - - image="ubuntu" tag="latest" - - image="ubuntu" tag="bionic" - - image="ubuntu" tag="xenial" - cache: - pip install: - pip install --upgrade pip - - pip install tox + - pip install yamllint + - pip install ansible-lint script: - - function retry { counter=0 ; until "$@" ; do exit=$? ; counter=$(($counter + 1)) ; if [ $counter -ge 3 ] ; then return $exit ; fi ; done ; return 0; } ; retry tox --parallel all + - yamllint . + - ansible-lint notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ - slack: - secure: "p8PSvlX2yGAqG49VMv//0YiHJOIwS22hGqXdfwKU0iu0yF82+ZmtaQqxzk2v5YTw4J7X5kl4qXsplZ7fpl2MI76DTL9hQbV4CHzSdhMpccZnwTeAzVy6YJBKHFiGaMQ+ty6IzUe3k4/XGidXxWencmuXgVZm4BA4MKhaq7UoRpGamgzaZm6n1j9RIHBQZa7Todvm5QbsXYzq9I+tt2lHjYYiOZsxAcUcB+E6hTHA7ONF9X7JjtRjCjy5sfE/MFgBIkL0xNDiGMSyOfqprJS9jV6Sg3jpYis4cYupaqzKGzyZc2ESmbziSmLxRgJ2CvwH8DL67V8hJ7HrMLMFVl++dH3LMTPGZExXywMJ3nc50AefvKAtOGs8mP3H6HXMy7QlBVFOi6X6Isz2AZpCw/RK2noQBSzwSCy3zdSwvrTPEFUTRU6W0vWJR784/kfSaD5lPoOvj5R9yKvkmKM28ti6EtJ5NVnbdIXK+oHS7L4RCeLq0POt1yGJK+FtiQLz0JYutIoXthkrrK6w9i50G2tNnLqMTz4igm+OOr5ibDt8ULbW2BBRQFhb+dKGwTGjTuy+whwmwhnAvMc1EI5txaPA8oJjgj+azYiSKNu6pPtkDDkiP4ALcn7R81cXq5kIxrZQPi59WR2ThIi6wQQSokQRXKATIBPxHQ5Y6Y4ZOkXZQC4=" - on_success: change - template: "%{result}: %{repository_slug}@%{branch}, build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}>)" email: false diff --git a/roles/buildtools/.yamllint b/roles/buildtools/.yamllint index 894450c..a7ff098 100644 --- a/roles/buildtools/.yamllint +++ b/roles/buildtools/.yamllint @@ -13,3 +13,4 @@ rules: ignore: | .tox/ + .cache/ diff --git a/roles/buildtools/LICENSE b/roles/buildtools/LICENSE index bd15893..e770af8 100644 --- a/roles/buildtools/LICENSE +++ b/roles/buildtools/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 Robert de Bock (robert@meinit.nl) + Copyright 2021 Robert de Bock (robert@meinit.nl) 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/roles/buildtools/README.md b/roles/buildtools/README.md index 248e1ca..1c82beb 100644 --- a/roles/buildtools/README.md +++ b/roles/buildtools/README.md @@ -2,9 +2,9 @@ Install buildtools on your system. -|Travis|GitHub|Quality|Downloads|Version| +|GitHub|GitLab|Quality|Downloads|Version| |------|------|-------|---------|-------| -|[![travis](https://travis-ci.com/robertdebock/ansible-role-buildtools.svg?branch=master)](https://travis-ci.com/robertdebock/ansible-role-buildtools)|[![github](https://github.com/robertdebock/ansible-role-buildtools/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-buildtools/actions)|[![quality](https://img.shields.io/ansible/quality/22111)](https://galaxy.ansible.com/robertdebock/buildtools)|[![downloads](https://img.shields.io/ansible/role/d/22111)](https://galaxy.ansible.com/robertdebock/buildtools)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-buildtools.svg)](https://github.com/robertdebock/ansible-role-buildtools/releases/)| +|[![github](https://github.com/robertdebock/ansible-role-buildtools/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-buildtools/actions)|[![gitlab](https://gitlab.com/robertdebock/ansible-role-buildtools/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-buildtools)|[![quality](https://img.shields.io/ansible/quality/22111)](https://galaxy.ansible.com/robertdebock/buildtools)|[![downloads](https://img.shields.io/ansible/role/d/22111)](https://galaxy.ansible.com/robertdebock/buildtools)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-buildtools.svg)](https://github.com/robertdebock/ansible-role-buildtools/releases/)| ## [Example Playbook](#example-playbook) @@ -20,7 +20,7 @@ This example is taken from `molecule/resources/converge.yml` and is tested on ea - role: robertdebock.buildtools ``` -The machine may need to be prepared using `molecule/resources/prepare.yml`: +The machine needs to be prepared in CI this is done using `molecule/resources/prepare.yml`: ```yaml --- - name: Prepare @@ -32,62 +32,27 @@ The machine may need to be prepared using `molecule/resources/prepare.yml`: - role: robertdebock.bootstrap ``` -For verification `molecule/resources/verify.yml` runs after the role has been applied. -```yaml ---- -- name: Verify - hosts: all - become: no - gather_facts: no - - tasks: - - name: run gcc - command: gcc --version - - - name: run make - command: make --version - - - name: run shasum - command: shasum --version - - - name: run bison - command: bison --version - - - name: find libelf - find: - paths: /usr - patterns: libelf.so.1 - register: buildtools_find_libelf - - - name: assert the results - assert: - that: - - buildtools_find_libelf.matched >= 0 - msg: could not find libelf.so.1 in /usr -``` - Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles. ## [Requirements](#requirements) -- Access to a repository containing packages, likely on the internet. -- A recent version of Ansible. (Tests run on the current, previous and next release of Ansible.) +- pip packages listed in [requirements.txt](https://github.com/robertdebock/ansible-role-buildtools/blob/master/requirements.txt). -The following roles can be installed to ensure all requirements are met, using `ansible-galaxy install -r requirements.yml`: +## [Status of requirements](#status-of-requirements) -```yaml ---- -- robertdebock.bootstrap +The following roles are used to prepare a system. You may choose to prepare your system in another way, I have tested these roles as well. -``` +| Requirement | GitHub | GitLab | +|-------------|--------|--------| +| [robertdebock.bootstrap](https://galaxy.ansible.com/robertdebock/bootstrap) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-bootstrap/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-bootstrap/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-bootstrap/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-bootstrap) ## [Context](#context) This role is a part of many compatible roles. Have a look at [the documentation of these roles](https://robertdebock.nl/) for further information. Here is an overview of related roles: -![dependencies](https://raw.githubusercontent.com/robertdebock/drawings/artifacts/buildtools.png "Dependency") +![dependencies](https://raw.githubusercontent.com/robertdebock/ansible-role-buildtools/png/requirements.png "Dependencies") ## [Compatibility](#compatibility) @@ -96,16 +61,16 @@ This role has been tested on these [container images](https://hub.docker.com/u/r |container|tags| |---------|----| |alpine|all| -|amazon|2018.03| +|amazon|Candidate| |el|7, 8| |debian|buster, bullseye| -|fedora|31, 32| +|fedora|all| |opensuse|all| -|ubuntu|focal, bionic, xenial| +|ubuntu|focal, bionic| -The minimum version of Ansible required is 2.8 but tests have been done to: +The minimum version of Ansible required is 2.10, tests have been done to: -- The previous version, on version lower. +- The previous version. - The current version. - The development version. @@ -118,40 +83,8 @@ Some variarations of the build matrix do not work. These are the variations and | EL | No package matching 'bison' found available, installed or updated | -## [Testing](#testing) - -[Unit tests](https://travis-ci.com/robertdebock/ansible-role-buildtools) are done on every commit, pull request, release and periodically. - If you find issues, please register them in [GitHub](https://github.com/robertdebock/ansible-role-buildtools/issues) -Testing is done using [Tox](https://tox.readthedocs.io/en/latest/) and [Molecule](https://github.com/ansible/molecule): - -[Tox](https://tox.readthedocs.io/en/latest/) tests multiple ansible versions. -[Molecule](https://github.com/ansible/molecule) tests multiple distributions. - -To test using the defaults (any installed ansible version, namespace: `robertdebock`, image: `fedora`, tag: `latest`): - -``` -molecule test - -# Or select a specific image: -image=ubuntu molecule test -# Or select a specific image and a specific tag: -image="debian" tag="stable" tox -``` - -Or you can test multiple versions of Ansible, and select images: -Tox allows multiple versions of Ansible to be tested. To run the default (namespace: `robertdebock`, image: `fedora`, tag: `latest`) tests: - -``` -tox - -# To run CentOS (namespace: `robertdebock`, tag: `latest`) -image="centos" tox -# Or customize more: -image="debian" tag="stable" tox -``` - ## [License](#license) Apache-2.0 diff --git a/roles/buildtools/meta 2/.galaxy_install_info b/roles/buildtools/meta 2/.galaxy_install_info deleted file mode 100644 index 1e3aaeb..0000000 --- a/roles/buildtools/meta 2/.galaxy_install_info +++ /dev/null @@ -1,2 +0,0 @@ -install_date: Mon Sep 28 13:22:05 2020 -version: 2.4.15 diff --git a/roles/buildtools/meta 2/exception.yml b/roles/buildtools/meta 2/exception.yml deleted file mode 100644 index 02f8e69..0000000 --- a/roles/buildtools/meta 2/exception.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -exceptions: - - variation: EL - reason: "No package matching 'bison' found available, installed or updated" diff --git a/roles/buildtools/meta 2/preferences.yml b/roles/buildtools/meta 2/preferences.yml deleted file mode 100644 index e7fdebf..0000000 --- a/roles/buildtools/meta 2/preferences.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -tox_parallel: yes diff --git a/roles/buildtools/meta/.galaxy_install_info b/roles/buildtools/meta/.galaxy_install_info index 1e3aaeb..05981e8 100644 --- a/roles/buildtools/meta/.galaxy_install_info +++ b/roles/buildtools/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Mon Sep 28 13:22:05 2020 -version: 2.4.15 +install_date: Sun Mar 21 06:59:29 2021 +version: 3.0.1 diff --git a/roles/buildtools/meta/main.yml b/roles/buildtools/meta/main.yml index 7a44347..69df952 100644 --- a/roles/buildtools/meta/main.yml +++ b/roles/buildtools/meta/main.yml @@ -5,7 +5,7 @@ galaxy_info: description: Install buildtools on your system. license: Apache-2.0 company: none - min_ansible_version: 2.8 + min_ansible_version: "2.10" platforms: - name: Alpine @@ -13,7 +13,7 @@ galaxy_info: - all - name: Amazon versions: - - 2018.03 + - Candidate - name: EL versions: - 7 @@ -24,8 +24,7 @@ galaxy_info: - bullseye - name: Fedora versions: - - 31 - - 32 + - all - name: OpenSUSE versions: - all @@ -33,10 +32,8 @@ galaxy_info: versions: - focal - bionic - - xenial galaxy_tags: - - centos - development - installer - packages diff --git a/roles/buildtools/molecule 2/default/converge.yml b/roles/buildtools/molecule 2/default/converge.yml deleted file mode 100644 index 88675b2..0000000 --- a/roles/buildtools/molecule 2/default/converge.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Converge - hosts: all - become: yes - gather_facts: yes - - roles: - - role: ansible-role-buildtools diff --git a/roles/buildtools/molecule 2/default/prepare.yml b/roles/buildtools/molecule 2/default/prepare.yml deleted file mode 100644 index feb7d81..0000000 --- a/roles/buildtools/molecule 2/default/prepare.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Prepare - hosts: all - gather_facts: no - become: yes - - roles: - - role: robertdebock.bootstrap diff --git a/roles/buildtools/molecule/default/molecule.yml b/roles/buildtools/molecule/default/molecule.yml index ca80f6c..3f5da1e 100644 --- a/roles/buildtools/molecule/default/molecule.yml +++ b/roles/buildtools/molecule/default/molecule.yml @@ -9,6 +9,7 @@ dependency: lint: | set -e yamllint . + ansible-lint driver: name: docker platforms: diff --git a/roles/buildtools/molecule/default/verify.yml b/roles/buildtools/molecule/default/verify.yml index 23cf6b8..daf1c67 100644 --- a/roles/buildtools/molecule/default/verify.yml +++ b/roles/buildtools/molecule/default/verify.yml @@ -16,15 +16,3 @@ - name: run bison command: bison --version - - - name: find libelf - find: - paths: /usr - patterns: libelf.so.1 - register: buildtools_find_libelf - - - name: assert the results - assert: - that: - - buildtools_find_libelf.matched >= 0 - msg: could not find libelf.so.1 in /usr diff --git a/roles/buildtools/requirements 2.yml b/roles/buildtools/requirements 2.yml deleted file mode 100644 index 46dec9d..0000000 --- a/roles/buildtools/requirements 2.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- robertdebock.bootstrap diff --git a/roles/buildtools/requirements.yml b/roles/buildtools/requirements.yml index 46dec9d..11e3224 100644 --- a/roles/buildtools/requirements.yml +++ b/roles/buildtools/requirements.yml @@ -1,2 +1,3 @@ --- -- robertdebock.bootstrap +roles: + - name: robertdebock.bootstrap diff --git a/roles/buildtools/tasks/main.yml b/roles/buildtools/tasks/main.yml index 52b2715..06f0576 100644 --- a/roles/buildtools/tasks/main.yml +++ b/roles/buildtools/tasks/main.yml @@ -1,6 +1,7 @@ --- # tasks file for buildtools + - name: install buildtools - package: + ansible.builtin.package: name: "{{ buildtools_packages }}" state: present diff --git a/roles/buildtools/tox.ini b/roles/buildtools/tox.ini index c1bc1d4..f57553b 100644 --- a/roles/buildtools/tox.ini +++ b/roles/buildtools/tox.ini @@ -2,25 +2,25 @@ # Ansible managed # [tox] -minversion = 3.7 -# Disabled "next" because of: -# https://github.com/ansible-community/molecule/issues/2626. -# envlist = py{38}-ansible-{previous,current,next} -envlist = py{38}-ansible-{previous,current} +minversion = 3.21.4 +# 2.11 has been disabled: couldn't resolve module/action 'docker_container'. +envlist = py{39}-ansible-{2.9,2.10} + skipsdist = true [testenv] deps = - previous: ansible>=2.8, <2.9 - current: ansible>=2.9 - next: git+https://github.com/ansible/ansible.git@devel - molecule[lint]>=3, <4 - docker>=4.2, <4.3 + 2.9: ansible == 2.9.* + 2.10: ansible == 2.10.* + 2.11: git+https://github.com/ansible/ansible.git@devel + molecule[docker] + docker == 4.* + ansible-lint == 5.* commands = molecule test setenv = TOX_ENVNAME={envname} - MOLECULE_EPHEMERAL_DIRECTORY=/tmp/.molecule/{env:image:fedora}-{env:tag:latest}/{envname} PY_COLORS=1 ANSIBLE_FORCE_COLOR=1 + ANSIBLE_ROLES_PATH=../ passenv = namespace image tag diff --git a/roles/common/.ansible-lint b/roles/common/.ansible-lint index eba57d1..7a17121 100644 --- a/roles/common/.ansible-lint +++ b/roles/common/.ansible-lint @@ -4,5 +4,9 @@ exclude_paths: - ./meta/exception.yml - ./meta/preferences.yml + - ./molecule/default/prepare.yml + - ./molecule/default/converge.yml - ./molecule/default/verify.yml + - ./molecule/default/collections.yml - ./.tox + - ./.cache diff --git a/roles/common/.github 2/FUNDING.yml b/roles/common/.github 2/FUNDING.yml deleted file mode 100644 index 67320f0..0000000 --- a/roles/common/.github 2/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -github: robertdebock diff --git a/roles/common/.github 2/pull_request_template.md b/roles/common/.github 2/pull_request_template.md deleted file mode 100644 index b1578c0..0000000 --- a/roles/common/.github 2/pull_request_template.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: Pull request -about: Describe the proposed change - ---- - -**Describe the change** -A clear and concise description of what the pull request is. - -**Testing** -In case a feature was added, how were tests performed? diff --git a/roles/common/.github 2/settings.yml b/roles/common/.github 2/settings.yml deleted file mode 100644 index 54f4b17..0000000 --- a/roles/common/.github 2/settings.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# -# Ansible managed -# -repository: - description: The purpose of this role is to configure common things on your system. - homepage: https://robertdebock.nl/ diff --git a/roles/common/.github/settings.yml b/roles/common/.github/settings.yml index 54f4b17..c5ae4cb 100644 --- a/roles/common/.github/settings.yml +++ b/roles/common/.github/settings.yml @@ -5,3 +5,4 @@ repository: description: The purpose of this role is to configure common things on your system. homepage: https://robertdebock.nl/ + topics: common, hosts, hostname, server, system, ansible, molecule, tox, playbook, hacktoberfest diff --git a/roles/common/.github/workflows/galaxy.yml b/roles/common/.github/workflows/galaxy.yml index 85aaa46..1d36b74 100644 --- a/roles/common/.github/workflows/galaxy.yml +++ b/roles/common/.github/workflows/galaxy.yml @@ -6,17 +6,13 @@ name: Release to Ansible Galaxy on: - push: - tags: - - '*' - schedule: - - cron: '3 3 3 * *' - + release: + types: [created, edited, published, released] jobs: release: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: galaxy - uses: robertdebock/galaxy-action@1.0.1 + uses: robertdebock/galaxy-action@1.1.0 with: galaxy_api_key: ${{ secrets.galaxy_api_key }} diff --git a/roles/common/.github/workflows/molecule.yml b/roles/common/.github/workflows/molecule.yml index 949c452..ab65095 100644 --- a/roles/common/.github/workflows/molecule.yml +++ b/roles/common/.github/workflows/molecule.yml @@ -15,30 +15,28 @@ on: jobs: lint: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: checkout uses: actions/checkout@v2 with: path: "${{ github.repository }}" - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: command: lint test: needs: - lint - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: config: - image: "alpine" tag: "latest" - - image: "alpine" - tag: "edge" - image: "amazonlinux" - tag: "1" + tag: "latest" - image: "centos" tag: "7" - image: "centos" @@ -48,7 +46,7 @@ jobs: - image: "debian" tag: "bullseye" - image: "fedora" - tag: "31" + tag: "32" - image: "fedora" tag: "latest" - image: "opensuse" @@ -57,8 +55,6 @@ jobs: tag: "latest" - image: "ubuntu" tag: "bionic" - - image: "ubuntu" - tag: "xenial" steps: - name: checkout uses: actions/checkout@v2 @@ -69,10 +65,7 @@ jobs: - name: parse apparmor for mysql run: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: image: ${{ matrix.config.image }} tag: ${{ matrix.config.tag }} - options: "--parallel all" - env: - TOX_PARALLEL_NO_SPINNER: 1 diff --git a/roles/common/.gitignore b/roles/common/.gitignore index 982db11..c15d16a 100644 --- a/roles/common/.gitignore +++ b/roles/common/.gitignore @@ -2,3 +2,4 @@ *.log *.swp .tox +.cache diff --git a/roles/common/.gitignore 2 b/roles/common/.gitignore 2 deleted file mode 100644 index 982db11..0000000 --- a/roles/common/.gitignore 2 +++ /dev/null @@ -1,4 +0,0 @@ -.molecule -*.log -*.swp -.tox diff --git a/roles/common/.travis.yml b/roles/common/.travis.yml index 54285e7..21201e1 100644 --- a/roles/common/.travis.yml +++ b/roles/common/.travis.yml @@ -8,43 +8,23 @@ os: linux dist: xenial python: - - "3.8" + - "3.9" services: - docker -env: - global: - namespace="robertdebock" - jobs: - - image="alpine" tag="latest" - - image="alpine" tag="edge" - - image="amazonlinux" tag="1" - - image="centos" tag="7" - - image="centos" tag="latest" - - image="debian" tag="latest" - - image="debian" tag="bullseye" - - image="fedora" tag="31" - - image="fedora" tag="latest" - - image="opensuse" tag="latest" - - image="ubuntu" tag="latest" - - image="ubuntu" tag="bionic" - - image="ubuntu" tag="xenial" - cache: - pip install: - pip install --upgrade pip - - pip install tox + - pip install yamllint + - pip install ansible-lint script: - - function retry { counter=0 ; until "$@" ; do exit=$? ; counter=$(($counter + 1)) ; if [ $counter -ge 3 ] ; then return $exit ; fi ; done ; return 0; } ; retry tox --parallel all + - yamllint . + - ansible-lint notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ - slack: - secure: "gMfzU7MPw5PwgzC9++WDG3D7Fa1EDw6BzbHAkixE1rYHtU2aH5nlFILqzm2rBL2s7+Rcn+c6QIzQ2P2HQSGfdxtKFu/79RWtxawRM0lpM3EZ5lBzu4VDre+9xmAcp92WW7CqdiAit2VxvOBkZJEQNht7N4CbMOhTACXEU9r6BvyDTJu+cBXdo3Wm5vr0znoVdsAy96uxRH/Kg3pJKXw+dlaUrkdaKDGR2uqEGx3kYhqGu/P0DpCd5q8EPzRyaxXCA3IQl9HBMg9wnGFmRYQO3xCGLVMQ6Aw/4ab7sgWVfBYpxx7gV82xE+w2NqpzLg4lvkl9YfA0Ywlqf4ptGWTM1vHwKObqdnesFcpDOdHnonY5xS9Ql1FBVAqQI8Ff6JESEZCaHYSO8dLJ6722bBo0Ns6cYuj5aPCirg+9Fhbbxof2tSWKMGpBhkOJVFgS59giJMovlzevmNcRPvsNNOmzmLi3nm/ZMbmQ85i0uGRLob3Kos52VeMBod4iNAYnwzZnqCyM7Qsd/Z6BrlVgCiaxH9phbXUNoY1aa7D1uBDORdDyzJ5Sek6KsDiqLrIS9hJY17BF5zrAL/eFbD4T6RoM5/tf/gGHc7W0JDCNN0oEIOwvwwPrfXfn+cFcrigBcQu+spI1EdoleBD4zZJUTj7uzbcHQ4LGbuw4KoAPMO2RuOk=" - on_success: change - template: "%{result}: %{repository_slug}@%{branch}, build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}>)" email: false diff --git a/roles/common/.yamllint b/roles/common/.yamllint index 894450c..a7ff098 100644 --- a/roles/common/.yamllint +++ b/roles/common/.yamllint @@ -13,3 +13,4 @@ rules: ignore: | .tox/ + .cache/ diff --git a/roles/common/LICENSE b/roles/common/LICENSE index bd15893..e770af8 100644 --- a/roles/common/LICENSE +++ b/roles/common/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 Robert de Bock (robert@meinit.nl) + Copyright 2021 Robert de Bock (robert@meinit.nl) 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/roles/common/README.md b/roles/common/README.md index 27c9e4b..51db327 100644 --- a/roles/common/README.md +++ b/roles/common/README.md @@ -2,9 +2,9 @@ The purpose of this role is to configure common things on your system. -|Travis|GitHub|Quality|Downloads|Version| +|GitHub|GitLab|Quality|Downloads|Version| |------|------|-------|---------|-------| -|[![travis](https://travis-ci.com/robertdebock/ansible-role-common.svg?branch=master)](https://travis-ci.com/robertdebock/ansible-role-common)|[![github](https://github.com/robertdebock/ansible-role-common/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-common/actions)|[![quality](https://img.shields.io/ansible/quality/29224)](https://galaxy.ansible.com/robertdebock/common)|[![downloads](https://img.shields.io/ansible/role/d/29224)](https://galaxy.ansible.com/robertdebock/common)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-common.svg)](https://github.com/robertdebock/ansible-role-common/releases/)| +|[![github](https://github.com/robertdebock/ansible-role-common/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-common/actions)|[![gitlab](https://gitlab.com/robertdebock/ansible-role-common/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-common)|[![quality](https://img.shields.io/ansible/quality/29224)](https://galaxy.ansible.com/robertdebock/common)|[![downloads](https://img.shields.io/ansible/role/d/29224)](https://galaxy.ansible.com/robertdebock/common)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-common.svg)](https://github.com/robertdebock/ansible-role-common/releases/)| ## [Example Playbook](#example-playbook) @@ -20,7 +20,7 @@ This example is taken from `molecule/resources/converge.yml` and is tested on ea - role: robertdebock.common ``` -The machine may need to be prepared using `molecule/resources/prepare.yml`: +The machine needs to be prepared in CI this is done using `molecule/resources/prepare.yml`: ```yaml --- - name: Prepare @@ -32,19 +32,6 @@ The machine may need to be prepared using `molecule/resources/prepare.yml`: - role: robertdebock.bootstrap ``` -For verification `molecule/resources/verify.yml` runs after the role has been applied. -```yaml ---- -- name: Verify - hosts: all - become: yes - gather_facts: no - - tasks: - - name: check if connection still works - ping: -``` - Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles. ## [Role Variables](#role-variables) @@ -71,23 +58,22 @@ common_reboot: yes ## [Requirements](#requirements) -- Access to a repository containing packages, likely on the internet. -- A recent version of Ansible. (Tests run on the current, previous and next release of Ansible.) +- pip packages listed in [requirements.txt](https://github.com/robertdebock/ansible-role-common/blob/master/requirements.txt). -The following roles can be installed to ensure all requirements are met, using `ansible-galaxy install -r requirements.yml`: +## [Status of requirements](#status-of-requirements) -```yaml ---- -- robertdebock.bootstrap +The following roles are used to prepare a system. You may choose to prepare your system in another way, I have tested these roles as well. -``` +| Requirement | GitHub | GitLab | +|-------------|--------|--------| +| [robertdebock.bootstrap](https://galaxy.ansible.com/robertdebock/bootstrap) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-bootstrap/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-bootstrap/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-bootstrap/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-bootstrap) ## [Context](#context) This role is a part of many compatible roles. Have a look at [the documentation of these roles](https://robertdebock.nl/) for further information. Here is an overview of related roles: -![dependencies](https://raw.githubusercontent.com/robertdebock/drawings/artifacts/common.png "Dependency") +![dependencies](https://raw.githubusercontent.com/robertdebock/ansible-role-common/png/requirements.png "Dependencies") ## [Compatibility](#compatibility) @@ -96,16 +82,16 @@ This role has been tested on these [container images](https://hub.docker.com/u/r |container|tags| |---------|----| |alpine|all| -|amazon|2018.03| +|amazon|Candidate| |el|7, 8| |debian|buster, bullseye| -|fedora|31, 32| +|fedora|all| |opensuse|all| -|ubuntu|focal, bionic, xenial| +|ubuntu|focal, bionic| -The minimum version of Ansible required is 2.8 but tests have been done to: +The minimum version of Ansible required is 2.10, tests have been done to: -- The previous version, on version lower. +- The previous version. - The current version. - The development version. @@ -118,40 +104,8 @@ Some variarations of the build matrix do not work. These are the variations and | amazonlinux | set hostname: [Errno 2] No such file or directory: '/etc/sysconfig/network' | -## [Testing](#testing) - -[Unit tests](https://travis-ci.com/robertdebock/ansible-role-common) are done on every commit, pull request, release and periodically. - If you find issues, please register them in [GitHub](https://github.com/robertdebock/ansible-role-common/issues) -Testing is done using [Tox](https://tox.readthedocs.io/en/latest/) and [Molecule](https://github.com/ansible/molecule): - -[Tox](https://tox.readthedocs.io/en/latest/) tests multiple ansible versions. -[Molecule](https://github.com/ansible/molecule) tests multiple distributions. - -To test using the defaults (any installed ansible version, namespace: `robertdebock`, image: `fedora`, tag: `latest`): - -``` -molecule test - -# Or select a specific image: -image=ubuntu molecule test -# Or select a specific image and a specific tag: -image="debian" tag="stable" tox -``` - -Or you can test multiple versions of Ansible, and select images: -Tox allows multiple versions of Ansible to be tested. To run the default (namespace: `robertdebock`, image: `fedora`, tag: `latest`) tests: - -``` -tox - -# To run CentOS (namespace: `robertdebock`, tag: `latest`) -image="centos" tox -# Or customize more: -image="debian" tag="stable" tox -``` - ## [License](#license) Apache-2.0 diff --git a/roles/common/handlers/main.yml b/roles/common/handlers/main.yml index f7751e2..25fa08f 100644 --- a/roles/common/handlers/main.yml +++ b/roles/common/handlers/main.yml @@ -1,15 +1,16 @@ --- # handlers file for common + - name: gather facts - setup: + ansible.builtin.setup: become: no - name: reload network manager - service: + ansible.builtin.service: name: NetworkManager state: reloaded - name: reboot - reboot: + ansible.builtin.reboot: when: - common_reboot | bool diff --git a/roles/common/meta 2/.galaxy_install_info b/roles/common/meta 2/.galaxy_install_info deleted file mode 100644 index eccc7b2..0000000 --- a/roles/common/meta 2/.galaxy_install_info +++ /dev/null @@ -1,2 +0,0 @@ -install_date: Mon Sep 28 13:22:08 2020 -version: 3.3.4 diff --git a/roles/common/meta 2/exception.yml b/roles/common/meta 2/exception.yml deleted file mode 100644 index 1c78591..0000000 --- a/roles/common/meta 2/exception.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -exceptions: - - variation: amazonlinux - reason: "set hostname: [Errno 2] No such file or directory: '/etc/sysconfig/network'" diff --git a/roles/common/meta 2/preferences.yml b/roles/common/meta 2/preferences.yml deleted file mode 100644 index e7fdebf..0000000 --- a/roles/common/meta 2/preferences.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -tox_parallel: yes diff --git a/roles/common/meta/.galaxy_install_info b/roles/common/meta/.galaxy_install_info index eccc7b2..849f418 100644 --- a/roles/common/meta/.galaxy_install_info +++ b/roles/common/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Mon Sep 28 13:22:08 2020 -version: 3.3.4 +install_date: Sun Mar 21 06:59:33 2021 +version: 4.0.2 diff --git a/roles/common/meta/main.yml b/roles/common/meta/main.yml index defac81..784cdc5 100644 --- a/roles/common/meta/main.yml +++ b/roles/common/meta/main.yml @@ -5,7 +5,7 @@ galaxy_info: description: The purpose of this role is to configure common things on your system. license: Apache-2.0 company: none - min_ansible_version: 2.8 + min_ansible_version: "2.10" platforms: - name: Alpine @@ -13,7 +13,7 @@ galaxy_info: - all - name: Amazon versions: - - 2018.03 + - Candidate - name: EL versions: - 7 @@ -24,8 +24,7 @@ galaxy_info: - bullseye - name: Fedora versions: - - 31 - - 32 + - all - name: OpenSUSE versions: - all @@ -33,12 +32,11 @@ galaxy_info: versions: - focal - bionic - - xenial galaxy_tags: - common - - centos - - redhat + - hosts + - hostname - server - system diff --git a/roles/common/molecule 2/default/converge.yml b/roles/common/molecule 2/default/converge.yml deleted file mode 100644 index b309e96..0000000 --- a/roles/common/molecule 2/default/converge.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Converge - hosts: all - become: yes - gather_facts: yes - - roles: - - role: ansible-role-common diff --git a/roles/common/molecule 2/default/prepare.yml b/roles/common/molecule 2/default/prepare.yml deleted file mode 100644 index feb7d81..0000000 --- a/roles/common/molecule 2/default/prepare.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Prepare - hosts: all - gather_facts: no - become: yes - - roles: - - role: robertdebock.bootstrap diff --git a/roles/common/molecule 2/default/verify.yml b/roles/common/molecule 2/default/verify.yml deleted file mode 100644 index b9dc6f8..0000000 --- a/roles/common/molecule 2/default/verify.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -- name: Verify - hosts: all - become: yes - gather_facts: no - - tasks: - - name: check if connection still works - ping: diff --git a/roles/common/molecule/default/molecule.yml b/roles/common/molecule/default/molecule.yml index e506938..72dc57c 100644 --- a/roles/common/molecule/default/molecule.yml +++ b/roles/common/molecule/default/molecule.yml @@ -6,9 +6,11 @@ dependency: name: galaxy options: role-file: requirements.yml + requirements-file: requirements.yml lint: | set -e yamllint . + ansible-lint driver: name: docker platforms: diff --git a/roles/common/requirements 2.yml b/roles/common/requirements 2.yml deleted file mode 100644 index 46dec9d..0000000 --- a/roles/common/requirements 2.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- robertdebock.bootstrap diff --git a/roles/common/requirements.yml b/roles/common/requirements.yml index 46dec9d..4971e35 100644 --- a/roles/common/requirements.yml +++ b/roles/common/requirements.yml @@ -1,2 +1,5 @@ --- -- robertdebock.bootstrap +roles: + - name: robertdebock.bootstrap +collections: + - name: community.general diff --git a/roles/common/tasks/assert.yml b/roles/common/tasks/assert.yml index 5d29aa1..a9b66cb 100644 --- a/roles/common/tasks/assert.yml +++ b/roles/common/tasks/assert.yml @@ -1,31 +1,30 @@ --- + - name: test if common_hostname is set correctly - assert: + ansible.builtin.assert: that: - common_hostname is defined - - common_hostname | length > 0 + - common_hostname is string quiet: yes - name: test if common_nameservers is set correctly - assert: + ansible.builtin.assert: that: - - common_nameservers | length >= 0 - common_nameservers is iterable quiet: yes when: - common_nameservers is defined - name: test if common_hosts is set correctly - assert: + ansible.builtin.assert: that: - common_hosts is defined - - common_hosts | length > 0 - common_hosts is iterable quiet: yes - name: test if common_reboot is set correctly - assert: + ansible.builtin.assert: that: - common_reboot is defined - - common_reboot | type_debug == "bool" + - common_reboot is boolean quiet: yes diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index f16c478..1a2e744 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -1,58 +1,64 @@ --- # tasks file for common + - name: include assert.yml - include_tasks: assert.yml + import_tasks: assert.yml + run_once: yes + delegate_to: localhost - name: install requirements - package: + ansible.builtin.package: name: "{{ common_requirements }}" state: present - name: check for network manager - stat: + ansible.builtin.stat: path: /etc/NetworkManager/NetworkManager.conf register: common_check_for_network_manager -- name: set nameserver in resolv.conf +- name: set nameserver block: - name: set nameserver in resolv.conf - lineinfile: - path: /etc/resolv.conf - line: "nameserver {{ item }}" + block: + - name: set nameserver in resolv.conf + ansible.builtin.lineinfile: + path: /etc/resolv.conf + line: "nameserver {{ item }}" + mode: "0644" + loop: "{{ common_nameservers }}" + notify: + - gather facts + when: + - not common_check_for_network_manager.stat.exists + - ansible_connection != "docker" + + rescue: + - name: comfort users + ansible.builtin.debug: + msg: + - "The file /etc/resolve.conf could not be modified." + - "This is likely because it is mapped from the Docker host to the Docker container." + + - name: set nameservers in network manager + community.general.ini_file: + path: /etc/NetworkManager/conf.d/dnsservers.conf + section: global-dns-domain-* + option: servers + value: "{{ common_nameservers | join(',') }}" mode: "0644" - loop: "{{ common_nameservers }}" + when: + - common_check_for_network_manager.stat.exists notify: + - reload network manager - gather facts when: - common_nameservers is defined - - not common_check_for_network_manager.stat.exists - - ansible_connection != "docker" - rescue: - - name: comfort users - debug: - msg: - - "The file /etc/resolve.conf could not be modified." - - "This is likely because it is mapped from the Docker host to the Docker container." - -- name: set nameservers in network manager - ini_file: - path: /etc/NetworkManager/conf.d/dnsservers.conf - section: global-dns-domain-* - option: servers - value: "{{ common_nameservers | join(',') }}" - mode: "0644" - when: - - common_check_for_network_manager.stat.exists - - common_nameservers is defined - notify: - - reload network manager - - gather facts - name: flush handlers - meta: flush_handlers + ansible.builtin.meta: flush_handlers - name: set hostname - hostname: + ansible.builtin.hostname: name: "{{ common_hostname }}" when: - ansible_connection != "docker" @@ -62,15 +68,15 @@ - name: fill /etc/hosts block: - name: fill /etc/hosts - template: + ansible.builtin.template: src: hosts.j2 dest: /etc/hosts mode: "0644" - when: - - ansible_connection != "docker" rescue: - name: comfort users - debug: + ansible.builtin.debug: msg: - "The file /etc/hosts could not be modified." - "This is likely because it is mapped from the Docker host to the Docker container." + when: + - ansible_connection != "docker" diff --git a/roles/common/templates/hosts.j2 b/roles/common/templates/hosts.j2 index 6505dfa..7eaf1f3 100644 --- a/roles/common/templates/hosts.j2 +++ b/roles/common/templates/hosts.j2 @@ -4,7 +4,7 @@ {% for host in common_hosts | sort %} {% if host != "localhost" %} {% if hostvars[host]['ansible_default_ipv4'] is defined %} -{{ hostvars[host]['ansible_default_ipv4']['address'] }} {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_fqdn'] }} +{{ hostvars[host]['ansible_default_ipv4']['address'] }} {{ hostvars[host]['ansible_fqdn'] }} {{ hostvars[host]['ansible_hostname'] }} {% endif %} {% endif %} {% endfor %} diff --git a/roles/common/tox.ini b/roles/common/tox.ini index c1bc1d4..f57553b 100644 --- a/roles/common/tox.ini +++ b/roles/common/tox.ini @@ -2,25 +2,25 @@ # Ansible managed # [tox] -minversion = 3.7 -# Disabled "next" because of: -# https://github.com/ansible-community/molecule/issues/2626. -# envlist = py{38}-ansible-{previous,current,next} -envlist = py{38}-ansible-{previous,current} +minversion = 3.21.4 +# 2.11 has been disabled: couldn't resolve module/action 'docker_container'. +envlist = py{39}-ansible-{2.9,2.10} + skipsdist = true [testenv] deps = - previous: ansible>=2.8, <2.9 - current: ansible>=2.9 - next: git+https://github.com/ansible/ansible.git@devel - molecule[lint]>=3, <4 - docker>=4.2, <4.3 + 2.9: ansible == 2.9.* + 2.10: ansible == 2.10.* + 2.11: git+https://github.com/ansible/ansible.git@devel + molecule[docker] + docker == 4.* + ansible-lint == 5.* commands = molecule test setenv = TOX_ENVNAME={envname} - MOLECULE_EPHEMERAL_DIRECTORY=/tmp/.molecule/{env:image:fedora}-{env:tag:latest}/{envname} PY_COLORS=1 ANSIBLE_FORCE_COLOR=1 + ANSIBLE_ROLES_PATH=../ passenv = namespace image tag diff --git a/roles/docker/.ansible-lint b/roles/docker/.ansible-lint index eba57d1..7a17121 100644 --- a/roles/docker/.ansible-lint +++ b/roles/docker/.ansible-lint @@ -4,5 +4,9 @@ exclude_paths: - ./meta/exception.yml - ./meta/preferences.yml + - ./molecule/default/prepare.yml + - ./molecule/default/converge.yml - ./molecule/default/verify.yml + - ./molecule/default/collections.yml - ./.tox + - ./.cache diff --git a/roles/docker/.github 2/FUNDING.yml b/roles/docker/.github 2/FUNDING.yml deleted file mode 100644 index 67320f0..0000000 --- a/roles/docker/.github 2/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -github: robertdebock diff --git a/roles/docker/.github 2/pull_request_template.md b/roles/docker/.github 2/pull_request_template.md deleted file mode 100644 index b1578c0..0000000 --- a/roles/docker/.github 2/pull_request_template.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: Pull request -about: Describe the proposed change - ---- - -**Describe the change** -A clear and concise description of what the pull request is. - -**Testing** -In case a feature was added, how were tests performed? diff --git a/roles/docker/.github 2/settings.yml b/roles/docker/.github 2/settings.yml deleted file mode 100644 index 059ae76..0000000 --- a/roles/docker/.github 2/settings.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# -# Ansible managed -# -repository: - description: Install and configure Docker (non-CE) on your system. - homepage: https://robertdebock.nl/ diff --git a/roles/docker/.github/settings.yml b/roles/docker/.github/settings.yml index 059ae76..7803dd6 100644 --- a/roles/docker/.github/settings.yml +++ b/roles/docker/.github/settings.yml @@ -5,3 +5,4 @@ repository: description: Install and configure Docker (non-CE) on your system. homepage: https://robertdebock.nl/ + topics: docker, ansible, molecule, tox, playbook, hacktoberfest diff --git a/roles/docker/.github/workflows/galaxy.yml b/roles/docker/.github/workflows/galaxy.yml index b95a2fb..1d36b74 100644 --- a/roles/docker/.github/workflows/galaxy.yml +++ b/roles/docker/.github/workflows/galaxy.yml @@ -6,17 +6,13 @@ name: Release to Ansible Galaxy on: - push: - tags: - - '*' - schedule: - - cron: '4 4 4 * *' - + release: + types: [created, edited, published, released] jobs: release: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: galaxy - uses: robertdebock/galaxy-action@1.0.1 + uses: robertdebock/galaxy-action@1.1.0 with: galaxy_api_key: ${{ secrets.galaxy_api_key }} diff --git a/roles/docker/.github/workflows/molecule.yml b/roles/docker/.github/workflows/molecule.yml index 32409db..e93bf6c 100644 --- a/roles/docker/.github/workflows/molecule.yml +++ b/roles/docker/.github/workflows/molecule.yml @@ -15,30 +15,26 @@ on: jobs: lint: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: checkout uses: actions/checkout@v2 with: path: "${{ github.repository }}" - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: command: lint test: needs: - lint - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: config: - image: "alpine" tag: "latest" - - image: "alpine" - tag: "edge" - - image: "centos" - tag: "7" - image: "centos" tag: "latest" - image: "debian" @@ -46,17 +42,13 @@ jobs: - image: "debian" tag: "bullseye" - image: "fedora" - tag: "31" + tag: "32" - image: "fedora" tag: "latest" - - image: "opensuse" - tag: "latest" - image: "ubuntu" tag: "latest" - image: "ubuntu" tag: "bionic" - - image: "ubuntu" - tag: "xenial" steps: - name: checkout uses: actions/checkout@v2 @@ -67,10 +59,7 @@ jobs: - name: parse apparmor for mysql run: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: image: ${{ matrix.config.image }} tag: ${{ matrix.config.tag }} - options: "--parallel all" - env: - TOX_PARALLEL_NO_SPINNER: 1 diff --git a/roles/docker/.gitignore b/roles/docker/.gitignore index 982db11..c15d16a 100644 --- a/roles/docker/.gitignore +++ b/roles/docker/.gitignore @@ -2,3 +2,4 @@ *.log *.swp .tox +.cache diff --git a/roles/docker/.gitignore 2 b/roles/docker/.gitignore 2 deleted file mode 100644 index 982db11..0000000 --- a/roles/docker/.gitignore 2 +++ /dev/null @@ -1,4 +0,0 @@ -.molecule -*.log -*.swp -.tox diff --git a/roles/docker/.travis.yml b/roles/docker/.travis.yml index 17d4196..21201e1 100644 --- a/roles/docker/.travis.yml +++ b/roles/docker/.travis.yml @@ -8,42 +8,23 @@ os: linux dist: xenial python: - - "3.8" + - "3.9" services: - docker -env: - global: - namespace="robertdebock" - jobs: - - image="alpine" tag="latest" - - image="alpine" tag="edge" - - image="centos" tag="7" - - image="centos" tag="latest" - - image="debian" tag="latest" - - image="debian" tag="bullseye" - - image="fedora" tag="31" - - image="fedora" tag="latest" - - image="opensuse" tag="latest" - - image="ubuntu" tag="latest" - - image="ubuntu" tag="bionic" - - image="ubuntu" tag="xenial" - cache: - pip install: - pip install --upgrade pip - - pip install tox + - pip install yamllint + - pip install ansible-lint script: - - function retry { counter=0 ; until "$@" ; do exit=$? ; counter=$(($counter + 1)) ; if [ $counter -ge 3 ] ; then return $exit ; fi ; done ; return 0; } ; retry tox --parallel all + - yamllint . + - ansible-lint notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ - slack: - secure: "J0lFSDeOWC/tyF/+b/kVMS9bXzo1C/77RY+SuuGB4FDv000yobXXsvdusbmco1YChfEy8LHOEij8W6/B9Z4myMENjZnIAWVKVr4Ddg8MNtgj3a56S7ajAu12YWse020LvJGZva5dOXT/9680+P/Ybar0YfHeuRNPp5+9WMIstjF9z/6kQk3epqMzusu4tdFKRtOV+f0HrgJ0H2BnZhXyZMdxFHH8QxuJ2hr4l5vac1iebsI7O+oV/Q0ZI+5/XXJ35G+EK6EKbF3o2oW6nZjGlZESDbd+n4itDbIOzhIEfBekk0GsbLCnUlGd/fgfVF8uaq2Ho7UPzG7qlBeLkdeClpfF1kGay2e+jy/pTr+Br+BEHkGzSfJB8sR92yCCK5xzgEjPrzIwgr6bFCu74lvuGOffmNeAm/rCpdzuXpH7lehrFT6qHPpt4J8IGQxe9WaKlOA5/Vspd+iK7n7Wt54d72sN3Oq1ARcdbpDf4oLHRw/9f/t1HLiJeQf30aAMKZ/7T5U5hNjFKN7O5JoNw45hpOo06KT0pgDQxt5ZhVNchX9rwwPXFUmfsRdcIaOp92LXMrmgQa87l1aUQ+V9xKHg3/kMgmUUCxozOzmkMawSNYT3pj+fF7kqZM4OUaMFukfGjcgcUF5WREhs/KrGAHqbb5UbDefF9LDcZK/1qEiuRl4=" - on_success: change - template: "%{result}: %{repository_slug}@%{branch}, build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}>)" email: false diff --git a/roles/docker/.yamllint b/roles/docker/.yamllint index 894450c..a7ff098 100644 --- a/roles/docker/.yamllint +++ b/roles/docker/.yamllint @@ -13,3 +13,4 @@ rules: ignore: | .tox/ + .cache/ diff --git a/roles/docker/LICENSE b/roles/docker/LICENSE index bd15893..e770af8 100644 --- a/roles/docker/LICENSE +++ b/roles/docker/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 Robert de Bock (robert@meinit.nl) + Copyright 2021 Robert de Bock (robert@meinit.nl) 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/roles/docker/README.md b/roles/docker/README.md index c152f48..c501aa5 100644 --- a/roles/docker/README.md +++ b/roles/docker/README.md @@ -2,9 +2,9 @@ Install and configure Docker (non-CE) on your system. -|Travis|GitHub|Quality|Downloads|Version| +|GitHub|GitLab|Quality|Downloads|Version| |------|------|-------|---------|-------| -|[![travis](https://travis-ci.com/robertdebock/ansible-role-docker.svg?branch=master)](https://travis-ci.com/robertdebock/ansible-role-docker)|[![github](https://github.com/robertdebock/ansible-role-docker/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-docker/actions)|[![quality](https://img.shields.io/ansible/quality/21647)](https://galaxy.ansible.com/robertdebock/docker)|[![downloads](https://img.shields.io/ansible/role/d/21647)](https://galaxy.ansible.com/robertdebock/docker)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-docker.svg)](https://github.com/robertdebock/ansible-role-docker/releases/)| +|[![github](https://github.com/robertdebock/ansible-role-docker/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-docker/actions)|[![gitlab](https://gitlab.com/robertdebock/ansible-role-docker/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-docker)|[![quality](https://img.shields.io/ansible/quality/21647)](https://galaxy.ansible.com/robertdebock/docker)|[![downloads](https://img.shields.io/ansible/role/d/21647)](https://galaxy.ansible.com/robertdebock/docker)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-docker.svg)](https://github.com/robertdebock/ansible-role-docker/releases/)| ## [Example Playbook](#example-playbook) @@ -20,7 +20,7 @@ This example is taken from `molecule/resources/converge.yml` and is tested on ea - role: robertdebock.docker ``` -The machine may need to be prepared using `molecule/resources/prepare.yml`: +The machine needs to be prepared in CI this is done using `molecule/resources/prepare.yml`: ```yaml --- - name: Prepare @@ -36,51 +36,31 @@ The machine may need to be prepared using `molecule/resources/prepare.yml`: - role: robertdebock.python_pip ``` -For verification `molecule/resources/verify.yml` runs after the role has been applied. -```yaml ---- -- name: Verify - hosts: all - become: yes - gather_facts: no - - tasks: - - name: Create a container - docker_container: - name: openssh - image: robertdebock/docker-centos-openssh - ports: - - "2222:22" - when: - - ansible_connection != "docker" -``` - Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles. ## [Requirements](#requirements) -- Access to a repository containing packages, likely on the internet. -- A recent version of Ansible. (Tests run on the current, previous and next release of Ansible.) +- pip packages listed in [requirements.txt](https://github.com/robertdebock/ansible-role-docker/blob/master/requirements.txt). -The following roles can be installed to ensure all requirements are met, using `ansible-galaxy install -r requirements.yml`: +## [Status of requirements](#status-of-requirements) -```yaml ---- -- robertdebock.bootstrap -- robertdebock.buildtools -- robertdebock.core_dependencies -- robertdebock.epel -- robertdebock.python_pip +The following roles are used to prepare a system. You may choose to prepare your system in another way, I have tested these roles as well. -``` +| Requirement | GitHub | GitLab | +|-------------|--------|--------| +| [robertdebock.bootstrap](https://galaxy.ansible.com/robertdebock/bootstrap) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-bootstrap/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-bootstrap/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-bootstrap/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-bootstrap) +| [robertdebock.buildtools](https://galaxy.ansible.com/robertdebock/buildtools) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-buildtools/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-buildtools/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-buildtools/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-buildtools) +| [robertdebock.core_dependencies](https://galaxy.ansible.com/robertdebock/core_dependencies) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-core_dependencies/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-core_dependencies/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-core_dependencies/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-core_dependencies) +| [robertdebock.epel](https://galaxy.ansible.com/robertdebock/epel) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-epel/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-epel/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-epel/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-epel) +| [robertdebock.python_pip](https://galaxy.ansible.com/robertdebock/python_pip) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-python_pip/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-python_pip/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-python_pip/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-python_pip) ## [Context](#context) This role is a part of many compatible roles. Have a look at [the documentation of these roles](https://robertdebock.nl/) for further information. Here is an overview of related roles: -![dependencies](https://raw.githubusercontent.com/robertdebock/drawings/artifacts/docker.png "Dependency") +![dependencies](https://raw.githubusercontent.com/robertdebock/ansible-role-docker/png/requirements.png "Dependencies") ## [Compatibility](#compatibility) @@ -89,15 +69,14 @@ This role has been tested on these [container images](https://hub.docker.com/u/r |container|tags| |---------|----| |alpine|all| -|el|7, 8| +|el|8| |debian|buster, bullseye| -|fedora|31, 32| -|opensuse|all| -|ubuntu|focal, bionic, xenial| +|fedora|all| +|ubuntu|focal, bionic| -The minimum version of Ansible required is 2.8 but tests have been done to: +The minimum version of Ansible required is 2.10, tests have been done to: -- The previous version, on version lower. +- The previous version. - The current version. - The development version. @@ -111,40 +90,8 @@ Some variarations of the build matrix do not work. These are the variations and | amazonlinux | Required dependency (python_pip) does not work on amazonlinux. | -## [Testing](#testing) - -[Unit tests](https://travis-ci.com/robertdebock/ansible-role-docker) are done on every commit, pull request, release and periodically. - If you find issues, please register them in [GitHub](https://github.com/robertdebock/ansible-role-docker/issues) -Testing is done using [Tox](https://tox.readthedocs.io/en/latest/) and [Molecule](https://github.com/ansible/molecule): - -[Tox](https://tox.readthedocs.io/en/latest/) tests multiple ansible versions. -[Molecule](https://github.com/ansible/molecule) tests multiple distributions. - -To test using the defaults (any installed ansible version, namespace: `robertdebock`, image: `fedora`, tag: `latest`): - -``` -molecule test - -# Or select a specific image: -image=ubuntu molecule test -# Or select a specific image and a specific tag: -image="debian" tag="stable" tox -``` - -Or you can test multiple versions of Ansible, and select images: -Tox allows multiple versions of Ansible to be tested. To run the default (namespace: `robertdebock`, image: `fedora`, tag: `latest`) tests: - -``` -tox - -# To run CentOS (namespace: `robertdebock`, tag: `latest`) -image="centos" tox -# Or customize more: -image="debian" tag="stable" tox -``` - ## [License](#license) Apache-2.0 diff --git a/roles/docker/handlers/main.yml b/roles/docker/handlers/main.yml index eb6b2d7..bd29ab8 100644 --- a/roles/docker/handlers/main.yml +++ b/roles/docker/handlers/main.yml @@ -1,7 +1,8 @@ --- # handlers file for docker + - name: change group for docker socket - file: + ansible.builtin.file: path: "{{ docker_socket }}" group: docker mode: "0640" diff --git a/roles/docker/meta 2/.galaxy_install_info b/roles/docker/meta 2/.galaxy_install_info deleted file mode 100644 index 4c66e62..0000000 --- a/roles/docker/meta 2/.galaxy_install_info +++ /dev/null @@ -1,2 +0,0 @@ -install_date: Mon Sep 28 13:22:11 2020 -version: 2.4.3 diff --git a/roles/docker/meta 2/exception.yml b/roles/docker/meta 2/exception.yml deleted file mode 100644 index 774cd36..0000000 --- a/roles/docker/meta 2/exception.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -exceptions: - - variation: Ubuntu - reason: "Unable to find any of pip2, pip to use." - - variation: amazonlinux - reason: "Required dependency (python_pip) does not work on amazonlinux." diff --git a/roles/docker/meta 2/preferences.yml b/roles/docker/meta 2/preferences.yml deleted file mode 100644 index e7fdebf..0000000 --- a/roles/docker/meta 2/preferences.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -tox_parallel: yes diff --git a/roles/docker/meta/.galaxy_install_info b/roles/docker/meta/.galaxy_install_info index 4c66e62..40336f7 100644 --- a/roles/docker/meta/.galaxy_install_info +++ b/roles/docker/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Mon Sep 28 13:22:11 2020 -version: 2.4.3 +install_date: Sun Mar 21 06:59:35 2021 +version: 3.0.0 diff --git a/roles/docker/meta/main.yml b/roles/docker/meta/main.yml index a91dc7f..08f4bb3 100644 --- a/roles/docker/meta/main.yml +++ b/roles/docker/meta/main.yml @@ -5,7 +5,7 @@ galaxy_info: description: Install and configure Docker (non-CE) on your system. license: Apache-2.0 company: none - min_ansible_version: 2.8 + min_ansible_version: "2.10" platforms: - name: Alpine @@ -13,27 +13,20 @@ galaxy_info: - all - name: EL versions: - - 7 - 8 - name: Debian versions: - buster - bullseye - name: Fedora - versions: - - 31 - - 32 - - name: OpenSUSE versions: - all - name: Ubuntu versions: - focal - bionic - - xenial galaxy_tags: - docker - - centos dependencies: [] diff --git a/roles/docker/molecule 2/default/converge.yml b/roles/docker/molecule 2/default/converge.yml deleted file mode 100644 index bdbb251..0000000 --- a/roles/docker/molecule 2/default/converge.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Converge - hosts: all - become: yes - gather_facts: yes - - roles: - - role: ansible-role-docker diff --git a/roles/docker/molecule 2/default/prepare.yml b/roles/docker/molecule 2/default/prepare.yml deleted file mode 100644 index 0d6f180..0000000 --- a/roles/docker/molecule 2/default/prepare.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -- name: Prepare - hosts: all - gather_facts: no - become: yes - - roles: - - role: robertdebock.bootstrap - - role: robertdebock.core_dependencies - - role: robertdebock.buildtools - - role: robertdebock.epel - - role: robertdebock.python_pip diff --git a/roles/docker/molecule 2/default/verify.yml b/roles/docker/molecule 2/default/verify.yml deleted file mode 100644 index 091a21e..0000000 --- a/roles/docker/molecule 2/default/verify.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -- name: Verify - hosts: all - become: yes - gather_facts: no - - tasks: - - name: Create a container - docker_container: - name: openssh - image: robertdebock/docker-centos-openssh - ports: - - "2222:22" - when: - - ansible_connection != "docker" diff --git a/roles/docker/molecule/default/molecule.yml b/roles/docker/molecule/default/molecule.yml index f2e484a..a01d6e6 100644 --- a/roles/docker/molecule/default/molecule.yml +++ b/roles/docker/molecule/default/molecule.yml @@ -9,6 +9,7 @@ dependency: lint: | set -e yamllint . + ansible-lint driver: name: docker platforms: diff --git a/roles/docker/requirements.yml b/roles/docker/requirements.yml index 38b9b85..672ffe7 100644 --- a/roles/docker/requirements.yml +++ b/roles/docker/requirements.yml @@ -1,6 +1,7 @@ --- -- robertdebock.bootstrap -- robertdebock.buildtools -- robertdebock.core_dependencies -- robertdebock.epel -- robertdebock.python_pip +roles: + - name: robertdebock.bootstrap + - name: robertdebock.buildtools + - name: robertdebock.core_dependencies + - name: robertdebock.epel + - name: robertdebock.python_pip diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index 6eeda9e..b26ce15 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -1,22 +1,23 @@ --- # tasks file for docker + - name: install docker - package: + ansible.builtin.package: name: "{{ docker_packages }}" state: present - name: install docker pip packages - pip: + ansible.builtin.pip: name: "{{ docker_pip_packages }}" state: present - name: add docker group - group: + ansible.builtin.group: name: docker system: yes - name: start and enable docker - service: + ansible.builtin.service: name: "{{ docker_service }}" state: started enabled: yes diff --git a/roles/docker/tox.ini b/roles/docker/tox.ini index c1bc1d4..f57553b 100644 --- a/roles/docker/tox.ini +++ b/roles/docker/tox.ini @@ -2,25 +2,25 @@ # Ansible managed # [tox] -minversion = 3.7 -# Disabled "next" because of: -# https://github.com/ansible-community/molecule/issues/2626. -# envlist = py{38}-ansible-{previous,current,next} -envlist = py{38}-ansible-{previous,current} +minversion = 3.21.4 +# 2.11 has been disabled: couldn't resolve module/action 'docker_container'. +envlist = py{39}-ansible-{2.9,2.10} + skipsdist = true [testenv] deps = - previous: ansible>=2.8, <2.9 - current: ansible>=2.9 - next: git+https://github.com/ansible/ansible.git@devel - molecule[lint]>=3, <4 - docker>=4.2, <4.3 + 2.9: ansible == 2.9.* + 2.10: ansible == 2.10.* + 2.11: git+https://github.com/ansible/ansible.git@devel + molecule[docker] + docker == 4.* + ansible-lint == 5.* commands = molecule test setenv = TOX_ENVNAME={envname} - MOLECULE_EPHEMERAL_DIRECTORY=/tmp/.molecule/{env:image:fedora}-{env:tag:latest}/{envname} PY_COLORS=1 ANSIBLE_FORCE_COLOR=1 + ANSIBLE_ROLES_PATH=../ passenv = namespace image tag diff --git a/roles/docker/vars/main.yml b/roles/docker/vars/main.yml index 13429c9..22d3ac3 100644 --- a/roles/docker/vars/main.yml +++ b/roles/docker/vars/main.yml @@ -4,23 +4,19 @@ _docker_packages: default: - docker - - docker-compose Alpine: - docker RedHat-7: - docker-io - - docker-compose RedHat-8: - podman-docker Debian: - docker.io - - docker-compose docker_packages: "{{ _docker_packages[ansible_os_family ~ '-' ~ ansible_distribution_major_version] | default(_docker_packages[ansible_os_family] | default(_docker_packages['default'])) }}" docker_pip_packages: - docker - - docker-compose _docker_service: default: docker diff --git a/roles/epel/.ansible-lint b/roles/epel/.ansible-lint index cb2872e..57f681e 100644 --- a/roles/epel/.ansible-lint +++ b/roles/epel/.ansible-lint @@ -3,5 +3,9 @@ # exclude_paths: - ./meta/preferences.yml + - ./molecule/default/prepare.yml + - ./molecule/default/converge.yml - ./molecule/default/verify.yml + - ./molecule/default/collections.yml - ./.tox + - ./.cache diff --git a/roles/epel/.ansible-lint 2 b/roles/epel/.ansible-lint 2 deleted file mode 100644 index cb2872e..0000000 --- a/roles/epel/.ansible-lint 2 +++ /dev/null @@ -1,7 +0,0 @@ -# -# Ansible managed -# -exclude_paths: - - ./meta/preferences.yml - - ./molecule/default/verify.yml - - ./.tox diff --git a/roles/epel/.github 2/FUNDING.yml b/roles/epel/.github 2/FUNDING.yml deleted file mode 100644 index 67320f0..0000000 --- a/roles/epel/.github 2/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -github: robertdebock diff --git a/roles/epel/.github 2/pull_request_template.md b/roles/epel/.github 2/pull_request_template.md deleted file mode 100644 index b1578c0..0000000 --- a/roles/epel/.github 2/pull_request_template.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: Pull request -about: Describe the proposed change - ---- - -**Describe the change** -A clear and concise description of what the pull request is. - -**Testing** -In case a feature was added, how were tests performed? diff --git a/roles/epel/.github 2/settings.yml b/roles/epel/.github 2/settings.yml deleted file mode 100644 index 491309e..0000000 --- a/roles/epel/.github 2/settings.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# -# Ansible managed -# -repository: - description: Install epel on your system. - homepage: https://robertdebock.nl/ diff --git a/roles/epel/.github/settings.yml b/roles/epel/.github/settings.yml index 491309e..aa2a8a3 100644 --- a/roles/epel/.github/settings.yml +++ b/roles/epel/.github/settings.yml @@ -5,3 +5,4 @@ repository: description: Install epel on your system. homepage: https://robertdebock.nl/ + topics: epel, repository, installer, packages, ansible, molecule, tox, playbook, hacktoberfest diff --git a/roles/epel/.github/workflows/galaxy.yml b/roles/epel/.github/workflows/galaxy.yml index aec2b62..1d36b74 100644 --- a/roles/epel/.github/workflows/galaxy.yml +++ b/roles/epel/.github/workflows/galaxy.yml @@ -6,17 +6,13 @@ name: Release to Ansible Galaxy on: - push: - tags: - - '*' - schedule: - - cron: '5 5 5 * *' - + release: + types: [created, edited, published, released] jobs: release: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: galaxy - uses: robertdebock/galaxy-action@1.0.1 + uses: robertdebock/galaxy-action@1.1.0 with: galaxy_api_key: ${{ secrets.galaxy_api_key }} diff --git a/roles/epel/.github/workflows/molecule.yml b/roles/epel/.github/workflows/molecule.yml index 11750fd..7d57c9e 100644 --- a/roles/epel/.github/workflows/molecule.yml +++ b/roles/epel/.github/workflows/molecule.yml @@ -15,26 +15,24 @@ on: jobs: lint: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: checkout uses: actions/checkout@v2 with: path: "${{ github.repository }}" - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: command: lint test: needs: - lint - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: config: - - image: "amazonlinux" - tag: "1" - image: "amazonlinux" tag: "latest" - image: "centos" @@ -51,10 +49,7 @@ jobs: - name: parse apparmor for mysql run: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: image: ${{ matrix.config.image }} tag: ${{ matrix.config.tag }} - options: "--parallel all" - env: - TOX_PARALLEL_NO_SPINNER: 1 diff --git a/roles/epel/.gitignore b/roles/epel/.gitignore index 982db11..c15d16a 100644 --- a/roles/epel/.gitignore +++ b/roles/epel/.gitignore @@ -2,3 +2,4 @@ *.log *.swp .tox +.cache diff --git a/roles/epel/.gitignore 2 b/roles/epel/.gitignore 2 deleted file mode 100644 index 982db11..0000000 --- a/roles/epel/.gitignore 2 +++ /dev/null @@ -1,4 +0,0 @@ -.molecule -*.log -*.swp -.tox diff --git a/roles/epel/.travis.yml b/roles/epel/.travis.yml index 8d56355..21201e1 100644 --- a/roles/epel/.travis.yml +++ b/roles/epel/.travis.yml @@ -8,34 +8,23 @@ os: linux dist: xenial python: - - "3.8" + - "3.9" services: - docker -env: - global: - namespace="robertdebock" - jobs: - - image="amazonlinux" tag="1" - - image="amazonlinux" tag="latest" - - image="centos" tag="7" - - image="centos" tag="latest" - cache: - pip install: - pip install --upgrade pip - - pip install tox + - pip install yamllint + - pip install ansible-lint script: - - function retry { counter=0 ; until "$@" ; do exit=$? ; counter=$(($counter + 1)) ; if [ $counter -ge 3 ] ; then return $exit ; fi ; done ; return 0; } ; retry tox --parallel all + - yamllint . + - ansible-lint notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ - slack: - secure: "dS+2v+ZGVgs1j2d+QgqDOYdZcQDzzgyTb+sq2SrbstMOQoiHpgrhb5KsORoSHyABI/fNXfRwfaF+DR/V4fqetyqDYzJLi2oyrUnyKRyb3uL93tTo8ng14VAqxbZmosNkwLRtfDuIcwYA0nLZiBg0gBz2Vcik0SykIWqsXOrGEhDkAgNfyTg8hIOM8nwAf0eNoJQT0XgxzvTu5ZxsuNcPcSNh0lMqTu8EM1w6ZQM25MsnLbKgzyTAMq1VXmK/L7+LSqoJUpeXw4RZ6ffHShyK9UVZa23Yv2ypAM/b+cFiF9VsymVq7dc+BIxkLpxEc++ALmmGvFcClm7P4qEMREniBfWoEihUqPBk0pv5AGR1r1JTJtqgxbCTNasI4i2q3RQUW8uT4rrR3l7X09poZbQnHzJeTlSnPgX+ItvRifYxa7RWrwFtUMBL7elPGMi6tsD4/b2m7+MZHu9Irzi5eL0D44LiIpJgN6C467DI9dqfwOJz9HYuU3m9jm9YeqxelupqVJHQQCBF2G6z5/3zKnlsijGqYrxApKlFxgPHm169X83D3Vf4zWRYHTfZuWcqRzWevL6XOd6gRTnYLnVFmzx2PehD0JSZZByJjcl1RuGqOe7JiJ7xJRJoo0wu8QfmZIs796816Ssd71hDNvowwlmc7OUSX9syu1+zlgymR9L8DrM=" - on_success: change - template: "%{result}: %{repository_slug}@%{branch}, build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}>)" email: false diff --git a/roles/epel/.yamllint b/roles/epel/.yamllint index 894450c..a7ff098 100644 --- a/roles/epel/.yamllint +++ b/roles/epel/.yamllint @@ -13,3 +13,4 @@ rules: ignore: | .tox/ + .cache/ diff --git a/roles/epel/LICENSE b/roles/epel/LICENSE index bd15893..e770af8 100644 --- a/roles/epel/LICENSE +++ b/roles/epel/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 Robert de Bock (robert@meinit.nl) + Copyright 2021 Robert de Bock (robert@meinit.nl) 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/roles/epel/README.md b/roles/epel/README.md index 001c0c3..824f87e 100644 --- a/roles/epel/README.md +++ b/roles/epel/README.md @@ -2,9 +2,9 @@ Install epel on your system. -|Travis|GitHub|Quality|Downloads|Version| +|GitHub|GitLab|Quality|Downloads|Version| |------|------|-------|---------|-------| -|[![travis](https://travis-ci.com/robertdebock/ansible-role-epel.svg?branch=master)](https://travis-ci.com/robertdebock/ansible-role-epel)|[![github](https://github.com/robertdebock/ansible-role-epel/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-epel/actions)|[![quality](https://img.shields.io/ansible/quality/21643)](https://galaxy.ansible.com/robertdebock/epel)|[![downloads](https://img.shields.io/ansible/role/d/21643)](https://galaxy.ansible.com/robertdebock/epel)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-epel.svg)](https://github.com/robertdebock/ansible-role-epel/releases/)| +|[![github](https://github.com/robertdebock/ansible-role-epel/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-epel/actions)|[![gitlab](https://gitlab.com/robertdebock/ansible-role-epel/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-epel)|[![quality](https://img.shields.io/ansible/quality/21643)](https://galaxy.ansible.com/robertdebock/epel)|[![downloads](https://img.shields.io/ansible/role/d/21643)](https://galaxy.ansible.com/robertdebock/epel)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-epel.svg)](https://github.com/robertdebock/ansible-role-epel/releases/)| ## [Example Playbook](#example-playbook) @@ -20,7 +20,7 @@ This example is taken from `molecule/resources/converge.yml` and is tested on ea - role: robertdebock.epel ``` -The machine may need to be prepared using `molecule/resources/prepare.yml`: +The machine needs to be prepared in CI this is done using `molecule/resources/prepare.yml`: ```yaml --- - name: Prepare @@ -32,43 +32,27 @@ The machine may need to be prepared using `molecule/resources/prepare.yml`: - role: robertdebock.bootstrap ``` -For verification `molecule/resources/verify.yml` runs after the role has been applied. -```yaml ---- -- name: Verify - hosts: all - become: yes - gather_facts: no - - tasks: - - name: install a package from epel - package: - name: aalib - state: present -``` - Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles. ## [Requirements](#requirements) -- Access to a repository containing packages, likely on the internet. -- A recent version of Ansible. (Tests run on the current, previous and next release of Ansible.) +- pip packages listed in [requirements.txt](https://github.com/robertdebock/ansible-role-epel/blob/master/requirements.txt). -The following roles can be installed to ensure all requirements are met, using `ansible-galaxy install -r requirements.yml`: +## [Status of requirements](#status-of-requirements) -```yaml ---- -- robertdebock.bootstrap +The following roles are used to prepare a system. You may choose to prepare your system in another way, I have tested these roles as well. -``` +| Requirement | GitHub | GitLab | +|-------------|--------|--------| +| [robertdebock.bootstrap](https://galaxy.ansible.com/robertdebock/bootstrap) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-bootstrap/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-bootstrap/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-bootstrap/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-bootstrap) ## [Context](#context) This role is a part of many compatible roles. Have a look at [the documentation of these roles](https://robertdebock.nl/) for further information. Here is an overview of related roles: -![dependencies](https://raw.githubusercontent.com/robertdebock/drawings/artifacts/epel.png "Dependency") +![dependencies](https://raw.githubusercontent.com/robertdebock/ansible-role-epel/png/requirements.png "Dependencies") ## [Compatibility](#compatibility) @@ -76,51 +60,19 @@ This role has been tested on these [container images](https://hub.docker.com/u/r |container|tags| |---------|----| -|amazon|all| +|amazon|Candidate| |el|7, 8| -The minimum version of Ansible required is 2.8 but tests have been done to: +The minimum version of Ansible required is 2.10, tests have been done to: -- The previous version, on version lower. +- The previous version. - The current version. - The development version. -## [Testing](#testing) - -[Unit tests](https://travis-ci.com/robertdebock/ansible-role-epel) are done on every commit, pull request, release and periodically. - If you find issues, please register them in [GitHub](https://github.com/robertdebock/ansible-role-epel/issues) -Testing is done using [Tox](https://tox.readthedocs.io/en/latest/) and [Molecule](https://github.com/ansible/molecule): - -[Tox](https://tox.readthedocs.io/en/latest/) tests multiple ansible versions. -[Molecule](https://github.com/ansible/molecule) tests multiple distributions. - -To test using the defaults (any installed ansible version, namespace: `robertdebock`, image: `fedora`, tag: `latest`): - -``` -molecule test - -# Or select a specific image: -image=ubuntu molecule test -# Or select a specific image and a specific tag: -image="debian" tag="stable" tox -``` - -Or you can test multiple versions of Ansible, and select images: -Tox allows multiple versions of Ansible to be tested. To run the default (namespace: `robertdebock`, image: `fedora`, tag: `latest`) tests: - -``` -tox - -# To run CentOS (namespace: `robertdebock`, tag: `latest`) -image="centos" tox -# Or customize more: -image="debian" tag="stable" tox -``` - ## [License](#license) Apache-2.0 @@ -128,6 +80,6 @@ Apache-2.0 ## [Author Information](#author-information) -[Robert de Bock](https://robertdebock.nl/) +[robertdebock](https://robertdebock.nl/) Please consider [sponsoring me](https://github.com/sponsors/robertdebock). diff --git a/roles/epel/handlers 2/main.yml b/roles/epel/handlers 2/main.yml deleted file mode 100644 index a281a2c..0000000 --- a/roles/epel/handlers 2/main.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -# handlers file for epel -- name: yum update cache - yum: - update_cache: yes diff --git a/roles/epel/handlers/main.yml b/roles/epel/handlers/main.yml index a281a2c..a5091ab 100644 --- a/roles/epel/handlers/main.yml +++ b/roles/epel/handlers/main.yml @@ -1,5 +1,6 @@ --- # handlers file for epel + - name: yum update cache - yum: + ansible.builtin.yum: update_cache: yes diff --git a/roles/epel/meta 2/.galaxy_install_info b/roles/epel/meta 2/.galaxy_install_info deleted file mode 100644 index b49dbf2..0000000 --- a/roles/epel/meta 2/.galaxy_install_info +++ /dev/null @@ -1,2 +0,0 @@ -install_date: Mon Sep 28 13:22:15 2020 -version: 2.5.1 diff --git a/roles/epel/meta 2/preferences.yml b/roles/epel/meta 2/preferences.yml deleted file mode 100644 index e7fdebf..0000000 --- a/roles/epel/meta 2/preferences.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -tox_parallel: yes diff --git a/roles/epel/meta/.galaxy_install_info b/roles/epel/meta/.galaxy_install_info index b49dbf2..1292ef8 100644 --- a/roles/epel/meta/.galaxy_install_info +++ b/roles/epel/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Mon Sep 28 13:22:15 2020 -version: 2.5.1 +install_date: Sun Mar 21 06:59:38 2021 +version: 3.0.2 diff --git a/roles/epel/meta/main.yml b/roles/epel/meta/main.yml index 21a1647..3180474 100644 --- a/roles/epel/meta/main.yml +++ b/roles/epel/meta/main.yml @@ -1,16 +1,16 @@ --- galaxy_info: - author: Robert de Bock + author: robertdebock ansible_role: epel description: Install epel on your system. license: Apache-2.0 company: none - min_ansible_version: 2.8 + min_ansible_version: "2.10" platforms: - name: Amazon versions: - - all + - Candidate - name: EL versions: - 7 @@ -21,7 +21,5 @@ galaxy_info: - repository - installer - packages - - centos - - redhat dependencies: [] diff --git a/roles/epel/molecule 2/default/converge.yml b/roles/epel/molecule 2/default/converge.yml deleted file mode 100644 index edaa8ef..0000000 --- a/roles/epel/molecule 2/default/converge.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Converge - hosts: all - become: yes - gather_facts: yes - - roles: - - role: ansible-role-epel diff --git a/roles/epel/molecule 2/default/prepare.yml b/roles/epel/molecule 2/default/prepare.yml deleted file mode 100644 index feb7d81..0000000 --- a/roles/epel/molecule 2/default/prepare.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Prepare - hosts: all - gather_facts: no - become: yes - - roles: - - role: robertdebock.bootstrap diff --git a/roles/epel/molecule 2/default/verify.yml b/roles/epel/molecule 2/default/verify.yml deleted file mode 100644 index 8a418ca..0000000 --- a/roles/epel/molecule 2/default/verify.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -- name: Verify - hosts: all - become: yes - gather_facts: no - - tasks: - - name: install a package from epel - package: - name: aalib - state: present diff --git a/roles/epel/molecule/default/molecule.yml b/roles/epel/molecule/default/molecule.yml index e7532a7..868eb55 100644 --- a/roles/epel/molecule/default/molecule.yml +++ b/roles/epel/molecule/default/molecule.yml @@ -9,6 +9,7 @@ dependency: lint: | set -e yamllint . + ansible-lint driver: name: docker platforms: diff --git a/roles/epel/requirements 2.yml b/roles/epel/requirements 2.yml deleted file mode 100644 index 46dec9d..0000000 --- a/roles/epel/requirements 2.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- robertdebock.bootstrap diff --git a/roles/epel/requirements.yml b/roles/epel/requirements.yml index 46dec9d..11e3224 100644 --- a/roles/epel/requirements.yml +++ b/roles/epel/requirements.yml @@ -1,2 +1,3 @@ --- -- robertdebock.bootstrap +roles: + - name: robertdebock.bootstrap diff --git a/roles/epel/tasks/main.yml b/roles/epel/tasks/main.yml index b2f595d..4c3d691 100644 --- a/roles/epel/tasks/main.yml +++ b/roles/epel/tasks/main.yml @@ -1,17 +1,21 @@ --- # tasks file for epel -- name: install epel gpg key - rpm_key: - key: "{{ epel_gpg_key }}" - state: present - when: - - ansible_distribution in [ "Amazon", "CentOS", "RedHat" ] -- name: install epel-release - package: - name: "{{ epel_url }}" - state: present - notify: - - yum update cache +- name: install epel + block: + - name: install epel gpg key + ansible.builtin.rpm_key: + key: "{{ epel_gpg_key }}" + state: present + + - name: install epel-release + ansible.builtin.package: + name: "{{ epel_url }}" + state: present + notify: + - yum update cache when: - - ansible_distribution in [ "Amazon", "CentOS", "RedHat" ] + - (ansible_distribution == "Amazon" and + ansible_distribution_major_version == "2") or + (ansible_distribution in [ "CentOS", "RedHat" ] and + ansible_distribution_major_version in [ "7", "8" ]) diff --git a/roles/epel/tox.ini b/roles/epel/tox.ini index c1bc1d4..f57553b 100644 --- a/roles/epel/tox.ini +++ b/roles/epel/tox.ini @@ -2,25 +2,25 @@ # Ansible managed # [tox] -minversion = 3.7 -# Disabled "next" because of: -# https://github.com/ansible-community/molecule/issues/2626. -# envlist = py{38}-ansible-{previous,current,next} -envlist = py{38}-ansible-{previous,current} +minversion = 3.21.4 +# 2.11 has been disabled: couldn't resolve module/action 'docker_container'. +envlist = py{39}-ansible-{2.9,2.10} + skipsdist = true [testenv] deps = - previous: ansible>=2.8, <2.9 - current: ansible>=2.9 - next: git+https://github.com/ansible/ansible.git@devel - molecule[lint]>=3, <4 - docker>=4.2, <4.3 + 2.9: ansible == 2.9.* + 2.10: ansible == 2.10.* + 2.11: git+https://github.com/ansible/ansible.git@devel + molecule[docker] + docker == 4.* + ansible-lint == 5.* commands = molecule test setenv = TOX_ENVNAME={envname} - MOLECULE_EPHEMERAL_DIRECTORY=/tmp/.molecule/{env:image:fedora}-{env:tag:latest}/{envname} PY_COLORS=1 ANSIBLE_FORCE_COLOR=1 + ANSIBLE_ROLES_PATH=../ passenv = namespace image tag diff --git a/roles/fail2ban/.ansible-lint b/roles/fail2ban/.ansible-lint index eba57d1..7a17121 100644 --- a/roles/fail2ban/.ansible-lint +++ b/roles/fail2ban/.ansible-lint @@ -4,5 +4,9 @@ exclude_paths: - ./meta/exception.yml - ./meta/preferences.yml + - ./molecule/default/prepare.yml + - ./molecule/default/converge.yml - ./molecule/default/verify.yml + - ./molecule/default/collections.yml - ./.tox + - ./.cache diff --git a/roles/fail2ban/.github 2/FUNDING.yml b/roles/fail2ban/.github 2/FUNDING.yml deleted file mode 100644 index 67320f0..0000000 --- a/roles/fail2ban/.github 2/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -github: robertdebock diff --git a/roles/fail2ban/.github 2/pull_request_template.md b/roles/fail2ban/.github 2/pull_request_template.md deleted file mode 100644 index b1578c0..0000000 --- a/roles/fail2ban/.github 2/pull_request_template.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: Pull request -about: Describe the proposed change - ---- - -**Describe the change** -A clear and concise description of what the pull request is. - -**Testing** -In case a feature was added, how were tests performed? diff --git a/roles/fail2ban/.github 2/settings.yml b/roles/fail2ban/.github 2/settings.yml deleted file mode 100644 index 577ba15..0000000 --- a/roles/fail2ban/.github 2/settings.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# -# Ansible managed -# -repository: - description: Install and configure fail2ban on your system. - homepage: https://robertdebock.nl/ diff --git a/roles/fail2ban/.github/settings.yml b/roles/fail2ban/.github/settings.yml index 577ba15..29252cf 100644 --- a/roles/fail2ban/.github/settings.yml +++ b/roles/fail2ban/.github/settings.yml @@ -5,3 +5,4 @@ repository: description: Install and configure fail2ban on your system. homepage: https://robertdebock.nl/ + topics: fail2ban, installer, package, ansible, molecule, tox, playbook, hacktoberfest diff --git a/roles/fail2ban/.github/workflows/galaxy.yml b/roles/fail2ban/.github/workflows/galaxy.yml index b8478b7..1d36b74 100644 --- a/roles/fail2ban/.github/workflows/galaxy.yml +++ b/roles/fail2ban/.github/workflows/galaxy.yml @@ -6,17 +6,13 @@ name: Release to Ansible Galaxy on: - push: - tags: - - '*' - schedule: - - cron: '6 6 6 * *' - + release: + types: [created, edited, published, released] jobs: release: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: galaxy - uses: robertdebock/galaxy-action@1.0.1 + uses: robertdebock/galaxy-action@1.1.0 with: galaxy_api_key: ${{ secrets.galaxy_api_key }} diff --git a/roles/fail2ban/.github/workflows/molecule.yml b/roles/fail2ban/.github/workflows/molecule.yml index ad2ebef..edd43ea 100644 --- a/roles/fail2ban/.github/workflows/molecule.yml +++ b/roles/fail2ban/.github/workflows/molecule.yml @@ -15,26 +15,26 @@ on: jobs: lint: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: checkout uses: actions/checkout@v2 with: path: "${{ github.repository }}" - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: command: lint test: needs: - lint - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: config: - image: "amazonlinux" - tag: "1" + tag: "latest" - image: "centos" tag: "7" - image: "centos" @@ -44,17 +44,13 @@ jobs: - image: "debian" tag: "bullseye" - image: "fedora" - tag: "31" + tag: "32" - image: "fedora" tag: "latest" - - image: "opensuse" - tag: "latest" - image: "ubuntu" tag: "latest" - image: "ubuntu" tag: "bionic" - - image: "ubuntu" - tag: "xenial" steps: - name: checkout uses: actions/checkout@v2 @@ -65,10 +61,7 @@ jobs: - name: parse apparmor for mysql run: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: image: ${{ matrix.config.image }} tag: ${{ matrix.config.tag }} - options: "--parallel all" - env: - TOX_PARALLEL_NO_SPINNER: 1 diff --git a/roles/fail2ban/.gitignore b/roles/fail2ban/.gitignore index 982db11..c15d16a 100644 --- a/roles/fail2ban/.gitignore +++ b/roles/fail2ban/.gitignore @@ -2,3 +2,4 @@ *.log *.swp .tox +.cache diff --git a/roles/fail2ban/.gitignore 2 b/roles/fail2ban/.gitignore 2 deleted file mode 100644 index 982db11..0000000 --- a/roles/fail2ban/.gitignore 2 +++ /dev/null @@ -1,4 +0,0 @@ -.molecule -*.log -*.swp -.tox diff --git a/roles/fail2ban/.travis.yml b/roles/fail2ban/.travis.yml index 1f902f9..21201e1 100644 --- a/roles/fail2ban/.travis.yml +++ b/roles/fail2ban/.travis.yml @@ -8,41 +8,23 @@ os: linux dist: xenial python: - - "3.8" + - "3.9" services: - docker -env: - global: - namespace="robertdebock" - jobs: - - image="amazonlinux" tag="1" - - image="centos" tag="7" - - image="centos" tag="latest" - - image="debian" tag="latest" - - image="debian" tag="bullseye" - - image="fedora" tag="31" - - image="fedora" tag="latest" - - image="opensuse" tag="latest" - - image="ubuntu" tag="latest" - - image="ubuntu" tag="bionic" - - image="ubuntu" tag="xenial" - cache: - pip install: - pip install --upgrade pip - - pip install tox + - pip install yamllint + - pip install ansible-lint script: - - function retry { counter=0 ; until "$@" ; do exit=$? ; counter=$(($counter + 1)) ; if [ $counter -ge 3 ] ; then return $exit ; fi ; done ; return 0; } ; retry tox --parallel all + - yamllint . + - ansible-lint notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ - slack: - secure: "q9mLGSHcv5k7eG5IrRMAkC9OtcFb4/dsHdbXAnpcdV4KFfDdI49YULLu6RromXYeZsabESnWb73r1mo+qu+83Ky25UpHyY9OBl1IR6txSIzqMX/P+cA69pIh9TE3zmTXiEv6PFJhDM6Jrv47UOkktVWZwDISdn9P7cFxE7PM1GK4OD5Zn8ioCYI2d7jEUQZ9c/d564z+nJQVV8YDOh55Zw0tM/yK6ZiiHna0xv+HPUJsMhx0B1RZnggoDbcq27TcHb3Bys8+Sw0gQyHLJEnOIrPXNw8tNhUwTq9oJEPqxgXcEoaOTEJzH0Aw4mEw1FXwdKkxzeKNSQHruHpTqLO0QMyHvgHyTfEtWIufQd94dCtp6qLNpM56Ew61sIyWPQWlEy98B6FzYqz5IBlorrK+9BRygk47Gp2OZSBKZCYLbWdhp7kVT5e2D4HfJQV9r5U2rCm4I0geKaFfljUv5RrUI5HV1PiWMpCer++LiP9lD7S/GGPQ5Dkc+A5nEZ5Dd/T/E+dzOWznQuTVhWMs2Mx8a2iDv6XsXkeXPQrrYu0KY+KFCnAGSWRIOh3Ok0iOAd0OUEsrR5JhMiH8btBIXZ+jin3VE6sDkQPk+meXy+CsbS48ksPSPStJpenU2eKLbhQ0lUVvr12pR41f9+ZVia/4AVqSJTrljDMzt61BkyEzye8=" - on_success: change - template: "%{result}: %{repository_slug}@%{branch}, build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}>)" email: false diff --git a/roles/fail2ban/.yamllint b/roles/fail2ban/.yamllint index 894450c..a7ff098 100644 --- a/roles/fail2ban/.yamllint +++ b/roles/fail2ban/.yamllint @@ -13,3 +13,4 @@ rules: ignore: | .tox/ + .cache/ diff --git a/roles/fail2ban/LICENSE b/roles/fail2ban/LICENSE index bd15893..e770af8 100644 --- a/roles/fail2ban/LICENSE +++ b/roles/fail2ban/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 Robert de Bock (robert@meinit.nl) + Copyright 2021 Robert de Bock (robert@meinit.nl) 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/roles/fail2ban/README.md b/roles/fail2ban/README.md index 3d2b606..260c456 100644 --- a/roles/fail2ban/README.md +++ b/roles/fail2ban/README.md @@ -2,9 +2,9 @@ Install and configure fail2ban on your system. -|Travis|GitHub|Quality|Downloads|Version| +|GitHub|GitLab|Quality|Downloads|Version| |------|------|-------|---------|-------| -|[![travis](https://travis-ci.com/robertdebock/ansible-role-fail2ban.svg?branch=master)](https://travis-ci.com/robertdebock/ansible-role-fail2ban)|[![github](https://github.com/robertdebock/ansible-role-fail2ban/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-fail2ban/actions)|[![quality](https://img.shields.io/ansible/quality/22987)](https://galaxy.ansible.com/robertdebock/fail2ban)|[![downloads](https://img.shields.io/ansible/role/d/22987)](https://galaxy.ansible.com/robertdebock/fail2ban)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-fail2ban.svg)](https://github.com/robertdebock/ansible-role-fail2ban/releases/)| +|[![github](https://github.com/robertdebock/ansible-role-fail2ban/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-fail2ban/actions)|[![gitlab](https://gitlab.com/robertdebock/ansible-role-fail2ban/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-fail2ban)|[![quality](https://img.shields.io/ansible/quality/22987)](https://galaxy.ansible.com/robertdebock/fail2ban)|[![downloads](https://img.shields.io/ansible/role/d/22987)](https://galaxy.ansible.com/robertdebock/fail2ban)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-fail2ban.svg)](https://github.com/robertdebock/ansible-role-fail2ban/releases/)| ## [Example Playbook](#example-playbook) @@ -20,7 +20,7 @@ This example is taken from `molecule/resources/converge.yml` and is tested on ea - role: robertdebock.fail2ban ``` -The machine may need to be prepared using `molecule/resources/prepare.yml`: +The machine needs to be prepared in CI this is done using `molecule/resources/prepare.yml`: ```yaml --- - name: Prepare @@ -33,19 +33,6 @@ The machine may need to be prepared using `molecule/resources/prepare.yml`: - role: robertdebock.epel ``` -For verification `molecule/resources/verify.yml` runs after the role has been applied. -```yaml ---- -- name: Verify - hosts: all - become: yes - gather_facts: no - - tasks: - - name: check if connection still works - ping: -``` - Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles. ## [Role Variables](#role-variables) @@ -82,24 +69,23 @@ fail2ban_jail_configuration: [] ## [Requirements](#requirements) -- Access to a repository containing packages, likely on the internet. -- A recent version of Ansible. (Tests run on the current, previous and next release of Ansible.) +- pip packages listed in [requirements.txt](https://github.com/robertdebock/ansible-role-fail2ban/blob/master/requirements.txt). -The following roles can be installed to ensure all requirements are met, using `ansible-galaxy install -r requirements.yml`: +## [Status of requirements](#status-of-requirements) -```yaml ---- -- robertdebock.bootstrap -- robertdebock.epel +The following roles are used to prepare a system. You may choose to prepare your system in another way, I have tested these roles as well. -``` +| Requirement | GitHub | GitLab | +|-------------|--------|--------| +| [robertdebock.bootstrap](https://galaxy.ansible.com/robertdebock/bootstrap) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-bootstrap/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-bootstrap/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-bootstrap/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-bootstrap) +| [robertdebock.epel](https://galaxy.ansible.com/robertdebock/epel) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-epel/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-epel/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-epel/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-epel) ## [Context](#context) This role is a part of many compatible roles. Have a look at [the documentation of these roles](https://robertdebock.nl/) for further information. Here is an overview of related roles: -![dependencies](https://raw.githubusercontent.com/robertdebock/drawings/artifacts/fail2ban.png "Dependency") +![dependencies](https://raw.githubusercontent.com/robertdebock/ansible-role-fail2ban/png/requirements.png "Dependencies") ## [Compatibility](#compatibility) @@ -107,16 +93,15 @@ This role has been tested on these [container images](https://hub.docker.com/u/r |container|tags| |---------|----| -|amazon|2018.03| +|amazon|Candidate| |el|7, 8| |debian|buster, bullseye| -|fedora|31, 32| -|opensuse|all| -|ubuntu|focal, bionic, xenial| +|fedora|all| +|ubuntu|focal, bionic| -The minimum version of Ansible required is 2.8 but tests have been done to: +The minimum version of Ansible required is 2.10, tests have been done to: -- The previous version, on version lower. +- The previous version. - The current version. - The development version. @@ -127,43 +112,12 @@ Some variarations of the build matrix do not work. These are the variations and | variation | reason | |---------------------------|------------------------| | alpine | Service `fail2ban' needs non existent service `logger' | -| amazonlinux:1 | file /etc/ethertypes conflicts between attempted installs of ebtables-2.0.10-16.amzn2.x86_64 and iptables-1.8.2-16.amzn2.0.1.x86_64 | +| amazonlinux:1 | Based on EL6, not supported since 2020Q4. | +| opensuse | The package fail2ban depends on python2, we switched to python3. | -## [Testing](#testing) - -[Unit tests](https://travis-ci.com/robertdebock/ansible-role-fail2ban) are done on every commit, pull request, release and periodically. - If you find issues, please register them in [GitHub](https://github.com/robertdebock/ansible-role-fail2ban/issues) -Testing is done using [Tox](https://tox.readthedocs.io/en/latest/) and [Molecule](https://github.com/ansible/molecule): - -[Tox](https://tox.readthedocs.io/en/latest/) tests multiple ansible versions. -[Molecule](https://github.com/ansible/molecule) tests multiple distributions. - -To test using the defaults (any installed ansible version, namespace: `robertdebock`, image: `fedora`, tag: `latest`): - -``` -molecule test - -# Or select a specific image: -image=ubuntu molecule test -# Or select a specific image and a specific tag: -image="debian" tag="stable" tox -``` - -Or you can test multiple versions of Ansible, and select images: -Tox allows multiple versions of Ansible to be tested. To run the default (namespace: `robertdebock`, image: `fedora`, tag: `latest`) tests: - -``` -tox - -# To run CentOS (namespace: `robertdebock`, tag: `latest`) -image="centos" tox -# Or customize more: -image="debian" tag="stable" tox -``` - ## [License](#license) Apache-2.0 @@ -173,6 +127,7 @@ Apache-2.0 I'd like to thank everybody that made contributions to this repository. It motivates me, improves the code and is just fun to collaborate. - [j8r](https://github.com/j8r) +- [Pandemonium1986](https://github.com/Pandemonium1986) - [rgevaert](https://github.com/rgevaert) ## [Author Information](#author-information) diff --git a/roles/fail2ban/handlers/main.yml b/roles/fail2ban/handlers/main.yml index 433500e..d9d268b 100644 --- a/roles/fail2ban/handlers/main.yml +++ b/roles/fail2ban/handlers/main.yml @@ -1,6 +1,9 @@ --- # handlers file for fail2ban + - name: restart fail2ban - service: + ansible.builtin.service: name: "{{ fail2ban_service }}" state: restarted + when: + - not ansible_check_mode | bool diff --git a/roles/fail2ban/meta 2/.galaxy_install_info b/roles/fail2ban/meta 2/.galaxy_install_info deleted file mode 100644 index 1e6bee8..0000000 --- a/roles/fail2ban/meta 2/.galaxy_install_info +++ /dev/null @@ -1,2 +0,0 @@ -install_date: Mon Sep 28 13:22:18 2020 -version: 3.1.4 diff --git a/roles/fail2ban/meta 2/exception.yml b/roles/fail2ban/meta 2/exception.yml deleted file mode 100644 index c364baa..0000000 --- a/roles/fail2ban/meta 2/exception.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -exceptions: - - variation: alpine - reason: "Service `fail2ban' needs non existent service `logger'" - - variation: amazonlinux:1 - reason: "file /etc/ethertypes conflicts between attempted installs of ebtables-2.0.10-16.amzn2.x86_64 and iptables-1.8.2-16.amzn2.0.1.x86_64" diff --git a/roles/fail2ban/meta 2/preferences.yml b/roles/fail2ban/meta 2/preferences.yml deleted file mode 100644 index e7fdebf..0000000 --- a/roles/fail2ban/meta 2/preferences.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -tox_parallel: yes diff --git a/roles/fail2ban/meta/.galaxy_install_info b/roles/fail2ban/meta/.galaxy_install_info index 1e6bee8..7b0b91d 100644 --- a/roles/fail2ban/meta/.galaxy_install_info +++ b/roles/fail2ban/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Mon Sep 28 13:22:18 2020 -version: 3.1.4 +install_date: Sun Mar 21 06:59:40 2021 +version: 4.0.0 diff --git a/roles/fail2ban/meta/exception.yml b/roles/fail2ban/meta/exception.yml index c364baa..49888ff 100644 --- a/roles/fail2ban/meta/exception.yml +++ b/roles/fail2ban/meta/exception.yml @@ -3,4 +3,6 @@ exceptions: - variation: alpine reason: "Service `fail2ban' needs non existent service `logger'" - variation: amazonlinux:1 - reason: "file /etc/ethertypes conflicts between attempted installs of ebtables-2.0.10-16.amzn2.x86_64 and iptables-1.8.2-16.amzn2.0.1.x86_64" + reason: "Based on EL6, not supported since 2020Q4." + - variation: opensuse + reason: "The package fail2ban depends on python2, we switched to python3." diff --git a/roles/fail2ban/meta/main.yml b/roles/fail2ban/meta/main.yml index 816df35..c396fb0 100644 --- a/roles/fail2ban/meta/main.yml +++ b/roles/fail2ban/meta/main.yml @@ -5,12 +5,12 @@ galaxy_info: description: Install and configure fail2ban on your system. license: Apache-2.0 company: none - min_ansible_version: 2.8 + min_ansible_version: "2.10" platforms: - name: Amazon versions: - - 2018.03 + - Candidate - name: EL versions: - 7 @@ -20,22 +20,16 @@ galaxy_info: - buster - bullseye - name: Fedora - versions: - - 31 - - 32 - - name: OpenSUSE versions: - all - name: Ubuntu versions: - focal - bionic - - xenial galaxy_tags: - fail2ban - installer - package - - centos dependencies: [] diff --git a/roles/fail2ban/molecule 2/default/converge.yml b/roles/fail2ban/molecule 2/default/converge.yml deleted file mode 100644 index 3194da6..0000000 --- a/roles/fail2ban/molecule 2/default/converge.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Converge - hosts: all - become: yes - gather_facts: yes - - roles: - - role: ansible-role-fail2ban diff --git a/roles/fail2ban/molecule 2/default/prepare.yml b/roles/fail2ban/molecule 2/default/prepare.yml deleted file mode 100644 index c8572a5..0000000 --- a/roles/fail2ban/molecule 2/default/prepare.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -- name: Prepare - hosts: all - gather_facts: no - become: yes - - roles: - - role: robertdebock.bootstrap - - role: robertdebock.epel diff --git a/roles/fail2ban/molecule 2/default/verify.yml b/roles/fail2ban/molecule 2/default/verify.yml deleted file mode 100644 index b9dc6f8..0000000 --- a/roles/fail2ban/molecule 2/default/verify.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -- name: Verify - hosts: all - become: yes - gather_facts: no - - tasks: - - name: check if connection still works - ping: diff --git a/roles/fail2ban/molecule/default/molecule.yml b/roles/fail2ban/molecule/default/molecule.yml index 878e444..1c7ceec 100644 --- a/roles/fail2ban/molecule/default/molecule.yml +++ b/roles/fail2ban/molecule/default/molecule.yml @@ -6,9 +6,11 @@ dependency: name: galaxy options: role-file: requirements.yml + requirements-file: requirements.yml lint: | set -e yamllint . + ansible-lint driver: name: docker platforms: diff --git a/roles/fail2ban/requirements 2.yml b/roles/fail2ban/requirements 2.yml deleted file mode 100644 index cecd945..0000000 --- a/roles/fail2ban/requirements 2.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- robertdebock.bootstrap -- robertdebock.epel diff --git a/roles/fail2ban/requirements.yml b/roles/fail2ban/requirements.yml index cecd945..56b0f29 100644 --- a/roles/fail2ban/requirements.yml +++ b/roles/fail2ban/requirements.yml @@ -1,3 +1,6 @@ --- -- robertdebock.bootstrap -- robertdebock.epel +roles: + - name: robertdebock.bootstrap + - name: robertdebock.epel +collections: + - name: community.general diff --git a/roles/fail2ban/tasks/assert.yml b/roles/fail2ban/tasks/assert.yml index 961b418..e30a2c1 100644 --- a/roles/fail2ban/tasks/assert.yml +++ b/roles/fail2ban/tasks/assert.yml @@ -1,74 +1,75 @@ --- + - name: test if fail2ban_loglevel is set correctly - assert: + ansible.builtin.assert: that: - fail2ban_loglevel is defined - - fail2ban_loglevel | length > 0 - - fail2ban_loglevel in ["CRITICAL", "ERROR", "WARNING", "NOTICE", "INFO", "DEBUG"] + - fail2ban_loglevel is string + - fail2ban_loglevel in [ "CRITICAL", "ERROR", "WARNING", "NOTICE", "INFO", "DEBUG" ] quiet: yes - name: test if fail2ban_logtarget is set correctly - assert: + ansible.builtin.assert: that: - fail2ban_logtarget is defined - - fail2ban_logtarget | length > 0 + - fail2ban_logtarget is string quiet: yes - name: test if fail2ban_ignoreself is set correctly - assert: + ansible.builtin.assert: that: - fail2ban_ignoreself is defined - - fail2ban_ignoreself | length > 0 - - fail2ban_ignoreself in ["false", "true"] + - fail2ban_ignoreself is string + - fail2ban_ignoreself in [ "false", "true" ] quiet: yes - name: test if fail2ban_ignoreips is set correctly - assert: + ansible.builtin.assert: that: - fail2ban_ignoreips is defined - - fail2ban_ignoreips | length > 0 + - fail2ban_ignoreips is string quiet: yes - name: test if fail2ban_bantime is set correctly - assert: + ansible.builtin.assert: that: - fail2ban_bantime is defined - - fail2ban_bantime | int - - fail2ban_bantime | int > 0 + - fail2ban_bantime is number + - fail2ban_bantime >= -1 and fail2ban_bantime !=0 quiet: yes - name: test if fail2ban_findtime is set correctly - assert: + ansible.builtin.assert: that: - fail2ban_findtime is defined - - fail2ban_findtime | int - - fail2ban_findtime | int > 0 + - fail2ban_findtime is number + - fail2ban_findtime > 0 quiet: yes - name: test if fail2ban_maxretry is set correctly - assert: + ansible.builtin.assert: that: - fail2ban_maxretry is defined - - fail2ban_maxretry | int - - fail2ban_maxretry | int > 0 + - fail2ban_maxretry is number + - fail2ban_maxretry > 0 quiet: yes - name: test if fail2ban_destemail is set correctly - assert: + ansible.builtin.assert: that: - fail2ban_destemail is defined - - fail2ban_destemail | length > 0 + - fail2ban_destemail is string quiet: yes - name: test if fail2ban_sender is set correctly - assert: + ansible.builtin.assert: that: - fail2ban_sender is defined - - fail2ban_sender | length > 0 + - fail2ban_sender is string quiet: yes - name: test if fail2ban_configuration is set correctly - assert: + ansible.builtin.assert: that: - fail2ban_configuration is iterable quiet: yes @@ -76,37 +77,33 @@ - fail2ban_configuration is defined - name: test if item in fail2ban_configuration is set correctly - assert: + ansible.builtin.assert: that: - item.option is defined - - item.option | length > 0 + - item.option is string - item.value is defined - - item.value | length > 0 - item.section is defined - - item.section | length > 0 + - item.section is string quiet: yes loop: "{{ fail2ban_configuration }}" loop_control: label: "{{ item.option }}" when: - fail2ban_configuration is defined - - fail2ban_configuration | length > 0 - fail2ban_configuration is iterable - name: test if fail2ban_jail_configuration is set correctly - assert: + ansible.builtin.assert: that: - item.option is defined - - item.option | length > 0 + - item.option is string - item.value is defined - - item.value | length > 0 - item.section is defined - - item.section | length > 0 + - item.section is string quiet: yes loop: "{{ fail2ban_jail_configuration }}" loop_control: label: "{{ item.option }}" when: - fail2ban_jail_configuration is defined - - fail2ban_jail_configuration | length > 0 - fail2ban_jail_configuration is iterable diff --git a/roles/fail2ban/tasks/main.yml b/roles/fail2ban/tasks/main.yml index b2db813..bb289db 100644 --- a/roles/fail2ban/tasks/main.yml +++ b/roles/fail2ban/tasks/main.yml @@ -1,15 +1,18 @@ --- # tasks file for fail2ban + - name: include assert.yml - include_tasks: assert.yml + import_tasks: assert.yml + run_once: yes + delegate_to: localhost - name: install fail2ban - package: + ansible.builtin.package: name: "{{ fail2ban_packages }}" state: present - name: configure fail2ban.conf - ini_file: + community.general.ini_file: path: /etc/fail2ban/fail2ban.conf section: "{{ item.section }}" option: "{{ item.option }}" @@ -22,7 +25,7 @@ label: "{{ item.option }}" - name: configure jail.local - ini_file: + community.general.ini_file: path: /etc/fail2ban/jail.local section: "{{ item.section }}" option: "{{ item.option }}" @@ -35,12 +38,12 @@ label: "{{ item.option }}" - name: stat auth log file - stat: + ansible.builtin.stat: path: /var/log/auth.log register: fail2ban_auth - name: touch auth log file - file: + ansible.builtin.file: path: /var/log/auth.log state: touch mode: "0640" @@ -49,7 +52,7 @@ - not fail2ban_auth.stat.exists - name: start and enable fail2ban - service: + ansible.builtin.service: name: "{{ fail2ban_service }}" state: started enabled: yes diff --git a/roles/fail2ban/tox.ini b/roles/fail2ban/tox.ini index c1bc1d4..f57553b 100644 --- a/roles/fail2ban/tox.ini +++ b/roles/fail2ban/tox.ini @@ -2,25 +2,25 @@ # Ansible managed # [tox] -minversion = 3.7 -# Disabled "next" because of: -# https://github.com/ansible-community/molecule/issues/2626. -# envlist = py{38}-ansible-{previous,current,next} -envlist = py{38}-ansible-{previous,current} +minversion = 3.21.4 +# 2.11 has been disabled: couldn't resolve module/action 'docker_container'. +envlist = py{39}-ansible-{2.9,2.10} + skipsdist = true [testenv] deps = - previous: ansible>=2.8, <2.9 - current: ansible>=2.9 - next: git+https://github.com/ansible/ansible.git@devel - molecule[lint]>=3, <4 - docker>=4.2, <4.3 + 2.9: ansible == 2.9.* + 2.10: ansible == 2.10.* + 2.11: git+https://github.com/ansible/ansible.git@devel + molecule[docker] + docker == 4.* + ansible-lint == 5.* commands = molecule test setenv = TOX_ENVNAME={envname} - MOLECULE_EPHEMERAL_DIRECTORY=/tmp/.molecule/{env:image:fedora}-{env:tag:latest}/{envname} PY_COLORS=1 ANSIBLE_FORCE_COLOR=1 + ANSIBLE_ROLES_PATH=../ passenv = namespace image tag diff --git a/roles/git/.ansible-lint b/roles/git/.ansible-lint index cb2872e..57f681e 100644 --- a/roles/git/.ansible-lint +++ b/roles/git/.ansible-lint @@ -3,5 +3,9 @@ # exclude_paths: - ./meta/preferences.yml + - ./molecule/default/prepare.yml + - ./molecule/default/converge.yml - ./molecule/default/verify.yml + - ./molecule/default/collections.yml - ./.tox + - ./.cache diff --git a/roles/git/.ansible-lint 2 b/roles/git/.ansible-lint 2 deleted file mode 100644 index cb2872e..0000000 --- a/roles/git/.ansible-lint 2 +++ /dev/null @@ -1,7 +0,0 @@ -# -# Ansible managed -# -exclude_paths: - - ./meta/preferences.yml - - ./molecule/default/verify.yml - - ./.tox diff --git a/roles/git/.github 2/FUNDING.yml b/roles/git/.github 2/FUNDING.yml deleted file mode 100644 index 67320f0..0000000 --- a/roles/git/.github 2/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -github: robertdebock diff --git a/roles/git/.github 2/pull_request_template.md b/roles/git/.github 2/pull_request_template.md deleted file mode 100644 index b1578c0..0000000 --- a/roles/git/.github 2/pull_request_template.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: Pull request -about: Describe the proposed change - ---- - -**Describe the change** -A clear and concise description of what the pull request is. - -**Testing** -In case a feature was added, how were tests performed? diff --git a/roles/git/.github 2/settings.yml b/roles/git/.github 2/settings.yml deleted file mode 100644 index 041c2ef..0000000 --- a/roles/git/.github 2/settings.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# -# Ansible managed -# -repository: - description: Install and configure git on your system. - homepage: https://robertdebock.nl/ diff --git a/roles/git/.github/settings.yml b/roles/git/.github/settings.yml index 041c2ef..29b922b 100644 --- a/roles/git/.github/settings.yml +++ b/roles/git/.github/settings.yml @@ -5,3 +5,4 @@ repository: description: Install and configure git on your system. homepage: https://robertdebock.nl/ + topics: git, ansible, molecule, tox, playbook, hacktoberfest diff --git a/roles/git/.github/workflows/galaxy.yml b/roles/git/.github/workflows/galaxy.yml index bfb170a..1d36b74 100644 --- a/roles/git/.github/workflows/galaxy.yml +++ b/roles/git/.github/workflows/galaxy.yml @@ -6,17 +6,13 @@ name: Release to Ansible Galaxy on: - push: - tags: - - '*' - schedule: - - cron: '7 7 7 * *' - + release: + types: [created, edited, published, released] jobs: release: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: galaxy - uses: robertdebock/galaxy-action@1.0.1 + uses: robertdebock/galaxy-action@1.1.0 with: galaxy_api_key: ${{ secrets.galaxy_api_key }} diff --git a/roles/git/.github/workflows/molecule.yml b/roles/git/.github/workflows/molecule.yml index 6da7e06..cd4b23b 100644 --- a/roles/git/.github/workflows/molecule.yml +++ b/roles/git/.github/workflows/molecule.yml @@ -15,30 +15,28 @@ on: jobs: lint: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: checkout uses: actions/checkout@v2 with: path: "${{ github.repository }}" - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: command: lint test: needs: - lint - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: config: - image: "alpine" tag: "latest" - - image: "alpine" - tag: "edge" - image: "amazonlinux" - tag: "1" + tag: "latest" - image: "centos" tag: "7" - image: "centos" @@ -48,7 +46,7 @@ jobs: - image: "debian" tag: "bullseye" - image: "fedora" - tag: "31" + tag: "32" - image: "fedora" tag: "latest" - image: "opensuse" @@ -57,8 +55,6 @@ jobs: tag: "latest" - image: "ubuntu" tag: "bionic" - - image: "ubuntu" - tag: "xenial" steps: - name: checkout uses: actions/checkout@v2 @@ -69,10 +65,7 @@ jobs: - name: parse apparmor for mysql run: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: image: ${{ matrix.config.image }} tag: ${{ matrix.config.tag }} - options: "--parallel all" - env: - TOX_PARALLEL_NO_SPINNER: 1 diff --git a/roles/git/.gitignore b/roles/git/.gitignore index 982db11..c15d16a 100644 --- a/roles/git/.gitignore +++ b/roles/git/.gitignore @@ -2,3 +2,4 @@ *.log *.swp .tox +.cache diff --git a/roles/git/.gitignore 2 b/roles/git/.gitignore 2 deleted file mode 100644 index 982db11..0000000 --- a/roles/git/.gitignore 2 +++ /dev/null @@ -1,4 +0,0 @@ -.molecule -*.log -*.swp -.tox diff --git a/roles/git/.travis.yml b/roles/git/.travis.yml index c2f575a..21201e1 100644 --- a/roles/git/.travis.yml +++ b/roles/git/.travis.yml @@ -8,43 +8,23 @@ os: linux dist: xenial python: - - "3.8" + - "3.9" services: - docker -env: - global: - namespace="robertdebock" - jobs: - - image="alpine" tag="latest" - - image="alpine" tag="edge" - - image="amazonlinux" tag="1" - - image="centos" tag="7" - - image="centos" tag="latest" - - image="debian" tag="latest" - - image="debian" tag="bullseye" - - image="fedora" tag="31" - - image="fedora" tag="latest" - - image="opensuse" tag="latest" - - image="ubuntu" tag="latest" - - image="ubuntu" tag="bionic" - - image="ubuntu" tag="xenial" - cache: - pip install: - pip install --upgrade pip - - pip install tox + - pip install yamllint + - pip install ansible-lint script: - - function retry { counter=0 ; until "$@" ; do exit=$? ; counter=$(($counter + 1)) ; if [ $counter -ge 3 ] ; then return $exit ; fi ; done ; return 0; } ; retry tox --parallel all + - yamllint . + - ansible-lint notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ - slack: - secure: "cfHT76XEmLF7IEz3QFesP5ZE/XPy9H1KtzUAqFuUVUryitRSeYIyXAgiy9u/zLiHkcNDIdrC/9ZiA/xz0gBuG/Cqy5PuH2STx9WNLEb4sOLofWV25go4FOz+EYB2PJtuyg/YOEadJh30cAjJaB2U+vkni8i/tW5Y3Hi3fA4BB3VTMUw08ItqmG8205udxz/9+stF7KQw2G355CGIn6ix2xk8LINTk4SDOWq2/ECk78TXnNO+c/j/vMJsn1tYkkVXaXJdJzI6ozB7FmBAD3At2C397plxECe4M2+kw00k0wmtynKG5XIBAIqDBi7+1mm9v4DB+ZiWPrqaLVM2So6AMEX0fbeUfmGHCQFN6uHBwAHwTXWNPIZOlWaWxT9CUdh+Qc5JIcHqfOYORYPxJfXCk0o1KCexBJ7rd1HObXZ0mvvPB8Ro48VUdzUCyyD8t1PtxJSlB1EHtw/9weZ6ClZ25Q6cIh9f8QQSmLjRdSc+YxI4MC7fpPAE+EEz39lAbo7xoGiXZfCwzItzPLuB8Ee2u4LtIqCaxwQ7AaAjvc65tYKJXoYvynwCrUCJsjja2jMxWmgiSe0h+hNUeTJp1AlhkcMYZlqdHxapL1jxUIXjOuaoGiXfozQHjziXikL2GUpF03aXwByRdqT9TaEoAchKm/tp4CSpbbsa6gddgc0OZZw=" - on_success: change - template: "%{result}: %{repository_slug}@%{branch}, build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}>)" email: false diff --git a/roles/git/.yamllint b/roles/git/.yamllint index 894450c..a7ff098 100644 --- a/roles/git/.yamllint +++ b/roles/git/.yamllint @@ -13,3 +13,4 @@ rules: ignore: | .tox/ + .cache/ diff --git a/roles/git/LICENSE b/roles/git/LICENSE index bd15893..e770af8 100644 --- a/roles/git/LICENSE +++ b/roles/git/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 Robert de Bock (robert@meinit.nl) + Copyright 2021 Robert de Bock (robert@meinit.nl) 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/roles/git/README.md b/roles/git/README.md index 159dcf3..6836e6e 100644 --- a/roles/git/README.md +++ b/roles/git/README.md @@ -2,9 +2,9 @@ Install and configure git on your system. -|Travis|GitHub|Quality|Downloads|Version| +|GitHub|GitLab|Quality|Downloads|Version| |------|------|-------|---------|-------| -|[![travis](https://travis-ci.com/robertdebock/ansible-role-git.svg?branch=master)](https://travis-ci.com/robertdebock/ansible-role-git)|[![github](https://github.com/robertdebock/ansible-role-git/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-git/actions)|[![quality](https://img.shields.io/ansible/quality/34950)](https://galaxy.ansible.com/robertdebock/git)|[![downloads](https://img.shields.io/ansible/role/d/34950)](https://galaxy.ansible.com/robertdebock/git)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-git.svg)](https://github.com/robertdebock/ansible-role-git/releases/)| +|[![github](https://github.com/robertdebock/ansible-role-git/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-git/actions)|[![gitlab](https://gitlab.com/robertdebock/ansible-role-git/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-git)|[![quality](https://img.shields.io/ansible/quality/34950)](https://galaxy.ansible.com/robertdebock/git)|[![downloads](https://img.shields.io/ansible/role/d/34950)](https://galaxy.ansible.com/robertdebock/git)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-git.svg)](https://github.com/robertdebock/ansible-role-git/releases/)| ## [Example Playbook](#example-playbook) @@ -34,7 +34,7 @@ This example is taken from `molecule/resources/converge.yml` and is tested on ea - role: robertdebock.git ``` -The machine may need to be prepared using `molecule/resources/prepare.yml`: +The machine needs to be prepared in CI this is done using `molecule/resources/prepare.yml`: ```yaml --- - name: Prepare @@ -47,19 +47,6 @@ The machine may need to be prepared using `molecule/resources/prepare.yml`: - role: robertdebock.bootstrap ``` -For verification `molecule/resources/verify.yml` runs after the role has been applied. -```yaml ---- -- name: Verify - hosts: all - become: yes - gather_facts: no - - tasks: - - name: check if connection still works - ping: -``` - Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles. ## [Role Variables](#role-variables) @@ -100,23 +87,22 @@ git_force: no ## [Requirements](#requirements) -- Access to a repository containing packages, likely on the internet. -- A recent version of Ansible. (Tests run on the current, previous and next release of Ansible.) +- pip packages listed in [requirements.txt](https://github.com/robertdebock/ansible-role-git/blob/master/requirements.txt). -The following roles can be installed to ensure all requirements are met, using `ansible-galaxy install -r requirements.yml`: +## [Status of requirements](#status-of-requirements) -```yaml ---- -- robertdebock.bootstrap +The following roles are used to prepare a system. You may choose to prepare your system in another way, I have tested these roles as well. -``` +| Requirement | GitHub | GitLab | +|-------------|--------|--------| +| [robertdebock.bootstrap](https://galaxy.ansible.com/robertdebock/bootstrap) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-bootstrap/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-bootstrap/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-bootstrap/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-bootstrap) ## [Context](#context) This role is a part of many compatible roles. Have a look at [the documentation of these roles](https://robertdebock.nl/) for further information. Here is an overview of related roles: -![dependencies](https://raw.githubusercontent.com/robertdebock/drawings/artifacts/git.png "Dependency") +![dependencies](https://raw.githubusercontent.com/robertdebock/ansible-role-git/png/requirements.png "Dependencies") ## [Compatibility](#compatibility) @@ -125,55 +111,23 @@ This role has been tested on these [container images](https://hub.docker.com/u/r |container|tags| |---------|----| |alpine|all| -|amazon|2018.03| +|amazon|Candidate| |el|7, 8| |debian|buster, bullseye| -|fedora|31, 32| +|fedora|all| |opensuse|all| -|ubuntu|focal, bionic, xenial| +|ubuntu|focal, bionic| -The minimum version of Ansible required is 2.8 but tests have been done to: +The minimum version of Ansible required is 2.10, tests have been done to: -- The previous version, on version lower. +- The previous version. - The current version. - The development version. -## [Testing](#testing) - -[Unit tests](https://travis-ci.com/robertdebock/ansible-role-git) are done on every commit, pull request, release and periodically. - If you find issues, please register them in [GitHub](https://github.com/robertdebock/ansible-role-git/issues) -Testing is done using [Tox](https://tox.readthedocs.io/en/latest/) and [Molecule](https://github.com/ansible/molecule): - -[Tox](https://tox.readthedocs.io/en/latest/) tests multiple ansible versions. -[Molecule](https://github.com/ansible/molecule) tests multiple distributions. - -To test using the defaults (any installed ansible version, namespace: `robertdebock`, image: `fedora`, tag: `latest`): - -``` -molecule test - -# Or select a specific image: -image=ubuntu molecule test -# Or select a specific image and a specific tag: -image="debian" tag="stable" tox -``` - -Or you can test multiple versions of Ansible, and select images: -Tox allows multiple versions of Ansible to be tested. To run the default (namespace: `robertdebock`, image: `fedora`, tag: `latest`) tests: - -``` -tox - -# To run CentOS (namespace: `robertdebock`, tag: `latest`) -image="centos" tox -# Or customize more: -image="debian" tag="stable" tox -``` - ## [License](#license) Apache-2.0 diff --git a/roles/git/meta 2/.galaxy_install_info b/roles/git/meta 2/.galaxy_install_info deleted file mode 100644 index 8676ff0..0000000 --- a/roles/git/meta 2/.galaxy_install_info +++ /dev/null @@ -1,2 +0,0 @@ -install_date: Mon Sep 28 13:22:21 2020 -version: 3.3.5 diff --git a/roles/git/meta 2/preferences.yml b/roles/git/meta 2/preferences.yml deleted file mode 100644 index e7fdebf..0000000 --- a/roles/git/meta 2/preferences.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -tox_parallel: yes diff --git a/roles/git/meta/.galaxy_install_info b/roles/git/meta/.galaxy_install_info index 8676ff0..6bbeada 100644 --- a/roles/git/meta/.galaxy_install_info +++ b/roles/git/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Mon Sep 28 13:22:21 2020 -version: 3.3.5 +install_date: Sun Mar 21 06:59:42 2021 +version: 4.0.0 diff --git a/roles/git/meta/main.yml b/roles/git/meta/main.yml index 940ebe5..9758172 100644 --- a/roles/git/meta/main.yml +++ b/roles/git/meta/main.yml @@ -5,7 +5,7 @@ galaxy_info: description: Install and configure git on your system. license: Apache-2.0 company: none - min_ansible_version: 2.8 + min_ansible_version: "2.10" platforms: - name: Alpine @@ -13,7 +13,7 @@ galaxy_info: - all - name: Amazon versions: - - 2018.03 + - Candidate - name: EL versions: - 7 @@ -24,8 +24,7 @@ galaxy_info: - bullseye - name: Fedora versions: - - 31 - - 32 + - all - name: OpenSUSE versions: - all @@ -33,11 +32,8 @@ galaxy_info: versions: - focal - bionic - - xenial galaxy_tags: - git - - centos - - redhat dependencies: [] diff --git a/roles/git/molecule/default/molecule.yml b/roles/git/molecule/default/molecule.yml index a1d486d..cec1865 100644 --- a/roles/git/molecule/default/molecule.yml +++ b/roles/git/molecule/default/molecule.yml @@ -9,6 +9,7 @@ dependency: lint: | set -e yamllint . + ansible-lint driver: name: docker platforms: diff --git a/roles/git/requirements 2.yml b/roles/git/requirements 2.yml deleted file mode 100644 index 46dec9d..0000000 --- a/roles/git/requirements 2.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- robertdebock.bootstrap diff --git a/roles/git/requirements.yml b/roles/git/requirements.yml index 46dec9d..11e3224 100644 --- a/roles/git/requirements.yml +++ b/roles/git/requirements.yml @@ -1,2 +1,3 @@ --- -- robertdebock.bootstrap +roles: + - name: robertdebock.bootstrap diff --git a/roles/git/tasks/assert.yml b/roles/git/tasks/assert.yml index a14bbad..3691663 100644 --- a/roles/git/tasks/assert.yml +++ b/roles/git/tasks/assert.yml @@ -1,66 +1,34 @@ --- -- name: test if git_username is set correctly - assert: - that: - - git_username | length > 0 - quiet: yes - when: - - git_username is defined - -- name: test if git_groupname is set correctly - assert: - that: - - git_groupname | length > 0 - quiet: yes - when: - - git_groupname is defined - -- name: test if git_user_email is set correctly - assert: - that: - - git_user_email | length > 0 - quiet: yes - when: - - git_user_email is defined - -- name: test if git_user_name is set correctly - assert: - that: - - git_user_name | length > 0 - quiet: yes - when: - - git_user_name is defined - name: test if git_repository_destination is set correctly - assert: + ansible.builtin.assert: that: - git_repository_destination is defined - - git_repository_destination | length > 0 + - git_repository_destination is string quiet: yes - name: test if git_force is set correctly - assert: + ansible.builtin.assert: that: - git_force is defined - - git_force | type_debug == "bool" + - git_force is boolean quiet: yes - name: test if git_repositories is set correctly - assert: + ansible.builtin.assert: that: - - git_repositories | length > 0 - git_repositories is iterable quiet: yes when: - git_repositories is defined - name: test if item in git_repositories is set correctly - assert: + ansible.builtin.assert: that: - item.repo is defined - - item.repo | length > 0 + - item.repo is string - item.dest is defined - - item.dest | length > 0 + - item.dest is string quiet: yes loop: "{{ git_repositories }}" loop_control: @@ -68,19 +36,10 @@ when: - git_repositories is defined -- name: test if item in git_repositories with version is set correctly - assert: - that: - - item.version | length > 0 - quiet: yes - when: - - git_repositories is defined - - item.version is defined - - name: test if item in git_repositories with force is set correctly - assert: + ansible.builtin.assert: that: - - item.version | type_debug == "bool" + - item.version is boolean quiet: yes when: - git_repositories is defined diff --git a/roles/git/tasks/main.yml b/roles/git/tasks/main.yml index 0437340..b0bc5b4 100644 --- a/roles/git/tasks/main.yml +++ b/roles/git/tasks/main.yml @@ -1,15 +1,18 @@ --- # tasks file for git + - name: include assert.yml - include_tasks: assert.yml + import_tasks: assert.yml + run_once: yes + delegate_to: localhost - name: install git - package: + ansible.builtin.package: name: "{{ git_packages }}" state: present - name: see if the specified user exists - getent: + ansible.builtin.getent: database: passwd key: "{{ git_username }}" fail_key: no @@ -17,7 +20,7 @@ - git_username is defined - name: create directory for git configuration - file: + ansible.builtin.file: path: /home/{{ git_username }} state: directory owner: "{{ git_username | default(omit) }}" @@ -28,7 +31,7 @@ - getent_passwd[git_username] != none - name: place git configuration - template: + ansible.builtin.template: src: gitconfig.j2 dest: /home/{{ git_username }}/.gitconfig mode: "0644" @@ -39,7 +42,7 @@ - getent_passwd[git_username] != none - name: create repository_destination - file: + ansible.builtin.file: path: "{{ git_repository_destination }}" state: directory owner: "{{ git_username | default(omit) }}" @@ -51,7 +54,7 @@ - getent_passwd[git_username] != none - name: clone all roles - git: + ansible.builtin.git: repo: "{{ item.repo }}" dest: "{{ git_repository_destination }}/{{ item.dest }}" accept_hostkey: yes diff --git a/roles/git/templates 2/gitconfig.j2 b/roles/git/templates 2/gitconfig.j2 deleted file mode 100644 index 49567af..0000000 --- a/roles/git/templates 2/gitconfig.j2 +++ /dev/null @@ -1,3 +0,0 @@ -[user] - email = {{ git_user_email }} - name = {{ git_user_name }} diff --git a/roles/git/templates/gitconfig.j2 b/roles/git/templates/gitconfig.j2 index 49567af..b20a6e9 100644 --- a/roles/git/templates/gitconfig.j2 +++ b/roles/git/templates/gitconfig.j2 @@ -1,3 +1,5 @@ +{{ ansible_managed | comment }} + [user] email = {{ git_user_email }} name = {{ git_user_name }} diff --git a/roles/git/tox.ini b/roles/git/tox.ini index c1bc1d4..f57553b 100644 --- a/roles/git/tox.ini +++ b/roles/git/tox.ini @@ -2,25 +2,25 @@ # Ansible managed # [tox] -minversion = 3.7 -# Disabled "next" because of: -# https://github.com/ansible-community/molecule/issues/2626. -# envlist = py{38}-ansible-{previous,current,next} -envlist = py{38}-ansible-{previous,current} +minversion = 3.21.4 +# 2.11 has been disabled: couldn't resolve module/action 'docker_container'. +envlist = py{39}-ansible-{2.9,2.10} + skipsdist = true [testenv] deps = - previous: ansible>=2.8, <2.9 - current: ansible>=2.9 - next: git+https://github.com/ansible/ansible.git@devel - molecule[lint]>=3, <4 - docker>=4.2, <4.3 + 2.9: ansible == 2.9.* + 2.10: ansible == 2.10.* + 2.11: git+https://github.com/ansible/ansible.git@devel + molecule[docker] + docker == 4.* + ansible-lint == 5.* commands = molecule test setenv = TOX_ENVNAME={envname} - MOLECULE_EPHEMERAL_DIRECTORY=/tmp/.molecule/{env:image:fedora}-{env:tag:latest}/{envname} PY_COLORS=1 ANSIBLE_FORCE_COLOR=1 + ANSIBLE_ROLES_PATH=../ passenv = namespace image tag diff --git a/roles/git/vars 2/main.yml b/roles/git/vars 2/main.yml deleted file mode 100644 index fbc7f01..0000000 --- a/roles/git/vars 2/main.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -# vars file for git - -git_packages: - - git diff --git a/roles/investigate/.ansible-lint b/roles/investigate/.ansible-lint index cb2872e..57f681e 100644 --- a/roles/investigate/.ansible-lint +++ b/roles/investigate/.ansible-lint @@ -3,5 +3,9 @@ # exclude_paths: - ./meta/preferences.yml + - ./molecule/default/prepare.yml + - ./molecule/default/converge.yml - ./molecule/default/verify.yml + - ./molecule/default/collections.yml - ./.tox + - ./.cache diff --git a/roles/investigate/.ansible-lint 2 b/roles/investigate/.ansible-lint 2 deleted file mode 100644 index cb2872e..0000000 --- a/roles/investigate/.ansible-lint 2 +++ /dev/null @@ -1,7 +0,0 @@ -# -# Ansible managed -# -exclude_paths: - - ./meta/preferences.yml - - ./molecule/default/verify.yml - - ./.tox diff --git a/roles/investigate/.github 2/FUNDING.yml b/roles/investigate/.github 2/FUNDING.yml deleted file mode 100644 index 67320f0..0000000 --- a/roles/investigate/.github 2/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -github: robertdebock diff --git a/roles/investigate/.github 2/pull_request_template.md b/roles/investigate/.github 2/pull_request_template.md deleted file mode 100644 index b1578c0..0000000 --- a/roles/investigate/.github 2/pull_request_template.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: Pull request -about: Describe the proposed change - ---- - -**Describe the change** -A clear and concise description of what the pull request is. - -**Testing** -In case a feature was added, how were tests performed? diff --git a/roles/investigate/.github 2/settings.yml b/roles/investigate/.github 2/settings.yml deleted file mode 100644 index 373a9a0..0000000 --- a/roles/investigate/.github 2/settings.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# -# Ansible managed -# -repository: - description: Install and configure investigation tools on your system. - homepage: https://robertdebock.nl/ diff --git a/roles/investigate/.github/settings.yml b/roles/investigate/.github/settings.yml index 373a9a0..4c5860b 100644 --- a/roles/investigate/.github/settings.yml +++ b/roles/investigate/.github/settings.yml @@ -5,3 +5,4 @@ repository: description: Install and configure investigation tools on your system. homepage: https://robertdebock.nl/ + topics: investigate, ansible, molecule, tox, playbook, hacktoberfest diff --git a/roles/investigate/.github/workflows/galaxy.yml b/roles/investigate/.github/workflows/galaxy.yml index 9b30d38..1d36b74 100644 --- a/roles/investigate/.github/workflows/galaxy.yml +++ b/roles/investigate/.github/workflows/galaxy.yml @@ -6,17 +6,13 @@ name: Release to Ansible Galaxy on: - push: - tags: - - '*' - schedule: - - cron: '9 9 9 * *' - + release: + types: [created, edited, published, released] jobs: release: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: galaxy - uses: robertdebock/galaxy-action@1.0.1 + uses: robertdebock/galaxy-action@1.1.0 with: galaxy_api_key: ${{ secrets.galaxy_api_key }} diff --git a/roles/investigate/.github/workflows/molecule.yml b/roles/investigate/.github/workflows/molecule.yml index 293ac94..ca5edfb 100644 --- a/roles/investigate/.github/workflows/molecule.yml +++ b/roles/investigate/.github/workflows/molecule.yml @@ -15,30 +15,28 @@ on: jobs: lint: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: checkout uses: actions/checkout@v2 with: path: "${{ github.repository }}" - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: command: lint test: needs: - lint - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: config: - image: "alpine" tag: "latest" - - image: "alpine" - tag: "edge" - image: "amazonlinux" - tag: "1" + tag: "latest" - image: "centos" tag: "7" - image: "centos" @@ -48,7 +46,7 @@ jobs: - image: "debian" tag: "bullseye" - image: "fedora" - tag: "31" + tag: "32" - image: "fedora" tag: "latest" - image: "opensuse" @@ -57,8 +55,6 @@ jobs: tag: "latest" - image: "ubuntu" tag: "bionic" - - image: "ubuntu" - tag: "xenial" steps: - name: checkout uses: actions/checkout@v2 @@ -69,10 +65,7 @@ jobs: - name: parse apparmor for mysql run: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: image: ${{ matrix.config.image }} tag: ${{ matrix.config.tag }} - options: "--parallel all" - env: - TOX_PARALLEL_NO_SPINNER: 1 diff --git a/roles/investigate/.gitignore b/roles/investigate/.gitignore index 982db11..c15d16a 100644 --- a/roles/investigate/.gitignore +++ b/roles/investigate/.gitignore @@ -2,3 +2,4 @@ *.log *.swp .tox +.cache diff --git a/roles/investigate/.gitignore 2 b/roles/investigate/.gitignore 2 deleted file mode 100644 index 982db11..0000000 --- a/roles/investigate/.gitignore 2 +++ /dev/null @@ -1,4 +0,0 @@ -.molecule -*.log -*.swp -.tox diff --git a/roles/investigate/.travis.yml b/roles/investigate/.travis.yml index 6554c75..21201e1 100644 --- a/roles/investigate/.travis.yml +++ b/roles/investigate/.travis.yml @@ -8,43 +8,23 @@ os: linux dist: xenial python: - - "3.8" + - "3.9" services: - docker -env: - global: - namespace="robertdebock" - jobs: - - image="alpine" tag="latest" - - image="alpine" tag="edge" - - image="amazonlinux" tag="1" - - image="centos" tag="7" - - image="centos" tag="latest" - - image="debian" tag="latest" - - image="debian" tag="bullseye" - - image="fedora" tag="31" - - image="fedora" tag="latest" - - image="opensuse" tag="latest" - - image="ubuntu" tag="latest" - - image="ubuntu" tag="bionic" - - image="ubuntu" tag="xenial" - cache: - pip install: - pip install --upgrade pip - - pip install tox + - pip install yamllint + - pip install ansible-lint script: - - function retry { counter=0 ; until "$@" ; do exit=$? ; counter=$(($counter + 1)) ; if [ $counter -ge 3 ] ; then return $exit ; fi ; done ; return 0; } ; retry tox --parallel all + - yamllint . + - ansible-lint notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ - slack: - secure: "O+jAXGCoFcm3dX+w+Pydzo7kw6dg/o0P7kUoApUQ/QS7rskGXfkvrLaMV1TC1AWsct/OwDIwk2Fsm4BptgsYosJHrDNThhkgJGMcenEEsjpx4wUV8YC8AtI/m0h2THLtEtKL2SUAmGelbwWk6AV/3q+EZf8kTgZLBiD+SStFnMX/7mutEVLjDCuqbI4/lM2VHyUMeXdWg6Ymo0XsXXmGVpbnD7iBOj0e4ttaMGDC0omWx21uNwIgdx761I7KmPET35TM+kmlEYGVqLhF4P66HteHZxynFudmAbDBK6NJeYhiBL3lHn9tp3mB/vtyd2Nk2hXsdFW0ntKc1f5MBkahaXVltmI/NhTAtNkgi4DQm7DNlDhZBwBfWq9onON8SMjVkIAulf4ApQmAGKJramjsYUvL1atmq7AQQsZVlAcVUsB/XkAzigx7E7py3kXYF8iO7Pi0d62bMhOxdu9K6TNVQzx8m5S+ye0HlldSffdyleBRjWUhNy1hNaf40TDrBBash0RS3wWr0EBVtzzLJlryoaJCmqQbdt2YBreQ6HE6mCeEDR8wQRcBbDeFogYUnyIoO/iViiz4wSPIghyTKATOssI8+8IgtR3wERfz9v+dIaUQpFeBjqN0m1ThKB9gVTGztLKXY9CpzqZVq2Mnbz77fUuNI8fwGi9ijbyN6YCogOo=" - on_success: change - template: "%{result}: %{repository_slug}@%{branch}, build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}>)" email: false diff --git a/roles/investigate/.yamllint b/roles/investigate/.yamllint index 894450c..a7ff098 100644 --- a/roles/investigate/.yamllint +++ b/roles/investigate/.yamllint @@ -13,3 +13,4 @@ rules: ignore: | .tox/ + .cache/ diff --git a/roles/investigate/LICENSE b/roles/investigate/LICENSE index bd15893..e770af8 100644 --- a/roles/investigate/LICENSE +++ b/roles/investigate/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 Robert de Bock (robert@meinit.nl) + Copyright 2021 Robert de Bock (robert@meinit.nl) 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/roles/investigate/README.md b/roles/investigate/README.md index c2205a2..4140ce1 100644 --- a/roles/investigate/README.md +++ b/roles/investigate/README.md @@ -2,9 +2,9 @@ Install and configure investigation tools on your system. -|Travis|GitHub|Quality|Downloads|Version| +|GitHub|GitLab|Quality|Downloads|Version| |------|------|-------|---------|-------| -|[![travis](https://travis-ci.com/robertdebock/ansible-role-investigate.svg?branch=master)](https://travis-ci.com/robertdebock/ansible-role-investigate)|[![github](https://github.com/robertdebock/ansible-role-investigate/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-investigate/actions)|[![quality](https://img.shields.io/ansible/quality/35590)](https://galaxy.ansible.com/robertdebock/investigate)|[![downloads](https://img.shields.io/ansible/role/d/35590)](https://galaxy.ansible.com/robertdebock/investigate)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-investigate.svg)](https://github.com/robertdebock/ansible-role-investigate/releases/)| +|[![github](https://github.com/robertdebock/ansible-role-investigate/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-investigate/actions)|[![gitlab](https://gitlab.com/robertdebock/ansible-role-investigate/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-investigate)|[![quality](https://img.shields.io/ansible/quality/35590)](https://galaxy.ansible.com/robertdebock/investigate)|[![downloads](https://img.shields.io/ansible/role/d/35590)](https://galaxy.ansible.com/robertdebock/investigate)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-investigate.svg)](https://github.com/robertdebock/ansible-role-investigate/releases/)| ## [Example Playbook](#example-playbook) @@ -20,7 +20,7 @@ This example is taken from `molecule/resources/converge.yml` and is tested on ea - role: robertdebock.investigate ``` -The machine may need to be prepared using `molecule/resources/prepare.yml`: +The machine needs to be prepared in CI this is done using `molecule/resources/prepare.yml`: ```yaml --- - name: Prepare @@ -33,42 +33,28 @@ The machine may need to be prepared using `molecule/resources/prepare.yml`: - role: robertdebock.epel ``` -For verification `molecule/resources/verify.yml` runs after the role has been applied. -```yaml ---- -- name: Verify - hosts: all - become: yes - gather_facts: no - - tasks: - - name: check if connection still works - ping: -``` - Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles. ## [Requirements](#requirements) -- Access to a repository containing packages, likely on the internet. -- A recent version of Ansible. (Tests run on the current, previous and next release of Ansible.) +- pip packages listed in [requirements.txt](https://github.com/robertdebock/ansible-role-investigate/blob/master/requirements.txt). -The following roles can be installed to ensure all requirements are met, using `ansible-galaxy install -r requirements.yml`: +## [Status of requirements](#status-of-requirements) -```yaml ---- -- robertdebock.bootstrap -- robertdebock.epel +The following roles are used to prepare a system. You may choose to prepare your system in another way, I have tested these roles as well. -``` +| Requirement | GitHub | GitLab | +|-------------|--------|--------| +| [robertdebock.bootstrap](https://galaxy.ansible.com/robertdebock/bootstrap) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-bootstrap/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-bootstrap/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-bootstrap/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-bootstrap) +| [robertdebock.epel](https://galaxy.ansible.com/robertdebock/epel) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-epel/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-epel/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-epel/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-epel) ## [Context](#context) This role is a part of many compatible roles. Have a look at [the documentation of these roles](https://robertdebock.nl/) for further information. Here is an overview of related roles: -![dependencies](https://raw.githubusercontent.com/robertdebock/drawings/artifacts/investigate.png "Dependency") +![dependencies](https://raw.githubusercontent.com/robertdebock/ansible-role-investigate/png/requirements.png "Dependencies") ## [Compatibility](#compatibility) @@ -77,55 +63,23 @@ This role has been tested on these [container images](https://hub.docker.com/u/r |container|tags| |---------|----| |alpine|all| -|amazon|2018.03| +|amazon|Candidate| |el|7, 8| |debian|buster, bullseye| -|fedora|31, 32| +|fedora|all| |opensuse|all| -|ubuntu|focal, bionic, xenial| +|ubuntu|focal, bionic| -The minimum version of Ansible required is 2.8 but tests have been done to: +The minimum version of Ansible required is 2.10, tests have been done to: -- The previous version, on version lower. +- The previous version. - The current version. - The development version. -## [Testing](#testing) - -[Unit tests](https://travis-ci.com/robertdebock/ansible-role-investigate) are done on every commit, pull request, release and periodically. - If you find issues, please register them in [GitHub](https://github.com/robertdebock/ansible-role-investigate/issues) -Testing is done using [Tox](https://tox.readthedocs.io/en/latest/) and [Molecule](https://github.com/ansible/molecule): - -[Tox](https://tox.readthedocs.io/en/latest/) tests multiple ansible versions. -[Molecule](https://github.com/ansible/molecule) tests multiple distributions. - -To test using the defaults (any installed ansible version, namespace: `robertdebock`, image: `fedora`, tag: `latest`): - -``` -molecule test - -# Or select a specific image: -image=ubuntu molecule test -# Or select a specific image and a specific tag: -image="debian" tag="stable" tox -``` - -Or you can test multiple versions of Ansible, and select images: -Tox allows multiple versions of Ansible to be tested. To run the default (namespace: `robertdebock`, image: `fedora`, tag: `latest`) tests: - -``` -tox - -# To run CentOS (namespace: `robertdebock`, tag: `latest`) -image="centos" tox -# Or customize more: -image="debian" tag="stable" tox -``` - ## [License](#license) Apache-2.0 diff --git a/roles/investigate/meta 2/.galaxy_install_info b/roles/investigate/meta 2/.galaxy_install_info deleted file mode 100644 index f75c12d..0000000 --- a/roles/investigate/meta 2/.galaxy_install_info +++ /dev/null @@ -1,2 +0,0 @@ -install_date: Mon Sep 28 13:22:23 2020 -version: 2.3.4 diff --git a/roles/investigate/meta 2/preferences.yml b/roles/investigate/meta 2/preferences.yml deleted file mode 100644 index e7fdebf..0000000 --- a/roles/investigate/meta 2/preferences.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -tox_parallel: yes diff --git a/roles/investigate/meta/.galaxy_install_info b/roles/investigate/meta/.galaxy_install_info index f75c12d..6f42f06 100644 --- a/roles/investigate/meta/.galaxy_install_info +++ b/roles/investigate/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Mon Sep 28 13:22:23 2020 -version: 2.3.4 +install_date: Sun Mar 21 06:59:43 2021 +version: 3.0.1 diff --git a/roles/investigate/meta/main.yml b/roles/investigate/meta/main.yml index 8024993..79fcf70 100644 --- a/roles/investigate/meta/main.yml +++ b/roles/investigate/meta/main.yml @@ -5,7 +5,7 @@ galaxy_info: description: Install and configure investigation tools on your system. license: Apache-2.0 company: none - min_ansible_version: 2.8 + min_ansible_version: "2.10" platforms: - name: Alpine @@ -13,7 +13,7 @@ galaxy_info: - all - name: Amazon versions: - - 2018.03 + - Candidate - name: EL versions: - 7 @@ -24,8 +24,7 @@ galaxy_info: - bullseye - name: Fedora versions: - - 31 - - 32 + - all - name: OpenSUSE versions: - all @@ -33,10 +32,8 @@ galaxy_info: versions: - focal - bionic - - xenial galaxy_tags: - investigate - - centos dependencies: [] diff --git a/roles/investigate/molecule/default/molecule.yml b/roles/investigate/molecule/default/molecule.yml index 92acbce..7f19236 100644 --- a/roles/investigate/molecule/default/molecule.yml +++ b/roles/investigate/molecule/default/molecule.yml @@ -9,6 +9,7 @@ dependency: lint: | set -e yamllint . + ansible-lint driver: name: docker platforms: diff --git a/roles/investigate/requirements 2.yml b/roles/investigate/requirements 2.yml deleted file mode 100644 index cecd945..0000000 --- a/roles/investigate/requirements 2.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- robertdebock.bootstrap -- robertdebock.epel diff --git a/roles/investigate/requirements.yml b/roles/investigate/requirements.yml index cecd945..fc519c4 100644 --- a/roles/investigate/requirements.yml +++ b/roles/investigate/requirements.yml @@ -1,3 +1,4 @@ --- -- robertdebock.bootstrap -- robertdebock.epel +roles: + - name: robertdebock.bootstrap + - name: robertdebock.epel diff --git a/roles/investigate/tasks/main.yml b/roles/investigate/tasks/main.yml index 632aed7..447c092 100644 --- a/roles/investigate/tasks/main.yml +++ b/roles/investigate/tasks/main.yml @@ -1,6 +1,7 @@ --- # tasks file for investigate + - name: install investigation tools - package: + ansible.builtin.package: name: "{{ investigate_packages }}" state: present diff --git a/roles/investigate/tox.ini b/roles/investigate/tox.ini index c1bc1d4..f57553b 100644 --- a/roles/investigate/tox.ini +++ b/roles/investigate/tox.ini @@ -2,25 +2,25 @@ # Ansible managed # [tox] -minversion = 3.7 -# Disabled "next" because of: -# https://github.com/ansible-community/molecule/issues/2626. -# envlist = py{38}-ansible-{previous,current,next} -envlist = py{38}-ansible-{previous,current} +minversion = 3.21.4 +# 2.11 has been disabled: couldn't resolve module/action 'docker_container'. +envlist = py{39}-ansible-{2.9,2.10} + skipsdist = true [testenv] deps = - previous: ansible>=2.8, <2.9 - current: ansible>=2.9 - next: git+https://github.com/ansible/ansible.git@devel - molecule[lint]>=3, <4 - docker>=4.2, <4.3 + 2.9: ansible == 2.9.* + 2.10: ansible == 2.10.* + 2.11: git+https://github.com/ansible/ansible.git@devel + molecule[docker] + docker == 4.* + ansible-lint == 5.* commands = molecule test setenv = TOX_ENVNAME={envname} - MOLECULE_EPHEMERAL_DIRECTORY=/tmp/.molecule/{env:image:fedora}-{env:tag:latest}/{envname} PY_COLORS=1 ANSIBLE_FORCE_COLOR=1 + ANSIBLE_ROLES_PATH=../ passenv = namespace image tag diff --git a/roles/molecule/.ansible-lint b/roles/molecule/.ansible-lint index eba57d1..7a17121 100644 --- a/roles/molecule/.ansible-lint +++ b/roles/molecule/.ansible-lint @@ -4,5 +4,9 @@ exclude_paths: - ./meta/exception.yml - ./meta/preferences.yml + - ./molecule/default/prepare.yml + - ./molecule/default/converge.yml - ./molecule/default/verify.yml + - ./molecule/default/collections.yml - ./.tox + - ./.cache diff --git a/roles/molecule/.github 2/FUNDING.yml b/roles/molecule/.github 2/FUNDING.yml deleted file mode 100644 index 67320f0..0000000 --- a/roles/molecule/.github 2/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -github: robertdebock diff --git a/roles/molecule/.github 2/pull_request_template.md b/roles/molecule/.github 2/pull_request_template.md deleted file mode 100644 index b1578c0..0000000 --- a/roles/molecule/.github 2/pull_request_template.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: Pull request -about: Describe the proposed change - ---- - -**Describe the change** -A clear and concise description of what the pull request is. - -**Testing** -In case a feature was added, how were tests performed? diff --git a/roles/molecule/.github 2/settings.yml b/roles/molecule/.github 2/settings.yml deleted file mode 100644 index c7caec3..0000000 --- a/roles/molecule/.github 2/settings.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# -# Ansible managed -# -repository: - description: Install Molecule on your system. - homepage: https://robertdebock.nl/ diff --git a/roles/molecule/.github/settings.yml b/roles/molecule/.github/settings.yml index c7caec3..0e5d554 100644 --- a/roles/molecule/.github/settings.yml +++ b/roles/molecule/.github/settings.yml @@ -5,3 +5,4 @@ repository: description: Install Molecule on your system. homepage: https://robertdebock.nl/ + topics: molecule, ansible, molecule, tox, playbook, hacktoberfest diff --git a/roles/molecule/.github/workflows/galaxy.yml b/roles/molecule/.github/workflows/galaxy.yml index 28dbf05..1d36b74 100644 --- a/roles/molecule/.github/workflows/galaxy.yml +++ b/roles/molecule/.github/workflows/galaxy.yml @@ -6,17 +6,13 @@ name: Release to Ansible Galaxy on: - push: - tags: - - '*' - schedule: - - cron: '13 13 13 * *' - + release: + types: [created, edited, published, released] jobs: release: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: galaxy - uses: robertdebock/galaxy-action@1.0.1 + uses: robertdebock/galaxy-action@1.1.0 with: galaxy_api_key: ${{ secrets.galaxy_api_key }} diff --git a/roles/molecule/.github/workflows/molecule.yml b/roles/molecule/.github/workflows/molecule.yml index 6e2539b..c8d6596 100644 --- a/roles/molecule/.github/workflows/molecule.yml +++ b/roles/molecule/.github/workflows/molecule.yml @@ -15,28 +15,24 @@ on: jobs: lint: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: checkout uses: actions/checkout@v2 with: path: "${{ github.repository }}" - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: command: lint test: needs: - lint - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: config: - - image: "alpine" - tag: "latest" - - image: "alpine" - tag: "edge" - image: "centos" tag: "latest" - image: "debian" @@ -44,7 +40,7 @@ jobs: - image: "debian" tag: "bullseye" - image: "fedora" - tag: "31" + tag: "32" - image: "fedora" tag: "latest" - image: "ubuntu" @@ -59,10 +55,7 @@ jobs: - name: parse apparmor for mysql run: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: image: ${{ matrix.config.image }} tag: ${{ matrix.config.tag }} - options: "--parallel all" - env: - TOX_PARALLEL_NO_SPINNER: 1 diff --git a/roles/molecule/.gitignore b/roles/molecule/.gitignore index 982db11..c15d16a 100644 --- a/roles/molecule/.gitignore +++ b/roles/molecule/.gitignore @@ -2,3 +2,4 @@ *.log *.swp .tox +.cache diff --git a/roles/molecule/.gitignore 2 b/roles/molecule/.gitignore 2 deleted file mode 100644 index 982db11..0000000 --- a/roles/molecule/.gitignore 2 +++ /dev/null @@ -1,4 +0,0 @@ -.molecule -*.log -*.swp -.tox diff --git a/roles/molecule/.travis.yml b/roles/molecule/.travis.yml index 27efa49..21201e1 100644 --- a/roles/molecule/.travis.yml +++ b/roles/molecule/.travis.yml @@ -8,38 +8,23 @@ os: linux dist: xenial python: - - "3.8" + - "3.9" services: - docker -env: - global: - namespace="robertdebock" - jobs: - - image="alpine" tag="latest" - - image="alpine" tag="edge" - - image="centos" tag="latest" - - image="debian" tag="latest" - - image="debian" tag="bullseye" - - image="fedora" tag="31" - - image="fedora" tag="latest" - - image="ubuntu" tag="latest" - cache: - pip install: - pip install --upgrade pip - - pip install tox + - pip install yamllint + - pip install ansible-lint script: - - function retry { counter=0 ; until "$@" ; do exit=$? ; counter=$(($counter + 1)) ; if [ $counter -ge 3 ] ; then return $exit ; fi ; done ; return 0; } ; retry tox --parallel all + - yamllint . + - ansible-lint notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ - slack: - secure: "Ts8B1BCjhczQMFq7kXpLn13HfMEYQSH9gIF1yy5U8k9lqqRBLlRpUIIJITsYYEAAnOERwV/BD/UKV3Qy3/7fFsDjQuuxeIqpn3Dc2Lxyz7IGTTcPJ2FDUmYpvkY8dTKT01gGDmqZgZEI94bnThypKm5zpvxb43PyqEOyyrO9uNHc4UZlGCoDwCynZKV9BMGlrsLjHV8gYP1EoJKAMUlwdRNYf1eFyhC80ZvY2Xj2qVXxDs9Zrr/fI6prfPp8HCoWJVA2IwMqZk5bnCneU2a6+fR0ArCw99rMcpe4mnre3RCKCOhg2o2rNtqN0GBHcOLFgNJx+n1tcyPn/apmgVfyTDcRIDA31u5itEtc7rLKrOUsiQHbPahgrE8yrSaHSroPc3FWCwm29rWVp4OnTbu0izfjiSTUAEsXMPHQ5yEzlzjYYD3+7HHGHsy6mRjBEknIYAeVje9S+WG8CaoxJt/E/QbDn5s0MSnd0ixzZ8rX9QwwG8xf+yXtkNxcsUWWooOpt++pqQLWUM5wqg4p1YtkBoXfWRxoG954ZiSjpI1V1FMaiBVMM2NZkQydsF+1C596P3z+oXMg5t3ZP40VVDYM2CRLNBGVNtV/db03iXULoj7BYiEttwf4RMa1dtvpz60gggE/ywF9Gzr/yOWvajr32fqhvDoDUsfhrNQgVhi3hq8=" - on_success: change - template: "%{result}: %{repository_slug}@%{branch}, build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}>)" email: false diff --git a/roles/molecule/.yamllint b/roles/molecule/.yamllint index 894450c..a7ff098 100644 --- a/roles/molecule/.yamllint +++ b/roles/molecule/.yamllint @@ -13,3 +13,4 @@ rules: ignore: | .tox/ + .cache/ diff --git a/roles/molecule/LICENSE b/roles/molecule/LICENSE index bd15893..e770af8 100644 --- a/roles/molecule/LICENSE +++ b/roles/molecule/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 Robert de Bock (robert@meinit.nl) + Copyright 2021 Robert de Bock (robert@meinit.nl) 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/roles/molecule/README.md b/roles/molecule/README.md index 1af5cbd..79a7efa 100644 --- a/roles/molecule/README.md +++ b/roles/molecule/README.md @@ -2,9 +2,9 @@ Install Molecule on your system. -|Travis|GitHub|Quality|Downloads|Version| +|GitHub|GitLab|Quality|Downloads|Version| |------|------|-------|---------|-------| -|[![travis](https://travis-ci.com/robertdebock/ansible-role-molecule.svg?branch=master)](https://travis-ci.com/robertdebock/ansible-role-molecule)|[![github](https://github.com/robertdebock/ansible-role-molecule/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-molecule/actions)|[![quality](https://img.shields.io/ansible/quality/35945)](https://galaxy.ansible.com/robertdebock/molecule)|[![downloads](https://img.shields.io/ansible/role/d/35945)](https://galaxy.ansible.com/robertdebock/molecule)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-molecule.svg)](https://github.com/robertdebock/ansible-role-molecule/releases/)| +|[![github](https://github.com/robertdebock/ansible-role-molecule/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-molecule/actions)|[![gitlab](https://gitlab.com/robertdebock/ansible-role-molecule/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-molecule)|[![quality](https://img.shields.io/ansible/quality/35945)](https://galaxy.ansible.com/robertdebock/molecule)|[![downloads](https://img.shields.io/ansible/role/d/35945)](https://galaxy.ansible.com/robertdebock/molecule)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-molecule.svg)](https://github.com/robertdebock/ansible-role-molecule/releases/)| ## [Example Playbook](#example-playbook) @@ -20,7 +20,7 @@ This example is taken from `molecule/resources/converge.yml` and is tested on ea - role: robertdebock.molecule ``` -The machine may need to be prepared using `molecule/resources/prepare.yml`: +The machine needs to be prepared in CI this is done using `molecule/resources/prepare.yml`: ```yaml --- - name: Prepare @@ -35,19 +35,6 @@ The machine may need to be prepared using `molecule/resources/prepare.yml`: - role: robertdebock.python_pip ``` -For verification `molecule/resources/verify.yml` runs after the role has been applied. -```yaml ---- -- name: Verify - hosts: all - become: yes - gather_facts: no - - tasks: - - name: check if connection still works - ping: -``` - Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles. ## [Role Variables](#role-variables) @@ -64,26 +51,25 @@ These variables are set in `defaults/main.yml`: ## [Requirements](#requirements) -- Access to a repository containing packages, likely on the internet. -- A recent version of Ansible. (Tests run on the current, previous and next release of Ansible.) +- pip packages listed in [requirements.txt](https://github.com/robertdebock/ansible-role-molecule/blob/master/requirements.txt). -The following roles can be installed to ensure all requirements are met, using `ansible-galaxy install -r requirements.yml`: +## [Status of requirements](#status-of-requirements) -```yaml ---- -- robertdebock.bootstrap -- robertdebock.buildtools -- robertdebock.epel -- robertdebock.python_pip +The following roles are used to prepare a system. You may choose to prepare your system in another way, I have tested these roles as well. -``` +| Requirement | GitHub | GitLab | +|-------------|--------|--------| +| [robertdebock.bootstrap](https://galaxy.ansible.com/robertdebock/bootstrap) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-bootstrap/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-bootstrap/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-bootstrap/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-bootstrap) +| [robertdebock.buildtools](https://galaxy.ansible.com/robertdebock/buildtools) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-buildtools/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-buildtools/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-buildtools/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-buildtools) +| [robertdebock.epel](https://galaxy.ansible.com/robertdebock/epel) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-epel/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-epel/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-epel/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-epel) +| [robertdebock.python_pip](https://galaxy.ansible.com/robertdebock/python_pip) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-python_pip/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-python_pip/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-python_pip/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-python_pip) ## [Context](#context) This role is a part of many compatible roles. Have a look at [the documentation of these roles](https://robertdebock.nl/) for further information. Here is an overview of related roles: -![dependencies](https://raw.githubusercontent.com/robertdebock/drawings/artifacts/molecule.png "Dependency") +![dependencies](https://raw.githubusercontent.com/robertdebock/ansible-role-molecule/png/requirements.png "Dependencies") ## [Compatibility](#compatibility) @@ -91,15 +77,14 @@ This role has been tested on these [container images](https://hub.docker.com/u/r |container|tags| |---------|----| -|alpine|all| |el|8| |debian|buster, bullseye| -|fedora|31, 32| +|fedora|all| |ubuntu|focal| -The minimum version of Ansible required is 2.8 but tests have been done to: +The minimum version of Ansible required is 2.10, tests have been done to: -- The previous version, on version lower. +- The previous version. - The current version. - The development version. @@ -109,45 +94,14 @@ Some variarations of the build matrix do not work. These are the variations and | variation | reason | |---------------------------|------------------------| -| CentOS 7 | error in click-completion setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers | +| centos:7 | install_requires' must be a string or list of strings containing valid project/version requirement specifiers | | amazonlinux | Dependency (python_pip) not available | | opensuse | UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13: ordinal not in range(128) | +| alpine | error: [Errno 2] No such file or directory: 'cargo' | -## [Testing](#testing) - -[Unit tests](https://travis-ci.com/robertdebock/ansible-role-molecule) are done on every commit, pull request, release and periodically. - If you find issues, please register them in [GitHub](https://github.com/robertdebock/ansible-role-molecule/issues) -Testing is done using [Tox](https://tox.readthedocs.io/en/latest/) and [Molecule](https://github.com/ansible/molecule): - -[Tox](https://tox.readthedocs.io/en/latest/) tests multiple ansible versions. -[Molecule](https://github.com/ansible/molecule) tests multiple distributions. - -To test using the defaults (any installed ansible version, namespace: `robertdebock`, image: `fedora`, tag: `latest`): - -``` -molecule test - -# Or select a specific image: -image=ubuntu molecule test -# Or select a specific image and a specific tag: -image="debian" tag="stable" tox -``` - -Or you can test multiple versions of Ansible, and select images: -Tox allows multiple versions of Ansible to be tested. To run the default (namespace: `robertdebock`, image: `fedora`, tag: `latest`) tests: - -``` -tox - -# To run CentOS (namespace: `robertdebock`, tag: `latest`) -image="centos" tox -# Or customize more: -image="debian" tag="stable" tox -``` - ## [License](#license) Apache-2.0 diff --git a/roles/molecule/meta 2/.galaxy_install_info b/roles/molecule/meta 2/.galaxy_install_info deleted file mode 100644 index 05147fc..0000000 --- a/roles/molecule/meta 2/.galaxy_install_info +++ /dev/null @@ -1,2 +0,0 @@ -install_date: Mon Sep 28 13:22:25 2020 -version: 2.3.1 diff --git a/roles/molecule/meta 2/preferences.yml b/roles/molecule/meta 2/preferences.yml deleted file mode 100644 index e7fdebf..0000000 --- a/roles/molecule/meta 2/preferences.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -tox_parallel: yes diff --git a/roles/molecule/meta/.galaxy_install_info b/roles/molecule/meta/.galaxy_install_info index 05147fc..797f44c 100644 --- a/roles/molecule/meta/.galaxy_install_info +++ b/roles/molecule/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Mon Sep 28 13:22:25 2020 -version: 2.3.1 +install_date: Sun Mar 21 06:59:45 2021 +version: 3.0.0 diff --git a/roles/molecule/meta/exception.yml b/roles/molecule/meta/exception.yml index f51abd1..1157580 100644 --- a/roles/molecule/meta/exception.yml +++ b/roles/molecule/meta/exception.yml @@ -1,8 +1,10 @@ --- exceptions: - - variation: CentOS 7 - reason: "error in click-completion setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers" + - variation: centos:7 + reason: "install_requires' must be a string or list of strings containing valid project/version requirement specifiers" - variation: amazonlinux reason: Dependency (python_pip) not available - variation: opensuse reason: "UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13: ordinal not in range(128)" + - variation: alpine + reason: "error: [Errno 2] No such file or directory: 'cargo'" diff --git a/roles/molecule/meta/main.yml b/roles/molecule/meta/main.yml index 982543d..5ee6dd7 100644 --- a/roles/molecule/meta/main.yml +++ b/roles/molecule/meta/main.yml @@ -5,12 +5,9 @@ galaxy_info: description: Install Molecule on your system. license: Apache-2.0 company: none - min_ansible_version: 2.8 + min_ansible_version: "2.10" platforms: - - name: Alpine - versions: - - all - name: EL versions: - 8 @@ -20,14 +17,12 @@ galaxy_info: - bullseye - name: Fedora versions: - - 31 - - 32 + - all - name: Ubuntu versions: - focal galaxy_tags: - molecule - - centos dependencies: [] diff --git a/roles/molecule/molecule 2/default/converge.yml b/roles/molecule/molecule 2/default/converge.yml deleted file mode 100644 index f62959c..0000000 --- a/roles/molecule/molecule 2/default/converge.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Converge - hosts: all - become: yes - gather_facts: yes - - roles: - - role: ansible-role-molecule diff --git a/roles/molecule/molecule 2/default/prepare.yml b/roles/molecule/molecule 2/default/prepare.yml deleted file mode 100644 index a44724a..0000000 --- a/roles/molecule/molecule 2/default/prepare.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -- name: Prepare - hosts: all - gather_facts: no - become: yes - - roles: - - role: robertdebock.bootstrap - - role: robertdebock.buildtools - - role: robertdebock.epel - - role: robertdebock.python_pip diff --git a/roles/molecule/molecule 2/default/verify.yml b/roles/molecule/molecule 2/default/verify.yml deleted file mode 100644 index b9dc6f8..0000000 --- a/roles/molecule/molecule 2/default/verify.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -- name: Verify - hosts: all - become: yes - gather_facts: no - - tasks: - - name: check if connection still works - ping: diff --git a/roles/molecule/molecule/default/molecule.yml b/roles/molecule/molecule/default/molecule.yml index 2a8a642..1b31a88 100644 --- a/roles/molecule/molecule/default/molecule.yml +++ b/roles/molecule/molecule/default/molecule.yml @@ -9,6 +9,7 @@ dependency: lint: | set -e yamllint . + ansible-lint driver: name: docker platforms: diff --git a/roles/molecule/requirements 2.yml b/roles/molecule/requirements 2.yml deleted file mode 100644 index 2fd552b..0000000 --- a/roles/molecule/requirements 2.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- robertdebock.bootstrap -- robertdebock.buildtools -- robertdebock.epel -- robertdebock.python_pip diff --git a/roles/molecule/requirements.yml b/roles/molecule/requirements.yml index 2fd552b..d7e7d73 100644 --- a/roles/molecule/requirements.yml +++ b/roles/molecule/requirements.yml @@ -1,5 +1,6 @@ --- -- robertdebock.bootstrap -- robertdebock.buildtools -- robertdebock.epel -- robertdebock.python_pip +roles: + - name: robertdebock.bootstrap + - name: robertdebock.buildtools + - name: robertdebock.epel + - name: robertdebock.python_pip diff --git a/roles/molecule/tasks/assert.yml b/roles/molecule/tasks/assert.yml deleted file mode 100644 index 034e0fd..0000000 --- a/roles/molecule/tasks/assert.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: test if molecule_extra_args is set correctly - assert: - that: - - molecule_extra_args | length > 0 - quiet: yes - when: - - molecule_extra_args is defined diff --git a/roles/molecule/tasks/main.yml b/roles/molecule/tasks/main.yml index fd74a34..d9878ac 100644 --- a/roles/molecule/tasks/main.yml +++ b/roles/molecule/tasks/main.yml @@ -1,16 +1,14 @@ --- # tasks file for molecule -- name: include assert.yml - include_tasks: assert.yml - name: install requirements - package: + ansible.builtin.package: name: "{{ molecule_requirements }}" state: present become: yes - name: install molecule - pip: - name: molecule + ansible.builtin.pip: + name: molecule[ansible,docker,lint] state: present extra_args: "{{ molecule_extra_args | default(omit) }}" diff --git a/roles/molecule/tox.ini b/roles/molecule/tox.ini index c1bc1d4..f57553b 100644 --- a/roles/molecule/tox.ini +++ b/roles/molecule/tox.ini @@ -2,25 +2,25 @@ # Ansible managed # [tox] -minversion = 3.7 -# Disabled "next" because of: -# https://github.com/ansible-community/molecule/issues/2626. -# envlist = py{38}-ansible-{previous,current,next} -envlist = py{38}-ansible-{previous,current} +minversion = 3.21.4 +# 2.11 has been disabled: couldn't resolve module/action 'docker_container'. +envlist = py{39}-ansible-{2.9,2.10} + skipsdist = true [testenv] deps = - previous: ansible>=2.8, <2.9 - current: ansible>=2.9 - next: git+https://github.com/ansible/ansible.git@devel - molecule[lint]>=3, <4 - docker>=4.2, <4.3 + 2.9: ansible == 2.9.* + 2.10: ansible == 2.10.* + 2.11: git+https://github.com/ansible/ansible.git@devel + molecule[docker] + docker == 4.* + ansible-lint == 5.* commands = molecule test setenv = TOX_ENVNAME={envname} - MOLECULE_EPHEMERAL_DIRECTORY=/tmp/.molecule/{env:image:fedora}-{env:tag:latest}/{envname} PY_COLORS=1 ANSIBLE_FORCE_COLOR=1 + ANSIBLE_ROLES_PATH=../ passenv = namespace image tag diff --git a/roles/molecule/vars/main.yml b/roles/molecule/vars/main.yml index 90a172e..07d17be 100644 --- a/roles/molecule/vars/main.yml +++ b/roles/molecule/vars/main.yml @@ -5,15 +5,13 @@ _molecule_requirements: default: [] Alpine: - linux-headers - CentOS-7: - - python-devel - - openssl-devel + - rust Debian: - libssl-dev RedHat: - python3-devel - openssl-devel Suse: - - python-devel + - python3-devel -molecule_requirements: "{{ _molecule_requirements[ansible_distribution ~ '-' ~ ansible_distribution_major_version] | default(_molecule_requirements[ansible_os_family] | default(_molecule_requirements['default'])) }}" +molecule_requirements: "{{ _molecule_requirements[ansible_os_family] | default(_molecule_requirements['default']) }}" diff --git a/roles/postfix/.ansible-lint b/roles/postfix/.ansible-lint index eba57d1..7a17121 100644 --- a/roles/postfix/.ansible-lint +++ b/roles/postfix/.ansible-lint @@ -4,5 +4,9 @@ exclude_paths: - ./meta/exception.yml - ./meta/preferences.yml + - ./molecule/default/prepare.yml + - ./molecule/default/converge.yml - ./molecule/default/verify.yml + - ./molecule/default/collections.yml - ./.tox + - ./.cache diff --git a/roles/postfix/.github 2/FUNDING.yml b/roles/postfix/.github 2/FUNDING.yml deleted file mode 100644 index 67320f0..0000000 --- a/roles/postfix/.github 2/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -github: robertdebock diff --git a/roles/postfix/.github 2/pull_request_template.md b/roles/postfix/.github 2/pull_request_template.md deleted file mode 100644 index b1578c0..0000000 --- a/roles/postfix/.github 2/pull_request_template.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: Pull request -about: Describe the proposed change - ---- - -**Describe the change** -A clear and concise description of what the pull request is. - -**Testing** -In case a feature was added, how were tests performed? diff --git a/roles/postfix/.github 2/settings.yml b/roles/postfix/.github 2/settings.yml deleted file mode 100644 index ae4da49..0000000 --- a/roles/postfix/.github 2/settings.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# -# Ansible managed -# -repository: - description: Install and configure postfix on your system. - homepage: https://robertdebock.nl/ diff --git a/roles/postfix/.github/settings.yml b/roles/postfix/.github/settings.yml index ae4da49..dc81d45 100644 --- a/roles/postfix/.github/settings.yml +++ b/roles/postfix/.github/settings.yml @@ -5,3 +5,4 @@ repository: description: Install and configure postfix on your system. homepage: https://robertdebock.nl/ + topics: installer, mailserver, package, postfix, security, system, ansible, molecule, tox, playbook, hacktoberfest diff --git a/roles/postfix/.github/workflows/galaxy.yml b/roles/postfix/.github/workflows/galaxy.yml index cca8501..1d36b74 100644 --- a/roles/postfix/.github/workflows/galaxy.yml +++ b/roles/postfix/.github/workflows/galaxy.yml @@ -6,17 +6,13 @@ name: Release to Ansible Galaxy on: - push: - tags: - - '*' - schedule: - - cron: '16 16 16 * *' - + release: + types: [created, edited, published, released] jobs: release: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: galaxy - uses: robertdebock/galaxy-action@1.0.1 + uses: robertdebock/galaxy-action@1.1.0 with: galaxy_api_key: ${{ secrets.galaxy_api_key }} diff --git a/roles/postfix/.github/workflows/molecule.yml b/roles/postfix/.github/workflows/molecule.yml index 3c0e769..498027d 100644 --- a/roles/postfix/.github/workflows/molecule.yml +++ b/roles/postfix/.github/workflows/molecule.yml @@ -15,20 +15,20 @@ on: jobs: lint: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: checkout uses: actions/checkout@v2 with: path: "${{ github.repository }}" - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: command: lint test: needs: - lint - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: @@ -44,15 +44,13 @@ jobs: - image: "debian" tag: "bullseye" - image: "fedora" - tag: "31" + tag: "32" - image: "fedora" tag: "latest" - image: "ubuntu" tag: "latest" - image: "ubuntu" tag: "bionic" - - image: "ubuntu" - tag: "xenial" steps: - name: checkout uses: actions/checkout@v2 @@ -63,10 +61,7 @@ jobs: - name: parse apparmor for mysql run: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: image: ${{ matrix.config.image }} tag: ${{ matrix.config.tag }} - options: "--parallel all" - env: - TOX_PARALLEL_NO_SPINNER: 1 diff --git a/roles/postfix/.gitignore b/roles/postfix/.gitignore index 982db11..c15d16a 100644 --- a/roles/postfix/.gitignore +++ b/roles/postfix/.gitignore @@ -2,3 +2,4 @@ *.log *.swp .tox +.cache diff --git a/roles/postfix/.gitignore 2 b/roles/postfix/.gitignore 2 deleted file mode 100644 index 982db11..0000000 --- a/roles/postfix/.gitignore 2 +++ /dev/null @@ -1,4 +0,0 @@ -.molecule -*.log -*.swp -.tox diff --git a/roles/postfix/.travis.yml b/roles/postfix/.travis.yml index 65b12ad..21201e1 100644 --- a/roles/postfix/.travis.yml +++ b/roles/postfix/.travis.yml @@ -8,40 +8,23 @@ os: linux dist: xenial python: - - "3.8" + - "3.9" services: - docker -env: - global: - namespace="robertdebock" - jobs: - - image="amazonlinux" tag="1" - - image="centos" tag="7" - - image="centos" tag="latest" - - image="debian" tag="latest" - - image="debian" tag="bullseye" - - image="fedora" tag="31" - - image="fedora" tag="latest" - - image="ubuntu" tag="latest" - - image="ubuntu" tag="bionic" - - image="ubuntu" tag="xenial" - cache: - pip install: - pip install --upgrade pip - - pip install tox + - pip install yamllint + - pip install ansible-lint script: - - function retry { counter=0 ; until "$@" ; do exit=$? ; counter=$(($counter + 1)) ; if [ $counter -ge 3 ] ; then return $exit ; fi ; done ; return 0; } ; retry tox --parallel all + - yamllint . + - ansible-lint notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ - slack: - secure: "U772ebHw7bzE583/zsePnFgn1rNeMudFTM9+9FgpXS3wYY/52icoRvqBH3zpeTypZcbLW9Dzu9JQR9PxI6BU9Ukn/Y8BEjS+6mKj99rr39XaK/D4ofdJZP3zxE3VtUhjugKROahsTGfqelLSArGPCV5HqCzH+RpBGKs1UyFxqTyuJCn5dQke9vk+X0wZO4q5TrsGLXM8qB9pwz/gq6f14yPod8cbACYOI8u7oLVwhp+cD5UN5CEJ7hLCegtY2l2OuBgWg/P+za19Rseg8MLMWKLLi/j0bH99GdnnHrT3x87BwQl3i8EF0r/nl3moWgQvkNuCwY+yVMJ2Wo8AKzbBef0wRBuj8iYXCTa8mbhLfe5C5WdhgUSQHrJg1wYSYJOFQP8obCzQbuHEJ7swMv6ufHwXkvktpab+xuCiQPfVRzJSguk2ZuFEaBFrk0pZFQnagqQPiRlWAfjqjVhGikQcXx9qpnizQdtefISUDYNpx169ndYx4YphEroGiT6oGca1ki4f2YXV+VclPVFlfG2oKaeCcIhTqBlgFdGwzWQCtxMsnhcFNyUpBYjeOgcerP/Byv5tB0EXql2UZWzQOh9GMHmwc7KQDyC6Ayi89LWeSOLIEL+SBSaSmE+FsGu9kk/CNW6iWyNLDUcqCNnwnQp/7NO0KAZsgJ9+ucHa549+b8c=" - on_success: change - template: "%{result}: %{repository_slug}@%{branch}, build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}>)" email: false diff --git a/roles/postfix/.yamllint b/roles/postfix/.yamllint index 894450c..a7ff098 100644 --- a/roles/postfix/.yamllint +++ b/roles/postfix/.yamllint @@ -13,3 +13,4 @@ rules: ignore: | .tox/ + .cache/ diff --git a/roles/postfix/LICENSE b/roles/postfix/LICENSE index bd15893..e770af8 100644 --- a/roles/postfix/LICENSE +++ b/roles/postfix/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 Robert de Bock (robert@meinit.nl) + Copyright 2021 Robert de Bock (robert@meinit.nl) 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/roles/postfix/README.md b/roles/postfix/README.md index 53fc93b..d419b41 100644 --- a/roles/postfix/README.md +++ b/roles/postfix/README.md @@ -2,9 +2,9 @@ Install and configure postfix on your system. -|Travis|GitHub|Quality|Downloads|Version| +|GitHub|GitLab|Quality|Downloads|Version| |------|------|-------|---------|-------| -|[![travis](https://travis-ci.com/robertdebock/ansible-role-postfix.svg?branch=master)](https://travis-ci.com/robertdebock/ansible-role-postfix)|[![github](https://github.com/robertdebock/ansible-role-postfix/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-postfix/actions)|[![quality](https://img.shields.io/ansible/quality/22976)](https://galaxy.ansible.com/robertdebock/postfix)|[![downloads](https://img.shields.io/ansible/role/d/22976)](https://galaxy.ansible.com/robertdebock/postfix)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-postfix.svg)](https://github.com/robertdebock/ansible-role-postfix/releases/)| +|[![github](https://github.com/robertdebock/ansible-role-postfix/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-postfix/actions)|[![gitlab](https://gitlab.com/robertdebock/ansible-role-postfix/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-postfix)|[![quality](https://img.shields.io/ansible/quality/22976)](https://galaxy.ansible.com/robertdebock/postfix)|[![downloads](https://img.shields.io/ansible/role/d/22976)](https://galaxy.ansible.com/robertdebock/postfix)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-postfix.svg)](https://github.com/robertdebock/ansible-role-postfix/releases/)| ## [Example Playbook](#example-playbook) @@ -18,6 +18,7 @@ This example is taken from `molecule/resources/converge.yml` and is tested on ea roles: - role: robertdebock.postfix + postfix_relayhost: "[relay.example.com]" postfix_myhostname: "smtp.example.com" postfix_mydomain: "example.com" postfix_myorigin: "example.com" @@ -26,7 +27,7 @@ This example is taken from `molecule/resources/converge.yml` and is tested on ea destination: test@example.com ``` -The machine may need to be prepared using `molecule/resources/prepare.yml`: +The machine needs to be prepared in CI this is done using `molecule/resources/prepare.yml`: ```yaml --- - name: Prepare @@ -39,27 +40,6 @@ The machine may need to be prepared using `molecule/resources/prepare.yml`: - role: robertdebock.core_dependencies ``` -For verification `molecule/resources/verify.yml` runs after the role has been applied. -```yaml ---- -- name: Verify - hosts: all - become: yes - gather_facts: no - - tasks: - - name: check if port 25 is open - wait_for: - port: 25 - - - name: check if a mail can be sent - mail: - from: "Robert de Bock " - to: "Robert de Bock " - subject: Testing robertdebock.postfix. - body: Testing the ansible role postfix. -``` - Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles. ## [Role Variables](#role-variables) @@ -93,7 +73,7 @@ postfix_mynetworks: "127.0.0.0/8" # If you want to forward emails to another central relay server, set relayhost. # use brackets to sent to the A-record of the relayhost. -# postfix_relayhost: [relay.example.com] +# postfix_relayhost: "[relay.example.com]" # Set the restrictions for receiving mails. postfix_smtpd_recipient_restrictions: @@ -141,28 +121,30 @@ postfix_smtpd_sender_restrictions: # action: OK # - domain: baddomain.com # action: REJECT + +# You can disable SSL/TLS versions here. +# postfix_tls_protocols: '!SSLv2, !SSLv3, !TLSv1, !TLSv1.1' ``` ## [Requirements](#requirements) -- Access to a repository containing packages, likely on the internet. -- A recent version of Ansible. (Tests run on the current, previous and next release of Ansible.) +- pip packages listed in [requirements.txt](https://github.com/robertdebock/ansible-role-postfix/blob/master/requirements.txt). -The following roles can be installed to ensure all requirements are met, using `ansible-galaxy install -r requirements.yml`: +## [Status of requirements](#status-of-requirements) -```yaml ---- -- robertdebock.bootstrap -- robertdebock.core_dependencies +The following roles are used to prepare a system. You may choose to prepare your system in another way, I have tested these roles as well. -``` +| Requirement | GitHub | GitLab | +|-------------|--------|--------| +| [robertdebock.bootstrap](https://galaxy.ansible.com/robertdebock/bootstrap) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-bootstrap/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-bootstrap/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-bootstrap/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-bootstrap) +| [robertdebock.core_dependencies](https://galaxy.ansible.com/robertdebock/core_dependencies) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-core_dependencies/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-core_dependencies/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-core_dependencies/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-core_dependencies) ## [Context](#context) This role is a part of many compatible roles. Have a look at [the documentation of these roles](https://robertdebock.nl/) for further information. Here is an overview of related roles: -![dependencies](https://raw.githubusercontent.com/robertdebock/drawings/artifacts/postfix.png "Dependency") +![dependencies](https://raw.githubusercontent.com/robertdebock/ansible-role-postfix/png/requirements.png "Dependencies") ## [Compatibility](#compatibility) @@ -173,12 +155,12 @@ This role has been tested on these [container images](https://hub.docker.com/u/r |amazon|2018.03| |el|7, 8| |debian|buster, bullseye| -|fedora|31, 32| -|ubuntu|focal, bionic, xenial| +|fedora|32, 33| +|ubuntu|focal, bionic| -The minimum version of Ansible required is 2.8 but tests have been done to: +The minimum version of Ansible required is 2.10, tests have been done to: -- The previous version, on version lower. +- The previous version. - The current version. - The development version. @@ -192,44 +174,17 @@ Some variarations of the build matrix do not work. These are the variations and | alpine | 451, 4.3.0 : Temporary lookup failure | -## [Testing](#testing) - -[Unit tests](https://travis-ci.com/robertdebock/ansible-role-postfix) are done on every commit, pull request, release and periodically. - If you find issues, please register them in [GitHub](https://github.com/robertdebock/ansible-role-postfix/issues) -Testing is done using [Tox](https://tox.readthedocs.io/en/latest/) and [Molecule](https://github.com/ansible/molecule): - -[Tox](https://tox.readthedocs.io/en/latest/) tests multiple ansible versions. -[Molecule](https://github.com/ansible/molecule) tests multiple distributions. - -To test using the defaults (any installed ansible version, namespace: `robertdebock`, image: `fedora`, tag: `latest`): - -``` -molecule test - -# Or select a specific image: -image=ubuntu molecule test -# Or select a specific image and a specific tag: -image="debian" tag="stable" tox -``` - -Or you can test multiple versions of Ansible, and select images: -Tox allows multiple versions of Ansible to be tested. To run the default (namespace: `robertdebock`, image: `fedora`, tag: `latest`) tests: - -``` -tox - -# To run CentOS (namespace: `robertdebock`, tag: `latest`) -image="centos" tox -# Or customize more: -image="debian" tag="stable" tox -``` - ## [License](#license) Apache-2.0 +## [Contributors](#contributors) + +I'd like to thank everybody that made contributions to this repository. It motivates me, improves the code and is just fun to collaborate. + +- [benformosa](https://github.com/benformosa) ## [Author Information](#author-information) diff --git a/roles/postfix/defaults/main.yml b/roles/postfix/defaults/main.yml index 7b960c1..22e7e2b 100644 --- a/roles/postfix/defaults/main.yml +++ b/roles/postfix/defaults/main.yml @@ -25,7 +25,7 @@ postfix_mynetworks: "127.0.0.0/8" # If you want to forward emails to another central relay server, set relayhost. # use brackets to sent to the A-record of the relayhost. -# postfix_relayhost: [relay.example.com] +# postfix_relayhost: "[relay.example.com]" # Set the restrictions for receiving mails. postfix_smtpd_recipient_restrictions: @@ -73,3 +73,6 @@ postfix_smtpd_sender_restrictions: # action: OK # - domain: baddomain.com # action: REJECT + +# You can disable SSL/TLS versions here. +# postfix_tls_protocols: '!SSLv2, !SSLv3, !TLSv1, !TLSv1.1' diff --git a/roles/postfix/files/my-postfix.te b/roles/postfix/files/my-postfix.te deleted file mode 100644 index 915ccda..0000000 --- a/roles/postfix/files/my-postfix.te +++ /dev/null @@ -1,10 +0,0 @@ - -module my-postfix 1.0; - -require { - type postfix_postdrop_t; - class capability dac_override; -} - -#============= postfix_postdrop_t ============== -allow postfix_postdrop_t self:capability dac_override; diff --git a/roles/postfix/handlers/main.yml b/roles/postfix/handlers/main.yml index 450f24e..47b4ace 100644 --- a/roles/postfix/handlers/main.yml +++ b/roles/postfix/handlers/main.yml @@ -1,24 +1,25 @@ --- # handlers file for postfix + - name: rebuild alias database - command: postmap "{{ postfix_alias_path }}" + ansible.builtin.command: postmap "{{ postfix_alias_path }}" - name: rebuild sender_access database - command: postmap "{{ postfix_sender_access_path }}" + ansible.builtin.command: postmap "{{ postfix_sender_access_path }}" - name: rebuild recipient_access database - command: postmap "{{ postfix_recipient_access_path }}" + ansible.builtin.command: postmap "{{ postfix_recipient_access_path }}" + +- name: reload postfix + ansible.builtin.service: + name: "{{ postfix_service }}" + state: reloaded + when: + - not ansible_check_mode | bool - name: restart postfix - service: + ansible.builtin.service: name: "{{ postfix_service }}" state: restarted - -- name: create selinux mod for postfix - command: checkmodule -M -m -o /etc/my-postfix.mod /etc/my-postfix.te - -- name: create selinux pp for postfix - command: semodule_package -o /etc/my-postfix.pp -m /etc/my-postfix.mod - -- name: load selinux pp for postfix - command: semodule -i /etc/my-postfix.pp + when: + - not ansible_check_mode | bool diff --git a/roles/postfix/meta 2/.galaxy_install_info b/roles/postfix/meta 2/.galaxy_install_info deleted file mode 100644 index 8880af9..0000000 --- a/roles/postfix/meta 2/.galaxy_install_info +++ /dev/null @@ -1,2 +0,0 @@ -install_date: Mon Sep 28 13:22:27 2020 -version: 3.3.2 diff --git a/roles/postfix/meta 2/exception.yml b/roles/postfix/meta 2/exception.yml deleted file mode 100644 index d70b96a..0000000 --- a/roles/postfix/meta 2/exception.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -exceptions: - - variation: opensuse - reason: "Not idempotent on configure postfix (main.cf) and configure postfix" - - variation: alpine - reason: "451, 4.3.0 : Temporary lookup failure" diff --git a/roles/postfix/meta 2/preferences.yml b/roles/postfix/meta 2/preferences.yml deleted file mode 100644 index e7fdebf..0000000 --- a/roles/postfix/meta 2/preferences.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -tox_parallel: yes diff --git a/roles/postfix/meta/.galaxy_install_info b/roles/postfix/meta/.galaxy_install_info index 8880af9..7906a99 100644 --- a/roles/postfix/meta/.galaxy_install_info +++ b/roles/postfix/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Mon Sep 28 13:22:27 2020 -version: 3.3.2 +install_date: Sun Mar 21 06:59:50 2021 +version: 4.2.0 diff --git a/roles/postfix/meta/main.yml b/roles/postfix/meta/main.yml index 70f65b4..51388aa 100644 --- a/roles/postfix/meta/main.yml +++ b/roles/postfix/meta/main.yml @@ -5,7 +5,7 @@ galaxy_info: description: Install and configure postfix on your system. license: Apache-2.0 company: none - min_ansible_version: 2.8 + min_ansible_version: "2.10" platforms: - name: Amazon @@ -21,21 +21,18 @@ galaxy_info: - bullseye - name: Fedora versions: - - 31 - 32 + - 33 - name: Ubuntu versions: - focal - bionic - - xenial galaxy_tags: - - centos - installer - mailserver - package - postfix - - redhat - security - system diff --git a/roles/postfix/molecule/default/converge.yml b/roles/postfix/molecule/default/converge.yml index 0f16f77..a707cea 100644 --- a/roles/postfix/molecule/default/converge.yml +++ b/roles/postfix/molecule/default/converge.yml @@ -6,6 +6,7 @@ roles: - role: ansible-role-postfix + postfix_relayhost: "[relay.example.com]" postfix_myhostname: "smtp.example.com" postfix_mydomain: "example.com" postfix_myorigin: "example.com" diff --git a/roles/postfix/molecule/default/molecule.yml b/roles/postfix/molecule/default/molecule.yml index 74e8723..94c0003 100644 --- a/roles/postfix/molecule/default/molecule.yml +++ b/roles/postfix/molecule/default/molecule.yml @@ -9,6 +9,7 @@ dependency: lint: | set -e yamllint . + ansible-lint driver: name: docker platforms: diff --git a/roles/postfix/requirements 2.yml b/roles/postfix/requirements 2.yml deleted file mode 100644 index e531325..0000000 --- a/roles/postfix/requirements 2.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- robertdebock.bootstrap -- robertdebock.core_dependencies diff --git a/roles/postfix/requirements.yml b/roles/postfix/requirements.yml index e531325..e540ea4 100644 --- a/roles/postfix/requirements.yml +++ b/roles/postfix/requirements.yml @@ -1,3 +1,4 @@ --- -- robertdebock.bootstrap -- robertdebock.core_dependencies +roles: + - name: robertdebock.bootstrap + - name: robertdebock.core_dependencies diff --git a/roles/postfix/tasks/assert.yml b/roles/postfix/tasks/assert.yml index 7df5d1b..1b67d2c 100644 --- a/roles/postfix/tasks/assert.yml +++ b/roles/postfix/tasks/assert.yml @@ -1,58 +1,65 @@ --- + - name: test if postfix_myhostname is set correctly - assert: + ansible.builtin.assert: that: - postfix_myhostname is defined - - postfix_myhostname | length > 0 + - postfix_myhostname is string quiet: yes - name: test if postfix_mydomain is set correctly - assert: + ansible.builtin.assert: that: - postfix_mydomain is defined - - postfix_mydomain | length > 0 + - postfix_mydomain is string quiet: yes - name: test if postfix_myorigin is set correctly - assert: + ansible.builtin.assert: that: - postfix_myorigin is defined - - postfix_myorigin | length > 0 + - postfix_myorigin is string quiet: yes - name: test if postfix_inet_interfaces is set correctly - assert: + ansible.builtin.assert: that: - postfix_inet_interfaces is defined - - postfix_inet_interfaces | length > 0 + - postfix_inet_interfaces is string quiet: yes - name: test if postfix_mydestination is set correctly - assert: + ansible.builtin.assert: that: - postfix_mydestination is defined - - postfix_mydestination | length > 0 + - postfix_mydestination is string quiet: yes - name: test if postfix_mynetworks is set correctly - assert: + ansible.builtin.assert: that: - postfix_mynetworks is defined - - postfix_mynetworks | length > 0 + - postfix_mynetworks is string quiet: yes - name: test if postfix_smtpd_recipient_restrictions is set correctly - assert: + ansible.builtin.assert: that: - postfix_smtpd_recipient_restrictions is defined - - postfix_smtpd_recipient_restrictions | length > 0 - postfix_smtpd_recipient_restrictions is iterable quiet: yes - name: test if postfix_smtpd_sender_restrictions is set correctly - assert: + ansible.builtin.assert: that: - postfix_smtpd_sender_restrictions is defined - - postfix_smtpd_sender_restrictions | length > 0 - postfix_smtpd_sender_restrictions is iterable quiet: yes + +- name: test if postfix_smtpd_sender_restrictions is set correctly + ansible.builtin.assert: + that: + - postfix_tls_protocols is string + quiet: yes + when: + - postfix_tls_protocols is defined diff --git a/roles/postfix/tasks/main.yml b/roles/postfix/tasks/main.yml index 607e0b2..c1027c6 100644 --- a/roles/postfix/tasks/main.yml +++ b/roles/postfix/tasks/main.yml @@ -1,29 +1,36 @@ --- # tasks file for postfix + - name: include assert.yml - include_tasks: assert.yml + import_tasks: assert.yml + run_once: yes + delegate_to: localhost + +- name: pre-configure debian systems + ansible.builtin.debconf: + name: postfix + question: postfix/main_mailer_type + vtype: string + value: "No configuration" + when: + - ansible_os_family == "Debian" - name: install postfix - package: + ansible.builtin.package: name: "{{ postfix_packages }}" state: present -- name: create group - group: - name: "{{ postfix_group }}" - state: present - - name: configure postfix (main.cf) - template: + ansible.builtin.template: src: main.cf.j2 dest: /etc/postfix/main.cf validate: postconf -d -c %s mode: "0644" notify: - - restart postfix + - reload postfix - name: configure postfix (master.cf) - template: + ansible.builtin.template: src: master.cf.j2 dest: /etc/postfix/master.cf validate: postconf -d -c %s @@ -32,10 +39,10 @@ - restart postfix - name: force all notified handlers to run - meta: flush_handlers + ansible.builtin.meta: flush_handlers - name: configure aliases - lineinfile: + ansible.builtin.lineinfile: path: "{{ postfix_alias_path }}" regexp: "^{{ item.name }}:" line: "{{ item.name }}: {{ item.destination }}" @@ -45,12 +52,12 @@ loop: "{{ postfix_aliases }}" notify: - rebuild alias database - - restart postfix + - reload postfix loop_control: label: "{{ item.name }}" - name: configure sender_access - lineinfile: + ansible.builtin.lineinfile: path: "{{ postfix_sender_access_path }}" regexp: "^{{ item.domain }}" line: "{{ item.domain }} {{ item.action }}" @@ -61,12 +68,12 @@ loop: "{{ postfix_sender_access }}" notify: - rebuild sender_access database - - restart postfix + - reload postfix loop_control: label: "{{ item.domain }}" - name: configure recipient_access - lineinfile: + ansible.builtin.lineinfile: path: "{{ postfix_recipient_access_path }}" regexp: "^{{ item.domain }}" line: "{{ item.domain }} {{ item.action }}" @@ -77,39 +84,15 @@ loop: "{{ postfix_recipient_access }}" notify: - rebuild recipient_access database - - restart postfix + - reload postfix loop_control: label: "{{ item.domain }}" - name: force all notified handlers to run - meta: flush_handlers - -- name: set group owner - file: - path: "{{ item }}" - group: "{{ postfix_group }}" - mode: "0755" - loop: - - /usr/sbin/postqueue - - /usr/sbin/postdrop - - /var/spool/postfix/public - - /var/spool/postfix/maildrop - -- name: place selinux type enforcement - copy: - src: my-postfix.te - dest: /etc/my-postfix.te - mode: "0644" - notify: - - create selinux mod for postfix - - create selinux pp for postfix - - load selinux pp for postfix - when: - - ansible_selinux.status is defined - - ansible_selinux.status == "enabled" + ansible.builtin.meta: flush_handlers - name: start and enable postfix - service: + ansible.builtin.service: name: "{{ postfix_service }}" state: started enabled: yes diff --git a/roles/postfix/templates/main.cf.j2 b/roles/postfix/templates/main.cf.j2 index 5fbff9a..f8feb31 100644 --- a/roles/postfix/templates/main.cf.j2 +++ b/roles/postfix/templates/main.cf.j2 @@ -344,7 +344,7 @@ smtpd_sender_restrictions = check_sender_access hash:{{ postfix_sender_access_pa #relayhost = [mailserver.isp.tld] #relayhost = uucphost #relayhost = [an.ip.add.ress] -{% if postfix_relayhost is defined %} +{% if postfix_relayhost is defined and postfix_relayhost | length > 0 %} relayhost = {{ postfix_relayhost|replace("'", "") }} {% endif %} @@ -691,7 +691,7 @@ mailq_path = /usr/bin/mailq.postfix # commands. This must be a group name with a numerical group ID that # is not shared with other accounts, not even with the Postfix account. # -setgid_group = postdrop +setgid_group = {{ postfix_group }} # html_directory: The location of the Postfix HTML documentation. # @@ -715,3 +715,13 @@ readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES content_filter = scan:127.0.0.1:10025 receive_override_options = no_address_mappings {% endif %} + +{% if postfix_tls_protocols is defined %} +# smtpd_tls_mandatory_protcols: TLS protocols accepted by the Postfix SMTP +# server with mandatory TLS encryption. +# +smtpd_tls_mandatory_protocols = {{ postfix_tls_protocols }} +smtpd_tls_protocols = {{ postfix_tls_protocols }} +smtp_tls_mandatory_protocols = {{ postfix_tls_protocols }} +smtp_tls_protocols = {{ postfix_tls_protocols }} +{% endif %} diff --git a/roles/postfix/tox.ini b/roles/postfix/tox.ini index c1bc1d4..f57553b 100644 --- a/roles/postfix/tox.ini +++ b/roles/postfix/tox.ini @@ -2,25 +2,25 @@ # Ansible managed # [tox] -minversion = 3.7 -# Disabled "next" because of: -# https://github.com/ansible-community/molecule/issues/2626. -# envlist = py{38}-ansible-{previous,current,next} -envlist = py{38}-ansible-{previous,current} +minversion = 3.21.4 +# 2.11 has been disabled: couldn't resolve module/action 'docker_container'. +envlist = py{39}-ansible-{2.9,2.10} + skipsdist = true [testenv] deps = - previous: ansible>=2.8, <2.9 - current: ansible>=2.9 - next: git+https://github.com/ansible/ansible.git@devel - molecule[lint]>=3, <4 - docker>=4.2, <4.3 + 2.9: ansible == 2.9.* + 2.10: ansible == 2.10.* + 2.11: git+https://github.com/ansible/ansible.git@devel + molecule[docker] + docker == 4.* + ansible-lint == 5.* commands = molecule test setenv = TOX_ENVNAME={envname} - MOLECULE_EPHEMERAL_DIRECTORY=/tmp/.molecule/{env:image:fedora}-{env:tag:latest}/{envname} PY_COLORS=1 ANSIBLE_FORCE_COLOR=1 + ANSIBLE_ROLES_PATH=../ passenv = namespace image tag diff --git a/roles/postfix/vars/main.yml b/roles/postfix/vars/main.yml index b5d002a..d5afff9 100644 --- a/roles/postfix/vars/main.yml +++ b/roles/postfix/vars/main.yml @@ -13,8 +13,6 @@ _postfix_daemon_directory: postfix_daemon_directory: "{{_postfix_daemon_directory[ansible_os_family] | default(_postfix_daemon_directory['default']) }}" -postfix_group: postdrop - _postfix_alias_path: default: /etc/aliases Alpine: /etc/postfix/aliases @@ -24,3 +22,9 @@ postfix_alias_path: "{{ _postfix_alias_path[ansible_os_family] | default(_postfi postfix_recipient_access_path: /etc/postfix/recipient_access postfix_sender_access_path: /etc/postfix/sender_access + +_postfix_group: + default: postdrop + Suse: maildrop + +postfix_group: "{{ _postfix_group[ansible_os_family] | default(_postfix_group['default']) }}" diff --git a/roles/python_pip/.ansible-lint b/roles/python_pip/.ansible-lint index eba57d1..7a17121 100644 --- a/roles/python_pip/.ansible-lint +++ b/roles/python_pip/.ansible-lint @@ -4,5 +4,9 @@ exclude_paths: - ./meta/exception.yml - ./meta/preferences.yml + - ./molecule/default/prepare.yml + - ./molecule/default/converge.yml - ./molecule/default/verify.yml + - ./molecule/default/collections.yml - ./.tox + - ./.cache diff --git a/roles/python_pip/.github 2/FUNDING.yml b/roles/python_pip/.github 2/FUNDING.yml deleted file mode 100644 index 67320f0..0000000 --- a/roles/python_pip/.github 2/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -github: robertdebock diff --git a/roles/python_pip/.github 2/pull_request_template.md b/roles/python_pip/.github 2/pull_request_template.md deleted file mode 100644 index b1578c0..0000000 --- a/roles/python_pip/.github 2/pull_request_template.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: Pull request -about: Describe the proposed change - ---- - -**Describe the change** -A clear and concise description of what the pull request is. - -**Testing** -In case a feature was added, how were tests performed? diff --git a/roles/python_pip/.github 2/settings.yml b/roles/python_pip/.github 2/settings.yml deleted file mode 100644 index 98dbddf..0000000 --- a/roles/python_pip/.github 2/settings.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# -# Ansible managed -# -repository: - description: Install pythons pip on your system. - homepage: https://robertdebock.nl/ diff --git a/roles/python_pip/.github/settings.yml b/roles/python_pip/.github/settings.yml index 98dbddf..0348a6d 100644 --- a/roles/python_pip/.github/settings.yml +++ b/roles/python_pip/.github/settings.yml @@ -5,3 +5,4 @@ repository: description: Install pythons pip on your system. homepage: https://robertdebock.nl/ + topics: python, pip, pypip, system, installer, ansible, molecule, tox, playbook, hacktoberfest diff --git a/roles/python_pip/.github/workflows/galaxy.yml b/roles/python_pip/.github/workflows/galaxy.yml index cca8501..1d36b74 100644 --- a/roles/python_pip/.github/workflows/galaxy.yml +++ b/roles/python_pip/.github/workflows/galaxy.yml @@ -6,17 +6,13 @@ name: Release to Ansible Galaxy on: - push: - tags: - - '*' - schedule: - - cron: '16 16 16 * *' - + release: + types: [created, edited, published, released] jobs: release: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: galaxy - uses: robertdebock/galaxy-action@1.0.1 + uses: robertdebock/galaxy-action@1.1.0 with: galaxy_api_key: ${{ secrets.galaxy_api_key }} diff --git a/roles/python_pip/.github/workflows/molecule.yml b/roles/python_pip/.github/workflows/molecule.yml index 87d7684..bf5d267 100644 --- a/roles/python_pip/.github/workflows/molecule.yml +++ b/roles/python_pip/.github/workflows/molecule.yml @@ -15,30 +15,24 @@ on: jobs: lint: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: checkout uses: actions/checkout@v2 with: path: "${{ github.repository }}" - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: command: lint test: needs: - lint - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: config: - - image: "alpine" - tag: "latest" - - image: "alpine" - tag: "edge" - - image: "centos" - tag: "7" - image: "centos" tag: "latest" - image: "debian" @@ -46,7 +40,7 @@ jobs: - image: "debian" tag: "bullseye" - image: "fedora" - tag: "31" + tag: "32" - image: "fedora" tag: "latest" - image: "opensuse" @@ -55,8 +49,6 @@ jobs: tag: "latest" - image: "ubuntu" tag: "bionic" - - image: "ubuntu" - tag: "xenial" steps: - name: checkout uses: actions/checkout@v2 @@ -67,10 +59,7 @@ jobs: - name: parse apparmor for mysql run: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - name: molecule - uses: robertdebock/molecule-action@2.6.2 + uses: robertdebock/molecule-action@2.6.16 with: image: ${{ matrix.config.image }} tag: ${{ matrix.config.tag }} - options: "--parallel all" - env: - TOX_PARALLEL_NO_SPINNER: 1 diff --git a/roles/python_pip/.gitignore b/roles/python_pip/.gitignore index 982db11..c15d16a 100644 --- a/roles/python_pip/.gitignore +++ b/roles/python_pip/.gitignore @@ -2,3 +2,4 @@ *.log *.swp .tox +.cache diff --git a/roles/python_pip/.gitignore 2 b/roles/python_pip/.gitignore 2 deleted file mode 100644 index 982db11..0000000 --- a/roles/python_pip/.gitignore 2 +++ /dev/null @@ -1,4 +0,0 @@ -.molecule -*.log -*.swp -.tox diff --git a/roles/python_pip/.travis.yml b/roles/python_pip/.travis.yml index 524218b..21201e1 100644 --- a/roles/python_pip/.travis.yml +++ b/roles/python_pip/.travis.yml @@ -8,42 +8,23 @@ os: linux dist: xenial python: - - "3.8" + - "3.9" services: - docker -env: - global: - namespace="robertdebock" - jobs: - - image="alpine" tag="latest" - - image="alpine" tag="edge" - - image="centos" tag="7" - - image="centos" tag="latest" - - image="debian" tag="latest" - - image="debian" tag="bullseye" - - image="fedora" tag="31" - - image="fedora" tag="latest" - - image="opensuse" tag="latest" - - image="ubuntu" tag="latest" - - image="ubuntu" tag="bionic" - - image="ubuntu" tag="xenial" - cache: - pip install: - pip install --upgrade pip - - pip install tox + - pip install yamllint + - pip install ansible-lint script: - - function retry { counter=0 ; until "$@" ; do exit=$? ; counter=$(($counter + 1)) ; if [ $counter -ge 3 ] ; then return $exit ; fi ; done ; return 0; } ; retry tox --parallel all + - yamllint . + - ansible-lint notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ - slack: - secure: "B8VPCMWxv/8UDsuvi0StYn30s4h/9An62D9CXJTUL6gaTwkZ+0PpCZ482Vd2EiYbQc3hNQyBiScStXG3r+2Yzl5i4fwOmYpBnOMptZUrFapqI0Tx7zaQOKTw2wvNccuIM0usDPZPnF653X4vgJ6JXZ6s74wXcpHcPL3tStwVcqExjs0VcrDO2cRc+NHlvZr/e8z/66LPh2kuOT3dbQiVsGVQmr+pXPN5ZE7+KczDSPUpbS2IK/aR5qj+GR3gxr8lcHhfsLwb4ajloTJas2Whskg6KnPuGOFy3Ta/BdNnuwkgyPeNPFVanyJXX/CiBu6oeN3VLQxq/alOFTrwO1LQ80UtgVEj8abTkNAySSEpDuFM0BWm9I79syufP2iguV/aUyTKUC+Ut9j++8mkMWDErQnZu1sdiONLdInHnPA30U8mp3W0nQjJuNkQZGTFDaY8aoW3UiNEO1G9PExSAOVxt6132VlvSPDcMzfRdFDEegNT5Ebkqhpx4illSeooT9SZs2tboobCAl9CWigY994hjzOk4DEaIurt9rakDNrAeh75DJZE72dfBc5txARmBKqiml5htf0Nxf4R6q+GfSFCzMYarHS8MR/Ekd8679YD/6wfBRQUOS4aypsRt3WNlxwLH+kj7pKTyDkefO2P6KQrMcZcoPb0O2o8WGNihmwlyDA=" - on_success: change - template: "%{result}: %{repository_slug}@%{branch}, build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}>)" email: false diff --git a/roles/python_pip/.yamllint b/roles/python_pip/.yamllint index 894450c..a7ff098 100644 --- a/roles/python_pip/.yamllint +++ b/roles/python_pip/.yamllint @@ -13,3 +13,4 @@ rules: ignore: | .tox/ + .cache/ diff --git a/roles/python_pip/LICENSE b/roles/python_pip/LICENSE index bd15893..e770af8 100644 --- a/roles/python_pip/LICENSE +++ b/roles/python_pip/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 Robert de Bock (robert@meinit.nl) + Copyright 2021 Robert de Bock (robert@meinit.nl) 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/roles/python_pip/README.md b/roles/python_pip/README.md index 9055fb8..b6349ad 100644 --- a/roles/python_pip/README.md +++ b/roles/python_pip/README.md @@ -2,9 +2,9 @@ Install pythons pip on your system. -|Travis|GitHub|Quality|Downloads|Version| +|GitHub|GitLab|Quality|Downloads|Version| |------|------|-------|---------|-------| -|[![travis](https://travis-ci.com/robertdebock/ansible-role-python_pip.svg?branch=master)](https://travis-ci.com/robertdebock/ansible-role-python_pip)|[![github](https://github.com/robertdebock/ansible-role-python_pip/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-python_pip/actions)|[![quality](https://img.shields.io/ansible/quality/42440)](https://galaxy.ansible.com/robertdebock/python_pip)|[![downloads](https://img.shields.io/ansible/role/d/42440)](https://galaxy.ansible.com/robertdebock/python_pip)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-python_pip.svg)](https://github.com/robertdebock/ansible-role-python_pip/releases/)| +|[![github](https://github.com/robertdebock/ansible-role-python_pip/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-python_pip/actions)|[![gitlab](https://gitlab.com/robertdebock/ansible-role-python_pip/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-python_pip)|[![quality](https://img.shields.io/ansible/quality/42440)](https://galaxy.ansible.com/robertdebock/python_pip)|[![downloads](https://img.shields.io/ansible/role/d/42440)](https://galaxy.ansible.com/robertdebock/python_pip)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-python_pip.svg)](https://github.com/robertdebock/ansible-role-python_pip/releases/)| ## [Example Playbook](#example-playbook) @@ -20,7 +20,7 @@ This example is taken from `molecule/resources/converge.yml` and is tested on ea - role: robertdebock.python_pip ``` -The machine may need to be prepared using `molecule/resources/prepare.yml`: +The machine needs to be prepared in CI this is done using `molecule/resources/prepare.yml`: ```yaml --- - name: Prepare @@ -34,37 +34,6 @@ The machine may need to be prepared using `molecule/resources/prepare.yml`: - role: robertdebock.buildtools ``` -For verification `molecule/resources/verify.yml` runs after the role has been applied. -```yaml ---- -- name: Verify - hosts: all - become: yes - gather_facts: no - - tasks: - - name: install pip module - pip: - name: docker - state: present - - - name: check if bootstrap still works. - include_role: - name: robertdebock.bootstrap - - - name: remove pip module - pip: - name: docker - state: absent - - - name: check if requested modules can be installed - include_role: - name: robertdebock.python_pip - vars: - python_pip_modules: - - name: docker -``` - Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles. ## [Role Variables](#role-variables) @@ -82,29 +51,31 @@ python_pip_modules: [] # Don't forget to trust foreign pip repositories if you use them. # python_pip_trusted_host: my-pip-repository.example.com + +# You can have this role update pip, using pip. +python_pip_update: yes ``` ## [Requirements](#requirements) -- Access to a repository containing packages, likely on the internet. -- A recent version of Ansible. (Tests run on the current, previous and next release of Ansible.) +- pip packages listed in [requirements.txt](https://github.com/robertdebock/ansible-role-python_pip/blob/master/requirements.txt). -The following roles can be installed to ensure all requirements are met, using `ansible-galaxy install -r requirements.yml`: +## [Status of requirements](#status-of-requirements) -```yaml ---- -- robertdebock.bootstrap -- robertdebock.buildtools -- robertdebock.epel +The following roles are used to prepare a system. You may choose to prepare your system in another way, I have tested these roles as well. -``` +| Requirement | GitHub | GitLab | +|-------------|--------|--------| +| [robertdebock.bootstrap](https://galaxy.ansible.com/robertdebock/bootstrap) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-bootstrap/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-bootstrap/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-bootstrap/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-bootstrap) +| [robertdebock.buildtools](https://galaxy.ansible.com/robertdebock/buildtools) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-buildtools/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-buildtools/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-buildtools/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-buildtools) +| [robertdebock.epel](https://galaxy.ansible.com/robertdebock/epel) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-epel/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-epel/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-epel/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-epel) ## [Context](#context) This role is a part of many compatible roles. Have a look at [the documentation of these roles](https://robertdebock.nl/) for further information. Here is an overview of related roles: -![dependencies](https://raw.githubusercontent.com/robertdebock/drawings/artifacts/python_pip.png "Dependency") +![dependencies](https://raw.githubusercontent.com/robertdebock/ansible-role-python_pip/png/requirements.png "Dependencies") ## [Compatibility](#compatibility) @@ -112,16 +83,15 @@ This role has been tested on these [container images](https://hub.docker.com/u/r |container|tags| |---------|----| -|alpine|all| -|el|7, 8| +|el|8| |debian|buster, bullseye| -|fedora|31, 32| +|fedora|32, 33| |opensuse|all| -|ubuntu|focal, bionic, xenial| +|ubuntu|focal, bionic| -The minimum version of Ansible required is 2.8 but tests have been done to: +The minimum version of Ansible required is 2.1, tests have been done to: -- The previous version, on version lower. +- The previous version. - The current version. - The development version. @@ -131,44 +101,13 @@ Some variarations of the build matrix do not work. These are the variations and | variation | reason | |---------------------------|------------------------| -| amazonline:1 | ImportError: No module named pkg_resources | -| amazonline | ImportError: No module named pkg_resources | +| amazonlinux | python2 is installed already. | +| alpine | Failed to create temporary directory. | +| centos:7 | CentOS 7 uses python2, which is EOL. | -## [Testing](#testing) - -[Unit tests](https://travis-ci.com/robertdebock/ansible-role-python_pip) are done on every commit, pull request, release and periodically. - If you find issues, please register them in [GitHub](https://github.com/robertdebock/ansible-role-python_pip/issues) -Testing is done using [Tox](https://tox.readthedocs.io/en/latest/) and [Molecule](https://github.com/ansible/molecule): - -[Tox](https://tox.readthedocs.io/en/latest/) tests multiple ansible versions. -[Molecule](https://github.com/ansible/molecule) tests multiple distributions. - -To test using the defaults (any installed ansible version, namespace: `robertdebock`, image: `fedora`, tag: `latest`): - -``` -molecule test - -# Or select a specific image: -image=ubuntu molecule test -# Or select a specific image and a specific tag: -image="debian" tag="stable" tox -``` - -Or you can test multiple versions of Ansible, and select images: -Tox allows multiple versions of Ansible to be tested. To run the default (namespace: `robertdebock`, image: `fedora`, tag: `latest`) tests: - -``` -tox - -# To run CentOS (namespace: `robertdebock`, tag: `latest`) -image="centos" tox -# Or customize more: -image="debian" tag="stable" tox -``` - ## [License](#license) Apache-2.0 diff --git a/roles/python_pip/defaults/main.yml b/roles/python_pip/defaults/main.yml index dc8580f..4f274ef 100644 --- a/roles/python_pip/defaults/main.yml +++ b/roles/python_pip/defaults/main.yml @@ -9,3 +9,9 @@ python_pip_modules: [] # Don't forget to trust foreign pip repositories if you use them. # python_pip_trusted_host: my-pip-repository.example.com + +# You can have this role update pip, using pip. +python_pip_update: yes + +# You can use something other than the default pip binary. +# python_pip_executable: pip3 diff --git a/roles/python_pip/meta 2/.galaxy_install_info b/roles/python_pip/meta 2/.galaxy_install_info deleted file mode 100644 index d21cfb2..0000000 --- a/roles/python_pip/meta 2/.galaxy_install_info +++ /dev/null @@ -1,2 +0,0 @@ -install_date: Mon Sep 28 13:22:31 2020 -version: 3.3.11 diff --git a/roles/python_pip/meta 2/exception.yml b/roles/python_pip/meta 2/exception.yml deleted file mode 100644 index c6f46c0..0000000 --- a/roles/python_pip/meta 2/exception.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -exceptions: - - variation: amazonline:1 - reason: "ImportError: No module named pkg_resources" - - variation: amazonline - reason: "ImportError: No module named pkg_resources" diff --git a/roles/python_pip/meta 2/preferences.yml b/roles/python_pip/meta 2/preferences.yml deleted file mode 100644 index e7fdebf..0000000 --- a/roles/python_pip/meta 2/preferences.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -tox_parallel: yes diff --git a/roles/python_pip/meta/.galaxy_install_info b/roles/python_pip/meta/.galaxy_install_info index d21cfb2..e870578 100644 --- a/roles/python_pip/meta/.galaxy_install_info +++ b/roles/python_pip/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Mon Sep 28 13:22:31 2020 -version: 3.3.11 +install_date: Sun Mar 21 06:59:52 2021 +version: 4.1.0 diff --git a/roles/python_pip/meta/exception.yml b/roles/python_pip/meta/exception.yml index c6f46c0..fd14022 100644 --- a/roles/python_pip/meta/exception.yml +++ b/roles/python_pip/meta/exception.yml @@ -1,6 +1,8 @@ --- exceptions: - - variation: amazonline:1 - reason: "ImportError: No module named pkg_resources" - - variation: amazonline - reason: "ImportError: No module named pkg_resources" + - variation: amazonlinux + reason: "python2 is installed already." + - variation: alpine + reason: "Failed to create temporary directory." + - variation: "centos:7" + reason: "CentOS 7 uses python2, which is EOL." diff --git a/roles/python_pip/meta/main.yml b/roles/python_pip/meta/main.yml index 5a7d21f..e7a0020 100644 --- a/roles/python_pip/meta/main.yml +++ b/roles/python_pip/meta/main.yml @@ -1,19 +1,16 @@ --- galaxy_info: author: Robert de Bock + namespace: robertdebock role_name: python_pip description: Install pythons pip on your system. license: Apache-2.0 company: none - min_ansible_version: 2.8 + min_ansible_version: 2.10 platforms: - - name: Alpine - versions: - - all - name: EL versions: - - 7 - 8 - name: Debian versions: @@ -21,8 +18,8 @@ galaxy_info: - bullseye - name: Fedora versions: - - 31 - 32 + - 33 - name: OpenSUSE versions: - all @@ -30,7 +27,6 @@ galaxy_info: versions: - focal - bionic - - xenial galaxy_tags: - python @@ -38,6 +34,5 @@ galaxy_info: - pypip - system - installer - - centos dependencies: [] diff --git a/roles/python_pip/molecule 2/default/converge.yml b/roles/python_pip/molecule 2/default/converge.yml deleted file mode 100644 index ee3c770..0000000 --- a/roles/python_pip/molecule 2/default/converge.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Converge - hosts: all - become: yes - gather_facts: yes - - roles: - - role: ansible-role-python_pip diff --git a/roles/python_pip/molecule 2/default/prepare.yml b/roles/python_pip/molecule 2/default/prepare.yml deleted file mode 100644 index 1772675..0000000 --- a/roles/python_pip/molecule 2/default/prepare.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -- name: Prepare - hosts: all - gather_facts: no - become: yes - - roles: - - role: robertdebock.bootstrap - - role: robertdebock.epel - - role: robertdebock.buildtools diff --git a/roles/python_pip/molecule/default/molecule.yml b/roles/python_pip/molecule/default/molecule.yml index ccbf3f0..2eab685 100644 --- a/roles/python_pip/molecule/default/molecule.yml +++ b/roles/python_pip/molecule/default/molecule.yml @@ -6,9 +6,11 @@ dependency: name: galaxy options: role-file: requirements.yml + requirements-file: requirements.yml lint: | set -e yamllint . + ansible-lint driver: name: docker platforms: diff --git a/roles/python_pip/molecule/default/verify.yml b/roles/python_pip/molecule/default/verify.yml index 691b58d..7358f6b 100644 --- a/roles/python_pip/molecule/default/verify.yml +++ b/roles/python_pip/molecule/default/verify.yml @@ -25,3 +25,24 @@ vars: python_pip_modules: - name: docker + + - name: check if requested modules can be removed + include_role: + name: ansible-role-python_pip + vars: + python_pip_modules: + - name: docker + state: absent + + - name: check if pyOpenSSL can be installed + pip: + name: pyOpenSSL + state: present + notify: + - remove pyOpenSSL + + handlers: + - name: remove pyOpenSSL + pip: + name: pyOpenSSL + state: absent diff --git a/roles/python_pip/requirements 2.yml b/roles/python_pip/requirements 2.yml deleted file mode 100644 index 0682eb0..0000000 --- a/roles/python_pip/requirements 2.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -- robertdebock.bootstrap -- robertdebock.buildtools -- robertdebock.epel diff --git a/roles/python_pip/requirements.yml b/roles/python_pip/requirements.yml index 0682eb0..fc52308 100644 --- a/roles/python_pip/requirements.yml +++ b/roles/python_pip/requirements.yml @@ -1,4 +1,7 @@ --- -- robertdebock.bootstrap -- robertdebock.buildtools -- robertdebock.epel +roles: + - name: robertdebock.bootstrap + - name: robertdebock.buildtools + - name: robertdebock.epel +collections: + - name: community.general diff --git a/roles/python_pip/tasks/assert.yml b/roles/python_pip/tasks/assert.yml index aad155b..8421073 100644 --- a/roles/python_pip/tasks/assert.yml +++ b/roles/python_pip/tasks/assert.yml @@ -1,23 +1,47 @@ --- + - name: test if python_pip_modules is set correctly - assert: + ansible.builtin.assert: that: - python_pip_modules is defined - - python_pip_modules | type_debug == "list" + - python_pip_modules is iterable quiet: yes -- name: test if python_pip_proxy is set correctly - assert: +- name: test if item.name in python_pip_modules is set correctly + ansible.builtin.assert: that: - - python_pip_proxy | length > 0 + - item.name is defined + - item.name is string quiet: yes - when: - - python_pip_proxy is defined + loop: "{{ python_pip_modules }}" + loop_control: + label: "{{ item.name }}" -- name: test if python_pip_trusted_host is set correctly - assert: +- name: test if item.state in python_pip_modules is set correctly + ansible.builtin.assert: that: - - python_pip_trusted_host | length > 0 + - item.state in [ "absent", "latest", "present" ] quiet: yes + loop: "{{ python_pip_modules }}" + loop_control: + label: "{{ item.name }}" when: - - python_pip_trusted_host is defined + - item.state is defined + +- name: test if item.name in python_pip_modules is set correctly + ansible.builtin.assert: + that: + - item.version is string + quiet: yes + loop: "{{ python_pip_modules }}" + loop_control: + label: "{{ item.name }}" + when: + - item.version is defined + +- name: test if python_pip_update is set correctly + ansible.builtin.assert: + that: + - python_pip_update is defined + - python_pip_update is boolean + quiet: yes diff --git a/roles/python_pip/tasks/main.yml b/roles/python_pip/tasks/main.yml index 27d40c9..26a3ec8 100644 --- a/roles/python_pip/tasks/main.yml +++ b/roles/python_pip/tasks/main.yml @@ -1,15 +1,18 @@ --- # tasks file for python_pip + - name: include assert.yml - include_tasks: assert.yml + import_tasks: assert.yml + run_once: yes + delegate_to: localhost - name: install python pip - package: + ansible.builtin.package: name: "{{ python_pip_packages }}" state: present - name: configure pip proxy - ini_file: + community.general.ini_file: path: /etc/pip.conf section: global option: index-url @@ -19,7 +22,7 @@ - python_pip_proxy is defined - name: trust hosts - ini_file: + community.general.ini_file: path: /etc/pip.conf section: global option: trusted-host @@ -28,11 +31,22 @@ when: - python_pip_trusted_host is defined +- name: update pip + ansible.builtin.pip: + name: + - pip + - setuptools + state: latest # noqa package-latest + executable: "{{ python_pip_executable | default(omit) }}" + when: + - python_pip_update | bool + - name: install requested modules - pip: + ansible.builtin.pip: name: "{{ item.name }}" - state: present + state: "{{ item.state | default('present') }}" version: "{{ item.version | default(omit) }}" + executable: "{{ python_pip_executable | default(omit) }}" loop: "{{ python_pip_modules }}" loop_control: label: "{{ item.name }}" diff --git a/roles/python_pip/tox.ini b/roles/python_pip/tox.ini index c1bc1d4..f57553b 100644 --- a/roles/python_pip/tox.ini +++ b/roles/python_pip/tox.ini @@ -2,25 +2,25 @@ # Ansible managed # [tox] -minversion = 3.7 -# Disabled "next" because of: -# https://github.com/ansible-community/molecule/issues/2626. -# envlist = py{38}-ansible-{previous,current,next} -envlist = py{38}-ansible-{previous,current} +minversion = 3.21.4 +# 2.11 has been disabled: couldn't resolve module/action 'docker_container'. +envlist = py{39}-ansible-{2.9,2.10} + skipsdist = true [testenv] deps = - previous: ansible>=2.8, <2.9 - current: ansible>=2.9 - next: git+https://github.com/ansible/ansible.git@devel - molecule[lint]>=3, <4 - docker>=4.2, <4.3 + 2.9: ansible == 2.9.* + 2.10: ansible == 2.10.* + 2.11: git+https://github.com/ansible/ansible.git@devel + molecule[docker] + docker == 4.* + ansible-lint == 5.* commands = molecule test setenv = TOX_ENVNAME={envname} - MOLECULE_EPHEMERAL_DIRECTORY=/tmp/.molecule/{env:image:fedora}-{env:tag:latest}/{envname} PY_COLORS=1 ANSIBLE_FORCE_COLOR=1 + ANSIBLE_ROLES_PATH=../ passenv = namespace image tag diff --git a/roles/python_pip/vars/main.yml b/roles/python_pip/vars/main.yml index 3fd72f5..00232dc 100644 --- a/roles/python_pip/vars/main.yml +++ b/roles/python_pip/vars/main.yml @@ -9,14 +9,11 @@ _python_pip_packages: Debian: - python3-pip - python3-setuptools - RedHat-7: - - python2-pip - - python-setuptools RedHat: - python3-pip - python3-setuptools Suse: - - python-pip - - python-setuptools + - python3-pip + - python3-setuptools -python_pip_packages: "{{ _python_pip_packages[ansible_os_family ~ '-' ~ ansible_distribution_major_version] | default(_python_pip_packages[ansible_os_family] | default(_python_pip_packages['default'])) }}" +python_pip_packages: "{{ _python_pip_packages[ansible_os_family] | default(_python_pip_packages['default']) }}" diff --git a/roles/reboot/.ansible-lint b/roles/reboot/.ansible-lint index cb2872e..57f681e 100644 --- a/roles/reboot/.ansible-lint +++ b/roles/reboot/.ansible-lint @@ -3,5 +3,9 @@ # exclude_paths: - ./meta/preferences.yml + - ./molecule/default/prepare.yml + - ./molecule/default/converge.yml - ./molecule/default/verify.yml + - ./molecule/default/collections.yml - ./.tox + - ./.cache diff --git a/roles/reboot/.ansible-lint 2 b/roles/reboot/.ansible-lint 2 deleted file mode 100644 index cb2872e..0000000 --- a/roles/reboot/.ansible-lint 2 +++ /dev/null @@ -1,7 +0,0 @@ -# -# Ansible managed -# -exclude_paths: - - ./meta/preferences.yml - - ./molecule/default/verify.yml - - ./.tox diff --git a/roles/reboot/.github 2/FUNDING.yml b/roles/reboot/.github 2/FUNDING.yml deleted file mode 100644 index 67320f0..0000000 --- a/roles/reboot/.github 2/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -github: robertdebock diff --git a/roles/reboot/.github 2/pull_request_template.md b/roles/reboot/.github 2/pull_request_template.md deleted file mode 100644 index b1578c0..0000000 --- a/roles/reboot/.github 2/pull_request_template.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: Pull request -about: Describe the proposed change - ---- - -**Describe the change** -A clear and concise description of what the pull request is. - -**Testing** -In case a feature was added, how were tests performed? diff --git a/roles/reboot/.github 2/settings.yml b/roles/reboot/.github 2/settings.yml deleted file mode 100644 index 82c8276..0000000 --- a/roles/reboot/.github 2/settings.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# -# Ansible managed -# -repository: - description: The purpose of this role is to reboot your system. - homepage: https://robertdebock.nl/ diff --git a/roles/reboot/.github/settings.yml b/roles/reboot/.github/settings.yml index 82c8276..ddc1bf7 100644 --- a/roles/reboot/.github/settings.yml +++ b/roles/reboot/.github/settings.yml @@ -5,3 +5,4 @@ repository: description: The purpose of this role is to reboot your system. homepage: https://robertdebock.nl/ + topics: reboot, ansible, molecule, tox, playbook, hacktoberfest diff --git a/roles/reboot/.github/workflows/galaxy.yml b/roles/reboot/.github/workflows/galaxy.yml index 87ced73..1d36b74 100644 --- a/roles/reboot/.github/workflows/galaxy.yml +++ b/roles/reboot/.github/workflows/galaxy.yml @@ -6,17 +6,13 @@ name: Release to Ansible Galaxy on: - push: - tags: - - '*' - schedule: - - cron: '18 18 18 * *' - + release: + types: [created, edited, published, released] jobs: release: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: galaxy - uses: robertdebock/galaxy-action@1.0.1 + uses: robertdebock/galaxy-action@1.1.0 with: galaxy_api_key: ${{ secrets.galaxy_api_key }} diff --git a/roles/reboot/.github/workflows/molecule.yml b/roles/reboot/.github/workflows/molecule.yml index 7ef594e..18cf994 100644 --- a/roles/reboot/.github/workflows/molecule.yml +++ b/roles/reboot/.github/workflows/molecule.yml @@ -15,30 +15,28 @@ on: jobs: lint: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: checkout uses: actions/checkout@v2 with: path: "${{ github.repository }}" - name: molecule - uses: robertdebock/molecule-action@2.6.3 + uses: robertdebock/molecule-action@2.6.16 with: command: lint test: needs: - lint - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: config: - image: "alpine" tag: "latest" - - image: "alpine" - tag: "edge" - image: "amazonlinux" - tag: "1" + tag: "latest" - image: "centos" tag: "7" - image: "centos" @@ -48,7 +46,7 @@ jobs: - image: "debian" tag: "bullseye" - image: "fedora" - tag: "31" + tag: "32" - image: "fedora" tag: "latest" - image: "opensuse" @@ -57,8 +55,6 @@ jobs: tag: "latest" - image: "ubuntu" tag: "bionic" - - image: "ubuntu" - tag: "xenial" steps: - name: checkout uses: actions/checkout@v2 @@ -69,10 +65,7 @@ jobs: - name: parse apparmor for mysql run: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - name: molecule - uses: robertdebock/molecule-action@2.6.3 + uses: robertdebock/molecule-action@2.6.16 with: image: ${{ matrix.config.image }} tag: ${{ matrix.config.tag }} - options: "--parallel all" - env: - TOX_PARALLEL_NO_SPINNER: 1 diff --git a/roles/reboot/.gitignore b/roles/reboot/.gitignore index 982db11..c15d16a 100644 --- a/roles/reboot/.gitignore +++ b/roles/reboot/.gitignore @@ -2,3 +2,4 @@ *.log *.swp .tox +.cache diff --git a/roles/reboot/.gitignore 2 b/roles/reboot/.gitignore 2 deleted file mode 100644 index 982db11..0000000 --- a/roles/reboot/.gitignore 2 +++ /dev/null @@ -1,4 +0,0 @@ -.molecule -*.log -*.swp -.tox diff --git a/roles/reboot/.travis.yml b/roles/reboot/.travis.yml index 64e7245..21201e1 100644 --- a/roles/reboot/.travis.yml +++ b/roles/reboot/.travis.yml @@ -8,43 +8,23 @@ os: linux dist: xenial python: - - "3.8" + - "3.9" services: - docker -env: - global: - namespace="robertdebock" - jobs: - - image="alpine" tag="latest" - - image="alpine" tag="edge" - - image="amazonlinux" tag="1" - - image="centos" tag="7" - - image="centos" tag="latest" - - image="debian" tag="latest" - - image="debian" tag="bullseye" - - image="fedora" tag="31" - - image="fedora" tag="latest" - - image="opensuse" tag="latest" - - image="ubuntu" tag="latest" - - image="ubuntu" tag="bionic" - - image="ubuntu" tag="xenial" - cache: - pip install: - pip install --upgrade pip - - pip install tox + - pip install yamllint + - pip install ansible-lint script: - - function retry { counter=0 ; until "$@" ; do exit=$? ; counter=$(($counter + 1)) ; if [ $counter -ge 3 ] ; then return $exit ; fi ; done ; return 0; } ; retry tox --parallel all + - yamllint . + - ansible-lint notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ - slack: - secure: "GpBPK1AmC7GF6i/GmiqOen2foL/jbZHlISxRco34tgFWGszUsMV88YN4AyiU3PBH+UdqlmEE+ofKb9ugx7Bw93LC0rLMtnBqlTUA3fNLdQPl56Jwy3UlKA8A3SSyA8nMdUhj0NDh3wX4XuBJjqwbluIEsEVifSH1koWQEbEEf0qsc9fkymgvZ770JlGJNq8+oaeVtDRNQ7LCBvDDxNxwJrb5L0g9knWUF+tyO749QapQID8U1iLxeS6FK8EJp88H7N/hjfrR19r8z9TqQoTYS4UQil+fXeKNc6LuinoeUFwPc5ubH7wNMvtgEfbnDwC5w6a4Xw8TeyHM6j1FHHLwqwTGdnXzpO8ltYBYf9fnVzhh13wSJlhRfi+NzBxV8skg+U1En1RXBV2faZkqLsM7Pspx/pISJJwWfCWRuS/T7k2QkvSGjEOhjbPdCHULlkowOYmNMQNG3E7Zl6t0Fpw5l2jXuTX/ojvazqr3Mv+uEueEnF+jDP5AuuaMdLAzMVHf/nZPTPj+IaVOW95mPeWt21dXCfYOcviXFMJj+94KRfBVGRUYs+Ta8TDov3Thiq4eRmsC33ELildRMdoscP1CjLSZ02FY0cm8ZIVJNAJKKeQjsETQPv6pnQzaxB5hsR43hgtSIVTajzIZYuwEew8D4aLy3ObySUVMILhHyI2MDEw=" - on_success: change - template: "%{result}: %{repository_slug}@%{branch}, build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}>)" email: false diff --git a/roles/reboot/.yamllint b/roles/reboot/.yamllint index 894450c..a7ff098 100644 --- a/roles/reboot/.yamllint +++ b/roles/reboot/.yamllint @@ -13,3 +13,4 @@ rules: ignore: | .tox/ + .cache/ diff --git a/roles/reboot/LICENSE b/roles/reboot/LICENSE index bd15893..e770af8 100644 --- a/roles/reboot/LICENSE +++ b/roles/reboot/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 Robert de Bock (robert@meinit.nl) + Copyright 2021 Robert de Bock (robert@meinit.nl) 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/roles/reboot/README.md b/roles/reboot/README.md index 491fc01..3095185 100644 --- a/roles/reboot/README.md +++ b/roles/reboot/README.md @@ -2,9 +2,9 @@ The purpose of this role is to reboot your system. -|Travis|GitHub|Quality|Downloads|Version| +|GitHub|GitLab|Quality|Downloads|Version| |------|------|-------|---------|-------| -|[![travis](https://travis-ci.com/robertdebock/ansible-role-reboot.svg?branch=master)](https://travis-ci.com/robertdebock/ansible-role-reboot)|[![github](https://github.com/robertdebock/ansible-role-reboot/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-reboot/actions)|[![quality](https://img.shields.io/ansible/quality/30570)](https://galaxy.ansible.com/robertdebock/reboot)|[![downloads](https://img.shields.io/ansible/role/d/30570)](https://galaxy.ansible.com/robertdebock/reboot)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-reboot.svg)](https://github.com/robertdebock/ansible-role-reboot/releases/)| +|[![github](https://github.com/robertdebock/ansible-role-reboot/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-reboot/actions)|[![gitlab](https://gitlab.com/robertdebock/ansible-role-reboot/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-reboot)|[![quality](https://img.shields.io/ansible/quality/30570)](https://galaxy.ansible.com/robertdebock/reboot)|[![downloads](https://img.shields.io/ansible/role/d/30570)](https://galaxy.ansible.com/robertdebock/reboot)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-reboot.svg)](https://github.com/robertdebock/ansible-role-reboot/releases/)| ## [Example Playbook](#example-playbook) @@ -20,7 +20,7 @@ This example is taken from `molecule/resources/converge.yml` and is tested on ea - role: robertdebock.reboot ``` -The machine may need to be prepared using `molecule/resources/prepare.yml`: +The machine needs to be prepared in CI this is done using `molecule/resources/prepare.yml`: ```yaml --- - name: Prepare @@ -32,19 +32,6 @@ The machine may need to be prepared using `molecule/resources/prepare.yml`: - role: robertdebock.bootstrap ``` -For verification `molecule/resources/verify.yml` runs after the role has been applied. -```yaml ---- -- name: Verify - hosts: all - become: yes - gather_facts: no - - tasks: - - name: check if connection still works - ping: -``` - Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles. ## [Role Variables](#role-variables) @@ -70,23 +57,22 @@ reboot_message: "Ansible role robertdebock.reboot initiated a reboot." ## [Requirements](#requirements) -- Access to a repository containing packages, likely on the internet. -- A recent version of Ansible. (Tests run on the current, previous and next release of Ansible.) +- pip packages listed in [requirements.txt](https://github.com/robertdebock/ansible-role-reboot/blob/master/requirements.txt). -The following roles can be installed to ensure all requirements are met, using `ansible-galaxy install -r requirements.yml`: +## [Status of requirements](#status-of-requirements) -```yaml ---- -- robertdebock.bootstrap +The following roles are used to prepare a system. You may choose to prepare your system in another way, I have tested these roles as well. -``` +| Requirement | GitHub | GitLab | +|-------------|--------|--------| +| [robertdebock.bootstrap](https://galaxy.ansible.com/robertdebock/bootstrap) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-bootstrap/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-bootstrap/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-bootstrap/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-bootstrap) ## [Context](#context) This role is a part of many compatible roles. Have a look at [the documentation of these roles](https://robertdebock.nl/) for further information. Here is an overview of related roles: -![dependencies](https://raw.githubusercontent.com/robertdebock/drawings/artifacts/reboot.png "Dependency") +![dependencies](https://raw.githubusercontent.com/robertdebock/ansible-role-reboot/png/requirements.png "Dependencies") ## [Compatibility](#compatibility) @@ -95,55 +81,23 @@ This role has been tested on these [container images](https://hub.docker.com/u/r |container|tags| |---------|----| |alpine|all| -|amazon|2018.03| +|amazon|Candidate| |el|7, 8| |debian|buster, bullseye| -|fedora|31, 32| +|fedora|all| |opensuse|all| -|ubuntu|focal, bionic, xenial| +|ubuntu|focal, bionic| -The minimum version of Ansible required is 2.8 but tests have been done to: +The minimum version of Ansible required is 2.10, tests have been done to: -- The previous version, on version lower. +- The previous version. - The current version. - The development version. -## [Testing](#testing) - -[Unit tests](https://travis-ci.com/robertdebock/ansible-role-reboot) are done on every commit, pull request, release and periodically. - If you find issues, please register them in [GitHub](https://github.com/robertdebock/ansible-role-reboot/issues) -Testing is done using [Tox](https://tox.readthedocs.io/en/latest/) and [Molecule](https://github.com/ansible/molecule): - -[Tox](https://tox.readthedocs.io/en/latest/) tests multiple ansible versions. -[Molecule](https://github.com/ansible/molecule) tests multiple distributions. - -To test using the defaults (any installed ansible version, namespace: `robertdebock`, image: `fedora`, tag: `latest`): - -``` -molecule test - -# Or select a specific image: -image=ubuntu molecule test -# Or select a specific image and a specific tag: -image="debian" tag="stable" tox -``` - -Or you can test multiple versions of Ansible, and select images: -Tox allows multiple versions of Ansible to be tested. To run the default (namespace: `robertdebock`, image: `fedora`, tag: `latest`) tests: - -``` -tox - -# To run CentOS (namespace: `robertdebock`, tag: `latest`) -image="centos" tox -# Or customize more: -image="debian" tag="stable" tox -``` - ## [License](#license) Apache-2.0 diff --git a/roles/reboot/meta 2/.galaxy_install_info b/roles/reboot/meta 2/.galaxy_install_info deleted file mode 100644 index 7a413c2..0000000 --- a/roles/reboot/meta 2/.galaxy_install_info +++ /dev/null @@ -1,2 +0,0 @@ -install_date: Mon Sep 28 13:22:33 2020 -version: 2.6.3 diff --git a/roles/reboot/meta 2/preferences.yml b/roles/reboot/meta 2/preferences.yml deleted file mode 100644 index e7fdebf..0000000 --- a/roles/reboot/meta 2/preferences.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -tox_parallel: yes diff --git a/roles/reboot/meta/.galaxy_install_info b/roles/reboot/meta/.galaxy_install_info index 7a413c2..2f753e9 100644 --- a/roles/reboot/meta/.galaxy_install_info +++ b/roles/reboot/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Mon Sep 28 13:22:33 2020 -version: 2.6.3 +install_date: Sun Mar 21 06:59:55 2021 +version: 3.0.2 diff --git a/roles/reboot/meta/main.yml b/roles/reboot/meta/main.yml index 8adbcda..ad0bf7c 100644 --- a/roles/reboot/meta/main.yml +++ b/roles/reboot/meta/main.yml @@ -5,7 +5,7 @@ galaxy_info: description: The purpose of this role is to reboot your system. license: Apache-2.0 company: none - min_ansible_version: 2.8 + min_ansible_version: "2.10" platforms: - name: Alpine @@ -13,7 +13,7 @@ galaxy_info: - all - name: Amazon versions: - - 2018.03 + - Candidate - name: EL versions: - 7 @@ -24,8 +24,7 @@ galaxy_info: - bullseye - name: Fedora versions: - - 31 - - 32 + - all - name: OpenSUSE versions: - all @@ -33,11 +32,8 @@ galaxy_info: versions: - focal - bionic - - xenial galaxy_tags: - reboot - - centos - - redhat dependencies: [] diff --git a/roles/reboot/molecule 2/default/converge.yml b/roles/reboot/molecule 2/default/converge.yml deleted file mode 100644 index f85ea78..0000000 --- a/roles/reboot/molecule 2/default/converge.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Converge - hosts: all - become: yes - gather_facts: yes - - roles: - - role: ansible-role-reboot diff --git a/roles/reboot/molecule 2/default/prepare.yml b/roles/reboot/molecule 2/default/prepare.yml deleted file mode 100644 index feb7d81..0000000 --- a/roles/reboot/molecule 2/default/prepare.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Prepare - hosts: all - gather_facts: no - become: yes - - roles: - - role: robertdebock.bootstrap diff --git a/roles/reboot/molecule 2/default/verify.yml b/roles/reboot/molecule 2/default/verify.yml deleted file mode 100644 index b9dc6f8..0000000 --- a/roles/reboot/molecule 2/default/verify.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -- name: Verify - hosts: all - become: yes - gather_facts: no - - tasks: - - name: check if connection still works - ping: diff --git a/roles/reboot/requirements 2.yml b/roles/reboot/requirements 2.yml deleted file mode 100644 index 46dec9d..0000000 --- a/roles/reboot/requirements 2.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- robertdebock.bootstrap diff --git a/roles/reboot/requirements.yml b/roles/reboot/requirements.yml index 46dec9d..11e3224 100644 --- a/roles/reboot/requirements.yml +++ b/roles/reboot/requirements.yml @@ -1,2 +1,3 @@ --- -- robertdebock.bootstrap +roles: + - name: robertdebock.bootstrap diff --git a/roles/reboot/tasks/assert.yml b/roles/reboot/tasks/assert.yml index 7545ed6..744eced 100644 --- a/roles/reboot/tasks/assert.yml +++ b/roles/reboot/tasks/assert.yml @@ -1,30 +1,31 @@ --- + - name: test if reboot_always is set correctly - assert: + ansible.builtin.assert: that: - reboot_always is defined - - reboot_always | type_debug == "bool" + - reboot_always is boolean quiet: yes - name: test if reboot_delay is set correctly - assert: + ansible.builtin.assert: that: - reboot_delay is defined - - reboot_delay | int - - reboot_delay | int >= 0 + - reboot_delay is number + - reboot_delay >= 0 quiet: yes - name: test if reboot_up_delay is set correctly - assert: + ansible.builtin.assert: that: - reboot_up_delay is defined - - reboot_up_delay | int - - reboot_up_delay | int >= 0 + - reboot_up_delay is number + - reboot_up_delay >= 0 quiet: yes - name: test if reboot_message is set correctly - assert: + ansible.builtin.assert: that: - reboot_message is defined - - reboot_message | length > 0 + - reboot_message is string quiet: yes diff --git a/roles/reboot/tasks/main.yml b/roles/reboot/tasks/main.yml index 978ff5a..b8c84e1 100644 --- a/roles/reboot/tasks/main.yml +++ b/roles/reboot/tasks/main.yml @@ -1,49 +1,60 @@ --- # tasks file for reboot + - name: include assert.yml - include_tasks: assert.yml + import_tasks: assert.yml + run_once: yes + delegate_to: localhost - name: install requirements - package: + ansible.builtin.package: name: "{{ reboot_requirements }}" state: present -- when: - - ansible_connection != "docker" - - ansible_os_family == "RedHat" +- name: configure redhat block: - name: check for needs-restarting executable (rhel) - stat: + ansible.builtin.stat: path: /usr/bin/needs-restarting register: reboot_rhel_needs_restarting_executable - name: see if a reboot is required (rhel) - command: needs-restarting -r + ansible.builtin.command: needs-restarting -r check_mode: no register: reboot_rhel_needsrestarting - changed_when: reboot_rhel_needsrestarting.rc == 1 - failed_when: reboot_rhel_needsrestarting.rc not in [0,1] - when: reboot_rhel_needs_restarting_executable.stat.exists - -- when: + changed_when: + - reboot_rhel_needsrestarting.rc == 1 + failed_when: + - reboot_rhel_needsrestarting.rc not in [ 0, 1 ] + when: + - reboot_rhel_needs_restarting_executable.stat.exists + when: - ansible_connection != "docker" - - ansible_os_family == "Debian" + - ansible_os_family == "RedHat" + +- name: configure debian block: - name: check for needrestart executable (debian) - stat: + ansible.builtin.stat: path: /usr/sbin/needrestart register: reboot_debian_needsrestart_executable - name: see if a reboot is required (debian) - command: needrestart -b + ansible.builtin.command: needrestart -b check_mode: no register: reboot_debian_needrestarting - changed_when: "'NEEDRESTART-KSTA: 3' in reboot_debian_needrestarting.stdout_lines" - when: reboot_debian_needsrestart_executable.stat.exists + changed_when: + - "'NEEDRESTART-KSTA: 3' in reboot_debian_needrestarting.stdout_lines" + when: + - reboot_debian_needsrestart_executable.stat.exists + when: + - ansible_connection != "docker" + - ansible_os_family == "Debian" -- when: +- name: include reboot + ansible.builtin.include_tasks: reboot.yml + when: - ansible_connection != "docker" - (reboot_always | bool) or (reboot_rhel_needsrestarting.changed | default(no)) or (reboot_debian_needrestarting.changed | default(no)) - include_tasks: reboot.yml diff --git a/roles/reboot/tasks/reboot.yml b/roles/reboot/tasks/reboot.yml index 6ec6461..309c714 100644 --- a/roles/reboot/tasks/reboot.yml +++ b/roles/reboot/tasks/reboot.yml @@ -1,20 +1,20 @@ --- - name: flush notified handlers - meta: flush_handlers + ansible.builtin.meta: flush_handlers - name: reboot the machine - shell: "(sleep {{ reboot_delay }} && {{ reboot_command }} &)" # noqa 301 This was before the reboot module existed. + ansible.builtin.shell: "(sleep {{ reboot_delay }} && {{ reboot_command }} &)" # noqa 301 This was before the reboot module existed. async: 1 poll: 0 ignore_errors: yes - name: 1 wait for the start of reboot - pause: + ansible.builtin.pause: seconds: "{{ reboot_delay }}" - name: 2 wait for the machine to be up - wait_for_connection: + ansible.builtin.wait_for: delay: "{{ reboot_up_delay }}" - name: 3 gather facts after reboot - setup: + ansible.builtin.setup: diff --git a/roles/reboot/tox.ini b/roles/reboot/tox.ini index c94adfa..f57553b 100644 --- a/roles/reboot/tox.ini +++ b/roles/reboot/tox.ini @@ -2,22 +2,25 @@ # Ansible managed # [tox] -minversion = 3.7 -envlist = py{38}-ansible-{previous,current,next} +minversion = 3.21.4 +# 2.11 has been disabled: couldn't resolve module/action 'docker_container'. +envlist = py{39}-ansible-{2.9,2.10} + skipsdist = true [testenv] deps = - previous: ansible>=2.9, <2.10 - current: ansible - next: git+https://github.com/ansible/ansible.git@devel - molecule[lint]>=3, <4 - docker>=4.2, <4.3 + 2.9: ansible == 2.9.* + 2.10: ansible == 2.10.* + 2.11: git+https://github.com/ansible/ansible.git@devel + molecule[docker] + docker == 4.* + ansible-lint == 5.* commands = molecule test setenv = TOX_ENVNAME={envname} - MOLECULE_EPHEMERAL_DIRECTORY=/tmp/.molecule/{env:image:fedora}-{env:tag:latest}/{envname} PY_COLORS=1 ANSIBLE_FORCE_COLOR=1 + ANSIBLE_ROLES_PATH=../ passenv = namespace image tag diff --git a/roles/ruby/.ansible-lint b/roles/ruby/.ansible-lint index acb2d05..57f681e 100644 --- a/roles/ruby/.ansible-lint +++ b/roles/ruby/.ansible-lint @@ -3,4 +3,9 @@ # exclude_paths: - ./meta/preferences.yml + - ./molecule/default/prepare.yml + - ./molecule/default/converge.yml - ./molecule/default/verify.yml + - ./molecule/default/collections.yml + - ./.tox + - ./.cache diff --git a/roles/ruby/.ansible-lint 2 b/roles/ruby/.ansible-lint 2 deleted file mode 100644 index acb2d05..0000000 --- a/roles/ruby/.ansible-lint 2 +++ /dev/null @@ -1,6 +0,0 @@ -# -# Ansible managed -# -exclude_paths: - - ./meta/preferences.yml - - ./molecule/default/verify.yml diff --git a/roles/ruby/.github 2/FUNDING.yml b/roles/ruby/.github 2/FUNDING.yml deleted file mode 100644 index 67320f0..0000000 --- a/roles/ruby/.github 2/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -github: robertdebock diff --git a/roles/ruby/.github 2/pull_request_template.md b/roles/ruby/.github 2/pull_request_template.md deleted file mode 100644 index b1578c0..0000000 --- a/roles/ruby/.github 2/pull_request_template.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: Pull request -about: Describe the proposed change - ---- - -**Describe the change** -A clear and concise description of what the pull request is. - -**Testing** -In case a feature was added, how were tests performed? diff --git a/roles/ruby/.github 2/settings.yml b/roles/ruby/.github 2/settings.yml deleted file mode 100644 index 6a92b70..0000000 --- a/roles/ruby/.github 2/settings.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# -# Ansible managed -# -repository: - description: Install ruby on your system. - homepage: https://robertdebock.nl/ diff --git a/roles/ruby/.github/settings.yml b/roles/ruby/.github/settings.yml index 6a92b70..477c762 100644 --- a/roles/ruby/.github/settings.yml +++ b/roles/ruby/.github/settings.yml @@ -5,3 +5,4 @@ repository: description: Install ruby on your system. homepage: https://robertdebock.nl/ + topics: ruby, installer, package, ansible, molecule, tox, playbook, hacktoberfest diff --git a/roles/ruby/.github/workflows/galaxy.yml b/roles/ruby/.github/workflows/galaxy.yml index 87ced73..1d36b74 100644 --- a/roles/ruby/.github/workflows/galaxy.yml +++ b/roles/ruby/.github/workflows/galaxy.yml @@ -6,17 +6,13 @@ name: Release to Ansible Galaxy on: - push: - tags: - - '*' - schedule: - - cron: '18 18 18 * *' - + release: + types: [created, edited, published, released] jobs: release: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: galaxy - uses: robertdebock/galaxy-action@1.0.1 + uses: robertdebock/galaxy-action@1.1.0 with: galaxy_api_key: ${{ secrets.galaxy_api_key }} diff --git a/roles/ruby/.github/workflows/molecule.yml b/roles/ruby/.github/workflows/molecule.yml index 355a68d..18cf994 100644 --- a/roles/ruby/.github/workflows/molecule.yml +++ b/roles/ruby/.github/workflows/molecule.yml @@ -15,30 +15,28 @@ on: jobs: lint: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: checkout uses: actions/checkout@v2 with: path: "${{ github.repository }}" - name: molecule - uses: robertdebock/molecule-action@2.6.1 + uses: robertdebock/molecule-action@2.6.16 with: command: lint test: needs: - lint - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: config: - image: "alpine" tag: "latest" - - image: "alpine" - tag: "edge" - image: "amazonlinux" - tag: "1" + tag: "latest" - image: "centos" tag: "7" - image: "centos" @@ -48,7 +46,7 @@ jobs: - image: "debian" tag: "bullseye" - image: "fedora" - tag: "31" + tag: "32" - image: "fedora" tag: "latest" - image: "opensuse" @@ -57,8 +55,6 @@ jobs: tag: "latest" - image: "ubuntu" tag: "bionic" - - image: "ubuntu" - tag: "xenial" steps: - name: checkout uses: actions/checkout@v2 @@ -69,10 +65,7 @@ jobs: - name: parse apparmor for mysql run: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - name: molecule - uses: robertdebock/molecule-action@2.6.1 + uses: robertdebock/molecule-action@2.6.16 with: image: ${{ matrix.config.image }} tag: ${{ matrix.config.tag }} - options: "--parallel all" - env: - TOX_PARALLEL_NO_SPINNER: 1 diff --git a/roles/ruby/.gitignore b/roles/ruby/.gitignore index 982db11..c15d16a 100644 --- a/roles/ruby/.gitignore +++ b/roles/ruby/.gitignore @@ -2,3 +2,4 @@ *.log *.swp .tox +.cache diff --git a/roles/ruby/.gitignore 2 b/roles/ruby/.gitignore 2 deleted file mode 100644 index 982db11..0000000 --- a/roles/ruby/.gitignore 2 +++ /dev/null @@ -1,4 +0,0 @@ -.molecule -*.log -*.swp -.tox diff --git a/roles/ruby/.travis.yml b/roles/ruby/.travis.yml index eae6e48..21201e1 100644 --- a/roles/ruby/.travis.yml +++ b/roles/ruby/.travis.yml @@ -4,41 +4,27 @@ # language: python +os: linux +dist: xenial + python: - - "3.8" + - "3.9" services: - docker -env: - global: - namespace="robertdebock" - matrix: - - image="alpine" tag="latest" - - image="alpine" tag="edge" - - image="amazonlinux" tag="1" - - image="centos" tag="7" - - image="centos" tag="latest" - - image="debian" tag="latest" - - image="debian" tag="bullseye" - - image="fedora" tag="31" - - image="fedora" tag="latest" - - image="opensuse" tag="latest" - - image="ubuntu" tag="latest" - - image="ubuntu" tag="bionic" - - image="ubuntu" tag="xenial" - cache: - pip install: - pip install --upgrade pip - - pip install tox + - pip install yamllint + - pip install ansible-lint script: - - function retry { counter=0 ; until "$@" ; do exit=$? ; counter=$(($counter + 1)) ; if [ $counter -ge 3 ] ; then return $exit ; fi ; done ; return 0; } ; retry tox --parallel all + - yamllint . + - ansible-lint notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ - slack: "dr3U8w5uZK/8zr6PK0vkb8Mw2yINvH0F7UyftkVl8ex6M1qrO9ie5h8vvr5bEF9S/H5gpR+UBJfCBlRbXwEvTPyCBhinMBfMl7zfooOgShBcNYK/KpNHVcHui/dE8dMEWD5y1bkaA8D3EuGBQSRIBd+qNfT+C32jbkTJdn/JisOpXUeSJDeWubVs/pB0pq6i93VNgJGgs81mhUhZK15RaVzHhlbCn+uCyASy5jTnycA/MbzPBtRoMX2zqTHyMc4jcM2Dl3lRxzT6H7EeAyQE4fkGet2RLnsSzsVkcHArJpIXptsdj8VNJIYNALspb97LTkBwfGah5UQoMhXLA8wbU9ovjUNMAXtlODb8l2HEw4gQkj39/A6kVBqsIkob7TZu3T6OfilEb4g/bTBQJPtJLS9PhbUGDZsUPosFVumRWz8DCN9KyGM5S0u1wQr+9ShJ+0LgRuSeHtRIR8ccEsdqs5tg1FYlCyS3puJta4O0n0urUfekbs30gbBvujVKkIMK1g+LVFAXI7gBlcGCgP5vpyKa4xxF4Aw+0niOQbfJR8K6BrT8/FlzLqOBRhaM6HcHte5xC0eAJLKsnV3H8c/UUAcULAixFbtAcH5mIDyKQs1aV2pnto8/ZGdj0/sZkq36guAliDoAYY5aIm+YVBXUXQGvJs55HXz4itsNu9i73qo=" email: false diff --git a/roles/ruby/.yamllint b/roles/ruby/.yamllint index c5ae64b..a7ff098 100644 --- a/roles/ruby/.yamllint +++ b/roles/ruby/.yamllint @@ -10,3 +10,7 @@ rules: level: error line-length: disable truthy: disable + +ignore: | + .tox/ + .cache/ diff --git a/roles/ruby/LICENSE b/roles/ruby/LICENSE index bd15893..e770af8 100644 --- a/roles/ruby/LICENSE +++ b/roles/ruby/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 Robert de Bock (robert@meinit.nl) + Copyright 2021 Robert de Bock (robert@meinit.nl) 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/roles/ruby/README.md b/roles/ruby/README.md index 52ec45d..d4ab45e 100644 --- a/roles/ruby/README.md +++ b/roles/ruby/README.md @@ -2,9 +2,9 @@ Install ruby on your system. -|Travis|GitHub|Quality|Downloads|Version| +|GitHub|GitLab|Quality|Downloads|Version| |------|------|-------|---------|-------| -|[![travis](https://travis-ci.com/robertdebock/ansible-role-ruby.svg?branch=master)](https://travis-ci.com/robertdebock/ansible-role-ruby)|[![github](https://github.com/robertdebock/ansible-role-ruby/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-ruby/actions)|[![quality](https://img.shields.io/ansible/quality/21976)](https://galaxy.ansible.com/robertdebock/ruby)|[![downloads](https://img.shields.io/ansible/role/d/21976)](https://galaxy.ansible.com/robertdebock/ruby)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-ruby.svg)](https://github.com/robertdebock/ansible-role-ruby/releases/)| +|[![github](https://github.com/robertdebock/ansible-role-ruby/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-ruby/actions)|[![gitlab](https://gitlab.com/robertdebock/ansible-role-ruby/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-ruby)|[![quality](https://img.shields.io/ansible/quality/21976)](https://galaxy.ansible.com/robertdebock/ruby)|[![downloads](https://img.shields.io/ansible/role/d/21976)](https://galaxy.ansible.com/robertdebock/ruby)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-ruby.svg)](https://github.com/robertdebock/ansible-role-ruby/releases/)| ## [Example Playbook](#example-playbook) @@ -20,7 +20,7 @@ This example is taken from `molecule/resources/converge.yml` and is tested on ea - role: robertdebock.ruby ``` -The machine may need to be prepared using `molecule/resources/prepare.yml`: +The machine needs to be prepared in CI this is done using `molecule/resources/prepare.yml`: ```yaml --- - name: Prepare @@ -32,41 +32,27 @@ The machine may need to be prepared using `molecule/resources/prepare.yml`: - role: robertdebock.bootstrap ``` -For verification `molecule/resources/verify.yml` run after the role has been applied. -```yaml ---- -- name: Verify - hosts: all - become: yes - gather_facts: yes - - tasks: - - name: check if connection still works - ping: -``` - Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles. ## [Requirements](#requirements) -- Access to a repository containing packages, likely on the internet. -- A recent version of Ansible. (Tests run on the current, previous and next release of Ansible.) +- pip packages listed in [requirements.txt](https://github.com/robertdebock/ansible-role-ruby/blob/master/requirements.txt). -The following roles can be installed to ensure all requirements are met, using `ansible-galaxy install -r requirements.yml`: +## [Status of requirements](#status-of-requirements) -```yaml ---- -- robertdebock.bootstrap +The following roles are used to prepare a system. You may choose to prepare your system in another way, I have tested these roles as well. -``` +| Requirement | GitHub | GitLab | +|-------------|--------|--------| +| [robertdebock.bootstrap](https://galaxy.ansible.com/robertdebock/bootstrap) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-bootstrap/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-bootstrap/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-bootstrap/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-bootstrap) ## [Context](#context) This role is a part of many compatible roles. Have a look at [the documentation of these roles](https://robertdebock.nl/) for further information. Here is an overview of related roles: -![dependencies](https://raw.githubusercontent.com/robertdebock/drawings/artifacts/ruby.png "Dependency") +![dependencies](https://raw.githubusercontent.com/robertdebock/ansible-role-ruby/png/requirements.png "Dependencies") ## [Compatibility](#compatibility) @@ -75,55 +61,23 @@ This role has been tested on these [container images](https://hub.docker.com/u/r |container|tags| |---------|----| |alpine|all| -|amazon|2018.03| +|amazon|Candidate| |el|7, 8| |debian|buster, bullseye| -|fedora|31, 32| +|fedora|all| |opensuse|all| -|ubuntu|focal, bionic, xenial| +|ubuntu|focal, bionic| -The minimum version of Ansible required is 2.8 but tests have been done to: +The minimum version of Ansible required is 2.10, tests have been done to: -- The previous version, on version lower. +- The previous version. - The current version. - The development version. -## [Testing](#testing) - -[Unit tests](https://travis-ci.com/robertdebock/ansible-role-ruby) are done on every commit, pull request, release and periodically. - If you find issues, please register them in [GitHub](https://github.com/robertdebock/ansible-role-ruby/issues) -Testing is done using [Tox](https://tox.readthedocs.io/en/latest/) and [Molecule](https://github.com/ansible/molecule): - -[Tox](https://tox.readthedocs.io/en/latest/) tests multiple ansible versions. -[Molecule](https://github.com/ansible/molecule) tests multiple distributions. - -To test using the defaults (any installed ansible version, namespace: `robertdebock`, image: `fedora`, tag: `latest`): - -``` -molecule test - -# Or select a specific image: -image=ubuntu molecule test -# Or select a specific image and a specific tag: -image="debian" tag="stable" tox -``` - -Or you can test multiple versions of Ansible, and select images: -Tox allows multiple versions of Ansible to be tested. To run the default (namespace: `robertdebock`, image: `fedora`, tag: `latest`) tests: - -``` -tox - -# To run CentOS (namespace: `robertdebock`, tag: `latest`) -image="centos" tox -# Or customize more: -image="debian" tag="stable" tox -``` - ## [License](#license) Apache-2.0 diff --git a/roles/ruby/meta 2/.galaxy_install_info b/roles/ruby/meta 2/.galaxy_install_info deleted file mode 100644 index eeb3a8e..0000000 --- a/roles/ruby/meta 2/.galaxy_install_info +++ /dev/null @@ -1,2 +0,0 @@ -install_date: Mon Sep 28 13:22:36 2020 -version: 2.2.9 diff --git a/roles/ruby/meta 2/preferences.yml b/roles/ruby/meta 2/preferences.yml deleted file mode 100644 index e7fdebf..0000000 --- a/roles/ruby/meta 2/preferences.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -tox_parallel: yes diff --git a/roles/ruby/meta/.galaxy_install_info b/roles/ruby/meta/.galaxy_install_info index eeb3a8e..5214de1 100644 --- a/roles/ruby/meta/.galaxy_install_info +++ b/roles/ruby/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Mon Sep 28 13:22:36 2020 -version: 2.2.9 +install_date: Sun Mar 21 06:59:58 2021 +version: 3.0.0 diff --git a/roles/ruby/meta/main.yml b/roles/ruby/meta/main.yml index afc8b6e..6588169 100644 --- a/roles/ruby/meta/main.yml +++ b/roles/ruby/meta/main.yml @@ -5,7 +5,7 @@ galaxy_info: description: Install ruby on your system. license: Apache-2.0 company: none - min_ansible_version: 2.8 + min_ansible_version: "2.10" platforms: - name: Alpine @@ -13,7 +13,7 @@ galaxy_info: - all - name: Amazon versions: - - 2018.03 + - Candidate - name: EL versions: - 7 @@ -24,8 +24,7 @@ galaxy_info: - bullseye - name: Fedora versions: - - 31 - - 32 + - all - name: OpenSUSE versions: - all @@ -33,13 +32,10 @@ galaxy_info: versions: - focal - bionic - - xenial galaxy_tags: - ruby - installer - package - - centos - - redhat dependencies: [] diff --git a/roles/ruby/molecule 2/default/converge.yml b/roles/ruby/molecule 2/default/converge.yml deleted file mode 100644 index b12ce21..0000000 --- a/roles/ruby/molecule 2/default/converge.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Converge - hosts: all - become: yes - gather_facts: yes - - roles: - - role: ansible-role-ruby diff --git a/roles/ruby/molecule 2/default/prepare.yml b/roles/ruby/molecule 2/default/prepare.yml deleted file mode 100644 index f76c7bf..0000000 --- a/roles/ruby/molecule 2/default/prepare.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Prepare - hosts: all - become: yes - gather_facts: no - - roles: - - role: robertdebock.bootstrap diff --git a/roles/ruby/molecule 2/default/verify.yml b/roles/ruby/molecule 2/default/verify.yml deleted file mode 100644 index 6ab75cf..0000000 --- a/roles/ruby/molecule 2/default/verify.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -- name: Verify - hosts: all - become: yes - gather_facts: yes - - tasks: - - name: check if connection still works - ping: diff --git a/roles/ruby/molecule/default/molecule.yml b/roles/ruby/molecule/default/molecule.yml index 50fce5f..c205e89 100644 --- a/roles/ruby/molecule/default/molecule.yml +++ b/roles/ruby/molecule/default/molecule.yml @@ -7,9 +7,9 @@ dependency: options: role-file: requirements.yml lint: | - PATH=${PATH} - yamllint molecule/default/converge.yml - ansible-lint molecule/default/converge.yml + set -e + yamllint . + ansible-lint driver: name: docker platforms: diff --git a/roles/ruby/molecule/default/verify.yml b/roles/ruby/molecule/default/verify.yml index 6ab75cf..b9dc6f8 100644 --- a/roles/ruby/molecule/default/verify.yml +++ b/roles/ruby/molecule/default/verify.yml @@ -2,7 +2,7 @@ - name: Verify hosts: all become: yes - gather_facts: yes + gather_facts: no tasks: - name: check if connection still works diff --git a/roles/ruby/requirements 2.yml b/roles/ruby/requirements 2.yml deleted file mode 100644 index 46dec9d..0000000 --- a/roles/ruby/requirements 2.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- robertdebock.bootstrap diff --git a/roles/ruby/requirements.yml b/roles/ruby/requirements.yml index 46dec9d..11e3224 100644 --- a/roles/ruby/requirements.yml +++ b/roles/ruby/requirements.yml @@ -1,2 +1,3 @@ --- -- robertdebock.bootstrap +roles: + - name: robertdebock.bootstrap diff --git a/roles/ruby/tasks 2/main.yml b/roles/ruby/tasks 2/main.yml deleted file mode 100644 index 9817d7a..0000000 --- a/roles/ruby/tasks 2/main.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -# tasks file for ruby -- name: install ruby - package: - name: "{{ ruby_packages }}" diff --git a/roles/ruby/tasks/main.yml b/roles/ruby/tasks/main.yml index 9817d7a..05131e7 100644 --- a/roles/ruby/tasks/main.yml +++ b/roles/ruby/tasks/main.yml @@ -1,5 +1,6 @@ --- # tasks file for ruby + - name: install ruby - package: + ansible.builtin.package: name: "{{ ruby_packages }}" diff --git a/roles/ruby/tox.ini b/roles/ruby/tox.ini index c1bc1d4..f57553b 100644 --- a/roles/ruby/tox.ini +++ b/roles/ruby/tox.ini @@ -2,25 +2,25 @@ # Ansible managed # [tox] -minversion = 3.7 -# Disabled "next" because of: -# https://github.com/ansible-community/molecule/issues/2626. -# envlist = py{38}-ansible-{previous,current,next} -envlist = py{38}-ansible-{previous,current} +minversion = 3.21.4 +# 2.11 has been disabled: couldn't resolve module/action 'docker_container'. +envlist = py{39}-ansible-{2.9,2.10} + skipsdist = true [testenv] deps = - previous: ansible>=2.8, <2.9 - current: ansible>=2.9 - next: git+https://github.com/ansible/ansible.git@devel - molecule[lint]>=3, <4 - docker>=4.2, <4.3 + 2.9: ansible == 2.9.* + 2.10: ansible == 2.10.* + 2.11: git+https://github.com/ansible/ansible.git@devel + molecule[docker] + docker == 4.* + ansible-lint == 5.* commands = molecule test setenv = TOX_ENVNAME={envname} - MOLECULE_EPHEMERAL_DIRECTORY=/tmp/.molecule/{env:image:fedora}-{env:tag:latest}/{envname} PY_COLORS=1 ANSIBLE_FORCE_COLOR=1 + ANSIBLE_ROLES_PATH=../ passenv = namespace image tag diff --git a/roles/ruby/vars 2/main.yml b/roles/ruby/vars 2/main.yml deleted file mode 100644 index 275d903..0000000 --- a/roles/ruby/vars 2/main.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -# vars file for ruby - -ruby_packages: - - ruby diff --git a/roles/service/.ansible-lint b/roles/service/.ansible-lint index cb2872e..57f681e 100644 --- a/roles/service/.ansible-lint +++ b/roles/service/.ansible-lint @@ -3,5 +3,9 @@ # exclude_paths: - ./meta/preferences.yml + - ./molecule/default/prepare.yml + - ./molecule/default/converge.yml - ./molecule/default/verify.yml + - ./molecule/default/collections.yml - ./.tox + - ./.cache diff --git a/roles/service/.ansible-lint 2 b/roles/service/.ansible-lint 2 deleted file mode 100644 index cb2872e..0000000 --- a/roles/service/.ansible-lint 2 +++ /dev/null @@ -1,7 +0,0 @@ -# -# Ansible managed -# -exclude_paths: - - ./meta/preferences.yml - - ./molecule/default/verify.yml - - ./.tox diff --git a/roles/service/.github 2/FUNDING.yml b/roles/service/.github 2/FUNDING.yml deleted file mode 100644 index 67320f0..0000000 --- a/roles/service/.github 2/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -github: robertdebock diff --git a/roles/service/.github 2/pull_request_template.md b/roles/service/.github 2/pull_request_template.md deleted file mode 100644 index b1578c0..0000000 --- a/roles/service/.github 2/pull_request_template.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: Pull request -about: Describe the proposed change - ---- - -**Describe the change** -A clear and concise description of what the pull request is. - -**Testing** -In case a feature was added, how were tests performed? diff --git a/roles/service/.github 2/settings.yml b/roles/service/.github 2/settings.yml deleted file mode 100644 index 8bb3037..0000000 --- a/roles/service/.github 2/settings.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# -# Ansible managed -# -repository: - description: Add custom services to your Linux system. - homepage: https://robertdebock.nl/ diff --git a/roles/service/.github/settings.yml b/roles/service/.github/settings.yml index 8bb3037..549f114 100644 --- a/roles/service/.github/settings.yml +++ b/roles/service/.github/settings.yml @@ -5,3 +5,4 @@ repository: description: Add custom services to your Linux system. homepage: https://robertdebock.nl/ + topics: service, ansible, molecule, tox, playbook, hacktoberfest diff --git a/roles/service/.github/workflows/galaxy.yml b/roles/service/.github/workflows/galaxy.yml index 2912ff8..1d36b74 100644 --- a/roles/service/.github/workflows/galaxy.yml +++ b/roles/service/.github/workflows/galaxy.yml @@ -6,17 +6,13 @@ name: Release to Ansible Galaxy on: - push: - tags: - - '*' - schedule: - - cron: '19 19 19 * *' - + release: + types: [created, edited, published, released] jobs: release: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: galaxy - uses: robertdebock/galaxy-action@1.0.1 + uses: robertdebock/galaxy-action@1.1.0 with: galaxy_api_key: ${{ secrets.galaxy_api_key }} diff --git a/roles/service/.github/workflows/molecule.yml b/roles/service/.github/workflows/molecule.yml index 0c2da96..5fd95f0 100644 --- a/roles/service/.github/workflows/molecule.yml +++ b/roles/service/.github/workflows/molecule.yml @@ -15,30 +15,24 @@ on: jobs: lint: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: checkout uses: actions/checkout@v2 with: path: "${{ github.repository }}" - name: molecule - uses: robertdebock/molecule-action@2.6.1 + uses: robertdebock/molecule-action@2.6.16 with: command: lint test: needs: - lint - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: config: - - image: "alpine" - tag: "latest" - - image: "alpine" - tag: "edge" - - image: "amazonlinux" - tag: "1" - image: "centos" tag: "7" - image: "centos" @@ -48,7 +42,7 @@ jobs: - image: "debian" tag: "bullseye" - image: "fedora" - tag: "31" + tag: "32" - image: "fedora" tag: "latest" - image: "opensuse" @@ -57,8 +51,6 @@ jobs: tag: "latest" - image: "ubuntu" tag: "bionic" - - image: "ubuntu" - tag: "xenial" steps: - name: checkout uses: actions/checkout@v2 @@ -69,10 +61,7 @@ jobs: - name: parse apparmor for mysql run: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - name: molecule - uses: robertdebock/molecule-action@2.6.1 + uses: robertdebock/molecule-action@2.6.16 with: image: ${{ matrix.config.image }} tag: ${{ matrix.config.tag }} - options: "--parallel all" - env: - TOX_PARALLEL_NO_SPINNER: 1 diff --git a/roles/service/.gitignore b/roles/service/.gitignore index 982db11..c15d16a 100644 --- a/roles/service/.gitignore +++ b/roles/service/.gitignore @@ -2,3 +2,4 @@ *.log *.swp .tox +.cache diff --git a/roles/service/.gitignore 2 b/roles/service/.gitignore 2 deleted file mode 100644 index 982db11..0000000 --- a/roles/service/.gitignore 2 +++ /dev/null @@ -1,4 +0,0 @@ -.molecule -*.log -*.swp -.tox diff --git a/roles/service/.travis.yml b/roles/service/.travis.yml index 8d33abd..21201e1 100644 --- a/roles/service/.travis.yml +++ b/roles/service/.travis.yml @@ -8,43 +8,23 @@ os: linux dist: xenial python: - - "3.8" + - "3.9" services: - docker -env: - global: - namespace="robertdebock" - jobs: - - image="alpine" tag="latest" - - image="alpine" tag="edge" - - image="amazonlinux" tag="1" - - image="centos" tag="7" - - image="centos" tag="latest" - - image="debian" tag="latest" - - image="debian" tag="bullseye" - - image="fedora" tag="31" - - image="fedora" tag="latest" - - image="opensuse" tag="latest" - - image="ubuntu" tag="latest" - - image="ubuntu" tag="bionic" - - image="ubuntu" tag="xenial" - cache: - pip install: - pip install --upgrade pip - - pip install tox + - pip install yamllint + - pip install ansible-lint script: - - function retry { counter=0 ; until "$@" ; do exit=$? ; counter=$(($counter + 1)) ; if [ $counter -ge 3 ] ; then return $exit ; fi ; done ; return 0; } ; retry tox --parallel all + - yamllint . + - ansible-lint notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ - slack: - secure: "gmZzWPhCQnjVNy1tspnMqRiyHiyQ7QJgqEXFHyuhxdlfF0lwi9beFfXDSZnP33hIK5cOwj8M8EETADVb8MTTtmY/lJQ+4exiPoyG44gfWkREjkzOz8UT2z1TXzecBfoRF+BQ3vIR9tkbOPPJFNI4+3vZ6p3tl8wbaxgl2Hthp0QjyieBpcpvQENCccy19g/xwAkEUKDQ8D4ojW70BJxd3WcUEVSONB4bSldEDP6gOlWgkgzdY9RJmyxF36WbQi5gc+j8Tht8cqT+IfCtIs94nugpQjK6x7xHloxDJHWJcSF4L86Ph5IYeoKvL8rB0yOeEqLIKzHa5SeRIJPs6rzgo44dQ4CMYUljO6vcBWxNrt+IuJPTaFiPXs6E+qeygAWUKjtGAzP/271DzCnzDOSx6lby2bECk3+8CGWCOm3B2taK10DS8xq+BL2/UCtVInsEgYBJAlX6uCgK2IjuyTVAcBFfcs5P30drd+77xfN4ESEoA9s08XRm+p+BSJWtfN7aUkcZj9aqX2LeiMUi+6ClbQJzG5c3vs8CtbNS1mukZqrNs4J6GrB86JmPYhsIg/CkiJgTMBKaQvEV2ZWoCUPnR/udpSTvz713BvJ0T9e7wGHTkVlosa66px25eASkEmJuHEw2Qs/7U1hVFEP+rDjd7zhyM0f1xKv0/i88LVoLirs=" - on_success: change - template: "%{result}: %{repository_slug}@%{branch}, build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}>)" email: false diff --git a/roles/service/.yamllint b/roles/service/.yamllint index 894450c..a7ff098 100644 --- a/roles/service/.yamllint +++ b/roles/service/.yamllint @@ -13,3 +13,4 @@ rules: ignore: | .tox/ + .cache/ diff --git a/roles/service/LICENSE b/roles/service/LICENSE index bd15893..e770af8 100644 --- a/roles/service/LICENSE +++ b/roles/service/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 Robert de Bock (robert@meinit.nl) + Copyright 2021 Robert de Bock (robert@meinit.nl) 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/roles/service/README.md b/roles/service/README.md index eb8c78e..445e83b 100644 --- a/roles/service/README.md +++ b/roles/service/README.md @@ -2,9 +2,9 @@ Add custom services to your Linux system. -|Travis|GitHub|Quality|Downloads|Version| +|GitHub|GitLab|Quality|Downloads|Version| |------|------|-------|---------|-------| -|[![travis](https://travis-ci.com/robertdebock/ansible-role-service.svg?branch=master)](https://travis-ci.com/robertdebock/ansible-role-service)|[![github](https://github.com/robertdebock/ansible-role-service/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-service/actions)|[![quality](https://img.shields.io/ansible/quality/38040)](https://galaxy.ansible.com/robertdebock/service)|[![downloads](https://img.shields.io/ansible/role/d/38040)](https://galaxy.ansible.com/robertdebock/service)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-service.svg)](https://github.com/robertdebock/ansible-role-service/releases/)| +|[![github](https://github.com/robertdebock/ansible-role-service/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-service/actions)|[![gitlab](https://gitlab.com/robertdebock/ansible-role-service/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-service)|[![quality](https://img.shields.io/ansible/quality/38040)](https://galaxy.ansible.com/robertdebock/service)|[![downloads](https://img.shields.io/ansible/role/d/38040)](https://galaxy.ansible.com/robertdebock/service)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-service.svg)](https://github.com/robertdebock/ansible-role-service/releases/)| ## [Example Playbook](#example-playbook) @@ -20,45 +20,57 @@ This example is taken from `molecule/resources/converge.yml` and is tested on ea _service_test_command: default: /usr/bin/sleep Alpine: /bin/sleep - - service_test_command: "{{ _service_test_command[ansible_os_family] | default(_service_test_command['default']) }}" - - service_list: - - name: simple-service - description: Simple Service - start_command: "{{ service_test_command }} 3600" - - name: forking-service - description: Forking Service - type: forking - start_command: "{{ service_test_command }} 7200 &" - - name: specific-stop-service - description: Specific Stop Service - start_command: "{{ service_test_command }} 1440" - stop_command: killall -f "sleep 1440" - - name: specific-user-group-service - description: Specific User Group Service - start_command: "{{ service_test_command }} 28800" - user_name: root - group_name: root - - name: specific-workingdirectory-service - description: Specific WorkingDirectory Service - start_command: "{{ service_test_command }} 57600" - working_directory: /tmp - - name: specific-pattern-service - description: Specific Status Pattern Service - start_command: "{{ service_test_command }} 115200" - status_pattern: 115200 - - name: variable-service - description: Service with environment variables - start_command: "{{ service_test_command }} ${time}" - environment_variables: - time: 230400 + Debian: /bin/sleep + Ubuntu-16: /bin/sleep + Ubuntu-18: /bin/sleep + service_test_command: "{{ _service_test_command[ansible_distribution ~ '-' ~ ansible_distribution_major_version] | default(_service_test_command[ansible_os_family] | default(_service_test_command['default'])) }}" # noqa 204 Just long. roles: - role: robertdebock.service + service_list: + - name: simple-service + description: Simple Service + start_command: "{{ service_test_command }} 3600" + state: started + enabled: yes + - name: stopped-service + description: Simple Service + start_command: "{{ service_test_command }} 3601" + state: stopped + enabled: no + - name: specific-stop-service + description: Specific Stop Service + start_command: "{{ service_test_command }} 1440" + stop_command: /usr/bin/killall -f "sleep 1440" + - name: specific-user-group-service + description: Specific User Group Service + start_command: "{{ service_test_command }} 28800" + user_name: root + group_name: root + - name: specific-workingdirectory-service + description: Specific WorkingDirectory Service + start_command: "{{ service_test_command }} 57600" + working_directory: /tmp + - name: specific-pattern-service + description: Specific Status Pattern Service + start_command: "{{ service_test_command }} 115200" + status_pattern: 115200 + - name: variable-service + description: Service with environment variables + start_command: "{{ service_test_command }} ${time}" + environment_variables: + time: 230400 + - name: pidfile-service + description: Service with pidfile + start_command: "{{ service_test_command }} 460800" + pidfile: /var/run/pidfile-service.pid + - name: environmentfile-service + description: Service with environmentfile + start_command: "{{ service_test_command }} 921600" + environmentfile: /environmentfile.txt ``` -The machine may need to be prepared using `molecule/resources/prepare.yml`: +The machine needs to be prepared in CI this is done using `molecule/resources/prepare.yml`: ```yaml --- - name: Prepare @@ -69,35 +81,13 @@ The machine may need to be prepared using `molecule/resources/prepare.yml`: roles: - role: robertdebock.bootstrap -``` -For verification `molecule/resources/verify.yml` run after the role has been applied. -```yaml ---- -- name: Verify - hosts: all - become: yes - gather_facts: yes - - vars: - service_list: - - name: simple-service - - tasks: - - name: start simple-service - service: - name: simple-service - state: started - - - name: stop simple-service - service: - name: simple-service - state: stopped - - - name: restart simple-service - service: - name: simple-service - state: restarted + post_tasks: + - name: place /environmentfile.txt + copy: + content: "value=variable" + dest: /environmentfile.txt + mode: "0644" ``` Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles. @@ -136,23 +126,22 @@ These variables are set in `defaults/main.yml`: ## [Requirements](#requirements) -- Access to a repository containing packages, likely on the internet. -- A recent version of Ansible. (Tests run on the current, previous and next release of Ansible.) +- pip packages listed in [requirements.txt](https://github.com/robertdebock/ansible-role-service/blob/master/requirements.txt). -The following roles can be installed to ensure all requirements are met, using `ansible-galaxy install -r requirements.yml`: +## [Status of requirements](#status-of-requirements) -```yaml ---- -- robertdebock.bootstrap +The following roles are used to prepare a system. You may choose to prepare your system in another way, I have tested these roles as well. -``` +| Requirement | GitHub | GitLab | +|-------------|--------|--------| +| [robertdebock.bootstrap](https://galaxy.ansible.com/robertdebock/bootstrap) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-bootstrap/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-bootstrap/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-bootstrap/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-bootstrap) ## [Context](#context) This role is a part of many compatible roles. Have a look at [the documentation of these roles](https://robertdebock.nl/) for further information. Here is an overview of related roles: -![dependencies](https://raw.githubusercontent.com/robertdebock/drawings/artifacts/service.png "Dependency") +![dependencies](https://raw.githubusercontent.com/robertdebock/ansible-role-service/png/requirements.png "Dependencies") ## [Compatibility](#compatibility) @@ -160,56 +149,22 @@ This role has been tested on these [container images](https://hub.docker.com/u/r |container|tags| |---------|----| -|alpine|all| -|amazon|2018.03| |el|7, 8| |debian|buster, bullseye| -|fedora|31, 32| +|fedora|all| |opensuse|all| -|ubuntu|focal, bionic, xenial| +|ubuntu|focal, bionic| -The minimum version of Ansible required is 2.8 but tests have been done to: +The minimum version of Ansible required is 2.10, tests have been done to: -- The previous version, on version lower. +- The previous version. - The current version. - The development version. -## [Testing](#testing) - -[Unit tests](https://travis-ci.com/robertdebock/ansible-role-service) are done on every commit, pull request, release and periodically. - If you find issues, please register them in [GitHub](https://github.com/robertdebock/ansible-role-service/issues) -Testing is done using [Tox](https://tox.readthedocs.io/en/latest/) and [Molecule](https://github.com/ansible/molecule): - -[Tox](https://tox.readthedocs.io/en/latest/) tests multiple ansible versions. -[Molecule](https://github.com/ansible/molecule) tests multiple distributions. - -To test using the defaults (any installed ansible version, namespace: `robertdebock`, image: `fedora`, tag: `latest`): - -``` -molecule test - -# Or select a specific image: -image=ubuntu molecule test -# Or select a specific image and a specific tag: -image="debian" tag="stable" tox -``` - -Or you can test multiple versions of Ansible, and select images: -Tox allows multiple versions of Ansible to be tested. To run the default (namespace: `robertdebock`, image: `fedora`, tag: `latest`) tests: - -``` -tox - -# To run CentOS (namespace: `robertdebock`, tag: `latest`) -image="centos" tox -# Or customize more: -image="debian" tag="stable" tox -``` - ## [License](#license) Apache-2.0 diff --git a/roles/service/handlers/main.yml b/roles/service/handlers/main.yml index 04de248..466cf89 100644 --- a/roles/service/handlers/main.yml +++ b/roles/service/handlers/main.yml @@ -1,8 +1,9 @@ --- # handlers file for service + - name: gather facts - setup: + ansible.builtin.setup: - name: systemctl daemon-reload - systemd: + ansible.builtin.systemd: daemon_reload: yes diff --git a/roles/service/meta 2/.galaxy_install_info b/roles/service/meta 2/.galaxy_install_info deleted file mode 100644 index e94ab9c..0000000 --- a/roles/service/meta 2/.galaxy_install_info +++ /dev/null @@ -1,2 +0,0 @@ -install_date: Mon Sep 28 13:22:39 2020 -version: 2.6.6 diff --git a/roles/service/meta 2/preferences.yml b/roles/service/meta 2/preferences.yml deleted file mode 100644 index e7fdebf..0000000 --- a/roles/service/meta 2/preferences.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -tox_parallel: yes diff --git a/roles/service/meta/.galaxy_install_info b/roles/service/meta/.galaxy_install_info index e94ab9c..3408834 100644 --- a/roles/service/meta/.galaxy_install_info +++ b/roles/service/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Mon Sep 28 13:22:39 2020 -version: 2.6.6 +install_date: Sun Mar 21 07:00:00 2021 +version: 3.0.0 diff --git a/roles/service/meta/main.yml b/roles/service/meta/main.yml index a76e031..77b95c1 100644 --- a/roles/service/meta/main.yml +++ b/roles/service/meta/main.yml @@ -5,15 +5,9 @@ galaxy_info: description: Add custom services to your Linux system. license: Apache-2.0 company: none - min_ansible_version: 2.8 + min_ansible_version: "2.10" platforms: - - name: Alpine - versions: - - all - - name: Amazon - versions: - - 2018.03 - name: EL versions: - 7 @@ -24,8 +18,7 @@ galaxy_info: - bullseye - name: Fedora versions: - - 31 - - 32 + - all - name: OpenSUSE versions: - all @@ -33,11 +26,8 @@ galaxy_info: versions: - focal - bionic - - xenial galaxy_tags: - service - - centos - - redhat dependencies: [] diff --git a/roles/service/molecule/default/converge.yml b/roles/service/molecule/default/converge.yml index 0dd764b..5d302a4 100644 --- a/roles/service/molecule/default/converge.yml +++ b/roles/service/molecule/default/converge.yml @@ -8,39 +8,51 @@ _service_test_command: default: /usr/bin/sleep Alpine: /bin/sleep - - service_test_command: "{{ _service_test_command[ansible_os_family] | default(_service_test_command['default']) }}" - - service_list: - - name: simple-service - description: Simple Service - start_command: "{{ service_test_command }} 3600" - - name: forking-service - description: Forking Service - type: forking - start_command: "{{ service_test_command }} 7200 &" - - name: specific-stop-service - description: Specific Stop Service - start_command: "{{ service_test_command }} 1440" - stop_command: killall -f "sleep 1440" - - name: specific-user-group-service - description: Specific User Group Service - start_command: "{{ service_test_command }} 28800" - user_name: root - group_name: root - - name: specific-workingdirectory-service - description: Specific WorkingDirectory Service - start_command: "{{ service_test_command }} 57600" - working_directory: /tmp - - name: specific-pattern-service - description: Specific Status Pattern Service - start_command: "{{ service_test_command }} 115200" - status_pattern: 115200 - - name: variable-service - description: Service with environment variables - start_command: "{{ service_test_command }} ${time}" - environment_variables: - time: 230400 + Debian: /bin/sleep + Ubuntu-16: /bin/sleep + Ubuntu-18: /bin/sleep + service_test_command: "{{ _service_test_command[ansible_distribution ~ '-' ~ ansible_distribution_major_version] | default(_service_test_command[ansible_os_family] | default(_service_test_command['default'])) }}" # noqa 204 Just long. roles: - role: ansible-role-service + service_list: + - name: simple-service + description: Simple Service + start_command: "{{ service_test_command }} 3600" + state: started + enabled: yes + - name: stopped-service + description: Simple Service + start_command: "{{ service_test_command }} 3601" + state: stopped + enabled: no + - name: specific-stop-service + description: Specific Stop Service + start_command: "{{ service_test_command }} 1440" + stop_command: /usr/bin/killall -f "sleep 1440" + - name: specific-user-group-service + description: Specific User Group Service + start_command: "{{ service_test_command }} 28800" + user_name: root + group_name: root + - name: specific-workingdirectory-service + description: Specific WorkingDirectory Service + start_command: "{{ service_test_command }} 57600" + working_directory: /tmp + - name: specific-pattern-service + description: Specific Status Pattern Service + start_command: "{{ service_test_command }} 115200" + status_pattern: 115200 + - name: variable-service + description: Service with environment variables + start_command: "{{ service_test_command }} ${time}" + environment_variables: + time: 230400 + - name: pidfile-service + description: Service with pidfile + start_command: "{{ service_test_command }} 460800" + pidfile: /var/run/pidfile-service.pid + - name: environmentfile-service + description: Service with environmentfile + start_command: "{{ service_test_command }} 921600" + environmentfile: /environmentfile.txt diff --git a/roles/service/molecule/default/molecule.yml b/roles/service/molecule/default/molecule.yml index a1e72d6..2dce3c5 100644 --- a/roles/service/molecule/default/molecule.yml +++ b/roles/service/molecule/default/molecule.yml @@ -9,7 +9,7 @@ dependency: lint: | set -e yamllint . - ansible-lint tasks/main.yml + ansible-lint driver: name: docker platforms: diff --git a/roles/service/molecule/default/prepare.yml b/roles/service/molecule/default/prepare.yml index d54ab93..84471e0 100644 --- a/roles/service/molecule/default/prepare.yml +++ b/roles/service/molecule/default/prepare.yml @@ -7,3 +7,10 @@ roles: - role: robertdebock.bootstrap + + post_tasks: + - name: place /environmentfile.txt + copy: + content: "value=variable" + dest: /environmentfile.txt + mode: "0644" diff --git a/roles/service/molecule/default/verify.yml b/roles/service/molecule/default/verify.yml index a4d4773..b57c495 100644 --- a/roles/service/molecule/default/verify.yml +++ b/roles/service/molecule/default/verify.yml @@ -9,17 +9,22 @@ - name: simple-service tasks: - - name: start simple-service + - name: check simple-service service: name: simple-service state: started + enabled: yes + check_mode: yes + register: service_check_simple_service + failed_when: + - service_check_simple_service is changed - - name: stop simple-service + - name: check stopped-service service: - name: simple-service + name: stopped-service state: stopped - - - name: restart simple-service - service: - name: simple-service - state: restarted + enabled: no + check_mode: yes + register: service_check_stopped_service + failed_when: + - service_check_stopped_service is changed diff --git a/roles/service/requirements 2.yml b/roles/service/requirements 2.yml deleted file mode 100644 index 46dec9d..0000000 --- a/roles/service/requirements 2.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- robertdebock.bootstrap diff --git a/roles/service/requirements.yml b/roles/service/requirements.yml index 46dec9d..11e3224 100644 --- a/roles/service/requirements.yml +++ b/roles/service/requirements.yml @@ -1,2 +1,3 @@ --- -- robertdebock.bootstrap +roles: + - name: robertdebock.bootstrap diff --git a/roles/service/tasks/assert.yml b/roles/service/tasks/assert.yml index a447ced..bdc80b2 100644 --- a/roles/service/tasks/assert.yml +++ b/roles/service/tasks/assert.yml @@ -1,114 +1,92 @@ --- + - name: test if service_list is set correctly - assert: + ansible.builtin.assert: that: - - service_list | length > 0 + - service_list is defined - service_list is iterable quiet: yes - when: - - service_list is defined - name: test if item in service_list is set correctly - assert: + ansible.builtin.assert: that: - item.name is defined - - item.name | length > 0 + - item.name is string - item.description is defined - - item.description | length > 0 + - item.description is string - item.start_command is defined - - item.start_command | length > 0 + - item.start_command is string quiet: yes loop: "{{ service_list }}" loop_control: label: "{{ item.name }}" - when: - - service_list is defined - -- name: test if stop_command in service_list is set correctly - assert: - that: - - item.stop_command | length > 0 - quiet: yes - loop: "{{ service_list }}" - loop_control: - label: "{{ item.name }}" - when: - - service_list is defined - - item.stop_command is defined - name: test if type in service_list is set correctly - assert: + ansible.builtin.assert: that: - - item.type | length > 0 - - item.type in ["forking", "oneshot", "simple"] + - item.type is string + - item.type in [ "forking", "oneshot", "simple" ] quiet: yes loop: "{{ service_list }}" loop_control: label: "{{ item.name }}" when: - - service_list is defined - item.type is defined -- name: test if working_directory in service_list is set correctly - assert: - that: - - item.working_directory | length > 0 - quiet: yes - loop: "{{ service_list }}" - loop_control: - label: "{{ item.name }}" - when: - - service_list is defined - - item.working_directory is defined - - name: test if environment_variables in service_list is set correctly - assert: + ansible.builtin.assert: that: - - item.environment_variables | length > 0 - item.environment_variables is iterable quiet: yes loop: "{{ service_list }}" loop_control: label: "{{ item.name }}" when: - - service_list is defined - item.environment_variables is defined -- name: test if after in service_list is set correctly - assert: - that: - - item.after | length > 0 - quiet: yes - loop: "{{ service_list }}" - loop_control: - label: "{{ item.name }}" - when: - - service_list is defined - - item.after is defined - - name: test if restart_mode in service_list is set correctly - assert: + ansible.builtin.assert: that: - - item.restart_mode | length > 0 - - item.restart_mode in ["no", "on-success", "on-failure", "on-abnormal", "on-watchdog", "on-abort", "always"] + - item.restart_mode is string + - item.restart_mode in [ "no", "on-success", "on-failure", "on-abnormal", "on-watchdog", "on-abort", "always" ] quiet: yes loop: "{{ service_list }}" loop_control: label: "{{ item.name }}" when: - - service_list is defined - item.restart_mode is defined - name: test if restart_seconds in service_list is set correctly - assert: + ansible.builtin.assert: that: - - item.seconds | length > 0 - - item.seconds | int - - item.seconds | int >= 0 + - item.seconds is number + - item.seconds >= 0 quiet: yes loop: "{{ service_list }}" loop_control: label: "{{ item.name }}" when: - - service_list is defined - item.seconds is defined + +- name: test if state in service_list is set correctly + ansible.builtin.assert: + that: + - item.state is string + - item.state in [ "reloaded", "restarted", "started", "stopped" ] + quiet: yes + loop: "{{ service_list }}" + loop_control: + label: "{{ item.name }}" + when: + - item.state is defined + +- name: test if enabled in service_list is set correctly + ansible.builtin.assert: + that: + - item.enabled is boolean + quiet: yes + loop: "{{ service_list }}" + loop_control: + label: "{{ item.name }}" + when: + - item.enabled is defined diff --git a/roles/service/tasks/main.yml b/roles/service/tasks/main.yml index 9f74df8..b61fbdf 100644 --- a/roles/service/tasks/main.yml +++ b/roles/service/tasks/main.yml @@ -1,17 +1,20 @@ --- # tasks file for service + - name: include assert.yml - include_tasks: assert.yml + import_tasks: assert.yml + run_once: yes + delegate_to: localhost - name: install required packages - package: + ansible.builtin.package: name: "{{ service_required_packages }}" state: present notify: - gather facts - name: configure systemd service - template: + ansible.builtin.template: src: "systemd.j2" dest: "/etc/systemd/system/{{ item.name }}.service" mode: "0644" @@ -24,17 +27,27 @@ label: "{{ item.name }}" - name: configure sysvinit service - template: + ansible.builtin.template: src: "sysvinit.j2" dest: "/etc/init.d/{{ item.name }}" mode: "0755" when: - - ansible_service_mgr == "sysvinit" or - ansible_service_mgr == "upstart" or - ansible_service_mgr == "openrc" + - ansible_service_mgr in [ "sysvinit", "upstart", "openrc" ] loop: "{{ service_list }}" loop_control: label: "{{ item.name }}" +- name: manage service + ansible.builtin.service: + name: "{{ item.name }}" + state: "{{ item.state | default(omit) }}" + enabled: "{{ item.enabled | default(omit) }}" + loop: "{{ service_list }}" + loop_control: + label: "{{ item.name }}" + when: + - item.state is defined or + item.enabled is defined + - name: flush handlers - meta: flush_handlers + ansible.builtin.meta: flush_handlers diff --git a/roles/service/templates/systemd.j2 b/roles/service/templates/systemd.j2 index 954e679..bde34b8 100644 --- a/roles/service/templates/systemd.j2 +++ b/roles/service/templates/systemd.j2 @@ -27,12 +27,18 @@ ExecStop={{ item.stop_command }} Environment={{ key }}={{ item.environment_variables[key] }} {% endfor %} {% endif %} +{% if item.environmentfile is defined %} +EnvironmentFile={{ item.environmentfile }} +{% endif %} {% if item.restart_mode is defined %} Restart={{ item.restart_mode }} {% endif %} {% if item.restart_seconds is defined %} RestartSec={{ item.restart_seconds }} {% endif %} +{% if item.pidfile is defined %} +PIDFile={{ item.pidfile }} +{% endif %} [Install] WantedBy=multi-user.target diff --git a/roles/service/templates/sysvinit.j2 b/roles/service/templates/sysvinit.j2 index 0c8d39e..b64cccd 100644 --- a/roles/service/templates/sysvinit.j2 +++ b/roles/service/templates/sysvinit.j2 @@ -26,20 +26,21 @@ start() { pgrep -f {{ item.start_command | regex_replace(' .*') }} > /dev/null {% endif %} returncode="${?}" - if [ $returncode -gt 0 ] ; then + if [ $returncode -ne 0 ] ; then echo -n "Starting {{ item.name }}: " {% if item.working_directory is defined %} cd {{ item.working_directory }} {% endif %} {% if item.type is defined and item.type != "simple" %} - {% if item.user_name is defined %}su -c {% endif %}"{{ item.start_command }}"{% if item.user_name is defined %} {{ item.user_name }}{% endif %} + {% if item.user_name is defined %}su - {{ item.user_name }} -c {% endif %}{{ item.start_command }} {% else %} - ({% if item.user_name is defined %}su -c {% endif %}"{{ item.start_command }}"{% if item.user_name is defined %} {{ item.user_name }}{% endif %} &) + ({% if item.user_name is defined %}su - {{ item.user_name }} -c {% endif %}{{ item.start_command }}&) {% endif %} returncode="${?}" touch /var/lock/subsys/{{ item.name }} else echo "Already running." + returncode=1 fi } @@ -72,11 +73,12 @@ status() { {% else %} pgrep -f {{ item.start_command | regex_replace(' .*') }} > /dev/null {% endif %} - returncode="${?}" - if [ $returncode -gt 0 ] ; then - echo "{{ item.name }} is not running." ; exit 3 + if [ $? -gt 0 ] ; then + echo "{{ item.name }} is not running." + returncode=3 else - echo "{{ item.name }} is running." ; exit ${returncode} + echo "{{ item.name }} is running." + returncode=0 fi return ${returncode} } diff --git a/roles/service/tox.ini b/roles/service/tox.ini index c1bc1d4..f57553b 100644 --- a/roles/service/tox.ini +++ b/roles/service/tox.ini @@ -2,25 +2,25 @@ # Ansible managed # [tox] -minversion = 3.7 -# Disabled "next" because of: -# https://github.com/ansible-community/molecule/issues/2626. -# envlist = py{38}-ansible-{previous,current,next} -envlist = py{38}-ansible-{previous,current} +minversion = 3.21.4 +# 2.11 has been disabled: couldn't resolve module/action 'docker_container'. +envlist = py{39}-ansible-{2.9,2.10} + skipsdist = true [testenv] deps = - previous: ansible>=2.8, <2.9 - current: ansible>=2.9 - next: git+https://github.com/ansible/ansible.git@devel - molecule[lint]>=3, <4 - docker>=4.2, <4.3 + 2.9: ansible == 2.9.* + 2.10: ansible == 2.10.* + 2.11: git+https://github.com/ansible/ansible.git@devel + molecule[docker] + docker == 4.* + ansible-lint == 5.* commands = molecule test setenv = TOX_ENVNAME={envname} - MOLECULE_EPHEMERAL_DIRECTORY=/tmp/.molecule/{env:image:fedora}-{env:tag:latest}/{envname} PY_COLORS=1 ANSIBLE_FORCE_COLOR=1 + ANSIBLE_ROLES_PATH=../ passenv = namespace image tag diff --git a/roles/service/vars/main.yml b/roles/service/vars/main.yml index c12bccd..3b47cb9 100644 --- a/roles/service/vars/main.yml +++ b/roles/service/vars/main.yml @@ -3,6 +3,10 @@ _service_required_packages: default: [] + Amazon-2: + - procps-ng + Amazon-2018: + - procps Debian: - psmisc RedHat: @@ -10,4 +14,4 @@ _service_required_packages: Suse: - psmisc -service_required_packages: "{{ _service_required_packages[ansible_os_family] | default(_service_required_packages['default']) }}" +service_required_packages: "{{ _service_required_packages[ansible_distribution ~ '-' ~ ansible_distribution_major_version] | default(_service_required_packages[ansible_os_family] | default(_service_required_packages['default'])) }}" diff --git a/roles/travis/.ansible-lint b/roles/travis/.ansible-lint index ffceae6..7a17121 100644 --- a/roles/travis/.ansible-lint +++ b/roles/travis/.ansible-lint @@ -4,4 +4,9 @@ exclude_paths: - ./meta/exception.yml - ./meta/preferences.yml + - ./molecule/default/prepare.yml + - ./molecule/default/converge.yml - ./molecule/default/verify.yml + - ./molecule/default/collections.yml + - ./.tox + - ./.cache diff --git a/roles/travis/.github 2/FUNDING.yml b/roles/travis/.github 2/FUNDING.yml deleted file mode 100644 index 67320f0..0000000 --- a/roles/travis/.github 2/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -github: robertdebock diff --git a/roles/travis/.github 2/pull_request_template.md b/roles/travis/.github 2/pull_request_template.md deleted file mode 100644 index b1578c0..0000000 --- a/roles/travis/.github 2/pull_request_template.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: Pull request -about: Describe the proposed change - ---- - -**Describe the change** -A clear and concise description of what the pull request is. - -**Testing** -In case a feature was added, how were tests performed? diff --git a/roles/travis/.github 2/settings.yml b/roles/travis/.github 2/settings.yml deleted file mode 100644 index 9cd2a21..0000000 --- a/roles/travis/.github 2/settings.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# -# Ansible managed -# -repository: - description: Installs travis on your system. - homepage: https://robertdebock.nl/ diff --git a/roles/travis/.github/settings.yml b/roles/travis/.github/settings.yml index 9cd2a21..bbfdd84 100644 --- a/roles/travis/.github/settings.yml +++ b/roles/travis/.github/settings.yml @@ -5,3 +5,4 @@ repository: description: Installs travis on your system. homepage: https://robertdebock.nl/ + topics: travis, ansible, molecule, tox, playbook, hacktoberfest diff --git a/roles/travis/.github/workflows/galaxy.yml b/roles/travis/.github/workflows/galaxy.yml index 08996ca..1d36b74 100644 --- a/roles/travis/.github/workflows/galaxy.yml +++ b/roles/travis/.github/workflows/galaxy.yml @@ -6,17 +6,13 @@ name: Release to Ansible Galaxy on: - push: - tags: - - '*' - schedule: - - cron: '20 20 20 * *' - + release: + types: [created, edited, published, released] jobs: release: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: galaxy - uses: robertdebock/galaxy-action@1.0.1 + uses: robertdebock/galaxy-action@1.1.0 with: galaxy_api_key: ${{ secrets.galaxy_api_key }} diff --git a/roles/travis/.github/workflows/molecule.yml b/roles/travis/.github/workflows/molecule.yml index f122a19..dfe56d7 100644 --- a/roles/travis/.github/workflows/molecule.yml +++ b/roles/travis/.github/workflows/molecule.yml @@ -15,28 +15,26 @@ on: jobs: lint: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: checkout uses: actions/checkout@v2 with: path: "${{ github.repository }}" - name: molecule - uses: robertdebock/molecule-action@2.6.1 + uses: robertdebock/molecule-action@2.6.16 with: command: lint test: needs: - lint - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: config: - image: "alpine" tag: "latest" - - image: "alpine" - tag: "edge" - image: "centos" tag: "latest" - image: "debian" @@ -49,8 +47,6 @@ jobs: tag: "latest" - image: "ubuntu" tag: "bionic" - - image: "ubuntu" - tag: "xenial" steps: - name: checkout uses: actions/checkout@v2 @@ -61,10 +57,7 @@ jobs: - name: parse apparmor for mysql run: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - name: molecule - uses: robertdebock/molecule-action@2.6.1 + uses: robertdebock/molecule-action@2.6.16 with: image: ${{ matrix.config.image }} tag: ${{ matrix.config.tag }} - options: "--parallel all" - env: - TOX_PARALLEL_NO_SPINNER: 1 diff --git a/roles/travis/.gitignore b/roles/travis/.gitignore index 982db11..c15d16a 100644 --- a/roles/travis/.gitignore +++ b/roles/travis/.gitignore @@ -2,3 +2,4 @@ *.log *.swp .tox +.cache diff --git a/roles/travis/.gitignore 2 b/roles/travis/.gitignore 2 deleted file mode 100644 index 982db11..0000000 --- a/roles/travis/.gitignore 2 +++ /dev/null @@ -1,4 +0,0 @@ -.molecule -*.log -*.swp -.tox diff --git a/roles/travis/.travis.yml b/roles/travis/.travis.yml index 7d8be10..21201e1 100644 --- a/roles/travis/.travis.yml +++ b/roles/travis/.travis.yml @@ -4,37 +4,27 @@ # language: python +os: linux +dist: xenial + python: - - "3.8" + - "3.9" services: - docker -env: - global: - namespace="robertdebock" - matrix: - - image="alpine" tag="latest" - - image="alpine" tag="edge" - - image="centos" tag="latest" - - image="debian" tag="latest" - - image="debian" tag="bullseye" - - image="opensuse" tag="latest" - - image="ubuntu" tag="latest" - - image="ubuntu" tag="bionic" - - image="ubuntu" tag="xenial" - cache: - pip install: - pip install --upgrade pip - - pip install tox + - pip install yamllint + - pip install ansible-lint script: - - function retry { counter=0 ; until "$@" ; do exit=$? ; counter=$(($counter + 1)) ; if [ $counter -ge 3 ] ; then return $exit ; fi ; done ; return 0; } ; retry tox --parallel all + - yamllint . + - ansible-lint notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ - slack: "WbkXeeWn2ywEGhPRMZSKlQKhxxNNZcyavxonnRlj7ZqTPlf1xJ/VlNxs3hsFBNafCePnxNuVTrWaA+4oq4xQgTSHyX3Rxh4rqyY2FIYWYDoQP6hiUFfuunZ9Wa5utGIKRkX3YQWfYaUUqd18tiD6N1KQ1LrAZFywKjHx5RQwUXLPvCQ5WR48SrwaV6/PVYy4h59PljYb/GrItLJrQV44Eqzs9WqkdTfXBNLe6+0w90RmxZUeaCZkbmI+0NUCpJzHMGw4YSE0Ov5EuGPoeRdRBodTbzoDLe+MxVzQUAeUZV9IQf3PjYzdp4P7hDVsqYF9rQUU7lF1y5z0FeReRrb0nmPW3qRHj5EbcN54/kYILyqI+TFLRyxO/YUXzSb1dWTJjS2qCXhHYsd7bwzWJrnxSApmtLpz0dXcutdn+eJnNdZfmFG4wQjnIf0X1vJOW754FW3J+0Mdg3KNty7I9NbvvoOaalahm1s9DxV6emw3biNVuyPML0yDZHb5z7ztOCGgJuHmwUkc+wpoLBOy2XVXc8L2gcWM2IKnOytOklq8/mvwWnUCSbiic4w+Xi0yDEv85f36vlfkI9p6BxrsUBj2JMlF2y9J+453dkKBiU/ESnFMO1iagbtDqrEjyMlOY/paF+DtiP5Rij1UubQo0p3j8i4vtdrtLdM9iMoiv0HyISg=" email: false diff --git a/roles/travis/.yamllint b/roles/travis/.yamllint index c5ae64b..a7ff098 100644 --- a/roles/travis/.yamllint +++ b/roles/travis/.yamllint @@ -10,3 +10,7 @@ rules: level: error line-length: disable truthy: disable + +ignore: | + .tox/ + .cache/ diff --git a/roles/travis/LICENSE b/roles/travis/LICENSE index bd15893..e770af8 100644 --- a/roles/travis/LICENSE +++ b/roles/travis/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 Robert de Bock (robert@meinit.nl) + Copyright 2021 Robert de Bock (robert@meinit.nl) 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/roles/travis/README.md b/roles/travis/README.md index a37f323..2a419f8 100644 --- a/roles/travis/README.md +++ b/roles/travis/README.md @@ -2,9 +2,9 @@ Installs travis on your system. -|Travis|GitHub|Quality|Downloads|Version| +|GitHub|GitLab|Quality|Downloads|Version| |------|------|-------|---------|-------| -|[![travis](https://travis-ci.com/robertdebock/ansible-role-travis.svg?branch=master)](https://travis-ci.com/robertdebock/ansible-role-travis)|[![github](https://github.com/robertdebock/ansible-role-travis/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-travis/actions)|[![quality](https://img.shields.io/ansible/quality/35947)](https://galaxy.ansible.com/robertdebock/travis)|[![downloads](https://img.shields.io/ansible/role/d/35947)](https://galaxy.ansible.com/robertdebock/travis)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-travis.svg)](https://github.com/robertdebock/ansible-role-travis/releases/)| +|[![github](https://github.com/robertdebock/ansible-role-travis/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-travis/actions)|[![gitlab](https://gitlab.com/robertdebock/ansible-role-travis/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-travis)|[![quality](https://img.shields.io/ansible/quality/35947)](https://galaxy.ansible.com/robertdebock/travis)|[![downloads](https://img.shields.io/ansible/role/d/35947)](https://galaxy.ansible.com/robertdebock/travis)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-travis.svg)](https://github.com/robertdebock/ansible-role-travis/releases/)| ## [Example Playbook](#example-playbook) @@ -20,7 +20,7 @@ This example is taken from `molecule/resources/converge.yml` and is tested on ea - role: robertdebock.travis ``` -The machine may need to be prepared using `molecule/resources/prepare.yml`: +The machine needs to be prepared in CI this is done using `molecule/resources/prepare.yml`: ```yaml --- - name: Prepare @@ -34,43 +34,29 @@ The machine may need to be prepared using `molecule/resources/prepare.yml`: - role: robertdebock.ruby ``` -For verification `molecule/resources/verify.yml` run after the role has been applied. -```yaml ---- -- name: Verify - hosts: all - become: yes - gather_facts: yes - - tasks: - - name: check if connection still works - ping: -``` - Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles. ## [Requirements](#requirements) -- Access to a repository containing packages, likely on the internet. -- A recent version of Ansible. (Tests run on the current, previous and next release of Ansible.) +- pip packages listed in [requirements.txt](https://github.com/robertdebock/ansible-role-travis/blob/master/requirements.txt). -The following roles can be installed to ensure all requirements are met, using `ansible-galaxy install -r requirements.yml`: +## [Status of requirements](#status-of-requirements) -```yaml ---- -- robertdebock.bootstrap -- robertdebock.buildtools -- robertdebock.ruby +The following roles are used to prepare a system. You may choose to prepare your system in another way, I have tested these roles as well. -``` +| Requirement | GitHub | GitLab | +|-------------|--------|--------| +| [robertdebock.bootstrap](https://galaxy.ansible.com/robertdebock/bootstrap) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-bootstrap/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-bootstrap/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-bootstrap/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-bootstrap) +| [robertdebock.buildtools](https://galaxy.ansible.com/robertdebock/buildtools) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-buildtools/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-buildtools/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-buildtools/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-buildtools) +| [robertdebock.ruby](https://galaxy.ansible.com/robertdebock/ruby) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-ruby/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-ruby/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-ruby/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-ruby) ## [Context](#context) This role is a part of many compatible roles. Have a look at [the documentation of these roles](https://robertdebock.nl/) for further information. Here is an overview of related roles: -![dependencies](https://raw.githubusercontent.com/robertdebock/drawings/artifacts/travis.png "Dependency") +![dependencies](https://raw.githubusercontent.com/robertdebock/ansible-role-travis/png/requirements.png "Dependencies") ## [Compatibility](#compatibility) @@ -82,11 +68,11 @@ This role has been tested on these [container images](https://hub.docker.com/u/r |el|8| |debian|buster, bullseye| |opensuse|all| -|ubuntu|focal, bionic, xenial| +|ubuntu|focal, bionic| -The minimum version of Ansible required is 2.8 but tests have been done to: +The minimum version of Ansible required is 2.10, tests have been done to: -- The previous version, on version lower. +- The previous version. - The current version. - The development version. @@ -96,44 +82,13 @@ Some variarations of the build matrix do not work. These are the variations and | variation | reason | |---------------------------|------------------------| -| CentOS 7 | Dependency faraday requires Ruby version >= 2.3 | -| Fedora | extconf failed, exit code 1 | +| centos:7 | Dependency faraday requires Ruby version >= 2.3 | +| fedora | extconf failed, exit code 1 | +| ubuntu:xenial | faraday requires Ruby version >= 2.4. | -## [Testing](#testing) - -[Unit tests](https://travis-ci.com/robertdebock/ansible-role-travis) are done on every commit, pull request, release and periodically. - If you find issues, please register them in [GitHub](https://github.com/robertdebock/ansible-role-travis/issues) -Testing is done using [Tox](https://tox.readthedocs.io/en/latest/) and [Molecule](https://github.com/ansible/molecule): - -[Tox](https://tox.readthedocs.io/en/latest/) tests multiple ansible versions. -[Molecule](https://github.com/ansible/molecule) tests multiple distributions. - -To test using the defaults (any installed ansible version, namespace: `robertdebock`, image: `fedora`, tag: `latest`): - -``` -molecule test - -# Or select a specific image: -image=ubuntu molecule test -# Or select a specific image and a specific tag: -image="debian" tag="stable" tox -``` - -Or you can test multiple versions of Ansible, and select images: -Tox allows multiple versions of Ansible to be tested. To run the default (namespace: `robertdebock`, image: `fedora`, tag: `latest`) tests: - -``` -tox - -# To run CentOS (namespace: `robertdebock`, tag: `latest`) -image="centos" tox -# Or customize more: -image="debian" tag="stable" tox -``` - ## [License](#license) Apache-2.0 diff --git a/roles/travis/meta 2/.galaxy_install_info b/roles/travis/meta 2/.galaxy_install_info deleted file mode 100644 index 55d8aae..0000000 --- a/roles/travis/meta 2/.galaxy_install_info +++ /dev/null @@ -1,2 +0,0 @@ -install_date: Mon Sep 28 13:22:41 2020 -version: 3.0.5 diff --git a/roles/travis/meta 2/exception.yml b/roles/travis/meta 2/exception.yml deleted file mode 100644 index 66d9e65..0000000 --- a/roles/travis/meta 2/exception.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -exceptions: - - variation: CentOS 7 - reason: "Dependency faraday requires Ruby version >= 2.3" - - variation: Fedora - reason: "extconf failed, exit code 1" diff --git a/roles/travis/meta 2/preferences.yml b/roles/travis/meta 2/preferences.yml deleted file mode 100644 index e7fdebf..0000000 --- a/roles/travis/meta 2/preferences.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -tox_parallel: yes diff --git a/roles/travis/meta/.galaxy_install_info b/roles/travis/meta/.galaxy_install_info index 55d8aae..4236eeb 100644 --- a/roles/travis/meta/.galaxy_install_info +++ b/roles/travis/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Mon Sep 28 13:22:41 2020 -version: 3.0.5 +install_date: Sun Mar 21 07:00:02 2021 +version: 4.0.1 diff --git a/roles/travis/meta/exception.yml b/roles/travis/meta/exception.yml index 66d9e65..2c33dce 100644 --- a/roles/travis/meta/exception.yml +++ b/roles/travis/meta/exception.yml @@ -1,6 +1,8 @@ --- exceptions: - - variation: CentOS 7 + - variation: centos:7 reason: "Dependency faraday requires Ruby version >= 2.3" - - variation: Fedora + - variation: fedora reason: "extconf failed, exit code 1" + - variation: ubuntu:xenial + reason: "faraday requires Ruby version >= 2.4." diff --git a/roles/travis/meta/main.yml b/roles/travis/meta/main.yml index 2aa1307..95a96f7 100644 --- a/roles/travis/meta/main.yml +++ b/roles/travis/meta/main.yml @@ -5,7 +5,7 @@ galaxy_info: description: Installs travis on your system. license: Apache-2.0 company: none - min_ansible_version: 2.8 + min_ansible_version: "2.10" platforms: - name: Alpine @@ -25,10 +25,8 @@ galaxy_info: versions: - focal - bionic - - xenial galaxy_tags: - travis - - centos dependencies: [] diff --git a/roles/travis/molecule 2/default/converge.yml b/roles/travis/molecule 2/default/converge.yml deleted file mode 100644 index 3143587..0000000 --- a/roles/travis/molecule 2/default/converge.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Converge - hosts: all - become: yes - gather_facts: yes - - roles: - - role: ansible-role-travis diff --git a/roles/travis/molecule 2/default/prepare.yml b/roles/travis/molecule 2/default/prepare.yml deleted file mode 100644 index a4f3931..0000000 --- a/roles/travis/molecule 2/default/prepare.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -- name: Prepare - hosts: all - gather_facts: no - become: yes - - roles: - - role: robertdebock.bootstrap - - role: robertdebock.buildtools - - role: robertdebock.ruby diff --git a/roles/travis/molecule 2/default/verify.yml b/roles/travis/molecule 2/default/verify.yml deleted file mode 100644 index 6ab75cf..0000000 --- a/roles/travis/molecule 2/default/verify.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -- name: Verify - hosts: all - become: yes - gather_facts: yes - - tasks: - - name: check if connection still works - ping: diff --git a/roles/travis/molecule/default/molecule.yml b/roles/travis/molecule/default/molecule.yml index 9f74607..4ecf3b8 100644 --- a/roles/travis/molecule/default/molecule.yml +++ b/roles/travis/molecule/default/molecule.yml @@ -6,10 +6,11 @@ dependency: name: galaxy options: role-file: requirements.yml + requirements-file: requirements.yml lint: | - PATH=${PATH} - yamllint molecule/default/converge.yml - ansible-lint molecule/default/converge.yml + set -e + yamllint . + ansible-lint driver: name: docker platforms: diff --git a/roles/travis/molecule/default/verify.yml b/roles/travis/molecule/default/verify.yml index 6ab75cf..b9dc6f8 100644 --- a/roles/travis/molecule/default/verify.yml +++ b/roles/travis/molecule/default/verify.yml @@ -2,7 +2,7 @@ - name: Verify hosts: all become: yes - gather_facts: yes + gather_facts: no tasks: - name: check if connection still works diff --git a/roles/travis/requirements 2.yml b/roles/travis/requirements 2.yml deleted file mode 100644 index 5c1fe87..0000000 --- a/roles/travis/requirements 2.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -- robertdebock.bootstrap -- robertdebock.buildtools -- robertdebock.ruby diff --git a/roles/travis/requirements.yml b/roles/travis/requirements.yml index 5c1fe87..50d7336 100644 --- a/roles/travis/requirements.yml +++ b/roles/travis/requirements.yml @@ -1,4 +1,7 @@ --- -- robertdebock.bootstrap -- robertdebock.buildtools -- robertdebock.ruby +roles: + - name: robertdebock.bootstrap + - name: robertdebock.buildtools + - name: robertdebock.ruby +collections: + - name: community.general diff --git a/roles/travis/tasks/main.yml b/roles/travis/tasks/main.yml index b2e9e88..2b3cd5c 100644 --- a/roles/travis/tasks/main.yml +++ b/roles/travis/tasks/main.yml @@ -1,12 +1,13 @@ --- # tasks file for travis + - name: install requirements - package: + ansible.builtin.package: name: "{{ travis_requirements }}" state: present - name: install travis - gem: + community.general.gem: name: "{{ travis_package }}" state: present user_install: no diff --git a/roles/travis/tox.ini b/roles/travis/tox.ini index c1bc1d4..f57553b 100644 --- a/roles/travis/tox.ini +++ b/roles/travis/tox.ini @@ -2,25 +2,25 @@ # Ansible managed # [tox] -minversion = 3.7 -# Disabled "next" because of: -# https://github.com/ansible-community/molecule/issues/2626. -# envlist = py{38}-ansible-{previous,current,next} -envlist = py{38}-ansible-{previous,current} +minversion = 3.21.4 +# 2.11 has been disabled: couldn't resolve module/action 'docker_container'. +envlist = py{39}-ansible-{2.9,2.10} + skipsdist = true [testenv] deps = - previous: ansible>=2.8, <2.9 - current: ansible>=2.9 - next: git+https://github.com/ansible/ansible.git@devel - molecule[lint]>=3, <4 - docker>=4.2, <4.3 + 2.9: ansible == 2.9.* + 2.10: ansible == 2.10.* + 2.11: git+https://github.com/ansible/ansible.git@devel + molecule[docker] + docker == 4.* + ansible-lint == 5.* commands = molecule test setenv = TOX_ENVNAME={envname} - MOLECULE_EPHEMERAL_DIRECTORY=/tmp/.molecule/{env:image:fedora}-{env:tag:latest}/{envname} PY_COLORS=1 ANSIBLE_FORCE_COLOR=1 + ANSIBLE_ROLES_PATH=../ passenv = namespace image tag diff --git a/roles/update/.ansible-lint b/roles/update/.ansible-lint index ffceae6..7a17121 100644 --- a/roles/update/.ansible-lint +++ b/roles/update/.ansible-lint @@ -4,4 +4,9 @@ exclude_paths: - ./meta/exception.yml - ./meta/preferences.yml + - ./molecule/default/prepare.yml + - ./molecule/default/converge.yml - ./molecule/default/verify.yml + - ./molecule/default/collections.yml + - ./.tox + - ./.cache diff --git a/roles/update/.github 2/FUNDING.yml b/roles/update/.github 2/FUNDING.yml deleted file mode 100644 index 67320f0..0000000 --- a/roles/update/.github 2/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -github: robertdebock diff --git a/roles/update/.github 2/pull_request_template.md b/roles/update/.github 2/pull_request_template.md deleted file mode 100644 index b1578c0..0000000 --- a/roles/update/.github 2/pull_request_template.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: Pull request -about: Describe the proposed change - ---- - -**Describe the change** -A clear and concise description of what the pull request is. - -**Testing** -In case a feature was added, how were tests performed? diff --git a/roles/update/.github 2/settings.yml b/roles/update/.github 2/settings.yml deleted file mode 100644 index 823f25d..0000000 --- a/roles/update/.github 2/settings.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# -# Ansible managed -# -repository: - description: Install updates on your system. - homepage: https://robertdebock.nl/ diff --git a/roles/update/.github/settings.yml b/roles/update/.github/settings.yml index 823f25d..0d9595b 100644 --- a/roles/update/.github/settings.yml +++ b/roles/update/.github/settings.yml @@ -5,3 +5,4 @@ repository: description: Install updates on your system. homepage: https://robertdebock.nl/ + topics: update, ansible, molecule, tox, playbook, hacktoberfest diff --git a/roles/update/.github/workflows/galaxy.yml b/roles/update/.github/workflows/galaxy.yml index 5ec3062..1d36b74 100644 --- a/roles/update/.github/workflows/galaxy.yml +++ b/roles/update/.github/workflows/galaxy.yml @@ -6,17 +6,13 @@ name: Release to Ansible Galaxy on: - push: - tags: - - '*' - schedule: - - cron: '21 21 21 * *' - + release: + types: [created, edited, published, released] jobs: release: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: galaxy - uses: robertdebock/galaxy-action@1.0.1 + uses: robertdebock/galaxy-action@1.1.0 with: galaxy_api_key: ${{ secrets.galaxy_api_key }} diff --git a/roles/update/.github/workflows/molecule.yml b/roles/update/.github/workflows/molecule.yml index d7a3e2c..bd9805e 100644 --- a/roles/update/.github/workflows/molecule.yml +++ b/roles/update/.github/workflows/molecule.yml @@ -15,30 +15,28 @@ on: jobs: lint: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: checkout uses: actions/checkout@v2 with: path: "${{ github.repository }}" - name: molecule - uses: robertdebock/molecule-action@2.6.1 + uses: robertdebock/molecule-action@2.6.16 with: command: lint test: needs: - lint - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: config: - image: "alpine" tag: "latest" - - image: "alpine" - tag: "edge" - image: "amazonlinux" - tag: "1" + tag: "latest" - image: "centos" tag: "7" - image: "centos" @@ -48,7 +46,7 @@ jobs: - image: "debian" tag: "bullseye" - image: "fedora" - tag: "31" + tag: "32" - image: "fedora" tag: "latest" - image: "opensuse" @@ -57,8 +55,6 @@ jobs: tag: "latest" - image: "ubuntu" tag: "bionic" - - image: "ubuntu" - tag: "xenial" steps: - name: checkout uses: actions/checkout@v2 @@ -69,10 +65,7 @@ jobs: - name: parse apparmor for mysql run: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - name: molecule - uses: robertdebock/molecule-action@2.6.1 + uses: robertdebock/molecule-action@2.6.16 with: image: ${{ matrix.config.image }} tag: ${{ matrix.config.tag }} - options: "--parallel all" - env: - TOX_PARALLEL_NO_SPINNER: 1 diff --git a/roles/update/.gitignore b/roles/update/.gitignore index 982db11..c15d16a 100644 --- a/roles/update/.gitignore +++ b/roles/update/.gitignore @@ -2,3 +2,4 @@ *.log *.swp .tox +.cache diff --git a/roles/update/.gitignore 2 b/roles/update/.gitignore 2 deleted file mode 100644 index 982db11..0000000 --- a/roles/update/.gitignore 2 +++ /dev/null @@ -1,4 +0,0 @@ -.molecule -*.log -*.swp -.tox diff --git a/roles/update/.travis.yml b/roles/update/.travis.yml index 24565ce..21201e1 100644 --- a/roles/update/.travis.yml +++ b/roles/update/.travis.yml @@ -4,41 +4,27 @@ # language: python +os: linux +dist: xenial + python: - - "3.8" + - "3.9" services: - docker -env: - global: - namespace="robertdebock" - matrix: - - image="alpine" tag="latest" - - image="alpine" tag="edge" - - image="amazonlinux" tag="1" - - image="centos" tag="7" - - image="centos" tag="latest" - - image="debian" tag="latest" - - image="debian" tag="bullseye" - - image="fedora" tag="31" - - image="fedora" tag="latest" - - image="opensuse" tag="latest" - - image="ubuntu" tag="latest" - - image="ubuntu" tag="bionic" - - image="ubuntu" tag="xenial" - cache: - pip install: - pip install --upgrade pip - - pip install tox + - pip install yamllint + - pip install ansible-lint script: - - function retry { counter=0 ; until "$@" ; do exit=$? ; counter=$(($counter + 1)) ; if [ $counter -ge 3 ] ; then return $exit ; fi ; done ; return 0; } ; retry tox --parallel all + - yamllint . + - ansible-lint notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ - slack: "dsx6/sONAWIAzC548G+A1c+VxICe/G3sEl2x3+eCJZnoAbtPFmGceAQN2PqVD1VhpNdS3kacO8v2+vp02xJlUskIO9CYbZjEsCyeH5ZU9fcnSQrq8pIGsq7907zhre6RBG+P0ZYJsZlP2/pC5M/RckfySPjL/NxEtKaI5J56fu7KMCwGoPBYBQet9zwhsOKKfrKkJnBTdECy+QzhRUHvjZTVzNDu4ISz/eh8AjqdqwWHGBKYswhgkUmkEssYwSIStu6o2PCMQLIWlm5b+twdmjDKt7Z6Z/UD7IloB2WC4jcQx/pPHMJferMEQMO3vaNBOVD6UzHMN7nEg6cSU6M5Gd4gdyS2/ZMypvL1HjyOAMxHM6jzqy/1ULqcaaHE9uwbVAUQTyK6RozG4f5f0h3eUeJlMO6pqWGpu0g0HDShk+3+q6907tJY0URr9SJ7wIB8pDHN9MrhCiPf03o9QFOxt7hVIv/iEYOj93ZbTVHANbDR4V+n8ndDcz+X3vFF9Bj1Ckj6vcwaucLxyR5+2ykB2Mbm4HSUngu31kQxf5C91jaAC0IGbaBZzVIcRNNlQacT/XkI1gPVNoA2M1NLdw00CRDKLSYhOsX/39a7hp75WDJdCSFEwX4190j9qy2EIRa7Tv0WePppRto+maXggTYDfyGHClVY01V6Wuc8DEYYYnA=" email: false diff --git a/roles/update/.yamllint b/roles/update/.yamllint index c5ae64b..a7ff098 100644 --- a/roles/update/.yamllint +++ b/roles/update/.yamllint @@ -10,3 +10,7 @@ rules: level: error line-length: disable truthy: disable + +ignore: | + .tox/ + .cache/ diff --git a/roles/update/LICENSE b/roles/update/LICENSE index bd15893..e770af8 100644 --- a/roles/update/LICENSE +++ b/roles/update/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 Robert de Bock (robert@meinit.nl) + Copyright 2021 Robert de Bock (robert@meinit.nl) 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/roles/update/README.md b/roles/update/README.md index d36a831..c5ccbd5 100644 --- a/roles/update/README.md +++ b/roles/update/README.md @@ -2,9 +2,9 @@ Install updates on your system. -|Travis|GitHub|Quality|Downloads|Version| +|GitHub|GitLab|Quality|Downloads|Version| |------|------|-------|---------|-------| -|[![travis](https://travis-ci.com/robertdebock/ansible-role-update.svg?branch=master)](https://travis-ci.com/robertdebock/ansible-role-update)|[![github](https://github.com/robertdebock/ansible-role-update/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-update/actions)|[![quality](https://img.shields.io/ansible/quality/22417)](https://galaxy.ansible.com/robertdebock/update)|[![downloads](https://img.shields.io/ansible/role/d/22417)](https://galaxy.ansible.com/robertdebock/update)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-update.svg)](https://github.com/robertdebock/ansible-role-update/releases/)| +|[![github](https://github.com/robertdebock/ansible-role-update/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-update/actions)|[![gitlab](https://gitlab.com/robertdebock/ansible-role-update/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-update)|[![quality](https://img.shields.io/ansible/quality/22417)](https://galaxy.ansible.com/robertdebock/update)|[![downloads](https://img.shields.io/ansible/role/d/22417)](https://galaxy.ansible.com/robertdebock/update)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-update.svg)](https://github.com/robertdebock/ansible-role-update/releases/)| ## [Example Playbook](#example-playbook) @@ -20,7 +20,7 @@ This example is taken from `molecule/resources/converge.yml` and is tested on ea - role: robertdebock.update ``` -The machine may need to be prepared using `molecule/resources/prepare.yml`: +The machine needs to be prepared in CI this is done using `molecule/resources/prepare.yml`: ```yaml --- - name: Prepare @@ -32,19 +32,6 @@ The machine may need to be prepared using `molecule/resources/prepare.yml`: - role: robertdebock.bootstrap ``` -For verification `molecule/resources/verify.yml` run after the role has been applied. -```yaml ---- -- name: Verify - hosts: all - become: yes - gather_facts: yes - - tasks: - - name: check if connection still works - ping: -``` - Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles. ## [Role Variables](#role-variables) @@ -71,23 +58,22 @@ update_reboot: yes ## [Requirements](#requirements) -- Access to a repository containing packages, likely on the internet. -- A recent version of Ansible. (Tests run on the current, previous and next release of Ansible.) +- pip packages listed in [requirements.txt](https://github.com/robertdebock/ansible-role-update/blob/master/requirements.txt). -The following roles can be installed to ensure all requirements are met, using `ansible-galaxy install -r requirements.yml`: +## [Status of requirements](#status-of-requirements) -```yaml ---- -- robertdebock.bootstrap +The following roles are used to prepare a system. You may choose to prepare your system in another way, I have tested these roles as well. -``` +| Requirement | GitHub | GitLab | +|-------------|--------|--------| +| [robertdebock.bootstrap](https://galaxy.ansible.com/robertdebock/bootstrap) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-bootstrap/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-bootstrap/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-bootstrap/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-bootstrap) ## [Context](#context) This role is a part of many compatible roles. Have a look at [the documentation of these roles](https://robertdebock.nl/) for further information. Here is an overview of related roles: -![dependencies](https://raw.githubusercontent.com/robertdebock/drawings/artifacts/update.png "Dependency") +![dependencies](https://raw.githubusercontent.com/robertdebock/ansible-role-update/png/requirements.png "Dependencies") ## [Compatibility](#compatibility) @@ -96,16 +82,16 @@ This role has been tested on these [container images](https://hub.docker.com/u/r |container|tags| |---------|----| |alpine|all| -|amazon|2018.03| +|amazon|Candidate| |el|7, 8| |debian|buster, bullseye| -|fedora|31, 32| +|fedora|all| |opensuse|all| -|ubuntu|focal, bionic, xenial| +|ubuntu|focal, bionic| -The minimum version of Ansible required is 2.8 but tests have been done to: +The minimum version of Ansible required is 2.10, tests have been done to: -- The previous version, on version lower. +- The previous version. - The current version. - The development version. @@ -118,40 +104,8 @@ Some variarations of the build matrix do not work. These are the variations and | Archlinux & Ansible 2.7 | New-style module did not handle its own exit | -## [Testing](#testing) - -[Unit tests](https://travis-ci.com/robertdebock/ansible-role-update) are done on every commit, pull request, release and periodically. - If you find issues, please register them in [GitHub](https://github.com/robertdebock/ansible-role-update/issues) -Testing is done using [Tox](https://tox.readthedocs.io/en/latest/) and [Molecule](https://github.com/ansible/molecule): - -[Tox](https://tox.readthedocs.io/en/latest/) tests multiple ansible versions. -[Molecule](https://github.com/ansible/molecule) tests multiple distributions. - -To test using the defaults (any installed ansible version, namespace: `robertdebock`, image: `fedora`, tag: `latest`): - -``` -molecule test - -# Or select a specific image: -image=ubuntu molecule test -# Or select a specific image and a specific tag: -image="debian" tag="stable" tox -``` - -Or you can test multiple versions of Ansible, and select images: -Tox allows multiple versions of Ansible to be tested. To run the default (namespace: `robertdebock`, image: `fedora`, tag: `latest`) tests: - -``` -tox - -# To run CentOS (namespace: `robertdebock`, tag: `latest`) -image="centos" tox -# Or customize more: -image="debian" tag="stable" tox -``` - ## [License](#license) Apache-2.0 diff --git a/roles/update/handlers/main.yml b/roles/update/handlers/main.yml index b03c7c4..bf3f59b 100644 --- a/roles/update/handlers/main.yml +++ b/roles/update/handlers/main.yml @@ -1,7 +1,8 @@ --- # handlers file for update + - name: reboot - reboot: + ansible.builtin.reboot: when: - update_reboot | bool - ansible_connection != "docker" diff --git a/roles/update/meta 2/.galaxy_install_info b/roles/update/meta 2/.galaxy_install_info deleted file mode 100644 index 2b3b846..0000000 --- a/roles/update/meta 2/.galaxy_install_info +++ /dev/null @@ -1,2 +0,0 @@ -install_date: Mon Sep 28 13:22:43 2020 -version: 2.3.3 diff --git a/roles/update/meta 2/exception.yml b/roles/update/meta 2/exception.yml deleted file mode 100644 index 6da44d3..0000000 --- a/roles/update/meta 2/exception.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -exceptions: - - variation: Archlinux & Ansible 2.7 - reason: New-style module did not handle its own exit diff --git a/roles/update/meta 2/preferences.yml b/roles/update/meta 2/preferences.yml deleted file mode 100644 index e7fdebf..0000000 --- a/roles/update/meta 2/preferences.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -tox_parallel: yes diff --git a/roles/update/meta/.galaxy_install_info b/roles/update/meta/.galaxy_install_info index 2b3b846..ca298ed 100644 --- a/roles/update/meta/.galaxy_install_info +++ b/roles/update/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Mon Sep 28 13:22:43 2020 -version: 2.3.3 +install_date: Sun Mar 21 07:00:05 2021 +version: master diff --git a/roles/update/meta/main.yml b/roles/update/meta/main.yml index 750d1ea..7cbbd54 100644 --- a/roles/update/meta/main.yml +++ b/roles/update/meta/main.yml @@ -1,11 +1,12 @@ --- galaxy_info: author: Robert de Bock + namespace: robertdebock role_name: update description: Install updates on your system. license: Apache-2.0 company: none - min_ansible_version: 2.8 + min_ansible_version: "2.10" platforms: - name: Alpine @@ -13,7 +14,7 @@ galaxy_info: - all - name: Amazon versions: - - 2018.03 + - Candidate - name: EL versions: - 7 @@ -24,8 +25,7 @@ galaxy_info: - bullseye - name: Fedora versions: - - 31 - - 32 + - all - name: OpenSUSE versions: - all @@ -33,11 +33,8 @@ galaxy_info: versions: - focal - bionic - - xenial galaxy_tags: - update - - centos - - redhat dependencies: [] diff --git a/roles/update/molecule 2/default/converge.yml b/roles/update/molecule 2/default/converge.yml deleted file mode 100644 index b42ae1d..0000000 --- a/roles/update/molecule 2/default/converge.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Converge - hosts: all - become: yes - gather_facts: yes - - roles: - - role: ansible-role-update diff --git a/roles/update/molecule 2/default/prepare.yml b/roles/update/molecule 2/default/prepare.yml deleted file mode 100644 index f76c7bf..0000000 --- a/roles/update/molecule 2/default/prepare.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Prepare - hosts: all - become: yes - gather_facts: no - - roles: - - role: robertdebock.bootstrap diff --git a/roles/update/molecule 2/default/verify.yml b/roles/update/molecule 2/default/verify.yml deleted file mode 100644 index 6ab75cf..0000000 --- a/roles/update/molecule 2/default/verify.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -- name: Verify - hosts: all - become: yes - gather_facts: yes - - tasks: - - name: check if connection still works - ping: diff --git a/roles/update/molecule/default/molecule.yml b/roles/update/molecule/default/molecule.yml index b13ed58..c3cafde 100644 --- a/roles/update/molecule/default/molecule.yml +++ b/roles/update/molecule/default/molecule.yml @@ -6,10 +6,11 @@ dependency: name: galaxy options: role-file: requirements.yml + requirements-file: requirements.yml lint: | - PATH=${PATH} - yamllint molecule/default/converge.yml - ansible-lint molecule/default/converge.yml + set -e + yamllint . + ansible-lint driver: name: docker platforms: diff --git a/roles/update/molecule/default/verify.yml b/roles/update/molecule/default/verify.yml index 6ab75cf..b9dc6f8 100644 --- a/roles/update/molecule/default/verify.yml +++ b/roles/update/molecule/default/verify.yml @@ -2,7 +2,7 @@ - name: Verify hosts: all become: yes - gather_facts: yes + gather_facts: no tasks: - name: check if connection still works diff --git a/roles/update/requirements 2.yml b/roles/update/requirements 2.yml deleted file mode 100644 index 46dec9d..0000000 --- a/roles/update/requirements 2.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- robertdebock.bootstrap diff --git a/roles/update/requirements.yml b/roles/update/requirements.yml index 46dec9d..4971e35 100644 --- a/roles/update/requirements.yml +++ b/roles/update/requirements.yml @@ -1,2 +1,5 @@ --- -- robertdebock.bootstrap +roles: + - name: robertdebock.bootstrap +collections: + - name: community.general diff --git a/roles/update/tasks/assert.yml b/roles/update/tasks/assert.yml index a25eb64..46cf9c5 100644 --- a/roles/update/tasks/assert.yml +++ b/roles/update/tasks/assert.yml @@ -1,30 +1,31 @@ --- + - name: test if update_autoremove is set correctly - assert: + ansible.builtin.assert: that: - update_autoremove is defined - - update_autoremove | type_debug == "bool" + - update_autoremove is boolean quiet: yes - name: test if update_upgrade_command is set correctly - assert: + ansible.builtin.assert: that: - update_upgrade_command is defined - - update_upgrade_command | length > 0 - - update_upgrade_command in ["dist", "full", "yes", "safe"] + - update_upgrade_command is string + - update_upgrade_command in [ "dist", "full", "yes", "safe" ] quiet: yes - name: test if update_cache_valid_time is set correctly - assert: + ansible.builtin.assert: that: - update_cache_valid_time is defined - - update_cache_valid_time | int - - update_cache_valid_time | int >= 0 + - update_cache_valid_time is number + - update_cache_valid_time >= 0 quiet: yes - name: test if update_reboot is set correctly - assert: + ansible.builtin.assert: that: - update_reboot is defined - - update_reboot | type_debug == "bool" + - update_reboot is boolean quiet: yes diff --git a/roles/update/tasks/main.yml b/roles/update/tasks/main.yml index 0121e82..468dd6d 100644 --- a/roles/update/tasks/main.yml +++ b/roles/update/tasks/main.yml @@ -1,44 +1,49 @@ --- # tasks file for update + - name: include assert.yml - include_tasks: assert.yml + import_tasks: assert.yml + run_once: yes + delegate_to: localhost -- name: update cache (apk) - apk: - update_cache: yes - when: - - ansible_pkg_mgr == "apk" - changed_when: no +- name: configure apk + block: + - name: update cache (apk) + community.general.apk: + update_cache: yes + changed_when: no -- name: update all software (apk) - apk: - upgrade: yes - notify: - - reboot + - name: update all software (apk) + community.general.apk: + upgrade: yes + notify: + - reboot when: - ansible_pkg_mgr == "apk" -- name: update all software (apt) - apt: - update_cache: yes - upgrade: "{{ update_upgrade_command }}" - cache_valid_time: "{{ update_cache_valid_time }}" - notify: - - reboot - when: - - ansible_pkg_mgr == "apt" +- name: configure apt + block: + - name: update all software (apt) + ansible.builtin.apt: + update_cache: yes + upgrade: "{{ update_upgrade_command }}" + cache_valid_time: "{{ update_cache_valid_time }}" + notify: + - reboot -- name: apt autoremove (apt) - apt: - autoremove: "{{ update_autoremove }}" + - name: apt autoremove (apt) + ansible.builtin.apt: + autoremove: "{{ update_autoremove }}" + when: + - ansible_pkg_mgr == "apt" + - update_autoremove == "yes" + tags: + - skip_ansible_lint when: - ansible_pkg_mgr == "apt" - - update_autoremove == "yes" - tags: - - skip_ansible_lint - name: update all software (dnf) - dnf: + ansible.builtin.dnf: name: "*" state: latest notify: @@ -49,7 +54,7 @@ - skip_ansible_lint - name: update all software (pacman) - pacman: + community.general.pacman: update_cache: yes upgrade: yes notify: @@ -59,39 +64,40 @@ tags: - skip_ansible_lint -- name: update all software (yum/6) - yum: - name: "*" - state: latest - notify: - - reboot - when: - - ansible_pkg_mgr == "yum" - - ansible_distribution_major_version == "6" - tags: - - skip_ansible_lint +- name: configure yum + block: + - name: update all software (yum/6) + ansible.builtin.yum: + name: "*" + state: latest + notify: + - reboot + when: + - ansible_distribution_major_version == "6" + tags: + - skip_ansible_lint -- name: update all software (yum/7) - yum: - name: "*" - state: latest - notify: - - reboot - when: - - ansible_pkg_mgr == "yum" - - ansible_distribution_major_version == "7" - tags: - - skip_ansible_lint + - name: configure 7 + block: + - name: update all software (yum/7) + ansible.builtin.yum: + name: "*" + state: latest + notify: + - reboot + tags: + - skip_ansible_lint -- name: install yum-utils - package: - name: yum-utils + - name: install yum-utils + ansible.builtin.package: + name: yum-utils + when: + - ansible_distribution_major_version == "7" when: - ansible_pkg_mgr == "yum" - - ansible_distribution_major_version == "7" - name: update all software (zypper) - zypper: + community.general.zypper: name: "*" state: latest notify: diff --git a/roles/update/tox.ini b/roles/update/tox.ini index c1bc1d4..f57553b 100644 --- a/roles/update/tox.ini +++ b/roles/update/tox.ini @@ -2,25 +2,25 @@ # Ansible managed # [tox] -minversion = 3.7 -# Disabled "next" because of: -# https://github.com/ansible-community/molecule/issues/2626. -# envlist = py{38}-ansible-{previous,current,next} -envlist = py{38}-ansible-{previous,current} +minversion = 3.21.4 +# 2.11 has been disabled: couldn't resolve module/action 'docker_container'. +envlist = py{39}-ansible-{2.9,2.10} + skipsdist = true [testenv] deps = - previous: ansible>=2.8, <2.9 - current: ansible>=2.9 - next: git+https://github.com/ansible/ansible.git@devel - molecule[lint]>=3, <4 - docker>=4.2, <4.3 + 2.9: ansible == 2.9.* + 2.10: ansible == 2.10.* + 2.11: git+https://github.com/ansible/ansible.git@devel + molecule[docker] + docker == 4.* + ansible-lint == 5.* commands = molecule test setenv = TOX_ENVNAME={envname} - MOLECULE_EPHEMERAL_DIRECTORY=/tmp/.molecule/{env:image:fedora}-{env:tag:latest}/{envname} PY_COLORS=1 ANSIBLE_FORCE_COLOR=1 + ANSIBLE_ROLES_PATH=../ passenv = namespace image tag diff --git a/roles/users/.ansible-lint b/roles/users/.ansible-lint index cb2872e..57f681e 100644 --- a/roles/users/.ansible-lint +++ b/roles/users/.ansible-lint @@ -3,5 +3,9 @@ # exclude_paths: - ./meta/preferences.yml + - ./molecule/default/prepare.yml + - ./molecule/default/converge.yml - ./molecule/default/verify.yml + - ./molecule/default/collections.yml - ./.tox + - ./.cache diff --git a/roles/users/.ansible-lint 2 b/roles/users/.ansible-lint 2 deleted file mode 100644 index cb2872e..0000000 --- a/roles/users/.ansible-lint 2 +++ /dev/null @@ -1,7 +0,0 @@ -# -# Ansible managed -# -exclude_paths: - - ./meta/preferences.yml - - ./molecule/default/verify.yml - - ./.tox diff --git a/roles/users/.github 2/FUNDING.yml b/roles/users/.github 2/FUNDING.yml deleted file mode 100644 index 67320f0..0000000 --- a/roles/users/.github 2/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -github: robertdebock diff --git a/roles/users/.github 2/pull_request_template.md b/roles/users/.github 2/pull_request_template.md deleted file mode 100644 index b1578c0..0000000 --- a/roles/users/.github 2/pull_request_template.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: Pull request -about: Describe the proposed change - ---- - -**Describe the change** -A clear and concise description of what the pull request is. - -**Testing** -In case a feature was added, how were tests performed? diff --git a/roles/users/.github 2/settings.yml b/roles/users/.github 2/settings.yml deleted file mode 100644 index cd26217..0000000 --- a/roles/users/.github 2/settings.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# -# Ansible managed -# -repository: - description: The purpose of this role is to add users and groups on your system. - homepage: https://robertdebock.nl/ diff --git a/roles/users/.github/settings.yml b/roles/users/.github/settings.yml index cd26217..1da8103 100644 --- a/roles/users/.github/settings.yml +++ b/roles/users/.github/settings.yml @@ -5,3 +5,4 @@ repository: description: The purpose of this role is to add users and groups on your system. homepage: https://robertdebock.nl/ + topics: users, server, sudo, system, ansible, molecule, tox, playbook, hacktoberfest diff --git a/roles/users/.github/workflows/galaxy.yml b/roles/users/.github/workflows/galaxy.yml index 5ec3062..1d36b74 100644 --- a/roles/users/.github/workflows/galaxy.yml +++ b/roles/users/.github/workflows/galaxy.yml @@ -6,17 +6,13 @@ name: Release to Ansible Galaxy on: - push: - tags: - - '*' - schedule: - - cron: '21 21 21 * *' - + release: + types: [created, edited, published, released] jobs: release: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: galaxy - uses: robertdebock/galaxy-action@1.0.1 + uses: robertdebock/galaxy-action@1.1.0 with: galaxy_api_key: ${{ secrets.galaxy_api_key }} diff --git a/roles/users/.github/workflows/molecule.yml b/roles/users/.github/workflows/molecule.yml index d7a3e2c..bd9805e 100644 --- a/roles/users/.github/workflows/molecule.yml +++ b/roles/users/.github/workflows/molecule.yml @@ -15,30 +15,28 @@ on: jobs: lint: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: checkout uses: actions/checkout@v2 with: path: "${{ github.repository }}" - name: molecule - uses: robertdebock/molecule-action@2.6.1 + uses: robertdebock/molecule-action@2.6.16 with: command: lint test: needs: - lint - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: config: - image: "alpine" tag: "latest" - - image: "alpine" - tag: "edge" - image: "amazonlinux" - tag: "1" + tag: "latest" - image: "centos" tag: "7" - image: "centos" @@ -48,7 +46,7 @@ jobs: - image: "debian" tag: "bullseye" - image: "fedora" - tag: "31" + tag: "32" - image: "fedora" tag: "latest" - image: "opensuse" @@ -57,8 +55,6 @@ jobs: tag: "latest" - image: "ubuntu" tag: "bionic" - - image: "ubuntu" - tag: "xenial" steps: - name: checkout uses: actions/checkout@v2 @@ -69,10 +65,7 @@ jobs: - name: parse apparmor for mysql run: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - name: molecule - uses: robertdebock/molecule-action@2.6.1 + uses: robertdebock/molecule-action@2.6.16 with: image: ${{ matrix.config.image }} tag: ${{ matrix.config.tag }} - options: "--parallel all" - env: - TOX_PARALLEL_NO_SPINNER: 1 diff --git a/roles/users/.gitignore b/roles/users/.gitignore index 982db11..c15d16a 100644 --- a/roles/users/.gitignore +++ b/roles/users/.gitignore @@ -2,3 +2,4 @@ *.log *.swp .tox +.cache diff --git a/roles/users/.gitignore 2 b/roles/users/.gitignore 2 deleted file mode 100644 index 982db11..0000000 --- a/roles/users/.gitignore 2 +++ /dev/null @@ -1,4 +0,0 @@ -.molecule -*.log -*.swp -.tox diff --git a/roles/users/.travis.yml b/roles/users/.travis.yml index c82859d..21201e1 100644 --- a/roles/users/.travis.yml +++ b/roles/users/.travis.yml @@ -8,43 +8,23 @@ os: linux dist: xenial python: - - "3.8" + - "3.9" services: - docker -env: - global: - namespace="robertdebock" - jobs: - - image="alpine" tag="latest" - - image="alpine" tag="edge" - - image="amazonlinux" tag="1" - - image="centos" tag="7" - - image="centos" tag="latest" - - image="debian" tag="latest" - - image="debian" tag="bullseye" - - image="fedora" tag="31" - - image="fedora" tag="latest" - - image="opensuse" tag="latest" - - image="ubuntu" tag="latest" - - image="ubuntu" tag="bionic" - - image="ubuntu" tag="xenial" - cache: - pip install: - pip install --upgrade pip - - pip install tox + - pip install yamllint + - pip install ansible-lint script: - - function retry { counter=0 ; until "$@" ; do exit=$? ; counter=$(($counter + 1)) ; if [ $counter -ge 3 ] ; then return $exit ; fi ; done ; return 0; } ; retry tox --parallel all + - yamllint . + - ansible-lint notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ - slack: - secure: "OmpxwNaBJqLyNSlkSO77DxH+hAndVfrb0cMgb2RYO68ziieK81r/cJpDGFJAWU+6/819G9PNmSgmREKJ8imuHDJx2PEJ9kCAwvUrGL2dmNjSiltQSdDCJDIWMLLDcsecC81C1FxMGnltMaDg2z/OhqwR+mA6z89RaiKeBLV3w/c9y75/Te4dtN2n1l6wQyIGmksjTYUmbZlwakyHEy3jls1tAc4rw9AoP1QBk/3opqMk2gGDsPRyoTsJSNWL6q0PILldcxdX9KHuFojPgmZnEgeBKrpABuLT6yjEcBvnKGt0jnkGRl52TjF0ARcYStKs5l0gvcGeQ3dwC26uQgEQL7RPVKmAwoWus57znOX6s3EN6mExVuf5+zbhDzcBeF07cbNYHGUcxpJdBDiEyb80icDBFOa0adgEcgykjiGbv7MiVK+05utSitgtfeeDxbyeXQGCh/vxFWBAWDNd4PE+NztPR05j4PpOLwheJalIRp/z21RiHRdbwldHptYC2NRGO59BI1o0pb6Ol9hYPXGfDpZ1KBdz76D0F6bfEvtvsdcXIAlarln9DE6o3VZSz910TdzmI0q6O5EDig6XOpfrdfW4JZp5RT2i51xOm/RDLnul84+n5rOG4LsVHI1MZp/IxFqsKv9FSgm22Ib44lPX+rkMScFX2uvjpy7UnC6uEcw=" - on_success: change - template: "%{result}: %{repository_slug}@%{branch}, build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}>)" email: false diff --git a/roles/users/.yamllint b/roles/users/.yamllint index 894450c..a7ff098 100644 --- a/roles/users/.yamllint +++ b/roles/users/.yamllint @@ -13,3 +13,4 @@ rules: ignore: | .tox/ + .cache/ diff --git a/roles/users/LICENSE b/roles/users/LICENSE index bd15893..e770af8 100644 --- a/roles/users/LICENSE +++ b/roles/users/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 Robert de Bock (robert@meinit.nl) + Copyright 2021 Robert de Bock (robert@meinit.nl) 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/roles/users/README.md b/roles/users/README.md index 0ebabf7..7e45f9a 100644 --- a/roles/users/README.md +++ b/roles/users/README.md @@ -2,9 +2,9 @@ The purpose of this role is to add users and groups on your system. -|Travis|GitHub|Quality|Downloads|Version| +|GitHub|GitLab|Quality|Downloads|Version| |------|------|-------|---------|-------| -|[![travis](https://travis-ci.com/robertdebock/ansible-role-users.svg?branch=master)](https://travis-ci.com/robertdebock/ansible-role-users)|[![github](https://github.com/robertdebock/ansible-role-users/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-users/actions)|[![quality](https://img.shields.io/ansible/quality/29201)](https://galaxy.ansible.com/robertdebock/users)|[![downloads](https://img.shields.io/ansible/role/d/29201)](https://galaxy.ansible.com/robertdebock/users)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-users.svg)](https://github.com/robertdebock/ansible-role-users/releases/)| +|[![github](https://github.com/robertdebock/ansible-role-users/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-users/actions)|[![gitlab](https://gitlab.com/robertdebock/ansible-role-users/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-users)|[![quality](https://img.shields.io/ansible/quality/29201)](https://galaxy.ansible.com/robertdebock/users)|[![downloads](https://img.shields.io/ansible/role/d/29201)](https://galaxy.ansible.com/robertdebock/users)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-users.svg)](https://github.com/robertdebock/ansible-role-users/releases/)| ## [Example Playbook](#example-playbook) @@ -24,6 +24,8 @@ This example is taken from `molecule/resources/converge.yml` and is tested on ea - name: users - name: notgroup state: absent + - name: systemgroup + system: yes users_user_list: - name: root @@ -56,9 +58,11 @@ This example is taken from `molecule/resources/converge.yml` and is tested on ea - name: remotekey authorized_keys: - "https://raw.githubusercontent.com/shaanr/smdb/master/file.pub" + - name: systemuser + system: yes ``` -The machine may need to be prepared using `molecule/resources/prepare.yml`: +The machine needs to be prepared in CI this is done using `molecule/resources/prepare.yml`: ```yaml --- - name: Prepare @@ -71,25 +75,6 @@ The machine may need to be prepared using `molecule/resources/prepare.yml`: - role: robertdebock.core_dependencies ``` -For verification `molecule/resources/verify.yml` run after the role has been applied. -```yaml ---- -- name: Verify - hosts: all - become: yes - gather_facts: no - - tasks: - - name: record status of .ssh - stat: - path: /home/keyuser/.ssh - register: result - - name: check status of .ssh - assert: - that: - - result.stat.exists -``` - Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles. ## [Role Variables](#role-variables) @@ -107,28 +92,30 @@ users_shell: /bin/bash # manage cron permissions via /etc/cron.allow users_cron_allow: yes + +# should homedirectories be created? +users_create_home: yes ``` ## [Requirements](#requirements) -- Access to a repository containing packages, likely on the internet. -- A recent version of Ansible. (Tests run on the current, previous and next release of Ansible.) +- pip packages listed in [requirements.txt](https://github.com/robertdebock/ansible-role-users/blob/master/requirements.txt). -The following roles can be installed to ensure all requirements are met, using `ansible-galaxy install -r requirements.yml`: +## [Status of requirements](#status-of-requirements) -```yaml ---- -- robertdebock.bootstrap -- robertdebock.core_dependencies +The following roles are used to prepare a system. You may choose to prepare your system in another way, I have tested these roles as well. -``` +| Requirement | GitHub | GitLab | +|-------------|--------|--------| +| [robertdebock.bootstrap](https://galaxy.ansible.com/robertdebock/bootstrap) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-bootstrap/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-bootstrap/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-bootstrap/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-bootstrap) +| [robertdebock.core_dependencies](https://galaxy.ansible.com/robertdebock/core_dependencies) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-core_dependencies/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-core_dependencies/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-core_dependencies/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-core_dependencies) ## [Context](#context) This role is a part of many compatible roles. Have a look at [the documentation of these roles](https://robertdebock.nl/) for further information. Here is an overview of related roles: -![dependencies](https://raw.githubusercontent.com/robertdebock/drawings/artifacts/users.png "Dependency") +![dependencies](https://raw.githubusercontent.com/robertdebock/ansible-role-users/png/requirements.png "Dependencies") ## [Compatibility](#compatibility) @@ -137,55 +124,23 @@ This role has been tested on these [container images](https://hub.docker.com/u/r |container|tags| |---------|----| |alpine|all| -|amazon|2018.03| +|amazon|Candidate| |el|7, 8| |debian|buster, bullseye| -|fedora|31, 32| +|fedora|all| |opensuse|all| -|ubuntu|focal, bionic, xenial| +|ubuntu|focal, bionic| -The minimum version of Ansible required is 2.8 but tests have been done to: +The minimum version of Ansible required is 2.10, tests have been done to: -- The previous version, on version lower. +- The previous version. - The current version. - The development version. -## [Testing](#testing) - -[Unit tests](https://travis-ci.com/robertdebock/ansible-role-users) are done on every commit, pull request, release and periodically. - If you find issues, please register them in [GitHub](https://github.com/robertdebock/ansible-role-users/issues) -Testing is done using [Tox](https://tox.readthedocs.io/en/latest/) and [Molecule](https://github.com/ansible/molecule): - -[Tox](https://tox.readthedocs.io/en/latest/) tests multiple ansible versions. -[Molecule](https://github.com/ansible/molecule) tests multiple distributions. - -To test using the defaults (any installed ansible version, namespace: `robertdebock`, image: `fedora`, tag: `latest`): - -``` -molecule test - -# Or select a specific image: -image=ubuntu molecule test -# Or select a specific image and a specific tag: -image="debian" tag="stable" tox -``` - -Or you can test multiple versions of Ansible, and select images: -Tox allows multiple versions of Ansible to be tested. To run the default (namespace: `robertdebock`, image: `fedora`, tag: `latest`) tests: - -``` -tox - -# To run CentOS (namespace: `robertdebock`, tag: `latest`) -image="centos" tox -# Or customize more: -image="debian" tag="stable" tox -``` - ## [License](#license) Apache-2.0 diff --git a/roles/users/defaults/main.yml b/roles/users/defaults/main.yml index dcf81ab..a1a2a66 100644 --- a/roles/users/defaults/main.yml +++ b/roles/users/defaults/main.yml @@ -9,3 +9,6 @@ users_shell: /bin/bash # manage cron permissions via /etc/cron.allow users_cron_allow: yes + +# should homedirectories be created? +users_create_home: yes diff --git a/roles/users/meta 2/.galaxy_install_info b/roles/users/meta 2/.galaxy_install_info deleted file mode 100644 index 54407be..0000000 --- a/roles/users/meta 2/.galaxy_install_info +++ /dev/null @@ -1,2 +0,0 @@ -install_date: Mon Sep 28 13:22:46 2020 -version: 4.3.3 diff --git a/roles/users/meta 2/preferences.yml b/roles/users/meta 2/preferences.yml deleted file mode 100644 index e7fdebf..0000000 --- a/roles/users/meta 2/preferences.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -tox_parallel: yes diff --git a/roles/users/meta/.galaxy_install_info b/roles/users/meta/.galaxy_install_info index 54407be..15b37e6 100644 --- a/roles/users/meta/.galaxy_install_info +++ b/roles/users/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Mon Sep 28 13:22:46 2020 -version: 4.3.3 +install_date: Sun Mar 21 07:00:08 2021 +version: master diff --git a/roles/users/meta/main.yml b/roles/users/meta/main.yml index 2aa3103..3777302 100644 --- a/roles/users/meta/main.yml +++ b/roles/users/meta/main.yml @@ -1,11 +1,12 @@ --- galaxy_info: author: Robert de Bock + namespace: robertdebock role_name: users description: The purpose of this role is to add users and groups on your system. license: Apache-2.0 company: none - min_ansible_version: 2.8 + min_ansible_version: "2.10" platforms: - name: Alpine @@ -13,7 +14,7 @@ galaxy_info: - all - name: Amazon versions: - - 2018.03 + - Candidate - name: EL versions: - 7 @@ -24,8 +25,7 @@ galaxy_info: - bullseye - name: Fedora versions: - - 31 - - 32 + - all - name: OpenSUSE versions: - all @@ -33,12 +33,9 @@ galaxy_info: versions: - focal - bionic - - xenial galaxy_tags: - users - - centos - - redhat - server - sudo - system diff --git a/roles/users/molecule/default/converge.yml b/roles/users/molecule/default/converge.yml index af20f91..5dd90cd 100644 --- a/roles/users/molecule/default/converge.yml +++ b/roles/users/molecule/default/converge.yml @@ -12,6 +12,8 @@ - name: users - name: notgroup state: absent + - name: systemgroup + system: yes users_user_list: - name: root @@ -44,3 +46,5 @@ - name: remotekey authorized_keys: - "https://raw.githubusercontent.com/shaanr/smdb/master/file.pub" + - name: systemuser + system: yes diff --git a/roles/users/molecule/default/molecule.yml b/roles/users/molecule/default/molecule.yml index 361191f..b4d0cdc 100644 --- a/roles/users/molecule/default/molecule.yml +++ b/roles/users/molecule/default/molecule.yml @@ -9,6 +9,7 @@ dependency: lint: | set -e yamllint . + ansible-lint driver: name: docker platforms: diff --git a/roles/users/molecule/default/verify.yml b/roles/users/molecule/default/verify.yml index b9cd313..7d4355f 100644 --- a/roles/users/molecule/default/verify.yml +++ b/roles/users/molecule/default/verify.yml @@ -9,7 +9,13 @@ stat: path: /home/keyuser/.ssh register: result - - name: check status of .ssh - assert: - that: - - result.stat.exists + failed_when: + - not result.stat.exists + + - name: check if user notuser does not exist + user: + name: notuser + state: absent + register: users_check_user_notuser + failed_when: + - users_check_user_notuser is changed diff --git a/roles/users/requirements 2.yml b/roles/users/requirements 2.yml deleted file mode 100644 index e531325..0000000 --- a/roles/users/requirements 2.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- robertdebock.bootstrap -- robertdebock.core_dependencies diff --git a/roles/users/requirements.yml b/roles/users/requirements.yml index e531325..e540ea4 100644 --- a/roles/users/requirements.yml +++ b/roles/users/requirements.yml @@ -1,3 +1,4 @@ --- -- robertdebock.bootstrap -- robertdebock.core_dependencies +roles: + - name: robertdebock.bootstrap + - name: robertdebock.core_dependencies diff --git a/roles/users/tasks/assert.yml b/roles/users/tasks/assert.yml index 45f67f8..9dd6bf3 100644 --- a/roles/users/tasks/assert.yml +++ b/roles/users/tasks/assert.yml @@ -1,39 +1,46 @@ --- + - name: test if users_ssh_key_directory is set correctly - assert: + ansible.builtin.assert: that: - users_ssh_key_directory is defined - - users_ssh_key_directory | length > 0 + - users_ssh_key_directory is string quiet: yes - name: test if users_shell is set correctly - assert: + ansible.builtin.assert: that: - users_shell is defined - - users_shell | length > 0 + - users_shell is string quiet: yes - name: test if users_cron_allow is set correctly - assert: + ansible.builtin.assert: that: - users_cron_allow is defined - - users_cron_allow | type_debug == "bool" + - users_cron_allow is boolean + quiet: yes + +- name: test if users_create_home is set correctly + ansible.builtin.assert: + that: + - users_create_home is defined + - users_create_home is boolean quiet: yes - name: test if users_group_list is set correctly - assert: + ansible.builtin.assert: that: - - users_group_list | length > 0 - users_group_list is iterable quiet: yes when: - users_group_list is defined - name: test if item.name in users_group_list is set correctly - assert: + ansible.builtin.assert: that: - item.name is defined - - item.name | length > 0 + - item.name is string quiet: yes loop: "{{ users_group_list }}" loop_control: @@ -42,11 +49,11 @@ - users_group_list is defined - name: test if item.gid in users_group_list is set correctly - assert: + ansible.builtin.assert: that: - item.gid is defined - - item.gid | int - - item.gid | int > 0 + - item.gid is number + - item.gid > 0 quiet: yes loop: "{{ users_group_list }}" loop_control: @@ -56,11 +63,11 @@ - item.gid is defined - name: test if item.state in users_group_list is set correctly - assert: + ansible.builtin.assert: that: - item.state is defined - - item.state | length > 0 - - item.state in ["absent", "present"] + - item.state is string + - item.state in [ "absent", "present" ] quiet: yes loop: "{{ users_group_list }}" loop_control: @@ -69,22 +76,23 @@ - users_group_list is defined - item.state is defined -- name: test if users_user_list is set correctly - assert: +- name: test if item.system in users_group_list is set correctly + ansible.builtin.assert: that: - - users_user_list | length > 0 + - item.system is boolean quiet: yes - loop: "{{ users_user_list }}" + loop: "{{ users_group_list }}" loop_control: label: "{{ item.name }}" when: - - users_user_list is defined + - users_group_list is defined + - item.system is defined - name: test if item.name in users_user_list is set correctly - assert: + ansible.builtin.assert: that: - item.name is defined - - item.name | length > 0 + - item.name is string quiet: yes loop: "{{ users_user_list }}" loop_control: @@ -93,9 +101,9 @@ - users_user_list is defined - name: test if item.cron_allow in users_user_list is set correctly - assert: + ansible.builtin.assert: that: - - item.cron_allow | type_debug == "bool" + - item.cron_allow is boolean quiet: yes loop: "{{ users_user_list }}" loop_control: @@ -104,23 +112,11 @@ - users_user_list is defined - item.cron_allow is defined -- name: test if item.comment in users_user_list is set correctly - assert: - that: - - item.comment | length > 0 - quiet: yes - loop: "{{ users_user_list }}" - loop_control: - label: "{{ item.name }}" - when: - - users_user_list is defined - - item.comment is defined - - name: test if item.uid in users_user_list is set correctly - assert: + ansible.builtin.assert: that: - - item.uid | int - - item.uid | int >= 0 + - item.uid is number + - item.uid >= 0 quiet: yes loop: "{{ users_user_list }}" loop_control: @@ -129,46 +125,9 @@ - users_user_list is defined - item.uid is defined -- name: test if item.group in users_user_list is set correctly - assert: - that: - - item.group | length > 0 - quiet: yes - loop: "{{ users_user_list }}" - loop_control: - label: "{{ item.name }}" - when: - - users_user_list is defined - - item.group is defined - -- name: test if item.groups in users_user_list is set correctly - assert: - that: - - item.groups | length > 0 - quiet: yes - loop: "{{ users_user_list }}" - loop_control: - label: "{{ item.name }}" - when: - - users_user_list is defined - - item.groups is defined - -- name: test if item.sudo_options in users_user_list is set correctly - assert: - that: - - item.sudo_options | length > 0 - quiet: yes - loop: "{{ users_user_list }}" - loop_control: - label: "{{ item.name }}" - when: - - users_user_list is defined - - item.sudo_options is defined - - name: test if item.authorized_keys in users_user_list is set correctly - assert: + ansible.builtin.assert: that: - - item.authorized_keys | length > 0 - item.authorized_keys is iterable quiet: yes loop: "{{ users_user_list }}" @@ -179,9 +138,9 @@ - item.authorized_keys is defined - name: test if item.manage_ssh_key in users_user_list is set correctly - assert: + ansible.builtin.assert: that: - - item.manage_ssh_key | type_debug == "bool" + - item.manage_ssh_key is boolean quiet: yes loop: "{{ users_user_list }}" loop_control: @@ -190,23 +149,10 @@ - users_user_list is defined - item.manage_ssh_key is defined -- name: test if item.password in users_user_list is set correctly - assert: - that: - - item.password | length > 0 - quiet: yes - loop: "{{ users_user_list }}" - loop_control: - label: "{{ item.name }}" - when: - - users_user_list is defined - - item.password is defined - - name: test if item.update_password in users_user_list is set correctly - assert: + ansible.builtin.assert: that: - - item.update_password | length > 0 - - item.update_password in ["always", "on_create"] + - item.update_password in [ "always", "on_create" ] quiet: yes loop: "{{ users_user_list }}" loop_control: @@ -216,10 +162,10 @@ - item.update_password is defined - name: test if item.exipres in users_user_list is set correctly - assert: + ansible.builtin.assert: that: - - item.expires | int - - item.expires | int >= -1 + - item.expires is number + - item.expires >= -1 quiet: yes loop: "{{ users_user_list }}" loop_control: @@ -229,10 +175,10 @@ - item.expires is defined - name: test if item.password_validity_days in users_user_list is set correctly - assert: + ansible.builtin.assert: that: - - item.password_validity_days | int - - item.password_validity_days | int >= -1 + - item.password_validity_days is number + - item.password_validity_days >= -1 quiet: yes loop: "{{ users_user_list }}" loop_control: @@ -240,3 +186,15 @@ when: - users_user_list is defined - item.password_validity_days is defined + +- name: test if item.system in users_user_list is set correctly + ansible.builtin.assert: + that: + - item.system is boolean + quiet: yes + loop: "{{ users_user_list }}" + loop_control: + label: "{{ item.name }}" + when: + - users_user_list is defined + - item.system is defined diff --git a/roles/users/tasks/group.yml b/roles/users/tasks/group.yml index a2eae67..001f002 100644 --- a/roles/users/tasks/group.yml +++ b/roles/users/tasks/group.yml @@ -1,6 +1,7 @@ --- - name: manage group {{ group.name }} - group: + ansible.builtin.group: name: "{{ group.name }}" state: "{{ group.state | default('present') }}" gid: "{{ group.gid | default(omit) }}" + system: "{{ group.system | default(omit) }}" diff --git a/roles/users/tasks/main.yml b/roles/users/tasks/main.yml index 025db58..a65140b 100644 --- a/roles/users/tasks/main.yml +++ b/roles/users/tasks/main.yml @@ -1,15 +1,18 @@ --- # tasks file for users + - name: include assert.yml - include_tasks: assert.yml + import_tasks: assert.yml + run_once: yes + delegate_to: localhost - name: install required software - package: + ansible.builtin.package: name: "{{ users_requirements }}" state: present - name: loop over users_group_list - include: group.yml + ansible.builtin.include: group.yml loop: "{{ users_group_list }}" loop_control: label: "{{ group.name }}" @@ -18,7 +21,7 @@ - users_group_list is defined - name: loop over users_user_list - include: user.yml + ansible.builtin.include: user.yml loop: "{{ users_user_list }}" loop_control: label: "{{ user.name }}" @@ -27,14 +30,16 @@ - users_user_list is defined - name: manage cron permission - template: + ansible.builtin.template: src: cron.allow.j2 dest: /etc/cron.allow mode: "0640" - when: users_cron_allow|bool + when: + - users_cron_allow | bool - name: check existence of /etc/cron.allow - file: + ansible.builtin.file: path: /etc/cron.allow state: absent - when: not users_cron_allow|bool + when: + - not users_cron_allow|bool diff --git a/roles/users/tasks/user.yml b/roles/users/tasks/user.yml index 9e58187..7719992 100644 --- a/roles/users/tasks/user.yml +++ b/roles/users/tasks/user.yml @@ -1,7 +1,7 @@ --- # tasks file for users - name: create local ssh_key_directory - file: + ansible.builtin.file: path: "{{ users_ssh_key_directory }}" state: directory mode: "0750" @@ -12,21 +12,24 @@ become: no - name: manage users {{ user.name }} - user: + ansible.builtin.user: name: "{{ user.name }}" state: "{{ user.state | default('present') }}" comment: "{{ user.comment | default(omit) }}" + create_home: "{{ users_create_home }}" password: "{{ user.password | default(omit) }}" uid: "{{ user.uid | default(omit) }}" group: "{{ user.group | default(omit) }}" groups: "{{ user.groups | default(omit) }}" + home: "{{ user.home | default(omit) }}" shell: "{{ user.shell | default(users_shell) }}" update_password: "{{ user.update_password | default(omit) }}" expires: "{{ user.expires | default(omit) }}" + system: "{{ user.system | default(omit) }}" register: users_manage_user - name: set sudo options for {{ user.name }} - template: + ansible.builtin.template: src: sudo.j2 dest: "/etc/sudoers.d/{{ user.name }}" mode: "0640" @@ -36,7 +39,7 @@ label: "{{ user.name }}" - name: remove sudo options for {{ user.name }} - file: + ansible.builtin.file: path: "/etc/sudoers.d/{{ user.name }}" state: absent when: @@ -45,7 +48,7 @@ label: "{{ user.name }}" - name: generate private ssh key for {{ user.name }} - command: "{{ users_ssh_keygen_command }}" + ansible.builtin.command: "{{ users_ssh_keygen_command }}" args: creates: "{{ users_ssh_key_directory }}/{{ user.name }}" when: @@ -57,7 +60,7 @@ become: no - name: generate public ssh key for {{ user.name }} - shell: "{{ users_ssh_keygen_pubkey_command }} > {{ users_ssh_key_directory }}/{{ user.name }}.pub" + ansible.builtin.shell: "{{ users_ssh_keygen_pubkey_command }} > {{ users_ssh_key_directory }}/{{ user.name }}.pub" args: creates: "{{ users_ssh_key_directory }}/{{ user.name }}.pub" when: @@ -69,7 +72,7 @@ become: no - name: convert ssh key to ppk for {{ user.name }} - shell: > + ansible.builtin.shell: > ssh-keygen -e -f "{{ users_ssh_key_directory }}/{{ user.name }}" -C "Generated by Ansible role robertdebock.users" > "{{ users_ssh_key_directory }}/{{ user.name }}.ppk" @@ -82,7 +85,7 @@ become: no - name: create .ssh directory for {{ user.name }} - file: + ansible.builtin.file: path: "/home/{{ user.name }}/.ssh" state: directory mode: "700" @@ -93,7 +96,7 @@ - user.manage_ssh_key - name: loop over authorized_keys for {{ user.name }} - include: user_authorized_key.yml + ansible.builtin.include: user_authorized_key.yml loop: "{{ user.authorized_keys }}" loop_control: label: "{{ user.name }}" @@ -102,13 +105,12 @@ - user.authorized_keys is defined - name: copy generated private ssh key for {{ user.name }} - copy: + ansible.builtin.copy: src: "{{ users_ssh_key_directory }}/{{ user.name }}" dest: "/home/{{ user.name }}/.ssh/id_rsa" mode: "400" owner: "{{ user.name }}" group: "{{ user.group | default(omit) }}" - loop: "{{ lookup('dict', users_manage_user, wantlist=True) }}" when: - users_manage_user is defined - user.copy_private_key is defined diff --git a/roles/users/tasks/user_authorized_key.yml b/roles/users/tasks/user_authorized_key.yml index e746129..306c625 100644 --- a/roles/users/tasks/user_authorized_key.yml +++ b/roles/users/tasks/user_authorized_key.yml @@ -5,3 +5,5 @@ state: present key: "{{ item }}" loop: "{{ user.authorized_keys }}" + loop_control: + label: "{{ user.name }}" diff --git a/roles/users/templates 2/.gitkeep b/roles/users/templates 2/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/roles/users/templates 2/cron.allow.j2 b/roles/users/templates 2/cron.allow.j2 deleted file mode 100644 index 2b339d4..0000000 --- a/roles/users/templates 2/cron.allow.j2 +++ /dev/null @@ -1,10 +0,0 @@ -{{ ansible_managed | comment }} -{% if users_user_list is defined %} -{% for user in users_user_list %} -{% if user.cron_allow is defined %} -{% if user.cron_allow %} -{{ user.name }} -{% endif %} -{% endif %} -{% endfor %} -{% endif %} diff --git a/roles/users/templates 2/sudo.j2 b/roles/users/templates 2/sudo.j2 deleted file mode 100644 index 43459cc..0000000 --- a/roles/users/templates 2/sudo.j2 +++ /dev/null @@ -1,2 +0,0 @@ -{{ ansible_managed | comment }} -{{ user.name }} {{ user.sudo_options }} diff --git a/roles/users/tox.ini b/roles/users/tox.ini index c1bc1d4..f57553b 100644 --- a/roles/users/tox.ini +++ b/roles/users/tox.ini @@ -2,25 +2,25 @@ # Ansible managed # [tox] -minversion = 3.7 -# Disabled "next" because of: -# https://github.com/ansible-community/molecule/issues/2626. -# envlist = py{38}-ansible-{previous,current,next} -envlist = py{38}-ansible-{previous,current} +minversion = 3.21.4 +# 2.11 has been disabled: couldn't resolve module/action 'docker_container'. +envlist = py{39}-ansible-{2.9,2.10} + skipsdist = true [testenv] deps = - previous: ansible>=2.8, <2.9 - current: ansible>=2.9 - next: git+https://github.com/ansible/ansible.git@devel - molecule[lint]>=3, <4 - docker>=4.2, <4.3 + 2.9: ansible == 2.9.* + 2.10: ansible == 2.10.* + 2.11: git+https://github.com/ansible/ansible.git@devel + molecule[docker] + docker == 4.* + ansible-lint == 5.* commands = molecule test setenv = TOX_ENVNAME={envname} - MOLECULE_EPHEMERAL_DIRECTORY=/tmp/.molecule/{env:image:fedora}-{env:tag:latest}/{envname} PY_COLORS=1 ANSIBLE_FORCE_COLOR=1 + ANSIBLE_ROLES_PATH=../ passenv = namespace image tag diff --git a/roles/vagrant/.ansible-lint b/roles/vagrant/.ansible-lint index eba57d1..7a17121 100644 --- a/roles/vagrant/.ansible-lint +++ b/roles/vagrant/.ansible-lint @@ -4,5 +4,9 @@ exclude_paths: - ./meta/exception.yml - ./meta/preferences.yml + - ./molecule/default/prepare.yml + - ./molecule/default/converge.yml - ./molecule/default/verify.yml + - ./molecule/default/collections.yml - ./.tox + - ./.cache diff --git a/roles/vagrant/.github 2/FUNDING.yml b/roles/vagrant/.github 2/FUNDING.yml deleted file mode 100644 index 67320f0..0000000 --- a/roles/vagrant/.github 2/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -github: robertdebock diff --git a/roles/vagrant/.github 2/pull_request_template.md b/roles/vagrant/.github 2/pull_request_template.md deleted file mode 100644 index b1578c0..0000000 --- a/roles/vagrant/.github 2/pull_request_template.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: Pull request -about: Describe the proposed change - ---- - -**Describe the change** -A clear and concise description of what the pull request is. - -**Testing** -In case a feature was added, how were tests performed? diff --git a/roles/vagrant/.github 2/settings.yml b/roles/vagrant/.github 2/settings.yml deleted file mode 100644 index 2e9c8e3..0000000 --- a/roles/vagrant/.github 2/settings.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# -# Ansible managed -# -repository: - description: Install vagrant on your system. - homepage: https://robertdebock.nl/ diff --git a/roles/vagrant/.github/settings.yml b/roles/vagrant/.github/settings.yml index 2e9c8e3..63ace83 100644 --- a/roles/vagrant/.github/settings.yml +++ b/roles/vagrant/.github/settings.yml @@ -5,3 +5,4 @@ repository: description: Install vagrant on your system. homepage: https://robertdebock.nl/ + topics: vagrant, ansible, molecule, tox, playbook, hacktoberfest diff --git a/roles/vagrant/.github/workflows/galaxy.yml b/roles/vagrant/.github/workflows/galaxy.yml index 73891df..1d36b74 100644 --- a/roles/vagrant/.github/workflows/galaxy.yml +++ b/roles/vagrant/.github/workflows/galaxy.yml @@ -6,17 +6,13 @@ name: Release to Ansible Galaxy on: - push: - tags: - - '*' - schedule: - - cron: '23 22 22 * *' - + release: + types: [created, edited, published, released] jobs: release: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: galaxy - uses: robertdebock/galaxy-action@1.0.1 + uses: robertdebock/galaxy-action@1.1.0 with: galaxy_api_key: ${{ secrets.galaxy_api_key }} diff --git a/roles/vagrant/.github/workflows/molecule.yml b/roles/vagrant/.github/workflows/molecule.yml index 391fad5..cd0f101 100644 --- a/roles/vagrant/.github/workflows/molecule.yml +++ b/roles/vagrant/.github/workflows/molecule.yml @@ -15,26 +15,24 @@ on: jobs: lint: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: checkout uses: actions/checkout@v2 with: path: "${{ github.repository }}" - name: molecule - uses: robertdebock/molecule-action@2.6.1 + uses: robertdebock/molecule-action@2.6.16 with: command: lint test: needs: - lint - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: config: - - image: "centos" - tag: "7" - image: "centos" tag: "latest" - image: "debian" @@ -42,7 +40,7 @@ jobs: - image: "debian" tag: "bullseye" - image: "fedora" - tag: "31" + tag: "32" - image: "fedora" tag: "latest" - image: "opensuse" @@ -51,8 +49,6 @@ jobs: tag: "latest" - image: "ubuntu" tag: "bionic" - - image: "ubuntu" - tag: "xenial" steps: - name: checkout uses: actions/checkout@v2 @@ -63,10 +59,7 @@ jobs: - name: parse apparmor for mysql run: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - name: molecule - uses: robertdebock/molecule-action@2.6.1 + uses: robertdebock/molecule-action@2.6.16 with: image: ${{ matrix.config.image }} tag: ${{ matrix.config.tag }} - options: "--parallel all" - env: - TOX_PARALLEL_NO_SPINNER: 1 diff --git a/roles/vagrant/.gitignore b/roles/vagrant/.gitignore index 982db11..c15d16a 100644 --- a/roles/vagrant/.gitignore +++ b/roles/vagrant/.gitignore @@ -2,3 +2,4 @@ *.log *.swp .tox +.cache diff --git a/roles/vagrant/.gitignore 2 b/roles/vagrant/.gitignore 2 deleted file mode 100644 index 982db11..0000000 --- a/roles/vagrant/.gitignore 2 +++ /dev/null @@ -1,4 +0,0 @@ -.molecule -*.log -*.swp -.tox diff --git a/roles/vagrant/.travis.yml b/roles/vagrant/.travis.yml index 0a93975..21201e1 100644 --- a/roles/vagrant/.travis.yml +++ b/roles/vagrant/.travis.yml @@ -8,40 +8,23 @@ os: linux dist: xenial python: - - "3.8" + - "3.9" services: - docker -env: - global: - namespace="robertdebock" - jobs: - - image="centos" tag="7" - - image="centos" tag="latest" - - image="debian" tag="latest" - - image="debian" tag="bullseye" - - image="fedora" tag="31" - - image="fedora" tag="latest" - - image="opensuse" tag="latest" - - image="ubuntu" tag="latest" - - image="ubuntu" tag="bionic" - - image="ubuntu" tag="xenial" - cache: - pip install: - pip install --upgrade pip - - pip install tox + - pip install yamllint + - pip install ansible-lint script: - - function retry { counter=0 ; until "$@" ; do exit=$? ; counter=$(($counter + 1)) ; if [ $counter -ge 3 ] ; then return $exit ; fi ; done ; return 0; } ; retry tox --parallel all + - yamllint . + - ansible-lint notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ - slack: - secure: "CZQepN54bErWdWZHEhqKAo5IrJ7uO87Wy2oLylwR66VsxoqNWp8GCPuhFYu3lUMWsAGeh2qu/N+3JRzgWeZp/7DBNrVPi6LV/tsGekQYEe0Orx5r794qci2Ped79wXPMDmoqXzobzb78ZoagnnQU2UiRWuMKo7/ipFjaWU14eOVV1Sh31YLwXXJS9k23ZvPhG/s5jzMZtk07n5SRbuAnjsQs5cegmco0X7X2SXZYEVy8fTiq2mNisOq6J2FH94dSPAwS7T8ACnFCqSPoQ0MMT77i+RD4AHe4e1tQLj+dQ6lSkhcdLsevBbMrYmtopMwgZOERmUvtzkdWPVG2SlN1Tu33ybqRgDw04+pEmmPH/hdEYMgv7S8dh1ACFpw5+dLNz8YIAF0sLTxjyVUeUnrSwWc5Nm1TAVvnVeQnVpMYQQwhZfDefP1gx5XnwK4UkdKtcEEj80qSxiX3Of4cYV4NSRurj583r15ADsR9Wepb0VmBHk5h5+tpY2HibayW6DY3WpbG3luanE5+4R1MVDVdm0uIe+k8wKY11/NidqhYn1AIlYoPz2+hEOTMBI25lXVzdBq5RcDfYYM7/CQbsDHOP20dSN4giv6MBrip83o+TfadmGmg2NnJkeUZPghh6sWzIXDralqAEkbNzm4UiFsXu8WiSxbwqibKKbjAZZ0KZUQ=" - on_success: change - template: "%{result}: %{repository_slug}@%{branch}, build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}>)" email: false diff --git a/roles/vagrant/.yamllint b/roles/vagrant/.yamllint index 894450c..a7ff098 100644 --- a/roles/vagrant/.yamllint +++ b/roles/vagrant/.yamllint @@ -13,3 +13,4 @@ rules: ignore: | .tox/ + .cache/ diff --git a/roles/vagrant/LICENSE b/roles/vagrant/LICENSE index bd15893..e770af8 100644 --- a/roles/vagrant/LICENSE +++ b/roles/vagrant/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 Robert de Bock (robert@meinit.nl) + Copyright 2021 Robert de Bock (robert@meinit.nl) 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/roles/vagrant/README.md b/roles/vagrant/README.md index 9b67b85..070e81e 100644 --- a/roles/vagrant/README.md +++ b/roles/vagrant/README.md @@ -2,9 +2,9 @@ Install vagrant on your system. -|Travis|GitHub|Quality|Downloads|Version| +|GitHub|GitLab|Quality|Downloads|Version| |------|------|-------|---------|-------| -|[![travis](https://travis-ci.com/robertdebock/ansible-role-vagrant.svg?branch=master)](https://travis-ci.com/robertdebock/ansible-role-vagrant)|[![github](https://github.com/robertdebock/ansible-role-vagrant/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-vagrant/actions)|[![quality](https://img.shields.io/ansible/quality/36246)](https://galaxy.ansible.com/robertdebock/vagrant)|[![downloads](https://img.shields.io/ansible/role/d/36246)](https://galaxy.ansible.com/robertdebock/vagrant)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-vagrant.svg)](https://github.com/robertdebock/ansible-role-vagrant/releases/)| +|[![github](https://github.com/robertdebock/ansible-role-vagrant/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-vagrant/actions)|[![gitlab](https://gitlab.com/robertdebock/ansible-role-vagrant/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-vagrant)|[![quality](https://img.shields.io/ansible/quality/36246)](https://galaxy.ansible.com/robertdebock/vagrant)|[![downloads](https://img.shields.io/ansible/role/d/36246)](https://galaxy.ansible.com/robertdebock/vagrant)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-vagrant.svg)](https://github.com/robertdebock/ansible-role-vagrant/releases/)| ## [Example Playbook](#example-playbook) @@ -20,7 +20,7 @@ This example is taken from `molecule/resources/converge.yml` and is tested on ea - role: robertdebock.vagrant ``` -The machine may need to be prepared using `molecule/resources/prepare.yml`: +The machine needs to be prepared in CI this is done using `molecule/resources/prepare.yml`: ```yaml --- - name: Prepare @@ -36,19 +36,6 @@ The machine may need to be prepared using `molecule/resources/prepare.yml`: - role: robertdebock.python_pip ``` -For verification `molecule/resources/verify.yml` run after the role has been applied. -```yaml ---- -- name: Verify - hosts: all - become: yes - gather_facts: no - - tasks: - - name: try vagrant - command: vagrant --version -``` - Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles. ## [Role Variables](#role-variables) @@ -67,27 +54,26 @@ vagrant_unarchive_dest: /usr/local/bin ## [Requirements](#requirements) -- Access to a repository containing packages, likely on the internet. -- A recent version of Ansible. (Tests run on the current, previous and next release of Ansible.) +- pip packages listed in [requirements.txt](https://github.com/robertdebock/ansible-role-vagrant/blob/master/requirements.txt). -The following roles can be installed to ensure all requirements are met, using `ansible-galaxy install -r requirements.yml`: +## [Status of requirements](#status-of-requirements) -```yaml ---- -- robertdebock.bootstrap -- robertdebock.buildtools -- robertdebock.core_dependencies -- robertdebock.epel -- robertdebock.python_pip +The following roles are used to prepare a system. You may choose to prepare your system in another way, I have tested these roles as well. -``` +| Requirement | GitHub | GitLab | +|-------------|--------|--------| +| [robertdebock.bootstrap](https://galaxy.ansible.com/robertdebock/bootstrap) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-bootstrap/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-bootstrap/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-bootstrap/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-bootstrap) +| [robertdebock.buildtools](https://galaxy.ansible.com/robertdebock/buildtools) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-buildtools/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-buildtools/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-buildtools/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-buildtools) +| [robertdebock.core_dependencies](https://galaxy.ansible.com/robertdebock/core_dependencies) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-core_dependencies/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-core_dependencies/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-core_dependencies/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-core_dependencies) +| [robertdebock.epel](https://galaxy.ansible.com/robertdebock/epel) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-epel/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-epel/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-epel/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-epel) +| [robertdebock.python_pip](https://galaxy.ansible.com/robertdebock/python_pip) | [![Build Status GitHub](https://github.com/robertdebock/ansible-role-python_pip/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-python_pip/actions) | [![Build Status GitLab ](https://gitlab.com/robertdebock/ansible-role-ansible-role-python_pip/badges/master/pipeline.svg)](https://gitlab.com/robertdebock/ansible-role-python_pip) ## [Context](#context) This role is a part of many compatible roles. Have a look at [the documentation of these roles](https://robertdebock.nl/) for further information. Here is an overview of related roles: -![dependencies](https://raw.githubusercontent.com/robertdebock/drawings/artifacts/vagrant.png "Dependency") +![dependencies](https://raw.githubusercontent.com/robertdebock/ansible-role-vagrant/png/requirements.png "Dependencies") ## [Compatibility](#compatibility) @@ -95,15 +81,15 @@ This role has been tested on these [container images](https://hub.docker.com/u/r |container|tags| |---------|----| -|el|7, 8| +|el|8| |debian|buster, bullseye| -|fedora|31, 32| +|fedora|all| |opensuse|all| -|ubuntu|focal, bionic, xenial| +|ubuntu|focal, bionic| -The minimum version of Ansible required is 2.8 but tests have been done to: +The minimum version of Ansible required is 2.10, tests have been done to: -- The previous version, on version lower. +- The previous version. - The current version. - The development version. @@ -116,40 +102,8 @@ Some variarations of the build matrix do not work. These are the variations and | alpine | Dependency not available: python_pip | -## [Testing](#testing) - -[Unit tests](https://travis-ci.com/robertdebock/ansible-role-vagrant) are done on every commit, pull request, release and periodically. - If you find issues, please register them in [GitHub](https://github.com/robertdebock/ansible-role-vagrant/issues) -Testing is done using [Tox](https://tox.readthedocs.io/en/latest/) and [Molecule](https://github.com/ansible/molecule): - -[Tox](https://tox.readthedocs.io/en/latest/) tests multiple ansible versions. -[Molecule](https://github.com/ansible/molecule) tests multiple distributions. - -To test using the defaults (any installed ansible version, namespace: `robertdebock`, image: `fedora`, tag: `latest`): - -``` -molecule test - -# Or select a specific image: -image=ubuntu molecule test -# Or select a specific image and a specific tag: -image="debian" tag="stable" tox -``` - -Or you can test multiple versions of Ansible, and select images: -Tox allows multiple versions of Ansible to be tested. To run the default (namespace: `robertdebock`, image: `fedora`, tag: `latest`) tests: - -``` -tox - -# To run CentOS (namespace: `robertdebock`, tag: `latest`) -image="centos" tox -# Or customize more: -image="debian" tag="stable" tox -``` - ## [License](#license) Apache-2.0 diff --git a/roles/vagrant/meta 2/.galaxy_install_info b/roles/vagrant/meta 2/.galaxy_install_info deleted file mode 100644 index fde6c96..0000000 --- a/roles/vagrant/meta 2/.galaxy_install_info +++ /dev/null @@ -1,2 +0,0 @@ -install_date: Mon Sep 28 13:22:49 2020 -version: 3.2.0 diff --git a/roles/vagrant/meta 2/exception.yml b/roles/vagrant/meta 2/exception.yml deleted file mode 100644 index 5897a1b..0000000 --- a/roles/vagrant/meta 2/exception.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -exceptions: - - variation: alpine - reason: "Dependency not available: python_pip" diff --git a/roles/vagrant/meta 2/preferences.yml b/roles/vagrant/meta 2/preferences.yml deleted file mode 100644 index e7fdebf..0000000 --- a/roles/vagrant/meta 2/preferences.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -tox_parallel: yes diff --git a/roles/vagrant/meta/.galaxy_install_info b/roles/vagrant/meta/.galaxy_install_info index fde6c96..f69ba41 100644 --- a/roles/vagrant/meta/.galaxy_install_info +++ b/roles/vagrant/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Mon Sep 28 13:22:49 2020 -version: 3.2.0 +install_date: Sun Mar 21 07:00:09 2021 +version: 4.0.1 diff --git a/roles/vagrant/meta/main.yml b/roles/vagrant/meta/main.yml index f1edc0e..62ee67e 100644 --- a/roles/vagrant/meta/main.yml +++ b/roles/vagrant/meta/main.yml @@ -5,12 +5,11 @@ galaxy_info: description: Install vagrant on your system. license: Apache-2.0 company: none - min_ansible_version: 2.8 + min_ansible_version: "2.10" platforms: - name: EL versions: - - 7 - 8 - name: Debian versions: @@ -18,8 +17,7 @@ galaxy_info: - bullseye - name: Fedora versions: - - 31 - - 32 + - all - name: OpenSUSE versions: - all @@ -27,10 +25,8 @@ galaxy_info: versions: - focal - bionic - - xenial galaxy_tags: - vagrant - - centos dependencies: [] diff --git a/roles/vagrant/molecule 2/default/converge.yml b/roles/vagrant/molecule 2/default/converge.yml deleted file mode 100644 index 1fd5d5d..0000000 --- a/roles/vagrant/molecule 2/default/converge.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Converge - hosts: all - become: yes - gather_facts: yes - - roles: - - role: ansible-role-vagrant diff --git a/roles/vagrant/molecule 2/default/prepare.yml b/roles/vagrant/molecule 2/default/prepare.yml deleted file mode 100644 index 0d6f180..0000000 --- a/roles/vagrant/molecule 2/default/prepare.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -- name: Prepare - hosts: all - gather_facts: no - become: yes - - roles: - - role: robertdebock.bootstrap - - role: robertdebock.core_dependencies - - role: robertdebock.buildtools - - role: robertdebock.epel - - role: robertdebock.python_pip diff --git a/roles/vagrant/molecule 2/default/verify.yml b/roles/vagrant/molecule 2/default/verify.yml deleted file mode 100644 index e71561d..0000000 --- a/roles/vagrant/molecule 2/default/verify.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -- name: Verify - hosts: all - become: yes - gather_facts: no - - tasks: - - name: try vagrant - command: vagrant --version diff --git a/roles/vagrant/molecule/default/molecule.yml b/roles/vagrant/molecule/default/molecule.yml index 9cc4588..c5fd6d3 100644 --- a/roles/vagrant/molecule/default/molecule.yml +++ b/roles/vagrant/molecule/default/molecule.yml @@ -6,9 +6,11 @@ dependency: name: galaxy options: role-file: requirements.yml + requirements-file: requirements.yml lint: | set -e yamllint . + ansible-lint driver: name: docker platforms: diff --git a/roles/vagrant/requirements.yml b/roles/vagrant/requirements.yml index 38b9b85..7a59c6b 100644 --- a/roles/vagrant/requirements.yml +++ b/roles/vagrant/requirements.yml @@ -1,6 +1,9 @@ --- -- robertdebock.bootstrap -- robertdebock.buildtools -- robertdebock.core_dependencies -- robertdebock.epel -- robertdebock.python_pip +roles: + - name: robertdebock.bootstrap + - name: robertdebock.buildtools + - name: robertdebock.core_dependencies + - name: robertdebock.epel + - name: robertdebock.python_pip +collections: + - name: community.general diff --git a/roles/vagrant/tasks/assert.yml b/roles/vagrant/tasks/assert.yml index 6fbdc65..544bb61 100644 --- a/roles/vagrant/tasks/assert.yml +++ b/roles/vagrant/tasks/assert.yml @@ -1,14 +1,15 @@ --- + - name: test if vagrant_version is set correctly - assert: + ansible.builtin.assert: that: - vagrant_version is defined - - vagrant_version | length > 0 + - vagrant_version is string quiet: yes - name: test if vagrant_unarchive_dest is set correctly - assert: + ansible.builtin.assert: that: - vagrant_unarchive_dest is defined - - vagrant_unarchive_dest | length > 0 + - vagrant_unarchive_dest is string quiet: yes diff --git a/roles/vagrant/tasks/main.yml b/roles/vagrant/tasks/main.yml index 4c625f2..6a2f247 100644 --- a/roles/vagrant/tasks/main.yml +++ b/roles/vagrant/tasks/main.yml @@ -1,24 +1,26 @@ --- # tasks file for vagrant + - name: include assert.yml - include_tasks: assert.yml + import_tasks: assert.yml + run_once: yes + delegate_to: localhost - name: download vagrant - get_url: + ansible.builtin.get_url: url: "{{ vagrant_package }}" dest: /tmp - name: install vagrant rpm using package - package: + ansible.builtin.package: name: "/tmp/{{ vagrant_package | basename }}" state: present disable_gpg_check: yes when: - - ansible_pkg_mgr == "yum" or - ansible_pkg_mgr == "dnf" + - ansible_pkg_mgr in [ "yum", "dnf" ] - name: install vagrant rpm using zypper - zypper: + community.general.zypper: name: "/tmp/{{ vagrant_package | basename }}" state: present disable_gpg_check: yes @@ -26,26 +28,23 @@ - ansible_pkg_mgr == "zypper" - name: install vagrant deb - apt: + ansible.builtin.apt: deb: "/tmp/{{ vagrant_package | basename }}" state: present when: - ansible_pkg_mgr == "apt" - name: install vagrant archive - unarchive: + ansible.builtin.unarchive: src: "/tmp/{{ vagrant_package | basename }}" dest: "{{ vagrant_unarchive_dest }}" creates: "{{ vagrant_unarchive_dest }}/vagrant" remote_src: yes mode: "0755" when: - - ansible_pkg_mgr != "apt" - - ansible_pkg_mgr != "yum" - - ansible_pkg_mgr != "dnf" - - ansible_pkg_mgr != "zypper" + - ansible_pkg_mgr not in [ "apt", "dnf", "yum", "zypper" ] - name: install pip requirements - pip: + ansible.builtin.pip: name: "{{ vagrant_pip_packages }}" state: present diff --git a/roles/vagrant/tox.ini b/roles/vagrant/tox.ini index c1bc1d4..f57553b 100644 --- a/roles/vagrant/tox.ini +++ b/roles/vagrant/tox.ini @@ -2,25 +2,25 @@ # Ansible managed # [tox] -minversion = 3.7 -# Disabled "next" because of: -# https://github.com/ansible-community/molecule/issues/2626. -# envlist = py{38}-ansible-{previous,current,next} -envlist = py{38}-ansible-{previous,current} +minversion = 3.21.4 +# 2.11 has been disabled: couldn't resolve module/action 'docker_container'. +envlist = py{39}-ansible-{2.9,2.10} + skipsdist = true [testenv] deps = - previous: ansible>=2.8, <2.9 - current: ansible>=2.9 - next: git+https://github.com/ansible/ansible.git@devel - molecule[lint]>=3, <4 - docker>=4.2, <4.3 + 2.9: ansible == 2.9.* + 2.10: ansible == 2.10.* + 2.11: git+https://github.com/ansible/ansible.git@devel + molecule[docker] + docker == 4.* + ansible-lint == 5.* commands = molecule test setenv = TOX_ENVNAME={envname} - MOLECULE_EPHEMERAL_DIRECTORY=/tmp/.molecule/{env:image:fedora}-{env:tag:latest}/{envname} PY_COLORS=1 ANSIBLE_FORCE_COLOR=1 + ANSIBLE_ROLES_PATH=../ passenv = namespace image tag