2

The puppet-yum documentation is very straightforward, and explains how to add your own managed repo via hiera data. However, in addition to our 'release' repo, I want to conditionally add our 'build' repo to servers in our 'test' environment.

In a puppet class (init, probably), how can I (conditionally) toggle 'enable' on a nested value in common.yaml?

yum::managed_repos:
    - 'project_build'
yum::repos:
    project_build:
        descr: 'project build repo'
        ensure: 'absent' <----this needs to be 'present' in the test env
        enabled: true
        baseurl: 'https://repo.example.corp/project/el/$releasever/build/$basearch/'
        gpgcheck: false

1 Answer 1

0

From what I understand of the documentation, you should go ahead and define the repo with ensure set to present. But, omit it from the yum::managed_repos key in common.yaml.

On its own, the repos parameter does nothing. The resource names from the hash must be selected via the managed_repos parameter.

Then, you would create a new hierarchy in Hiera based on the $::environment Fact. Under that directory a test.yaml file would have the expected:

yum::managed_repos:
    - 'project_build'

Look in the example here where they have a Hiera level for $::trusted.certname. You can use that as a pattern for what you want to do with $::environment.

https://github.com/voxpupuli/puppet-yum/blob/master/README.md#enable-managemnt-of-multiple-repos

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .