From 438bf4fd4ad4ae356ec87d37b6a5c37ed5863568 Mon Sep 17 00:00:00 2001
From: Robin Sonnabend <robin@fsmpi.rwth-aachen.de>
Date: Wed, 17 Oct 2018 17:04:16 +0200
Subject: [PATCH] Remove with_items from apt

---
 debian-repository/tasks/main.yml |  4 +---
 dokuwiki/tasks/main.yml          | 15 +++++++--------
 php-fpm/tasks/main.yml           | 11 ++++-------
 sentry/tasks/main.yml            | 27 ++++++++++++++-------------
 shibboleth/tasks/main.yml        | 17 +++++++++--------
 uwsgi-python/tasks/app.yml       | 31 +++++++++++++++----------------
 uwsgi-python/tasks/mysql.yml     |  9 ++++-----
 webserver/tasks/main.yml         |  7 +++----
 8 files changed, 57 insertions(+), 64 deletions(-)

diff --git a/debian-repository/tasks/main.yml b/debian-repository/tasks/main.yml
index 7c6aa47..6b97695 100644
--- a/debian-repository/tasks/main.yml
+++ b/debian-repository/tasks/main.yml
@@ -25,10 +25,8 @@
 
 - name: ensure we have the packaging software installed
   apt:
-    name: "{{ item }}"
+    name: reprepro
     state: present
-  with_items:
-    - reprepro
   tags:
     - packages
     - debian-repository
diff --git a/dokuwiki/tasks/main.yml b/dokuwiki/tasks/main.yml
index ceb6513..56816dd 100644
--- a/dokuwiki/tasks/main.yml
+++ b/dokuwiki/tasks/main.yml
@@ -2,15 +2,14 @@
 
 - name: ensure php packages are installed
   apt:
-    name: "{{ item }}"
+    name:
+      - php
+      - php-mbstring
+      - php-gd
+      - php-zip
+      - php-mcrypt
+      - php-xml
     state: present
-  with_items:
-    - php
-    - php-mbstring
-    - php-gd
-    - php-zip
-    - php-mcrypt
-    - php-xml
 
 - name: ensure groups for dokuwiki exist
   group:
diff --git a/php-fpm/tasks/main.yml b/php-fpm/tasks/main.yml
index 84ca46f..976c387 100644
--- a/php-fpm/tasks/main.yml
+++ b/php-fpm/tasks/main.yml
@@ -3,10 +3,8 @@
 
 - name: ensure php-fpm is installed on stretch
   apt:
-    name: "{{ item }}"
+    name: php-fpm
     state: present
-  with_items:
-    - php-fpm
   when: debian_version == "stretch"
   notify:
     - restart php-fpm
@@ -16,11 +14,10 @@
 
 - name: ensure php-fpm is installed on jessie
   apt:
-    name: "{{ item }}"
+    name:
+      - php5
+      - php5-fpm
     state: present
-  with_items:
-    - php5
-    - php5-fpm
   when: debian_version == "jessie"
   tags:
     - php-fpm
diff --git a/sentry/tasks/main.yml b/sentry/tasks/main.yml
index 6ca9781..b8c800b 100644
--- a/sentry/tasks/main.yml
+++ b/sentry/tasks/main.yml
@@ -2,19 +2,20 @@
 # file: sentry/tasks/main.yml
 
 - name: ensure we have the necessary software
-  apt: name="{{item}}" state=present
-  with_items:
-    - python-virtualenv
-    - libpq-dev
-    - python-dev
-    - python-psycopg2
-    - uwsgi
-    - uwsgi-core
-    - uwsgi-plugin-python
-    - libsasl2-dev
-    - libldap2-dev
-    - libssl-dev
-    - python-ldap
+  apt:
+    name:
+      - python-virtualenv
+      - libpq-dev
+      - python-dev
+      - python-psycopg2
+      - uwsgi
+      - uwsgi-core
+      - uwsgi-plugin-python
+      - libsasl2-dev
+      - libldap2-dev
+      - libssl-dev
+      - python-ldap
+    state: present
   tags:
     - sentry
     - webservices
