Update usage of apt module, move away from deprecated loop approach

This commit is contained in:
Alexander Grothe 2018-10-05 17:49:39 +02:00
parent febd80390f
commit 96b029fd24
13 changed files with 647 additions and 682 deletions

File diff suppressed because it is too large Load Diff

View File

@ -198,7 +198,7 @@ fi
# update packages # update packages
apt update apt update
apt -y install software-properties-common apt -y install software-properties-common
add-apt-repository -y ppa:ansible/ansible-2.6 add-apt-repository -y ppa:ansible/ansible-2.7
# install required packages # install required packages
apt-get -y install --no-install-recommends ansible python-jmespath apt-get -y install --no-install-recommends ansible python-jmespath
@ -430,12 +430,10 @@ grub:
- name: apt | install packages - name: apt | install packages
apt: apt:
name: '{{ item }}' name: '{{ packages }}'
state: present state: present
install_recommends: no install_recommends: no
cache_valid_time: 60 cache_valid_time: 60
with_items:
'{{ packages }}'
#+END_SRC #+END_SRC
** nvidia experimental drivers ** nvidia experimental drivers
@ -464,12 +462,11 @@ install nvidia-396 from ppa:graphics-drivers/ppa
- name: install nvidia-396 and other required packages - name: install nvidia-396 and other required packages
apt: apt:
name: '{{ item }}' name:
-nvidia-396
-nvidia-settings
state: present state: present
install_recommends: no install_recommends: no
with_items:
- nvidia-396
- nvidia-settings
tags: tags:
- packages - packages
#+END_SRC #+END_SRC
@ -669,10 +666,7 @@ yavdr-common executes the following tasks:
#+BEGIN_SRC yaml :tangle roles/yavdr-common/tasks/configure_system.yml :mkdirp yes #+BEGIN_SRC yaml :tangle roles/yavdr-common/tasks/configure_system.yml :mkdirp yes
- name: apt | install basic packages - name: apt | install basic packages
apt: apt:
name: '{{ item }}' name:
state: present
install_recommends: no
with_items:
- anacron - anacron
- acl - acl
- at - at
@ -691,6 +685,8 @@ yavdr-common executes the following tasks:
- wpasupplicant - wpasupplicant
- usbutils - usbutils
- xfsprogs - xfsprogs
state: present
install_recommends: no
#+END_SRC #+END_SRC
***** Install additional packages (user defined) ***** Install additional packages (user defined)
@ -700,11 +696,10 @@ yavdr-common executes the following tasks:
#+BEGIN_SRC yaml :tangle roles/yavdr-common/tasks/configure_system.yml #+BEGIN_SRC yaml :tangle roles/yavdr-common/tasks/configure_system.yml
- name: apt | install extra packages - name: apt | install extra packages
apt: apt:
name: '{{ item }}' name: '{{ extra_packages }}'
state: present state: present
install_recommends: no install_recommends: no
with_items:
'{{ extra_packages }}'
#+END_SRC #+END_SRC
***** create directories ***** create directories
:PROPERTIES: :PROPERTIES:
@ -835,13 +830,12 @@ first_run: False
- name: apt | install basic vdr packages - name: apt | install basic vdr packages
apt: apt:
name: '{{ item }}' name:
state: present
install_recommends: no
with_items:
- vdr - vdr
- vdrctl - vdrctl
- vdr-plugin-dbus2vdr - vdr-plugin-dbus2vdr
state: present
install_recommends: no
#+END_SRC #+END_SRC
**** Add svdrp/svdrp-disc to /etc/services **** Add svdrp/svdrp-disc to /etc/services
:PROPERTIES: :PROPERTIES:
@ -899,11 +893,9 @@ The additional plugins to install can be set in the variable ~{{vdr_plugins}}~ i
#+BEGIN_SRC yaml :tangle roles/vdr/tasks/main.yml :mkdirp yes #+BEGIN_SRC yaml :tangle roles/vdr/tasks/main.yml :mkdirp yes
- name: apt | install additional vdr plugins - name: apt | install additional vdr plugins
apt: apt:
name: '{{ item }}' name: '{{ vdr_plugins | default([]) }}'
state: present state: present
install_recommends: no install_recommends: no
with_items:
'{{ vdr_plugins | default({}) }}'
notify: [ 'Restart VDR' ] notify: [ 'Restart VDR' ]
#+END_SRC #+END_SRC
**** copy vdr configuration files (if they don't exist yet) **** copy vdr configuration files (if they don't exist yet)
@ -1144,10 +1136,7 @@ install_avahi: true
- name: apt | install packages for network services - name: apt | install packages for network services
apt: apt:
name: '{{ item }}' name:
state: present
install_recommends: no
with_items:
- avahi-daemon - avahi-daemon
- avahi-utils - avahi-utils
#- biosdevname # caution: this may change device names after a minimal installation! #- biosdevname # caution: this may change device names after a minimal installation!
@ -1155,6 +1144,8 @@ install_avahi: true
- nfs-common - nfs-common
- vdr-addon-avahi-linker - vdr-addon-avahi-linker
- wakeonlan - wakeonlan
state: present
install_recommends: no
# Does this really work? We need a way to check if an interface supports WOL - Python Skript? # Does this really work? We need a way to check if an interface supports WOL - Python Skript?
# - name: check WOL capabilities of network interfaces # - name: check WOL capabilities of network interfaces
@ -1219,12 +1210,11 @@ install_avahi: true
- name: install nfs server packages - name: install nfs server packages
apt: apt:
name: '{{ item }}' name:
state: present
install_recommends: no
with_items:
- nfs-kernel-server - nfs-kernel-server
- nfs-common - nfs-common
state: present
install_recommends: no
- name: create /etc/exports - name: create /etc/exports
template: template:
@ -1292,11 +1282,10 @@ lircd0_socket: /var/run/lirc/lircd0
- name: apt | install packages for remote support - name: apt | install packages for remote support
apt: apt:
name: '{{ item }}' name:
state: present
with_items:
- yavdr-remote - yavdr-remote
- lirc - lirc
state: present
tags: tags:
- packages - packages
@ -1330,11 +1319,10 @@ lircd0_socket: /var/run/lirc/lircd0
- name: apt | install eventlircd and lircd2uinput - name: apt | install eventlircd and lircd2uinput
apt: apt:
name: '{{ item }}' name:
state: present
with_items:
- eventlircd - eventlircd
- lircd2uinput - lircd2uinput
state: present
tags: tags:
- packages - packages
@ -1584,13 +1572,12 @@ ati_remote rc-medion-x10-digitainer /lib/udev/rc_keymaps/rc-medion-x10-digi
- name: apt | install pulseaudio, pavucontrol and vdr-plugin-pulsecontrol - name: apt | install pulseaudio, pavucontrol and vdr-plugin-pulsecontrol
apt: apt:
name: '{{ item }}' name:
state: present
install_recommends: no
with_items:
- pulseaudio - pulseaudio
- pavucontrol - pavucontrol
- vdr-plugin-pulsecontrol - vdr-plugin-pulsecontrol
state: present
install_recommends: no
- name: create /etc/asound.conf with pulseaudio as default device - name: create /etc/asound.conf with pulseaudio as default device
template: template:
@ -2144,9 +2131,7 @@ preferred_refreshrates:
- name: apt | install packages for xorg - name: apt | install packages for xorg
apt: apt:
name: '{{ item }}' name:
state: present
with_items:
- xlogin - xlogin
- yavdr-xorg - yavdr-xorg
- xorg - xorg
@ -2161,14 +2146,14 @@ preferred_refreshrates:
- vdr-plugin-osd2web - vdr-plugin-osd2web
- feh - feh
#- yavdr-xorg #- yavdr-xorg
state: present
- name: apt | install packages for Intel IGP - name: apt | install packages for Intel IGP
apt: apt:
name: '{{ item }}' name:
state: present
with_items:
- xserver-xorg-video-intel - xserver-xorg-video-intel
- i965-va-driver-shaders - i965-va-driver-shaders
state: present
when: intel_detected when: intel_detected
- name: download yavdr logo - name: download yavdr logo
@ -2195,12 +2180,11 @@ preferred_refreshrates:
- name: apt | install desktop programs - name: apt | install desktop programs
apt: apt:
name: '{{ item }}' name:
state: present
with_items:
- xterm - xterm
- firefox - firefox
- kiosk-browser - kiosk-browser
state: present
#+END_SRC #+END_SRC
**** detect-xorg.yml **** detect-xorg.yml
:PROPERTIES: :PROPERTIES:
@ -4911,14 +4895,14 @@ end
- name: install samba server - name: install samba server
apt: apt:
name: '{{ item }}' name:
state: present
install_recommends: no
with_items:
- samba - samba
- samba-common - samba-common
- samba-common-bin - samba-common-bin
- tdb-tools - tdb-tools
state: present
install_recommends: no
with_items:
#+END_SRC #+END_SRC
** samba-config ** samba-config
@ -5135,8 +5119,7 @@ This role installs the guest additions for virtualbox guests on Ubuntu 16.04
- name: install packages - name: install packages
apt: apt:
state: present state: present
name: '{{ item }}' name:
with_items:
- dkms - dkms
- virtualbox-guest-x11-hwe - virtualbox-guest-x11-hwe
- virtualbox-guest-dkms-hwe - virtualbox-guest-dkms-hwe
@ -5151,11 +5134,10 @@ This role installs the guest additions for virtualbox guests on Ubuntu 16.04
- name: set xineliboutput as frontend - name: set xineliboutput as frontend
block: block:
- apt: - apt:
name: '{{ item }}' name:
state: present
with_items:
- vdr-plugin-xineliboutput - vdr-plugin-xineliboutput
- xineliboutput-sxfe - xineliboutput-sxfe
state: present
- command: '{{ item }}' - command: '{{ item }}'
with_items: with_items:
- vdrctl disable softhddevice - vdrctl disable softhddevice

