diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 0ff0ab9..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,69 +0,0 @@ ---- -name: CI - -on: - pull_request: - push: - branches: - - master - schedule: - - cron: "0 5 * * 0" - -defaults: - run: - working-directory: 'nephelaiio.heartbeat' - -jobs: - - lint: - name: Lint - runs-on: ubuntu-latest - steps: - - name: Check out the codebase. - uses: actions/checkout@v2 - with: - path: 'nephelaiio.heartbeat' - - - name: Set up Python 3. - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - - name: Install test dependencies. - run: pip3 install ansible-lint[community,yamllint] - - - name: Lint code. - run: | - ansible-lint . - - molecule: - name: Molecule - runs-on: ubuntu-latest - strategy: - matrix: - image: - - geerlingguy/docker-ubuntu2004-ansible:latest - - geerlingguy/docker-ubuntu1804-ansible:latest - - geerlingguy/docker-ubuntu1604-ansible:latest - - geerlingguy/docker-debian10-ansible:latest - - geerlingguy/docker-centos7-ansible:latest - steps: - - name: Check out the codebase. - uses: actions/checkout@v2 - with: - path: 'nephelaiio.heartbeat' - - - name: Set up Python 3. - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - - name: Install test dependencies. - run: pip3 install ansible molecule[docker] docker pytest pytest-testinfra - - - name: Run Molecule tests. - run: molecule test - env: - PY_COLORS: '1' - ANSIBLE_FORCE_COLOR: '1' - MOLECULE_DOCKER_IMAGE: ${{ matrix.image }} diff --git a/.github/workflows/molecule.yml b/.github/workflows/molecule.yml index 08e2e65..13098d7 100644 --- a/.github/workflows/molecule.yml +++ b/.github/workflows/molecule.yml @@ -23,8 +23,8 @@ jobs: strategy: matrix: scenario: - - name: default - - name: elastic + - name: 7x + - name: 8x image: - name: ubuntu2204 command: /lib/systemd/systemd diff --git a/Makefile b/Makefile index 68481e3..f36add1 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ .PHONY: all ${MAKECMDGOALS} -MOLECULE_SCENARIO ?= default +MOLECULE_SCENARIO ?= 7x MOLECULE_DOCKER_IMAGE ?= ubuntu2004 GALAXY_API_KEY ?= GITHUB_REPOSITORY ?= $$(git config --get remote.origin.url | cut -d: -f 2 | cut -d. -f 1) diff --git a/README.md b/README.md index 8ca310f..6a69010 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Please review the [dependency configuration](/meta/main.yml) for more details - hosts: servers vars: heartbeat_package_state: latest - heartbeat_conf_manage: yes + heartbeat_conf_manage: true heartbeat_conf: heartbeat: monitors: diff --git a/defaults/main.yml b/defaults/main.yml index 937cfd9..3ada06e 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,10 +1,10 @@ --- heartbeat_package_names: heartbeat-elastic heartbeat_package_state: present -heartbeat_package_hold: no -heartbeat_conf_manage: yes +heartbeat_package_hold: false +heartbeat_conf_manage: true heartbeat_conf_path: /etc/heartbeat/heartbeat.yml heartbeat_service_name: heartbeat-elastic heartbeat_service_status: started -heartbeat_service_enabled: yes -heartbeat_repo_manage: yes +heartbeat_service_enabled: true +heartbeat_repo_manage: true diff --git a/molecule/default/molecule.yml b/molecule/7x/molecule.yml similarity index 62% rename from molecule/default/molecule.yml rename to molecule/7x/molecule.yml index aaf10e4..6e87c11 100644 --- a/molecule/default/molecule.yml +++ b/molecule/7x/molecule.yml @@ -25,20 +25,20 @@ provisioner: defaults: callbacks_enabled: ansible.posix.profile_tasks inventory: - hosts: + group_vars: all: - vars: - heartbeat_package_hold: yes - heartbeat_conf: - heartbeat: - monitors: - - type: http - schedule: '*/1 * * * * * *' - urls: - - https://www.google.com - output: - file: - path: /tmp - filename: heartbeat + elasticsearch_repo_major_version: 7 + heartbeat_package_hold: true + heartbeat_conf: + heartbeat: + monitors: + - type: http + schedule: '*/1 * * * * * *' + urls: + - https://www.google.com + output: + file: + path: /tmp + filename: heartbeat verifier: name: ansible diff --git a/molecule/elastic/molecule.yml b/molecule/8x/molecule.yml similarity index 58% rename from molecule/elastic/molecule.yml rename to molecule/8x/molecule.yml index 28ae644..f446e4f 100644 --- a/molecule/elastic/molecule.yml +++ b/molecule/8x/molecule.yml @@ -25,22 +25,21 @@ provisioner: defaults: callbacks_enabled: ansible.posix.profile_tasks inventory: - hosts: + group_vars: all: - vars: - elasticsearch_repo_major_version: 8 - elastic_repo_oss: false - heartbeat_package_hold: yes - heartbeat_conf: - heartbeat: - monitors: - - type: http - schedule: '*/1 * * * * * *' - urls: - - https://www.google.com - output: - file: - path: /tmp - filename: heartbeat + elasticsearch_repo_major_version: 8 + elastic_repo_oss: false + heartbeat_package_hold: true + heartbeat_conf: + heartbeat: + monitors: + - type: http + schedule: '*/1 * * * * * *' + urls: + - https://www.google.com + output: + file: + path: /tmp + filename: heartbeat verifier: name: ansible diff --git a/molecule/common/prepare.yml b/molecule/common/prepare.yml index a865f6d..a39a95e 100644 --- a/molecule/common/prepare.yml +++ b/molecule/common/prepare.yml @@ -4,5 +4,5 @@ tasks: - name: Update apt package cache ansible.builtin.apt: - update_cache: yes + update_cache: true when: ansible_os_family == 'Debian' diff --git a/molecule/common/verify.yml b/molecule/common/verify.yml index 14c6787..d840e03 100644 --- a/molecule/common/verify.yml +++ b/molecule/common/verify.yml @@ -13,6 +13,13 @@ msg: "Package {{ _package }} was not deployed" when: _package not in packages + - name: Check package version + ansible.builtin.fail: + msg: "Found unexpected major version '{{ _version[0] }}' expected '{{ elasticsearch_repo_major_version }}'" + vars: + _version: "{{ packages[_package][0].version }}" + when: (_version[0] | string) != (elasticsearch_repo_major_version | string) + - name: Collect service facts ansible.builtin.service_facts: @@ -39,4 +46,3 @@ retries: 2 delay: 60 until: _output_file.stat.exists - when: diff --git a/tasks/main.yml b/tasks/main.yml index 4821b4b..be47b03 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -52,7 +52,7 @@ selection: hold loop: "{{ [heartbeat_package_names] | flatten }}" changed_when: false - when: (ansible_os_family | lower) == 'debian' + when: ansible_os_family == 'Debian' - name: Enable yum package lock community.general.yum_versionlock: