fix
This commit is contained in:
41
test.yml
Normal file
41
test.yml
Normal 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' }}"
|
||||
Reference in New Issue
Block a user