Tech/OSS/Ansible/Guide/Playbooks

From lathama
< Tech‎ | OSS‎ | Ansible‎ | Guide
Jump to navigation Jump to search

legacy.yaml

---

# login to a really old Cisco switch and get some info
# using the raw command to list the directory
# we are making no changes so we ignore changes
# printing out the result we only want the stdout_lines

- name: 'Legacy device info'
  hosts: oldcisco
  gather_facts: false
  tasks:
    - name: 'List filesystem'
      ansible.builtin.raw: 'dir'
      changed_when: false
      register: result
    - name: 'Print out the directory'
      ansible.builtin.debug:
        var: result.stdout_lines