This commit is contained in:
Justin 2025-05-07 18:45:45 -05:00
parent 6236bf6caa
commit 79df365f95
13 changed files with 29 additions and 307 deletions

View File

@ -1,23 +0,0 @@
---
- name: Add ssh key
hosts: all
become: true
tasks:
- name: create id_rsa
file:
path: "~/.ssh/id_rsa.pub"
state: touch
- name: Install public keys
ansible.posix.authorized_key:
user: "{{ lookup('env', 'USER') }}"
state: present
key: "{{ lookup('file', '~/.ssh/id_ed25519.pub') }}"
- name: Change sudoers file
ansible.builtin.lineinfile:
path: /etc/sudoers
state: present
regexp: '^%sudo'
line: '%sudo ALL=(ALL) NOPASSWD: ALL'
validate: /usr/sbin/visudo -cf %s

View File

@ -1,110 +0,0 @@
---
- name: Installing Nvim
hosts: all
tasks:
- name: make sure git is installed
become: yes
apt:
update_cache: yes
name: git
state: latest
- name: Pulling from github
ansible.builtin.command:
cmd: "curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gz --output-dir /tmp"
- name: Removing and older verson
become: true
ansible.builtin.command:
cmd: "sudo rm -rf /opt/nvim"
- name: Unziping Nvim
become: true
ansible.builtin.command:
cmd: "sudo tar -C /opt -xzf /tmp/nvim-linux-x86_64.tar.gz"
- name: Setting the path
ansible.builtin.lineinfile:
line: 'export PATH="$PATH:/opt/nvim-linux64/bin"'
path: "~/.bashrc"
insertafter: EOF
- name: Check if there is a config
ansible.builtin.stat:
path: /home/justin/.config/nvim
register: nvim_config
- name: Checking if there is a backup Nvim config
ansible.builtin.stat:
path: /home/justin/.config/nvim.bak
register: nvim_backup_config
- name: Removing backup config
ansible.builtin.command:
cmd: "rm -r home/justin/.config/nvim.bak"
when: nvim_backup_config.stat.exists
- name: Backup configs
ansible.builtin.command:
cmd: "mv /home/justin/.config/nvim /home/justin/.config/nvim.bak"
when: nvim_config.stat.exists
- name: Pulling config
ansible.builtin.command:
cmd: "git clone https://github.com/LazyVim/starter ~/.config/nvim"
- name: removing the git file
ansible.builtin.command:
cmd: "rm -rf /home/justin/.config/nvim/.git"
- name: Cleanup
ansible.builtin.command:
cmd: "rm /tmp/nvim-linux-x86_64.tar.gz"
- name: installing unzip
become: true
when: ansible_pkg_mgr == "apt"
ansible.builtin.apt:
name: unzip
state: latest
- name: Check if Font folder is there
ansible.builtin.stat:
path: ~/.local/share/fonts
register: fonts_folder
- name: Making font folder
ansible.builtin.command:
cmd: "mkdir /home/justin/.local/share/fonts"
when: fonts_folder.stat.exists != True
- name: Nerd font zip
ansible.builtin.command:
cmd: "wget https://github.com/ryanoasis/nerd-fonts/releases/download/v3.3.0/3270.zip"
- name: Unzipping
ansible.builtin.command:
cmd: "unzip 3270.zip -d /home/justin/.local/share/fonts/ "
- name: Font Cleanup
ansible.builtin.command:
cmd: "rm 3270.zip"
- name: installing font config
become: true
when: ansible_pkg_mgr == "apt"
ansible.builtin.apt:
name: fontconfig
state: latest
- name: Set Fonts
ansible.builtin.command:
cmd: "fc-cache -fv"
- name: installing fzf for nvim
become: true
when: ansible_pkg_mgr == "apt"
ansible.builtin.apt:
name: fzf
state: latest

View File

@ -1,25 +0,0 @@
---
- name: Check disk space
hosts: "all"
tasks:
- name: Check disk space available
ansible.builtin.shell:
cmd: |
set -euo pipefail
df -Ph / | awk 'NR==2 {print $5}'
executable: /bin/bash
changed_when: false
check_mode: false
register: disk_usage
- name: Diskspace is over 80%
ansible.builtin.debug:
msg: "Disk is over 80%"
when: disk_usage.stdout[:-1]|int>80
- name: Posting
ansible.builtin.command:
cmd: 'curl -d "Disk space on {{ inventory_hostname }} is above 80%!" ntfy.ki5bhv.com/server'
when: disk_usage.stdout[:-1]|int>80

View File

@ -1,16 +0,0 @@
---
- name: Check if system reboot is required
hosts: "all"
become: true
tasks:
- name: Check if system reboot is required
become: true
ansible.builtin.stat:
path: /run/reboot-required
register: reboot_required
- name: Report if reboot is required
ansible.builtin.command:
cmd: 'curl -d "Reboot is required for {{inventory_hostname}}" ntfy.ki5bhv.com/server'
when: reboot_required.stat.exists

