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,28 +666,27 @@ 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:
- anacron
- acl
- at
- bash-completion
#- biosdevname # caution: may change device names after a minimal installation!
- debconf-utils
- linux-firmware
- psmisc
- python-kmodpy
- python-requests
- python-usb
- python3-usb
- software-properties-common
- ssh
- wget
- wpasupplicant
- usbutils
- xfsprogs
state: present state: present
install_recommends: no install_recommends: no
with_items:
- anacron
- acl
- at
- bash-completion
#- biosdevname # caution: may change device names after a minimal installation!
- debconf-utils
- linux-firmware
- psmisc
- python-kmodpy
- python-requests
- python-usb
- python3-usb
- software-properties-common
- ssh
- wget
- wpasupplicant
- usbutils
- xfsprogs
#+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:
- vdr
- vdrctl
- vdr-plugin-dbus2vdr
state: present state: present
install_recommends: no install_recommends: no
with_items:
- vdr
- vdrctl
- vdr-plugin-dbus2vdr
#+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,17 +1136,16 @@ install_avahi: true
- name: apt | install packages for network services - name: apt | install packages for network services
apt: apt:
name: '{{ item }}' name:
- avahi-daemon
- avahi-utils
#- biosdevname # caution: this may change device names after a minimal installation!
- ethtool
- nfs-common
- vdr-addon-avahi-linker
- wakeonlan
state: present state: present
install_recommends: no install_recommends: no
with_items:
- avahi-daemon
- avahi-utils
#- biosdevname # caution: this may change device names after a minimal installation!
- ethtool
- nfs-common
- vdr-addon-avahi-linker
- wakeonlan
# 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:
- nfs-kernel-server
- nfs-common
state: present state: present
install_recommends: no install_recommends: no
with_items:
- nfs-kernel-server
- nfs-common
- 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:
- yavdr-remote
- lirc
state: present state: present
with_items:
- yavdr-remote
- lirc
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:
- eventlircd
- lircd2uinput
state: present state: present
with_items:
- eventlircd
- lircd2uinput
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:
- pulseaudio
- pavucontrol
- vdr-plugin-pulsecontrol
state: present state: present
install_recommends: no install_recommends: no
with_items:
- pulseaudio
- pavucontrol
- vdr-plugin-pulsecontrol
- name: create /etc/asound.conf with pulseaudio as default device - name: create /etc/asound.conf with pulseaudio as default device
template: template:
@ -2144,31 +2131,29 @@ preferred_refreshrates:
- name: apt | install packages for xorg - name: apt | install packages for xorg
apt: apt:
name: '{{ item }}' name:
- xlogin
- yavdr-xorg
- xorg
- xserver-xorg-input-all
- xserver-xorg-video-all
- openbox
- python3-dbus2vdr
- python3-yavdrfrontend
- read-edid
- tmux
- vdr-plugin-desktop
- vdr-plugin-osd2web
- feh
#- yavdr-xorg
state: present state: present
with_items:
- xlogin
- yavdr-xorg
- xorg
- xserver-xorg-input-all
- xserver-xorg-video-all
- openbox
- python3-dbus2vdr
- python3-yavdrfrontend
- read-edid
- tmux
- vdr-plugin-desktop
- vdr-plugin-osd2web
- feh
#- yavdr-xorg
- name: apt | install packages for Intel IGP - name: apt | install packages for Intel IGP
apt: apt:
name: '{{ item }}' name:
- xserver-xorg-video-intel
- i965-va-driver-shaders
state: present state: present
with_items:
- xserver-xorg-video-intel
- i965-va-driver-shaders
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:
- xterm
- firefox
- kiosk-browser
state: present state: present
with_items:
- xterm
- firefox
- kiosk-browser
#+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:
- samba
- samba-common
- samba-common-bin
- tdb-tools
state: present state: present
install_recommends: no install_recommends: no
with_items: with_items:
- samba
- samba-common
- samba-common-bin
- tdb-tools
#+END_SRC #+END_SRC
** samba-config ** samba-config
@ -5135,12 +5119,11 @@ 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 - virtualbox-guest-x11-hwe
- virtualbox-guest-x11-hwe
# TODO: set xineliboutput as frontend # TODO: set xineliboutput as frontend
when: when:
@ -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:
- vdr-plugin-xineliboutput
- xineliboutput-sxfe
state: present state: present
with_items:
- vdr-plugin-xineliboutput
- xineliboutput-sxfe
- 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,12 +6,11 @@
- 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 - virtualbox-guest-x11-hwe
- virtualbox-guest-x11-hwe
# TODO: set xineliboutput as frontend # TODO: set xineliboutput as frontend
when: when:
@ -22,11 +21,10 @@
- name: set xineliboutput as frontend - name: set xineliboutput as frontend
block: block:
- apt: - apt:
name: '{{ item }}' name:
- vdr-plugin-xineliboutput
- xineliboutput-sxfe
state: present state: present
with_items:
- vdr-plugin-xineliboutput
- xineliboutput-sxfe
- 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:
- nfs-kernel-server
- nfs-common
state: present state: present
install_recommends: no install_recommends: no
with_items:
- nfs-kernel-server
- nfs-common
- 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:
- pulseaudio
- pavucontrol
- vdr-plugin-pulsecontrol
state: present state: present
install_recommends: no install_recommends: no
with_items:
- pulseaudio
- pavucontrol
- vdr-plugin-pulsecontrol
- 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:
- samba
- samba-common
- samba-common-bin
- tdb-tools
state: present state: present
install_recommends: no install_recommends: no
with_items: with_items:
- samba
- samba-common
- samba-common-bin
- tdb-tools

