I am using Puppet Enterprise.
# puppet master --version
4.8.1
Manifests dir (/etc/puppetlabs/code/environments/production/manifests
) contains the following:
iis.pp
rds.pp
site.pp
I have a node definition in site.pp
as shown below:
# cat site.pp
node 'box A' {
include iis
}
Now the issue i am facing is that if i create a new node (say, box B) and add it to site.pp by creating a blank definition as shown below, it still installs softwares that are actually part of another node ('box A' in this case) definition.
node 'box B' { }
I don't have any include
statement in site.pp defined outside the above two node definitions.
Why is this happening?
UPDATE:
# cat iis.pp
$iis_features = ['Web-Server','Web-WebServer','Web-Asp-Net45','Web-ISAPI-Ext','Web-ISAPI-Filter','NET-Framework-45-ASPNET']
windowsfeature { $iis_features:
ensure => present,
}
Since Puppet 4, all files in the top-level environment manifests/
directory will be automatically loaded. Usually this is so you can define different node definitions or classes and have them all loaded without using the import
directive (used in Puppet 2 and 3).
In your case, iis.pp
, rds.pp
and site.pp
are parsed and used on every node. (Directories: The main manifest(s) has some more info on how this is configured.)
To fix it, use Puppet classes to group your IIS configuration (the windowsfeature
resources) into an iis
class - then your include iis
will only use this configuration on "box A".
Change iis.pp to define a class:
class iis {
$iis_features = ['Web-Server','Web-WebServer','Web-Asp-Net45','Web-ISAPI-Ext','Web-ISAPI-Filter','NET-Framework-45-ASPNET']
windowsfeature { $iis_features:
ensure => present,
}
}
Ideally, move iis.pp
to /etc/puppetlabs/code/environments/production/modules/iis/manifests/init.pp
to be in the standard module location. This provides better performance as Puppet doesn't need to read iis.pp until you use include iis
.