Prevent playbook abort if variables are not defined

- Skip task `Deploy sudo configurations` when `sudo_permissions` is not defined
- Skip task `Deploy polkit configurations` when `polkit_rules` is not defined
This commit is contained in:
Raphael Dannecker 2025-03-24 14:23:14 +01:00
parent 91ab4d3511
commit 05844989eb

View file

@ -39,6 +39,7 @@
{% for user, programs in sudo_permissions.items() %}
{{ user }} ALL=(root) NOPASSWD: {% for program in programs %}{{ program }}{% if not loop.last %}, {% endif %}{% endfor %}
{% endfor %}
when: sudo_permissions is defined
- name: Deploy polkit configurations
ansible.builtin.template:
@ -46,3 +47,4 @@
dest: /etc/polkit-1/rules.d/lmn-security.rules
mode: '0644'
notify: Restart polkit
when: polkit_rules is defined