This commit is contained in:
Matteo Basile
2026-05-04 11:53:20 +02:00
parent 63aa0658ef
commit aafe712089
13 changed files with 0 additions and 0 deletions

41
test.yml Normal file
View File

@@ -0,0 +1,41 @@
---
- name: Test host e prerequisiti Docker
hosts: webservers
become: yes
gather_facts: yes
vars_files:
- group_vars/all.yml
tasks:
- name: Test SSH
ansible.builtin.ping:
- name: Mostra info host
ansible.builtin.debug:
msg:
- "Host: {{ ansible_hostname }}"
- "OS: {{ ansible_distribution }} {{ ansible_distribution_version }}"
- "Python: {{ ansible_python_version }}"
- name: Controlla Docker CLI
ansible.builtin.command: docker --version
register: docker_version
changed_when: false
failed_when: false
- name: Stato Docker CLI
ansible.builtin.debug:
msg: "{{ docker_version.stdout if docker_version.rc == 0 else 'Docker non trovato' }}"
- name: Verifica porta target disponibile
ansible.builtin.wait_for:
port: "{{ app_port }}"
state: stopped
timeout: 1
register: port_check
failed_when: false
- name: Risultato porta
ansible.builtin.debug:
msg: "Porta {{ app_port }} {{ 'libera' if port_check is not failed else 'gia in uso' }}"