In remediate/tasks/main.yml the requested remediations are executed with:
- name: Remediate the system
ansible.builtin.include_tasks: "{{ remediation }}.yml"
loop: "{{ remediation_playbooks }}"
loop_control:
loop_var: remediation
when: remediation in remediation_todo
But in remediate/tasks/leapp_missing_pkg.yml there are assumptions that remediation could be unset which can't be the case due to the above:
- name: leapp_missing_pkg | End execution of playbook if no entry found in leapp report
ansible.builtin.meta: end_host
when: remediation is not defined
- name: leapp_missing_pkg | Install the missing package via remediation command
ansible.builtin.command: "{{ remediation.context | join(' ') }}"
when: remediation is defined
register: remediation_result
changed_when: remediation_result.rc == 0
I'd change the variable in main.yml to something less generic and also would recommend to avoid the meta: end_host which a) duplicates the when check in the next task b) doesn't allow using this role in playbooks using more than just this role. Thanks.
In
remediate/tasks/main.yml
the requested remediations are executed with:But in
remediate/tasks/leapp_missing_pkg.yml
there are assumptions thatremediation
could be unset which can't be the case due to the above:I'd change the variable in main.yml to something less generic and also would recommend to avoid the
meta: end_host
which a) duplicates thewhen
check in the next task b) doesn't allow using this role in playbooks using more than just this role. Thanks.