ap34
This commit is contained in:
		
							
								
								
									
										2
									
								
								ap34/SDIS29-P2/ppe34test/roles/ppebase/defaults/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								ap34/SDIS29-P2/ppe34test/roles/ppebase/defaults/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| tomcat_archive_url: http://depl/store/apache-tomcat-10.0.13.tar.gz | ||||
| tomcat_archive_dest: /usr/share/tomcat/ | ||||
							
								
								
									
										96
									
								
								ap34/SDIS29-P2/ppe34test/roles/ppebase/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										96
									
								
								ap34/SDIS29-P2/ppe34test/roles/ppebase/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,96 @@ | ||||
|   - 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 | ||||
|  | ||||
|  | ||||
|   - name: on installe java | ||||
|     apt: | ||||
|       name: default-jdk | ||||
|       state: present | ||||
|  | ||||
|   - name: on installe les paquets de MariaDB | ||||
|     apt: | ||||
|       name: mariadb-server | ||||
|       state: latest | ||||
|       update_cache: yes | ||||
|  | ||||
|   - name: on installe Python3 | ||||
|     apt: | ||||
|       name: python3-pymysql | ||||
|       state: latest | ||||
|  | ||||
|   - name: on lance MariaDB | ||||
|     service: | ||||
|       name: mysql | ||||
|       state: started | ||||
|  | ||||
| @@ -0,0 +1,19 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!-- | ||||
|   Licensed to the Apache Software Foundation (ASF) under one or more | ||||
|   contributor license agreements.  See the NOTICE file distributed with | ||||
|   this work for additional information regarding copyright ownership. | ||||
|   The ASF licenses this file to You under the Apache License, Version 2.0 | ||||
|   (the "License"); you may not use this file except in compliance with | ||||
|   the License.  You may obtain a copy of the License at | ||||
|  | ||||
|       http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|   Unless required by applicable law or agreed to in writing, software | ||||
|   distributed under the License is distributed on an "AS IS" BASIS, | ||||
|   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|   See the License for the specific language governing permissions and | ||||
|   limitations under the License. | ||||
| --> | ||||
| <Context antiResourceLocking="false" privileged="true" > | ||||
| </Context> | ||||
| @@ -0,0 +1,44 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!-- | ||||
|   Licensed to the Apache Software Foundation (ASF) under one or more | ||||
|   contributor license agreements.  See the NOTICE file distributed with | ||||
|   this work for additional information regarding copyright ownership. | ||||
|   The ASF licenses this file to You under the Apache License, Version 2.0 | ||||
|   (the "License"); you may not use this file except in compliance with | ||||
|   the License.  You may obtain a copy of the License at | ||||
|  | ||||
|       http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|   Unless required by applicable law or agreed to in writing, software | ||||
|   distributed under the License is distributed on an "AS IS" BASIS, | ||||
|   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|   See the License for the specific language governing permissions and | ||||
|   limitations under the License. | ||||
| --> | ||||
| <tomcat-users xmlns="http://tomcat.apache.org/xml" | ||||
|               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||||
|               xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd" | ||||
|               version="1.0"> | ||||
| <!-- | ||||
|   NOTE:  By default, no user is included in the "manager-gui" role required | ||||
|   to operate the "/manager/html" web application.  If you wish to use this app, | ||||
|   you must define such a user - the username and password are arbitrary. It is | ||||
|   strongly recommended that you do NOT use one of the users in the commented out | ||||
|   section below since they are intended for use with the examples web | ||||
|   application. | ||||
| --> | ||||
| <!-- | ||||
|   NOTE:  The sample user and role entries below are intended for use with the | ||||
|   examples web application. They are wrapped in a comment and thus are ignored | ||||
|   when reading this file. If you wish to configure these users for use with the | ||||
|   examples web application, do not forget to remove the <!.. ..> that surrounds | ||||
|   them. You will also need to set the passwords to something appropriate. | ||||
| --> | ||||
| <!-- user manager can access only manager section --> | ||||
| <role rolename="manager-gui" /> | ||||
| <user username="{{ ui_manager_user }}" password="{{ ui_manager_pass }}" roles="manager-gui" /> | ||||
|  | ||||
| <!-- user admin can access manager and admin section both --> | ||||
| <role rolename="admin-gui" /> | ||||
| <user username="{{ ui_admin_username }}" password="{{ ui_admin_pass }}" roles="manager-gui,admin-gui" /> | ||||
| </tomcat-users> | ||||
| @@ -0,0 +1,22 @@ | ||||
| [Unit] | ||||
| Description=Tomcat | ||||
| After=syslog.target network.target | ||||
|  | ||||
| [Service] | ||||
| Type=forking | ||||
|  | ||||
| User=tomcat | ||||
| Group=tomcat | ||||
|  | ||||
| Environment=JAVA_HOME={{ JAVA_HOME }} | ||||
| Environment='JAVA_OPTS=-Djava.awt.headless=true' | ||||
|  | ||||
| Environment=CATALINA_HOME=/usr/share/tomcat/apache-tomcat-10.0.13 | ||||
| Environment=CATALINA_BASE=/usr/share/tomcat/apache-tomcat-10.0.13 | ||||
| Environment=CATALINA_PID=/usr/share/tomcat/apache-tomcat-10.0.13/temp/tomcat.pid | ||||
|  | ||||
| ExecStart=catalina.sh start | ||||
| ExecStop=catalina.sh stop | ||||
|  | ||||
| [Install] | ||||
| WantedBy=multi-user.target | ||||
							
								
								
									
										2
									
								
								ap34/SDIS29-P2/ppe34test/roles/ppebase/vars/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								ap34/SDIS29-P2/ppe34test/roles/ppebase/vars/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| --- | ||||
