Compare commits
12 Commits
v0.0.6t-jc
...
v0.0.7e-ak
Author | SHA1 | Date | |
---|---|---|---|
0ba8c7c3eb | |||
b1bd102d85 | |||
6cfe40b998 | |||
e48d63a8bc | |||
873b6b6def | |||
3d94e6c050 | |||
151c0adf88 | |||
745bc05e76 | |||
82561d5d0a | |||
df1000e1b5 | |||
0824fd9621 | |||
3c680769be |
21
roles/awx/README.md
Normal file
21
roles/awx/README.md
Normal 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.
|
8
roles/awx/default/main.yml
Normal file
8
roles/awx/default/main.yml
Normal 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"
|
||||
|
6
roles/awx/handlers/main.yml
Normal file
6
roles/awx/handlers/main.yml
Normal 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
47
roles/awx/tasks/main.yml
Normal 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 }}"
|
||||
|
||||
|
||||
|
||||
|
52
roles/awx/templates/server.env.j2
Normal file
52
roles/awx/templates/server.env.j2
Normal 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=
|
@ -1 +1 @@
|
||||
BEATVER: "8.11.5"
|
||||
BEATVER: "8.11.4"
|
||||
|
@ -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
16
roles/gotify/README.md
Normal 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
|
||||
|
||||
***
|
@ -16,5 +16,5 @@
|
||||
copy:
|
||||
src: /root/id_rsa_sbackup
|
||||
dest: /var/www/html/gsbstore
|
||||
mode: 0600
|
||||
mode: 0644
|
||||
remote_src: yes
|
||||
|
9
roles/ssh-backup-key-private/README.md
Normal file
9
roles/ssh-backup-key-private/README.md
Normal 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é.
|
@ -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
|
||||
|
||||
|
@ -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.
|
||||
|
7
roles/zabbix-srv/files/gotify.sh
Normal file
7
roles/zabbix-srv/files/gotify.sh
Normal 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
17
s-awx.yml
Normal 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
|
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user