--- - name: Add mirror.adm.ynerant.fr in /etc/hosts lineinfile: state: present path: /etc/hosts regex: "^{{ item }}" line: "{{ item }} mirror.adm.ynerant.fr" loop: - "172.16.42.102" - "fd00::42:4000:ff:fe01:242" - name: Configure Debian repositories template: src: apt/sources.list.j2 dest: /etc/apt/sources.list owner: root group: root mode: 0644 - name: Configure extra repositories template: src: apt/sources.list.d/sources.list.j2 dest: "/etc/apt/sources.list.d/{{ item.name }}.list" owner: root group: root mode: 0644 loop: "{{ apt.extra_repositories }}" - name: Configure pin from future distributions when: item[2].key != ansible_distribution_release template: src: "apt/{{ item[0] }}.d/pin{{ item[1] }}.j2" dest: "/etc/apt/{{ item[0] }}.d/{{ item[2].key }}{{ item[1] }}" owner: root group: root mode: 0644 with_nested: - [["sources.list", ".list"], ["preferences", ""]] - "{{ apt.pin|dict2items }}" - name: Clear useless pinned configuration when: item[2].key == ansible_distribution_release file: path: "/etc/apt/{{ item[0] }}.d/{{ item[2].key }}{{ item[1] }}" state: absent with_nested: - [["sources.list", ".list"], ["preferences", ""]] - "{{ apt.pin|dict2items }}" - name: Update APT cache apt: update_cache: true # APT-List Changes : send email with changelog - include_tasks: apt-listchanges.yml # APT Unattended upgrades - include_tasks: apt-unattended.yml