~ fixes E303... really

This commit is contained in:
nicobo 2020-11-19 22:41:07 +01:00
parent a306b68b58
commit d3db6d8faf
No known key found for this signature in database
GPG key ID: 2581E71C5FA5285F

View file

@ -80,10 +80,24 @@
register: module_http register: module_http
- name: Restart pulseaudio daemon if config changed - name: Restart pulseaudio daemon if config changed
command: systemctl --user restart pulseaudio.service systemd:
name: pulseaudio.service
scope: user
state: restarted
when: module_http.changed when: module_http.changed
# Because the `ini_file` module used in a loop and `backup:yes` would create a backup for each iteration... :-(
- name: Backup Rygel config file (1/3 - tests if file exists)
stat:
path: "{{ rygel_conf_path }}"
register: rygel_conf
- name: Backup Rygel config file (2/3 - reads initial file content)
slurp:
src: "{{ rygel_conf_path }}"
register: rygel_conf_backup
when: rygel_conf.stat.exists
# https://wiki.gnome.org/Projects/Rygel/Pulseaudio # https://wiki.gnome.org/Projects/Rygel/Pulseaudio
- name: Configure Rygel - name: Configure Rygel
ini_file: ini_file:
@ -92,7 +106,7 @@
option: "{{ item.option }}" option: "{{ item.option }}"
value: "{{ item.value }}" value: "{{ item.value }}"
no_extra_spaces: yes no_extra_spaces: yes
backup: yes backup: no
loop: loop:
# Still required ? # Still required ?
- section: External - section: External
@ -133,6 +147,14 @@
- section: GstLaunch - section: GstLaunch
option: myaudiompeg-launch option: myaudiompeg-launch
value: "pulsesrc device=upnp.monitor ! audio/x-raw,channels=2 ! lamemp3enc target=quality quality=6" value: "pulsesrc device=upnp.monitor ! audio/x-raw,channels=2 ! lamemp3enc target=quality quality=6"
register: rygel_conf
# Because the `ini_file` module used in a loop and `backup:yes` would create a backup for each iteration... :-(
- name: Backup Rygel config file (3/3 - saves the temporary backup only if rygel.conf has changed)
copy:
dest: "{{ rygel_conf }}.{{ 9999 | random }}.{{ '%Y-%m-%d@%H:%M:%S~' | strftime }}"
content: "{{ rygel_conf_backup['contents'] | b64decode }}"
when: rygel_conf.changed
# TODO Allow preventing Rygel from exporting all media by default # TODO Allow preventing Rygel from exporting all media by default