From aa1a9127b50391a663b82caf52c90734ae384aa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20P=C3=A9riard-Tremblay?= Date: Mon, 13 Mar 2017 11:47:53 -0400 Subject: [PATCH] apt-repositories: Refactor duplicated code --- apt-repositories/tasks/backports.yml | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/apt-repositories/tasks/backports.yml b/apt-repositories/tasks/backports.yml index 7d249b90..060aae6c 100644 --- a/apt-repositories/tasks/backports.yml +++ b/apt-repositories/tasks/backports.yml @@ -2,42 +2,20 @@ - name: Backports sources list is installed template: - src: jessie_backports.list.j2 + src: '{{ ansible_distribution_release }}_backports.list.j2' dest: /etc/apt/sources.list.d/backports.list force: yes backup: yes mode: "640" notify: apt update - when: ansible_distribution_major_version == '8' - -- name: Backports sources list is installed - template: - src: stretch_backports.list.j2 - dest: /etc/apt/sources.list.d/backports.list - force: yes - backup: yes - mode: "640" - notify: apt update - when: ansible_distribution_major_version == '9' - name: Backports configuration copy: - src: jessie_backports_preferences + src: '{{ ansible_distribution_release }}_backports_preferences' dest: /etc/apt/preferences.d/backports force: yes backup: yes mode: "640" notify: apt update - when: ansible_distribution_major_version == '8' - -- name: Backports configuration - copy: - src: stretch_backports_preferences - dest: /etc/apt/preferences.d/backports - force: yes - backup: yes - mode: "640" - notify: apt update - when: ansible_distribution_major_version == '9' - meta: flush_handlers