Skip to content

Commit

Permalink
Refactor check condition syntax (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyphreak authored Nov 6, 2023
1 parent 7d0c759 commit 960c37f
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 110 deletions.
69 changes: 0 additions & 69 deletions .github/workflows/main.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
strategy:
matrix:
scenario:
- name: default
- name: elastic
- name: 7x
- name: 8x
image:
- name: ubuntu2204
command: /lib/systemd/systemd
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -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
28 changes: 14 additions & 14 deletions molecule/default/molecule.yml → molecule/7x/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
31 changes: 15 additions & 16 deletions molecule/elastic/molecule.yml → molecule/8x/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion molecule/common/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
tasks:
- name: Update apt package cache
ansible.builtin.apt:
update_cache: yes
update_cache: true
when: ansible_os_family == 'Debian'
8 changes: 7 additions & 1 deletion molecule/common/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -39,4 +46,3 @@
retries: 2
delay: 60
until: _output_file.stat.exists
when:
2 changes: 1 addition & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 960c37f

Please sign in to comment.