-
Bug
-
Resolution: Unresolved
-
Major
-
DO457 - RHAAP2.3-en-5-20241122
-
None
-
False
-
-
False
-
-
-
en-US (English)
Please fill in the following information:
URL: | https://rol.redhat.com/rol/app/courses/do457-2.3/pages/ch04s04 |
Reporter RHNID: | shasingh01 |
Section Title: | Guided Exercise: Gathering Facts from Managed Network Devices |
Issue description
Description: There should be 'delegate_to: localhost' parameter in tasks "Create the facts directory if it does not exist" and "Save facts to file"
It somehow works without them but the code is not clear
—
- name: Gather and display facts for managed nodes
hosts: ios,junos
gather_facts: false
tasks:
- name: Create the facts directory if it does not exist
ansible.builtin.file:
path: facts
state: directory
mode: 0751
run_once: true
- name: Gather IOS facts
cisco.ios.ios_facts:
gather_subset:
- all
when: ansible_network_os == 'cisco.ios.ios'
- name: Gather Junos facts
junipernetworks.junos.junos_facts:
gather_subset:
- all
when: ansible_network_os == 'junipernetworks.junos.junos'
- name: Save facts to file
ansible.builtin.copy:
content: "{{ ansible_facts | to_nice_yaml }}"
dest: "facts/{{ inventory_hostname }}.txt"
mode: 0640
Steps to reproduce:
Workaround:
Expected result: