Projet/Mission2/ansible/roles/tomcat/tasks/tomcat-setup-Debian.yml
2021-12-15 09:56:20 +01:00

86 lines
2.2 KiB
YAML

- name: S'assurer que le système utilise le port HTTPS pour APT.
stat:
path: /usr/lib/apt/methods/https
register: apt_https_transport
- name: Installation APT HTTPS transport.
apt:
name: "apt-transport-https"
state: present
update_cache: yes
when: not apt_https_transport.stat.exists
- name: Installation packages basique
package:
name: ['vim','aptitude','bash-completion','tmux','tree','htop','wget','unzip','curl','git','python']
state: present
update_cache: yes
- name: Installation Java (Debian/Ubuntu)
apt:
name: default-jdk
state: present
- name: Ajout tomcat dans un groupe
group:
name: tomcat
- name: Ajout "tomcat" au user
user:
name: tomcat
group: tomcat
home: /usr/share/tomcat
createhome: no
system: yes
- name: Installation Tomcat
get_url:
url: "https://dlcdn.apache.org/tomcat/tomcat-10/v10.0.14/bin/apache-tomcat-10.0.14.tar.gz"
dest: "{{ tomcat_archive_dest }}"
- name: Création du répertoire tomcat
file:
path: /usr/share/tomcat
state: directory
owner: tomcat
group: tomcat
- name: Extraction archive de 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 tomcat fichier service*
template:
src: templates/tomcat.service.j2
dest: /etc/systemd/system/tomcat.service
when: ansible_service_mgr == "systemd"
- name: Démarrer et activé tomcat
service:
daemon_reload: yes
name: tomcat
state: started
enabled: yes
when: ansible_service_mgr == "systemd"
- name: Définir l'accès a l'interface utilisateur authentifié
template:
src: tomcat-users.xml.j2
dest: /usr/share/tomcat/conf/tomcat-users.xml
notify: restart tomcat
- name: Autoriser l'accès aux applications du gestionnaire et gestionnaire d'hote sur n'importe qu'elle 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