--- - name: tomcat restart instances with changed configs service: name=tomcat-instance-'{{ item.item.http_port }}' state=restarted sleep=20 with_items: restart_needed.results when: item.changed - name: tomcat restart instances with changed jmx config service: name=tomcat-instance-'{{ item.item.http_port }}' state=restarted sleep=20 with_items: jmx_restart_needed.results when: item.changed - name: tomcat instances restart service: name=tomcat-instance-'{{ item.http_port }}' state=restarted sleep=20 with_items: tomcat_m_instances - name: enable tomcat instances service: name=tomcat-instance-'{{ item.http_port }}' state=started enabled=yes sleep 20 with_items: tomcat_m_instances - name: disable tomcat instances service: name=tomcat-instance-'{{ item.http_port }}' state=stopped enabled=no sleep 20 with_items: tomcat_m_instances