Open obrain17 opened 7 months ago
Thank you very much, I chaged the logic error in the autoinstall-firmware role in https://github.com/yavdr/yavdr-ansible/commit/35ae7fa9ac976a7dbd756de00ffb9a845ba95c3d
How does "{{ 'files/dvbsky-firmware.tar.gz' is file }}"
work in this task?
block:
+ - name: check if firmware exists in files folder
+ set_fact:
+ dvbsky_firmware_exists: "{{ 'files/dvbsky-firmware.tar.gz' is file }}"
As far as I know one would have to use stat
to lookup information about a file: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/stat_module.html and then use the isreg
attribute of the result.
Maybe it would be better to download and cache the file on the controller and then just copy it to the target machine?
The variable dvbsky_firmware_exists
is a bool value set with set_fact
depending if "{{ 'files/dvbsky-firmware.tar.gz' is file }}"
is True
or False
.
I also tried using stat
to check the existence
- name: check if firmware exists in files folder
stat:
path: files/dvbsky-firmware.tar.gz
register: dvbsky_firmware
- name: extract firmware found in files folder
unarchive:
src: files/dvbsky-firmware.tar.gz
dest: /tmp/
when: dvbsky_firmware.stat.exists
But this did not work. I think because the stat
action is done on the remote (target) server and the relative path files/
is not found there. Probably it could be done using local_action
or similar ( Controlling where tasks run: delegation and local actions — Ansible Community Documentation ) but is file
worked for me.
The file is only copied from local files/
folder to the target server when the unarchive
is done. Therefore it is very important to have remote_src: no
or comment this setting for default behaviour:
# remote_src: yes
The archive dvbsky-firmware.tar.gz
is dated 2015 or older same as the DVBSky V2 and V3 cards are. So owners of these cards probably already have it and can copy it to the files
folder rather than downloading it any time the playbook runs.
Ah ok, I found it: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/file_test.html - I have to check if this works with older ansible versions like in focal, too
I am currently setting up a new yaVDR server with Ansible remotely.
Now I found that:
a) my DVBSky V2 card is not recognized with the autoinstall-dvbsky-firmware role
b) the firmware is installed with the autoinstall-firmware role - but this role also installs other firmwares that are not needed for the DVBSky
I already have created fixes for my own, and do not think it is appropriate to create a PR for all. But I still want to share the patches to be applied with git patch.
@seahawk1986 maybe you implement them as well in the repo, and let me know if you prefer me to create a PR.
a) is fixed with the following patch.
Additionally a task is implemented that would not download dvbsky-firmware.tar.gz if the file is already present in some file folder accessible by the role. (e.g. yavdr-ansible/files, which I also use for other files like channels.conf to be copied from). This is probably not necessary any more since the file has been available again with the new url.
With this all DVBSky firmware files get copied if either a card V2 (
"14f1:8852" in pci'
) or V3 ("1ade:3038" in pci'
) has been found.You can override this detection by placing a section like:
in e.g. in a file host_vars/my_yavdr_host. Then only the listed files will be copied, regardless if a card was detected or not.
b) is fixed with the following patch.
For card detection
union(pci)
is changed tointersect(pci)
, so a firmware will only be installed if its id is in both*_ids list
andpci
orusb
.With both fixes only detected or explicitly listed (only for DVBSky) firmware will be installed. For those who still want to install all firmwares the role install-dvb-firmware should be used. It uses the repository https://github.com/LibreElec/dvb-firmware.git, which apparently contains the same files as provided by the other roles.