- name: Install Default Java (Debian/Ubuntu) apt: name: default-jdk state: present - name: ajout du groupe tomcat group: name: tomcat - name: ajout du tomcat user user: name: tomcat group: tomcat home: /usr/share/tomcat createhome: no system: yes - name: téléchargement de Tomcat get_url: url: "http://depl/store/apache-tomcat-10.0.13.tar.gz" dest: "{{ tomcat_archive_dest }}" - name: Crée une direction pour tomcat file: path: /usr/share/tomcat state: directory owner: tomcat group: tomcat - name: Extraction de l'archive tomcat unarchive: src: "{{ tomcat_archive_dest }}" dest: /usr/share/tomcat owner: tomcat group: tomcat remote_src: yes extra_opts: "--strip-components=1" creates: /usr/share/tomcat/bin - name: Copie du tomcat service file template: src: tomcat.service.j2 dest: /etc/systemd/system/tomcat.service when: ansible_service_mgr == "systemd" - name: démarrage et activation de tomcat service: daemon_reload: yes name: tomcat state: started enabled: yes when: ansible_service_mgr == "systemd" - name: Set UI access credentials template: src: tomcat-users.xml.j2 dest: /usr/share/tomcat/conf/tomcat-users.xml notify: restart tomcat - name: Allow access to Manager and Host Manager apps from any IP template: src: context.xml.j2 dest: "{{ item }}" with_items: - /usr/share/tomcat/webapps/host-manager/META-INF/context.xml - /usr/share/tomcat/webapps/manager/META-INF/context.xml notify: restart tomcat