9
ping.yml Normal file
View File

@ -0,0 +1,9 @@
---
- hosts: all
gather_facts: false
tasks:
- name: Ping
ansible.builtin.ping:
data: pong

View File

@ -1,11 +0,0 @@
---
- name: Update Plex Sever
hosts: killer1
become: yes
tasks:
- name: Ensure Plex is at the latest version
apt:
update_cache: yes
name: plexmediaserver
state: latest

View File

@ -1,6 +1,7 @@
---
- name: Installing Nvim
hosts: localhost
hosts: killer-laptop.ki5bhv.com
tasks:
- name: make sure git is installed

View File

@ -1,6 +1,6 @@
---
- name: Reboot machine
hosts: "{{ my_hosts | d([]) }}"
hosts: ["git-server.ki5bhv.com"]
become: true
tasks:

View File

@ -1,6 +1,6 @@
---
- name: Update cloud Flare Tunnel
hosts: cloudflare-tunnel.ki5bhv.com
hosts: cloudflare.ki5bhv.com
tasks:
- name: Pull the newest package
@ -22,7 +22,7 @@
path: cloudflared.deb
register: cloudflaredfile
- name: Cleanup
- name: Cleanup
when: cloudflaredfile.stat.exists
ansible.builtin.command:
cmd: "rm cloudflared.deb"

View File

@ -24,12 +24,14 @@
state: latest
- name: Enable proxmox agent
ansible.builtin.command:
cmd: systemctl enable qemu-guest-agent
ansible.builtin.service:
name: qemu-guest-agent
state: started
- name: Restart proxmox agent
ansible.builtin.command:
cmd: systemctl restart qemu-guest-agent
ansible.builtin.service:
name: qemu-guest-agent
state: restarted
- name: Upgrade packages with apt

View File

@ -1,28 +0,0 @@
---
- name: Update cloud Flare Tunnel
hosts: 192.168.1.119
tasks:
- name: Pull the newest package
ansible.builtin.command:
cmd: "curl --location --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb"
- name: installing package
become: true
ansible.builtin.command:
cmd: "dpkg -i cloudflared.deb"
- name: Restart the service
become: true
ansible.builtin.command:
cmd: "systemctl restart cloudflared.service"
- name: check before cleanup
ansible.builtin.stat:
path: cloudflared.deb
register: cloudflaredfile
- name: Cleanup
when: cloudflaredfile.stat.exists
ansible.builtin.command:
cmd: "rm cloudflared.deb"

View File

@ -1,86 +0,0 @@
---
- name: Send Start update
hosts: localhost
tasks:
- name: send ntfy
ansible.builtin.command:
cmd: 'curl -d "Starting updating with ansible" ntfy.ki5bhv.com/server'
- name: Proxmox Update and upgrade apt packages
hosts: proxmox
become: yes
tasks:
- name: Update packages with apt
when: ansible_pkg_mgr == 'apt'
ansible.builtin.apt:
update_cache: true
- name: Installing proxmox guest agent
when: ansible_pkg_mgr == 'apt'
ansible.builtin.apt:
name: qemu-guest-agent
state: latest
- name: Enable proxmox agent
ansible.builtin.command:
cmd: systemctl enable qemu-guest-agent
- name: Restart proxmox agent
ansible.builtin.command:
cmd: systemctl restart qemu-guest-agent
- name: Upgrade packages with apt
when: ansible_pkg_mgr == 'apt'
ansible.builtin.apt:
upgrade: dist
- name: Clean up packages with apt
when: ansible_pkg_mgr == 'apt'
ansible.builtin.apt:
autoclean: true
autoremove: true
- name: Hardware Update and upgrade apt packages
hosts: hardware
become: yes
tasks:
- name: Update packages with apt
when: ansible_pkg_mgr == 'apt'
ansible.builtin.apt:
update_cache: true
- name: Upgrade packages with apt
when: ansible_pkg_mgr == 'apt'
ansible.builtin.apt:
upgrade: dist
- name: Clean up packages with apt
when: ansible_pkg_mgr == 'apt'
ansible.builtin.apt:
autoclean: true
autoremove: true
- name: installing net-tools on all
hosts: all
become: yes
tasks:
- name: running apt
when: ansible_pkg_mgr == 'apt'
ansible.builtin.apt:
name: net-tools
state: latest
- name: Send completed update
hosts: localhost
tasks:
- name: send ntfy
ansible.builtin.command:
cmd: 'curl -d "Updated with ansible" ntfy.ki5bhv.com/server'

9
windows/ping.yml Normal file
View File

@ -0,0 +1,9 @@
---
# This playbook uses the win_ping module to test connectivity to Windows hosts
- name: Ping
hosts: all
tasks:
- name: ping
win_ping: