--- - name: install global sources.list template: src: "{{ ansible_lsb.id | default(ansible_distribution) }}.list.j2" dest: /etc/apt/sources.list register: apt_repo_base_sources - name: remove new-style ubuntu apt source entries loop: - ubuntu.sources - ubuntu.sources.curtin.orig file: path: "/etc/apt/sources.list.d/{{ item }}" state: absent - name: update apt cache when: apt_repo_base_sources is changed command: apt-get update - name: create keyring directory for external repos file: path: /etc/apt/keyrings state: directory ## aptitude is needed for package upgrade roles - name: install aptitude apt: name: aptitude state: present - name: get rid of ubuntu esm ads when: - ansible_distribution == "Ubuntu" file: path: /etc/apt/apt.conf.d/20apt-esm-hook.conf state: absent