diff --git a/roles/nrpe/.editorconfig b/roles/nrpe/.editorconfig deleted file mode 100644 index 8c8d0d4..0000000 --- a/roles/nrpe/.editorconfig +++ /dev/null @@ -1,46 +0,0 @@ -# https://editorconfig.org/ - -root = true - -[*] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true -end_of_line = lf -charset = utf-8 - -# Docstrings and comments use max_line_length = 79 -[*.py] -insert_final_newline = true -max_line_length = 119 - -# Use 2 spaces for the HTML files -[*.html] -indent_size = 2 - -# Use 2 spaces for the Markdown files -[*.md] -indent_size = 2 -insert_final_newline = true - -# The JSON files contain newlines inconsistently -[*.json] -indent_size = 2 - -# Makefiles always use tabs for indentation -[Makefile] -indent_style = tab -insert_final_newline = true - -# Batch files use tabs for indentation -[*.bat] -indent_style = tab -insert_final_newline = true - -[docs/**.txt] -insert_final_newline = true -max_line_length = 79 - -[*.yml] -indent_size = 2 -insert_final_newline = true \ No newline at end of file diff --git a/roles/nrpe/.flake8 b/roles/nrpe/.flake8 deleted file mode 100644 index 6deafc2..0000000 --- a/roles/nrpe/.flake8 +++ /dev/null @@ -1,2 +0,0 @@ -[flake8] -max-line-length = 120 diff --git a/roles/nrpe/.github/dependabot.yml b/roles/nrpe/.github/dependabot.yml deleted file mode 100644 index da47f20..0000000 --- a/roles/nrpe/.github/dependabot.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -version: 2 -updates: - - package-ecosystem: github-actions - directory: / - schedule: - interval: monthly - open-pull-requests-limit: 10 diff --git a/roles/nrpe/.github/settings.yml b/roles/nrpe/.github/settings.yml deleted file mode 100644 index f68e4bc..0000000 --- a/roles/nrpe/.github/settings.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -repository: - description: Ansible Role for Nagios Remote Plugin Executor - topics: ansible, ansible-role, nagios, nrpe, agent, monitoring - delete_branch_on_merge: true - has_wiki: false diff --git a/roles/nrpe/.github/stale.yml b/roles/nrpe/.github/stale.yml deleted file mode 100644 index 7dd2d28..0000000 --- a/roles/nrpe/.github/stale.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -_extends: .github:.github/stale.yml diff --git a/roles/nrpe/.github/workflows/ansible-ci.yml b/roles/nrpe/.github/workflows/ansible-ci.yml deleted file mode 100644 index 5577146..0000000 --- a/roles/nrpe/.github/workflows/ansible-ci.yml +++ /dev/null @@ -1,46 +0,0 @@ ---- -name: CI - -on: - pull_request: - schedule: - - cron: '30 5 15 * *' - -jobs: - - lint: - name: Lint Code Base - runs-on: ubuntu-latest - - steps: - - name: Checkout Code - uses: actions/checkout@v2.3.4 - - - name: Lint Code Base - uses: github/super-linter@v4.6.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - molecule: - needs: lint - name: Molecule - runs-on: ubuntu-latest - - steps: - - name: Check out the codebase - uses: actions/checkout@v2.3.4 - - - name: Set up Python 3 - uses: actions/setup-python@v2.2.2 - with: - python-version: "3.x" - - - name: Install Tox - run: | - pip3 install tox - - - name: Run Molecule tests - run: tox - env: - PY_COLORS: "1" - ANSIBLE_FORCE_COLOR: "1" diff --git a/roles/nrpe/.github/workflows/ansible-release.yml b/roles/nrpe/.github/workflows/ansible-release.yml deleted file mode 100644 index 8e4f30d..0000000 --- a/roles/nrpe/.github/workflows/ansible-release.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -name: Release to Ansible Galaxy - -on: - push: - tags: - - v* - branches: - - master - -jobs: - release: - name: Release to Ansible Galaxy - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Release Ansible Role to Galaxy - uses: hspaans/ansible-galaxy-action@v0.3.3 - with: - api_key: ${{ secrets.galaxy_api_key }} diff --git a/roles/nrpe/.github/workflows/codeql-analysis.yml b/roles/nrpe/.github/workflows/codeql-analysis.yml deleted file mode 100644 index ca0d5c4..0000000 --- a/roles/nrpe/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -name: "CodeQL" - -on: - pull_request: - branches: - - master - schedule: - - cron: "35 22 * * 4" - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: ["python"] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: - # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 - - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/roles/nrpe/.gitignore b/roles/nrpe/.gitignore deleted file mode 100644 index d8de824..0000000 --- a/roles/nrpe/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -## Ansible -*.retry -.ansible_cache - -## Molecule -.cache -.molecule -.tox -.vagrant - -## Python -.pytest_cache/ -__pycache__/ -*.py[cod] -*$py.class diff --git a/roles/nrpe/.yamllint.yml b/roles/nrpe/.yamllint.yml deleted file mode 100644 index c5ae64b..0000000 --- a/roles/nrpe/.yamllint.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -extends: default - -rules: - braces: - max-spaces-inside: 1 - level: error - brackets: - max-spaces-inside: 1 - level: error - line-length: disable - truthy: disable diff --git a/roles/nrpe/README.md b/roles/nrpe/README.md deleted file mode 100644 index 6b31c8a..0000000 --- a/roles/nrpe/README.md +++ /dev/null @@ -1,51 +0,0 @@ -# Role Name - -Install and configure NRPE - -## Requirements - -None as the nrpe package is being installed. - -## Role Variables - -Default variables are set in `defaults/main.yml`. - -## Dependencies - -No dependency on other Ansible Galaxy roles. - -## Example Playbook - -```yaml ---- -- hosts: servers - vars: - nrpe_server_allowed_hosts: - - 10.0.10.0/24 - - 10.0.11.2 - - 127.0.0.1 - nrpe_plugin_packages: - - nagios-plugins-disk - - nagios-plugins-nagios - - nagios-plugins-users - nrpe_command: - check_disk_all: - script: check_disk - option: -w 80 -c 90 - check_users: - script: check_users2 - option: -w 1 -c 1 - check_nagios: - script: check_nagios - option: -F /var/log/nagios/nagios.log -e 15 -C nagios - roles: - - { role: hspaans.nrpe, become: true } -``` - -## License - -MIT - -## Author Information - -This role was created in 2020 by [Hans Spaans](https://github.com/hspaans). diff --git a/roles/nrpe/molecule/os-family-debian/INSTALL.rst b/roles/nrpe/molecule/os-family-debian/INSTALL.rst deleted file mode 100644 index 6a44bde..0000000 --- a/roles/nrpe/molecule/os-family-debian/INSTALL.rst +++ /dev/null @@ -1,22 +0,0 @@ -******* -Docker driver installation guide -******* - -Requirements -============ - -* Docker Engine - -Install -======= - -Please refer to the `Virtual environment`_ documentation for installation best -practices. If not using a virtual environment, please consider passing the -widely recommended `'--user' flag`_ when invoking ``pip``. - -.. _Virtual environment: https://virtualenv.pypa.io/en/latest/ -.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site - -.. code-block:: bash - - $ pip install 'molecule[docker]' diff --git a/roles/nrpe/molecule/os-family-debian/converge.yml b/roles/nrpe/molecule/os-family-debian/converge.yml deleted file mode 100644 index e0dfcb4..0000000 --- a/roles/nrpe/molecule/os-family-debian/converge.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- name: Converge - hosts: all - roles: - - role: hspaans.nrpe diff --git a/roles/nrpe/molecule/os-family-debian/molecule.yml b/roles/nrpe/molecule/os-family-debian/molecule.yml deleted file mode 100644 index 2f6792c..0000000 --- a/roles/nrpe/molecule/os-family-debian/molecule.yml +++ /dev/null @@ -1,47 +0,0 @@ ---- -dependency: - name: galaxy -driver: - name: docker -lint: | - set -e - yamllint `git ls-files '*.yaml' '*.yml'` - ansible-lint - # flake8 -platforms: - - name: debian-10 - image: "ghcr.io/hspaans/molecule-container-debian:10" - command: "" - volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro - privileged: true - pre_build_image: true - - name: debian-11 - image: "ghcr.io/hspaans/molecule-container-debian:11" - command: "" - volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro - privileged: true - pre_build_image: true - - name: ubuntu-18.04 - image: "ghcr.io/hspaans/molecule-container-ubuntu:18.04" - command: "" - volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro - privileged: true - pre_build_image: true - - name: ubuntu-20.04 - image: "ghcr.io/hspaans/molecule-container-ubuntu:20.04" - command: "" - volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro - privileged: true - pre_build_image: true -provisioner: - name: ansible - inventory: - group_vars: - all: - nrpe_plugin_packages: [] -verifier: - name: testinfra diff --git a/roles/nrpe/molecule/os-family-debian/prepare.yml b/roles/nrpe/molecule/os-family-debian/prepare.yml deleted file mode 100644 index 08b3225..0000000 --- a/roles/nrpe/molecule/os-family-debian/prepare.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- -- name: Prepare - hosts: all - - pre_tasks: - - name: Update apt cache (on Debian). - apt: - update_cache: true - cache_valid_time: 3600 - when: ansible_os_family == 'Debian' - - - name: Remove packages - package: - name: apt-utils - state: present - when: ansible_os_family == 'Debian' - - - name: Update yum cache (on Redhat). - yum: - update_cache: true - when: ansible_os_family == 'RedHat' - - tasks: - - name: Remove packages - package: - name: git - state: absent diff --git a/roles/nrpe/molecule/os-family-debian/tests/conftest.py b/roles/nrpe/molecule/os-family-debian/tests/conftest.py deleted file mode 100644 index ecbd854..0000000 --- a/roles/nrpe/molecule/os-family-debian/tests/conftest.py +++ /dev/null @@ -1,23 +0,0 @@ -"""PyTest Fixtures.""" -from __future__ import absolute_import - -import os - -import pytest - - -def pytest_runtest_setup(): - """Run tests only when under molecule with testinfra installed.""" - try: - # pylint: disable = import-outside-toplevel - import testinfra - except ImportError: - pytest.skip("Test requires testinfra", allow_module_level=True) - if "MOLECULE_INVENTORY_FILE" in os.environ: - pytest.testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ["MOLECULE_INVENTORY_FILE"] - ).get_hosts("all") - else: - pytest.skip( - "Test should run only from inside molecule.", allow_module_level=True - ) diff --git a/roles/nrpe/molecule/os-family-debian/tests/test_default.py b/roles/nrpe/molecule/os-family-debian/tests/test_default.py deleted file mode 100644 index 6171e73..0000000 --- a/roles/nrpe/molecule/os-family-debian/tests/test_default.py +++ /dev/null @@ -1,11 +0,0 @@ -"""Role testing files using testinfra.""" - -import pytest - - -@pytest.mark.parametrize("pkg", ["nagios-nrpe-server"]) -def test_pkg_installed(host, pkg): - """Test if package installed.""" - package = host.package(pkg) - - assert package.is_installed diff --git a/roles/nrpe/molecule/os-family-redhat/INSTALL.rst b/roles/nrpe/molecule/os-family-redhat/INSTALL.rst deleted file mode 100644 index 6a44bde..0000000 --- a/roles/nrpe/molecule/os-family-redhat/INSTALL.rst +++ /dev/null @@ -1,22 +0,0 @@ -******* -Docker driver installation guide -******* - -Requirements -============ - -* Docker Engine - -Install -======= - -Please refer to the `Virtual environment`_ documentation for installation best -practices. If not using a virtual environment, please consider passing the -widely recommended `'--user' flag`_ when invoking ``pip``. - -.. _Virtual environment: https://virtualenv.pypa.io/en/latest/ -.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site - -.. code-block:: bash - - $ pip install 'molecule[docker]' diff --git a/roles/nrpe/molecule/os-family-redhat/converge.yml b/roles/nrpe/molecule/os-family-redhat/converge.yml deleted file mode 100644 index e0dfcb4..0000000 --- a/roles/nrpe/molecule/os-family-redhat/converge.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- name: Converge - hosts: all - roles: - - role: hspaans.nrpe diff --git a/roles/nrpe/molecule/os-family-redhat/molecule.yml b/roles/nrpe/molecule/os-family-redhat/molecule.yml deleted file mode 100644 index 519ea91..0000000 --- a/roles/nrpe/molecule/os-family-redhat/molecule.yml +++ /dev/null @@ -1,47 +0,0 @@ ---- -dependency: - name: galaxy -driver: - name: docker -lint: | - set -e - yamllint `git ls-files '*.yaml' '*.yml'` - ansible-lint - # flake8 -platforms: - - name: centos-7 - image: "ghcr.io/hspaans/molecule-container-centos:7" - command: "" - volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro - privileged: true - pre_build_image: true - - name: centos-8 - image: "ghcr.io/hspaans/molecule-container-centos:8" - command: "" - volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro - privileged: true - pre_build_image: true - - name: fedora-33 - image: "ghcr.io/hspaans/molecule-container-fedora:33" - command: "" - volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro - privileged: true - pre_build_image: true - - name: fedora-34 - image: "ghcr.io/hspaans/molecule-container-fedora:34" - command: "" - volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro - privileged: true - pre_build_image: true -provisioner: - name: ansible - inventory: - group_vars: - all: - nrpe_plugin_packages: [] -verifier: - name: testinfra diff --git a/roles/nrpe/molecule/os-family-redhat/prepare.yml b/roles/nrpe/molecule/os-family-redhat/prepare.yml deleted file mode 100644 index 08b3225..0000000 --- a/roles/nrpe/molecule/os-family-redhat/prepare.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- -- name: Prepare - hosts: all - - pre_tasks: - - name: Update apt cache (on Debian). - apt: - update_cache: true - cache_valid_time: 3600 - when: ansible_os_family == 'Debian' - - - name: Remove packages - package: - name: apt-utils - state: present - when: ansible_os_family == 'Debian' - - - name: Update yum cache (on Redhat). - yum: - update_cache: true - when: ansible_os_family == 'RedHat' - - tasks: - - name: Remove packages - package: - name: git - state: absent diff --git a/roles/nrpe/molecule/os-family-redhat/tests/conftest.py b/roles/nrpe/molecule/os-family-redhat/tests/conftest.py deleted file mode 100644 index ecbd854..0000000 --- a/roles/nrpe/molecule/os-family-redhat/tests/conftest.py +++ /dev/null @@ -1,23 +0,0 @@ -"""PyTest Fixtures.""" -from __future__ import absolute_import - -import os - -import pytest - - -def pytest_runtest_setup(): - """Run tests only when under molecule with testinfra installed.""" - try: - # pylint: disable = import-outside-toplevel - import testinfra - except ImportError: - pytest.skip("Test requires testinfra", allow_module_level=True) - if "MOLECULE_INVENTORY_FILE" in os.environ: - pytest.testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ["MOLECULE_INVENTORY_FILE"] - ).get_hosts("all") - else: - pytest.skip( - "Test should run only from inside molecule.", allow_module_level=True - ) diff --git a/roles/nrpe/molecule/os-family-redhat/tests/test_default.py b/roles/nrpe/molecule/os-family-redhat/tests/test_default.py deleted file mode 100644 index 39b5115..0000000 --- a/roles/nrpe/molecule/os-family-redhat/tests/test_default.py +++ /dev/null @@ -1,11 +0,0 @@ -"""Role testing files using testinfra.""" - -import pytest - - -@pytest.mark.parametrize("pkg", ["nrpe"]) -def test_pkg_installed(host, pkg): - """Test if package installed.""" - package = host.package(pkg) - - assert package.is_installed diff --git a/roles/nrpe/tests/inventory b/roles/nrpe/tests/inventory deleted file mode 100644 index 2fbb50c..0000000 --- a/roles/nrpe/tests/inventory +++ /dev/null @@ -1 +0,0 @@ -localhost diff --git a/roles/nrpe/tests/test.yml b/roles/nrpe/tests/test.yml deleted file mode 100644 index e4efa3f..0000000 --- a/roles/nrpe/tests/test.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- hosts: localhost - remote_user: root - roles: - - hspaans.nrpe diff --git a/roles/nrpe/tox.ini b/roles/nrpe/tox.ini deleted file mode 100644 index 5277674..0000000 --- a/roles/nrpe/tox.ini +++ /dev/null @@ -1,20 +0,0 @@ -[tox] -minversion = 3.23.0 -envlist = py3 -skipsdist = true - -[testenv] -passenv = * -deps = - ansible-lint - molecule - molecule-docker - docker - flake8 - flake8-docstrings - flake8-pylint - pytest - pytest-testinfra - anisble -commands = - molecule test --all