From 8a44865367d8e3599f895a00b8475184ccf499db Mon Sep 17 00:00:00 2001 From: uap33-2025-r Date: Thu, 14 Nov 2024 08:36:45 +0000 Subject: [PATCH] creation du playbook apdbdump.yml --- ansible/apbase.yml | 28 ++++++++++++++++++++++++++++ ansible/apdb.yml | 34 ++++++++++++++++++++++++++++++++++ ansible/apdbdump.yml | 18 ++++++++++++++++++ ansible/hosts | 2 ++ 4 files changed, 82 insertions(+) create mode 100644 ansible/apbase.yml create mode 100644 ansible/apdb.yml create mode 100644 ansible/apdbdump.yml create mode 100644 ansible/hosts diff --git a/ansible/apbase.yml b/ansible/apbase.yml new file mode 100644 index 0000000..2b33496 --- /dev/null +++ b/ansible/apbase.yml @@ -0,0 +1,28 @@ +--- +- hosts: all + become: yes + tasks: + - name: changement de la timezone + timezone: + name: Europe/Paris + + + - name: configure le fichier apt.conf pour le proxy + copy: + content: | + Acquire::http::Proxy "http://10.121.38.1:8080"; + Acquire::https::Proxy "http://10.121.38.1:8080"; + dest: /etc/apt/apt.conf + + - name: installation des paquets de tomcat10, ant et mariadb-server + apt: + name: + - tomcat10 + - ant + - mariadb-server + state: present + + - name: installation de qemu-guest-agent + apt: + name: qemu-guest-agent + state: present diff --git a/ansible/apdb.yml b/ansible/apdb.yml new file mode 100644 index 0000000..a38b8ba --- /dev/null +++ b/ansible/apdb.yml @@ -0,0 +1,34 @@ +--- +- hosts: all + become: yes + tasks: + - name: installation de python3 + apt: + name: python3-pymysql + + - name: creation de la base de donnees "sdis29" + community.mysql.mysql_db: + name: sdis29 + state: present + login_unix_socket: /run/mysqld/mysqld.sock + + - name: Creation d'un utilisateur avec tous les privileges + community.mysql.mysql_user: + name: admin + password: password123* + priv: '*.*:ALL' + state: present + login_unix_socket: /run/mysqld/mysqld.sock + + - name: copie du dump mysql sur la machine pt + copy: + src: sdis29.sql + dest: /tmp + + - name: Import du fichier sdis29.sql sur la base de données sdis29 + community.mysql.mysql_db: + name: sdis29 + state: import + target: /tmp/sdis29.sql + force: true + login_unix_socket: /run/mysqld/mysqld.sock diff --git a/ansible/apdbdump.yml b/ansible/apdbdump.yml new file mode 100644 index 0000000..41cb5b1 --- /dev/null +++ b/ansible/apdbdump.yml @@ -0,0 +1,18 @@ +--- +- hosts: all + become: yes + tasks: + - name: export de la database sdis29 + community.mysql.mysql_db: + state: dump + name: sdis29 + target: /tmp/sdis29-dump.sql + login_unix_socket: /run/mysqld/mysqld.sock + + - name: recuperation du fichier de dump sur la machine locale + fetch: + src: /tmp/sdis29-dump.sql + dest: sdis29-dump.sql + flat: yes + + diff --git a/ansible/hosts b/ansible/hosts new file mode 100644 index 0000000..99bae8b --- /dev/null +++ b/ansible/hosts @@ -0,0 +1,2 @@ +[pt] +ap33-pt