View File

@ -8,7 +8,7 @@ fi
# update packages # update packages
apt update apt update
apt -y install software-properties-common apt -y install software-properties-common
add-apt-repository -y ppa:ansible/ansible-2.6 add-apt-repository -y ppa:ansible/ansible-2.7
# install required packages # install required packages
apt-get -y install --no-install-recommends ansible python-jmespath apt-get -y install --no-install-recommends ansible python-jmespath

View File

@ -6,8 +6,7 @@
- name: install packages - name: install packages
apt: apt:
state: present state: present
name: '{{ item }}' name:
with_items:
- dkms - dkms
- virtualbox-guest-x11-hwe - virtualbox-guest-x11-hwe
- virtualbox-guest-dkms-hwe - virtualbox-guest-dkms-hwe
@ -22,11 +21,10 @@
- name: set xineliboutput as frontend - name: set xineliboutput as frontend
block: block:
- apt: - apt:
name: '{{ item }}' name:
state: present
with_items:
- vdr-plugin-xineliboutput - vdr-plugin-xineliboutput
- xineliboutput-sxfe - xineliboutput-sxfe
state: present
- command: '{{ item }}' - command: '{{ item }}'
with_items: with_items:
- vdrctl disable softhddevice - vdrctl disable softhddevice

View File

