diff --git a/TP3/ansible/files/httpd.conf b/TP3/ansible/files/httpd.conf
new file mode 100644
index 0000000000000000000000000000000000000000..a0fb3683e2999bc1742fa0cb6ad9317906c8ccc6
--- /dev/null
+++ b/TP3/ansible/files/httpd.conf
@@ -0,0 +1,14 @@
+<VirtualHost *:{{ http_port }}>
+ ServerAdmin webmaster@localhost
+ ServerName {{ http_host }}
+ ServerAlias www.{{ http_host }}
+ DocumentRoot /var/www/{{ http_host }}/wordpress
+ ErrorLog /var/log/httpd/error.log
+ CustomLog /var/log/httpd/access.log combined
+
+ <Directory /var/www/{{ http_host }}/wordpress>
+ Options Indexes FollowSymLinks
+ AllowOverride all
+ Require all granted
+ </Directory>
+</VirtualHost>
\ No newline at end of file
diff --git a/TP3/ansible/inventory.txt b/TP3/ansible/inventory.txt
new file mode 100644
index 0000000000000000000000000000000000000000..001e366d0c1711011e98d0ab1368916b828a3d07
--- /dev/null
+++ b/TP3/ansible/inventory.txt
@@ -0,0 +1,2 @@
+target1
+ansible_host=127.0.0.1
diff --git a/TP3/ansible/playbook.yml b/TP3/ansible/playbook.yml
new file mode 100644
index 0000000000000000000000000000000000000000..3c9fcd2d7dee4341a0712c1fff98c61bb121a7a2
--- /dev/null
+++ b/TP3/ansible/playbook.yml
@@ -0,0 +1,11 @@
+- hosts: target1
+ gather_facts: False
+ become: true
+ vars_files:
+ - vars/default.yml
+ roles:
+ - apache
+ - php
+ - mysql
+ - wordpress
+ - firewall
\ No newline at end of file
diff --git a/TP3/ansible/roles/apache/tasks/main.yml b/TP3/ansible/roles/apache/tasks/main.yml
new file mode 100644
index 0000000000000000000000000000000000000000..b65179b2dffd5c61d634e58b8a3ef4f5ebb36812
--- /dev/null
+++ b/TP3/ansible/roles/apache/tasks/main.yml
@@ -0,0 +1,21 @@
+- name: Install HTTP Packages
+ yum: name=httpd update_cache=yes state=latest
+
+- name: Start httpd service
+ systemd: name=httpd state=started enabled=yes
+
+- name: Create Apache Document Root
+ file:
+ path: "/var/www/{{ http_host }}"
+ state: directory
+ owner: "apache"
+ group: "apache"
+ mode: '0755'
+
+- name: Set up Apache VirtualHost
+ template:
+ src: "files/httpd.conf"
+ dest: "/etc/httpd/conf.d/{{ http_conf }}"
+ owner: root
+ group: root
+ mode: u=rw,g=r,o=r
\ No newline at end of file
diff --git a/TP3/ansible/roles/firewall/tasks/main.yml b/TP3/ansible/roles/firewall/tasks/main.yml
new file mode 100644
index 0000000000000000000000000000000000000000..40d15b9afd527f47f4e3bb53c5b8f1277ed5b4af
--- /dev/null
+++ b/TP3/ansible/roles/firewall/tasks/main.yml
@@ -0,0 +1,12 @@
+# Firewall Configuration
+ - name: Disable SELinux Permanently (Reboot Required)
+ selinux: state=disabled
+
+ - name: Disable SELinux Without Reboot
+ command: /sbin/setenforce 0
+
+ - name: Configure Firewall
+ firewalld: zone=public service=http permanent=yes state=enabled
+
+ - name: Reload Firewall
+ systemd: name=firewalld state=reloaded
\ No newline at end of file
diff --git a/TP3/ansible/roles/mysql/tasks/main.yml b/TP3/ansible/roles/mysql/tasks/main.yml
new file mode 100644
index 0000000000000000000000000000000000000000..508d2be1ad4ad46c02618fe905825b5dddebefaa
--- /dev/null
+++ b/TP3/ansible/roles/mysql/tasks/main.yml
@@ -0,0 +1,32 @@
+# MySQL Configuration
+ - name: Install MySQL Packages
+ yum: name={{ item }} update_cache=yes state=latest
+ loop: [ 'mysql-server', 'php-mysqlnd', 'python3-PyMySQL' ]
+
+ - name: Start mysqld service
+ systemd: name=mysqld state=started enabled=yes
+
+ - name: Set MySQL root Password
+ mysql_user:
+ login_host: 'localhost'
+ login_user: 'root'
+ login_password: ''
+ name: 'root'
+ password: '{{ mysql_root_password }}'
+ state: present
+
+ - name: Creates database for WordPress
+ mysql_db:
+ name: "{{ mysql_db }}"
+ state: present
+ login_user: root
+ login_password: "{{ mysql_root_password }}"
+
+ - name: Create MySQL user for WordPress
+ mysql_user:
+ name: "{{ mysql_user }}"
+ password: "{{ mysql_password }}"
+ priv: "{{ mysql_db }}.*:ALL"
+ state: present
+ login_user: root
+ login_password: "{{ mysql_root_password }}"
\ No newline at end of file
diff --git a/TP3/ansible/roles/php/tasks/main.yml b/TP3/ansible/roles/php/tasks/main.yml
new file mode 100644
index 0000000000000000000000000000000000000000..b23112aa12fc6166d764ad507bc6d5e5b11e810b
--- /dev/null
+++ b/TP3/ansible/roles/php/tasks/main.yml
@@ -0,0 +1,10 @@
+- name: Install PHP Remi Repository
+ yum: name=http://rpms.remirepo.net/enterprise/remi-release-8.rpm update_cache=yes state=latest
+
+- name: Enable PHP Remi Repository
+ command: dnf module reset php -y
+ command: dnf module enable php:remi-7.4 -y
+
+- name: Install PHP Extensions
+ yum: name={{ item }} update_cache=yes state=latest
+ loop: "{{ php_modules }}"
\ No newline at end of file
diff --git a/TP3/ansible/roles/wordpress/tasks/main.yml b/TP3/ansible/roles/wordpress/tasks/main.yml
new file mode 100644
index 0000000000000000000000000000000000000000..87f6acc084fdfee7d4f19fb77e14346c0874399e
--- /dev/null
+++ b/TP3/ansible/roles/wordpress/tasks/main.yml
@@ -0,0 +1,40 @@
+# WordPress Configuration
+
+ - name: Download and unpack latest WordPress
+ unarchive:
+ src: https://wordpress.org/latest.tar.gz
+ dest: "/var/www/{{ http_host }}"
+ remote_src: yes
+ creates: "/var/www/{{ http_host }}/wordpress"
+
+ - name: Set ownership
+ file:
+ path: "/var/www/{{ http_host }}"
+ state: directory
+ recurse: yes
+ owner: apache
+ group: apache
+
+ - name: Set permissions for directories
+ shell: "/usr/bin/find /var/www/{{ http_host }}/wordpress/ -type d -exec chmod 750 {} \\;"
+
+ - name: Set permissions for files
+ shell: "/usr/bin/find /var/www/{{ http_host }}/wordpress/ -type f -exec chmod 640 {} \\;"
+
+ - name: Copy sample config file
+ command: mv /var/www/{{ http_host }}/wordpress/wp-config-sample.php /var/www/{{ http_host }}/wordpress/wp-config.php creates=/var/www/{{ http_host }}/wordpress/wp-config.php
+ become: yes
+
+ - name: Update WordPress config file
+ lineinfile:
+ path: "/var/www/{{ http_host }}/wordpress/wp-config.php"
+ regexp: "{{item.regexp}}"
+ line: "{{item.line}}"
+ with_items:
+ - {'regexp': "define\\( 'DB_NAME', '(.)+' \\);", 'line': "define( 'DB_NAME', '{{mysql_db}}' );"}
+ - {'regexp': "define\\( 'DB_USER', '(.)+' \\);", 'line': "define( 'DB_USER', '{{mysql_user}}' );"}
+ - {'regexp': "define\\( 'DB_PASSWORD', '(.)+' \\);", 'line': "define( 'DB_PASSWORD', '{{mysql_password}}' );"}
+
+ - name: Restart httpd service
+ systemd: name=httpd state=restarted
+ become: yes
\ No newline at end of file
diff --git a/TP3/ansible/vars/default.yml b/TP3/ansible/vars/default.yml
new file mode 100644
index 0000000000000000000000000000000000000000..2ad25609f3988d600fa9a620827228cd3a305c01
--- /dev/null
+++ b/TP3/ansible/vars/default.yml
@@ -0,0 +1,13 @@
+#PHP Settings
+php_modules: [ 'php', 'php-curl', 'php-gd', 'php-mbstring', 'php-xml', 'php-xmlrpc', 'php-soap', 'php-intl', 'php-zip' ]
+
+#MySQL Settings
+mysql_root_password: "somewordpress"
+mysql_db: "wordpress"
+mysql_user: "wordpress"
+mysql_password: "wordpress"
+
+#HTTP Settings
+http_host: "wp.example.com"
+http_conf: "wp.example.com.conf"
+http_port: "80"
\ No newline at end of file
diff --git a/TP3/docker_compose/docker-compose.yml b/TP3/docker_compose/docker-compose.yml
new file mode 100644
index 0000000000000000000000000000000000000000..f67dc721d6fdd795c7347c93819b2e7555be086f
--- /dev/null
+++ b/TP3/docker_compose/docker-compose.yml
@@ -0,0 +1,31 @@
+version: "3.9"
+
+services:
+ db:
+ image: mysql:5.7
+ volumes:
+ - db_data:/var/lib/mysql
+ restart: always
+ environment:
+ MYSQL_ROOT_PASSWORD: somewordpress
+ MYSQL_DATABASE: wordpress
+ MYSQL_USER: wordpress
+ MYSQL_PASSWORD: wordpress
+
+ wordpress:
+ depends_on:
+ - db
+ image: wordpress:latest
+ volumes:
+ - wordpress_data:/var/www/html
+ ports:
+ - "8000:80"
+ restart: always
+ environment:
+ WORDPRESS_DB_HOST: db
+ WORDPRESS_DB_USER: wordpress
+ WORDPRESS_DB_PASSWORD: wordpress
+ WORDPRESS_DB_NAME: wordpress
+volumes:
+ db_data: {}
+ wordpress_data: {}