Defined Resource types and Relationship

9 views
Skip to first unread message

Erez Zarum

unread,
Sep 21, 2016, 3:16:18 AM9/21/16
to Puppet Users
Is it the same behavior as classes?
Example:

define app::server {
  ::app::server::config { '/etc/app.conf': }
  ::app::server::service { 'app': }

  App::Server::Config['/etc/app.conf'] -> App::Server::Service['app']
}

define app::server::config {
  file { $name:
    ensure => present
  }
}

define app::server::service {
  service { $name:
    ensure => 'running'
  }
}

Will this work as expected, what happens if i have dependency resources inside the defined types? will it contain it as well?



    

R.I.Pienaar

unread,
Sep 21, 2016, 3:59:27 AM9/21/16
to puppet-users
yes with the same caveats as classes and class containment

Erez Zarum

unread,
Sep 21, 2016, 4:19:25 AM9/21/16
to Puppet Users
If i understand correctly, I do not have to contain (declare contain) on the defined resource (like in app::server)?
As in my example it will work as expected?

R.I.Pienaar

unread,
Sep 21, 2016, 4:26:57 AM9/21/16
to puppet-users


----- Original Message -----
> From: "Erez Zarum" <erez...@gmail.com>
> To: "puppet-users" <puppet...@googlegroups.com>
> Sent: Wednesday, 21 September, 2016 10:19:24
> Subject: Re: [Puppet Users] Defined Resource types and Relationship

> If i understand correctly, I do not have to contain (declare contain) on
> the defined resource (like in app::server)?
> As in my example it will work as expected?

yes, your example is fine, i mean containment if you were to include anything
in the define

Erez Zarum

unread,
Sep 21, 2016, 4:32:13 AM9/21/16
to Puppet Users
Thanks!
Reply all
Reply to author
Forward
0 new messages