@ -2,12 +2,11 @@
- name: install nfs server packages - name: install nfs server packages
apt: apt:
name: '{{ item }}' name:
state: present
install_recommends: no
with_items:
- nfs-kernel-server - nfs-kernel-server
- nfs-common - nfs-common
state: present
install_recommends: no
- name: create /etc/exports - name: create /etc/exports
template: template:

View File

@ -10,11 +10,10 @@
- name: install nvidia-396 and other required packages - name: install nvidia-396 and other required packages
apt: apt:
name: '{{ item }}' name:
-nvidia-396
-nvidia-settings
state: present state: present
install_recommends: no install_recommends: no
with_items:
- nvidia-396
- nvidia-settings
tags: tags:
- packages - packages

View File

@ -2,13 +2,12 @@
- name: apt | install pulseaudio, pavucontrol and vdr-plugin-pulsecontrol - name: apt | install pulseaudio, pavucontrol and vdr-plugin-pulsecontrol
apt: apt:
name: '{{ item }}' name:
state: present
install_recommends: no
with_items:
- pulseaudio - pulseaudio
- pavucontrol - pavucontrol
- vdr-plugin-pulsecontrol - vdr-plugin-pulsecontrol
state: present
install_recommends: no
- name: create /etc/asound.conf with pulseaudio as default device - name: create /etc/asound.conf with pulseaudio as default device
template: template:

View File

@ -3,11 +3,11 @@
- name: install samba server - name: install samba server
apt: apt:
name: '{{ item }}' name:
state: present
install_recommends: no
with_items:
- samba - samba
- samba-common - samba-common
- samba-common-bin - samba-common-bin
- tdb-tools - tdb-tools
state: present
install_recommends: no
with_items:

View File

