--- # Pulling by digest means this either fetches exactly the reviewed image or # fails. There is no "latest wins" path. - name: Pull the pinned gatus image ansible.builtin.command: cmd: docker compose pull chdir: "{{ gatus_dir }}" register: gatus_pull changed_when: "'Downloaded newer image' in gatus_pull.stderr or 'Pull complete' in gatus_pull.stderr" - name: Start gatus ansible.builtin.command: cmd: docker compose up -d --remove-orphans chdir: "{{ gatus_dir }}" register: gatus_up changed_when: "'Started' in gatus_up.stderr or 'Created' in gatus_up.stderr or 'Recreated' in gatus_up.stderr" - name: Flush handlers so a config change is live before it is verified ansible.builtin.meta: flush_handlers - name: Wait for gatus to answer ansible.builtin.uri: url: "http://{{ gatus_bind_address }}:{{ gatus_port }}/health" status_code: [200, 404] register: gatus_health until: gatus_health.status in [200, 404] retries: 12 delay: 5 - name: Assert gatus is running ansible.builtin.assert: that: - gatus_health.status in [200, 404] fail_msg: "gatus did not come up on {{ gatus_bind_address }}:{{ gatus_port }} - check `docker logs gatus`" success_msg: "gatus is answering on {{ gatus_bind_address }}:{{ gatus_port }}"