From: Alexander Barton Date: Thu, 18 Oct 2018 16:32:15 +0000 (+0200) Subject: Update "apt" tasks to use lists X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=AnsibleRoles.git;a=commitdiff_plain;h=67cd2b0e9d706393b4e3496c54cb71ebc61b39fa Update "apt" tasks to use lists This fixes the following deprecation warning: 'Invoking "apt" only once while using a loop via squash_actions is deprecated. Instead of using a loop to supply multiple items and specifying `name: {{ item }}`' --- diff --git a/roles/apache2-php5/tasks/main.yml b/roles/apache2-php5/tasks/main.yml index 7bcd63f..1fa1048 100644 --- a/roles/apache2-php5/tasks/main.yml +++ b/roles/apache2-php5/tasks/main.yml @@ -15,14 +15,14 @@ tags: - apache - packages - apt: > - state=present - name={{ item }} - with_items: - - libapache2-mod-php5 - - php5 - - php5-cli - - php5-mysql + apt: + state: present + name: [ + 'libapache2-mod-php5', + 'php5', + 'php5-cli', + 'php5-mysql', + ] notify: - restart "apache2" diff --git a/roles/apache2-php7/tasks/main.yml b/roles/apache2-php7/tasks/main.yml index 62a2c67..145066b 100644 --- a/roles/apache2-php7/tasks/main.yml +++ b/roles/apache2-php7/tasks/main.yml @@ -5,15 +5,15 @@ tags: - apache - packages - apt: > - state=present - name={{ item }} - with_items: - - libapache2-mod-php - - php - - php-cli - - php-mysql - - php-pgsql + apt: + state: present + name: [ + 'libapache2-mod-php', + 'php', + 'php-cli', + 'php-mysql', + 'php-pgsql', + ] notify: - restart "apache2" diff --git a/roles/apache2/tasks/main.yml b/roles/apache2/tasks/main.yml index 0a890a9..a71af82 100644 --- a/roles/apache2/tasks/main.yml +++ b/roles/apache2/tasks/main.yml @@ -5,13 +5,13 @@ tags: - apache - packages - apt: > - state=present - name={{ item }} - with_items: - - apache2 - - apache2-utils - - apachetop + apt: + state: present + name: [ + 'apache2', + 'apache2-utils', + 'apachetop', + ] notify: - restart "apache2" diff --git a/roles/check-mk-agent/tasks/main.yml b/roles/check-mk-agent/tasks/main.yml index 3bfc39d..b84a240 100644 --- a/roles/check-mk-agent/tasks/main.yml +++ b/roles/check-mk-agent/tasks/main.yml @@ -6,12 +6,12 @@ - check_mk - monitoring - packages - apt: > - state=present - name={{ item }} - with_items: - - check-mk-agent - - nagios-plugins-basic + apt: + state: present + name: [ + 'check-mk-agent', + 'nagios-plugins-basic', + ] - name: install Debian packages for Check_MK agent (2/2) tags: diff --git a/roles/debian-base/tasks/main.yml b/roles/debian-base/tasks/main.yml index 4c6f6c0..199cf46 100644 --- a/roles/debian-base/tasks/main.yml +++ b/roles/debian-base/tasks/main.yml @@ -4,35 +4,33 @@ - name: install common packages tags: - packages - apt: > - state=present - name={{ item }} - with_items: - - bash-completion - - ca-certificates - - curl - - debconf-utils - - etckeeper - - git - - htop - - less - - lsb-base - - lsb-release - - psmisc - - net-tools - - screen - - sudo - - telnet-ssl - - vim + apt: + state: present + name: [ + 'bash-completion', + 'ca-certificates', + 'curl', + 'debconf-utils', + 'etckeeper', + 'git', + 'htop', + 'less', + 'lsb-base', + 'lsb-release', + 'psmisc', + 'net-tools', + 'screen', + 'sudo', + 'telnet-ssl', + 'vim', + ] - name: install common packages (non Proxmox-VE hosts) tags: - packages apt: > state=present - name={{ item }} - with_items: - - busybox-static + name=busybox-static when: "ansible_kernel.find('pve') < 1" - name: install Linux kernel packages (amd64; non Proxmox-VE hosts, non OpenVZ guest) diff --git a/roles/docker-engine/tasks/main.yml b/roles/docker-engine/tasks/main.yml index 7a7cbd8..acda775 100644 --- a/roles/docker-engine/tasks/main.yml +++ b/roles/docker-engine/tasks/main.yml @@ -5,12 +5,12 @@ tags: - docker - packages - apt: > - name={{ item }} - state=present - with_items: - - apt-transport-https - - ca-certificates + apt: + name: [ + 'apt-transport-https', + 'ca-certificates', + ] + state: present when: docker_apt_repository.startswith("https://") - name: install docker.io repository GnuPG key diff --git a/roles/git-backup-script/tasks/main.yml b/roles/git-backup-script/tasks/main.yml index 031805b..5375bee 100644 --- a/roles/git-backup-script/tasks/main.yml +++ b/roles/git-backup-script/tasks/main.yml @@ -4,12 +4,12 @@ - name: install "rsync" and "make" tags: - packages - apt: > - state=present - name={{ item }} - with_items: - - rsync - - make + apt: + state: present + name: [ + 'rsync', + 'make', + ] - name: clone "backup-script" GIT repository tags: diff --git a/roles/kexec/tasks/main.yml b/roles/kexec/tasks/main.yml index 081870b..4beb639 100644 --- a/roles/kexec/tasks/main.yml +++ b/roles/kexec/tasks/main.yml @@ -7,9 +7,7 @@ - kexec apt: > state=present - name={{ item }} - with_items: - - kexec-tools + name=kexec-tools - name: configure kexec tools tags: diff --git a/roles/lcmc-cluster-node/tasks/main.yml b/roles/lcmc-cluster-node/tasks/main.yml index 6f17f62..c3c7f90 100644 --- a/roles/lcmc-cluster-node/tasks/main.yml +++ b/roles/lcmc-cluster-node/tasks/main.yml @@ -4,10 +4,10 @@ - name: install packages for cluster nodes tags: - packages - apt: > - state=present - name={{ item }} - with_items: - - drbd8-utils - - pacemaker - - corosync + apt: + state: present + name: [ + 'drbd8-utils', + 'pacemaker', + 'corosync', + ] diff --git a/roles/mysql-server/tasks/main.yml b/roles/mysql-server/tasks/main.yml index acd80dc..defacac 100644 --- a/roles/mysql-server/tasks/main.yml +++ b/roles/mysql-server/tasks/main.yml @@ -19,14 +19,14 @@ - mysql - mysqld - packages - apt: > - state=present - name={{ item }} - with_items: - - mysql-client - - mysql-server - - mysqltuner - - python-mysqldb + apt: + state: present + name: [ + 'mysql-client', + 'mysql-server', + 'mysqltuner', + 'python-mysqldb', + ] - name: ensure service "mysql" is enabled and started tags: diff --git a/roles/nodejs/tasks/main.yml b/roles/nodejs/tasks/main.yml index 7c72f00..a417ec4 100644 --- a/roles/nodejs/tasks/main.yml +++ b/roles/nodejs/tasks/main.yml @@ -6,11 +6,11 @@ - nodejs - packages apt: - name: "{{ item }}" + name: [ + 'apt-transport-https', + 'ca-certificates', + ] state: present - with_items: - - apt-transport-https - - ca-certificates when: nodejs_apt_repository.startswith("https://") - name: install Node.js repository GnuPG key diff --git a/roles/ntpd/tasks/main.yml b/roles/ntpd/tasks/main.yml index 43370f6..a70f682 100644 --- a/roles/ntpd/tasks/main.yml +++ b/roles/ntpd/tasks/main.yml @@ -17,12 +17,12 @@ tags: - ntpd - packages - apt: > - name={{ item }} - state=present - with_items: - - ntpdate - - ntp + apt: + name: [ + 'ntpdate', + 'ntp', + ] + state: present - name: ensure service "ntp" is enabled and started tags: diff --git a/roles/piwik/tasks/main.yml b/roles/piwik/tasks/main.yml index 3beeb55..00e8239 100644 --- a/roles/piwik/tasks/main.yml +++ b/roles/piwik/tasks/main.yml @@ -5,12 +5,12 @@ tags: - docker - packages - apt: > - name={{ item }} - state=present - with_items: - - apt-transport-https - - ca-certificates + apt: + name: [ + 'apt-transport-https', + 'ca-certificates', + ] + state: present when: piwik_apt_repository.startswith("https://") - name: install Piwik repository GnuPG key diff --git a/roles/postgresql-server/tasks/main.yml b/roles/postgresql-server/tasks/main.yml index fa2dd38..a090ae7 100644 --- a/roles/postgresql-server/tasks/main.yml +++ b/roles/postgresql-server/tasks/main.yml @@ -20,9 +20,7 @@ - postgresql apt: > state=present - name={{ item }} - with_items: - - postgresql-{{ postgresql_major }} + name=postgresql-{{ postgresql_major }} - name: ensure service "postgresql" is enabled and started tags: diff --git a/roles/ubuntu-base/tasks/main.yml b/roles/ubuntu-base/tasks/main.yml index d0ff788..7e11139 100644 --- a/roles/ubuntu-base/tasks/main.yml +++ b/roles/ubuntu-base/tasks/main.yml @@ -4,25 +4,25 @@ - name: install common packages tags: - packages - apt: > - state=present - name={{ item }} - with_items: - - bash-completion - - busybox-static - - ca-certificates - - curl - - debconf-utils - - etckeeper - - git - - htop - - less - - linux-image-generic - - lsb-base - - lsb-release - - psmisc - - net-tools - - screen - - sudo - - telnet-ssl - - vim + apt: + state: present + name: [ + 'bash-completion', + 'busybox-static', + 'ca-certificates', + 'curl', + 'debconf-utils', + 'etckeeper', + 'git', + 'htop', + 'less', + 'linux-image-generic', + 'lsb-base', + 'lsb-release', + 'psmisc', + 'net-tools', + 'screen', + 'sudo', + 'telnet-ssl', + 'vim', + ] diff --git a/roles/xinetd/tasks/main.yml b/roles/xinetd/tasks/main.yml index f649945..a8f8e46 100644 --- a/roles/xinetd/tasks/main.yml +++ b/roles/xinetd/tasks/main.yml @@ -6,6 +6,4 @@ - packages apt: > state=present - name={{ item }} - with_items: - - xinetd + name=xinetd