Open vphan13 opened 2 months ago
What version of Ansible are you using? Do you gather facts before running the role?
I do perform a gather fact. My ansible version is ansible 2.14.14
The error says 'dict object' has no attribute 'distribution'
, so distribution
is not part of ansible_facts
in your case. But it should, also in Ansible 2.14. Could you please put this in front of your import_role:
and show the output of both tasks, please?
- ansible.builtin.debug:
var: ansible_facts
I think I have figure it out. I needed to create a symlink from setup-CentOS.yml to setup-Rocky-9.yml in the following two directories
/home/user/.ansible/collections/ansible_collections/jm1/libvirt/roles/setup/tasks /home/user/.ansible/collections/ansible_collections/jm1/pkg/roles/setup/tasks
I think the same needs to be done for alma linux
Rocky Linux and AlmaLinux try to clone RHEL and CentOS as close as possible, so it might be an option for you to define distribution_id
as ['CentOS', '9']
or similar in your Ansible inventory (example). This will override the role defaults, releaving you from having to add all those symlinks.
But depending on your Ansible code, it might make sense to skip the roles in jm1.libvirt
and jm1.pkg
entirely and simply use the Ansible modules only. For example, role jm1.libvirt.server
is simply meant as an example of how to use the Ansible modules in that collection, but in production I use different roles (see jm1.cloudy).
Ok that makes sense and I will do that but Is there any reason you couldn't add the symlinks into the role? The package names should be the same for Rocky/Alma/CentOS, so I don't think there will be any issues.
It is certainly possible but a tedious and boring chore. For example, I recently added support for Fedora and that took quite some effort, simply because there are a lot of collections, roles and places to change.
Thank you for your support on this. I will make the changes on my end as you suggested. Feel free to close out this ticket or reach out if you need me to test any changes you make
This doesn't seem to work with the above flavors. I'm aware of the missing package, but running the setup bombs out any packages installations are attempted
Here is the output of the error
I created a setup-Rocky-9.yml file under the same directory as the other setup- files, but this does not resolve the issue