45 lines
1.0 KiB
YAML
45 lines
1.0 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: Installa pacchetti necessari (Debian/Ubuntu)
|
|
ansible.builtin.apt:
|
|
name:
|
|
- docker.io
|
|
- python3-docker
|
|
state: present
|
|
update_cache: yes
|
|
when: ansible_os_family == 'Debian'
|
|
|
|
- name: Avvia e abilita Docker
|
|
ansible.builtin.service:
|
|
name: docker
|
|
state: started
|
|
enabled: yes
|
|
|
|
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 }}"
|