feat: add Ansible playbooks for Docker management, system updates, and host configuration

This commit is contained in:
Justin 2026-04-14 15:56:26 -05:00
parent 473065199f
commit 56edb6a70d
7 changed files with 68 additions and 25 deletions

View File

@ -0,0 +1,26 @@
---
- name: Install Docker and Docker Compose plugin
hosts: killer2.ki5bhv.com
become: true
tasks:
- name: Update apt package index
ansible.builtin.apt:
update_cache: true
- name: Ensure required packages for Docker are installed
ansible.builtin.apt:
name:
- ca-certificates
- curl
- gnupg
- lsb-release
state: present
# The following steps are typically part of a full Docker installation playbook
# to set up the official Docker repository, but are omitted here for brevity.
# If you install Docker from the standard Ubuntu repos, the following task is sufficient:
- name: Install the Docker Compose plugin
ansible.builtin.apt:
name: docker-compose-plugin
state: present

View File

@ -1,6 +1,6 @@
--- ---
- name: Clean docker - name: Clean docker
hosts: k5bss.com hosts: ki5bhv.com
tasks: tasks:
- name: Prune non-dangling images - name: Prune non-dangling images

View File

@ -1,6 +1,6 @@
--- ---
- name: Deploy Docker Compose stack with pull and restart - name: Deploy Docker Compose stack with pull and restart
hosts: k5bss.com hosts: ki5bhv.com
become: true become: true
tasks: tasks:
- name: Qbits - name: Qbits

View File

@ -1,8 +1,9 @@
--- ---
- name: Deploy Docker Compose stack with pull and restart - name: Deploy Docker Compose stack with pull and restart
hosts: k5bss.com hosts: ki5bhv.com
become: true become: true
tasks: tasks:
- name: Qbits - name: Qbits
community.docker.docker_compose_v2: community.docker.docker_compose_v2:
project_src: /home/justin/docker/qbits/ project_src: /home/justin/docker/qbits/

24
host Normal file
View File

@ -0,0 +1,24 @@
[linux]
cloudflare-tunnel.ki5bhv.com
pi-hole-server.ki5bhv.com
mediaserver.ki5bhv.com
webhost.ki5bhv.com
gitserver.ki5bhv.com
ansible.ki5bhv.com
minecraft.ki5bhv.com
ki5bhv.com
[proxmox]
cloudflare-tunnel.ki5bhv.com
pi-hole-server.ki5bhv.com
webhost.ki5bhv.com
gitserver.ki5bhv.com
ansible.ki5bhv.com
minecraft.ki5bhv.com
ki5bhv.com
[hardware]
mediaserver.ki5bhv.com
[other]

View File

@ -1,6 +1,6 @@
--- ---
- name: Add ssh key - name: Add ssh key
hosts: killer-laptop.ki5bhv.com hosts: all
become: true become: true
tasks: tasks:
@ -12,7 +12,7 @@
ansible.posix.authorized_key: ansible.posix.authorized_key:
user: "{{ lookup('env', 'USER') }}" user: "{{ lookup('env', 'USER') }}"
state: present state: present
key: "{{ lookup('file', '~/.ssh/id_ed25519.pub') }}" key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
- name: Change sudoers file - name: Change sudoers file
ansible.builtin.lineinfile: ansible.builtin.lineinfile:

View File

@ -8,40 +8,34 @@
cmd: 'curl -d "Starting updating with ansible" ntfy.ki5bhv.com/server' cmd: 'curl -d "Starting updating with ansible" ntfy.ki5bhv.com/server'
- name: Proxmox Update and upgrade apt packages - name: Proxmox Update and upgrade apt packages
hosts: proxmox hosts: proxmox
become: yes become: yes
serial: 1 serial: 1
tasks: tasks:
- name: Update packages with apt - name: Update packages with apt
when: ansible_pkg_mgr == 'apt' when: ansible_facts['pkg_mgr'] == 'apt'
ansible.builtin.apt: ansible.builtin.apt:
update_cache: true update_cache: true
- name: Installing proxmox guest agent - name: Installing proxmox guest agent
when: ansible_pkg_mgr == 'apt' when: ansible_facts['pkg_mgr'] == 'apt'
ansible.builtin.apt: ansible.builtin.apt:
name: qemu-guest-agent name: qemu-guest-agent
state: latest state: latest
- name: Enable proxmox agent - name: Enable and restart proxmox agent
ansible.builtin.service:
name: qemu-guest-agent
state: started
- name: Restart proxmox agent
ansible.builtin.service: ansible.builtin.service:
name: qemu-guest-agent name: qemu-guest-agent
state: restarted state: restarted
- name: Upgrade packages with apt - name: Upgrade packages with apt
when: ansible_pkg_mgr == 'apt' when: ansible_facts['pkg_mgr'] == 'apt'
ansible.builtin.apt: ansible.builtin.apt:
upgrade: dist upgrade: dist
- name: Clean up packages with apt - name: Clean up packages with apt
when: ansible_pkg_mgr == 'apt' when: ansible_facts['pkg_mgr'] == 'apt'
ansible.builtin.apt: ansible.builtin.apt:
autoclean: true autoclean: true
autoremove: true autoremove: true
@ -52,18 +46,17 @@
tasks: tasks:
- name: Update packages with apt - name: Update packages with apt
when: ansible_pkg_mgr == 'apt' when: ansible_facts['pkg_mgr'] == 'apt'
ansible.builtin.apt: ansible.builtin.apt:
update_cache: true update_cache: true
- name: Upgrade packages with apt - name: Upgrade packages with apt
when: ansible_pkg_mgr == 'apt' when: ansible_facts['pkg_mgr'] == 'apt'
ansible.builtin.apt: ansible.builtin.apt:
upgrade: dist upgrade: dist
- name: Clean up packages with apt - name: Clean up packages with apt
when: ansible_pkg_mgr == 'apt' when: ansible_facts['pkg_mgr'] == 'apt'
ansible.builtin.apt: ansible.builtin.apt:
autoclean: true autoclean: true
autoremove: true autoremove: true
@ -71,15 +64,14 @@
- name: installing net-tools on all - name: installing net-tools on all
hosts: all hosts: all
become: yes become: yes
tasks: tasks:
- name: running apt - name: running apt
when: ansible_pkg_mgr == 'apt' when: ansible_facts['pkg_mgr'] == 'apt'
ansible.builtin.apt: ansible.builtin.apt:
name: net-tools name: net-tools
state: latest state: latest
- name: Send completed update - name: Send completed update
hosts: localhost hosts: localhost