From 95eda891df662650b8e73268f3f1a02d10a3869a Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Sat, 17 Oct 2020 17:13:13 +0200 Subject: [PATCH] Disable apport, and remove lxd by default --- library/roles/ubuntu-deb-general/defaults/main.yml | 13 +++++++------ .../roles/ubuntu-deb-general/tasks/apt-proxy.yml | 2 +- .../tasks/disable-unneeded-services.yml | 8 ++++++++ library/roles/ubuntu-deb-general/tasks/munin.yml | 2 +- .../tasks/remove-unneeded-pkgs.yml | 6 ++++++ 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/library/roles/ubuntu-deb-general/defaults/main.yml b/library/roles/ubuntu-deb-general/defaults/main.yml index ce1c747..6f9c140 100644 --- a/library/roles/ubuntu-deb-general/defaults/main.yml +++ b/library/roles/ubuntu-deb-general/defaults/main.yml @@ -70,6 +70,7 @@ cleanup_base_packages: True base_packages_to_remove: - ppp - at + - snapd cleanup_x_base_packages: False x_base_packages_to_remove: @@ -92,6 +93,12 @@ exim_email_server_pkgs: - exim4-config - exim4-daemon-light +disable_apport_service: True +ubuntu_remove_lxd: True +ubuntu_lxd_pkgs: + - lxd + - lxcfs + disable_some_not_needed_services: False services_to_be_disabled: - rpcbind @@ -150,12 +157,6 @@ default_security_limits: '{{ root_security_limits }}' # # debian/ubuntu distributions controllers # -has_default_grub: "'{{ ansible_distribution }}' == 'Debian' and '{{ ansible_distribution_version }}' != 'lenny/sid' and {{ ansible_distribution_major_version }} >= 6" - -has_htop: "'{{ ansible_distribution }}' == 'Ubuntu' and ({{ ansible_distribution_version }} == 10.10 or {{ ansible_distribution_version }} == 11.04 or {{ ansible_distribution_version }} == 12.04)" - -has_apt: "('{{ ansible_distribution }}' == 'Debian' or '{{ ansible_distribution }}' == 'Ubuntu') and '{{ ansible_distribution_version }}' != 'lenny/sid' and '{{ ansible_distribution_major_version }}' >= 5" - has_fail2ban: "(('{{ ansible_distribution }}' == 'Ubuntu') and ({{ ansible_distribution_major_version }} >= 14)) or (('{{ ansible_distribution }}' == 'Debian') and ({{ ansible_distribution_major_version }} >= 8))" is_debian: "'{{ ansible_distribution }}' == 'Debian'" diff --git a/library/roles/ubuntu-deb-general/tasks/apt-proxy.yml b/library/roles/ubuntu-deb-general/tasks/apt-proxy.yml index 50c987a..14fe6ec 100644 --- a/library/roles/ubuntu-deb-general/tasks/apt-proxy.yml +++ b/library/roles/ubuntu-deb-general/tasks/apt-proxy.yml @@ -1,6 +1,6 @@ --- - name: setup apt cache template: src=02proxy.j2 dest=/etc/apt/apt.conf.d/02proxy - when: has_apt + when: ansible_distribution_file_variety == "Debian" tags: - aptproxy diff --git a/library/roles/ubuntu-deb-general/tasks/disable-unneeded-services.yml b/library/roles/ubuntu-deb-general/tasks/disable-unneeded-services.yml index 68884cb..1953635 100644 --- a/library/roles/ubuntu-deb-general/tasks/disable-unneeded-services.yml +++ b/library/roles/ubuntu-deb-general/tasks/disable-unneeded-services.yml @@ -4,3 +4,11 @@ with_items: '{{ services_to_be_disabled }}' when: disable_some_not_needed_services tags: [ 'bootstrap', 'disable_services' ] + +- name: Disable some unneeded services + service: name=apport state=stopped enabled=no + when: + - disable_apport_service + - ansible_distribution == "Ubuntu" + - ansible_distribution_version is version_compare('18.04', '<') + tags: [ 'bootstrap', 'disable_services', 'apport' ] diff --git a/library/roles/ubuntu-deb-general/tasks/munin.yml b/library/roles/ubuntu-deb-general/tasks/munin.yml index d26eb11..2769815 100644 --- a/library/roles/ubuntu-deb-general/tasks/munin.yml +++ b/library/roles/ubuntu-deb-general/tasks/munin.yml @@ -1,7 +1,7 @@ --- - name: install munin-node apt: pkg=munin-node state=present - when: has_apt + when: ansible_distribution_file_variety == "Debian" tags: - packages - munin diff --git a/library/roles/ubuntu-deb-general/tasks/remove-unneeded-pkgs.yml b/library/roles/ubuntu-deb-general/tasks/remove-unneeded-pkgs.yml index f551bca..74e6361 100644 --- a/library/roles/ubuntu-deb-general/tasks/remove-unneeded-pkgs.yml +++ b/library/roles/ubuntu-deb-general/tasks/remove-unneeded-pkgs.yml @@ -26,3 +26,9 @@ when: cleanup_exim_email_server tags: [ 'packages', 'pkg_cleanup', 'exim' ] + +- name: Remove LXD + apt: name={{ ubuntu_lxd_pkgs }} state=absent + when: ubuntu_remove_lxd + tags: [ 'packages', 'pkg_cleanup', 'lxd' ] +