Blame doc/examples/cloud-config-apt.txt

Packit Service 751c4a
#cloud-config
Packit Service a04d08
# apt_pipelining (configure Acquire::http::Pipeline-Depth)
Packit Service a04d08
# Default: disables HTTP pipelining. Certain web servers, such
Packit Service a04d08
# as S3 do not pipeline properly (LP: #948461).
Packit Service a04d08
# Valid options:
Packit Service a04d08
#   False/default: Disables pipelining for APT
Packit Service a04d08
#   None/Unchanged: Use OS default
Packit Service a04d08
#   Number: Set pipelining to some number (not recommended)
Packit Service a04d08
apt_pipelining: False
Packit Service a04d08
Packit Service a04d08
## apt config via system_info:
Packit Service a04d08
# under the 'system_info', you can customize cloud-init's interaction
Packit Service a04d08
# with apt.
Packit Service a04d08
#  system_info:
Packit Service a04d08
#    apt_get_command: [command, argument, argument]
Packit Service a04d08
#    apt_get_upgrade_subcommand: dist-upgrade
Packit Service a04d08
#
Packit Service a04d08
# apt_get_command:
Packit Service a04d08
#  To specify a different 'apt-get' command, set 'apt_get_command'.
Packit Service a04d08
#  This must be a list, and the subcommand (update, upgrade) is appended to it.
Packit Service a04d08
#  default is:
Packit Service a04d08
#    ['apt-get', '--option=Dpkg::Options::=--force-confold',
Packit Service a04d08
#     '--option=Dpkg::options::=--force-unsafe-io', '--assume-yes', '--quiet']
Packit Service a04d08
#
Packit Service a04d08
# apt_get_upgrade_subcommand: "dist-upgrade"
Packit Service a04d08
#  Specify a different subcommand for 'upgrade. The default is 'dist-upgrade'.
Packit Service a04d08
#  This is the subcommand that is invoked for package_upgrade.
Packit Service a04d08
#
Packit Service a04d08
# apt_get_wrapper:
Packit Service a04d08
#   command: eatmydata
Packit Service a04d08
#   enabled: [True, False, "auto"]
Packit Service a04d08
#
Packit Service a04d08
Packit Service a04d08
# Install additional packages on first boot
Packit Service a04d08
#
Packit Service a04d08
# Default: none
Packit Service a04d08
#
Packit Service a04d08
# if packages are specified, this apt_update will be set to true
Packit Service a04d08
Packit Service a04d08
packages: ['pastebinit']
Packit Service a04d08
Packit Service a04d08
apt:
Packit Service a04d08
  # The apt config consists of two major "areas".
Packit Service a04d08
  #
Packit Service a04d08
  # On one hand there is the global configuration for the apt feature.
Packit Service a04d08
  #
Packit Service a04d08
  # On one hand (down in this file) there is the source dictionary which allows
Packit Service a04d08
  # to define various entries to be considered by apt.
Packit Service a04d08
Packit Service a04d08
  ##############################################################################
Packit Service a04d08
  # Section 1: global apt configuration
Packit Service a04d08
  #
Packit Service a04d08
  # The following examples number the top keys to ease identification in
Packit Service a04d08
  # discussions.
Packit Service a04d08
Packit Service a04d08
  # 1.1 preserve_sources_list
Packit Service a04d08
  #
Packit Service a04d08
  # Preserves the existing /etc/apt/sources.list
Packit Service a04d08
  # Default: false - do overwrite sources_list. If set to true then any
Packit Service a04d08
  # "mirrors" configuration will have no effect.
Packit Service a04d08
  # Set to true to avoid affecting sources.list. In that case only
Packit Service a04d08
  # "extra" source specifications will be written into
Packit Service a04d08
  # /etc/apt/sources.list.d/*
Packit Service a04d08
  preserve_sources_list: true
Packit Service a04d08
Packit Service a04d08
  # 1.2 disable_suites
Packit Service a04d08
  #
Packit Service a04d08
  # This is an empty list by default, so nothing is disabled.
Packit Service a04d08
  #
Packit Service a04d08
  # If given, those suites are removed from sources.list after all other
Packit Service a04d08
  # modifications have been made.
Packit Service a04d08
  # Suites are even disabled if no other modification was made,
