1.0
This commit is contained in:
10
ansible/inventory/inventory.ini
Normal file
10
ansible/inventory/inventory.ini
Normal file
@@ -0,0 +1,10 @@
|
||||
[web-serveur]
|
||||
|
||||
web ansible_host="192.168.1.119"
|
||||
|
||||
[git-serveur]
|
||||
git ansible_host='192.168.1.119'
|
||||
|
||||
[docker-serveur]
|
||||
|
||||
docker ansible_host='192.168.1.119'
|
||||
27
ansible/modules/firewall/nftables.conf
Normal file
27
ansible/modules/firewall/nftables.conf
Normal file
@@ -0,0 +1,27 @@
|
||||
table inet filter {
|
||||
chain input {
|
||||
type filter hook input priority 0; policy drop;
|
||||
|
||||
iif "lo" accept
|
||||
iif "eth0"
|
||||
|
||||
ct state established,related accept
|
||||
|
||||
tcp dport 22 accept
|
||||
|
||||
tcp dport 8000 accept
|
||||
icmp type echo-request accept
|
||||
icmpv6 type echo-request accept
|
||||
|
||||
|
||||
}
|
||||
|
||||
chain forward {
|
||||
type filter hook forward priority 0; policy drop;
|
||||
masquerade
|
||||
}
|
||||
|
||||
chain output {
|
||||
type filter hook output priority 0; policy accept;
|
||||
}
|
||||
}
|
||||
BIN
ansible/modules/web/html/assets/IMG_1916(1).JPG
Normal file
BIN
ansible/modules/web/html/assets/IMG_1916(1).JPG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 170 KiB |
BIN
ansible/modules/web/html/assets/images.jpeg
Normal file
BIN
ansible/modules/web/html/assets/images.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.7 KiB |
81
ansible/modules/web/html/index.html
Normal file
81
ansible/modules/web/html/index.html
Normal file
@@ -0,0 +1,81 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Comparaison - Bébé Guépard</title>
|
||||
<style>
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
body { font-family: sans-serif; background: #f5f4f0; min-height: 100vh; display: flex; align-items: center; justify-content: center; }
|
||||
.container { padding: 2rem 1rem; max-width: 800px; width: 100%; }
|
||||
h1 { font-size: 24px; font-weight: 500; text-align: center; margin-bottom: 0.4rem; color: #111; }
|
||||
.subtitle { font-size: 14px; color: #888; text-align: center; margin-bottom: 2rem; }
|
||||
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
|
||||
.card { background: #fff; border: 1px solid #e0ddd5; border-radius: 12px; overflow: hidden; }
|
||||
.img-zone { width: 100%; aspect-ratio: 1/1; background: #f0ede6; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; position: relative; overflow: hidden; }
|
||||
.img-zone img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; display: none; }
|
||||
.placeholder { display: flex; flex-direction: column; align-items: center; gap: 8px; }
|
||||
.placeholder svg { opacity: 0.3; }
|
||||
.placeholder span { font-size: 13px; color: #999; }
|
||||
.card-label { padding: 12px 16px; border-top: 1px solid #e0ddd5; font-size: 14px; font-weight: 500; color: #333; text-align: center; }
|
||||
input[type=file] { display: none; }
|
||||
@media (max-width: 500px) { .grid { grid-template-columns: 1fr; } }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Tie un bebe guépard Bébé</h1>
|
||||
<!--<p class="subtitle">Clique sur une zone pour uploader ta photo</p>-->
|
||||
|
||||
<div class="grid">
|
||||
<div class="card">
|
||||
<div class="img-zone" onclick="document.getElementById('input1').click()">
|
||||
<div class="placeholder" id="ph1">
|
||||
<svg width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="#aaa" stroke-width="1.5">
|
||||
<circle cx="12" cy="8" r="3"/><path d="M3 21c0-4 4-7 9-7s9 3 9 7"/>
|
||||
</svg>
|
||||
<span>Bébé guépard</span>
|
||||
</div>
|
||||
<img id="img1" src="assets/images.jpeg" style="display: block;">
|
||||
</div>
|
||||
<div class="card-label">Bébé guépard</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="img-zone" onclick="document.getElementById('input2').click()">
|
||||
<div class="placeholder" id="ph2">
|
||||
<svg width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="#aaa" stroke-width="1.5">
|
||||
<circle cx="12" cy="8" r="3"/><path d="M3 21c0-4 4-7 9-7s9 3 9 7"/>
|
||||
</svg>
|
||||
<span>Toi</span>
|
||||
</div>
|
||||
<img id="img2" src="assets/IMG_1916(1).JPG" style="display: block;">
|
||||
</div>
|
||||
<div class="card-label">Toi</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="file" id="input1" accept="image/*">
|
||||
<input type="file" id="input2" accept="image/*">
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function setup(inputId, imgId, phId) {
|
||||
document.getElementById(inputId).addEventListener('change', function(e) {
|
||||
const file = e.target.files[0];
|
||||
if (!file) return;
|
||||
const reader = new FileReader();
|
||||
reader.onload = function(ev) {
|
||||
const img = document.getElementById(imgId);
|
||||
img.src = ev.target.result;
|
||||
img.style.display = 'block';
|
||||
document.getElementById(phId).style.display = 'none';
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
});
|
||||
}
|
||||
setup('input1', 'img1', 'ph1');
|
||||
setup('input2', 'img2', 'ph2');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
6
ansible/modules/web/web.conf
Normal file
6
ansible/modules/web/web.conf
Normal file
@@ -0,0 +1,6 @@
|
||||
<VirtualHost *:8000>
|
||||
ServerAdmin webmaster@localhost
|
||||
DocumentRoot /var/www/web
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||
</VirtualHost>
|
||||
53
ansible/playbook/Setup_apache2.yml
Normal file
53
ansible/playbook/Setup_apache2.yml
Normal file
@@ -0,0 +1,53 @@
|
||||
---
|
||||
- name: Déploiement de apache2
|
||||
hosts: web
|
||||
become: yes
|
||||
|
||||
tasks:
|
||||
- name: Installation de Apache2
|
||||
apt:
|
||||
name: apache2
|
||||
state: present
|
||||
|
||||
- name: Copier la configuration du VirtualHost (web.conf)
|
||||
copy:
|
||||
src: ../modules/web/web.conf
|
||||
dest: /etc/apache2/sites-available/web.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
|
||||
- name: Configurer le port d'écoute dans ports.conf
|
||||
lineinfile:
|
||||
path: /etc/apache2/ports.conf
|
||||
insertafter: '^Listen 80'
|
||||
line: 'Listen 8000'
|
||||
notify: reload apache2
|
||||
|
||||
- name: Créer le dossier Web dans /var/www
|
||||
file:
|
||||
path: /var/www/web
|
||||
state: directory
|
||||
mode: '0755'
|
||||
owner: www-data
|
||||
group: www-data
|
||||
|
||||
- name: Copie des dossiers Web
|
||||
copy:
|
||||
src: ../modules/web/html/
|
||||
dest: /var/www/web/
|
||||
owner: www-data
|
||||
group: www-data
|
||||
mode: '0755'
|
||||
|
||||
- name: Activation du site web
|
||||
command: a2ensite web.conf
|
||||
args:
|
||||
creates: /etc/apache2/sites-enabled/web.conf
|
||||
notify: reload apache2
|
||||
|
||||
handlers:
|
||||
- name: reload apache2
|
||||
service:
|
||||
name: apache2
|
||||
state: reloaded
|
||||
21
ansible/playbook/setup_auto_wordpress.yml
Normal file
21
ansible/playbook/setup_auto_wordpress.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
|
||||
- name: Clonage des scripts installations wordpress
|
||||
hosts: wordpress_installation
|
||||
become: yes
|
||||
|
||||
tasks:
|
||||
- name: Clonage
|
||||
command: git clone https://xmdrk.xyz/maxime/scripts_installation_wordpress
|
||||
args:
|
||||
create scripts_installations_wordpress
|
||||
notify: Git cloné
|
||||
|
||||
#- name: Lancement des scripts
|
||||
# command: bash
|
||||
|
||||
handlers:
|
||||
- name: Git cloné
|
||||
command : bash scripts_installations_wordpress/gen_mariadb.sh
|
||||
|
||||
|
||||
66
ansible/playbook/setup_docker.yml
Normal file
66
ansible/playbook/setup_docker.yml
Normal file
@@ -0,0 +1,66 @@
|
||||
---
|
||||
- name: Installation complète de Docker Engine
|
||||
hosts: docker
|
||||
become: yes
|
||||
vars:
|
||||
docker_user: "maxime"
|
||||
|
||||
tasks:
|
||||
- name: Installation des dépendances système
|
||||
apt:
|
||||
name:
|
||||
- ca-certificates
|
||||
- curl
|
||||
- gnupg
|
||||
state: present
|
||||
update_cache: yes
|
||||
|
||||
- name: Création du dossier pour la clé GPG de Docker
|
||||
file:
|
||||
path: /etc/apt/keyrings
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: Téléchargement de la clé GPG officielle de Docker (via curl)
|
||||
shell: |
|
||||
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
|
||||
args:
|
||||
creates: /etc/apt/keyrings/docker.asc
|
||||
|
||||
- name: Ajout du dépôt Docker dans les sources APT
|
||||
apt_repository:
|
||||
repo: >
|
||||
deb [arch={{ ansible_architecture | replace('x86_64', 'amd64') }} signed-by=/etc/apt/keyrings/docker.asc]
|
||||
https://download.docker.com/linux/debian
|
||||
{{ ansible_distribution_release }} stable
|
||||
state: present
|
||||
filename: docker
|
||||
|
||||
- name: Installation de Docker et ses composants
|
||||
apt:
|
||||
name:
|
||||
- docker-ce
|
||||
- docker-ce-cli
|
||||
- containerd.io
|
||||
- docker-buildx-plugin
|
||||
- docker-compose-plugin
|
||||
state: present
|
||||
update_cache: yes
|
||||
|
||||
- name: S'assurer que le service Docker est démarré
|
||||
service:
|
||||
name: docker
|
||||
state: started
|
||||
enabled: yes
|
||||
|
||||
- name: Ajout de l'utilisateur au groupe 'docker'
|
||||
user:
|
||||
name: "{{ docker_user }}"
|
||||
groups: docker
|
||||
append: yes
|
||||
notify: "Message de fin"
|
||||
|
||||
handlers:
|
||||
- name: "Message de fin"
|
||||
debug:
|
||||
msg: "Docker est installé ||| déconnecter/reconnecter pour utiliser docker sans sudo."
|
||||
23
ansible/playbook/setup_git.yml
Normal file
23
ansible/playbook/setup_git.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
- name: Setup git
|
||||
hosts: git
|
||||
become: yes
|
||||
|
||||
tasks:
|
||||
- name: Installation de git
|
||||
apt:
|
||||
name: git
|
||||
state: present
|
||||
|
||||
- name: Clonage git Logan monitoring
|
||||
become: yes
|
||||
become_user: maxime
|
||||
command: git clone https://xmdrk.xyz/maxime/loustique-home.git /home/maxime/loustique-home
|
||||
args:
|
||||
creates: /home/maxime/loustique-home
|
||||
notify: "Confirmation clone"
|
||||
|
||||
handlers:
|
||||
- name: "Confirmation clone"
|
||||
debug:
|
||||
msg: "Le dépôt a été cloné avec succès dans /home/maxime/loustique-home"
|
||||
9
ansible/playbook/sites.yml
Normal file
9
ansible/playbook/sites.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
|
||||
|
||||
- name: Lancement Setup_apache2
|
||||
import_playbook: Setup_apache2.yml
|
||||
- name: Lancement docker
|
||||
import_playbook: setup_docker.yml
|
||||
- name: Clonage git
|
||||
import_playbook: setup_git.yml
|
||||
Reference in New Issue
Block a user