| JAVA_HOME: /usr/lib/jvm/default-java | ||||
							
								
								
									
										4
									
								
								ap34/SDIS29-P2/ppe34test/roles/ppedb/handlers/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								ap34/SDIS29-P2/ppe34test/roles/ppedb/handlers/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| - name: Restart MySQL | ||||
|   service: | ||||
|     name: mysqld | ||||
|     state: restarted | ||||
							
								
								
									
										31
									
								
								ap34/SDIS29-P2/ppe34test/roles/ppedb/tasks/main.yml
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										31
									
								
								ap34/SDIS29-P2/ppe34test/roles/ppedb/tasks/main.yml
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,31 @@ | ||||
| - name: on lance MariaDB | ||||
|   service: | ||||
|     name: mysql | ||||
|     state: started | ||||
|  | ||||
| - name: creation de la BDD sdis29 | ||||
|   mysql_db: | ||||
|     login_unix_socket: /var/run/mysqld/mysqld.sock | ||||
|     name: sdis29 | ||||
|        | ||||
| - name: creation de l'utilisateur slam | ||||
|   mysql_user: | ||||
|     name: slam | ||||
|     password: Azerty1+ | ||||
|     priv: '*.*:ALL,GRANT' | ||||
|     state: present | ||||
|     login_unix_socket: /var/run/mysqld/mysqld.sock | ||||
|  | ||||
|       #- name: injection de la BDD | ||||
|       #command: scp sio@10.121.38.95:/home/sio/bdd/sdis29.sql /tmp | ||||
|  | ||||
| - name: restauration de la bdd | ||||
|   mysql_db: | ||||
|     login_unix_socket: /var/run/mysqld/mysqld.sock | ||||
|     name: sdis29 | ||||
|     state: import | ||||
|     target: /tmp/sdis29.sql | ||||
|     login_user: slam | ||||
|     login_password: Azerty1+ | ||||
|   notify: Restart MySQL | ||||
|  | ||||
| @@ -0,0 +1,5 @@ | ||||
| - name: Copie de la sauv distante | ||||
|   ansible.builtin.fetch: | ||||
|     src: /tmp/sdis29.sql | ||||
|     dest: /sauvegarde | ||||
|     flat: yes | ||||
| @@ -0,0 +1,15 @@ | ||||
| - name: creer une sauvegarde | ||||
|   mysql_db: | ||||
|     name: sdis29 | ||||
|     state: dump | ||||
|     target: /tmp/sdis29.sql | ||||
|     login_host: localhost | ||||
|     login_user: slam | ||||
|     login_password: Azerty1+ | ||||
|     login_unix_user: /var/run/mysqld/mysqld.sock | ||||
|  | ||||
| - name: Copie de la sauv distante | ||||
|   ansible.builtin.fetch: | ||||
|     src: /tmp/sdis29.sql | ||||
|     dest: /root/sauvegarde/sql/ | ||||
|     flat: yes | ||||
		Reference in New Issue
	
	Block a user