diff --git a/roles/common/tasks/apt.yml b/roles/common/tasks/apt.yml index 01c7b31..529e155 100644 --- a/roles/common/tasks/apt.yml +++ b/roles/common/tasks/apt.yml @@ -36,6 +36,17 @@ tags: - apt-configuration +- name: (apt.yml) check if legacy /etc/apt/sources.list exists (Debian >= 13) + stat: + path: /etc/apt/sources.list + register: apt_sources_list_stat + when: + - apt_manage_sources_list|bool + - ansible_facts['distribution'] == 'Debian' + - (ansible_facts['distribution_major_version'] | int) >= 13 + tags: + - apt-configuration + - name: (apt.yml) backup legacy /etc/apt/sources.list before deb822 migration (Debian >= 13) copy: src: /etc/apt/sources.list @@ -49,9 +60,7 @@ - apt_manage_sources_list|bool - ansible_facts['distribution'] == 'Debian' - (ansible_facts['distribution_major_version'] | int) >= 13 - failed_when: - - apt_sources_list_backup.failed - - "'No such file or directory' not in (apt_sources_list_backup.msg | default(''))" + - apt_sources_list_stat.stat.exists | default(false) register: apt_sources_list_backup tags: - apt-configuration