when: ansible_distribution != "Ubuntu" or
(ansible_distribution == "Ubuntu" and ansible_distribution_major_version < 16)
+ - name: Check for custom repos
+ shell: "ls -1 /etc/apt/sources.list.d"
+ register: custom_repos
+
+ - name: Delete custom repos
+ file:
+ path: "/etc/apt/sources.list.d/{{ item }}"
+ state: absent
+ with_items: "{{ custom_repos.stdout_lines }}"
+ when: custom_repos|length > 0
+
+ - name: Update apt cache
+ apt:
+ update_cache: yes
+
# vagrant doesn't have repositories, this chacra repo will be better to have
# around and can get updates as soon as a new vagrant version is published via
# chacractl