diff --git a/shibboleth/tasks/main.yml b/shibboleth/tasks/main.yml
index 19bacac..eaa8524 100644
--- a/shibboleth/tasks/main.yml
+++ b/shibboleth/tasks/main.yml
@@ -15,14 +15,15 @@
 - meta: flush_handlers
 
 - name: install the required packages for shibboleth
-  apt: name="{{item}}" state=present
-  with_items:
-    - nginx-extras
-    - libnginx-mod-http-shibboleth
-    - libnginx-mod-http-headers-more-filter
-    - supervisor
-    - shibboleth-sp2-utils
-    - shibboleth-sp2-common
+  apt:
+    name:
+      - nginx-extras
+      - libnginx-mod-http-shibboleth
+      - libnginx-mod-http-headers-more-filter
+      - supervisor
+      - shibboleth-sp2-utils
+      - shibboleth-sp2-common
+    state: present
   notify:
     - reload shibd
   tags:
diff --git a/uwsgi-python/tasks/app.yml b/uwsgi-python/tasks/app.yml
index 4208992..613ffad 100644
--- a/uwsgi-python/tasks/app.yml
+++ b/uwsgi-python/tasks/app.yml
@@ -18,14 +18,13 @@
 
 - name: ensure we have python 2
   apt:
-    name: "{{ item }}"
+    name:
+      - python
+      - python-dev
+      - python-virtualenv
+      - uwsgi-plugin-python
+      - virtualenv
     state: present
-  with_items:
-    - python
-    - python-dev
-    - python-virtualenv
-    - uwsgi-plugin-python
-    - virtualenv
   when: app_python_version == 2
   tags:
     - uwsgi-app
@@ -34,14 +33,13 @@
 
 - name: ensure we have python 3
   apt:
-    name: "{{ item }}"
+    name:
+      - python3
+      - python3-dev
+      - python3-virtualenv
+      - uwsgi-plugin-python3
+      - virtualenv
     state: present
-  with_items:
-    - python3
-    - python3-dev
-    - python3-virtualenv
-    - uwsgi-plugin-python3
-    - virtualenv
   when: app_python_version == 3
   tags:
     - uwsgi-app
@@ -110,8 +108,9 @@
     - "{{ app.instance }}"
 
 - name: ensure additional software is installed
-  apt: name="{{ item }}" state=present
-  with_items: "{{ app_additional_software }}"
+  apt:
+    name: "{{app_additional_software}}"
+    state: present
   when: 
     - app_additional_software is defined
   tags:
diff --git a/uwsgi-python/tasks/mysql.yml b/uwsgi-python/tasks/mysql.yml
index 62f899a..5db2768 100644
--- a/uwsgi-python/tasks/mysql.yml
+++ b/uwsgi-python/tasks/mysql.yml
@@ -3,12 +3,11 @@
 
 - name: ensure we have python mysql packages
   apt:
-    name: "{{ item }}"
+    name:
+      - python-mysqldb
+      - python3-mysqldb
+      - default-libmysqlclient-dev
     state: present
-  with_items:
-    - python-mysqldb
-    - python3-mysqldb
-    - default-libmysqlclient-dev
   tags:
     - uwsgi-python
     - webservices
diff --git a/webserver/tasks/main.yml b/webserver/tasks/main.yml
index 1ff8237..b0e2968 100644
--- a/webserver/tasks/main.yml
+++ b/webserver/tasks/main.yml
@@ -3,11 +3,10 @@
 
 - name: ensure nginx is installed
   apt:
-    name: "{{ item }}"
+    name:
+      - nginx
+      - nginx-full
     state: present
-  with_items:
-    - nginx
-    - nginx-full
   notify:
     - restart nginx
     - restart nginx-proxy
-- 
GitLab