dotfiles/roles/os_deb/tasks/repositories.yml
Matej Focko a763442128
fix(deb,repos): refresh after adding new repos
When setting deb repositories it is necessary to manually refresh, if
there were some changes made since the metadata from mirrors don't get
pulled in automatically “on change”. Therefore do the refresh
“on change” manually.

Signed-off-by: Matej Focko <me@mfocko.xyz>
2025-04-21 12:05:54 +02:00

35 lines
1 KiB
YAML

---
- name: Disable installation DVD as a source
ansible.builtin.lineinfile:
path: /etc/apt/sources.list
regexp: "^deb cdrom:"
state: absent
- name: Enable additional Debian repos
ansible.builtin.deb822_repository:
name: "{{ item.name }}"
types:
- deb
- deb-src
uris: "{{ item.uris }}"
suites: "{{ item.suites }}"
components:
- contrib
- non-free
state: present
loop:
- name: contrib-non_free
uris: http://ftp.sk.debian.org/debian/
suites: "{{ ansible_facts.distribution_release }}"
- name: security-contrib-non_free
uris: http://security.debian.org/debian-security
suites: "{{ ansible_facts.distribution_release }}-security"
- name: updates-contrib-non_free
uris: http://ftp.sk.debian.org/debian/
suites: "{{ ansible_facts.distribution_release }}-updates"
register: _deb_repo
- name: Refresh the cache, if any of the repos has changed
ansible.builtin.apt:
update_cache: true
when: _deb_repo.changed