strange behave of newly added puppet client

188 views
Skip to first unread message

Thorsten

unread,
Dec 29, 2015, 5:00:26 PM12/29/15
to Puppet Users
Dear all,

I'm new to puppet, but learning fast and having fun with my new puppet project, but, I ran into some issues I'm stuck with now.

Maybe you can advise.

I created a set of configurations for some nodes in my /etc/puppet/manifests/site.pp, as follows:

node 'client1', 'client2', 'client3', 'client4', 'client5' {
include preconfig
include selinux
import 'timezone.pp'
include ntp
include oracle_java
import 'nagiosplugins.pp'
import 'nrpe.pp'
import 'cassandra.pp'
include httpd
}

(The imported files are stored in same directory as site.pp)
So far everything works perfectly, all clients will receive the software and configuration as defined.

Now I added a client6 to my site.pp as follows:

node 'client6' {
        include selinux
import 'timezone.pp'
include ntp
include oracle_java
import 'nagiosplugins.pp'
import 'nrpe.pp'
}

This causes my puppet client on client6 to act really strange. It looks like puppet will ignore the node settings and try to run all configurations on client6, even the ones, not specified in the node 'client6' section.

The output on the client is:

[root@client6 ~]# puppet agent --test
info: Loading facts in /var/lib/puppet/lib/facter/service_provider.rb
info: Loading facts in /var/lib/puppet/lib/facter/archive_windir.rb
info: Loading facts in /var/lib/puppet/lib/facter/package_provider.rb
info: Loading facts in /var/lib/puppet/lib/facter/staging_windir.rb
info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
info: Loading facts in /var/lib/puppet/lib/facter/apt_updates.rb
info: Loading facts in /var/lib/puppet/lib/facter/apt_reboot_required.rb
info: Loading facts in /var/lib/puppet/lib/facter/ip6tables_version.rb
info: Loading facts in /var/lib/puppet/lib/facter/os_maj_version.rb
info: Loading facts in /var/lib/puppet/lib/facter/iptables_persistent_version.rb
info: Loading facts in /var/lib/puppet/lib/facter/pe_version.rb
info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
info: Loading facts in /var/lib/puppet/lib/facter/concat_basedir.rb
info: Loading facts in /var/lib/puppet/lib/facter/staging_http_get.rb
info: Loading facts in /var/lib/puppet/lib/facter/iptables_version.rb
info: Loading facts in /var/lib/puppet/lib/facter/apt_update_last_success.rb
Could not retrieve package_provider: uninitialized constant Gem
Could not retrieve package_provider: uninitialized constant Gem
info: Caching catalog for client6
err: Failed to apply catalog: Invalid parameter ensure at /etc/puppet/modules/cassandra/manifests/datastax_repo.pp:27

Thank you very much

Thorsten

Russell Miller

unread,
Dec 29, 2015, 5:10:39 PM12/29/15
to Puppet Users


On Tuesday, December 29, 2015 at 2:00:26 PM UTC-8, Thorsten wrote:

err: Failed to apply catalog: Invalid parameter ensure at /etc/puppet/modules/cassandra/manifests/datastax_repo.pp:27

The first thing to do is check to see if any of your included modules also include cassandra.  You're right that this is unexpected behavior, but in 99% of the cases, the issue is with code, not with puppet.

Also, it looks like you have a bug in your cassandra module, which is how you found this in the first place.

--Russell

jcbollinger

unread,
Jan 4, 2016, 9:34:55 AM1/4/16
to Puppet Users


On Tuesday, December 29, 2015 at 4:00:26 PM UTC-6, Thorsten wrote:

I created a set of configurations for some nodes in my /etc/puppet/manifests/site.pp, as follows:

node 'client1', 'client2', 'client3', 'client4', 'client5' {
include preconfig
include selinux
import 'timezone.pp'
include ntp
include oracle_java
import 'nagiosplugins.pp'
import 'nrpe.pp'
import 'cassandra.pp'
include httpd
}

(The imported files are stored in same directory as site.pp)
So far everything works perfectly, all clients will receive the software and configuration as defined.


If it works as you intended, then your manifest set is very strange indeed.  Your placement of 'import' statements inside a node block strongly suggests that you have a mistaken idea of what they do.  Their effect is not scoped to the node block -- rather, the scope of any declarations within the imported files is whatever scope is implied by the file itself.  That the effect is what you expected for the original node block indicates that you have top-scope class or resource declarations in those files, and by importing them into 'site.pp', you get top-scope declarations in 'site.pp'.
 
 

Now I added a client6 to my site.pp as follows:

node 'client6' {
        include selinux
import 'timezone.pp'
include ntp
include oracle_java
import 'nagiosplugins.pp'
import 'nrpe.pp'
}

This causes my puppet client on client6 to act really strange. It looks like puppet will ignore the node settings and try to run all configurations on client6, even the ones, not specified in the node 'client6' section.


Yes and no.  You imported top-scope class and / or resource declarations into your site manifest (even though the 'import' statements appear inside a node block).  These apply to all nodes.

The 'import' statement was deprecated somewhere in the Puppet 3 series, and it has been removed from Puppet 4.  If you want to split your site manifest across multiple files, which is about the only good use that remained for 'import' in Puppet 3, then you can do that more easily in Puppet 4 simply by using a site manifest directory.  But that does not appear to be what you are actually trying to do.

Instead of putting all your manifests in the site manifest directory, create proper modules for them.  Instead of top-scope class and resource declarations in your manifests, put all your class and resource declarations inside class bodies (of classes in modules) or node blocks.


John
Reply all
Reply to author
Forward
0 new messages