modif playbook apt upgrade
This commit is contained in:
parent
2cb43d1ac1
commit
47ae1d7987
47
ansible/generate_vault_from_inventory.sh
Executable file
47
ansible/generate_vault_from_inventory.sh
Executable file
@ -0,0 +1,47 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# === Chemins ===
|
||||||
|
INVENTORY_FILE="inventory/inventory.ini"
|
||||||
|
VAULT_FILE="group_vars/all/vault.yml"
|
||||||
|
TMP_FILE="$(mktemp)"
|
||||||
|
VARS_DIR="group_vars/all"
|
||||||
|
mkdir -p "$VARS_DIR"
|
||||||
|
|
||||||
|
# === Liste des hôtes à traiter ===
|
||||||
|
HOSTS=()
|
||||||
|
while IFS= read -r line; do
|
||||||
|
[[ "$line" =~ ^# ]] && continue # Ignore les commentaires
|
||||||
|
[[ "$line" =~ ^\[.*\]$ ]] && continue # Ignore les sections [group]
|
||||||
|
[[ -z "$line" ]] && continue # Ignore les lignes vides
|
||||||
|
HOSTNAME=$(echo "$line" | awk '{print $1}')
|
||||||
|
HOSTS+=("$HOSTNAME")
|
||||||
|
done < "$INVENTORY_FILE"
|
||||||
|
|
||||||
|
# === Collecte des mots de passe ===
|
||||||
|
declare -A PASSWORDS
|
||||||
|
|
||||||
|
echo "🛡️ Entrez les mots de passe sudo pour chaque hôte de l'inventaire :"
|
||||||
|
for HOST in "${HOSTS[@]}"; do
|
||||||
|
echo -n "🔐 $HOST: "
|
||||||
|
read -s PASSWORD
|
||||||
|
echo
|
||||||
|
PASSWORDS["$HOST"]="$PASSWORD"
|
||||||
|
done
|
||||||
|
|
||||||
|
# === Construction du fichier YAML temporaire ===
|
||||||
|
echo "become_passwords:" > "$TMP_FILE"
|
||||||
|
for HOST in "${HOSTS[@]}"; do
|
||||||
|
echo " \"$HOST\": \"${PASSWORDS[$HOST]}\"" >> "$TMP_FILE"
|
||||||
|
done
|
||||||
|
|
||||||
|
# === Pause facultative pour vérification ===
|
||||||
|
echo
|
||||||
|
echo "✅ Tous les mots de passe ont été saisis."
|
||||||
|
echo "Appuie sur Entrée pour chiffrer le fichier avec Ansible Vault..."
|
||||||
|
read
|
||||||
|
|
||||||
|
# === Chiffrement avec ansible-vault ===
|
||||||
|
ansible-vault encrypt "$TMP_FILE" --output "$VAULT_FILE"
|
||||||
|
rm -f "$TMP_FILE"
|
||||||
|
echo "🔒 Fichier chiffré créé : $VAULT_FILE"
|
||||||
|
|
||||||
32
ansible/group_vars/all/vault.yml
Normal file
32
ansible/group_vars/all/vault.yml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
$ANSIBLE_VAULT;1.1;AES256
|
||||||
|
30323134393031363864613438303839353165343965336461636233353761313237633631383739
|
||||||
|
6365396665356339336635396364613231613531303662340a346535323766646235376262386330
|
||||||
|
35353761646333386439346334643463333235656333626234323865353132623161333238303162
|
||||||
|
6432313235653932300a376430343062363132383964383563666439303461303233666466313736
|
||||||
|
34393636646437383961636362643232633861383931313034663731643835306433336634616230
|
||||||
|
62613638366166626538396566333462356639353662323031636433363361343566363739643536
|
||||||
|
63333530316664663534616137386532636461616466303865346637393164366438336362383033
|
||||||
|
35383835366432363064336531353761663239393031336666633262623964333933333264313062
|
||||||
|
37333666633637323437376435366337653237383733346134306337336265386434343762633230
|
||||||
|
32636435323935643166323363626438356530313266613035386535383033343863333436626237
|
||||||
|
35383437313731656331323637303664323039376334636235316133303230316531376434343030
|
||||||
|
38663732356334376465383239383430663136373366303630643830313836323565343038613866
|
||||||
|
63623533313664653935626465376261646563363433383239306435356135376636316634653330
|
||||||
|
34316631663630643639653635326163333533333335643937303138623739636462666664333461
|
||||||
|
36326466643962343430353363646239373762313131623236396332353630643763353363383161
|
||||||
|
61396139346439333164663338636333393064646135613631373663313266383263653762333339
|
||||||
|
36363862663135393533366431373262396234653961356135663530656439623634663935336665
|
||||||
|
35633334343337613361333966356632633530356662393839346433636663306336663633353362
|
||||||
|
61396436636235356436313737343636306430386439366337653033386532393836306566613433
|
||||||
|
34346339376438306462353136353133303433623162376131653063383565336563383431396161
|
||||||
|
65313662396634393163333761326561303830666665393932363365646662373464393433313666
|
||||||
|
33303133623532623566396261373039313164373863323432663630643661346663306666373237
|
||||||
|
33343037613431633633613466313565306362666562326330653233383832373133306134353964
|
||||||
|
35366233386666626663663938623066326635366162353264396266333535366165386364373235
|
||||||
|
30626633653931663665396630356633653966323138316630383963356562666464356333346264
|
||||||
|
39663834386266363736626539626430383065313164343566326262653163653333346432643032
|
||||||
|
31373739633461336166663636643632653564373665363430336164313936653431353136393432
|
||||||
|
63353031623365306261396536643537323031633939366336666263613131623363376631303139
|
||||||
|
35373233373835363264396332326536633163313564613963636630336465643635316231303563
|
||||||
|
32633861636436663362386637626336613161633638396363613231306339643533623932643966
|
||||||
|
396338363534323737353734613431656637
|
||||||
@ -1,2 +0,0 @@
|
|||||||
[servers]
|
|
||||||
192.168.1.248 ansible_host=192.168.1.248 ansible_user=smauro ansible_password=/f=b,;f;4-*1f}4q2&gB#(1{ ansible_port=22 ansible_become_password='/f=b,;f;4-*1f}4q2&gB#(1{'"
|
|
||||||
@ -1,10 +1,20 @@
|
|||||||
[debian_vm]
|
[debians]
|
||||||
192.168.1.34 ansible_user=smauro ansible_ssh_pass=testtest
|
website-mc ansible_host=10.0.0.2 ansible_port=22
|
||||||
|
ids-01 ansible_host=10.0.0.6 ansible_port=22
|
||||||
|
db-02 ansible_host=10.0.0.7 ansible_port=22
|
||||||
|
steph ansible_host=10.0.0.9 ansible_port=51474
|
||||||
|
revproxy-01 ansible_host=10.0.0.4 ansible_port=59512
|
||||||
|
minecraft ansible_host=10.0.0.5 ansible_port=59008
|
||||||
|
evotechsphere ansible_host=10.0.0.11 ansible_port=22
|
||||||
|
collaboraonline ansible_host=10.0.0.12 ansible_port=22
|
||||||
|
n8n ansible_host=10.0.0.13 ansible_port=22
|
||||||
|
bookstack ansible_host=10.0.0.17 ansible_port=22
|
||||||
|
gitea ansible_host=10.0.0.19 ansible_port=22
|
||||||
|
|
||||||
[server_web]
|
[server_web]
|
||||||
#192.168.1.116 ansible_user=root ansible_ssh_pass=testtest
|
#192.168.1.116 ansible_user=root ansible_ssh_pass=testtest
|
||||||
#192.168.1.145 ansible_user=root ansible_ssh_pass=testtest
|
#192.168.1.145 ansible_user=root ansible_ssh_pass=testtest
|
||||||
192.168.1.118 ansible_user=root ansible_ssh_pass=testtest
|
#192.168.1.118 ansible_user=root ansible_ssh_pass=testtest
|
||||||
|
|
||||||
[server]
|
[server]
|
||||||
#192.168.1.136 ansible_user=smauro
|
#192.168.1.136 ansible_user=smauro
|
||||||
@ -12,7 +22,7 @@
|
|||||||
#192.168.1.168 ansible_user=smauro
|
#192.168.1.168 ansible_user=smauro
|
||||||
#192.168.1.14 ansible_user=smauro ansible_port=52190
|
#192.168.1.14 ansible_user=smauro ansible_port=52190
|
||||||
#192.168.1.10 ansible_user=smauro ansible_port=52190
|
#192.168.1.10 ansible_user=smauro ansible_port=52190
|
||||||
192.168.1.145 ansible_user=smauro
|
#192.168.1.145 ansible_user=smauro
|
||||||
|
|
||||||
[grafana]
|
[grafana]
|
||||||
#192.168.1.58 ansible_user=smauro
|
#192.168.1.58 ansible_user=smauro
|
||||||
@ -27,4 +37,4 @@
|
|||||||
#192.168.1.14 ansible_user=smauro ansible_port=52190
|
#192.168.1.14 ansible_user=smauro ansible_port=52190
|
||||||
#192.168.1.57 ansible_user=smauro
|
#192.168.1.57 ansible_user=smauro
|
||||||
#192.168.1.145 ansible_user=smauro
|
#192.168.1.145 ansible_user=smauro
|
||||||
192.168.1.118 ansible_user=smauro
|
#192.168.1.118 ansible_user=smauro
|
||||||
|
|||||||
41
ansible/inventory/inventory.ini.backup
Normal file
41
ansible/inventory/inventory.ini.backup
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
[debians]
|
||||||
|
website-mc ansible_host=10.0.0.2
|
||||||
|
ids-01 ansible_host=10.0.0.6
|
||||||
|
db-02 ansible_host=10.0.0.7
|
||||||
|
steph ansible_host=10.0.0.9
|
||||||
|
revproxy-01 ansible_host=10.0.0.4
|
||||||
|
minecraft ansible_host=10.0.0.5
|
||||||
|
evotechsphere ansible_host=10.0.0.11
|
||||||
|
collaboraonline ansible_host=10.0.0.12
|
||||||
|
n8n ansible_host=10.0.0.13
|
||||||
|
bookstack ansible_host=10.0.0.17
|
||||||
|
gitea ansible_host=10.0.0.19
|
||||||
|
|
||||||
|
|
||||||
|
[server_web]
|
||||||
|
#192.168.1.116 ansible_user=root ansible_ssh_pass=testtest
|
||||||
|
#192.168.1.145 ansible_user=root ansible_ssh_pass=testtest
|
||||||
|
#192.168.1.118 ansible_user=root ansible_ssh_pass=testtest
|
||||||
|
|
||||||
|
[server]
|
||||||
|
#192.168.1.136 ansible_user=smauro
|
||||||
|
#192.168.1.248 ansible_user=smauro
|
||||||
|
#192.168.1.168 ansible_user=smauro
|
||||||
|
#192.168.1.14 ansible_user=smauro ansible_port=52190
|
||||||
|
#192.168.1.10 ansible_user=smauro ansible_port=52190
|
||||||
|
#192.168.1.145 ansible_user=smauro
|
||||||
|
|
||||||
|
[grafana]
|
||||||
|
#192.168.1.58 ansible_user=smauro
|
||||||
|
#192.168.1.249 ansible_user=smauro ansible_port=59008
|
||||||
|
#192.168.1.65 ansible_user=smauro
|
||||||
|
#192.168.1.138 ansible_user=smauro ansible_port=59512
|
||||||
|
#192.168.1.251 ansible_user=smauro ansible_port=59513
|
||||||
|
#192.168.1.168 ansible_user=smauro
|
||||||
|
#192.168.1.136 ansible_user=smauro
|
||||||
|
#192.168.1.248 ansible_user=smauro
|
||||||
|
#192.168.1.10 ansible_user=smauro ansible_port=52190
|
||||||
|
#192.168.1.14 ansible_user=smauro ansible_port=52190
|
||||||
|
#192.168.1.57 ansible_user=smauro
|
||||||
|
#192.168.1.145 ansible_user=smauro
|
||||||
|
#192.168.1.118 ansible_user=smauro
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user