Host Uptime #98
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 "rishi@rxerium.com" | |
git config --local user.name "rxerium" | |
git add . | |
git commit -m "online hosts update" -a || true | |
git push |