Hey guys,
Hoping you can all help. I've nearly finished my project to implement device configuration standards using Ansible but i can't get this last bit to work! I've copied my post from /r/ansible below:
I'm working on a task that will run a command (see below) on a Cisco device & return an output. What i then want to do is check that output and compare it to "inventory hostname" the (ip address) and then register a variable from that line
My code may clear it up:
- name: getInterface ios_command: commands: - show ip int bri | inc [0-9]+[ ]+YES timeout: 20 register: interface - name: debuggings debug: msg: ""
This returns:
"msg": "Vlan13 1.1.1.1 YES NVRAM up up"
Essentially i want to scan through the output and pick out "1.1.1.1" if it matches inventory hostname and then register "Vlan13"
Has anyone done anything similar in you're own setup? I've tried a few methods but still can't get this to work!
Thanks in advance
No comments:
Post a Comment