View File

@ -3,13 +3,12 @@
- name: apt | install basic vdr packages - name: apt | install basic vdr packages
apt: apt:
name: '{{ item }}' name:
- vdr
- vdrctl
- vdr-plugin-dbus2vdr
state: present state: present
install_recommends: no install_recommends: no
with_items:
- vdr
- vdrctl
- vdr-plugin-dbus2vdr
- 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,32 +31,29 @@
skip: true skip: true
- name: apt | install basic packages - name: apt | install basic packages
apt: apt:
name: '{{ item }}' name:
- anacron
- acl
- at
- bash-completion
#- biosdevname # caution: may change device names after a minimal installation!
- debconf-utils
- linux-firmware
- psmisc
- python-kmodpy
- python-requests
- python-usb
- python3-usb
- software-properties-common
- ssh
- wget
- wpasupplicant
- usbutils
- xfsprogs
state: present state: present
install_recommends: no install_recommends: no
with_items:
- anacron
- acl
- at
- bash-completion
#- biosdevname # caution: may change device names after a minimal installation!
- debconf-utils
- linux-firmware
- psmisc
- python-kmodpy
- python-requests
- python-usb
- python3-usb
- software-properties-common
- ssh
- wget
- wpasupplicant
- usbutils
- xfsprogs
- 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 }}'

View File

@ -3,17 +3,16 @@
- name: apt | install packages for network services - name: apt | install packages for network services
apt: apt:
name: '{{ item }}' name:
- avahi-daemon
- avahi-utils
#- biosdevname # caution: this may change device names after a minimal installation!
- ethtool
- nfs-common
- vdr-addon-avahi-linker
- wakeonlan
state: present state: present
install_recommends: no install_recommends: no
with_items:
- avahi-daemon
- avahi-utils
#- biosdevname # caution: this may change device names after a minimal installation!
- ethtool
- nfs-common
- vdr-addon-avahi-linker
- wakeonlan
# 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:
- yavdr-remote
- lirc
state: present state: present
with_items:
- yavdr-remote
- lirc
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:
- eventlircd
- lircd2uinput
state: present state: present
with_items:
- eventlircd
- lircd2uinput
tags: tags:
- packages - packages

View File

@ -55,31 +55,29 @@
- name: apt | install packages for xorg - name: apt | install packages for xorg
apt: apt:
name: '{{ item }}' name:
- xlogin
- yavdr-xorg
- xorg
- xserver-xorg-input-all
- xserver-xorg-video-all
- openbox
- python3-dbus2vdr
- python3-yavdrfrontend
- read-edid
- tmux
- vdr-plugin-desktop
- vdr-plugin-osd2web
- feh
#- yavdr-xorg
state: present state: present
with_items:
- xlogin
- yavdr-xorg
- xorg
- xserver-xorg-input-all
- xserver-xorg-video-all
- openbox
- python3-dbus2vdr
- python3-yavdrfrontend
- read-edid
- tmux
- vdr-plugin-desktop
- vdr-plugin-osd2web
- feh
#- yavdr-xorg
- name: apt | install packages for Intel IGP - name: apt | install packages for Intel IGP
apt: apt:
name: '{{ item }}' name:
- xserver-xorg-video-intel
- i965-va-driver-shaders
state: present state: present
with_items:
- xserver-xorg-video-intel
- i965-va-driver-shaders
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:
- xterm
- firefox
- kiosk-browser
state: present state: present
with_items:
- xterm
- firefox
- kiosk-browser