Restructure into one folder per private repo/host, not a flat Docker/ dump
rocky-docker-lxc/, caddy-vm/, monitoring-vm/ (was missing entirely -
Grafana+Loki+Prometheus stack, refreshed and CA mount stripped same as
everything else), and automation/{ansible,automation-vm,iac}/ for the
three repos that live on the automation VM. Hawser is genuinely
deployed on all three of caddy-vm/monitoring-vm/automation-vm so it's
duplicated in each rather than picking one canonical home.
Old Ansible/ and "Infrastrucutre as Code/" content moved under
automation/ansible/old-playbooks and automation/iac/old-content as-is
for now - contents still need refreshing against the current repos and
a per-folder README, that's the next pass.
This commit is contained in:
146 files changed
+101
-84
No files matched your search
@@ -0,0 +1,65 @@
|
||||
### This is just a sample showing the way of removing apps from a VM using Ansible
|
||||
---
|
||||
- hosts: all
|
||||
become: yes
|
||||
vars:
|
||||
GOTIFY_IP: xxx #[Your gotify host IP goes here]
|
||||
GOTIFY_PORT: xxx #[Your gotify port goes here]
|
||||
GOTIFY_TOKEN: xxx #[Your app token goes here]
|
||||
|
||||
tasks:
|
||||
|
||||
- name: Ansible apt remove crowdsec
|
||||
apt:
|
||||
name: crowdsec
|
||||
state: absent
|
||||
|
||||
- name: Ansible apt remove zabbix
|
||||
apt:
|
||||
name: zabbix
|
||||
state: absent
|
||||
|
||||
- name: Ansible apt remove zabbix-agent
|
||||
apt:
|
||||
name: zabbix-agent
|
||||
state: absent
|
||||
|
||||
- name: Remove dependencies that are no longer required and purge their configuration files
|
||||
ansible.builtin.apt:
|
||||
autoremove: yes
|
||||
purge: true
|
||||
|
||||
- name: Check if reboot is required
|
||||
stat:
|
||||
path: /var/run/reboot-required
|
||||
register: reboot_required_file
|
||||
|
||||
- name: Show Output of required reboots
|
||||
debug: msg="{{ reboot_required_file.stat.exists == true }}"
|
||||
|
||||
- name: Rebooting machine
|
||||
shell: sleep 2 && shutdown -r now "Ansible updates triggered"
|
||||
async: 1
|
||||
poll: 0
|
||||
ignore_errors: true
|
||||
when: reboot_required_file.stat.exists
|
||||
|
||||
- name: Waiting for the machine to come back
|
||||
local_action: wait_for host={{ ansible_host }} state=started port=22 delay=30
|
||||
become: no
|
||||
when: reboot_required_file.stat.exists
|
||||
|
||||
- name: notify via Gotify
|
||||
uri:
|
||||
url: 'http://{{ GOTIFY_IP }}:{{ GOTIFY_PORT }}/message?token={{ GOTIFY_TOKEN }}'
|
||||
method: POST
|
||||
body:
|
||||
title:
|
||||
content: APT Packages Update
|
||||
message:
|
||||
content: The remove apps playbook has completed for {{ ansible_host }} and is now updated. A required reboot is {{ reboot_required_file.stat.exists == true }}.
|
||||
priority:
|
||||
content: '5'
|
||||
body_format: form-multipart
|
||||
register: result
|
||||
...
|
||||
Reference in new issue
Block a user