# Trying to distribute Desktop Central agent to linux servers - prompt for 'reinstall' is teasing me, trying with 'expect'

**URL:** <https://forum.ansible.com/t/trying-to-distribute-desktop-central-agent-to-linux-servers-prompt-for-reinstall-is-teasing-me-trying-with-expect/30198>\
**Category:** Ansible Project\
**Created:** [April 26, 2019, 10:20am UTC](https://forum.ansible.com/t/trying-to-distribute-desktop-central-agent-to-linux-servers-prompt-for-reinstall-is-teasing-me-trying-with-expect/30198 "2019-04-26T10:20:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kenneth\_Fribert](https://avatars.discourse-cdn.com/v4/letter/k/ecae2f/32.png) [@Kenneth\_Fribert](https://forum.ansible.com/u/Kenneth_Fribert)\
**Post date:** [April 26, 2019, 10:20am UTC](https://forum.ansible.com/t/trying-to-distribute-desktop-central-agent-to-linux-servers-prompt-for-reinstall-is-teasing-me-trying-with-expect/30198/1 "2019-04-26T10:20:50Z")

</div>

Hi All

I’ve made a small playbook, that installs pip, and pexpect on our target servers, as I was thinking I needed to use the expect in the playbook.

So the yaml looks like this:

- name: Installing Desktop Central Agent  
expect:  
command: “/root/DesktopCentral\_LinuxAgent.bin”  
responses:  
“Do you want to uninstall the existing agent and re-install this agent? (y/n)” : n

So if it asks (because the playbook is rerun) it should just say “n”

But it fails with this message:

fatal: [servername]: FAILED! =\> {“changed”: true, “cmd”: “/root/DesktopCentral\_LinuxAgent.bin”, “delta”: “0:00:30.117165”, “end”: “2019-04-26 12:06:47.724526”, “msg”: “command exceeded timeout”, “rc”: null, “start”: “2019-04-26 12:06:17.607361”, “stdout”: "ServerInfo File Exists. Proceeding with Installation.\r\nAgent Already Installed.\r\nDo you want to uninstall the existing agent and re-install this agent? (y/n) : ", “stdout\_lines”: [“ServerInfo File Exists. Proceeding with Installation.”, “Agent Already Installed.”, "Do you want to uninstall the existing agent and re-install this agent? (y/n) : "]}

So what did I misunderstand?

Also, I’m unsure if the command will fail on systems not prompting for anything?

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [April 26, 2019, 1:45pm UTC](https://forum.ansible.com/t/trying-to-distribute-desktop-central-agent-to-linux-servers-prompt-for-reinstall-is-teasing-me-trying-with-expect/30198/2 "2019-04-26T13:45:57Z")

</div>

The expected string to match is a regex string. As such, things like `?` have special meaning. You can give partial string matches to make it easier, so that you don’t have to escape things if that will work for you.
