--- - name: No backports config in default sources.list ansible.builtin.lineinfile: dest: /etc/apt/sources.list regexp: "backports" state: absent tags: - apt - name: Backports sources list is installed ansible.builtin.template: src: '{{ ansible_distribution_release }}_backports.list.j2' dest: /etc/apt/sources.list.d/backports.list force: yes mode: "0640" register: apt_backports_list tags: - apt - name: Backports configuration ansible.builtin.copy: src: '{{ ansible_distribution_release }}_backports_preferences' dest: /etc/apt/preferences.d/0-backports-defaults force: yes mode: "0640" register: apt_backports_config tags: - apt - name: Archived backport are accepted (jessie) ansible.builtin.lineinfile: dest: '/etc/apt/apt.conf.d/99no-check-valid-until' line: 'Acquire::Check-Valid-Until no;' create: yes state: present tags: - apt when: ansible_distribution_release == "jessie" - name: Apt update ansible.builtin.apt: update_cache: yes tags: - apt when: apt_backports_list is changed or apt_backports_config is changed