--- - name: Bootstrap Debian System vars: bootstrap_debian_release: >- {{ 'bullseye' if bootstrap_os_key == 'debian11' else 'bookworm' if bootstrap_os_key == 'debian12' else 'trixie' }} bootstrap_debian_base_list: "{{ lookup('vars', bootstrap_var_key).base | default([]) }}" bootstrap_debian_extra_list: "{{ lookup('vars', bootstrap_var_key).extra | default([]) }}" bootstrap_debian_base: "{{ bootstrap_debian_base_list | reject('equalto', '') | join(',') }}" bootstrap_debian_extra: >- {{ ( bootstrap_debian_extra_list ) | reject('equalto', '') | join(' ') }} ansible.builtin.command: "{{ item }}" loop: - >- debootstrap --include={{ bootstrap_debian_base }} {{ bootstrap_debian_release }} /mnt http://deb.debian.org/debian/ - "{{ chroot_command }} /mnt apt install -y {{ bootstrap_debian_extra }}" - "{{ chroot_command }} /mnt apt remove -y libcups2 libavahi-common3 libavahi-common-data" register: bootstrap_result changed_when: bootstrap_result.rc == 0