Default variable details
Some of debops.apt_mirror default variables have more extensive
configuration than simple strings or lists, here you can find documentation and
examples for them.
apt_mirror__configuration
The apt_mirror__*_configuration variables define "instances" of
apt-mirror configurations. Each instance has its own set of APT
sources to mirror, its own configuration options and its own cron
job with a separate frequency. Mirrored repositories are stored under the same
/var/spool/apt-mirror/mirror/ directory and care should be taken to
avoid conflicts.
Examples
Enable APT mirror of Debian Stable repository in the default configuration
(make sure that the space requirements are met before enabling this).
See apt_mirror__default_configuration variable for the initial options:
apt_mirror__configuration:
- name: 'default'
sources:
- name: 'debian-stable'
state: 'present'
Add an APT mirror for InfluxData and Zabbix APT repositories in the default configuration:
apt_mirror__configuration:
- name: 'default'
sources:
- name: 'influxdata'
raw: 'deb https://repos.influxdata.com/debian stable main'
- name: 'zabbix'
type: 'deb'
uri: 'https://repo.zabbix.com/zabbix/6.4/debian'
suite: '{{ ansible_distribution_release }}'
components: [ 'main', 'contrib', 'non-free' ]
- name: 'influxdata-clean'
type: 'clean'
uri: 'https://repos.influxdata.com/debian'
- name: 'zabbix-clean'
type: 'clean'
uri: 'https://repo.zabbix.com/zabbix/6.4/debian'
Create a new APT mirror instance with private APT repositories synchronized hourly using cron service:
apt_mirror__configuration:
- name: 'internal'
cron_time: '@hourly'
sources:
- name: 'apt-repo'
type: 'deb'
uri: 'https://username:password@apt.example.org/debian'
suite: 'stable'
components: [ 'main' ]
- name: 'clean-apt-repo'
type: 'clean'
uri: 'https://apt.example.org/debian'
Syntax
The variables are defined as a list of YAML dictionaires, parsed using Universal Configuration system. Each dictionary defines an "instance" using specific parameters:
nameRequired. An identifier for a particular apt-mirror instance. The value is used in the filesystem paths and should be a simple alphanumeric string. Configuration entries with the same
nameparameters are merged during role execution and can affect each other via Universal Configuration principles.filenameOptional. Name of the apt-mirror configuration file to use, located under the
/etc/apt/directory. If not specified, the configuration files are named in the format:mirror.<name>.list.stateOptional. If not specified or
present, a given APT mirror instance will be configured on the host. Ifabsent, the mirror will not be configured and the configuration file will be removed. Ifignore, a given configuration entry will not be evaluated during role execution.cron_timeOptional. The string which defines a time period for a given APT mirror synchronization, in the crontab(5) format. If not specified, the value of the
apt_mirror__cron_timewill be used instead.cron_userOptional. The UNIX account under which a cron job will be executed for a particular APT mirror. If not specified, the value in the
apt_mirror__userwill be used by default.cron_commandOptional. The cron job which should be executed for a given APT mirror. If not specified, the configuration template will automatically generate a configuration suitable for sequential apt-mirror operation (the script does not support parallel processing).
optionsOptional. List of YAML dictionaries which defines apt-mirror configuration options stored in the mirror configuration file. The
optionsparameters from configuration entries with the samenameparameter are merged together and can affect each other. A set of default options is taken from theapt_mirror__default_optionsas a base, user options are merged on top of it.The configuration is defined as a list of YAML dictionaries, each dictionary key being the option name and its value being the option value. Alternatively you can use specific parameters to control each option:
nameThe name of the option.
valueThe value of the option, can be a number or a string.
stateIf not specified or
present, the option is included in the configuration file. Ifabsent, the option will be removed from the configuration file. Ifcomment, the option will be present but it will be commented out. Ifdynamic, the value of a given option will be replaced with a value set at runtime in the configuration template (currently only thevar_pathoption utilizes this functionality).commentString or YAML text block with comments related to a given configuration option.
sourcesRequired. A list of APT repositories which will be mirrored by the apt-mirror script. THe
sourcesparameters from configuration entries with the samenameparameter are merged together and can affect each other.The list is defined using YAML dictionaries:
nameAn identifier of a given APT repository, used only internally by the role. Multiple sources with the same
nameare merged together and can affect each other.rawString specifying an APT repository in the sources.list(5) one-line-style format, included in the generated configuration file as-is. If this parameter is specified, it takes precedence over the parametrized configuration below.
typeSpecify the APT repository type (
deb,deb-src,deb-<arch>for additional architecture mirrors, orcleanto generate a cleanup script for a given repository).uriSpecify the URL of the APT repository to mirror or clean.
suiteSpecify the repository suite which should be mirrored (this is usually named
stable, or a specific distribution release likebookwormorbullseye).component/componentsA string (first version) or a YAML list (second version) of repository components to mirror (this is usually
main,contrib,non-freein Debian case, Ubuntu usually usesmain,restricted,universe,multiversecomponents).stateIf not specified or
present, a given source will be present in the generated configuration file. Ifabsent, a given source will be omitted from the generated configuration file. Ifignore, a given configuration entry will not be evaluated during role execution. Ifcomment, the source will be present but commented out.weightA positive or negative integer which will affect the order of the sources in the generated configuration file. Positive weight pushes a given source down the list, negative weight lifts it up the list.
commentString or YAML text block with comments related to a given source.