Ask Your Question
1

How to group virtual resources

asked 2014-11-07 08:12:03 -0600

jaksky gravatar image

Hello,

I am using virtual resources for definition of our repositories in a single file - for clarity.

@yumrepo { 'repo1':
  name            => "repo1",
  baseurl         => "...",
  enabled         => 1,
  protect         => 0,
  require         => Host['host1'],
}

@yumrepo { 'repo2':
  name            => "repo2",
  baseurl         => "...",
  enabled         => 1,
  protect         => 0,
  require         => Host['host1'],
}

the issue here is that repo1 and repo2 are dependant. So every time when there is a need for internal repositories both of them needs to be realized which is tedious and error prone. Is there a way how to group those two together? e.g. that you would refer to them as: realize('internalRepositories') etc.

Thx

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2014-11-07 08:58:12 -0600

You can use the tag metaparameter:

@yumrepo { 'repo1':
  name            => "repo1",
  baseurl         => "...",
  enabled         => 1,
  protect         => 0,
  require         => Host['host1'],
  tag             => 'myrepos'
}

And the use a collector for realizing all the tagged resources at once:

Yumrepo <| tag == 'myrepos' |>
edit flag offensive delete link more
0

answered 2014-11-09 06:36:04 -0600

vmule gravatar image

updated 2014-11-09 06:37:16 -0600

This should realise all the yumrepo virtual resources.

Yumrepo <| |>

see also:

https://docs.puppetlabs.com/puppet/latest/reference/lang_collectors.html#exported-resource-collectors

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-11-07 08:12:03 -0600

Seen: 80 times

Last updated: Nov 09 '14