Packit Service a04d08
  # but not if is preserve_sources_list is active.
Packit Service a04d08
  # There is a special alias "$RELEASE" as in the sources that will be replace
Packit Service a04d08
  # by the matching release.
Packit Service a04d08
  #
Packit Service a04d08
  # To ease configuration and improve readability the following common ubuntu
Packit Service a04d08
  # suites will be automatically mapped to their full definition.
Packit Service a04d08
  # updates   => $RELEASE-updates
Packit Service a04d08
  # backports => $RELEASE-backports
Packit Service a04d08
  # security  => $RELEASE-security
Packit Service a04d08
  # proposed  => $RELEASE-proposed
Packit Service a04d08
  # release   => $RELEASE
Packit Service a04d08
  #
Packit Service a04d08
  # There is no harm in specifying a suite to be disabled that is not found in
Packit Service a04d08
  # the source.list file (just a no-op then)
Packit Service a04d08
  #
Packit Service a04d08
  # Note: Lines don't get deleted, but disabled by being converted to a comment.
Packit Service a04d08
  # The following example disables all usual defaults except $RELEASE-security.
Packit Service a04d08
  # On top it disables a custom suite called "mysuite"
Packit Service a04d08
  disable_suites: [$RELEASE-updates, backports, $RELEASE, mysuite]
Packit Service a04d08
Packit Service a04d08
  # 1.3 primary/security archives
Packit Service a04d08
  #
Packit Service a04d08
  # Default: none - instead it is auto select based on cloud metadata
Packit Service a04d08
  # so if neither "uri" nor "search", nor "search_dns" is set (the default)
Packit Service a04d08
  # then use the mirror provided by the DataSource found.
Packit Service a04d08
  # In EC2, that means using <region>.ec2.archive.ubuntu.com
Packit Service a04d08
  #
Packit Service a04d08
  # define a custom (e.g. localized) mirror that will be used in sources.list
Packit Service a04d08
  # and any custom sources entries for deb / deb-src lines.
Packit Service a04d08
  #
Packit Service a04d08
  # One can set primary and security mirror to different uri's
Packit Service a04d08
  # the child elements to the keys primary and secondary are equivalent
Packit Service a04d08
  primary:
Packit Service a04d08
    # arches is list of architectures the following config applies to
Packit Service a04d08
    # the special keyword "default" applies to any architecture not explicitly
Packit Service a04d08
    # listed.
Packit Service a04d08
    - arches: [amd64, i386, default]
Packit Service a04d08
      # uri is just defining the target as-is
Packit Service a04d08
      uri: http://us.archive.ubuntu.com/ubuntu
Packit Service a04d08
      #
Packit Service a04d08
      # via search one can define lists that are tried one by one.
Packit Service a04d08
      # The first with a working DNS resolution (or if it is an IP) will be
Packit Service a04d08
      # picked. That way one can keep one configuration for multiple
Packit Service a04d08
      # subenvironments that select the working one.
Packit Service a04d08
      search:
Packit Service a04d08
        - http://cool.but-sometimes-unreachable.com/ubuntu
Packit Service a04d08
        - http://us.archive.ubuntu.com/ubuntu
Packit Service a04d08
      # if no mirror is provided by uri or search but 'search_dns' is
Packit Service a04d08
      # true, then search for dns names '<distro>-mirror' in each of
Packit Service a04d08
      # - fqdn of this host per cloud metadata
Packit Service a04d08
      # - localdomain
Packit Service a04d08
      # - no domain (which would search domains listed in /etc/resolv.conf)
Packit Service a04d08
      # If there is a dns entry for <distro>-mirror, then it is assumed that
Packit Service a04d08
      # there is a distro mirror at http://<distro>-mirror.<domain>/<distro>
Packit Service a04d08
      #
Packit Service a04d08
      # That gives the cloud provider the opportunity to set mirrors of a distro
Packit Service a04d08
      # up and expose them only by creating dns entries.
Packit Service a04d08
      #
Packit Service a04d08
      # if none of that is found, then the default distro mirror is used
Packit Service a04d08
      search_dns: true
Packit Service a04d08
      #
Packit Service a04d08
      # If multiple of a category are given
Packit Service a04d08
      #   1. uri
Packit Service a04d08
      #   2. search
