Files
vmn-ansible/playbooks/maintain.yaml
T

50 lines
1.4 KiB
YAML

---
- name: Perform regular maintenance
hosts: virtual
remote_user: ansible
vars_files:
../inventory/group_vars/all/secrets.yaml
roles:
# Check the Internet connection
# Check free disk space
- ../roles/common_healthcheck
# Ensure that all the required packages are installed
- ../roles/base_system
# Update the system
- ../roles/update_system
# Harden SSH - we must be sure that the last version of ssh configs are distributed
- ../roles/harden_ssh
# Update configs - omz, nvim, ranger and so on. Distribute the last version of those configs
- ../roles/update_configs
# Make sure that the services that are supposed to run are running
- ../roles/check_services
- name: Ensure all web-servers have fresh TLS certificates
hosts: web-servers
remote_user: ansible
vars_files:
../inventory/group_vars/all/secrets.yaml
roles:
# Pull certificates from cert_proxy and distribute them among the servers
- ../roles/update_certificates
post_tasks:
- name: Delete certificates from cert-proxy
ansible.builtin.file:
name: /tmp/letsencrypt
state: absent
when: "inventory_hostname == 'cert-proxy'"
run_once: true
- name: Delete certificates from ansible-server
ansible.builtin.file:
name: /tmp/letsencrypt
state: absent
run_once: true
delegate_to: 127.0.0.1