Product SiteDocumentation Site

14.4.2. Custom Repositories

To use extra repositories, such as a "custom" repository, use the following snippet in your manifests;
node 'node1.example.org' {
    yum::repository { "custom":
        enable => true
    }
}
To provide the file to configure the custom repository, you create the following files in the appropriate location:
  1. Using domain-specific configuration tree(s)
    Place the files in the following location, beneath the root of the domain specific configuration tree. yum/$os/$osver/repos/custom.repo, and yum/$os/$osver/repos/custom.repo.disabled
  2. Using the [files] fileserver mount
    Place the files in the following locations, beneath the directory that is used as the [files] share on the fileserver. yum/$os/$osver/repos/custom.repo, and yum/$os/$osver/repos/custom.repo.disabled
  3. Using the module
    Place the files in the following locatitons, beneath the path to the module, usually /var/lib/puppet/modules/ or /var/lib/puppet/modules/$environment/ in case you use staging environments. module_path/yum/files/$os/$osver/repos/custom.repo, and module_path/yum/files/$os/$osver/repos/custom.repo.disabled
About $os and $osver
The $os and $osver in the repository configuration file location are mandatory, although .repo configuration files can be shared amongst different operating systems ($os), and different operating system versions ($osver). Most commonly though, repository configuration is valid for just one specific $os/$osver.
To share repository configuration over two or more combinations of $os/$osver, consider the following options:
  1. Repository configuration shared between Red Hat 5.0 and Red Hat 5.1 systems for example can be shared using symbolic links to a major version number directory:
    $ ls -l
    drwxrwxr-x 3 jmeeuwen jmeeuwen 4096 2008-07-19 22:15 4
    lrwxrwxrwx 1 jmeeuwen jmeeuwen    1 2008-06-13 18:07 4.0 -> 4
    lrwxrwxrwx 1 jmeeuwen jmeeuwen    1 2008-06-13 18:07 4.1 -> 4
    lrwxrwxrwx 1 jmeeuwen jmeeuwen    1 2008-06-13 18:07 4.2 -> 4
    lrwxrwxrwx 1 jmeeuwen jmeeuwen    1 2008-06-13 18:07 4.3 -> 4
    lrwxrwxrwx 1 jmeeuwen jmeeuwen    1 2008-06-13 18:07 4.4 -> 4
    lrwxrwxrwx 1 jmeeuwen jmeeuwen    1 2008-06-13 18:07 4.5 -> 4
    lrwxrwxrwx 1 jmeeuwen jmeeuwen    1 2008-06-13 18:07 4.6 -> 4
    drwxrwxr-x 3 jmeeuwen jmeeuwen 4096 2008-07-19 22:15 5
    lrwxrwxrwx 1 jmeeuwen jmeeuwen    1 2008-06-13 18:07 5.0 -> 5
    lrwxrwxrwx 1 jmeeuwen jmeeuwen    1 2008-06-13 18:07 5.1 -> 5
    lrwxrwxrwx 1 jmeeuwen jmeeuwen    1 2008-07-19 22:11 5.2 -> 5
    
  2. Configuration shared between different operating systems can also be shared using symbolic links:
    $ ls -l
    lrwxrwxrwx 1 jmeeuwen jmeeuwen    1 2008-06-13 18:07 CentOS -> EL
    drwxrwxr-x 3 jmeeuwen jmeeuwen 4096 2008-07-19 22:15 EL
    lrwxrwxrwx 1 jmeeuwen jmeeuwen    1 2008-06-13 18:07 RedHat -> EL
    
    or,
    $ ls -l
    lrwxrwxrwx 1 jmeeuwen jmeeuwen    1 2008-06-13 18:07 CentOS -> RedHat
    drwxrwxr-x 3 jmeeuwen jmeeuwen 4096 2008-07-19 22:15 RedHat
    
  3. The $osver can be neglected in favor of using $releasever in the .repo repository configuration file, creating symbolic links between different versions of the distribution.