From 0a4c335e64a2118f7d0d0bd58955b1b99b3d83e7 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Tue, 17 Nov 2020 17:34:49 +0100 Subject: [PATCH] Fix some broken variables. --- .../centos/roles/centos-bootstrap/meta/main.yml | 4 ++++ library/roles/deb-apt-setup/tasks/main.yml | 4 +++- .../tasks/disable-unneeded-services.yml | 2 +- library/roles/ubuntu-deb-general/tasks/main.yml | 7 +++---- .../roles/ubuntu-deb-general/tasks/packages.yml | 12 +++++++++--- .../tasks/remove-unneeded-pkgs.yml | 5 +---- .../ubuntu-deb-general/tasks/rsyslogfix.yml | 16 ---------------- 7 files changed, 21 insertions(+), 29 deletions(-) diff --git a/library/centos/roles/centos-bootstrap/meta/main.yml b/library/centos/roles/centos-bootstrap/meta/main.yml index db4eb28b..9a7bfe1d 100644 --- a/library/centos/roles/centos-bootstrap/meta/main.yml +++ b/library/centos/roles/centos-bootstrap/meta/main.yml @@ -2,6 +2,10 @@ dependencies: - role: '../../library/centos/roles/external-repos' - role: '../../library/centos/roles/basic-setup' + - src: git+https://gitea-s2i2s.isti.cnr.it/ISTI-ansible-roles/ansible-role-basic-system-setup.git + version: master + name: basic-system-setup + state: latest - role: '../../library/roles/motd' - role: '../../library/roles/linux-kernel-sysctl' - role: '../../library/centos/roles/tuned-setup' diff --git a/library/roles/deb-apt-setup/tasks/main.yml b/library/roles/deb-apt-setup/tasks/main.yml index 9c7c6fb5..b3387b17 100644 --- a/library/roles/deb-apt-setup/tasks/main.yml +++ b/library/roles/deb-apt-setup/tasks/main.yml @@ -6,6 +6,8 @@ - name: Install python-software-properties apt: pkg=python-software-properties state=present update_cache=yes cache_valid_time=3600 - when: is_trusty + when: + - ansible_distribution == 'Ubuntu' + - ansible_distribution_version is version_compare('14.04', '==') tags: pythonapt 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 19536353..98443d80 100644 --- a/library/roles/ubuntu-deb-general/tasks/disable-unneeded-services.yml +++ b/library/roles/ubuntu-deb-general/tasks/disable-unneeded-services.yml @@ -10,5 +10,5 @@ when: - disable_apport_service - ansible_distribution == "Ubuntu" - - ansible_distribution_version is version_compare('18.04', '<') + - ansible_distribution_version is version_compare('18.04', '>=') tags: [ 'bootstrap', 'disable_services', 'apport' ] diff --git a/library/roles/ubuntu-deb-general/tasks/main.yml b/library/roles/ubuntu-deb-general/tasks/main.yml index 2e2419cb..bd9c1dd8 100644 --- a/library/roles/ubuntu-deb-general/tasks/main.yml +++ b/library/roles/ubuntu-deb-general/tasks/main.yml @@ -9,9 +9,9 @@ when: install_nscd - import_tasks: remove-unneeded-pkgs.yml - import_tasks: denyhost.yml - when: is_debian_7_or_older -- import_tasks: denyhost.yml - when: is_ubuntu_less_than_trusty + when: + - ansible_distribution == "Debian" + - ansible_distribution_release == "wheezy" - import_tasks: munin.yml when: configure_munin - import_tasks: pubkeys.yml @@ -27,4 +27,3 @@ - import_tasks: manage_su_limits.yml - import_tasks: disable-unneeded-services.yml - diff --git a/library/roles/ubuntu-deb-general/tasks/packages.yml b/library/roles/ubuntu-deb-general/tasks/packages.yml index 7e998911..5f56fef1 100644 --- a/library/roles/ubuntu-deb-general/tasks/packages.yml +++ b/library/roles/ubuntu-deb-general/tasks/packages.yml @@ -25,17 +25,23 @@ - name: Default the backports repository on debian 7 copy: src=backports-wheezy dest=/etc/apt/preferences.d/backports owner=root group=root mode=644 - when: is_debian7 | bool + when: + - ansible_distribution == "Debian" + - ansible_distribution_release == "wheezy" tags: wheezy-backports - name: Install the backports repository on debian 7 apt_repository: repo='deb http://http.debian.net/debian wheezy-backports main' state=present update_cache=yes - when: is_debian7 | bool + when: + - ansible_distribution == "Debian" + - ansible_distribution_release == "wheezy" tags: wheezy-backports - name: Install the backports repository on debian 8 apt_repository: repo='deb http://http.debian.net/debian jessie-backports main' state=present update_cache=yes - when: is_debian8 | bool + when: + - ansible_distribution == "Debian" + - ansible_distribution_release == "jessie" tags: jessie-backports - name: install common packages 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 74e63617..e57b10ac 100644 --- a/library/roles/ubuntu-deb-general/tasks/remove-unneeded-pkgs.yml +++ b/library/roles/ubuntu-deb-general/tasks/remove-unneeded-pkgs.yml @@ -11,9 +11,7 @@ - name: Remove the nfs packages apt: pkg={{ nfs_packages }} state=absent - when: - - is_not_precise - - cleanup_nfs_packages + when: cleanup_nfs_packages tags: [ 'packages', 'pkg_cleanup' ] - name: Remove rpcbind packages @@ -26,7 +24,6 @@ when: cleanup_exim_email_server tags: [ 'packages', 'pkg_cleanup', 'exim' ] - - name: Remove LXD apt: name={{ ubuntu_lxd_pkgs }} state=absent when: ubuntu_remove_lxd diff --git a/library/roles/ubuntu-deb-general/tasks/rsyslogfix.yml b/library/roles/ubuntu-deb-general/tasks/rsyslogfix.yml index 3e917e3c..597e58f5 100644 --- a/library/roles/ubuntu-deb-general/tasks/rsyslogfix.yml +++ b/library/roles/ubuntu-deb-general/tasks/rsyslogfix.yml @@ -1,20 +1,4 @@ --- -- name: Fix rsyslog behaviour on some ubuntu machines disabling the kernel logger - lineinfile: dest=/etc/rsyslog.conf regexp="\\$ModLoad\ imklog" line="#$ModLoad imklog" backup=yes - when: - - is_precise and ansible_kernel != "3.2.0-4-amd64" - - is_not_trusty - notify: Restart rsyslog - tags: rsyslog - -- name: Enable the kernel logger on ubuntu >= 12.04 and kernel major version >= 3 - lineinfile: dest=/etc/rsyslog.conf line="$ModLoad imklog " insertafter="\\$ModLoad\ imuxsock" backup=yes - when: - - is_precise and ansible_kernel == "3.2.0-4-amd64" - - is_trusty - notify: Restart rsyslog - tags: rsyslog - - name: Install custom rsyslog rules template: src=10-custom_rules.conf.j2 dest=/etc/rsyslog.d/10-custom_rules.conf owner=root group=root mode=0444 when: default_rsyslog_custom_rules is defined