Grande réorganisation et renommage au niveau du Gitea, d'autres

modifications à venir.
This commit is contained in:
Guillaume Emorine
2024-11-14 15:22:34 +01:00
parent d0a6791cad
commit 745f7a8537
184 changed files with 441 additions and 3 deletions

View File

@@ -0,0 +1,2 @@
Fichier hosts utilisé pour ansible lors du TP de la séance 16.
Sont inclus les fichiers idempotents .yml d'ansible que j'ai fait, ainsi que le dossier avec tous les playbooks pour le DokuWiki.

View File

@@ -0,0 +1 @@
Dossier des playbooks DokuWiki.

View File

@@ -0,0 +1,6 @@
[adm]
infra
[web]
web1
web2

View File

@@ -0,0 +1,4 @@
- hosts: web
roles:
- web
- doku

View File

@@ -0,0 +1,51 @@
- name: 1. Récupération du tar.gz du DokuWiki
get_url:
url: http://depl/store/dokuwiki-stable.tgz
dest: /tmp
- name: 2. Extraction de l'archive
unarchive:
src: /tmp/dokuwiki-stable.tgz
dest: /var/www/html
remote_src: yes
- name: 3. Status des dossiers du Wiki
stat:
path: /var/www/html/dokuwiki-2024-02-06b
register: rept_stat
- name: 4. On renomme les dossiers
command: mv /var/www/html/dokuwiki-2024-02-06b /var/www/html/doku
when: rept_stat.stat.exists
- name: 5. Changement des droits sur la racine
file:
path: /var/www/html/doku
owner: root
group: root
- name: 6. Changement des droits sur le dossier data
file:
path: /var/www/html/doku/data
owner: www-data
group: www-data
recurse: true
- name: 7. Changement des droits sur le dossier conf
file:
path: /var/www/html/doku/conf
owner: www-data
group: www-data
recurse: true
- name: 8. Changement des droits sur le dossier lib
file:
path: /var/www/html/doku/lib
owner: www-data
group: www-data
recurse: true
- name: 9. Redémarre Apache2
service:
name: apache2
state: restarted

View File

@@ -0,0 +1,10 @@
- name: 1. Installe les paquets requis pour le DokuWiki
apt:
name: "{{ item }}"
state: present
with_items:
- apache2
- php
- php-mbstring
- php-gd
- php-xml

View File

@@ -0,0 +1 @@
1.5:958cb3af-259b-4658-a68d-c1857a1e413e

View File

@@ -0,0 +1 @@
{"name":"debian/bookworm64","version":"12.20240905.1","provider":"virtualbox","directory":"boxes/debian-VAGRANTSLASH-bookworm64/12.20240905.1/virtualbox"}

View File

@@ -0,0 +1 @@
958cb3af-259b-4658-a68d-c1857a1e413e

View File

@@ -0,0 +1 @@
f61390876b004055816245659fd5bd63

View File

@@ -0,0 +1,8 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAA
AAtzc2gtZWQyNTUxOQAAACCBZZKsafTtksM02cxu00M0JHuzu98jWAYjAE5g
5nYQewAAAJAH27ajB9u2owAAAAtzc2gtZWQyNTUxOQAAACCBZZKsafTtksM0
2cxu00M0JHuzu98jWAYjAE5g5nYQewAAAEC/FErqsFWPvvl2PPU4cwB4kJeI
uUI3/pDFA1jD8ia3I4Flkqxp9O2SwzTZzG7TQzQke7O73yNYBiMATmDmdhB7
AAAAB3ZhZ3JhbnQBAgMEBQY=
-----END OPENSSH PRIVATE KEY-----

View File

@@ -0,0 +1 @@
{"virtualbox":{"/vagrant":{"guestpath":"/vagrant","hostpath":"/home/guillaume.emorine/vagrant/testansible/dokuw","disabled":false,"__vagrantfile":true}}}

View File

@@ -0,0 +1 @@
/home/guillaume.emorine/vagrant/testansible/dokuw

View File

@@ -0,0 +1,3 @@
# Generated by Vagrant
default ansible_ssh_host=127.0.0.1 ansible_ssh_port=2202 ansible_ssh_user='vagrant' ansible_ssh_private_key_file='/home/guillaume.emorine/vagrant/testansible/dokuw/.vagrant/machines/default/virtualbox/private_key'

View File

