Hello Everyone;
Could you please guide me on how to be able to print the CLI command to the log file?
For example, if I am backing up inventory, and I am using "show chassis hardware", I would like to see something like this:
<chassis junos:style="inventory">
<name>Chassis</name>
Currently, I am only seeing the output and not seeing the hostname with the CLI command.
Here is my script
This my current output. It is not show ing the CLI
<chassis-inventory>. ==> this is my first line
<chassis style="inventory">
<name>Chassis</name>
<serial-number>JN111F17FAFA</serial-number>
------------------------------
---
- name: Get Device Facts
hosts: lab-nep6
connection: local
gather_facts: no
roles:
- juniper.junos
vars_prompt:
- name: USERNAME
prompt: Username
private: no
- name: PASSWORD
prompt: password
private: yes
tasks:
- name: Get inventory_hostname
juniper_junos_command:
host: "{{ inventory_hostname }}"
port: 22
user: "{{ USERNAME }}"
password: "{{ PASSWORD }}"
commands: "show chassis hardware detail"
formats:
- "xml"
dest: "tmp/inventory-nep6/{{ inventory_hostname }}__{{ '%m-%d-%Y' | strftime }}.output"
Thank you in advance :-)