2021-12-14 15:11:34 +01:00

75 lines
2.1 KiB
YAML

- name: Install basic packages
package:
name: ['vim','aptitude','bash-completion','tmux','tree','htop','wget','unzip','curl','git','python']
state: present
update_cache: yes
- name: installer JDK
apt:
name: openjdk-11-jdk
state: present
- name: creer le repertoire /opt/tomcat
file:
path: /usr/share/tomcat
state: directory
mode: 0755
- name: creer le groupe tomcat
group:
name: tomcat
- name: creer l'utilisateur tomcat
user:
name: tomcat
group: tomcat
home: /usr/share/tomcat
createhome: no
- name: installer TomCat
unarchive:
src: http://depl/store/apache-tomcat-10.0.13.tar.gz
dest: /usr/share/tomcat
remote_src: yes
- name: Change ownership
file:
path: /usr/share/tomcat
owner: tomcat
group: tomcat
mode: "u+rwx,g+rx,o=rx"
recurse: yes
state: directory
- name: Templating Tomcat service from local to remote
template:
src: tomcat.service.j2
dest: /etc/systemd/system/tomcat.service
when: ansible_service_mgr == "systemd"
- name: Demarrer tomcat
local_action: command sh /usr/share/tomcat/apache-tomcat-10.0.13/bin/startup.sh
- name: Definition des utilisateurs
template:
src: tomcat-users.xml.j2
dest: /usr/share/tomcat/apache-tomcat-10.0.13/conf/tomcat-users.xml
- name: Autorisation des différentes ips de connexions
template:
src: context.xml.j2
dest: "{{ item }}"
with_items:
- /usr/share/tomcat/apache-tomcat-10.0.13/webapps/host-manager/META-INF/context.xml
- /usr/share/tomcat/apache-tomcat-10.0.13/webapps/manager/META-INF/context.xml
- name: Redemarrer le service tomcat (1)
local_action: command sh /usr/share/tomcat/apache-tomcat-10.0.13/bin/shutdown.sh
- name: Redemarrer le service tomcat (2)
local_action: command sh /usr/share/tomcat/apache-tomcat-10.0.13/bin/startup.sh
- name: Redemarrer le service tomcat (3)
local_action: command sh /usr/share/tomcat/apache-tomcat-10.0.13/bin/catalina.sh start