Skip to content

Commit 7170aae

Browse files
committed
chore(infra): ajouter python et nano au provisionnement + créer le script d'extraction des données système
1 parent 75a2686 commit 7170aae

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# Linux-System-Inventory-Tool-
1+
# Linux-System-Inventory-Tool

Vagrantfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
Vagrant.configure("2") do |config|
22
config.vm.box = "debian/bookworm64"
33
config.vbguest.auto_update = false
4+
config.vm.provision "shell", inline: <<-SHELL
5+
apt-get update
6+
apt-get install -y python3 python3-pip
7+
apt-get install -y nano
8+
SHELL
49
end

lsit.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
with open("/etc/hostname") as f:
2+
hostname = f.read().strip()
3+
4+
print(f"La cible a été identifiée. Nom de la machine : {hostname}")
5+
6+
ram_info = ""
7+
with open("/proc/meminfo") as f:
8+
for ligne in f:
9+
if "MemTotal" in ligne:
10+
ram_info = ligne.strip()
11+
12+
print(f"Mémoire totale : {ram_info}")
13+
14+
with open("rapport_lsit.txt", "a") as rapport:
15+
rapport.write(f"La cible a été identifiée. Nom de la machine : {hostname}\n")
16+
rapport.write(f"Mémoire totale : {ram_info}\n")

0 commit comments

Comments
 (0)