Files
ansible-automations/site.yml
Noah Knegt b0534951d6
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Only run the setup role when var is defined
Signed-off-by: Noah Knegt <git@noahknegt.com>
2023-03-30 14:40:11 +02:00

33 lines
1019 B
YAML

# ===================================================================================================
# ? ABOUT
# @author : Noah Knegt
# @email : personal@noahknegt.com
# @repo : https://git.noahknegt.com/noah.knegt/ansible-automations
# @createdOn : 27-02-2023
# @description : This will apply the base configuration to the list of machines.
# ===================================================================================================
---
- hosts: datacenter
remote_user: root
roles:
- setup
when: setup == true
# Clean up the system
- hosts: datacenter
remote_user: ansible
become: true
tasks:
- name: cleanup package cache (debian and ubuntu)
apt:
autoclean: true
changed_when: false
when: ansible_os_family == "Debian"
- name: autoremove packages (debian and ubuntu)
apt:
autoremove: true
purge: true
when: ansible_os_family == "Debian"