Change in osmo-ci[master]: ansible: fix apt deprecation warning about loops

osmith gerrit-no-reply at lists.osmocom.org
Mon Mar 8 14:04:21 UTC 2021


osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ci/+/23272 )


Change subject: ansible: fix apt deprecation warning about loops
......................................................................

ansible: fix apt deprecation warning about loops

Fix deprecation warnings like 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 }}"`, please use
  `name: ['libjansson-dev', 'libulfius-dev']` and remove the loop.
  This feature will be removed in version 2.11.

Change-Id: I57b9ce690e8167249468954f3e62d14c7a92fcfc
---
M ansible/roles/docker/tasks/main.yml
M ansible/roles/gsm-tester-bts/tasks/main.yml
M ansible/roles/gsm-tester/tasks/main.yml
M ansible/roles/install-coverity/tasks/main.yml
M ansible/roles/install-poky-sdk/tasks/main.yml
M ansible/roles/osmocom-jenkins-slave/tasks/debian.yml
M ansible/roles/osmocom-jenkins-slave/tasks/osmocom_build_deps.yml
M ansible/roles/osmocom-workstation/tasks/main.yml
M ansible/setup-gsm-tester.yml
M ansible/setup-jenkins-slave.yml
M ansible/setup-simtest.yml
11 files changed, 260 insertions(+), 288 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/72/23272/1

diff --git a/ansible/roles/docker/tasks/main.yml b/ansible/roles/docker/tasks/main.yml
index c38d38b..a268d2b 100644
--- a/ansible/roles/docker/tasks/main.yml
+++ b/ansible/roles/docker/tasks/main.yml
@@ -2,14 +2,13 @@
 
 - name: add https support
   apt:
-    name: "{{ item }}"
+    name:
+      - apt-transport-https
+      - gnupg
+      - cron
+      - ca-certificates
     cache_valid_time: 3600
     update_cache: yes
-  with_items:
-    - apt-transport-https
-    - gnupg
-    - cron
-    - ca-certificates
 
 - name: add docker gpg key to apt keyring
   apt_key:
diff --git a/ansible/roles/gsm-tester-bts/tasks/main.yml b/ansible/roles/gsm-tester-bts/tasks/main.yml
index e979605..f1377f0 100644
--- a/ansible/roles/gsm-tester-bts/tasks/main.yml
+++ b/ansible/roles/gsm-tester-bts/tasks/main.yml
@@ -15,12 +15,11 @@
 
 - name: usrp install apt dependecies
   apt:
-    name: "{{ item }}"
+    name:
+      - libuhd-dev
+      - uhd-host
     cache_valid_time: 3600
     update_cache: yes
-  with_items:
-    - libuhd-dev
-    - uhd-host
   register: uhd_installed
 
 - name: usrp download firmware
@@ -48,8 +47,7 @@
 
 - name: install osmocom utilities
   apt:
-    name: "{{ item }}"
-  with_items:
-    - abisip-find
-    - osmo-bsc-ipaccess-utils
-    - osmo-bsc-bs11-utils
+    name:
+      - abisip-find
+      - osmo-bsc-ipaccess-utils
+      - osmo-bsc-bs11-utils
diff --git a/ansible/roles/gsm-tester/tasks/main.yml b/ansible/roles/gsm-tester/tasks/main.yml
index eaf50fd..418509e 100644
--- a/ansible/roles/gsm-tester/tasks/main.yml
+++ b/ansible/roles/gsm-tester/tasks/main.yml
@@ -9,41 +9,39 @@
 
 - name: install osmocom runtime dependencies
   apt:
