Shell script does NOT run on target system?

13 views
Skip to first unread message

ZillaYT

unread,
Sep 21, 2016, 11:23:49 AM9/21/16
to Ansible Project
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?

ZillaYT

unread,
Sep 21, 2016, 12:18:41 PM9/21/16
to Ansible Project
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



Brian Coca

unread,
Sep 21, 2016, 12:32:19 PM9/21/16
to ansible...@googlegroups.com
next time you might want to do:

shell: | 

which preserves literal whitespace, vs 

shell: >

which does not.


----------
Brian Coca

ZillaYT

unread,
Sep 21, 2016, 2:13:40 PM9/21/16
to Ansible Project
Nice, thank you. I changed my script accordingly.
Reply all
Reply to author
Forward
0 new messages