Use independent fact to work around codename

This commit is contained in:
Joshua Boniface 2023-09-01 15:42:26 -04:00
parent 5c46bb0db7
commit 6104e0a5a5
1 changed files with 16 additions and 1 deletions

View File

@ -15,6 +15,21 @@
when: newhost_check.changed
tags: always
#
# Set codename
#
- name: set release codename (with ansible_distribution_release)
set_fact:
debian_codename: "{{ ansible_distribution_release }}"
when: ansible_distribution_release is defined
tags: always
- name: set release codename (with ansible_lsb)
set_fact:
debian_codename: "{{ ansible_lsb.codename }}"
when: ansible_lsb.codename is defined
tags: always
#
# Remove obsolete issue-gen
#
@ -78,7 +93,7 @@
with_items:
- { src: "etc/apt/apt.conf.d/10norecommends.j2", dest: "/etc/apt/apt.conf.d/10norecommends" }
- { src: "etc/apt/preferences.d/pins.j2", dest: "/etc/apt/preferences.d/pins" }
- { src: "etc/apt/sources.list.{{ ansible_machine }}.{{ ansible_lsb.codename }}.j2", dest: "/etc/apt/sources.list" }
- { src: "etc/apt/sources.list.{{ ansible_machine }}.{{ debian_codename }}.j2", dest: "/etc/apt/sources.list" }
register: apt_config
tags: base-apt