-    name: "{{ item }}"
-  with_items:
-    - build-essential
-    - git
-    - automake
-    - libdbi-dev
-    - libdbd-sqlite3
-    - sqlite3
-    - libsctp-dev
-    - libortp-dev
-    - libpcap-dev
-    - libc-ares-dev
-    - libtool
-    - shtool
-    - pkg-config
-    - libtalloc-dev
-    - libpcsclite-dev
-    - libgnutls28-dev
-    - libmnl-dev
-    - libssl-dev
-    - libczmq-dev
-    - libsofia-sip-ua-glib-dev
-    - libsqlite3-dev
-    - libasound2-dev
-    - liblua5.3-dev
-    - lua-socket
+    name:
+      - build-essential
+      - git
+      - automake
+      - libdbi-dev
+      - libdbd-sqlite3
+      - sqlite3
+      - libsctp-dev
+      - libortp-dev
+      - libpcap-dev
+      - libc-ares-dev
+      - libtool
+      - shtool
+      - pkg-config
+      - libtalloc-dev
+      - libpcsclite-dev
+      - libgnutls28-dev
+      - libmnl-dev
+      - libssl-dev
+      - libczmq-dev
+      - libsofia-sip-ua-glib-dev
+      - libsqlite3-dev
+      - libasound2-dev
+      - liblua5.3-dev
+      - lua-socket
   tags:
     - osmocom
 
 # mdbus2 is not available in debian10. TODO: compile it for >9
 - name: install mdbus2
   apt:
-    name: "{{ item }}"
-  with_items:
-    - mdbus2
+    name:
+      - mdbus2
   when: ansible_distribution == 'Debian' and ansible_distribution_version <= '9'
   tags:
     - ofono
@@ -51,35 +49,32 @@
 
 - name: install srsLTE build-only dependencies
   apt:
-    name: "{{ item }}"
-  with_items:
-    - cmake
-    - libfftw3-dev
-    - libmbedtls-dev
-    - libboost-program-options-dev
-    - libconfig++-dev
-    - libsctp-dev
-    - libpcsclite-dev
-    - libuhd-dev
-    - libczmq-dev
-    - libsoapysdr-dev
+    name:
+      - cmake
+      - libfftw3-dev
+      - libmbedtls-dev
+      - libboost-program-options-dev
+      - libconfig++-dev
+      - libsctp-dev
+      - libpcsclite-dev
+      - libuhd-dev
+      - libczmq-dev
+      - libsoapysdr-dev
   tags:
     - srs
 
 - name: install srsLTE runtime extra dependencies (Debian)
   apt:
-    name: "{{ item }}"
-  with_items:
-    - soapysdr0.7-module-lms7
+    name:
+      - soapysdr0.7-module-lms7
   when: ansible_distribution == 'Debian'
   tags:
     - srs
 
 - name: install srsLTE runtime extra dependencies (Ubuntu)
   apt:
-    name: "{{ item }}"
-  with_items:
-    - soapysdr0.6-module-lms7
+    name:
+      - soapysdr0.6-module-lms7
   when: ansible_distribution == 'Ubuntu'
   tags:
     - srs
@@ -101,9 +96,8 @@
 
 - name: install uhub dependencies
   apt:
-    name: "{{ item }}"
-  with_items:
-    - libusb-1.0-0-dev
+    name:
+      - libusb-1.0-0-dev
   tags:
     - modem
 
@@ -172,9 +166,8 @@
 
 - name: install patchelf build dependencies
   apt:
-    name: "{{ item }}"
-  with_items:
-    - autoconf
+    name:
+      - autoconf
   tags:
     - patchelf
     - osmo-gsm-tester-proc
@@ -208,34 +201,32 @@
 
 - name: install gsm tester dependencies (main)
   apt:
-    name: "{{ item }}"
-  with_items:
-    - sqlite3
-    - python3
-    - python3-setuptools
-    - python3-yaml
-    - python3-mako
-    - python3-gi
-    - python3-watchdog
-    - python3-numpy
-    - python3-websocket
-    - ofono
-    - patchelf
-    - libcap2-bin
-    - python3-pip
-    - udhcpc
+    name:
+      - sqlite3
+      - python3
+      - python3-setuptools
+      - python3-yaml
+      - python3-mako
+      - python3-gi
+      - python3-watchdog
+      - python3-numpy
+      - python3-websocket
+      - ofono
+      - patchelf
+      - libcap2-bin
+      - python3-pip
+      - udhcpc
   tags:
     - osmo-gsm-tester-main
 
 - name: install gsm tester dependencies (proc)
   apt:
-    name: "{{ item }}"
-  with_items:
-    - tcpdump
-    - patchelf
-    - libcap2-bin
-    - iperf3
-    - sudo
+    name:
+      - tcpdump
+      - patchelf
+      - libcap2-bin
+      - iperf3
+      - sudo
   tags:
     - osmo-gsm-tester-proc
 
diff --git a/ansible/roles/install-coverity/tasks/main.yml b/ansible/roles/install-coverity/tasks/main.yml
index 55fa77f..5baf6f3 100644
--- a/ansible/roles/install-coverity/tasks/main.yml
+++ b/ansible/roles/install-coverity/tasks/main.yml
@@ -1,9 +1,8 @@
 ---
 - name: install coverity-required debian packages
   apt:
-    name: "{{ item }}"
-  with_items:
-    - curl
+    name:
+      - curl
 
 - name: copy coverity installer
   copy:
diff --git a/ansible/roles/install-poky-sdk/tasks/main.yml b/ansible/roles/install-poky-sdk/tasks/main.yml
index ff65c1b..85b3c94 100644
--- a/ansible/roles/install-poky-sdk/tasks/main.yml
+++ b/ansible/roles/install-poky-sdk/tasks/main.yml
@@ -1,12 +1,11 @@
 ---
 - name: install bzip2 and tar
   apt:
-    name: "{{ item }}"
+    name:
+      - tar
+      - bzip2
     cache_valid_time: 3600
     update_cache: yes
-  with_items:
-    - tar
-    - bzip2
 
 - name: copy poky installer
   copy:
diff --git a/ansible/roles/osmocom-jenkins-slave/tasks/debian.yml b/ansible/roles/osmocom-jenkins-slave/tasks/debian.yml
index a8a36a7..0c762e9 100644
--- a/ansible/roles/osmocom-jenkins-slave/tasks/debian.yml
+++ b/ansible/roles/osmocom-jenkins-slave/tasks/debian.yml
@@ -2,19 +2,18 @@
 
 - name: install jenkins utilities
   apt:
-    name: "{{ item }}"
+    name:
+      - htop
+      - virt-manager
+      - qemu
+      - qemu-user-static
+      - qemu-system-arm
+      - proot
+      - debootstrap
+      - fakeroot
     cache_valid_time: 3600
     update_cache: yes
     install_recommends: no
-  with_items:
-    - htop
-    - virt-manager
-    - qemu
-    - qemu-user-static
-    - qemu-system-arm
-    - proot
-    - debootstrap
-    - fakeroot
   when: install_jenkins_utilities
 
 - name: stop checking release validity for old stable
@@ -41,20 +40,18 @@
 
 - name: install java for stretch
   apt:
-    name: "{{ item }}"
+    name:
+      - openjdk-8-jre-headless
     cache_valid_time: 3600
     update_cache: yes
     install_recommends: no
-  with_items:
-    - openjdk-8-jre-headless
   when: ansible_distribution == 'Debian' and ansible_distribution_version == '9'
 
 - name: install java for buster and later
   apt:
-    name: "{{ item }}"
+    name:
+      - openjdk-11-jre-headless
     cache_valid_time: 3600
     update_cache: yes
     install_recommends: no
-  with_items:
-    - openjdk-11-jre-headless
   when: ansible_distribution == 'Debian' and ansible_distribution_version|int >= 10
