Closed nis65 closed 2 years ago
Hint from one of my colleagues:
I would rewrite that to:
snapclient_snapservers:
- name: pidev
snapclient_snapserver: pidev.iselin.net
snapclient_sink: dmix:CARD=sndrpihifiberry,DEV=0
- name: hifi
snapclient_snapserver: hifi.iselin.net
snapclient_sink: dmix:CARD=sndrpihifiberry,DEV=0
And loop over it with something like this:
- name: do something
debug:
msg: "{{ item.name }} has {{ item.snapclient_snapserver }} and {{ item.snapclient_sink }}"
loop: "{{ snapclient_snapservers }}"
loop_control:
label: "{{ item.name }}"
Functionality is in dev branch
Today I changed the snapclient role to support multiple snapclients per host: https://github.com/Daenou/ansible-multiroom-audio/pull/25
I more or less merged the
acable
ansible logic into thesnapclient
role.To my understanding, the current loop logic is somewhat redundant. You have both
acable_connections
playing the same role for acable assnapclient_snapservers
does for snapclientacable_config
playing the same role for acable assnapclient_config
does for snapclient.The former is used in tasks/main.yml to enable/start the systemd units and in handlers/main.yml to restart the systemd units.
On the other hand, the latter is used to create the config files in
/etc/acable.conf.d/
and/etc/snapserver.conf.d
.I think it should be possible to use the
_config
dict to manage the systemd units and drop the former one...