--- - name: Springboot startup files management block: - name: Install the springboot app upstart init file template: src=springboot-upstart.conf.j2 dest=/etc/init/{{ item.name }}.conf owner=root group=root mode=0644 with_items: '{{ springboot_apps }}' when: ansible_service_mgr != 'systemd' - name: Install the springboot systemd service unit template: src=springboot.service.systemd.j2 dest=/etc/systemd/system/{{ item.name }}.service mode=0644 owner=root group=root with_items: '{{ springboot_apps }}' when: ansible_service_mgr == 'systemd' notify: systemd reload - name: Install the springboot logrotate configuration template: src=springboot-logrotate.j2 dest=/etc/logrotate.d/{{ item.name }} owner=root group=root mode=0444 with_items: '{{ springboot_apps }}' - name: Ensure that the springboot service is running and enabled service: name={{ item.name }} state=started enabled=yes with_items: '{{ springboot_apps }}' when: springboot_config | bool tags: [ 'springboot', 'springboot_config' ]