ansible-nas/roles/stats/molecule/default/verify.yml
2023-04-15 14:11:49 +01:00

46 lines
1.8 KiB
YAML

---
- name: Verify
hosts: all
gather_facts: false
tasks:
- ansible.builtin.include_vars:
file: ../../defaults/main.yml
- name: Get Grafana container state
community.docker.docker_container_info:
name: "{{ stats_grafana_container_name }}"
register: result_grafana
- name: Get Prometheus container state
community.docker.docker_container_info:
name: "{{ stats_prometheus_container_name }}"
register: result_prometheus
- name: Get Telegraf container state
community.docker.docker_container_info:
name: "{{ stats_telegraf_container_name }}"
register: result_telegraf
- name: Get Smartctl container state
community.docker.docker_container_info:
name: "{{ stats_smartctl_container_name }}"
register: result_smartctl
- name: Get Speedtest container state
community.docker.docker_container_info:
name: "{{ stats_speedtest_container_name }}"
register: result_speedtest
- name: Check if stats docker containers are running
ansible.builtin.assert:
that:
- result_grafana.container['State']['Status'] == "running"
- result_grafana.container['State']['Restarting'] == false
- result_prometheus.container['State']['Status'] == "running"
- result_prometheus.container['State']['Restarting'] == false
- result_telegraf.container['State']['Status'] == "running"
- result_telegraf.container['State']['Restarting'] == false
- result_smartctl.container['State']['Status'] == "running"
- result_smartctl.container['State']['Restarting'] == false
- result_speedtest.container['State']['Status'] == "running"
- result_speedtest.container['State']['Restarting'] == false