Update test.yml
This commit is contained in:
@@ -1,11 +1,41 @@
|
|||||||
---
|
---
|
||||||
- name: Test connectivity and gather system information
|
- name: Test connectivity and gather system information
|
||||||
hosts: all
|
hosts: all
|
||||||
become: true
|
become: yes
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
- name: Update all servers (Debian/Ubuntu)
|
- name: Ping the servers
|
||||||
apt:
|
ansible.builtin.ping:
|
||||||
upgrade: dist
|
|
||||||
update_cache: yes
|
- name: Gather system information
|
||||||
when: ansible_facts['os_family'] == "Debian"
|
ansible.builtin.setup:
|
||||||
|
gather_subset:
|
||||||
|
- 'network'
|
||||||
|
- 'hardware'
|
||||||
|
- 'virtualization_type'
|
||||||
|
- 'virtualization_role'
|
||||||
|
|
||||||
|
- 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 virtualization type
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: "Virtualization Type: {{ ansible_virtualization_type }}"
|
||||||
|
|
||||||
|
- name: Display the virtualization role
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: "Virtualization Role: {{ ansible_virtualization_role }}"
|
||||||
|
|
||||||
|
- name: Display the uptime
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: uptime
|
||||||
|
register: uptime_result
|
||||||
|
|
||||||
|
- name: Show the uptime
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: "Uptime: {{ uptime_result.stdout }}"
|
||||||
Reference in New Issue
Block a user