diff --git a/ansible/roles/osmocom-jenkins-slave/tasks/osmocom_build_deps.yml b/ansible/roles/osmocom-jenkins-slave/tasks/osmocom_build_deps.yml
index 54dcdc7..816218f 100644
--- a/ansible/roles/osmocom-jenkins-slave/tasks/osmocom_build_deps.yml
+++ b/ansible/roles/osmocom-jenkins-slave/tasks/osmocom_build_deps.yml
@@ -1,103 +1,101 @@
 ---
 - name: install build utilities
   apt:
-    name: "{{ item }}"
+    name:
+      - asciidoc
+      - autoconf
+      - autoconf-archive
+      - automake
+      - bc
+      - bison
+      - coccinelle
+      - cppcheck
+      - debhelper
+      - devscripts
+      - dh-autoreconf
+      - dh-systemd
+      - doxygen
+      - flex
+      - g++
+      - gawk
+      - gcc
+      - gcc-arm-none-eabi
+      - git
+      - git-buildpackage
+      - graphviz
+      - libcsv-dev
+      - libtool
+      - libboost-all-dev
+      - make
+      - mscgen
+      - osc
+      - pkgconf
+      - python-minimal
+      - python-setuptools
+      - python3
+      - python3-setuptools
+      - stow
+      - texinfo
+      # by gsm-manuals
+      - python3-nwdiag
+      - python-pychart
+      - inkscape
+      # by gapk
+      - libasound-dev
+      - libopencore-amrnb-dev
+      # by LimeSuite
+      - cmake
+      - patchelf
+      # by libusrp
+      - sdcc
+      # by mingw upload job
+      - rsync
     cache_valid_time: 3600
     update_cache: yes
-  with_items:
-    - asciidoc
-    - autoconf
-    - autoconf-archive
-    - automake
-    - bc
-    - bison
-    - coccinelle
-    - cppcheck
-    - debhelper
-    - devscripts
-    - dh-autoreconf
-    - dh-systemd
-    - doxygen
-    - flex
-    - g++
-    - gawk
-    - gcc
-    - gcc-arm-none-eabi
-    - git
-    - git-buildpackage
-    - graphviz
-    - libcsv-dev
-    - libtool
-    - libboost-all-dev
-    - make
-    - mscgen
-    - osc
-    - pkgconf
-    - python-minimal
-    - python-setuptools
-    - python3
-    - python3-setuptools
-    - stow
-    - texinfo
-    # by gsm-manuals
-    - python3-nwdiag
-    - python-pychart
-    - inkscape
-    # by gapk
-    - libasound-dev
-    - libopencore-amrnb-dev
-    # by LimeSuite
-    - cmake
-    - patchelf
-    # by libusrp
-    - sdcc
-    # by mingw upload job
-    - rsync
 
 - name: install build dependencies and libraries
   apt:
-    name: "{{ item }}"
+    name:
+      - dahdi-source
+      - docbook5-xml
+      - libboost-dev
+      - libc-ares-dev
+      - libdbd-sqlite3
+      - libdbi-dev
+      - libffi-dev
+      - libffi-dev
+      - libfftw3-dev
+      - libgmp-dev
+      - libgnutls28-dev
+      - libgps-dev
+      - libgsm1-dev
+      - libnl-3-dev
+      - libnl-route-3-dev
+      - libmnl-dev
+      # by osmo-sysmon
+      - liboping-dev
+      - libncurses5-dev
+      - libortp-dev
+      - libpcap-dev
+      - libpcsclite-dev
+      - libreadline-dev
+      - libsctp-dev
+      - libsigsegv-dev
+      - libsnmp-dev
+      - libsofia-sip-ua-glib-dev
+      - libsqlite3-dev
+      - libssl-dev
+      - libsystemd-dev
+      - libtalloc-dev
+      - libuhd-dev
+      - libusb-1.0-0-dev
+      - libusb-dev
+      - libzmq3-dev
+      - sqlite3
+      - libaio-dev
     cache_valid_time: 3600
     update_cache: yes
     install_recommends: no
