2025-06-21

This commit is contained in:
2025-06-21 14:33:36 +02:00
parent b3d4442af3
commit 3c034a1385
3 changed files with 27 additions and 6 deletions

View File

@ -29,4 +29,4 @@
- name: Removes all packages from the package cache
become: yes
command: apt -y clean
...
...

18
playbooks/hosts-ping.yml Normal file
View File

@ -0,0 +1,18 @@
---
- hosts: all
gather_facts: no
tasks:
- name: Ping all hosts
ping:
register: ping_result
ignore_errors: yes
- name: Display success message
debug:
msg: "Successfully connected to {{ inventory_hostname }}"
when: ping_result is succeeded
- name: Display failure message
debug:
msg: "Failed to connect to {{ inventory_hostname }}: {{ ping_result.msg if 'msg' in ping_result else 'Unknown error' }}"
when: ping_result is failed