# Multiple linux commands using command module

**URL:** <https://forum.ansible.com/t/multiple-linux-commands-using-command-module/28125>\
**Category:** Ansible Project\
**Created:** [July 23, 2018, 11:47am UTC](https://forum.ansible.com/t/multiple-linux-commands-using-command-module/28125 "2018-07-23T11:47:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vamsi\_Krishna](https://avatars.discourse-cdn.com/v4/letter/v/a8b319/32.png) [@Vamsi\_Krishna](https://forum.ansible.com/u/Vamsi_Krishna)\
**Post date:** [July 23, 2018, 11:47am UTC](https://forum.ansible.com/t/multiple-linux-commands-using-command-module/28125/1 "2018-07-23T11:47:12Z")

</div>

HI All,

I have written yaml script to get pre-checks from Linux systems before patching them. Can any one suggest on how can I re-write using command module in the ansible play book.

---

<div class="post-metadata">

**Author:** ![Andrew\_Latham](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@Andrew\_Latham](https://forum.ansible.com/u/Andrew_Latham)\
**Post date:** [July 23, 2018, 4:01pm UTC](https://forum.ansible.com/t/multiple-linux-commands-using-command-module/28125/2 "2018-07-23T16:01:15Z")

</div>

Vamsi

Try using facts: [https://docs.ansible.com/ansible/2.5/user\_guide/playbooks\_variables.html#information-discovered-from-systems-facts](https://docs.ansible.com/ansible/2.5/user_guide/playbooks_variables.html#information-discovered-from-systems-facts)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [July 23, 2018, 5:07am UTC](https://forum.ansible.com/t/multiple-linux-commands-using-command-module/28125/3 "2018-07-23T05:07:06Z")

</div>

i would advise you to use the script module instead

[https://docs.ansible.com/ansible/latest/modules/script\_module.html](https://docs.ansible.com/ansible/latest/modules/script_module.html)

---

<div class="post-metadata">

**Author:** ![bhargav\_bhargavan](https://avatars.discourse-cdn.com/v4/letter/b/a698b9/32.png) [@bhargav\_bhargavan](https://forum.ansible.com/u/bhargav_bhargavan)\
**Post date:** [July 23, 2018, 5:23pm UTC](https://forum.ansible.com/t/multiple-linux-commands-using-command-module/28125/4 "2018-07-23T17:23:13Z")

</div>

Hi coca .

Please help me on ansible.

1 first i want to get(fetch) files from source to ansible server

1. What ever i got files from those files need to list the files in clients . Exist or not .

2. If exist the files need to take safe copy . Later need to deploy the files.

This is my request bro please help me on this.

---

<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 23, 2018, 5:32pm UTC](https://forum.ansible.com/t/multiple-linux-commands-using-command-module/28125/5 "2018-07-23T17:32:22Z")

</div>

Why do you hijack other peoples threads?  
It's considered a very rude behavior, so please refrain from doing so.
