Reputation: 19099
I have below files csi.yaml
file, it include the roles beased on the OS version. this work but if I run it on CentOS 8, its giving skipping:
message all the task in RHEL7-CIS tasks.
roles:
- { role: RHEL7-CIS, when: ansible_distribution == "CentOS" and ansible_distribution_major_version == '7' }
- { role: RHEL8-CIS, when: ansible_distribution == "CentOS" and ansible_distribution_major_version == '8' }
try to include the role based on OS version this but its giving error also.
gather_facts: True
roles:
- "RHEL{{ ansible_distribution_major_version }}-CIS"
ERROR! 'ansible_distribution_major_version' is undefined
Is there an alternate way of including the role based on OS version?
Thanks SR
Upvotes: 1
Views: 1446