Files
application-consumption-dem…/deploy.yml
Matteo Basile f27f9388e5 first commit
2026-07-16 08:55:30 +02:00

44 lines
1.2 KiB
YAML

---
- name: Deploy ML app container
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 che la porta applicativa sia in ascolto
ansible.builtin.wait_for:
host: 127.0.0.1
port: "{{ app_port }}"
timeout: 30
when: enable_health_check | bool
- name: Output finale
ansible.builtin.debug:
msg:
- "Deploy completato"
- "URL: http://{{ ansible_host }}:{{ app_port }}"
- "Container: {{ container_name }}"
- "Image: {{ container_image_ref }}"
- "Digest atteso: sha256:6cc8ab7c08f195cb65c689255418652fdf0094acaaa4ef63475d594039cda2ab"