@@ -0,0 +1,12 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1
# This file loads the proper rgloader/loader.rb file that comes packaged
# with Vagrant so that encoded files can properly run with Vagrant.
if ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"]
require File.expand_path(
"rgloader/loader", ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"])
else
raise "Encoded files can't be read outside of the Vagrant installer."
end

View File

@@ -0,0 +1 @@
Dossier qui contient les fichiers du test vagrantfile + ansible.

View File

@@ -0,0 +1,30 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# Every Vagrant development environment requires a box. You can search for
# boxes at https://vagrantcloud.com/search.
config.vm.box = "debian/bookworm64"
config.vm.box_check_update = true
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# NOTE: This will enable public access to the opened port
config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.network "forwarded_port", guest: 22, host: 2022
config.vm.provision "shell", inline: <<-SHELL
apt update && apt-get upgrade -y
SHELL
config.vm.provision "ansible" do |ansible|
ansible.playbook = "local.yml" # lance le playbook local.yml
end
end

View File

@@ -0,0 +1,6 @@
[adm]
infra
[web]
web1
web2

View File

@@ -0,0 +1,5 @@
- hosts: all
become: yes
roles:
- web
- doku

View File

@@ -0,0 +1,51 @@
- name: 1. Récupération du tar.gz du DokuWiki
get_url:
url: http://depl/store/dokuwiki-stable.tgz
dest: /tmp
- name: 2. Extraction de l'archive
unarchive:
src: /tmp/dokuwiki-stable.tgz
dest: /var/www/html
remote_src: yes
- name: 3. Status des dossiers du Wiki
stat:
path: /var/www/html/dokuwiki-2024-02-06b
register: rept_stat
- name: 4. On renomme les dossiers
command: mv /var/www/html/dokuwiki-2024-02-06b /var/www/html/doku
when: rept_stat.stat.exists
- name: 5. Changement des droits sur la racine
file:
path: /var/www/html/doku
owner: root
group: root
- name: 6. Changement des droits sur le dossier data
file:
path: /var/www/html/doku/data
owner: www-data
group: www-data
recurse: true
- name: 7. Changement des droits sur le dossier conf
file:
path: /var/www/html/doku/conf
owner: www-data
group: www-data
recurse: true
- name: 8. Changement des droits sur le dossier lib
file:
path: /var/www/html/doku/lib
owner: www-data
group: www-data
recurse: true
- name: 9. Redémarre Apache2
service:
name: apache2
state: restarted

View File

@@ -0,0 +1,10 @@
- name: 1. Installe les paquets requis pour le DokuWiki
apt:
name: "{{ item }}"
state: present
with_items:
- apache2
- php
- php-mbstring
- php-gd
- php-xml

View File

@@ -0,0 +1,6 @@
[adm]
infra
[web]
web1
web2

View File

@@ -0,0 +1,32 @@
# squid.yml
---
- hosts: adm
vars:
- proxy_port: 8080
- proxy_mem: 128
- proxy_localnet: "192.168.0.0/24"
tasks:
- name: 1. Installe le proxy Squid sur la machine Infra.
apt:
name: squid
state: present
# Uncomment this on FIRST RUN, comment afterwards !
# - name: 2. Récupère le fichier squid.conf.
# ansible.builtin.fetch:
# src: /etc/squid/squid.conf
# dest: squid.conf.j2
# flat: yes
- name: 3. Envoie squid.conf
template:
src: squid.conf.j2
dest: /etc/squid/squid.conf
notify: Restart squid
handlers:
- name: Restart squid
service:
name: squid
state: restarted

View File

@@ -0,0 +1,35 @@
# syslog-cli.yml
---
- hosts: web
tasks:
- name: 1. Installe le paquet rsyslog.
apt:
name: rsyslog
state: present
- name: 2. Ajoute la ligne pour forwarder les logs rsyslog au bon endroit.
lineinfile:
path: /etc/rsyslog.conf
line: '*.* @192.168.0.37:514'
create: yes
notify: Restart rsyslog
- name: 3. Forward les logs journald vers syslog.
replace:
path: /etc/systemd/journald.conf
regexp: '^#ForwardToSyslog=yes'
replace: 'ForwardToSyslog=yes'
notify: Restart journald
handlers:
- name: Restart rsyslog
service:
name: rsyslog
state: restarted
- name: Restart journald
service:
name: systemd-journald
state: restarted

View File

@@ -0,0 +1,30 @@
# syslog.yml
---
- hosts: adm
tasks:
- name: 1. Installe le paquet rsyslog.
apt:
name: rsyslog
state: present
- name: 2. Active le module UDP sur le serveur syslog.
replace:
path: /etc/rsyslog.conf
regexp: '^#module\(load="imudp"\)'
replace: 'module(load="imudp")'
notify: Restart rsyslog
- name: 3. Active l'écoute sur le port UDP 514.
replace:
path: /etc/rsyslog.conf
regexp: '^#input\(type="imudp" port="514"\)'
replace: 'input(type="imudp" port="514")'
notify: Restart rsyslog
handlers:
- name: Restart rsyslog
service:
name: rsyslog
state: restarted

View File

@@ -0,0 +1,21 @@
# playbook.yml
---
- hosts: web
tasks:
- name: 1. installe Apache
apt:
name: apache2
state: present
- name: 2. installe PHP pour Apache
apt:
name: php
state: present
- name: 3. installe php-mbstring
apt:
name: php-mbstring
state: present
- name: 4. installe index.html
copy:
src: index.html
dest: /var/www/html/index.html
mode: 0664