diff --git a/Partie2/ansible/apbase.yml b/Partie2/ansible/apbase.yml new file mode 100644 index 0000000..b2212b3 --- /dev/null +++ b/Partie2/ansible/apbase.yml @@ -0,0 +1,18 @@ +--- +- name: install ap et bd + #hosts: ap31-prod, ap31-test + #hosts: ap31-prodt + hosts: all + # become_method: sudo + # remote_user: debian + become: yes + + tasks: + - name: install apache2, php, mariadb-server, python3-pymysql + ansible.builtin.apt: + name: + - apache2 + - php + - mariadb-server + - python3-pymysql + state: present diff --git a/Partie2/ansible/apdb.yml b/Partie2/ansible/apdb.yml new file mode 100644 index 0000000..1ce2e99 --- /dev/null +++ b/Partie2/ansible/apdb.yml @@ -0,0 +1,32 @@ +--- +- name: Creer la BDD, creer les comptes et injecter la BDD + hosts: all + become: true + + tasks: + - name: creation de la BDD sdis29-1 + community.mysql.mysql_db: + name: sdis29-1 + state: present + login_unix_socket: /var/run/mysqld/mysqld.sock + + - name: copie de la base de donnees + copy: + src: sdis2023.sql + dest: /tmp + + - name: restauration de la base de donnees + community.mysql.mysql_db: + name: sdis29-1 + state: import + target: /tmp/sdis2023.sql + force: true + login_unix_socket: /var/run/mysqld/mysqld.sock + + - name: creation de lutilisateur slam + community.mysql.mysql_user: + name: slam + password: Azerty1+ + priv: '*.*:ALL,GRANT' + state: present + login_unix_socket: /var/run/mysqld/mysqld.sock diff --git a/Partie2/ansible/apdbdump.yml b/Partie2/ansible/apdbdump.yml new file mode 100644 index 0000000..c78bea7 --- /dev/null +++ b/Partie2/ansible/apdbdump.yml @@ -0,0 +1,12 @@ +--- +- name: recuperer localement un dump de la BDD distante + hosts: all + become: true + + tasks: + - name: Copie du dump distant + ansible.builtin.fetch: + src: /tmp/sdis2023.sql + dest: /root/sauvegarde/sql/ + flat: true + diff --git a/Partie2/ansible/hosts b/Partie2/ansible/hosts new file mode 100644 index 0000000..a34b171 --- /dev/null +++ b/Partie2/ansible/hosts @@ -0,0 +1,2 @@ +ap31-prodt +