-  with_items:
-    - dahdi-source
-    - docbook5-xml
-    - libboost-dev
-    - libc-ares-dev
-    - libdbd-sqlite3
-    - libdbi-dev
-    - libffi-dev
-    - libffi-dev
-    - libfftw3-dev
-    - libgmp-dev
-    - libgnutls28-dev
-    - libgps-dev
-    - libgsm1-dev
-    - libnl-3-dev
-    - libnl-route-3-dev
-    - libmnl-dev
-    # by osmo-sysmon
-    - liboping-dev
-    - libncurses5-dev
-    - libortp-dev
-    - libpcap-dev
-    - libpcsclite-dev
-    - libreadline-dev
-    - libsctp-dev
-    - libsigsegv-dev
-    - libsnmp-dev
-    - libsofia-sip-ua-glib-dev
-    - libsqlite3-dev
-    - libssl-dev
-    - libsystemd-dev
-    - libtalloc-dev
-    - libuhd-dev
-    - libusb-1.0-0-dev
-    - libusb-dev
-    - libzmq3-dev
-    - sqlite3
-    - libaio-dev
 
 - name: install liblua for jessie
   apt:
@@ -110,65 +108,60 @@
 
 - name: install liblua for stretch or later
   apt:
-    name: "{{ item }}"
+    name:
+      - liblua5.3-dev
     cache_valid_time: 3600
     update_cache: yes
     install_recommends: no
-  with_items:
-    - liblua5.3-dev
   when: ansible_distribution == 'Debian' and ansible_distribution_version|int >= 9
 
 - name: install liblimesuite-dev for stretch or later
   apt:
-    name: "{{ item }}"
+    name:
+      - liblimesuite-dev
     cache_valid_time: 3600
     update_cache: yes
     install_recommends: no
-  with_items:
-    - liblimesuite-dev
   when: ansible_distribution == 'Debian' and ansible_distribution_version|int >= 9
 
 - name: install osmo-remsim dependencies
   apt:
-    name: "{{ item }}"
+    name:
+      - libjansson-dev
+      - libulfius-dev
     cache_valid_time: 3600
     update_cache: yes
-  with_items:
-    - libjansson-dev
-    - libulfius-dev
   when: ansible_distribution == 'Debian' and ansible_distribution_version|int >= 9
 
 - name: install srsLTE build dependencies
   apt:
-    name: "{{ item }}"
+    name:
+      - cmake
+      - libfftw3-dev
+      - libmbedtls-dev
+      - libboost-program-options-dev
+      - libconfig++-dev
+      - libsctp-dev
+      - libpcsclite-dev
+      - libuhd-dev
+      - libczmq-dev
+      - libsoapysdr-dev
     cache_valid_time: 3600
     update_cache: yes
-  with_items:
-    - cmake
-    - libfftw3-dev
-    - libmbedtls-dev
-    - libboost-program-options-dev
-    - libconfig++-dev
-    - libsctp-dev
-    - libpcsclite-dev
-    - libuhd-dev
-    - libczmq-dev
-    - libsoapysdr-dev
   when: ansible_distribution == 'Debian' and ansible_distribution_version|int >= 9
 
 - name: install open5gs build dependencies
   apt:
-    name: "{{ item }}"
+    name:
+      - meson
+      - ninja-build
+      - libgcrypt-dev
+      - libidn11-dev
+      - libmongoc-dev
+      - libbson-dev
+      - libyaml-dev
     cache_valid_time: 3600
     update_cache: yes
-  with_items:
-    - meson
-    - ninja-build
-    - libgcrypt-dev
-    - libidn11-dev
-    - libmongoc-dev
-    - libbson-dev
-    - libyaml-dev
   when: ansible_distribution == 'Debian' and ansible_distribution_version|int >= 10
 
 - name: download osmo-python-tests for py2
diff --git a/ansible/roles/osmocom-workstation/tasks/main.yml b/ansible/roles/osmocom-workstation/tasks/main.yml
index d68f956..ae29111 100644
--- a/ansible/roles/osmocom-workstation/tasks/main.yml
+++ b/ansible/roles/osmocom-workstation/tasks/main.yml
@@ -14,35 +14,34 @@
 
 - name: install distribution packages
   apt:
-    name: "{{ item }}"
+    name:
+      - iceweasel
+      - vim
+      - evince
+      - valgrind
+      - gdb
+      - libc6-dbg
+      - wireshark
+      - tcpdump
+      - ccache
+      - gnupg
+      - openssh-client
+      - openssh-server
+      - console-common
+      - console-data
+      - meld
+      - emacs
+      - gitk
+      - okular
+      - libreoffice-calc
+      - libreoffice-draw
+      - libreoffice-impress
+      - libreoffice-writer
+      - gnumeric
+      - openvpn
+      - fvwm
+      - xfce4
+      - network-manager
+      - modemmanager
     cache_valid_time: 3600
     update_cache: yes
-  with_items:
-    - iceweasel
-    - vim
-    - evince
-    - valgrind
-    - gdb
-    - libc6-dbg
-    - wireshark
-    - tcpdump
-    - ccache
-    - gnupg
-    - openssh-client
-    - openssh-server
-    - console-common
-    - console-data
-    - meld
-    - emacs
-    - gitk
-    - okular
-    - libreoffice-calc
-    - libreoffice-draw
-    - libreoffice-impress
-    - libreoffice-writer
-    - gnumeric
-    - openvpn
-    - fvwm
-    - xfce4
-    - network-manager
-    - modemmanager
diff --git a/ansible/setup-gsm-tester.yml b/ansible/setup-gsm-tester.yml
index 43ef753..26285df 100644
--- a/ansible/setup-gsm-tester.yml
+++ b/ansible/setup-gsm-tester.yml
@@ -5,16 +5,15 @@
   tasks:
     - name: install common utilities
       apt:
-        name: "{{ item }}"
+        name:
+          - vim
+          - tmux
+          - screen
+          - ca-certificates
+          - wget
+          - curl
         cache_valid_time: 3600
         update_cache: yes
-      with_items:
-        - vim
-        - tmux
-        - screen
-        - ca-certificates
-        - wget
-        - curl
   roles:
     - name: gsm-tester
       tags:
diff --git a/ansible/setup-jenkins-slave.yml b/ansible/setup-jenkins-slave.yml
index 350a40f..8565530 100644
--- a/ansible/setup-jenkins-slave.yml
+++ b/ansible/setup-jenkins-slave.yml
@@ -7,14 +7,13 @@
   tasks:
     - name: install common utilities
       apt:
-        name: "{{ item }}"
+        name:
+          - vim
+          - tmux
+          - screen
+          - ca-certificates
         cache_valid_time: 3600
         update_cache: yes
-      with_items:
-        - vim
-        - tmux
-        - screen
-        - ca-certificates
   roles:
     - name: docker
       jenkins_user: osmocom-build
diff --git a/ansible/setup-simtest.yml b/ansible/setup-simtest.yml
index 8ab6f7e..6eb67fc 100644
--- a/ansible/setup-simtest.yml
+++ b/ansible/setup-simtest.yml
@@ -10,17 +10,16 @@
 
     - name: install common utilities
       apt:
-        name: "{{ item }}"
+        name:
+          - vim
+          - ca-certificates
+          - python3-minimal
+          - python3-setuptools
+          - python3-pip
+          - python3-serial
+          - python3-pyscard
+          - virtualenv
         install_recommends: no
-      with_items:
-        - vim
-        - ca-certificates
-        - python3-minimal
-        - python3-setuptools
-        - python3-pip
-        - python3-serial
-        - python3-pyscard
-        - virtualenv
 
   roles:
     - name: osmocom-jenkins-slave

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/23272
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I57b9ce690e8167249468954f3e62d14c7a92fcfc
Gerrit-Change-Number: 23272
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210308/7eefe626/attachment.htm>


More information about the gerrit-log mailing list