ansible-vault icon indicating copy to clipboard operation
ansible-vault copied to clipboard

fix: set vault_os_packages for RedHat

Open dotdiego opened this issue 3 years ago • 2 comments

#302

Is it possible to handle package installation conditionally like this ? This method comes from ansible-community.ansible-nomad role.

I think that RedHat8.yml can be removed too with this solution.

dotdiego avatar Sep 03 '22 17:09 dotdiego

Yes this can be done, but instead of having to define the name and version of every rhel based distro you can simply check if the system is running python 2 or 3. Something like this:

  - "{{ 'libselinux-python' if ansible_python_version is version('3', '<')  else 'python3-libselinux' }}"

And yes while you are at it, it would be good to delete the vars/RedHat8.yml file as it is no longer needed with this change.

gardar avatar Sep 06 '22 09:09 gardar

@gardar thanks for your input. I've edited the file with your solution and removed RedHat8.yml

dotdiego avatar Sep 06 '22 17:09 dotdiego