Packit Service a04d08
      #   3. search_dns
Packit Service a04d08
      # the first defining a valid mirror wins (in the order as defined here,
Packit Service a04d08
      # not the order as listed in the config).
Packit Service a04d08
      #
Packit Service a04d08
    - arches: [s390x, arm64]
Packit Service a04d08
      # as above, allowing to have one config for different per arch mirrors
Packit Service a04d08
  # security is optional, if not defined it is set to the same value as primary
Packit Service a04d08
  security:
Packit Service 751c4a
    - uri: http://security.ubuntu.com/ubuntu
Packit Service a04d08
  # If search_dns is set for security the searched pattern is:
Packit Service a04d08
  #   <distro>-security-mirror
Packit Service a04d08
Packit Service a04d08
  # if no mirrors are specified at all, or all lookups fail it will try
Packit Service a04d08
  # to get them from the cloud datasource and if those neither provide one fall
Packit Service a04d08
  # back to:
Packit Service a04d08
  #   primary: http://archive.ubuntu.com/ubuntu
Packit Service a04d08
  #   security: http://security.ubuntu.com/ubuntu
Packit Service a04d08
Packit Service a04d08
  # 1.4 sources_list
Packit Service a04d08
  #
Packit Service a04d08
  # Provide a custom template for rendering sources.list
Packit Service a04d08
  # without one provided cloud-init uses builtin templates for
Packit Service a04d08
  # ubuntu and debian.
Packit Service a04d08
  # Within these sources.list templates you can use the following replacement
Packit Service a04d08
  # variables (all have sane Ubuntu defaults, but mirrors can be overwritten
Packit Service a04d08
  # as needed (see above)):
Packit Service a04d08
  # => $RELEASE, $MIRROR, $PRIMARY, $SECURITY
Packit Service a04d08
  sources_list: | # written by cloud-init custom template
Packit Service a04d08
    deb $MIRROR $RELEASE main restricted
Packit Service a04d08
    deb-src $MIRROR $RELEASE main restricted
Packit Service a04d08
    deb $PRIMARY $RELEASE universe restricted
Packit Service a04d08
    deb $SECURITY $RELEASE-security multiverse
Packit Service a04d08
Packit Service a04d08
  # 1.5 conf
Packit Service a04d08
  #
Packit Service a04d08
  # Any apt config string that will be made available to apt
Packit Service a04d08
  # see the APT.CONF(5) man page for details what can be specified
Packit Service a04d08
  conf: | # APT config
Packit Service a04d08
    APT {
Packit Service a04d08
      Get {
Packit Service a04d08
        Assume-Yes "true";
Packit Service a04d08
        Fix-Broken "true";
Packit Service a04d08
      };
Packit Service a04d08
    };
Packit Service a04d08
Packit Service a04d08
  # 1.6 (http_|ftp_|https_)proxy
Packit Service a04d08
  #
Packit Service a04d08
  # Proxies are the most common apt.conf option, so that for simplified use
Packit Service a04d08
  # there is a shortcut for those. Those get automatically translated into the
Packit Service a04d08
  # correct Acquire::*::Proxy statements.
Packit Service a04d08
  #
Packit Service a04d08
  # note: proxy actually being a short synonym to http_proxy
Packit Service a04d08
  proxy: http://[[user][:pass]@]host[:port]/
Packit Service a04d08
  http_proxy: http://[[user][:pass]@]host[:port]/
Packit Service a04d08
  ftp_proxy: ftp://[[user][:pass]@]host[:port]/
Packit Service a04d08
  https_proxy: https://[[user][:pass]@]host[:port]/
Packit Service a04d08
Packit Service a04d08
  # 1.7 add_apt_repo_match
Packit Service a04d08
  #
Packit Service a04d08
  # 'source' entries in apt-sources that match this python regex
Packit Service a04d08
  # expression will be passed to add-apt-repository
Packit Service a04d08
  # The following example is also the builtin default if nothing is specified
Packit Service a04d08
  add_apt_repo_match: '^[\w-]+:\w'
Packit Service a04d08
Packit Service a04d08
Packit Service a04d08
  ##############################################################################
Packit Service a04d08
  # Section 2: source list entries
Packit Service a04d08
  #
Packit Service a04d08
  # This is a dictionary (unlike most block/net which are lists)
