# Rebooting a Cisco ASA device

**URL:** <https://forum.ansible.com/t/rebooting-a-cisco-asa-device/29364>\
**Category:** Ansible Project\
**Created:** [January 3, 2019, 10:56pm UTC](https://forum.ansible.com/t/rebooting-a-cisco-asa-device/29364 "2019-01-03T22:56:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sahar](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@Sahar](https://forum.ansible.com/u/Sahar)\
**Post date:** [January 3, 2019, 10:56pm UTC](https://forum.ansible.com/t/rebooting-a-cisco-asa-device/29364/1 "2019-01-03T22:56:41Z")

</div>

I’m trying to reboot a Cisco ASA Firewall, and run the “show version” command after it. It seems that rebooting works, but when the playbook gets to the show version command, it will get failed by showing the error down below. Any idea about it?

- name: Rebooting the ASA  
asa\_command:  
commands:

- “reload\n”

- wait\_for: timeout=180

- name: check the version  
asa\_command:  
commands:

- show version  
register: output

- name: check the version  
debug: var=output.stdout

TASK [Rebooting the ASA] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
skipping: [Fw4Script-02.tor.bellnhs.int]  
ok: [Fw4Script-01.tor.bellnhs.int]

TASK [wait\_for] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
skipping: [Fw4Script-02.tor.bellnhs.int]  
ok: [Fw4Script-01.tor.bellnhs.int]

TASK [check the version] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
skipping: [Fw4Script-02.tor.bellnhs.int]  
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ansible.module\_utils.connection.ConnectionError: Socket is closed  
fatal: [Fw4Script-01.tor.bellnhs.int]: FAILED! =\> {“changed”: false, “module\_stderr”: “Traceback (most recent call last):\n File "/home/shdianat/.ansible/tmp/ansible-local-12216t0E3Bw/ansible-tmp-1546555792.58-98199446309935/AnsiballZ\_asa\_command.py", line 113, in \n _ansiballz\_main()\n File "/home/shdianat/.ansible/tmp/ansible-local-12216t0E3Bw/ansible-tmp-1546555792.58-98199446309935/AnsiballZ\_asa\_command.py", line 105, in ansiballz\_main\n invoke\_module(zipped\_mod, temp\_path, ANSIBALLZ\_PARAMS)\n File "/home/shdianat/.ansible/tmp/ansible-local-12216t0E3Bw/ansible-tmp-1546555792.58-98199446309935/AnsiballZ\_asa\_command.py", line 48, in invoke\_module\n imp.load\_module(‘ **main** ’, mod, module, MOD\_DESC)\n File "/tmp/ansible\_asa\_command\_payload\_4Z1mL/ **main**.py", line 195, in \n File "/tmp/ansible\_asa\_command\_payload\_4Z1mL_/ **main**.py", line 165, in main\n File "/tmp/ansible\_asa\_command\_payload\_4Z1mL\_/ansible\_asa\_command\_payload.zip/ansible/module\_utils/network/asa/asa.py", line 124, in run\_commands\n File "/tmp/ansible\_asa\_command\_payload\_4Z1mL\_/ansible\_asa\_command\_payload.zip/ansible/module\_utils/connection.py", line 173, in **rpc** \nansible.module\_utils.connection.ConnectionError: Socket is closed\n”, “module\_stdout”: “”, “msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”, “rc”: 1}

These are the parameters in ansible.cfg file:

[persistent\_connection]

connect\_timeout = 300  
command\_timeout = 300

---

<div class="post-metadata">

**Author:** ![ganeshrn](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ganeshrn/32/1021_2.png) [@ganeshrn](https://forum.ansible.com/u/ganeshrn)\
**Post date:** [January 4, 2019, 7:55am UTC](https://forum.ansible.com/t/rebooting-a-cisco-asa-device/29364/2 "2019-01-04T07:55:10Z")

</div>

Try adding “meta: reset\_connection” after wait\_for task and before check version task.  
Also, which Ansible version are you using?

Regards,  
Ganesh

---

<div class="post-metadata">

**Author:** ![Veera\_Kumar](https://avatars.discourse-cdn.com/v4/letter/v/b5a626/32.png) [@Veera\_Kumar](https://forum.ansible.com/u/Veera_Kumar)\
**Post date:** [January 4, 2019, 8:48am UTC](https://forum.ansible.com/t/rebooting-a-cisco-asa-device/29364/3 "2019-01-04T08:48:46Z")

</div>

Please refer below link as well,

[https://gdykeman.github.io/2018/06/26/ios-upgrades/](https://gdykeman.github.io/2018/06/26/ios-upgrades/)

---

<div class="post-metadata">

**Author:** ![Sahar](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@Sahar](https://forum.ansible.com/u/Sahar)\
**Post date:** [January 4, 2019, 3:41pm UTC](https://forum.ansible.com/t/rebooting-a-cisco-asa-device/29364/4 "2019-01-04T15:41:28Z")

</div>

Thanks. My ansible version is: 2.7.4. This command let me proceed. Is this a normal output?

TASK [wait\_for] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
skipping: [Fw4Script-01.tor.bellnhs.int]  
ok: [Fw4Script-02.tor.bellnhs.int]  
[WARNING]: reset\_connection task does not support when conditional

TASK [show version on ASA Firewall] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
skipping: [Fw4Script-01.tor.bellnhs.int]  
ok: [Fw4Script-02.tor.bellnhs.int]

My ansible version is: 2.7.4
