Compare commits

...

12 Commits

Author SHA1 Message Date
0ba8c7c3eb ajout role awx 2024-01-29 18:01:33 +01:00
b1bd102d85 création readme s-backup 2024-01-29 16:04:05 +01:00
6cfe40b998 création readme s-backup 2024-01-29 15:56:30 +01:00
e48d63a8bc update 2024-01-29 14:32:54 +01:00
873b6b6def update readme 2024-01-29 14:28:53 +01:00
3d94e6c050 update README 2024-01-29 14:23:08 +01:00
151c0adf88 elk-filebeat-cli filebeat.yml 2024-01-26 15:48:18 +01:00
745bc05e76 Merge branch 'main' of https://gitea.lyc-lecastel.fr/gsb/gsb2024 2024-01-26 15:00:44 +01:00
82561d5d0a update gotify.sh 2024-01-26 14:59:57 +01:00
df1000e1b5 modif droit copie cle privee 2024-01-26 14:55:25 +01:00
0824fd9621 update 2024-01-26 14:22:09 +01:00
3c680769be update zabbix-srv pour gotify 2024-01-26 14:15:31 +01:00
16 changed files with 218 additions and 16 deletions

21
roles/awx/README.md Normal file
View File

@ -0,0 +1,21 @@
# Rôle Kea
***
Rôle Kea: Configuration de 2 serveurs KEA en mode haute disponbilité.
## Tables des matières
1. [Que fait le rôle Kea ?]
2. [Installation et configuration de ka]
3. [Remarques]
## Que fait le rôle Kea ?
Le rôle KEA permet de configurer 1 serveurs kea (s-kea1 et s-kea2) en mode haute disponibilité.
- Le serveur **s-kea1** sera en mode **primary** il délivrera les baux DHCP sur le réseau n-user.
- Le serveur **s-kea2**, sera en mode **stand-by** le service DHCP basculera donc sur **s-kea2** en cas disponibilité du serveur**s-kea1**.
### Installation et configuration de kea
Le rôle kea installe les packets **kea dhcp4, hooks, admin** une fois les packets installer. Il configure un serveur kea pour qu'il distribue les ips sur le réseau n-user et soit en haute disponibilité.
### Remarquees ###
Une fois le playbook **s-kea** correctement terminé et la machine **s-kea** redemarrée, redémarrée le service **isc-kea-dhcp4.service** afin de prendre en compte les modifications éfféctuées sur la couche réseau par le role POST.

View File

@ -0,0 +1,8 @@
#variable kea
kea_ver: "2.4.1"
kea_dbname: ""
kaa_dbuser: ""
kea_dbpasswd: ""
kea_dhcp4_dir: "/etc/kea/kea-dhcp4.conf"
kea_ctrl_dir: "/etc/kea/kea-ctrl-agent.conf"

View File

@ -0,0 +1,6 @@
---
- name: Restart isc-stork-server.service
ansible.builtin.service:
name: isc-stork-server.service
state: restarted
enabled: yes

47
roles/awx/tasks/main.yml Normal file
View File

@ -0,0 +1,47 @@
---
- name: Preparation
ansible.builtin.shell: curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.28.5+k3s1 sh -s - --write-kubeconfig-mode 644 --node-ip "{{ awx_ip }}" --flanel-iface "{{ awx_if }}"
- name: clonage du dépot awx-on-k3s
git:
repo: https://github.com/kurokobo/awx-on-k3s.git
dest: "{{ awx_dir }}"
clone: yes
force: yes
- name: Deploiement AWX Operator ...
ansible.builtin.shell: "kubectl apply -k operator"
args:
chdir: "{{ awx_dir }}"
- name: Git checkout
ansible.builtin.git:
repo: 'https://github.com/kurokobo/awx-on-k3s.git'
dest: "{{ awx_dir }}"
version: release-2.10.0
- name: Generation de certification auto-signé
ansible.builtin.shell: 'openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -out ./base/tls.crt -keyout ./base/tls.key -subj "/CN={{ awx_host }}/O={{ awx_host }}" -addext "subjectAltName = DNS:{{ awx_host }}"'
args:
chdir: "{{ awx_dir }}"
- name: creation du repertoire postgres-13
ansible.builtin.file:
path: /data/postgres-13
state: directory
mode: '0755'
- name: Creation repertoire projects
ansible.builtin.file:
path: /data/projects
state: directory
owner: 1000:0
- name: Deploiement d'AWX ...
ansible.builtin.shell: "kubectl apply -k base"
args:
chdir: "{{ awx_dir }}"

