Hi Friends, I am trying to configure ossec via puppet module with Puppet 2.7.18 installed on the Centos 6 64-bit. It is running fine except I want ossec agent to download template based on its hostname( if it is defined in the site.pp) otherwise download the general osse.conf-agent file. This is the what I am trying to achieve but somehow it is not working. What should be the correct synax for the hostname and also, it is not taking the complete hostname for the template. if ($hostname == "") { $content_template = "ossec/ossec-conf-${ossectype}.erb" } else { $content_template "ossec/servers/ossec-conf-${ossectype}-${hostname}.erb" } file { "ossec.conf": path => "/var/ossec/etc/ossec.conf", ensure => present, owner => root, group => ossec, mode => 550, content => template($content_template), } Running: puppetd --test --server=puppet-server.synapse.com --debug returns the below error err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find template ''ossec/servers/ossec-conf-agent-repocentos6.erb'' at /etc/puppet/modules/ossec/manifests/init.pp:221 on node repocentos6.synapse.com. warning: Not using cache on failed catalog err: Could not retrieve catalog; skipping run Module is available at http://projects.puppetlabs.com/projects/1/wiki/OSSEC-HIDS_Patterns Thanks & Regards Ankush -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Hi, See inline.. On 06/08/2012, at 20:16, ankush grover <ankushcentos@gmail.com> wrote:> Hi Friends, > > I am trying to configure ossec via puppet module with Puppet 2.7.18 installed on the Centos 6 64-bit. It is running fine except I want ossec agent to download template based on its hostname( if it is defined in the site.pp) otherwise download the general osse.conf-agent file. > > > This is the what I am trying to achieve but somehow it is not working. What should be the correct synax for the hostname and also, it is not taking the complete hostname for the template. > > if ($hostname == "") { > $content_template = "ossec/ossec-conf-${ossectype}.erb" > } > else > > { $content_template = "ossec/servers/ossec-conf-${ossectype}-${hostname}.erb" > } > > > > file { "ossec.conf": > path => "/var/ossec/etc/ossec.conf", > ensure => present, owner => root, group => ossec, mode => 550, > content => template($content_template), > } > > Running: puppetd --test --server=puppet-server.synapse.com --debug returns the below error > > err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find template ''ossec/servers/ossec-conf-agent-repocentos6.erb'' at /etc/puppet/modules/ossec/manifests/init.pp:221 on node repocentos6.synapse.com. warning: Not using cache on failed catalog > err: Could not retrieve catalog; skipping run >What is the name of the file in the following directory?> /etc/puppet/modules/ossec/templates/serversPuppet is looking for:> ossec-conf-agent-repocentos6.erbHave a look here for more details: http://docs.puppetlabs.com/learning/templates.html Cheers> Module is available at > > http://projects.puppetlabs.com/projects/1/wiki/OSSEC-HIDS_Patterns > > > > Thanks & Regards > > Ankush > > -- > 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+unsubscribe@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
ankush grover
2012-Aug-06 13:53 UTC
Re: [Puppet Users] Configuring templates as per hostnames
Now this code is working fine. There was some issue with the other custom lines in init.pp if ($hostname == "") { $content_template = "ossec/ossec-conf-${ossectype}.erb" } else { $content_template "ossec/servers/ossec-conf-${ossectype}-${hostname}.erb" } file { "ossec.conf": path => "/var/ossec/etc/ossec.conf", ensure => present, owner => root, group => ossec, mode => 550, content => template($content_template), } On Mon, Aug 6, 2012 at 6:44 PM, Denmat <tu2bgone@gmail.com> wrote:> Hi, > See inline.. > > > On 06/08/2012, at 20:16, ankush grover <ankushcentos@gmail.com> wrote: > > Hi Friends, > > I am trying to configure ossec via puppet module with Puppet 2.7.18 > installed on the Centos 6 64-bit. It is running fine except I want ossec > agent to download template based on its hostname( if it is defined in the > site.pp) otherwise download the general osse.conf-agent file. > > > This is the what I am trying to achieve but somehow it is not working. > What should be the correct synax for the hostname and also, it is not > taking the complete hostname for the template. > > if ($hostname == "") { > $content_template = "ossec/ossec-conf-${ossectype}.erb" > } > else > > { $content_template > "ossec/servers/ossec-conf-${ossectype}-${hostname}.erb" > } > > > > file { "ossec.conf": > path => "/var/ossec/etc/ossec.conf", > ensure => present, owner => root, group => ossec, mode => 550, > content => template($content_template), > } > > Running: puppetd --test --server=puppet-server.synapse.com --debug > returns the below error > > err: Could not retrieve catalog from remote server: Error 400 on SERVER: > Could not find template ''ossec/servers/ossec-conf-agent-repocentos6.erb'' at > /etc/puppet/modules/ossec/manifests/init.pp:221 on node > repocentos6.synapse.com. warning: Not using cache on failed catalog > err: Could not retrieve catalog; skipping run > > What is the name of the file in the following directory? > > /etc/puppet/modules/ossec/templates/servers > > > Puppet is looking for: > > ossec-conf-agent-repocentos6.erb > > > Have a look here for more details: > http://docs.puppetlabs.com/learning/templates.html > > Cheers > > Module is available at > > http://projects.puppetlabs.com/projects/1/wiki/OSSEC-HIDS_Patterns > > > > Thanks & Regards > > Ankush > > -- > 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+unsubscribe@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+unsubscribe@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.