Packit Service a04d08
  #
Packit Service a04d08
  # The key of each source entry is the filename and will be prepended by
Packit Service a04d08
  # /etc/apt/sources.list.d/ if it doesn't start with a '/'.
Packit Service a04d08
  # If it doesn't end with .list it will be appended so that apt picks up it's
Packit Service a04d08
  # configuration.
Packit Service a04d08
  #
Packit Service a04d08
  # Whenever there is no content to be written into such a file, the key is
Packit Service a04d08
  # not used as filename - yet it can still be used as index for merging
Packit Service a04d08
  # configuration.
Packit Service a04d08
  #
Packit Service a04d08
  # The values inside the entries consost of the following optional entries:
Packit Service a04d08
  #   'source': a sources.list entry (some variable replacements apply)
Packit Service a04d08
  #   'keyid': providing a key to import via shortid or fingerprint
Packit Service a04d08
  #   'key': providing a raw PGP key
Packit Service a04d08
  #   'keyserver': specify an alternate keyserver to pull keys from that
Packit Service a04d08
  #                were specified by keyid
Packit Service a04d08
Packit Service a04d08
  # This allows merging between multiple input files than a list like:
Packit Service a04d08
  # cloud-config1
Packit Service a04d08
  # sources:
Packit Service 751c4a
  #   s1: {'key': 'key1', 'source': 'source1'}
Packit Service a04d08
  # cloud-config2
Packit Service a04d08
  # sources:
Packit Service 751c4a
  #   s2: {'key': 'key2'}
Packit Service 751c4a
  #   s1: {'keyserver': 'foo'}
Packit Service a04d08
  # This would be merged to
Packit Service a04d08
  # sources:
Packit Service 751c4a
  #   s1:
Packit Service 751c4a
  #     keyserver: foo
Packit Service 751c4a
  #     key: key1
Packit Service 751c4a
  #     source: source1
Packit Service 751c4a
  #   s2:
Packit Service 751c4a
  #     key: key2
Packit Service a04d08
  #
Packit Service a04d08
  # The following examples number the subfeatures per sources entry to ease
Packit Service a04d08
  # identification in discussions.
Packit Service a04d08
Packit Service a04d08
Packit Service a04d08
  sources:
Packit Service a04d08
    curtin-dev-ppa.list:
Packit Service a04d08
      # 2.1 source
Packit Service a04d08
      #
Packit Service a04d08
      # Creates a file in /etc/apt/sources.list.d/ for the sources list entry
Packit Service a04d08
      # based on the key: "/etc/apt/sources.list.d/curtin-dev-ppa.list"
Packit Service a04d08
      source: "deb http://ppa.launchpad.net/curtin-dev/test-archive/ubuntu xenial main"
Packit Service a04d08
Packit Service a04d08
      # 2.2 keyid
Packit Service a04d08
      #
Packit Service a04d08
      # Importing a gpg key for a given key id. Used keyserver defaults to
Packit Service a04d08
      # keyserver.ubuntu.com
Packit Service a04d08
      keyid: F430BBA5 # GPG key ID published on a key server
Packit Service a04d08
Packit Service a04d08
    ignored1:
Packit Service a04d08
      # 2.3 PPA shortcut
Packit Service a04d08
      #
Packit Service a04d08
      # Setup correct apt sources.list line and Auto-Import the signing key
Packit Service a04d08
      # from LP
Packit Service a04d08
      #
Packit Service a04d08
      # See https://help.launchpad.net/Packaging/PPA for more information
Packit Service a04d08
      # this requires 'add-apt-repository'. This will create a file in
Packit Service a04d08
      # /etc/apt/sources.list.d automatically, therefore the key here is
Packit Service a04d08
      # ignored as filename in those cases.
Packit Service a04d08
      source: "ppa:curtin-dev/test-archive"    # Quote the string
Packit Service a04d08
Packit Service a04d08
    my-repo2.list:
Packit Service a04d08
      # 2.4 replacement variables
Packit Service a04d08
      #
Packit Service a04d08
      # sources can use $MIRROR, $PRIMARY, $SECURITY and $RELEASE replacement
Packit Service a04d08
      # variables.
Packit Service a04d08
      # They will be replaced with the default or specified mirrors and the
Packit Service a04d08
      # running release.