View File

@ -0,0 +1,52 @@
### database settings
### the address of a PostgreSQL database
STORK_DATABASE_HOST=localhost
### the port of a PostgreSQL database
STORK_DATABASE_PORT=5432
### the name of a database
STORK_DATABASE_NAME={{ stork_db_name }}
### the username for connecting to the database
STORK_DATABASE_USER_NAME={{ stork_db_user }}
### the SSL mode for connecting to the database
### possible values: disable, require, verify-ca, or verify-full
# STORK_DATABASE_SSLMODE=
### the location of the SSL certificate used by the server to connect to the database
# STORK_DATABASE_SSLCERT=
### the location of the SSL key used by the server to connect to the database
# STORK_DATABASE_SSLKEY=
### the location of the root certificate file used to verify the database server's certificate
# STORK_DATABASE_SSLROOTCERT=
### the password for the username connecting to the database
### empty password is set to avoid prompting a user for database password
STORK_DATABASE_PASSWORD={{stork_db_passwd }}
### REST API settings
### the IP address on which the server listens
# STORK_REST_HOST=
### the port number on which the server listens
# STORK_REST_PORT=
### the file with a certificate to use for secure connections
# STORK_REST_TLS_CERTIFICATE=
### the file with a private key to use for secure connections
# STORK_REST_TLS_PRIVATE_KEY=
### the certificate authority file used for mutual TLS authentication
# STORK_REST_TLS_CA_CERTIFICATE=
### the directory with static files served in the UI
STORK_REST_STATIC_FILES_DIR=/usr/share/stork/www
### the base URL of the UI - to be used only if the UI is served from a subdirectory
# STORK_REST_BASE_URL=
### enable Prometheus /metrics HTTP endpoint for exporting metrics from
### the server to Prometheus. It is recommended to secure this endpoint
### (e.g. using HTTP proxy).
# STORK_SERVER_ENABLE_METRICS=true
### Logging parameters
### Set logging level. Supported values are: DEBUG, INFO, WARN, ERROR
# STORK_LOG_LEVEL=DEBUG
### disable output colorization
# CLICOLOR=false
### path to the hook directory
# STORK_SERVER_HOOK_DIRECTORY=

View File

@ -1 +1 @@
BEATVER: "8.11.5"
BEATVER: "8.11.4"

View File

@ -1,17 +1,31 @@
---
- name: Récupération de filebeat
get_url:
url: http://s-adm.gsb.adm/gsbstore/filebeat-${BEATVAR}-amd64.deb
url: "http://s-adm.gsb.adm/gsbstore/filebeat-{{ BEATVER }}-amd64.deb"
dest: /tmp/
- name: Installation de filebeat
apt:
deb: /tmp/filebeat-${BEATVEAR}-amd64.deb
deb: "/tmp/filebeat-{{ BEATVER }}-amd64.deb"
- name: Changement du fichier de conf
copy:
src: filebeat.yml
dest: /etc/filebeat/filebeat.yml
- name: Chgt filebeat.yml - localhost:9200 - Elastic
replace:
path: /etc/filebeat/filebeat.yml
regexp: 'localhost:9200'
replace: 's-elk.gsb.adm:9200'
backup: yes
- name: Chgt filebeat.yml - localhost:5601 - Kibana
replace:
path: /etc/filebeat/filebeat.yml
regexp: 'localhost:5601'
replace: 's-elk.gsb.adm:5601'
backup: yes
#- name: Changement du fichier de conf
# copy:
# src: filebeat.yml
# dest: /etc/filebeat/filebeat.yml
- name: Configuration de filebeat
shell: filebeat modules enable system

16
roles/gotify/README.md Normal file
View File

