semaphore-test/test.yml
2024-08-27 04:39:14 +00:00

33 lines
819 B
YAML

---
- name: Test connectivity and gather system information
hosts: all
become: false
tasks:
- name: Ping the servers
ansible.builtin.ping:
- name: Gather system information
ansible.builtin.setup:
gather_subset:
- 'network'
- 'virtualization'
- 'hardware'
- name: Display the hostname
ansible.builtin.debug:
msg: "Hostname: {{ ansible_hostname }}"
- name: Display the operating system
ansible.builtin.debug:
msg: "Operating System: {{ ansible_distribution }} {{ ansible_distribution_version }}"
- name: Display the uptime
ansible.builtin.command:
cmd: uptime
register: uptime_result
- name: Show the uptime
ansible.builtin.debug:
msg: "Uptime: {{ uptime_result.stdout }}"