---
- hosts: apache-tomcat6:&apt
  sudo: yes
  tasks:

    - name: Install Tomcat 6
      apt: pkg={{item}} state=present
      with_items:
        # Tomcat complains on start if there is no JDK installed, but on Ubuntu
        # 12.04 there is no JDK listed in its dependencies, so install a JDK
        # manually.
        - default-jdk
        - tomcat6

- hosts: apache-tomcat6
  sudo: yes
  tasks:

    - name: Create Tomcat web.xml with WebDAV enabled
      template: src=web.xml.j2 dest=/etc/tomcat6/web.xml owner=root group=tomcat6 mode=0644 backup=yes 
      notify: Restart Tomcat

    - name: allow WebDAV to use ROOT directory for serving files
      file: name=/var/lib/tomcat6/webapps/ROOT state=directory owner=tomcat6 mode=0750

  handlers:

    - name: Restart Tomcat
      service: name=tomcat6 state=restarted
---
- hosts: apache-tomcat6:&apt
  sudo: yes
  tasks:

    - name: Install Tomcat 6
      apt: pkg={{item}} state=present
      with_items:
        # Tomcat complains on start if there is no JDK installed, but on Ubuntu
        # 12.04 there is no JDK listed in its dependencies, so install a JDK
        # manually.
        - default-jdk
        - tomcat6

- hosts: apache-tomcat6
  sudo: yes
  tasks:

    - name: Increase Tomcat memory
      lineinfile: dest=/etc/default/tomcat6 regexp='^(JAVA_OPTS=.*-Xmx)\d+[MmGg]?(.*)$' line='\g<1>1024m\g<2>'
            state=present backrefs=yes backup=yes

    - name: Create Tomcat web.xml with WebDAV enabled
      template: src=web.xml.j2 dest=/etc/tomcat6/web.xml owner=root group=tomcat6 mode=0644 backup=yes 
      notify: Restart Tomcat

    - name: allow WebDAV to use ROOT directory for serving files
      file: name=/var/lib/tomcat6/webapps/ROOT state=directory owner=tomcat6 mode=0750

  handlers:

    - name: Restart Tomcat
      service: name=tomcat6 state=restarted
Increase Tomcat memory for Taverna Server (SERVINF-156)
Increase Tomcat memory for Taverna Server (SERVINF-156)
