Hi,

The 3rd option is interesting, i should try it to see.

So far i had tried a similar way, with a "realize", but instead of
overriding the content file, i had some conditional blocks with a variable
in the puppet.conf.erb file. And it did not work, because it seems the
variable was never known at the time of the first "realize" call (by the
class puppet). But with a content overide, it should work, i suppose


2011/10/13 Nan Liu <n...@puppetlabs.com>

> On Thu, Oct 13, 2011 at 3:16 AM, Alexandre <alexandre.fou...@gmail.com>
> wrote:
> > Hi,
> >
> > I am trying to manage the puppet.conf file, but both my classes
> > 'puppet' and 'puppet::master' need to manage it. Basically, the class
> > 'puppet::master' should be able to override the resource, which could
> > be done by inheritance.
> > My problem is that my class 'puppet' is a parameterized class:
> >
> >    class puppet ( $puppetmaster_fqdn ) {
> >        file { '/etc/puppet/puppet.conf':
> >            content => template('puppet/puppet.conf.erb'),
> >        }
> >        # (...)
> >    }
> >
> > and so, i don't find any syntax to inherit from it:
> >
> >    class puppet::master ( $with_dashboard          = 'yes',
> >                           $with_cloud_provisioner  = 'no'
> >                         ) inherits puppet {
> >        # (...)
> >    }
> >
> > fails with
> >
> >    err: Could not retrieve catalog from remote server: Error 400 on
> > SERVER: Must pass puppetmaster_fqdn to Class[Puppet] at /etc/puppet/
> > modules/puppet/manifests/puppet.pp:1 on node (...)
> >
> > I tried different ways to declare my class 'puppet::master', but i do
> > not find the right syntax, it always fails
> >
> >    class puppet::master ( $puppetmaster_fqdn       = 'something',
> >                           $with_dashboard          = 'yes',
> >                           $with_cloud_provisioner  = 'no'
> >                         ) inherits puppet {
> >        # (...)
> >    }
> >
> >    class puppet::master ( $with_dashboard          = 'yes',
> >                           $with_cloud_provisioner  = 'no'
> >                         ) inherits puppet( puppetmaster_fqdn =>
> > 'something' ) {
> >        # (...)
> >    }
> >
> > What is the good syntax for that ?
>
> There's probably three ways to tackle it:
> 1. have the puppet class write a file called puppet.conf.agent, and
> the master class write puppet.conf.master and cat puppet.conf.* >
> puppet.conf.
> 2. use a variable and add some logic to the ERB template.
> 3. use the following syntax (be aware it realize and override):
>
> In class puppet::master:
>
> File <| title=='/etc/puppet/puppet.conf' |> {
>  content => template('puppet/puppetmaster.conf.erb'),
> }
>
> HTH,
>
> Nan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to