@@ -298,19 +298,132 @@ oversight or testing.
298298Apt
299299===
300300
301- On Ubuntu, Apt is used to manage packages and package repositories. Currently
302- Kayobe does not provide support for configuring custom Apt repositories.
301+ On Ubuntu, Apt is used to manage packages and package repositories.
303302
304303Apt cache
305304---------
306305
307306The Apt cache timeout may be configured via ``apt_cache_valid_time `` (in
308307seconds) in ``etc/kayobe/apt.yml ``, and defaults to 3600.
309308
309+ Apt proxy
310+ ---------
311+
310312Apt can be configured to use a proxy via ``apt_proxy_http `` and
311313``apt_proxy_https `` in ``etc/kayobe/apt.yml ``. These should be set to the full
312314URL of the relevant proxy (e.g. ``http://squid.example.com:3128 ``).
313315
316+ Apt configuration
317+ -----------------
318+
319+ Arbitrary global configuration options for Apt may be defined via the
320+ ``apt_config `` variable in ``etc/kayobe/apt.yml `` since the Yoga release. The
321+ format is a list, with each item mapping to a dict/map with the following
322+ items:
323+
324+ * ``content ``: free-form configuration file content
325+ * ``filename ``: name of a file in ``/etc/apt/apt.conf.d/ `` in which to write
326+ the configuration
327+
328+ The default of ``apt_config `` is an empty list.
329+
330+ For example, the following configuration tells Apt to use 2 attempts when
331+ downloading packages:
332+
333+ .. code-block :: yaml
334+
335+ apt_config :
336+ - content : |
337+ Acquire::Retries 1;
338+ filename: 99retries
339+
340+ Apt repositories
341+ ----------------
342+
343+ Kayobe supports configuration of custom Apt repositories via the
344+ ``apt_repositories `` variable in ``etc/kayobe/apt.yml `` since the Yoga release.
345+ The format is a list, with each item mapping to a dict/map with the following
346+ items:
347+
348+ * ``types ``: whitespace-separated list of repository types, e.g. ``deb `` or
349+ ``deb-src `` (optional, default is ``deb ``)
350+ * ``url ``: URL of the repository
351+ * ``suites ``: whitespace-separated list of suites, e.g. ``focal `` (optional,
352+ default is ``ansible_facts.distribution_release ``)
353+ * ``components ``: whitespace-separated list of components, e.g. ``main ``
354+ (optional, default is ``main ``)
355+ * ``signed_by ``: whitespace-separated list of names of GPG keyring files in
356+ ``apt_keys_path `` (optional, default is unset)
357+ * ``architecture ``: whitespace-separated list of architectures that will be used
358+ (optional, default is unset)
359+
360+ The default of ``apt_repositories `` is an empty list.
361+
362+ For example, the following configuration defines a single Apt repository:
363+
364+ .. code-block :: yaml
365+ :caption : ` ` apt.yml``
366+
367+ apt_repositories :
368+ - types : deb
369+ url : https://example.com/repo
370+ suites : focal
371+ components : all
372+
373+ In the following example, the Ubuntu Focal 20.04 repositories are consumed from
374+ a local package mirror. The ``apt_disable_sources_list `` variable is set to
375+ ``true ``, which disables all repositories in ``/etc/apt/sources.list ``,
376+ including the default Ubuntu ones.
377+
378+ .. code-block :: yaml
379+ :caption : ` ` apt.yml``
380+
381+ apt_repositories :
382+ - url : http://mirror.example.com/ubuntu/
383+ suites : focal focal-updates
384+ components : main restricted universe multiverse
385+ - url : http://mirror.example.com/ubuntu/
386+ suites : focal-security
387+ components : main restricted universe multiverse
388+
389+ apt_disable_sources_list : true
390+
391+ Apt keys
392+ --------
393+
394+ Some repositories may be signed by a key that is not one of Apt's trusted keys.
395+ Kayobe avoids the use of the deprecated ``apt-key `` utility, and instead allows
396+ keys to be downloaded to a directory. This enables repositories to use the
397+ ``SignedBy `` option to state that they are signed by a specific key. This
398+ approach is more secure than using globally trusted keys.
399+
400+ Keys to be downloaded are defined by the ``apt_keys `` variable. The format is a
401+ list, with each item mapping to a dict/map with the following items:
402+
403+ * ``url ``: URL of key
404+ * ``filename ``: Name of a file in which to store the downloaded key in
405+ ``apt_keys_path ``. The extension should be ``.asc `` for ASCII-armoured keys,
406+ or ``.gpg `` otherwise.
407+
408+ The default value of ``apt_keys `` is an empty list.
409+
410+ In the following example, a key is downloaded, and a repository is configured
411+ that is signed by the key.
412+
413+ .. code-block :: yaml
414+ :caption : ` ` apt.yml``
415+
416+ apt_keys :
417+ - url : https://example.com/GPG-key
418+ filename : example-key.asc
419+
420+ apt_repositories :
421+ - types : deb
422+ url : https://example.com/repo
423+ suites : focal
424+ components : all
425+ signed_by : example-key.asc
426+
314427 SELinux
315428=======
316429*tags: *
0 commit comments