Ask Your Question
0

Help with the Relationships exercise

asked 2013-09-10 10:44:12 -0500

mrmuff gravatar image

Hi community,

I'm new to Puppet but I'm studying up. Can anyone suggest how to add the Relationship that setp #1 asks for?

I feel like this should be pretty straightforward, but I'm not sure of the syntax. Here's the exercise, it's step one towards the bottom of the page:

link text

Thanks!

edit retag flag offensive close merge delete

Comments

Your link is registration gated.

Ancillas gravatar imageAncillas ( 2013-09-10 11:28:09 -0500 )edit

Please add the exercise content directly in the question for future reference.

golja gravatar imagegolja ( 2013-09-12 01:12:20 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-09-12 01:10:10 -0500

golja gravatar image

There are two ways how to do it. Or using require or using before.

For example I will use require

  file { '/etc/zshrc':
    ensure => file,
    owner  => 'root',
    group  => 'root',
    source => 'puppet:///modules/zsh/zshrc',
    require => Package['zsh']
}

For an exercise try to achieve the same with before.

For more information please have a look here http://docs.puppetlabs.com/puppet/3/reference/lang_relationships.html

edit flag offensive delete link more

Comments

1

I myself prefer chaining because I find it easier to add resources later on: `Package['zsh'] -> File['/etc/zshrc']`. See the doc. for more details. http://docs.puppetlabs.com/learning/ordering.html#chaining-arrows

Ancillas gravatar imageAncillas ( 2013-09-12 02:20:08 -0500 )edit

Agree, however for a beginner I think require/before it's a bit easier to understand.

golja gravatar imagegolja ( 2013-09-12 03:00:07 -0500 )edit

You're probably right :). Tossing a link in about chaining does future proof the solution though in case people end up here by Google search with the same question.

Ancillas gravatar imageAncillas ( 2013-09-12 09:18:16 -0500 )edit

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2013-09-10 10:44:12 -0500

Seen: 88 times

Last updated: Sep 12 '13