Use independent fact to work around codename

This commit is contained in:
Joshua Boniface 2021-06-07 10:54:12 -04:00 committed by Joshua Boniface
parent 69c037c136
commit 836c946c72
1 changed files with 16 additions and 1 deletions

View File

@ -15,6 +15,21 @@
when: newhost_check.changed when: newhost_check.changed
tags: always 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 # Remove obsolete issue-gen
# #
@ -78,7 +93,7 @@
with_items: with_items:
- { src: "etc/apt/apt.conf.d/10norecommends.j2", dest: "/etc/apt/apt.conf.d/10norecommends" } - { 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/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 register: apt_config
tags: base-apt tags: base-apt