# what to do with a command task which starts more scripts

**URL:** <https://forum.ansible.com/t/what-to-do-with-a-command-task-which-starts-more-scripts/24207>\
**Category:** Ansible Project\
**Created:** [April 12, 2017, 5:54pm UTC](https://forum.ansible.com/t/what-to-do-with-a-command-task-which-starts-more-scripts/24207 "2017-04-12T17:54:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rob\_Mokkink](https://avatars.discourse-cdn.com/v4/letter/r/65b543/32.png) [@Rob\_Mokkink](https://forum.ansible.com/u/Rob_Mokkink)\
**Post date:** [April 12, 2017, 5:54pm UTC](https://forum.ansible.com/t/what-to-do-with-a-command-task-which-starts-more-scripts/24207/1 "2017-04-12T17:54:52Z")

</div>

Hi,

I am facing an issue with a command task that executes a main ruby script`(``oreman-proxy-certs-generate), see https://theforeman.org/plugins/katello/3.3/installation/smart_proxy.html.`  
``

```auto
The command executes the ruby script, but this scripts executes puppet and some other scripts, the first script is done, so the command task is done, which make 
What is the best practice to deal with these situations?

Thanks.

Kind regards,

Rob

```

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [April 12, 2017, 10:15pm UTC](https://forum.ansible.com/t/what-to-do-with-a-command-task-which-starts-more-scripts/24207/2 "2017-04-12T22:15:34Z")

</div>

If the ruby script does something like write a file when it has finished you could use async to kick off the job and then use wait\_for to wait until the file is written. There are other things you can wait for such as ports as well as files.

Hope this helps,

Jon

---

<div class="post-metadata">

**Author:** ![Rob\_Mokkink](https://avatars.discourse-cdn.com/v4/letter/r/65b543/32.png) [@Rob\_Mokkink](https://forum.ansible.com/u/Rob_Mokkink)\
**Post date:** [April 13, 2017, 7:33am UTC](https://forum.ansible.com/t/what-to-do-with-a-command-task-which-starts-more-scripts/24207/3 "2017-04-13T07:33:22Z")

</div>

I tried async and wait\_for, but both didn’t give me the expected result. I ended up writing a small wrapper script that executes the command, and it works.

---

<div class="post-metadata">

**Author:** ![Rob\_Mokkink](https://avatars.discourse-cdn.com/v4/letter/r/65b543/32.png) [@Rob\_Mokkink](https://forum.ansible.com/u/Rob_Mokkink)\
**Post date:** [April 13, 2017, 7:52am UTC](https://forum.ansible.com/t/what-to-do-with-a-command-task-which-starts-more-scripts/24207/4 "2017-04-13T07:52:09Z")

</div>

I tried everything, wait\_for, async etc. The quickest and easiest way was to fix the problem was to create a wrapper script and execute it with the script module.
