Files
gitlab-mirror/roles/curl_scheduled/molecule/default/verify.yml
2025-12-16 12:24:14 +03:00

82 lines
3.0 KiB
YAML

---
- name: Verify
hosts: all
gather_facts: false
tasks:
# Verify the systemd timers
- name: "Check the timer status - localhost-test-zero"
register: timer_zero
ansible.builtin.systemd:
name: "curl-localhost-test-zero.timer"
- name: "Assert that the localhost-test-zero timer is running"
ansible.builtin.assert:
that:
- timer_zero.status.ActiveState == "active"
success_msg: "Timer is running"
fail_msg: "Unexpected timer state: '{{ timer_zero.status.ActiveState }}'"
- name: "Check the timer status - localhost-test-one"
register: timer_one
ansible.builtin.systemd:
name: "curl-localhost-test-one.timer"
- name: "Assert that the localhost-test-one timer is running"
ansible.builtin.assert:
that:
- timer_one.status.ActiveState == "active"
success_msg: "Timer is running"
fail_msg: "Unexpected timer state: '{{ timer_one.status.ActiveState }}'"
- name: "Check the timer status - localhost-test-chained-curl"
register: timer_chained_curl
ansible.builtin.systemd:
name: "curl-localhost-test-chained-curl.timer"
- name: "Assert that the localhost-test-chained-curl timer is running"
ansible.builtin.assert:
that:
- timer_chained_curl.status.ActiveState == "active"
success_msg: "Timer is running"
fail_msg: "Unexpected timer state: '{{ timer_chained_curl.status.ActiveState }}'"
## Verify the systemd services
- name: "Check the service status - zero"
register: service_zero
ansible.builtin.systemd:
name: "curl-localhost-test-zero.service"
- name: "Assert that the localhost-test-zero service exited with a 0/SUCCESS status"
ansible.builtin.assert:
that:
- 'service_zero.status.ExecMainStatus == "0"'
success_msg: "Service has exited with a 0/SUCCESS status"
fail_msg: "Unexpected service status code: '{{ service_zero.status.ExecMainStatus }}'"
- name: "Check the service status - one"
register: service_one
ansible.builtin.systemd:
name: "curl-localhost-test-one.service"
- name: "Assert that the localhost-test-one service exited with a 0/SUCCESS status"
ansible.builtin.assert:
that:
- 'service_one.status.ExecMainStatus == "0"'
success_msg: "Service has exited with a 0/SUCCESS status"
fail_msg: "Unexpected service status code: '{{ service_one.status.ExecMainStatus }}'"
- name: "Check the service status - localhost-test-chained-curl"
register: service_chained_curl
ansible.builtin.systemd:
name: "curl-localhost-test-chained-curl.service"
- name: "Assert that the localhost-test-chained-curl service exited with a 0/SUCCESS status"
ansible.builtin.assert:
that:
- 'service_chained_curl.status.ExecMainStatus == "0"'
success_msg: "Service has exited with a 0/SUCCESS status"
fail_msg: "Unexpected service status code: '{{ service_chained_curl.status.ExecMainStatus }}'"