Hi, I am trying to work out how to iterate through some results from a command
I am running on a network device. the idea is when I find the line that matches
what I am looking for based on a regexp I want to store it.
tasks:
- name: get the existing access-list
ios_command:
provider: "{{ cli }}"
commands:
- show access-list mgtaccess
register: result
- debug: var=result.stdout_lines
- name: Do something with each result
debug:
msg: "{{ item }}"
with_items:
- "{{ result.stdout_lines }}"
This is the output from the task
ok: [172.16.1.135] => (item=[u'Standard IP access list mgtaccess', u' 20
permit 10.1.1.1', u' 10 permit 192.168.0.1', u' 30 permit any (2566
matches)']) => {
"changed": false,
"failed": false,
"item": [
"Standard IP access list mgtaccess",
" 20 permit 10.1.1.1",
" 10 permit 192.168.0.1",
" 30 permit any (2566 matches)"
],
"msg": [
"Standard IP access list mgtaccess",
" 20 permit 10.1.1.1",
" 10 permit 192.168.0.1",
" 30 permit any (2566 matches)"
]
}
I'm confused shouldn't I be seeing multiple individual 'msg's??
Many thanks.
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/aaacc3bb-dd88-4f11-95c6-6b8f387a2824%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.