# Unable to manage AVOCENT CONSOLE servers over Ansible

**URL:** <https://forum.ansible.com/t/unable-to-manage-avocent-console-servers-over-ansible/31481>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [October 17, 2019, 8:26pm UTC](https://forum.ansible.com/t/unable-to-manage-avocent-console-servers-over-ansible/31481 "2019-10-17T20:26:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shashidhar](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@Shashidhar](https://forum.ansible.com/u/Shashidhar)\
**Post date:** [October 17, 2019, 8:26pm UTC](https://forum.ansible.com/t/unable-to-manage-avocent-console-servers-over-ansible/31481/1 "2019-10-17T20:26:10Z")

</div>

Hello ,

root@ubuntu-16-04-4-server-amd64:/# ansible --version  
ansible 2.8.5  
config file = /etc/ansible/ansible.cfg  
configured module search path = [u’/root/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]  
ansible python module location = /usr/lib/python2.7/dist-packages/ansible  
executable location = /usr/bin/ansible  
python version = 2.7.12 (default, Oct 8 2019, 14:14:10) [GCC 5.4.0 20160609]

I wanted to manage Avocent Console servers using ansible play books but i am not able to ping to Avocent Console Server hosts from Ansible Controller, please see the error output mentioned below.

root@ubuntu-16-04-4-server-amd64:/# ansible -m ping all  
10.219.14.74 | UNREACHABLE! =\> {  
“changed”: false,  
“msg”: “Failed to connect to the host via ssh: Permission denied (publickey,keyboard-interactive).”,  
“unreachable”: true  
}  
[DEPRECATION WARNING]: Distribution Ubuntu 16.04 on host 10.219.83.180 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with prior  
Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See  
[https://docs.ansible.com/ansible/2.8/reference\_appendices/interpreter\_discovery.html](https://docs.ansible.com/ansible/2.8/reference_appendices/interpreter_discovery.html) for more information. This feature will be removed in version 2.12. Deprecation  
warnings can be disabled by setting deprecation\_warnings=False in ansible.cfg.  
10.219.83.180 | SUCCESS =\> {  
“ansible\_facts”: {  
“discovered\_interpreter\_python”: “/usr/bin/python”  
},  
“changed”: false,  
“ping”: “pong”  
}

10.219.13.72 | UNREACHABLE! =\> {  
“changed”: false,  
“msg”: “Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in "/tmp". Failed command was: ( umask 77 && mkdir -p "`echo /bin/sh: -c: line 1: syntax error: unexpected end of file/.ansible/tmp/ansible-tmp-1571343763.29-193564225595742`" && echo ansible-tmp-1571343763.29-193564225595742="`echo /bin/sh: -c: line 1: syntax error: unexpected end of file/.ansible/tmp/ansible-tmp-1571343763.29-193564225595742`" ), exited with result 1, stdout output: /bin/bash: -c: line 0: syntax error near unexpected token `('\r\n/bin/bash: -c: line 0: `/bin/sh -c ( umask 77 && mkdir -p "`echo /bin/sh: -c: line 1: syntax error: unexpected end of file/.ansible/tmp/ansible-tmp-1571343763.29-193564225595742`" && echo ansible-tmp-1571343763.29-193564225595742%3’\r\n”,  
“unreachable”: true

in the above output 10.219.13.72 and 10.219.14.74 ip’s are belongs to Avocent Console Servers and the one which is successful is my Ubuntu VM.  
any help in resolving the issue is highly appreciable.

Thanks a lot in Advance

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [October 17, 2019, 8:35pm UTC](https://forum.ansible.com/t/unable-to-manage-avocent-console-servers-over-ansible/31481/2 "2019-10-17T20:35:12Z")

</div>

Ansible need a proper shell and Python on the remote node to work, I doubt Avocent Console has that.

If it has a proper shell the raw module might work, if not your only choice is the expect module.

---

<div class="post-metadata">

**Author:** ![Shashidhar](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@Shashidhar](https://forum.ansible.com/u/Shashidhar)\
**Post date:** [October 28, 2019, 1:22pm UTC](https://forum.ansible.com/t/unable-to-manage-avocent-console-servers-over-ansible/31481/3 "2019-10-28T13:22:24Z")

</div>

Hi Kai Stian Olstad.

Thanks for the revert, when i tried expect module in play book i am seeing below error

root@ubuntu-16-04-4-server-amd64:/etc/ansible# ansible-playbook consoleservers.yml  
ERROR! conflicting action statements: command, expect

The error appears to be in ‘/etc/ansible/consoleservers.yml’: line 4, column 5, but may  
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

tasks:

- name: Reboot  
^ here

if i comment expect in playbook then playbook runs well but still host is uneachable, please see below output

root@ubuntu-16-04-4-server-amd64:/etc/ansible# ansible-playbook consoleservers.y ml

PLAY [all] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [Gathering Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [10.219.14.74]: UNREACHABLE! =\> {“changed”: false, “msg”: “Failed to conn ect to the host via ssh: Permission denied (publickey,keyboard-interactive).”, " unreachable": true}

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
10.219.14.74 : ok=0 changed=0 unreachable=1 failed=0 s kipped=0 rescued=0 ignored=0

below is the playbook i am trying, the agenda of playbook is to reboot the console server. i have used expect module in two different places but no luck, could you please suggest.  
i am very new to ansible.

- hosts: all  
#expect:  
tasks:
- name: Reboot

# expect:

command: reboot  
#responses:  
#(?i)password: “linux”  
#no\_log: true

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [October 29, 2019, 10:09pm UTC](https://forum.ansible.com/t/unable-to-manage-avocent-console-servers-over-ansible/31481/4 "2019-10-29T22:09:50Z")

</div>

Think of expect as your automated human, so your command is actually the ssh command the user would type.  
And this must run on localhost host, with conneection: local or delegate\_to: localhost.

- name: reboot  
&nbsp;&nbsp;&nbsp;expect:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;command: ssh \<something\>  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;responses:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<text to wait for\>: \<the respose to type in\>
