How to do it...

  1. Create a new file called playbook.yml inside the ch1_ansible folder and incorporate the following lines in this file:
$  cat playbook.yml

---
- name: Initial Playbook
hosts: all
gather_facts: no
tasks:
- name: Display Hostname
debug:
msg: "Router name is {{ hostname }}"
- name: Display OS
debug:
msg: "{{ hostname }} is running {{ os }}"
  1. Run the playbook as shown here:
$ ansible-playbook -i hosts playbook.yml