@ -3,13 +3,12 @@
- name: apt | install basic vdr packages - name: apt | install basic vdr packages
apt: apt:
name: '{{ item }}' name:
state: present
install_recommends: no
with_items:
- vdr - vdr
- vdrctl - vdrctl
- vdr-plugin-dbus2vdr - vdr-plugin-dbus2vdr
state: present
install_recommends: no
- name: add svdrp and svdrp-disc to /etc/services - name: add svdrp and svdrp-disc to /etc/services
lineinfile: lineinfile:
dest: /etc/services dest: /etc/services
@ -48,11 +47,9 @@
# TODO: set recdir, user etc. in /etc/vdr/conf.d/ # TODO: set recdir, user etc. in /etc/vdr/conf.d/
- name: apt | install additional vdr plugins - name: apt | install additional vdr plugins
apt: apt:
name: '{{ item }}' name: '{{ vdr_plugins | default([]) }}'
state: present state: present
install_recommends: no install_recommends: no
with_items:
'{{ vdr_plugins | default({}) }}'
notify: [ 'Restart VDR' ] notify: [ 'Restart VDR' ]
- name: ensure vdr is stopped - name: ensure vdr is stopped
systemd: systemd:

View File

@ -31,10 +31,7 @@
skip: true skip: true
- name: apt | install basic packages - name: apt | install basic packages
apt: apt:
name: '{{ item }}' name:
state: present
install_recommends: no
with_items:
- anacron - anacron
- acl - acl
- at - at
@ -53,10 +50,10 @@
- wpasupplicant - wpasupplicant
- usbutils - usbutils
- xfsprogs - xfsprogs
- name: apt | install extra packages
apt:
name: '{{ item }}'
state: present state: present
install_recommends: no install_recommends: no
with_items: - name: apt | install extra packages
'{{ extra_packages }}' apt:
name: '{{ extra_packages }}'
state: present
install_recommends: no

View File

@ -3,10 +3,7 @@
- name: apt | install packages for network services - name: apt | install packages for network services
apt: apt:
name: '{{ item }}' name:
state: present
install_recommends: no
with_items:
- avahi-daemon - avahi-daemon
- avahi-utils - avahi-utils
#- biosdevname # caution: this may change device names after a minimal installation! #- biosdevname # caution: this may change device names after a minimal installation!
@ -14,6 +11,8 @@
- nfs-common - nfs-common
- vdr-addon-avahi-linker - vdr-addon-avahi-linker
- wakeonlan - wakeonlan
state: present
install_recommends: no
# Does this really work? We need a way to check if an interface supports WOL - Python Skript? # Does this really work? We need a way to check if an interface supports WOL - Python Skript?
# - name: check WOL capabilities of network interfaces # - name: check WOL capabilities of network interfaces

View File

@ -3,11 +3,10 @@
- name: apt | install packages for remote support - name: apt | install packages for remote support
apt: apt:
name: '{{ item }}' name:
state: present
with_items:
- yavdr-remote - yavdr-remote
- lirc - lirc
state: present
tags: tags:
- packages - packages
@ -41,11 +40,10 @@
- name: apt | install eventlircd and lircd2uinput - name: apt | install eventlircd and lircd2uinput
apt: apt:
name: '{{ item }}' name:
state: present
with_items:
- eventlircd - eventlircd
- lircd2uinput - lircd2uinput
state: present
tags: tags:
- packages - packages

View File

@ -55,9 +55,7 @@
- name: apt | install packages for xorg - name: apt | install packages for xorg
apt: apt:
name: '{{ item }}' name:
state: present
with_items:
- xlogin - xlogin
- yavdr-xorg - yavdr-xorg
- xorg - xorg
@ -72,14 +70,14 @@
- vdr-plugin-osd2web - vdr-plugin-osd2web
- feh - feh
#- yavdr-xorg #- yavdr-xorg
state: present
- name: apt | install packages for Intel IGP - name: apt | install packages for Intel IGP
apt: apt:
name: '{{ item }}' name:
state: present
with_items:
- xserver-xorg-video-intel - xserver-xorg-video-intel
- i965-va-driver-shaders - i965-va-driver-shaders
state: present
when: intel_detected when: intel_detected
- name: download yavdr logo - name: download yavdr logo
@ -106,9 +104,8 @@
- name: apt | install desktop programs - name: apt | install desktop programs
apt: apt:
name: '{{ item }}' name:
state: present
with_items:
- xterm - xterm
- firefox - firefox
- kiosk-browser - kiosk-browser
state: present