-
Notifications
You must be signed in to change notification settings - Fork 0
36 lines (27 loc) · 1.01 KB
/
online-hosts.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
name: Host Uptime
on:
workflow_dispatch:
schedule:
- cron: '0 14 * * 1'
jobs:
Homelab-Hosts:
runs-on: self-hosted
timeout-minutes: 10
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Run scan script
run: |
nmap -sn 10.0.30.0/24 -oG - | awk '/Up$/{print $2}' > inventory/online-hosts.txt
sed -i '/^10\.0\.30\.1$/d' inventory/online-hosts.txt
sed -i '/^10\.0\.30\.2$/d' inventory/online-hosts.txt
sed -i '/^10\.0\.30\.3$/d' inventory/online-hosts.txt
sed -i 's/10\.0\.30\.185/10.0.30.185 ansible_user=hakrishi/g' inventory/online-hosts.txt
sed -i 's/10\.0\.30\.197/10.0.30.197 ansible_user=hakrishi ansible_python_interpreter=\/usr\/bin\/python3/g' inventory/online-hosts.txt
- name: Commit changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "hakrishi"
git add .
git commit -m "online hosts update" -a || true
git push