diff --git a/config-add-sshkey.yaml b/config-add-sshkey.yaml deleted file mode 100644 index 5df3ac4..0000000 --- a/config-add-sshkey.yaml +++ /dev/null @@ -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 diff --git a/install_nvim.yaml b/install_nvim.yaml deleted file mode 100644 index 1165bf4..0000000 --- a/install_nvim.yaml +++ /dev/null @@ -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 diff --git a/maint-diskspace.yaml b/maint-diskspace.yaml deleted file mode 100644 index 58b4fa2..0000000 --- a/maint-diskspace.yaml +++ /dev/null @@ -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 - diff --git a/maint-reboot-required.yaml b/maint-reboot-required.yaml deleted file mode 100644 index 4281db4..0000000 --- a/maint-reboot-required.yaml +++ /dev/null @@ -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 diff --git a/ping.yml b/ping.yml new file mode 100644 index 0000000..4e6ce01 --- /dev/null +++ b/ping.yml @@ -0,0 +1,9 @@ +--- + +- hosts: all + gather_facts: false + tasks: + - name: Ping + ansible.builtin.ping: + data: pong + diff --git a/plex.yaml b/plex.yaml deleted file mode 100644 index dd50504..0000000 --- a/plex.yaml +++ /dev/null @@ -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 diff --git a/ubuntu/install_nvim.yaml b/ubuntu/install_nvim.yaml index a265b5a..429bc34 100644 --- a/ubuntu/install_nvim.yaml +++ b/ubuntu/install_nvim.yaml @@ -1,6 +1,7 @@ --- - name: Installing Nvim - hosts: localhost + hosts: killer-laptop.ki5bhv.com + tasks: - name: make sure git is installed diff --git a/ubuntu/maint-reboot.yaml b/ubuntu/maint-reboot.yaml index a978a18..4d593b0 100644 --- a/ubuntu/maint-reboot.yaml +++ b/ubuntu/maint-reboot.yaml @@ -1,6 +1,6 @@ --- - name: Reboot machine - hosts: "{{ my_hosts | d([]) }}" + hosts: ["git-server.ki5bhv.com"] become: true tasks: diff --git a/ubuntu/update-cloudflare-tunnel.yaml b/ubuntu/update-cloudflare-tunnel.yaml index dea7cc5..254fea6 100644 --- a/ubuntu/update-cloudflare-tunnel.yaml +++ b/ubuntu/update-cloudflare-tunnel.yaml @@ -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" diff --git a/ubuntu/update.yaml b/ubuntu/update.yaml index 14ebc1e..2f4e333 100644 --- a/ubuntu/update.yaml +++ b/ubuntu/update.yaml @@ -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 diff --git a/update-cloudflace-tunnel.yaml b/update-cloudflace-tunnel.yaml deleted file mode 100644 index 83eace7..0000000 --- a/update-cloudflace-tunnel.yaml +++ /dev/null @@ -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" diff --git a/update.yaml b/update.yaml deleted file mode 100644 index 14ebc1e..0000000 --- a/update.yaml +++ /dev/null @@ -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' diff --git a/windows/ping.yml b/windows/ping.yml new file mode 100644 index 0000000..62f4707 --- /dev/null +++ b/windows/ping.yml @@ -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: +