diff --git a/tasks/install-Debian.yml b/tasks/install-Debian.yml index 1fdd740..89df884 100644 --- a/tasks/install-Debian.yml +++ b/tasks/install-Debian.yml @@ -13,7 +13,7 @@ - name: 'Add Microsoft APT key' ansible.builtin.apt_key: url: '{{ microsoft_repository_gpgkey }}' - keyring: '/usr/share/keyrings/microsoft-archive-keyring.gpg' + keyring: '{{ _microsoft_repository_local_gpgkey }}' state: present when: not ansible_check_mode diff --git a/templates/microsoft.list.j2 b/templates/microsoft.list.j2 index 2314934..94466e6 100644 --- a/templates/microsoft.list.j2 +++ b/templates/microsoft.list.j2 @@ -2,8 +2,8 @@ {% for microsoft_repository_dir in microsoft_repository_dirs_list %} {% if microsoft_repository_dir.type is defined and microsoft_repository_dir.type == 'alternative' %} -deb [arch=amd64,arm64,armhf signed-by=/usr/share/keyrings/microsoft-archive-keyring.gpg] {{ _microsoft_repository_alternative_mirror_url }}/{{ microsoft_repository_dir.name }} {{ ansible_distribution_release }} main +deb [arch=amd64,arm64,armhf signed-by={{ _microsoft_repository_local_gpgkey }}] {{ _microsoft_repository_alternative_mirror_url }}/{{ microsoft_repository_dir.name }} {{ ansible_distribution_release }} main {% else %} -deb [arch=amd64,arm64,armhf signed-by=/usr/share/keyrings/microsoft-archive-keyring.gpg] {{ _microsoft_repository_base_mirror_url }}/{{ microsoft_repository_dir.name }} {{ ansible_distribution_release }} main +deb [arch=amd64,arm64,armhf signed-by={{ _microsoft_repository_local_gpgkey }}] {{ _microsoft_repository_base_mirror_url }}/{{ microsoft_repository_dir.name }} {{ ansible_distribution_release }} main {% endif %} {% endfor %} \ No newline at end of file diff --git a/vars/Debian.yml b/vars/Debian.yml index fe8fa9b..a54a02c 100644 --- a/vars/Debian.yml +++ b/vars/Debian.yml @@ -1,3 +1,6 @@ --- -_microsoft_repository_base_mirror_url: '{{ microsoft_repository_mirror_url }}/{{ ansible_distribution | lower }}/{{ ansible_distribution_major_version }}' +_microsoft_repository_local_gpgkey: '/usr/share/keyrings/microsoft-archive-keyring.gpg' + +_microsoft_repository_distribution_version: "{{ (ansible_distribution == 'Ubuntu') | ternary(ansible_distribution_version, ansible_distribution_major_version) }}" +_microsoft_repository_base_mirror_url: '{{ microsoft_repository_mirror_url }}/{{ ansible_distribution | lower }}/{{ _microsoft_repository_distribution_version }}' _microsoft_repository_alternative_mirror_url: '{{ microsoft_repository_mirror_url }}/repos' diff --git a/vars/Ubuntu.yml b/vars/Ubuntu.yml deleted file mode 100644 index d08ab61..0000000 --- a/vars/Ubuntu.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -_microsoft_repository_base_mirror_url: '{{ microsoft_repository_mirror_url }}/{{ ansible_distribution | lower }}/{{ ansible_distribution_version }}' -_microsoft_repository_alternative_mirror_url: '{{ microsoft_repository_mirror_url }}/repos'