@ -0,0 +1,16 @@
# Rôle Gotify
***
Rôle gotify pour la notification Zabbix et pas que
## Que fait le rôle gotify ?
Le rôle gotify va installer gotify en binaire, il s'agit d'une installation basic sans https.
***
## Identifiant
***
Admin
Admin
***

View File

@ -16,5 +16,5 @@
copy:
src: /root/id_rsa_sbackup
dest: /var/www/html/gsbstore
mode: 0600
mode: 0644
remote_src: yes

View File

@ -0,0 +1,9 @@
####récupération d'une clé publique####
Ce script permet de récupérer un clé publique créer depuis la machine s-adm:
1. Création du répertoire .ssh :
- Il crée le répertoire `~/.ssh` avec des permissions strictes (0700) pour l'utilisateur.
2. Récupération de la clé privée :
- Il télécharge une clé privée depuis l'URL spécifiée (`http://s-adm.gsb.adm/gsbstore/id_rsa_sbackup`) et la place dans le répertoire `~/.ssh` avec le nom `id_rsa_sbackup`.
- La clé privée est configurée avec des permissions strictes (0600) pour garantir la sécurité.

View File

@ -1,9 +1,9 @@
- name: Intallation paquet zabbix agent
- name: Installation paquet zabbix agent
get_url:
url: "https://repo.zabbix.com/zabbix/6.4/debian/pool/main/z/zabbix-release/zabbix-release_6.4-1+debian12_all.deb"
dest: "/tmp"
- name: Intallation paquet zabbix agent suite
- name: Installation paquet zabbix agent suite
apt:
deb: "/tmp/zabbix-release_6.4-1+debian12_all.deb"
state: present
@ -12,7 +12,7 @@
apt:
update_cache: yes
- name: Intallation Zabbix agent
- name: Installation Zabbix agent
apt:
name: zabbix-agent
state: present
@ -33,6 +33,6 @@
src: hostcreate.sh.j2
dest: /tmp/hostcreate.sh
#- name: lancement script hostcreate
#command: bash /tmp/hostcreate.sh
- name: lancement script hostcreate
command: bash /tmp/hostcreate.sh

View File

@ -15,3 +15,7 @@ La base de données est importée depuis une sauvegarde existante sur s-adm qui
Lors de l'éxecution du playbook, les identifiants de la BDD sont crées avec le nom d'utilisateur "zabbix" et le mot de passe "password" pour se connecter a la BD importée.
Pour l'identifiant de Zabbix, c'est "Admin" et le mot de passe "zabbix", à l'adresse <http://s-mon/zabbix>.
## Notification Zabbix avec gotify
Ce rôle installe la base pour pouvoir faire des notification avec gotify, la base importée est pre-configurer pas besoin de rajouter le media gotify. Le serveur gotify est sur s-backup et est accessible via s-backup.gsb.adm:8008.

View File

@ -0,0 +1,7 @@
#!/bin/bash
ALERTSENDTO=$1
ALERTSUBJECT=$2
ALERTMESSAGE=$3
curl -X POST "http://s-backup.gsb.adm:8008/message?token=$ALERTSENDTO" -F "title=$ALERTSUBJECT" -F "message=$ALERTMESSAGE" -F "priority=5" > /dev/null 2>&1

17
s-awx.yml Normal file
View File

@ -0,0 +1,17 @@
---
- hosts: localhost
connection: local
vars:
awx_host: "s-awx.gsb.lan"
awx_dir: "/root/tools/awx-on-k3s"
awx_ip: "192.168.0.2"
awx_if: "enp0s3"
roles:
- base
# - goss
#- ssh-cli
- awx
# - zabbix-cli
#- journald-snd
#- post

View File

@ -4,11 +4,12 @@
# include: config.yml
roles:
- base
- zabbix-cli
# - zabbix-cli
- goss
- dns-master
- webautoconf
- journald-snd
- elk-filebeat-cli
# - journald-snd
- ssh-cli
- post

View File

@ -30,7 +30,7 @@ function create_vm{ param([string]$nomvm)
} else {
#Importation depuis l'ova
& "$vboxmanage" import "$ovafile" --vsys 0 --vmname "$nomvm"
Write-Host "Machine $nomvm importée"
Write-Host "Machine $nomvm importée"
}
}