2023-03-30 14:28:10 +02:00
|
|
|
# ===================================================================================================
|
2023-02-27 16:39:00 +01:00
|
|
|
# ? 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.
|
2023-03-30 14:28:10 +02:00
|
|
|
# ===================================================================================================
|
2023-02-27 16:39:00 +01:00
|
|
|
|
|
|
|
|
---
|
2023-03-27 16:39:03 +02:00
|
|
|
- hosts: datacenter
|
2023-03-27 16:32:09 +02:00
|
|
|
remote_user: root
|
2023-02-27 16:39:00 +01:00
|
|
|
roles:
|
2023-03-27 16:32:09 +02:00
|
|
|
- setup
|
2023-03-30 14:50:20 +02:00
|
|
|
when: setup is defined
|
2023-02-27 16:55:31 +01:00
|
|
|
|
|
|
|
|
# Clean up the system
|
2023-03-27 16:39:03 +02:00
|
|
|
- hosts: datacenter
|
2023-02-27 17:43:29 +01:00
|
|
|
remote_user: ansible
|
2023-02-27 16:55:31 +01:00
|
|
|
become: true
|
|
|
|
|
tasks:
|
|
|
|
|
- name: cleanup package cache (debian and ubuntu)
|
|
|
|
|
apt:
|
2023-03-30 14:28:10 +02:00
|
|
|
autoclean: true
|
2023-02-27 16:55:31 +01:00
|
|
|
changed_when: false
|
|
|
|
|
when: ansible_os_family == "Debian"
|
|
|
|
|
|
|
|
|
|
- name: autoremove packages (debian and ubuntu)
|
|
|
|
|
apt:
|
2023-03-30 14:28:10 +02:00
|
|
|
autoremove: true
|
|
|
|
|
purge: true
|
2023-02-27 16:55:31 +01:00
|
|
|
when: ansible_os_family == "Debian"
|