Hello,
I’m trying to execute show commands on a Juniper using the playbook below. I would like to use a separate file with the list of show commands but can’t find the correct way to do it. Any help would be appreciated.
thanks
showfile: “{{ lookup(‘file’, ‘template/shcmds.txt’) }}”
- name: Run a set of commands
junos_command:
commands: “{{ showfile }}”
src: template/shcmds.j2
output: text
provider: “{{ netconf }}”
register: showcmds
-
set_fact:
readout: “{{ showcmds.stdout_lines | to_nice_yaml }}” -
name: copy content
local_action:
copy content=“{{ readout }}”
dest=“{{ report_dir }}/{{ inventory_hostname }}.txt”
######### Input file ##########
template]$ more shcmds.txt
- “show bgp sum”
- “show route summary”