Packit Service a04d08
      # The entry below would be possibly turned into:
Packit Service a04d08
      #   source: deb http://archive.ubuntu.com/ubuntu xenial multiverse
Packit Service a04d08
      source: deb $MIRROR $RELEASE multiverse
Packit Service a04d08
Packit Service a04d08
    my-repo3.list:
Packit Service a04d08
      # this would have the same end effect as 'ppa:curtin-dev/test-archive'
Packit Service a04d08
      source: "deb http://ppa.launchpad.net/curtin-dev/test-archive/ubuntu xenial main"
Packit Service a04d08
      keyid: F430BBA5 # GPG key ID published on the key server
Packit Service a04d08
      filename: curtin-dev-ppa.list
Packit Service a04d08
Packit Service a04d08
    ignored2:
Packit Service a04d08
      # 2.5 key only
Packit Service a04d08
      #
Packit Service a04d08
      # this would only import the key without adding a ppa or other source spec
Packit Service a04d08
      # since this doesn't generate a source.list file the filename key is ignored
Packit Service a04d08
      keyid: F430BBA5 # GPG key ID published on a key server
Packit Service a04d08
Packit Service a04d08
    ignored3:
Packit Service a04d08
      # 2.6 key id alternatives
Packit Service a04d08
      #
Packit Service a04d08
      # Keyid's can also be specified via their long fingerprints
Packit Service a04d08
      keyid: B59D 5F15 97A5 04B7 E230  6DCA 0620 BBCF 0368 3F77
Packit Service a04d08
Packit Service a04d08
    ignored4:
Packit Service a04d08
      # 2.7 alternative keyservers
Packit Service a04d08
      #
Packit Service a04d08
      # One can also specify alternative keyservers to fetch keys from.
Packit Service a04d08
      keyid: B59D 5F15 97A5 04B7 E230  6DCA 0620 BBCF 0368 3F77
Packit Service a04d08
      keyserver: pgp.mit.edu
Packit Service a04d08
Packit Service a04d08
Packit Service a04d08
    my-repo4.list:
Packit Service a04d08
      # 2.8 raw key
Packit Service a04d08
      #
Packit Service a04d08
      # The apt signing key can also be specified by providing a pgp public key
Packit Service a04d08
      # block. Providing the PGP key this way is the most robust method for
Packit Service a04d08
      # specifying a key, as it removes dependency on a remote key server.
Packit Service a04d08
      #
Packit Service a04d08
      # As with keyid's this can be specified with or without some actual source
Packit Service a04d08
      # content.
Packit Service a04d08
      key: | # The value needs to start with -----BEGIN PGP PUBLIC KEY BLOCK-----
Packit Service 751c4a
        -----BEGIN PGP PUBLIC KEY BLOCK-----
Packit Service 751c4a
        Version: SKS 1.0.10
Packit Service a04d08
Packit Service 751c4a
        mI0ESpA3UQEEALdZKVIMq0j6qWAXAyxSlF63SvPVIgxHPb9Nk0DZUixn+akqytxG4zKCONz6
Packit Service 751c4a
        qLjoBBfHnynyVLfT4ihg9an1PqxRnTO+JKQxl8NgKGz6Pon569GtAOdWNKw15XKinJTDLjnj
Packit Service 751c4a
        9y96ljJqRcpV9t/WsIcdJPcKFR5voHTEoABE2aEXABEBAAG0GUxhdW5jaHBhZCBQUEEgZm9y
Packit Service 751c4a
        IEFsZXN0aWOItgQTAQIAIAUCSpA3UQIbAwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEA7H
Packit Service 751c4a
        5Qi+CcVxWZ8D/1MyYvfj3FJPZUm2Yo1zZsQ657vHI9+pPouqflWOayRR9jbiyUFIn0VdQBrP
Packit Service 751c4a
        t0FwvnOFArUovUWoKAEdqR8hPy3M3APUZjl5K4cMZR/xaMQeQRZ5CHpS4DBKURKAHC0ltS5o
Packit Service 751c4a
        uBJKQOZm5iltJp15cgyIkBkGe8Mx18VFyVglAZey
Packit Service 751c4a
        =Y2oI
Packit Service 751c4a
        -----END PGP PUBLIC KEY BLOCK-----