My guess would be that your playbook tried to start it before it had 
finished shutting down.

Simplest thing to do would be wait a bit before trying the start, but it 
would be better to check it is down.

You could use wait_for module to check it is down:
http://docs.ansible.com/ansible/wait_for_module.html

Incidentally, checking that tomcat is fully up and ready to service 
requests is tricky as it seems to lock its listening port and then not 
respond on it for some time.

We used to just wait before polling a particular url but now we use a 
pattern similar to what is described here to poll until we get a 200

https://groups.google.com/forum/#!searchin/ansible-project/do-until$20with$20uri$20module%7Csort:relevance/ansible-project/iLjIbsCASWU/ZmE-wYdtLQAJ

Hope this helps,

Jon



On Thursday, September 15, 2016 at 4:10:11 PM UTC+1, naag...@gmail.com 
wrote:
>
> Hi,
>
> - hosts: dev_tomcat
>   vars:
>     http_port: 8080
>     sudo: true
>     sudo_user: build
>   tasks:
>   - name: copy_shut
>     copy: src=/etc/ansible/playbooks/scripts/shutdown_all.sh dest=/tmp
>   - name: change_permission_shut
>     file: path=/tmp/shutdown_all.sh mode=777
>   - name: copy_start
>     copy: src=/etc/ansible/playbooks/scripts/startup_all.sh dest=/tmp
>   - name: change_permission_start
>     file: path=/tmp/startup_all.sh mode=777
>   - name: stopping tomcat
>     shell: /tmp/./shutdown_all.sh
>   - name: starting tomcat
>    #command: sudo -u build /etc/init.d/tomcat start
>     shell: /tmp/./startup_all.sh
>
> startup_all.sh => /etc/init.d/tomcat start
> ~
>
> Shutdown was happen properly, but it did not start tomcat, please advise 
> how to resolve this.
>
> Thanks,
>
>
>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/362f001a-ce5b-48bd-bc8b-e6d684105f9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to