boma/roles/reverse_proxy/molecule/default/verify.yml

22 lines
866 B
YAML
Raw Normal View History

---
- name: Verify
hosts: all
gather_facts: false
tasks:
- name: Slurp the rendered Caddyfile
ansible.builtin.slurp:
src: /opt/services/reverse_proxy/caddy/Caddyfile
register: _caddyfile
- name: Assert Caddyfile exists and contains expected content
ansible.builtin.assert:
that:
- _caddyfile.content | b64decode | length > 0
- "'app.example.test' in (_caddyfile.content | b64decode)"
- "'reverse_proxy app:80' in (_caddyfile.content | b64decode)"
- "'respond \"ok\" 200' in (_caddyfile.content | b64decode)"
- "'grpc.example.test' in (_caddyfile.content | b64decode)"
- "'reverse_proxy @grpc h2c://backend:80' in (_caddyfile.content | b64decode)"
fail_msg: "Caddyfile is missing expected content"
success_msg: "Caddyfile rendered correctly"