feat: add Ansible playbooks for Docker management, system updates, and host configuration
This commit is contained in:
parent
473065199f
commit
56edb6a70d
|
|
@ -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
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
- name: Clean docker
|
||||
hosts: k5bss.com
|
||||
hosts: ki5bhv.com
|
||||
|
||||
tasks:
|
||||
- name: Prune non-dangling images
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
- name: Deploy Docker Compose stack with pull and restart
|
||||
hosts: k5bss.com
|
||||
hosts: ki5bhv.com
|
||||
become: true
|
||||
tasks:
|
||||
- name: Qbits
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
---
|
||||
- name: Deploy Docker Compose stack with pull and restart
|
||||
hosts: k5bss.com
|
||||
hosts: ki5bhv.com
|
||||
become: true
|
||||
tasks:
|
||||
|
||||
- name: Qbits
|
||||
community.docker.docker_compose_v2:
|
||||
project_src: /home/justin/docker/qbits/
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
- name: Add ssh key
|
||||
hosts: killer-laptop.ki5bhv.com
|
||||
hosts: all
|
||||
become: true
|
||||
|
||||
tasks:
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
ansible.posix.authorized_key:
|
||||
user: "{{ lookup('env', 'USER') }}"
|
||||
state: present
|
||||
key: "{{ lookup('file', '~/.ssh/id_ed25519.pub') }}"
|
||||
key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
|
||||
|
||||
- name: Change sudoers file
|
||||
ansible.builtin.lineinfile:
|
||||
|
|
|
|||
|
|
@ -8,40 +8,34 @@
|
|||
cmd: 'curl -d "Starting updating with ansible" ntfy.ki5bhv.com/server'
|
||||
|
||||
- name: Proxmox Update and upgrade apt packages
|
||||
hosts: proxmox
|
||||
hosts: proxmox
|
||||
become: yes
|
||||
serial: 1
|
||||
|
||||
tasks:
|
||||
- name: Update packages with apt
|
||||
when: ansible_pkg_mgr == 'apt'
|
||||
when: ansible_facts['pkg_mgr'] == 'apt'
|
||||
ansible.builtin.apt:
|
||||
update_cache: true
|
||||
|
||||
- name: Installing proxmox guest agent
|
||||
when: ansible_pkg_mgr == 'apt'
|
||||
when: ansible_facts['pkg_mgr'] == 'apt'
|
||||
ansible.builtin.apt:
|
||||
name: qemu-guest-agent
|
||||
state: latest
|
||||
|
||||
- name: Enable proxmox agent
|
||||
ansible.builtin.service:
|
||||
name: qemu-guest-agent
|
||||
state: started
|
||||
|
||||
- name: Restart proxmox agent
|
||||
- name: Enable and restart proxmox agent
|
||||
ansible.builtin.service:
|
||||
name: qemu-guest-agent
|
||||
state: restarted
|
||||
|
||||
|
||||
- name: Upgrade packages with apt
|
||||
when: ansible_pkg_mgr == 'apt'
|
||||
when: ansible_facts['pkg_mgr'] == 'apt'
|
||||
ansible.builtin.apt:
|
||||
upgrade: dist
|
||||
|
||||
- name: Clean up packages with apt
|
||||
when: ansible_pkg_mgr == 'apt'
|
||||
when: ansible_facts['pkg_mgr'] == 'apt'
|
||||
ansible.builtin.apt:
|
||||
autoclean: true
|
||||
autoremove: true
|
||||
|
|
@ -52,18 +46,17 @@
|
|||
|
||||
tasks:
|
||||
- name: Update packages with apt
|
||||
when: ansible_pkg_mgr == 'apt'
|
||||
when: ansible_facts['pkg_mgr'] == 'apt'
|
||||
ansible.builtin.apt:
|
||||
update_cache: true
|
||||
|
||||
|
||||
- name: Upgrade packages with apt
|
||||
when: ansible_pkg_mgr == 'apt'
|
||||
when: ansible_facts['pkg_mgr'] == 'apt'
|
||||
ansible.builtin.apt:
|
||||
upgrade: dist
|
||||
|
||||
- name: Clean up packages with apt
|
||||
when: ansible_pkg_mgr == 'apt'
|
||||
when: ansible_facts['pkg_mgr'] == 'apt'
|
||||
ansible.builtin.apt:
|
||||
autoclean: true
|
||||
autoremove: true
|
||||
|
|
@ -71,15 +64,14 @@
|
|||
- name: installing net-tools on all
|
||||
hosts: all
|
||||
become: yes
|
||||
|
||||
tasks:
|
||||
- name: running apt
|
||||
when: ansible_pkg_mgr == 'apt'
|
||||
when: ansible_facts['pkg_mgr'] == 'apt'
|
||||
ansible.builtin.apt:
|
||||
name: net-tools
|
||||
name: net-tools
|
||||
state: latest
|
||||
|
||||
|
||||
|
||||
- name: Send completed update
|
||||
hosts: localhost
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue