On Tuesday, December 16, 2014 7:59:00 AM UTC-6, Abhijeet Rastogi wrote:
[...]
class profile::base {
anchor { 'base_repos_start': }
class { '::yum::repo::epel': require => Anchor['base_repos_start']}
class { '::yum::repo::puppet': require => Anchor['base_repos_start']}
anchor { 'base_repos_end': }
}
I think I'm using anchor patterns correctly but they don't seem to be working. Is there anything that I'm doing fundamentally wrong? Any possible reasons this might not be working?
Yes. Contrary to your assertion, you are not using the anchor pattern correctly. Your contained classes are related only to the starting anchor, not to the ending anchor. Correct use of the anchor pattern would look more like this:
class profile::base {
anchor { 'base_repos_start': }
class { '::yum::repo::epel': require => Anchor['base_repos_start'], before => Anchor['base_repos_end'] }
class { '::yum::repo::puppet': require => Anchor['base_repos_start'], before => Anchor['base_repos_end'] }
anchor { 'base_repos_end': }
}If you are using a sufficiently recent Puppet, however, then you should instead use
the new(ish) 'contain()' function. In full generality that would look like this:
class profile::base {
class { '::yum::repo::epel': }
class { '::yum::repo::puppet': }
contain '::yum::repo::epel'
contain '::yum::repo::puppet'
}Since your classes don't (any more) require any parameters to be specified in your manifests, however, you can shorten that further to simply
class profile::base {
contain '::yum::repo::epel'
contain '::yum::repo::puppet'
}John