Hi Michael,

---
- hosts: service
  vars:
    app_service_port: 8080
    tomcat_home: /opt/apache-tomcat-8.0.9
  remote_user: deploy
  tasks:
  - name: stop tomcat
    shell: "{{ tomcat_home }}"/bin/shutdown.sh
  - name: start tomcat
    shell: "{{ tomcat_home }}"/bin/startup.sh

olga@olga-vbox:~$ ansible-playbook test.yml
ERROR: Syntax Error while loading YAML script, test.yml
Note: The error may actually appear before this position: line 7, column 31
  - name: stop tomcat
    shell: "{{ tomcat_home }}"/bin/shutdown.sh
                                            ^
We could be wrong, but this one looks like it might be an issue with
missing quotes.  Always quote template expression brackets when they
start a value. For instance:
    with_items:
      - {{ foo }}
Should be written as:
    with_items:
      - "{{ foo }}"

Thanks,
Olga

On Tue, Oct 14, 2014 at 2:20 AM, Michael DeHaan <[email protected]> wrote:

> "Quoting also did not work. I added "sh" before the {{ and it worked."
>
> Please show me what you tried and what the output was?
>
> Thanks!
>
>
> On Fri, Oct 10, 2014 at 5:24 AM, olga <[email protected]> wrote:
>
>> Hi Michael,
>>
>> Quoting also did not work. I added "sh" before the {{ and it worked.
>>
>>   tasks:
>>   - name: stop tomcat
>>     shell: sh {{ tomcat_home }}/bin/shutdown.sh
>>   - name: start tomcat
>>     shell: sh {{ tomcat_home }}/bin/startup.sh
>>
>> Thanks for the link.
>>
>> Regards,
>> Olga
>>
>> On Thursday, October 9, 2014 1:33:15 AM UTC+5:30, Michael Peters wrote:
>>>
>>> Try quoting the templated part. The {{ }} syntax markers mess up the
>>> yaml parsing - http://docs.ansible.com/YAMLSyntax.html#gotchas
>>>
>>> On Wed, Oct 8, 2014 at 3:41 PM, olga <[email protected]> wrote:
>>> > Hi,
>>> >
>>> > ---
>>> > - hosts: service
>>> >   vars:
>>> >     app_service_port: 8080
>>> >     tomcat_home: /opt/apache-tomcat-8.0.9
>>> >   remote_user: deploy
>>> >   tasks:
>>> >   - name: stop tomcat
>>> >     shell: {{ tomcat_home }}/bin/shutdown.sh
>>> >   - name: start tomcat
>>> >     shell: {{ tomcat_home }}/bin/startup.sh
>>> >
>>> > When i run this play, i get
>>> >
>>> > ERROR: Syntax Error while loading YAML script, test.yml
>>> > Note: The error may actually appear before this position: line 8,
>>> column 28
>>> >
>>> >   tasks:
>>> >   - shell: {{ tomcat_home}}/bin/shutdown.sh
>>> >
>>> > is variable substitution not allowed in shell module.
>>> >
>>> > These are custom installed tomcat dir, so i have to use shell command
>>> to
>>> > start and stop the tomcat. Also, has anyone verified if the java
>>> process got
>>> > killed. I have seen some times that after shutdown, the java process
>>> still
>>> > run. OR is there any easy method in ansible to do this.
>>> >
>>> > Thanks,
>>> > olaga
>>> >
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> Groups
>>> > "Ansible Project" group.
>>> > To unsubscribe from this group and stop receiving emails from it, send
>>> an
>>> > email to [email protected].
>>> > To post to this group, send email to [email protected].
>>> > To view this discussion on the web visit
>>> > https://groups.google.com/d/msgid/ansible-project/
>>> 72a6af6d-d972-4747-bb6f-21eb0c63350b%40googlegroups.com.
>>> > For more options, visit https://groups.google.com/d/optout.
>>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/7cc0daa5-8d6e-46d8-ba2b-1f35ff8acdc8%40googlegroups.com
>> <https://groups.google.com/d/msgid/ansible-project/7cc0daa5-8d6e-46d8-ba2b-1f35ff8acdc8%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/n5jvt2qOI9I/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgyu79FsM7xmxVjRThbhtzJiQaBuCJhBMni0m9JAwxjOyg%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgyu79FsM7xmxVjRThbhtzJiQaBuCJhBMni0m9JAwxjOyg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAKQjojRVtsDjw1mVLiqQvnJfei4kujgN74UMatjuck5%2Bi5fRHQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to