You can use 'include_vars'
tasks:
- name: include commands
include_vars:
file: shcmds.yaml
- name: Run a set of commands
junos_command:
commands: "{{ show_commands }}"
output: text
provider: "{{ netconf }}"
register: showcmds
$ cat shcmds.yaml
---
show_commands:
- show ver
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') }}"
- na
-playbooks-using-network-modules
Od: ansible-project@googlegroups.com [mailto:ansible-project@googlegroups.com]
W imieniu Asif Iqbal
Wysłano: 25 kwietnia 2017 21:31
Do: Ansible Project
Temat: [ansible-project] junos_command
I am failing to make junos_command work
2017-04-25 15:28:49,152 p=4058 u
HI Asif, junos_command requires netconf to be enabled on the remote device.
On Tue, Apr 25, 2017 at 3:31 PM, Asif Iqbal wrote:
> I am failing to make junos_command work
>
> 2017-04-25 15:28:49,152 p=4058 u=user | PLAY [sdwan-routers]
> ***
I am failing to make junos_command work
2017-04-25 15:28:49,152 p=4058 u=user | PLAY [sdwan-routers]
2017-04-25 15:28:49,171 p=4058 u=user | TASK [junos_command]
***