25 lines
636 B
YAML
25 lines
636 B
YAML
---
|
|
- name: Test Ansible Playbook
|
|
hosts: all
|
|
gather_facts: yes
|
|
become: false
|
|
|
|
tasks:
|
|
- name: Ping all hosts
|
|
ansible.builtin.ping:
|
|
|
|
- name: Display hostname
|
|
ansible.builtin.debug:
|
|
msg: "The hostname of this system is {{ inventory_hostname }}"
|
|
|
|
- name: Show OS distribution
|
|
ansible.builtin.debug:
|
|
msg: "This host is running {{ ansible_distribution }} {{ ansible_distribution_version }}"
|
|
|
|
- name: Run uptime command
|
|
ansible.builtin.command: uptime
|
|
register: uptime_result
|
|
|
|
- name: Display uptime result
|
|
ansible.builtin.debug:
|
|
var: uptime_result.stdout |