supercommit
This commit is contained in:
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/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 in YAML format
|
||||
echo "all:" > inventory.yml
|
||||
|
||||
while read -r ip_address; do
|
||||
dns_name=$(dig -x "$ip_address" +short | sed -e 's/\.$//')
|
||||
if [ -n "$dns_name" ]; then
|
||||
echo " hosts:" >> inventory.yml
|
||||
echo " $dns_name:" >> inventory.yml
|
||||
echo " ansible_host: $ip_address" >> inventory.yml
|
||||
fi
|
||||
done < hosts.txt
|
||||
|
||||
echo "Inventory file created: inventory.yml"
|
||||
@@ -0,0 +1,21 @@
|
||||
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.245
|
||||
@@ -0,0 +1,50 @@
|
||||
all:
|
||||
hosts:
|
||||
ubnt:
|
||||
ansible_host: 192.168.1.1
|
||||
hosts:
|
||||
SonosZP.localdomain:
|
||||
ansible_host: 192.168.1.16
|
||||
hosts:
|
||||
raspi.localdomain:
|
||||
ansible_host: 192.168.1.18
|
||||
hosts:
|
||||
Chromecast.localdomain:
|
||||
ansible_host: 192.168.1.25
|
||||
hosts:
|
||||
office.localdomain:
|
||||
ansible_host: 192.168.1.112
|
||||
hosts:
|
||||
00178862792d.localdomain:
|
||||
ansible_host: 192.168.1.117
|
||||
hosts:
|
||||
dc01.localdomain:
|
||||
ansible_host: 192.168.1.119
|
||||
hosts:
|
||||
homeserver.localdomain:
|
||||
ansible_host: 192.168.1.144
|
||||
ansible_become: windows
|
||||
hosts:
|
||||
Google-Nest-Mini:
|
||||
ansible_host: 192.168.1.171
|
||||
hosts:
|
||||
LGwebOSTV.localdomain:
|
||||
ansible_host: 192.168.1.190
|
||||
hosts:
|
||||
Galaxy-A33-5G.localdomain:
|
||||
ansible_host: 192.168.1.201
|
||||
hosts:
|
||||
raspii.localdomain:
|
||||
ansible_host: 192.168.1.202
|
||||
hosts:
|
||||
unifi:
|
||||
ansible_host: 192.168.1.237
|
||||
hosts:
|
||||
livingroom.localdomain:
|
||||
ansible_host: 192.168.1.238
|
||||
hosts:
|
||||
office-switch.localdomain:
|
||||
ansible_host: 192.168.1.239
|
||||
hosts:
|
||||
Bedroom.localdomain:
|
||||
ansible_host: 192.168.1.240
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/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"
|
||||
@@ -1,19 +0,0 @@
|
||||
[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
|
||||
@@ -1,2 +0,0 @@
|
||||
---
|
||||
# tasks file for shutdown-role
|
||||
@@ -0,0 +1,5 @@
|
||||
# tasks file for shutdown-role
|
||||
---
|
||||
- name: Shutdown Windows server
|
||||
win_shell: Stop-Computer -Force
|
||||
tags: ['windows']
|
||||
@@ -5,5 +5,4 @@
|
||||
gather_facts: no # Disable gathering facts
|
||||
|
||||
roles:
|
||||
- shutdown-role
|
||||
|
||||
- { role: shutdown-role }
|
||||
Reference in New Issue
Block a user