# Pass multiple commands in ad-hoc mode in Cisco ios\_command module

**URL:** <https://forum.ansible.com/t/pass-multiple-commands-in-ad-hoc-mode-in-cisco-ios-command-module/27947>\
**Category:** Ansible Project\
**Created:** [July 4, 2018, 6:17am UTC](https://forum.ansible.com/t/pass-multiple-commands-in-ad-hoc-mode-in-cisco-ios-command-module/27947 "2018-07-04T06:17:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dilraj\_Singh\_Khalsa](https://avatars.discourse-cdn.com/v4/letter/d/e79b87/32.png) [@Dilraj\_Singh\_Khalsa](https://forum.ansible.com/u/Dilraj_Singh_Khalsa)\
**Post date:** [July 4, 2018, 6:17am UTC](https://forum.ansible.com/t/pass-multiple-commands-in-ad-hoc-mode-in-cisco-ios-command-module/27947/1 "2018-07-04T06:17:59Z")

</div>

I would like to know how can I pass multiple `show` commands in `ios_command` module in ad-hoc mode.

Sample with just one command:

```auto
ansible all -m ios_command -a "commands='show version'"

```

```auto

```

Now here I would like to send another command, say `show run` or any other.

Any suggestions on this would be appreciated.

---

<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:** [July 5, 2018, 9:09am UTC](https://forum.ansible.com/t/pass-multiple-commands-in-ad-hoc-mode-in-cisco-ios-command-module/27947/2 "2018-07-05T09:09:58Z")

</div>

I think you can make the commands a comma separated string.

---

<div class="post-metadata">

**Author:** ![Dilraj\_Singh\_Khalsa](https://avatars.discourse-cdn.com/v4/letter/d/e79b87/32.png) [@Dilraj\_Singh\_Khalsa](https://forum.ansible.com/u/Dilraj_Singh_Khalsa)\
**Post date:** [July 5, 2018, 9:38am UTC](https://forum.ansible.com/t/pass-multiple-commands-in-ad-hoc-mode-in-cisco-ios-command-module/27947/3 "2018-07-05T09:38:27Z")

</div>

I tried that but it throws Invalid Syntax error

---

<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:** [July 5, 2018, 11:30am UTC](https://forum.ansible.com/t/pass-multiple-commands-in-ad-hoc-mode-in-cisco-ios-command-module/27947/4 "2018-07-05T11:30:17Z")

</div>

It works for me on Ansible 2.5

ansible all -m ios\_command -a "commands='show version,show ip ssh'"

---

<div class="post-metadata">

**Author:** ![Dilraj\_Singh\_Khalsa](https://avatars.discourse-cdn.com/v4/letter/d/e79b87/32.png) [@Dilraj\_Singh\_Khalsa](https://forum.ansible.com/u/Dilraj_Singh_Khalsa)\
**Post date:** [July 5, 2018, 12:58pm UTC](https://forum.ansible.com/t/pass-multiple-commands-in-ad-hoc-mode-in-cisco-ios-command-module/27947/5 "2018-07-05T12:58:33Z")

</div>

I tried in 2.7 and it worked for me as well. Previously I was trying in 2.4.3.

Thanks for the suggestion.
