getting facts from remote devices

Hi,

I am new to this community and new ansible as so please excuse me of my stupid mistakes.

referring to peter’s webinar i am trying to collect device information using reguler expressions.it seems it through me error as bellow:-

TASK [network_facts : set hostname fact] ********************************************************************************************************************
task path: /etc/ansible/roles/network_facts/tasks/ios.yaml:14
fatal: [8.8.8.8]: FAILED! => {
“msg”: “Unexpected templating type error occurred on ({{ output.stdout[2] | regex_search(‘^hostname (.+)$’, ‘\\1’) | first }}): ‘NoneType’ object is not iterable”
}
fatal: [5.5.5.5]: FAILED! => {
“msg”: “Unexpected templating type error occurred on ({{ output.stdout[2] | regex_search(‘^hostname (.+)$’, ‘\\1’) | first }}): ‘NoneType’ object is not iterable”
}
to retry, use: --limit @/etc/ansible/facts.retry

PLAY RECAP **************************************************************************************************************************************************
5.5.5.5 : ok=2 changed=0 unreachable=0 failed=1
8.8.8.8 : ok=2 changed=0 unreachable=0 failed=1

i can confirm that ansible is able to login on the device and is able excute the required commend to collect the information but it seems reguler expression is not correct.

Here is my play book: