Hello everyone,
I'm messing around with expect and I can't seem to get a match to get the ping command to fire again a second time. I'm assuming that I'm making a very common matching mistake that is alluding me. Any help would be greatly appreciated!
~~~~~~~~~~~~~~~~~~~~~
Playbook:
~~~~~~~~~~~~~~~~~~~~~
---
- hosts: localhost
connection: local
gather_facts: false
tasks:
- name: Expect Attempt
expect:
echo: yes
command: ping -c 3 127.0.0.1
responses:
Question:
- rtt "ping -c 3 127.0.0.1"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Traceback:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
changed: [localhost] => {
"changed": true,
"cmd": "ping -c 3 127.0.0.1",
"delta": "0:00:02.104639",
"end": "2018-03-12 09:24:22.733808",
"invocation": {
"module_args": {
"chdir": null,
"command": "ping -c 3 127.0.0.1",
"creates": null,
"echo": true,
"removes": null,
"responses": {
"Question": [
"rtt \"ping -c 3 127.0.0.1\""
]
},
"timeout": 30
}
},
"rc": 0,
"start": "2018-03-12 09:24:20.629169",
"stdout": "PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.\r\n64 bytes from
127.0.0.1: icmp_seq=1 ttl=64 time=0.048 ms\r\n64 bytes from
127.0.0.1: icmp_seq=2 ttl=64 time=0.053 ms\r\n64 bytes from
127.0.0.1: icmp_seq=3 ttl=64 time=0.063 ms\r\n\r\n--- 127.0.0.1 ping statistics ---\r\n3 packets transmitted, 3 received, 0% packet loss, time 1999ms\r\nrtt min/avg/max/mdev = 0.048/0.054/0.063/0.010 ms",
"stdout_lines": [
"PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.",
"64 bytes from
127.0.0.1: icmp_seq=1 ttl=64 time=0.048 ms",
"64 bytes from
127.0.0.1: icmp_seq=2 ttl=64 time=0.053 ms",
"64 bytes from
127.0.0.1: icmp_seq=3 ttl=64 time=0.063 ms",
"",
"--- 127.0.0.1 ping statistics ---",
"3 packets transmitted, 3 received, 0% packet loss, time 1999ms",
"rtt min/avg/max/mdev = 0.048/0.054/0.063/0.010 ms"
]
}
META: ran handlers
META: ran handlers
PLAY RECAP *********************************************************************************************************************************************
localhost : ok=1 changed=1 unreachable=0 failed=0