diff --git a/.github/workflows/role-icingadb_redis.yml b/.github/workflows/role-icingadb_redis.yml new file mode 100644 index 00000000..3a01362c --- /dev/null +++ b/.github/workflows/role-icingadb_redis.yml @@ -0,0 +1,66 @@ +--- + # These Jobs should be always be run against the latest version of ansible on the systems + # Feel free to update python and ansible versions + # + # In addition to keep them quick and no additional variables are used. + # +name: role-icingadb_redis +on: + push: + branches: + - main + - 'feature/**' + - 'fix/**' + - '!doc/**' + paths: + - roles/icingadb_redis/** + - molecule/role-icingadb_redis/** + pull_request: + branches: + - 'feature/**' + - 'fix/**' + - '!doc/**' + +jobs: + icingadb_redis-ubuntu2204-latest: + runs-on: ubuntu-latest + + env: + COLLECTION_NAMESPACE: icinga + COLLECTION_NAME: icinga + + strategy: + fail-fast: false + max-parallel: 1 + matrix: + distro: [ubuntu2204] + python: ['3.10'] + ansible: ['2.16.2'] + scenario: [role-icingadb_redis] + + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + + - name: Install dependencies ansible + run: | + python3 -m pip install --upgrade pip + python3 -m pip install -r requirements-test-${{ matrix.ansible }}.txt + + - name: Install collection + run: | + mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE + cp -a ../ansible-collection-$COLLECTION_NAME ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME + + - name: Test with molecule + run: | + ansible --version + molecule --version + molecule test -s ${{ matrix.scenario }} + env: + MOLECULE_DISTRO: ${{ matrix.distro }} diff --git a/.github/workflows/role-icingaweb2.yml b/.github/workflows/role-icingaweb2.yml index 67bd2149..6ed31fde 100644 --- a/.github/workflows/role-icingaweb2.yml +++ b/.github/workflows/role-icingaweb2.yml @@ -1,9 +1,12 @@ --- -name: Empty role-icingaweb2 + # These Jobs should be always be run against the latest version of ansible on the systems + # Feel free to update python and ansible versions + # + # In addition to keep them quick and no additional variables are used. + # +name: role-icingaweb2 on: push: - tags: - - '*' branches: - main - 'feature/**' @@ -19,7 +22,7 @@ on: - '!doc/**' jobs: - icingaweb2-ansible-latest: + icingaweb2-ubuntu2204-latest: runs-on: ubuntu-latest env: diff --git a/molecule/role-icingadb_redis/collections.yml b/molecule/role-icingadb_redis/collections.yml new file mode 100644 index 00000000..66cb0953 --- /dev/null +++ b/molecule/role-icingadb_redis/collections.yml @@ -0,0 +1,5 @@ +collections: + - name: community.mysql + - name: community.docker + - name: community.general + version: ">=2,<3" diff --git a/molecule/role-icingadb_redis/converge.yml b/molecule/role-icingadb_redis/converge.yml new file mode 100644 index 00000000..2dea1e2b --- /dev/null +++ b/molecule/role-icingadb_redis/converge.yml @@ -0,0 +1,12 @@ +--- + +- name: Converge + hosts: all + collections: + - icinga.icinga + pre_tasks: + - ansible.builtin.include_role: + name: repos + post_tasks: + - ansible.builtin.include_role: + name: icingadb_redis diff --git a/molecule/role-icingadb_redis/dependency.yml b/molecule/role-icingadb_redis/dependency.yml new file mode 100644 index 00000000..9810d54a --- /dev/null +++ b/molecule/role-icingadb_redis/dependency.yml @@ -0,0 +1,4 @@ +dependency: + name: galaxy + options: + role-file: requirements.yml diff --git a/molecule/role-icingadb_redis/host_vars/icinga-default.yaml b/molecule/role-icingadb_redis/host_vars/icinga-default.yaml new file mode 100644 index 00000000..e69de29b diff --git a/molecule/role-icingadb_redis/molecule.yml b/molecule/role-icingadb_redis/molecule.yml new file mode 100644 index 00000000..c288cf03 --- /dev/null +++ b/molecule/role-icingadb_redis/molecule.yml @@ -0,0 +1,26 @@ +--- +dependency: + name: galaxy +driver: + name: docker +platforms: + - name: icingadb_redis-default + image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2204}-ansible:latest" + command: ${MOLECULE_DOCKER_COMMAND:-""} + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:rw + cgroupns_mode: host + privileged: true + pre_build_image: true +provisioner: + name: ansible + inventory: + link: + host_vars: host_vars/ +verifier: + name: testinfra + directory: tests/integration/ +lint: | + set -e + yamllint --no-warnings roles/ + ansible-lint roles/ diff --git a/molecule/role-icingadb_redis/prepare.yml b/molecule/role-icingadb_redis/prepare.yml new file mode 100644 index 00000000..cc5bbc56 --- /dev/null +++ b/molecule/role-icingadb_redis/prepare.yml @@ -0,0 +1,11 @@ +--- +- name: Prepare + hosts: all + tasks: + - name: Install requirements for Debian + apt: + name: + - gpg + - apt-transport-https + update_cache: yes + when: ansible_os_family == "Debian" diff --git a/molecule/role-icingadb_redis/requirements.yml b/molecule/role-icingadb_redis/requirements.yml new file mode 100644 index 00000000..cf94e2e2 --- /dev/null +++ b/molecule/role-icingadb_redis/requirements.yml @@ -0,0 +1,2 @@ +roles: + - geerlingguy.mysql diff --git a/molecule/role-icingadb_redis/verify.yml b/molecule/role-icingadb_redis/verify.yml new file mode 100644 index 00000000..3c4ed28d --- /dev/null +++ b/molecule/role-icingadb_redis/verify.yml @@ -0,0 +1,9 @@ +--- + +- name: Verify + hosts: all + tasks: + - name: Check for running icinga2 + service: + name: icinga2 + state: started