Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
9bdbe30539 | |||
fa3a3a8731 | |||
e88bb6e440 |
14
sio2/AP/apbase.yml
Normal file
14
sio2/AP/apbase.yml
Normal file
@ -0,0 +1,14 @@
|
||||
---
|
||||
- name: apbase
|
||||
hosts: web
|
||||
|
||||
- name: Installer les paquets apache2 php adminer
|
||||
apt:
|
||||
name:
|
||||
- apache2
|
||||
- php
|
||||
- adminer
|
||||
- php-mbstring
|
||||
- state: present
|
||||
|
||||
|
49
sio2/AP/apdb.yml
Normal file
49
sio2/AP/apdb.yml
Normal file
@ -0,0 +1,49 @@
|
||||
---
|
||||
- name: apbase
|
||||
hosts: web
|
||||
become: yes
|
||||
|
||||
- name: Installer mariadb
|
||||
apt:
|
||||
name:
|
||||
- mariadb-server
|
||||
- python3-PyMySQL
|
||||
state: present
|
||||
|
||||
- name: s'assurer que mariadb est en fonctionnement
|
||||
service:
|
||||
name: mariadb-server
|
||||
state: started
|
||||
|
||||
- name: Creer un utilisateur 'admin' lui attribuer tous les droits
|
||||
community.mysql.mysql_user:
|
||||
name: admin
|
||||
password: admin
|
||||
priv: '*.*:ALL'
|
||||
state: present
|
||||
|
||||
- name: Creation de la base de donnee 'sdis2023'
|
||||
mysql_db:
|
||||
name: sdis2023
|
||||
state: present
|
||||
|
||||
# Copy database dump file to remote host and restore it to database 'sdis2023'
|
||||
- name: Copie du dump de la BDD
|
||||
copy:
|
||||
src: sdis2023.sql
|
||||
dest: /tmp/
|
||||
|
||||
- name: Restore database
|
||||
community.mysql.mysql_db:
|
||||
name: sdis2023
|
||||
state: import
|
||||
target: /tmp/sdis2023
|
||||
|
||||
#- name: Restore d
|
||||
#community.mysql.mysql_db:
|
||||
#name: my_db
|
||||
#state: import
|
||||
#target: /tmp/dump.sql.bz2
|
||||
#force: true
|
||||
|
||||
|
10
sio2/AP/apdbdump.yml
Normal file
10
sio2/AP/apdbdump.yml
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
- name: apdbdump
|
||||
hosts: web
|
||||
|
||||
- name: 1. recuperation de sdis2023.sql avec fetch
|
||||
ansible.builtin.fetch:
|
||||
src: /tmp/sdis2023.sql
|
||||
dest: ~/ansible/backup/
|
||||
flat: yes
|
||||
|
2
sio2/AP/hosts
Normal file
2
sio2/AP/hosts
Normal file
@ -0,0 +1,2 @@
|
||||
[web]
|
||||
ap33prod
|
21610
sio2/AP/sdis2023.sql
Normal file
21610
sio2/AP/sdis2023.sql
Normal file
File diff suppressed because it is too large
Load Diff
23
sio2/CYBER/Cryptage/crypt.sh
Executable file
23
sio2/CYBER/Cryptage/crypt.sh
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
unn=$1
|
||||
utilisateurmdp=$2
|
||||
action=$3
|
||||
ficcle=$4
|
||||
user=$(echo $utilisateurmdp| cut -f1 -d/ )
|
||||
mdp=$(echo $utilisateurmdp| cut -f2 -d/ )
|
||||
echo $user
|
||||
echo $mdp
|
||||
[ -e /tmp/share ] || mkdir /tmp/share
|
||||
mount.cifs -o "username=${user},password=${mdp}" //${unn} /tmp/share
|
||||
if [[ $? == 0 ]] ;then
|
||||
echo "le montage fonctionne cryptage en cours"
|
||||
ccrypt ${action} -r -k ${ficcle} /tmp/share/*
|
||||
umount /tmp/share
|
||||
rm -r /tmp/share
|
||||
else
|
||||
echo "erreur montage $?"
|
||||
exit 1
|
||||
fi
|
||||
exit 0
|
||||
|
||||
|
9
sio2/SISR/Ansible/dokuw/hosts
Normal file
9
sio2/SISR/Ansible/dokuw/hosts
Normal file
@ -0,0 +1,9 @@
|
||||
[adm]
|
||||
infra
|
||||
|
||||
[web]
|
||||
web1
|
||||
web2
|
||||
|
||||
[doc]
|
||||
doku
|
6
sio2/SISR/Ansible/dokuw/local.yml
Normal file
6
sio2/SISR/Ansible/dokuw/local.yml
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
- hosts: doku
|
||||
roles:
|
||||
- web
|
||||
- doku
|
||||
|
18
sio2/SISR/Ansible/dokuw/roles/doku/main.yml
Normal file
18
sio2/SISR/Ansible/dokuw/roles/doku/main.yml
Normal file
@ -0,0 +1,18 @@
|
||||
vars:
|
||||
- chemin_fichier: /var/www/html/doku
|
||||
|
||||
- name: recuperation dokuwiki-stable.tgz depuis machine depl
|
||||
get_url:
|
||||
url: http://depl/store/dokuwiki-stable.tgz
|
||||
dest: /tmp/
|
||||
|
||||
- name: Extraction archive
|
||||
ansible.builtin.unarchive:
|
||||
src: /tmp/dokuwiki-stable.tgz
|
||||
dest: /var/www/html/
|
||||
|
||||
- name: changer propriétaire du fichier var/www/html/doku
|
||||
file:
|
||||
path: "{{ chemin_fichier }}"
|
||||
owner: www-data:www-data data lib conf
|
||||
become: true
|
37
sio2/SISR/Ansible/dokuw/roles/doku/tasks/main.yml
Normal file
37
sio2/SISR/Ansible/dokuw/roles/doku/tasks/main.yml
Normal file
@ -0,0 +1,37 @@
|
||||
- name: 1. recuperation dokuwiki-stable.tgz depuis machine depl
|
||||
get_url:
|
||||
url: http://depl/store/dokuwiki-stable.tgz
|
||||
dest: /tmp
|
||||
|
||||
- name: 2. Extraction archive dokuwiki-stage.tgz
|
||||
unarchive:
|
||||
src: /tmp/dokuwiki-stable.tgz
|
||||
dest: /var/www/html/
|
||||
remote_src: yes
|
||||
|
||||
- name: 3. stat dokuwiki
|
||||
stat:
|
||||
path: /var/www/html/dokuwiki-2023-04-04
|
||||
register: doku_stat
|
||||
|
||||
- name: 4. On renomme doku-v... en doku
|
||||
command: mv /var/www/html/dokuwiki-2023-04-04 /var/www/html/doku
|
||||
when: doku_stat.stat.exists
|
||||
|
||||
- name: 5. Changer propritaire group et permissions
|
||||
file:
|
||||
path: /var/www/html/doku
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0755'
|
||||
recurse: yes
|
||||
|
||||
- name: 6. Changer propritaire. group et permissions
|
||||
file:
|
||||
path: /var/www/html/doku
|
||||
owner: www-data
|
||||
group: www-data
|
||||
recurse: yes
|
||||
# mode: '755'
|
||||
|
||||
|
13
sio2/SISR/Ansible/dokuw/roles/web/tasks/main.yml
Normal file
13
sio2/SISR/Ansible/dokuw/roles/web/tasks/main.yml
Normal file
@ -0,0 +1,13 @@
|
||||
- name: 1. installe apache2 php et ces dependances
|
||||
apt:
|
||||
name:
|
||||
- apache2
|
||||
- php
|
||||
# - php-gd
|
||||
- php-mbstring
|
||||
state: present
|
||||
|
||||
- name: 2. lance Apache
|
||||
service:
|
||||
name: apache2
|
||||
state: started
|
Reference in New Issue
Block a user