From a47e4ddc43849f36d58a1b48e0f7a71157a82ae1 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Tue, 15 Aug 2023 21:55:53 +0200 Subject: use ansible_distribution_release as default for APT setup --- roles/apt_repo/defaults/main.yml | 1 - roles/apt_repo/tasks/main.yml | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'roles/apt_repo') diff --git a/roles/apt_repo/defaults/main.yml b/roles/apt_repo/defaults/main.yml index 0877adf..6d09a7b 100644 --- a/roles/apt_repo/defaults/main.yml +++ b/roles/apt_repo/defaults/main.yml @@ -1,2 +1 @@ apt_repo_keys_dir: /etc/apt/keyrings -apt_repo_component: main diff --git a/roles/apt_repo/tasks/main.yml b/roles/apt_repo/tasks/main.yml index 25069bb..b9baffd 100644 --- a/roles/apt_repo/tasks/main.yml +++ b/roles/apt_repo/tasks/main.yml @@ -17,7 +17,11 @@ dest: '{{ key_path }}' mode: '644' + - name: Get host distribution + ansible.builtin.setup: + gather_subset: [distribution_release] + - name: 'Add repository: {{ apt_repo_name }}' ansible.builtin.apt_repository: - repo: 'deb [signed-by={{ key_path }}] {{ apt_repo_url }} {{ apt_repo_distro }} {{ apt_repo_component }}' + repo: 'deb [signed-by={{ key_path }}] {{ apt_repo_url }} {{ apt_repo_distro | default(ansible_distribution_release) }} {{ apt_repo_component | default("main") }}' filename: '{{ apt_repo_name }}' -- cgit v1.2.3