Add the ability to override the system's default repositories
Ubuntu 24.04 is the first release where package sources for Ubuntu are stored in a `.sources` file called `/etc/apt/sources.list.d/ubuntu.sources`, instead of the traditional `sources.list`. This means that we have lost the ability to override the system's default repositories. Previously, we could use the `apt_disable_sources_list` setting to disable default repositories and provide our own using `apt_repositories`. However, this is no longer possible. Now, each element of `apt_repositories` contains a field called `name`, which specifies the name of the repository file (without the `.sources` suffix). The default value of this field is `kayobe` and it may be omitted. The user can override the default by providing a different name, such as `ubuntu`, and new repository data. This way, the default file, `/etc/apt/source.list.d/ubuntu.sources`, will be overwritten by the provided repository configuration. Closes-Bug: #2107280 Change-Id: Ieaa1f56de7579ff5f989b207e29de29e148086be Signed-off-by: Maksim Malchuk <maksim.malchuk@gmail.com>
This commit is contained in:

committed by
Pierre Riteau

parent
949b5a97a5
commit
b4733da80a
@@ -27,6 +27,8 @@ apt_config: []
|
|||||||
apt_keys: []
|
apt_keys: []
|
||||||
|
|
||||||
# A list of Apt repositories. Each item is a dict with the following keys:
|
# A list of Apt repositories. Each item is a dict with the following keys:
|
||||||
|
# * name: the <name>.sources filename part. Optional. Default is 'kayobe' and
|
||||||
|
# the default filename is 'kayobe.sources'.
|
||||||
# * types: whitespace-separated list of repository types, e.g. deb or deb-src
|
# * types: whitespace-separated list of repository types, e.g. deb or deb-src
|
||||||
# (optional, default is 'deb')
|
# (optional, default is 'deb')
|
||||||
# * url: URL of the repository
|
# * url: URL of the repository
|
||||||
|
@@ -30,6 +30,8 @@ apt_keys_path: "/etc/apt/keyrings"
|
|||||||
apt_keys: []
|
apt_keys: []
|
||||||
|
|
||||||
# A list of Apt repositories. Each item is a dict with the following keys:
|
# A list of Apt repositories. Each item is a dict with the following keys:
|
||||||
|
# * name: the <name>.sources filename part. Optional. Default is 'kayobe' and
|
||||||
|
# the default filename is 'kayobe.sources'.
|
||||||
# * types: whitespace-separated list of repository types, e.g. deb or deb-src
|
# * types: whitespace-separated list of repository types, e.g. deb or deb-src
|
||||||
# (optional, default is 'deb')
|
# (optional, default is 'deb')
|
||||||
# * url: URL of the repository
|
# * url: URL of the repository
|
||||||
|
@@ -13,11 +13,14 @@
|
|||||||
- name: Configure apt repositories
|
- name: Configure apt repositories
|
||||||
template:
|
template:
|
||||||
src: "kayobe.sources.j2"
|
src: "kayobe.sources.j2"
|
||||||
dest: "/etc/apt/sources.list.d/kayobe.sources"
|
dest: "/etc/apt/sources.list.d/{{ reponame }}.sources"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
become: true
|
become: true
|
||||||
|
loop: "{{ apt_repositories }}"
|
||||||
|
vars:
|
||||||
|
reponame: "{{ item.name | default('kayobe') }}"
|
||||||
notify:
|
notify:
|
||||||
- Update apt cache
|
- Update apt cache
|
||||||
|
|
||||||
|
@@ -1,12 +1,13 @@
|
|||||||
# {{ ansible_managed }}
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
{% for repo in apt_repositories %}
|
{% for repo in apt_repositories %}
|
||||||
|
{% if reponame == repo.name | default('kayobe') %}
|
||||||
Types: {{ repo.types | default('deb') }}
|
Types: {{ repo.types | default('deb') }}
|
||||||
URIs: {{ repo.url }}
|
URIs: {{ repo.url }}
|
||||||
Suites: {{ repo.suites | default(ansible_facts.distribution_release) }}
|
Suites: {{ repo.suites | default(ansible_facts.distribution_release) }}
|
||||||
Components: {{ repo.components | default('main') }}
|
Components: {{ repo.components | default('main') }}
|
||||||
{% if repo.signed_by is defined %}
|
{% if repo.signed_by is defined %}
|
||||||
Signed-by: {{ apt_keys_path }}/{{ repo.signed_by }}
|
Signed-by: {% if not repo.signed_by.startswith('/') %}{{ apt_keys_path }}/{% endif %}{{ repo.signed_by }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if repo.architecture is defined %}
|
{% if repo.architecture is defined %}
|
||||||
Architecture: {{ repo.architecture }}
|
Architecture: {{ repo.architecture }}
|
||||||
@@ -15,4 +16,5 @@ Architecture: {{ repo.architecture }}
|
|||||||
Trusted: {{ repo.trusted | bool }}
|
Trusted: {{ repo.trusted | bool }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@@ -366,6 +366,8 @@ Kayobe supports configuration of custom Apt repositories via the
|
|||||||
The format is a list, with each item mapping to a dict/map with the following
|
The format is a list, with each item mapping to a dict/map with the following
|
||||||
items:
|
items:
|
||||||
|
|
||||||
|
* ``name``: the ``<name>.sources`` filename part. Optional. Default is
|
||||||
|
``kayobe`` and the default filename is ``kayobe.sources``.
|
||||||
* ``types``: whitespace-separated list of repository types, e.g. ``deb`` or
|
* ``types``: whitespace-separated list of repository types, e.g. ``deb`` or
|
||||||
``deb-src`` (optional, default is ``deb``)
|
``deb-src`` (optional, default is ``deb``)
|
||||||
* ``url``: URL of the repository
|
* ``url``: URL of the repository
|
||||||
|
@@ -27,6 +27,8 @@
|
|||||||
#apt_keys:
|
#apt_keys:
|
||||||
|
|
||||||
# A list of Apt repositories. Each item is a dict with the following keys:
|
# A list of Apt repositories. Each item is a dict with the following keys:
|
||||||
|
# * name: the <name>.sources filename part. Optional. Default is 'kayobe' and
|
||||||
|
# the default filename is 'kayobe.sources'.
|
||||||
# * types: whitespace-separated list of repository types, e.g. deb or deb-src
|
# * types: whitespace-separated list of repository types, e.g. deb or deb-src
|
||||||
# (optional, default is 'deb')
|
# (optional, default is 'deb')
|
||||||
# * url: URL of the repository
|
# * url: URL of the repository
|
||||||
|
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Adds a ``name`` field to elements of ``apt_repositories``, which specifies
|
||||||
|
the name of the repository file (without the ``.sources`` suffix). The
|
||||||
|
default value of this field is ``kayobe`` and it may be omitted. The user
|
||||||
|
can override the default by providing a different name, such as ``ubuntu``,
|
||||||
|
and new repository data. This way, the default file,
|
||||||
|
``/etc/apt/source.list.d/ubuntu.sources``, will be overwritten by the
|
||||||
|
provided repository configuration.
|
||||||
|
`LP#2107280 <https://bugs.launchpad.net/kayobe/+bug/2107280>`__
|
Reference in New Issue
Block a user