# Shell script does NOT run on target system?

**URL:** <https://forum.ansible.com/t/shell-script-does-not-run-on-target-system/22603>\
**Category:** Ansible Project\
**Created:** [September 21, 2016, 3:23pm UTC](https://forum.ansible.com/t/shell-script-does-not-run-on-target-system/22603 "2016-09-21T15:23:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZillaYT](https://avatars.discourse-cdn.com/v4/letter/z/4da419/32.png) [@ZillaYT](https://forum.ansible.com/u/ZillaYT)\
**Post date:** [September 21, 2016, 3:23pm UTC](https://forum.ansible.com/t/shell-script-does-not-run-on-target-system/22603/1 "2016-09-21T15:23:49Z")

</div>

I have a task that does this

`

- name: Generate certs using the example.sh script from zip file  
shell: \>  
cd “/tmp/{{ sg\_ssl\_dir }}/example-pki-scripts”  
chmod +x \*.sh  
./example.sh pw pw  
`

Which should generate cert/key pairs, but I don’t see them. I do NOT get errors. If I run the script myself after ssh’ng into the target system, it works. Any clues?

---

<div class="post-metadata">

**Author:** ![ZillaYT](https://avatars.discourse-cdn.com/v4/letter/z/4da419/32.png) [@ZillaYT](https://forum.ansible.com/u/ZillaYT)\
**Post date:** [September 21, 2016, 4:18pm UTC](https://forum.ansible.com/t/shell-script-does-not-run-on-target-system/22603/2 "2016-09-21T16:18:41Z")

</div>

SOLVED! I had to put a semi-colon at the end of each command, except the last one. so

`

- name: Generate certs using the example.sh script from zip file  
shell: \>  
cd “/tmp/{{ sg\_ssl\_dir }}/example-pki-scripts”;  
chmod +x \*.sh;  
./example.sh pw pw  
`

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [September 21, 2016, 4:32pm UTC](https://forum.ansible.com/t/shell-script-does-not-run-on-target-system/22603/3 "2016-09-21T16:32:12Z")

</div>

next time you might want to do:

shell: |

which preserves literal whitespace, vs

shell: \>

which does not.

---

<div class="post-metadata">

**Author:** ![ZillaYT](https://avatars.discourse-cdn.com/v4/letter/z/4da419/32.png) [@ZillaYT](https://forum.ansible.com/u/ZillaYT)\
**Post date:** [September 21, 2016, 6:13pm UTC](https://forum.ansible.com/t/shell-script-does-not-run-on-target-system/22603/4 "2016-09-21T18:13:40Z")

</div>

Nice, thank you. I changed my script accordingly.
