Skip to content

Commit

Permalink
Add verification play
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyphreak committed Nov 3, 2023
1 parent 28afd89 commit a898236
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 8 deletions.
40 changes: 40 additions & 0 deletions molecule/common/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
- name: Verify
hosts: all
tasks:
- name: Collect package facts
ansible.builtin.package_facts:

- name: Verify package deployment
ansible.builtin.fail:
msg: "Package {{ _package }} was not deployed"
vars:
_package: heartbeat-elastic
when: _package not in packages

- name: Collect service facts
ansible.builtin.service_facts:

- name: Verify service run state
ansible.builtin.fail:
msg: "Service {{ _service }} is not running"
vars:
_service: heartbeat-elastic.service
when: services[_service].state != "running"

- name: Verify service boot state
ansible.builtin.fail:
msg: "Service {{ _service }} is not enabled"
vars:
_service: heartbeat-elastic.service
when: services[_service].status != "enabled"

- name: Stat output filename
ansible.builtin.stat:
path: "{{ heartbeat_conf.output.file.path }}/{{ heartbeat_conf.output.file.filename }}"
register: _output_file

- name: Verify output file
ansible.builtin.fail:
msg: "Output file {{ heartbeat_conf.output.file.filename}} not found"
when: not _output_file.stat.exists
8 changes: 4 additions & 4 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ provisioner:
schedule: '*/1 * * * * * *'
urls:
- https://www.google.com
output:
elasticsearch:
hosts:
- "localhost:9200"
output:
file:
path: /tmp
filename: heartbeat
verifier:
name: ansible
8 changes: 4 additions & 4 deletions molecule/elastic/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ provisioner:
schedule: '*/1 * * * * * *'
urls:
- https://www.google.com
output:
elasticsearch:
hosts:
- "localhost:9200"
output:
file:
path: /tmp
filename: heartbeat
verifier:
name: ansible

0 comments on commit a898236

Please sign in to comment.