Ansible version finalisée
This commit is contained in:
8
Mission2/ansible/roles/tomcat/tasks/main.yaml
Normal file
8
Mission2/ansible/roles/tomcat/tasks/main.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
- name: Add the OS specific variables
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
- "{{ ansible_distribution }}{{ ansible_distribution_major_version }}.yml"
|
||||
- "{{ ansible_os_family }}.yml"
|
||||
|
||||
- include_tasks: "tomcat-setup-{{ ansible_os_family }}.yml"
|
85
Mission2/ansible/roles/tomcat/tasks/tomcat-setup-Debian.yml
Normal file
85
Mission2/ansible/roles/tomcat/tasks/tomcat-setup-Debian.yml
Normal file
@@ -0,0 +1,85 @@
|
||||
- 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
|
||||
|
Reference in New Issue
Block a user