From 23ddc9a40d9bdf201481166de3b76f681f8ed800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Ccameron=2Edesrayaud=E2=80=9D?= Date: Wed, 15 Dec 2021 11:40:10 +0100 Subject: [PATCH] Fichier Mission2 --- Mission2/ansible/playbook.yml | 13 ----------- .../ansible/{tomcat-setup.yml => ppebase.yml} | 5 ++-- .../ansible/{mysql-setup.yml => ppedb.yml} | 2 +- .../ansible/{mysql-dump.yml => ppedump.yml} | 0 .../defaults/main.yml | 0 .../handlers/main.yml | 0 .../tasks/main.yaml | 2 +- .../tasks/tomcat-mariadb-install.yml} | 23 +++++++++++++++++-- .../templates/context.xml.j2 | 0 .../templates/tomcat-users.xml.j2 | 0 .../templates/tomcat.service.j2 | 0 .../vars/Debian.yml | 0 Mission2/ansible/roles/mysql/tasks/main.yml | 20 ---------------- .../roles/mysql_inject/handlers/main.yml | 0 .../ansible/roles/mysql_inject/tasks/main.yml | 14 ----------- 15 files changed, 25 insertions(+), 54 deletions(-) delete mode 100644 Mission2/ansible/playbook.yml rename Mission2/ansible/{tomcat-setup.yml => ppebase.yml} (75%) rename Mission2/ansible/{mysql-setup.yml => ppedb.yml} (60%) rename Mission2/ansible/{mysql-dump.yml => ppedump.yml} (100%) rename Mission2/ansible/roles/{tomcat => InstallTomcatMariaDB}/defaults/main.yml (100%) rename Mission2/ansible/roles/{tomcat => InstallTomcatMariaDB}/handlers/main.yml (100%) rename Mission2/ansible/roles/{tomcat => InstallTomcatMariaDB}/tasks/main.yaml (77%) rename Mission2/ansible/roles/{tomcat/tasks/tomcat-setup-Debian.yml => InstallTomcatMariaDB/tasks/tomcat-mariadb-install.yml} (84%) rename Mission2/ansible/roles/{tomcat => InstallTomcatMariaDB}/templates/context.xml.j2 (100%) rename Mission2/ansible/roles/{tomcat => InstallTomcatMariaDB}/templates/tomcat-users.xml.j2 (100%) rename Mission2/ansible/roles/{tomcat => InstallTomcatMariaDB}/templates/tomcat.service.j2 (100%) rename Mission2/ansible/roles/{tomcat => InstallTomcatMariaDB}/vars/Debian.yml (100%) delete mode 100644 Mission2/ansible/roles/mysql_inject/handlers/main.yml delete mode 100644 Mission2/ansible/roles/mysql_inject/tasks/main.yml diff --git a/Mission2/ansible/playbook.yml b/Mission2/ansible/playbook.yml deleted file mode 100644 index fa32652..0000000 --- a/Mission2/ansible/playbook.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -- hosts: test - remote_user: root - become: yes - become_method: sudo - - roles: - - tomcat - - mariadb - - mariadb_create_dump - - mariadb_create_usr - - mariadb_inject_dump - - openjdk diff --git a/Mission2/ansible/tomcat-setup.yml b/Mission2/ansible/ppebase.yml similarity index 75% rename from Mission2/ansible/tomcat-setup.yml rename to Mission2/ansible/ppebase.yml index cccb4da..8f7920a 100644 --- a/Mission2/ansible/tomcat-setup.yml +++ b/Mission2/ansible/ppebase.yml @@ -1,5 +1,5 @@ --- -- name: Tomcat playbook +- name: Tomcat & MariaDB installation playbook hosts: test become: yes become_method: sudo @@ -11,5 +11,4 @@ ui_admin_username: admin ui_admin_pass: root roles: - - tomcat - + - InstallTomcatMariaDB diff --git a/Mission2/ansible/mysql-setup.yml b/Mission2/ansible/ppedb.yml similarity index 60% rename from Mission2/ansible/mysql-setup.yml rename to Mission2/ansible/ppedb.yml index eb1b22a..832ce66 100644 --- a/Mission2/ansible/mysql-setup.yml +++ b/Mission2/ansible/ppedb.yml @@ -1,5 +1,5 @@ --- -- name: MariaDB playbook +- name: MariaDB création de compte et injection BDD playbook hosts: test become: yes become_method: sudo diff --git a/Mission2/ansible/mysql-dump.yml b/Mission2/ansible/ppedump.yml similarity index 100% rename from Mission2/ansible/mysql-dump.yml rename to Mission2/ansible/ppedump.yml diff --git a/Mission2/ansible/roles/tomcat/defaults/main.yml b/Mission2/ansible/roles/InstallTomcatMariaDB/defaults/main.yml similarity index 100% rename from Mission2/ansible/roles/tomcat/defaults/main.yml rename to Mission2/ansible/roles/InstallTomcatMariaDB/defaults/main.yml diff --git a/Mission2/ansible/roles/tomcat/handlers/main.yml b/Mission2/ansible/roles/InstallTomcatMariaDB/handlers/main.yml similarity index 100% rename from Mission2/ansible/roles/tomcat/handlers/main.yml rename to Mission2/ansible/roles/InstallTomcatMariaDB/handlers/main.yml diff --git a/Mission2/ansible/roles/tomcat/tasks/main.yaml b/Mission2/ansible/roles/InstallTomcatMariaDB/tasks/main.yaml similarity index 77% rename from Mission2/ansible/roles/tomcat/tasks/main.yaml rename to Mission2/ansible/roles/InstallTomcatMariaDB/tasks/main.yaml index 9ba17ed..bc27af1 100644 --- a/Mission2/ansible/roles/tomcat/tasks/main.yaml +++ b/Mission2/ansible/roles/InstallTomcatMariaDB/tasks/main.yaml @@ -5,4 +5,4 @@ - "{{ ansible_distribution }}{{ ansible_distribution_major_version }}.yml" - "{{ ansible_os_family }}.yml" -- include_tasks: "tomcat-setup-{{ ansible_os_family }}.yml" +- include_tasks: "tomcat-mariadb-install.yml" diff --git a/Mission2/ansible/roles/tomcat/tasks/tomcat-setup-Debian.yml b/Mission2/ansible/roles/InstallTomcatMariaDB/tasks/tomcat-mariadb-install.yml similarity index 84% rename from Mission2/ansible/roles/tomcat/tasks/tomcat-setup-Debian.yml rename to Mission2/ansible/roles/InstallTomcatMariaDB/tasks/tomcat-mariadb-install.yml index 1bf92f2..3333dbf 100644 --- a/Mission2/ansible/roles/tomcat/tasks/tomcat-setup-Debian.yml +++ b/Mission2/ansible/roles/InstallTomcatMariaDB/tasks/tomcat-mariadb-install.yml @@ -55,13 +55,13 @@ extra_opts: "--strip-components=1" creates: /usr/share/tomcat/bin -- name: Copie tomcat fichier service* +- 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 +- name: Démarrer et activer tomcat service: daemon_reload: yes name: tomcat @@ -83,3 +83,22 @@ - /usr/share/tomcat/webapps/manager/META-INF/context.xml notify: restart tomcat +- name: "MYSQL - update cache" + apt: + update_cache: yes + +- name: "MYSQL - installation" + apt: + name: mariadb-server + state: latest + +- name: "PYTHON3 - installation" + apt: + name: python3-pymysql + state: latest + +- name: "MYSQL - démarrage de mysql" + service: + name: "mysqld" + state: started + enabled: yes diff --git a/Mission2/ansible/roles/tomcat/templates/context.xml.j2 b/Mission2/ansible/roles/InstallTomcatMariaDB/templates/context.xml.j2 similarity index 100% rename from Mission2/ansible/roles/tomcat/templates/context.xml.j2 rename to Mission2/ansible/roles/InstallTomcatMariaDB/templates/context.xml.j2 diff --git a/Mission2/ansible/roles/tomcat/templates/tomcat-users.xml.j2 b/Mission2/ansible/roles/InstallTomcatMariaDB/templates/tomcat-users.xml.j2 similarity index 100% rename from Mission2/ansible/roles/tomcat/templates/tomcat-users.xml.j2 rename to Mission2/ansible/roles/InstallTomcatMariaDB/templates/tomcat-users.xml.j2 diff --git a/Mission2/ansible/roles/tomcat/templates/tomcat.service.j2 b/Mission2/ansible/roles/InstallTomcatMariaDB/templates/tomcat.service.j2 similarity index 100% rename from Mission2/ansible/roles/tomcat/templates/tomcat.service.j2 rename to Mission2/ansible/roles/InstallTomcatMariaDB/templates/tomcat.service.j2 diff --git a/Mission2/ansible/roles/tomcat/vars/Debian.yml b/Mission2/ansible/roles/InstallTomcatMariaDB/vars/Debian.yml similarity index 100% rename from Mission2/ansible/roles/tomcat/vars/Debian.yml rename to Mission2/ansible/roles/InstallTomcatMariaDB/vars/Debian.yml diff --git a/Mission2/ansible/roles/mysql/tasks/main.yml b/Mission2/ansible/roles/mysql/tasks/main.yml index 95e30b5..2c55393 100644 --- a/Mission2/ansible/roles/mysql/tasks/main.yml +++ b/Mission2/ansible/roles/mysql/tasks/main.yml @@ -1,24 +1,4 @@ --- -- name: "MYSQL - update cache" - apt: - update_cache: yes - -- name: "MYSQL - installation" - apt: - name: mariadb-server - state: latest - -- name: "PYTHON3 - installation" - apt: - name: python3-pymysql - state: latest - -- name: "MYSQL - démarrage de mysql" - service: - name: "mysqld" - state: started - enabled: yes - - name: "MYSQL - creation base de données" community.mysql.mysql_db: name: sdis29 diff --git a/Mission2/ansible/roles/mysql_inject/handlers/main.yml b/Mission2/ansible/roles/mysql_inject/handlers/main.yml deleted file mode 100644 index e69de29..0000000 diff --git a/Mission2/ansible/roles/mysql_inject/tasks/main.yml b/Mission2/ansible/roles/mysql_inject/tasks/main.yml deleted file mode 100644 index 4665e80..0000000 --- a/Mission2/ansible/roles/mysql_inject/tasks/main.yml +++ /dev/null @@ -1,14 +0,0 @@ -- name: copie de la base de donnée - copy: - src: sdis29.sql - dest: /tmp - -- name: Importation de la base de données - mysql_db: - name: sdis29 - state: import - target: /tmp/sdis29.sql - login_user: dev - login_password: Azerty1+ - login_unix_socket: /var/run/mysqld/mysqld.sock -