Peter Foley
2012-Apr-25 07:26 UTC
[Puppet Users] Unable to import a manifest file from a different directory to the one where site.pp is located using environments
Hi List, Puppet Version: v2.7.13 Question - If I correctly setup multiple manifestdir''s in the puppet.conf file how can I import a node pp file located in a different directory tree to site.pp? My configuration information is below. In my puppet.conf file I have setup an environment called "stable", within this environment I have setup the manifestdir, modulepath and manifest settings like so: ------------------------- (Begin Extract) -------------------------------- [stable] *manifestdir*=/srv/puppetmaster/stable/manifests:* /srv/puppetmaster/stable/site-nodes* modulepath=/srv/puppetmaster/stable/modules:/srv/puppetmaster/stable/site-modules *manifest=/srv/puppetmaster/stable/manifests/site.pp* ------------------------- (End Extract) -------------------------------- If I run a config print against the manifestdir against the stable environment it outputs the correct paths: ------------------------- (Begin Extract) -------------------------------- root@core ~# *puppet config print --environment stable manifestdir* /srv/puppetmaster/stable/manifests:/srv/puppetmaster/stable/site-nodes ------------------------- (End Extract) -------------------------------- In my site.pp file I have ------------------------- (Begin Extract) -------------------------------- root@core stable/manifests# pwd /srv/puppetmaster/stable/manifests root@core stable/manifests# cat site.pp Exec { path => "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" } import "core.mob.ifoley.local.pp" node default { fail (" Please create a node file for this computer ! ") } ------------------------- (End Extract) -------------------------------- In my core.mob.ifoley.local pp file I have ------------------------- (Begin Extract) -------------------------------- root@core stable/site-nodes# pwd /srv/puppetmaster/stable/site-nodes root@core stable/site-nodes# cat core.mob.ifoley.local.pp node ''core.mob.ifoley.local'' { notice("Inside core pp file") } ------------------------- (End Extract) -------------------------------- On the puppet client when I run the Puppet apply it gives the below output. ------------------------- (Begin Extract) -------------------------------- root@core ~# puppet agent --server puppet.mob.ifoley.local --environment stable --no-daemonize --verbose --onetime info: Retrieving plugin info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/root_home.rb info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/facter_dot_d.rb info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/puppet_vardir.rb info: Loading facts in /etc/puppet/modules/concat/lib/facter/concat_basedir.rb info: Loading facts in /var/lib/puppet/lib/facter/concat_basedir.rb info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb *err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not parse for environment stable: No file(s) found for import of ''core.mob.ifoley.local.pp'' at /srv/puppetmaster/stable/manifests/site.pp:8 on node core.mob.ifoley.local* info: Not using expired catalog for core.mob.ifoley.local from cache; expired at Wed Apr 25 08:22:31 +1000 2012 notice: Using cached catalog err: Could not retrieve catalog; skipping run ------------------------- (End Extract) -------------------------------- If I move the core.mob.ifoley.local.pp file into the same directory as the site.pp file then it correctly imports the file and spits out the notice message. Am I doing something wrong? Any help would be greatly appricated. Thanks, Peter. -- 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.
Luke Bigum
2012-Apr-25 07:56 UTC
Re: [Puppet Users] Unable to import a manifest file from a different directory to the one where site.pp is located using environments
I don''t think $manifestdir will take a directory list, only a single directory. From the 2.7.12 docs: [root@puppet ~]# puppet --genconf | grep -B2 -A1 manifestdir # The entry-point manifest for puppet master. # The default value is ''$manifestdir/site.pp''. manifest = /etc/puppet/manifests/site.pp -- # Where puppet master looks for its manifests. # The default value is ''$confdir/manifests''. manifestdir = /etc/puppet/manifests Is this your directory structure? /srv/puppetmaster/stable/manifests/ /srv/puppetmaster/stable/manifests/site.pp /srv/puppetmaster/stable/site-nodes/ /srv/puppetmaster/stable/site-nodes/core.mob.ifoley.local.pp The import function is relative, so you could try do this: import "../site-nodes/*.pp" Or move the site-nodes directory under stable/manifests/ and do this: import "site-nodes/*.pp" On 25/04/12 08:26, Peter Foley wrote:> Hi List, > > Puppet Version: v2.7.13 > > Question - If I correctly setup multiple manifestdir''s in the > puppet.conf file how can I import a node pp file located in a > different directory tree to site.pp? > > My configuration information is below. > > In my puppet.conf file I have setup an environment called "stable", > within this environment I have setup the manifestdir, modulepath and > manifest settings like so: > > ------------------------- (Begin Extract) -------------------------------- > > [stable] > *manifestdir*=/srv/puppetmaster/stable/manifests:*/srv/puppetmaster/stable/site-nodes* > modulepath=/srv/puppetmaster/stable/modules:/srv/puppetmaster/stable/site-modules > *manifest=/srv/puppetmaster/stable/manifests/site.pp* > > ------------------------- (End Extract) > -------------------------------- > > > If I run a config print against the manifestdir against the > stable environment it outputs the correct paths: > > ------------------------- (Begin Extract) > -------------------------------- > root@core ~# *puppet config print --environment stable manifestdir* > /srv/puppetmaster/stable/manifests:/srv/puppetmaster/stable/site-nodes > ------------------------- (End Extract) > -------------------------------- > > In my site.pp file I have > > ------------------------- (Begin Extract) > -------------------------------- > root@core stable/manifests# pwd > /srv/puppetmaster/stable/manifests > > root@core stable/manifests# cat site.pp > Exec { path => > "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" } > > import "core.mob.ifoley.local.pp" > > node default { > > fail (" > > Please create a node file for this computer ! > > ") > } > ------------------------- (End Extract) > -------------------------------- > > In my core.mob.ifoley.local pp file I have > > ------------------------- (Begin Extract) > -------------------------------- > > root@core stable/site-nodes# pwd > /srv/puppetmaster/stable/site-nodes > > root@core stable/site-nodes# cat core.mob.ifoley.local.pp > node ''core.mob.ifoley.local'' { > notice("Inside core pp file") > } > > > ------------------------- (End Extract) > -------------------------------- > > On the puppet client when I run the Puppet apply it gives the below > output. > > ------------------------- (Begin Extract) -------------------------------- > > root@core ~# puppet agent --server puppet.mob.ifoley.local > --environment stable --no-daemonize --verbose --onetime > info: Retrieving plugin > info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/root_home.rb > info: Loading facts in > /etc/puppet/modules/stdlib/lib/facter/facter_dot_d.rb > info: Loading facts in > /etc/puppet/modules/stdlib/lib/facter/puppet_vardir.rb > info: Loading facts in > /etc/puppet/modules/concat/lib/facter/concat_basedir.rb > info: Loading facts in /var/lib/puppet/lib/facter/concat_basedir.rb > info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb > info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb > info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb > *err: Could not retrieve catalog from remote server: Error 400 on > SERVER: Could not parse for environment stable: No file(s) found for > import of ''core.mob.ifoley.local.pp'' at > /srv/puppetmaster/stable/manifests/site.pp:8 on node > core.mob.ifoley.local* > info: Not using expired catalog for core.mob.ifoley.local from cache; > expired at Wed Apr 25 08:22:31 +1000 2012 > notice: Using cached catalog > err: Could not retrieve catalog; skipping run > > ------------------------- (End Extract) > -------------------------------- > > If I move the core.mob.ifoley.local.pp file into the same directory as > the site.pp file then it correctly imports the file and spits out the > notice message. > > Am I doing something wrong? > > Any help would be greatly appricated. > > Thanks, > > Peter. > -- > 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.-- Luke Bigum Information Systems Ph: +44 (0) 20 3192 2520 luke.bigum@lmax.com | http://www.lmax.com LMAX, Yellow Building, 1A Nicholas Road, London W11 4AN FX and CFDs are leveraged products that can result in losses exceeding your deposit. They are not suitable for everyone so please ensure you fully understand the risks involved. The information in this email is not directed at residents of the United States of America or any other jurisdiction where trading in CFDs and/or FX is restricted or prohibited by local laws or regulations. The information in this email and any attachment is confidential and is intended only for the named recipient(s). The email may not be disclosed or used by any person other than the addressee, nor may it be copied in any way. If you are not the intended recipient please notify the sender immediately and delete any copies of this message. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. LMAX operates a multilateral trading facility. Authorised and regulated by the Financial Services Authority (firm registration number 509778) and is registered in England and Wales (number 06505809). Our registered address is Yellow Building, 1A Nicholas Road, London, W11 4AN. -- 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.
Peter
2012-Apr-25 10:59 UTC
[Puppet Users] Re: Unable to import a manifest file from a different directory to the one where site.pp is located using environments
Hi Luke, Thanks for the reply. That makes sense now ... my issue was thinking it had the same behavour as the modulepath setting. I might have to re-think how I was going to manage multiple environments and multiple users using the same or different environments. For some background on what I was thinking I was planning on having: 1. A Repo(s) to manage settings that would be common across environments (with minor tweaks managed by site settings) /srv/puppetmaster/stable/manifests/ /srv/puppetmaster/stable/modules/ 2. A Repo(s) that contains information that defines how an environments nodes are setup and run /srv/puppetmaster/stable/site-nodes/ /srv/puppetmaster/stable/site-modules/ I will just have to think a it harder on how to achieve this ... On Apr 25, 5:56 pm, Luke Bigum <Luke.Bi...@lmax.com> wrote:> I don''t think $manifestdir will take a directory list, only a single > directory. From the 2.7.12 docs: > > [root@puppet ~]# puppet --genconf | grep -B2 -A1 manifestdir > > # The entry-point manifest for puppet master. > # The default value is ''$manifestdir/site.pp''. > manifest = /etc/puppet/manifests/site.pp > -- > # Where puppet master looks for its manifests. > # The default value is ''$confdir/manifests''. > manifestdir = /etc/puppet/manifests > > Is this your directory structure? > > /srv/puppetmaster/stable/manifests/ > /srv/puppetmaster/stable/manifests/site.pp > /srv/puppetmaster/stable/site-nodes/ > /srv/puppetmaster/stable/site-nodes/core.mob.ifoley.local.ppYes this is correct.> > The import function is relative, so you could try do this: > > import "../site-nodes/*.pp" > > Or move the site-nodes directory under stable/manifests/ and do this: > > import "site-nodes/*.pp" >As mentioned above I will have a think about how I want things setup now.> -- > Luke Bigum > > Information Systems > Ph: +44 (0) 20 3192 2520 > luke.bi...@lmax.com |http://www.lmax.com > LMAX, Yellow Building, 1A Nicholas Road, London W11 4ANThanks for your help. Peter. -- 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.
Seemingly Similar Threads
- Duplicate declaration for invoking a class
- Share Hiera configuration between 2 nodes?
- PuppetDB "Failed to submit 'replace facts' command"
- hiera values issue
- Puppet Setup - Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Connection refused - connect(2)