Files
appconsumption-demo-app/deploy.yml
2026-05-04 12:55:11 +02:00

44 lines
1.1 KiB
YAML

---
- name: Deploy Docker splash app via Nginx
hosts: webservers
become: yes
vars_files:
- group_vars/all.yml
- group_vars/secrets.yml
pre_tasks:
- name: Verifica che Docker CLI sia disponibile
ansible.builtin.command: docker --version
register: docker_check
changed_when: false
failed_when: docker_check.rc != 0
- name: Verifica che il servizio Docker sia in esecuzione
ansible.builtin.service_facts:
- name: Controlla stato Docker
ansible.builtin.assert:
that: ansible_facts.services['docker.service'].state == 'running'
fail_msg: "Docker non e' in esecuzione sul host target"
roles:
- role: splash
post_tasks:
- name: Verifica endpoint health
ansible.builtin.uri:
url: "http://localhost:{{ app_port }}/health"
status_code: 200
register: healthcheck
retries: 10
delay: 2
until: healthcheck.status == 200
- name: Output finale
ansible.builtin.debug:
msg:
- "Deploy completato"
- "URL: http://{{ ansible_host }}:{{ app_port }}"
- "Container: {{ container_name }}"