Add check for legacy /etc/apt/sources.list existence before backup in apt.yml
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user