From 836c946c72a2737c0a9fd09bce37c7b490b4e868 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Mon, 7 Jun 2021 10:54:12 -0400 Subject: [PATCH] Use independent fact to work around codename --- roles/base/tasks/main.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/roles/base/tasks/main.yml b/roles/base/tasks/main.yml index eaa4300..1d329c4 100644 --- a/roles/base/tasks/main.yml +++ b/roles/base/tasks/main.yml @@ -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