Open damianoneill opened 3 years ago
I can't reproduce this when running on Vagrant VMs or on a VPS. Unless I'm missing something, the vars/default.yml
file should be included for every distribution that is not Debian (and family), so I can't see why this wouldn't work..
Here is a snippet from the playbook used:
# ....
tasks:
- name: Sysctl tweaks.
include_role:
name: chzerv.sysctl
apply:
become: true
- name: Print distribution and version.
debug:
msg: "{{ ansible_distribution }} {{ ansible_distribution_version }}"
- name: Print 'sysctl_required_packages'
debug:
msg: "{{ sysctl_required_packages }}"
And the results:
TASK [ansible-role-sysctl : Install required packages.] **************************************************
ok: [x.x.x.x]
TASK [ansible-role-sysctl : Apply configuration.] ********************************************************
ok: [x.x.x.x] => (item=net.ipv4.ip_forward = 1)
ok: [x.x.x.x] => (item=kernel.kexec_load_disabled = 1)
TASK [Print distribution and version.] *******************************************************************
ok: [x.x.x.x] => {
"msg": "CentOS 7.9"
}
TASK [Print 'sysctl_required_packages'] ******************************************************************
ok: [x.x.x.x] => {
"msg": [
"procps-ng"
]
}
Please disregard my previous comment. This should be now fixed.
I have a pre-existing Redhat.yml, your with_first_found means this is loaded. Therefore default is never loaded, so the variable is missing. The easiest fix is to add a Redhat.yml alongside your Debian.yml with the redhat package.
Is the fix I pushed not working or do you think there is a reason I should go back to using with_first_found
and simply create a file for each distribution family?
Hi @chzerv when running on Centos 7 (distribution family - Redhat), sysctl_required_packages is not being set correctly.
Assume your task check is matching any instance of Redhat.yml in the playbook, adding a Redhat.yml to your vars directory should resolve the issue.