Yum repositories

This example shows how to configure a yum repository. For a full list of keys, refer to the yum add repo module schema.

Add a yum repo (basic example)

1#cloud-config
2yum_repos:
3  my_repo:
4    baseurl: http://blah.org/pub/epel/testing/5/$basearch/
5yum_repo_dir: /store/custom/yum.repos.d

Add daily testing repo

This example enables cloud-init upstream’s daily testing repo for EPEL 8 to install the latest version of cloud-init from tip of main for testing.

 1#cloud-config
 2yum_repos:
 3  cloud-init-daily:
 4    name: Copr repo for cloud-init-dev owned by @cloud-init
 5    baseurl: https://download.copr.fedorainfracloud.org/results/@cloud-init/cloud-init-dev/epel-8-$basearch/
 6    type: rpm-md
 7    skip_if_unavailable: true
 8    gpgcheck: true
 9    gpgkey: https://download.copr.fedorainfracloud.org/results/@cloud-init/cloud-init-dev/pubkey.gpg
10    enabled_metadata: 1

Add EPEL testing repo

The following example adds the /etc/yum.repos.d/epel_testing.repo file, which can be subsequently used by yum for later operations.

 1#cloud-config
 2yum_repos:
 3# The name of the repository
 4 epel-testing:
 5   baseurl: https://download.copr.fedorainfracloud.org/results/@cloud-init/cloud-init-dev/pubkey.gpg
 6   enabled: false
 7   failovermethod: priority
 8   gpgcheck: true
 9   gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
10   name: Extra Packages for Enterprise Linux 5 - Testing

Upgrade yum on boot

This example will upgrade the yum repository on first boot. The default is false.

#cloud-config
package_upgrade: true

Configure a yum repo

Any yum repo configuration can be passed directly into the repository file created. See man yum.conf for supported config keys.

This example will write /etc/yum.conf.d/my-package-stream.repo, with gpgkey checks on the repo data of the enabled repository.

1#cloud-config
2yum_repos:
3  my package stream:
4    baseurl: http://blah.org/pub/epel/testing/5/$basearch/
5    mirrorlist: http://some-url-to-list-of-baseurls
6    repo_gpgcheck: 1
7    enable_gpgcheck: true
8    gpgkey: https://url.to.ascii-armored-gpg-key