Skip to content
Snippets Groups Projects
clean_servers.yml 3.45 KiB
#!/usr/bin/env ansible-playbook
---
# This is a special playbook to clean old stuff from BCFG2
# it will disapear when BCFG2 will disapear
# `apt-mark showmanual` is a good start
- hosts: server,test_vm
  tasks:
    - name: Clean up unused packages
      apt:
        state: absent
        name:
          - acpid
          - apt-dater-host
          - arpwatch  # old sniffing
          - at
          - bcfg2
          - byobu  # we already have screen and tmux
          - collectd
          - collectd-utils  # old monitoring
          - debian-faq  # graphical
          - doc-debian  # graphical
          - icinga2
          - icinga2-bin
          - icinga2-common
          - icinga2-ido-pgsql
          - icinga2-node  # old monitoring
          - ipython  # go use ipython3!
          - irqbalance  # removed in newer debian
          - libmonitoring-plugin-perl
          - monit
          - monitoring-plugins
          - monitoring-plugins-basic
          - monitoring-plugins-common
          - monitoring-plugins-standard
          - munin-common
          - munin-node  # old monitoring
          - munin  # old monitoring
          - munin-plugins-core
          - munin-plugins-extra
          - nagios-nrpe-server
          - nagios-plugins-contrib
          - openbsd-inetd
          - os-prober  # makes grub-install lag
          - popularity-contest
          - python3-nagiosplugin
          - python3-reportbug
          - python-nagiosplugin
          - ramond  # remplaced by ra-guard on switchs
          - snmp
          - sysstat  # very old monitoring
          - xscreensaver  # was on owncloud
      register: apt_result
      retries: 3
      until: apt_result is succeeded

    - name: Clean unwanted olderstuff
      apt:
        autoremove: true
        purge: true
      register: apt_result
      retries: 3
      until: apt_result is succeeded

    - name: Remove old conf
      file:
        path: "{{ item }}"
        state: absent
      loop:
        - /etc/apt/apt.conf.d/01aptitude
        - /etc/apt/apt.conf.d/70debconf