Compare commits

..

7 Commits

Author SHA1 Message Date
32329396a9 mkvm : mode normal pour option -s 2024-01-18 00:12:51 +01:00
f9e801c39e MAJ doc README.md 2024-01-17 18:06:26 +01:00
85374ee503 s-fog.yml et s-fog-post.yml 2024-01-17 17:00:31 +01:00
5232d80321 syntax dans inst-depl 2024-01-17 15:08:29 +01:00
5acca816af inst-depl 2024-01-17 15:01:52 +01:00
394a8d8cd8 'fogsettings : short hostname 2024-01-17 14:53:47 +01:00
ff03ee66a5 fog: test goss et fogsettings adresse 2024-01-17 14:45:05 +01:00
7 changed files with 100 additions and 86 deletions

View File

@ -1,13 +1,13 @@
# gsb2024 # gsb2024
2024-01-13 ps 2024-01-17 18h04 ps
Environnement et playbooks **ansible** pour le projet **GSB 2024** Environnement et playbooks **ansible** pour le projet **GSB 2024**
## Quickstart ## Quickstart
Prérequis : Prérequis :
* une machine Linux Debian Bookworm ou Windows * une machine **Linux Debian Bookworm** ou **Windows**
* VirtualBox * VirtualBox
* git * git
* fichier machines virtuelles **ova** : * fichier machines virtuelles **ova** :
@ -38,6 +38,8 @@ Prérequis :
* **s-lb-web2** : Serveur Wordpress 2 Load Balancer * **s-lb-web2** : Serveur Wordpress 2 Load Balancer
* **s-lb-db** : Serveur Mariadb pour Wordpress * **s-lb-db** : Serveur Mariadb pour Wordpress
* **s-nas** : Serveur NFS pour application Wordpress avec LB * **s-nas** : Serveur NFS pour application Wordpress avec LB
* **s-kea1** : Serveur DHCP Kea HA 1
* **s-kea2** : Serveur DHCP Kea HA 2
## Les playbooks ## Les playbooks
@ -98,37 +100,40 @@ bash chname <nouveau_nom_de_machine>` , puis redémarrer
### Pour chaque machine ### Pour chaque machine
#### Etape 1 #### Etape 1 - Nommage machine
- créer la machine avec **mkvm -r**, les cartes réseau sont paramétrées par **mkvm** selon les spécifications - créer la machine avec **mkvm -r**, les cartes réseau sont paramétrées par **mkvm** selon les spécifications
- ouvrir une session sur la machine considérée - ouvrir une session sur la machine considérée
- renommer la machine soit - renommer la machine soit
* en utilisant le script de renommage comme suit : * en utilisant le script de renommage comme suit :
` /root/tools/ansible/gsb2024/scripts/chname <nouveau_nom_de_machine>` ` /root/tools/ansible/gsb2024/scripts/chname <nouveau_nom_de_machine>`
* soit avec : * soit (ici on renomme la machine en **s-infra**) avec :
```shell ```shell
NHOST=mavm export HOST=s-infra
sed -i "s/bookworm/${NHOST}/g" /etc/host{s,name} curl 192.168.99.99/gsbstore/inst1|bash
sudo reboot # on redemarre reboot # on redemarre
``` ```
#### Etape 2 #### Etape 2 - installation outils, depot gsb2024 et lancement playbook
- utiliser le script **gsb-start** : `bash gsb-start` - utiliser le script **gsb-start** : `bash gsb-start`
- ou sinon: - ou sinon:
```shell ```shell
mkdir -p tools/ansible ; cd tools/ansible curl 192.168.99.99/gsbstore/inst2|bash
git clone https://gitea.lyc-lecastel.fr/gsb/gsb2024.git
cd gsb2024/pre
DEPL=192.168.99.99 bash gsbboot
cd ../.. ; bash pull-config
``` ```
- le script recupere le dépot **gsb2024.git**
- il lance ensuite le script **pull-config** avec le script porant le nom de la machine
- on peut alors redémarrer
#### Etape 3 #### Etape 3 - Redémarrage et tests
- redémarrer - redémarrer
- **Remarque** : une machine doit avoir été redémarrée pour prendre en charge la nouvelle configuration - **Remarque** : une machine doit avoir été redémarrée pour prendre en charge la nouvelle configuration, en particulier la couche réseau et l'adressage.
- selon les situations, il est possible qu'un seul playbook ne soit pas suffisant pour installer complètement une machine. Dans ce cas de figure, le second playbook s'appelle **s-machine-post.yml**.
Il est à lancer depuis ''tools/ansible/gsb2024'' :
```shell
ansible-playbook -i localhost, -c local s-machine-post.yml
```
## Les tests ## Les tests

View File

@ -1,68 +1,77 @@
file: file:
/tftpboot/default.ipxe: /tftpboot/default.ipxe:
exists: true exists: true
mode: "0644" mode: "0644"
owner: root owner: root
group: root group: root
filetype: file filetype: file
contains: [] contains: []
contents: null
package: package:
apache2: apache2:
installed: true installed: true
versions: versions:
- 2.4.57-2 - 2.4.56-1~deb11u2
isc-dhcp-server: isc-dhcp-server:
installed: true installed: true
versions: versions:
- 4.4.3-P1-2 - 4.4.1-2.3+deb11u2
mariadb-server: mariadb-server:
installed: true installed: true
versions: versions:
- 1:10.11.4-1~deb12u1 - 1:10.5.21-0+deb11u1
tftpd-hpa: tftpd-hpa:
installed: true installed: true
versions: versions:
- 5.2+20150808-1.4 - 5.2+20150808-1.2
port: port:
tcp:80: tcp:80:
listening: true listening: true
ip: ip:
- 0.0.0.0 - 0.0.0.0
tcp:443: tcp:443:
listening: true listening: true
ip: ip:
- 0.0.0.0 - 0.0.0.0
udp:67:
listening: true
ip:
- 0.0.0.0
udp:69:
listening: true
ip:
- 0.0.0.0
service: service:
apache2: apache2:
enabled: true enabled: true
running: true running: true
isc-dhcp-server: isc-dhcp-server:
enabled: true enabled: true
running: true running: true
nfs-server: nfs-server:
enabled: true enabled: true
running: true running: true
tftpd-hpa: tftpd-hpa:
enabled: true enabled: true
running: true running: true
command: command:
ping -c 4 192.168.99.99: ping -c 4 192.168.99.99:
exit-status: 0 exit-status: 0
stdout: stdout:
- 0% packet loss - 0% packet loss
stderr: [] stderr: []
timeout: 10000 timeout: 10000
ping -c 4 google.fr: ping -c 4 google.fr:
exit-status: 0 exit-status: 0
stdout: stdout:
- 0% packet loss - 0% packet loss
stderr: [] stderr: []
timeout: 10000 timeout: 10000
process: process:
apache2: apache2:
running: true running: true
interface: interface:
enp0s9: enp0s9:
exists: true exists: true
addrs: addrs:
- 172.16.64.16/24 - 172.16.64.16/24

View File

@ -2,6 +2,7 @@
## aa : 2023-01-18 15:25 ## aa : 2023-01-18 15:25
## ps : 2023-02-01 15:25 ## ps : 2023-02-01 15:25
## ps : 2023-12-18 15:25 ## ps : 2023-12-18 15:25
## ps : 2024-01-17 15:25
set -o errexit set -o errexit
set -o pipefail set -o pipefail
@ -83,7 +84,7 @@ cp goss /usr/local/bin
(cat <<'EOT' > "${STOREREP}/inst1" (cat <<'EOT' > "${STOREREP}/inst1"
#!/bin/bash #!/bin/bash
if [[ -z ${HOST+x} ]]; then if [[ -z "${HOST+x}" ]]; then
echo "erreur : variable HOST indefinie" echo "erreur : variable HOST indefinie"
echo " HOST : adresse serveur deploiement" echo " HOST : adresse serveur deploiement"
echo "export HOST=s-xyzt ; ./$0" echo "export HOST=s-xyzt ; ./$0"
@ -93,7 +94,7 @@ fi
hostname=$(hostname) hostname=$(hostname)
echo "${HOST}" > /etc/hostname echo "${HOST}" > /etc/hostname
hostnamectl set-hostname "${HOST}" hostnamectl set-hostname "${HOST}"
sed -i "s/${hostname}/${HOST}/g" /etc/host{s,name} sed -i "s/${hostname}/${HOST}/g" /etc/hosts
echo "vous pouvez redemarrer ..." echo "vous pouvez redemarrer ..."
EOT EOT
) )

View File

@ -4,11 +4,11 @@
## https://wiki.fogproject.org/wiki/index.php?title=.fogsettings ## https://wiki.fogproject.org/wiki/index.php?title=.fogsettings
## Version: 1.5.10 ## Version: 1.5.10
## Install time: Mon Jan 15 23:16:31 2024 ## Install time: Mon Jan 15 23:16:31 2024
ipaddress='172.16.0.8' ipaddress='172.16.0.16'
copybackold='0' copybackold='0'
interface='enp0s9' interface='enp0s9'
submask='255.255.255.0' submask='255.255.255.0'
hostname='s-fog.gsb.lan' hostname='s-fog'
routeraddress='172.16.64.254' routeraddress='172.16.64.254'
plainrouter='172.16.64.254' plainrouter='172.16.64.254'
dnsaddress='172.16.0.1' dnsaddress='172.16.0.1'
@ -34,11 +34,12 @@ caCreated='yes'
httpproto='https' httpproto='https'
startrange='172.16.64.120' startrange='172.16.64.120'
endrange='172.16.64.140' endrange='172.16.64.140'
bootfilename='undionly.kpxe'
packages='apache2 bc build-essential cpp curl g++ gawk gcc genisoimage gettext git gzip htmldoc isc-dhcp-server isolinux lftp libapache2-mod-php libc6 libcurl4 liblzma-dev m4 mariadb-client mariadb-server net-tools nfs-kernel-server openssh-server php php-bcmath php-cli php-curl php-fpm php-gd php-intl php-json php-ldap php-mbstring php-mysql tar tftp-hpa tftpd-hpa unzip vsftpd wget zlib1g' packages='apache2 bc build-essential cpp curl g++ gawk gcc genisoimage gettext git gzip htmldoc isc-dhcp-server isolinux lftp libapache2-mod-php libc6 libcurl4 liblzma-dev m4 mariadb-client mariadb-server net-tools nfs-kernel-server openssh-server php php-bcmath php-cli php-curl php-fpm php-gd php-intl php-json php-ldap php-mbstring php-mysql tar tftp-hpa tftpd-hpa unzip vsftpd wget zlib1g'
noTftpBuild='' noTftpBuild=''
tftpAdvOpts='' tftpAdvOpts=''
sslpath='/opt/fog/snapins/ssl/' sslpath='/opt/fog/snapins/ssl/'
backupPath='/home/' #backupPath='/home/'
armsupport='0' armsupport='0'
php_ver='7.4' php_ver='7.4'
sslprivkey='/opt/fog/snapins/ssl//.srvprivate.key' sslprivkey='/opt/fog/snapins/ssl//.srvprivate.key'

View File

@ -7,8 +7,6 @@
- goss - goss
#- dhcp-fog #- dhcp-fog
# - ssh-cli # - ssh-cli
# - snmp-agent #- fog
# - syslog-cli
- fog
#- - journald-snd #- - journald-snd
- post - post

View File

@ -137,5 +137,5 @@ else
exit 2 exit 2
fi fi
if [[ $startmode == 1 ]] ; then if [[ $startmode == 1 ]] ; then
vboxmanage startvm "${vm}" --type headless vboxmanage startvm "${vm}"
fi fi