more changes

This commit is contained in:
2023-08-17 19:34:00 +02:00
parent ca41a67e12
commit 2b894e1019
83 changed files with 74 additions and 0 deletions

16
playbooks/generate_inventory.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
# Scan the network to discover hosts
nmap -sn 192.168.1.0/24 -oG - | awk '/Up$/{print $2}' > hosts.txt
# Create the Ansible inventory file
echo "[all]" > inventory.ini
while read -r ip_address; do
dns_name=$(dig -x "$ip_address" +short | sed -e 's/\.$//')
if [ -n "$dns_name" ]; then
echo "$dns_name ansible_host=$ip_address" >> inventory.ini
fi
done < hosts.txt
echo "Inventory file created: inventory.ini"

22
playbooks/hosts.txt Normal file
View File

@@ -0,0 +1,22 @@
192.168.1.1
192.168.1.16
192.168.1.18
192.168.1.22
192.168.1.23
192.168.1.25
192.168.1.112
192.168.1.117
192.168.1.119
192.168.1.139
192.168.1.144
192.168.1.171
192.168.1.190
192.168.1.201
192.168.1.202
192.168.1.228
192.168.1.237
192.168.1.238
192.168.1.239
192.168.1.240
192.168.1.246
192.168.1.247

19
playbooks/inventory.ini Normal file
View File

@@ -0,0 +1,19 @@
[all]
ubnt ansible_host=192.168.1.1
SonosZP.localdomain ansible_host=192.168.1.16
raspi.localdomain ansible_host=192.168.1.18
Chromecast.localdomain ansible_host=192.168.1.25
office.localdomain ansible_host=192.168.1.112
00178862792d.localdomain ansible_host=192.168.1.117
dc01.localdomain ansible_host=192.168.1.119
homeserver.localdomain ansible_host=192.168.1.144
Google-Nest-Mini ansible_host=192.168.1.171
LGwebOSTV.localdomain ansible_host=192.168.1.190
Galaxy-A33-5G.localdomain ansible_host=192.168.1.201
raspii.localdomain ansible_host=192.168.1.202
unifi ansible_host=192.168.1.237
livingroom.localdomain ansible_host=192.168.1.238
office-switch.localdomain ansible_host=192.168.1.239
Bedroom.localdomain ansible_host=192.168.1.240
OnePlus-8-Pro.localdomain ansible_host=192.168.1.246
roborock-vacuum-a15.localdomain ansible_host=192.168.1.247

View File

@@ -0,0 +1,9 @@
---
- name: Shutdown Windows Servers
hosts: windows
become: yes
gather_facts: no # Disable gathering facts
roles:
- shutdown-role

8
playbooks/vault.yml Normal file
View File

@@ -0,0 +1,8 @@
$ANSIBLE_VAULT;1.1;AES256
63663132373162373663623638316361356161656631396661336434346565646562313031356534
6264653632316532303664333065353037386432383663630a353236653330386164383564636331
31633761366139313765383336666438353535333534393237613837356139393865336362323631
3366343138626631650a626562396365363335643362373735373535393937636165313237616261
66363537303936316431303730653139363538643638366366313633326363323830643461663034
32646235303936393639366333643735613937393930373333313233376461643163666233613564
663766336234303937613763303466326664