--- - name: Verify hosts: all gather_facts: false tasks: # Verify the systemd timers - name: "Check the timer status - localhost-test-zero" register: curl_scheduled_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: - curl_scheduled_timer_zero.status.ActiveState == "active" success_msg: "Timer is running" fail_msg: "Unexpected timer state: '{{ curl_scheduled_timer_zero.status.ActiveState }}'" - name: "Check the timer status - localhost-test-one" register: curl_scheduled_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: - curl_scheduled_timer_one.status.ActiveState == "active" success_msg: "Timer is running" fail_msg: "Unexpected timer state: '{{ curl_scheduled_timer_one.status.ActiveState }}'" - name: "Check the timer status - localhost-test-chained-curl" register: curl_scheduled_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: - curl_scheduled_timer_chained_curl.status.ActiveState == "active" success_msg: "Timer is running" fail_msg: "Unexpected timer state: '{{ curl_scheduled_timer_chained_curl.status.ActiveState }}'" ## Verify the systemd services - name: "Check the service status - zero" register: curl_scheduled_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: - 'curl_scheduled_service_zero.status.ExecMainStatus == "0"' success_msg: "Service has exited with a 0/SUCCESS status" fail_msg: "Unexpected service status code: '{{ curl_scheduled_service_zero.status.ExecMainStatus }}'" - name: "Check the service status - one" register: curl_scheduled_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: - 'curl_scheduled_service_one.status.ExecMainStatus == "0"' success_msg: "Service has exited with a 0/SUCCESS status" fail_msg: "Unexpected service status code: '{{ curl_scheduled_service_one.status.ExecMainStatus }}'" - name: "Check the service status - localhost-test-chained-curl" register: curl_scheduled_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: - 'curl_scheduled_service_chained_curl.status.ExecMainStatus == "0"' success_msg: "Service has exited with a 0/SUCCESS status" fail_msg: "Unexpected service status code: '{{ curl_scheduled_service_chained_curl.status.ExecMainStatus }}'"