[Puppet Users] Re: Puppet class dependency

2011-10-29 Thread Andrew Hendry
Hi Jean,

Is Nginx::Vhost[packages.iscoolapp.com] getting set up somewhere
else in your code?

If not should your pkgrepo be like this?
class pkgrepo {
 Nginx::Vhost[website.domain.tld] - Class['Pkgrepo']
 include pkgrepo::install,pkgrepo::config
}

Or

 pkgrepo::repository { test:
 docroot = /var/www/website.domain.tld,
 gpgkeyid= C78033BD,
 require = Nginx::Vhost[website.domain.tld],
 }

Good luck.

On Oct 29, 12:41 am, Jean Baptiste Favre
jean.baptiste.fa...@gmail.com wrote:
 Hello,
 There's something I don't understand with classes dependency.
 I saw many thread about this subject, but still can not figure how it
 works exactly.

 I'm trying to setup a debian package repository. For that, I need:
 - a vhost, served by nginx
 - repo managment tools as well as GPG key copied into directory tree

 So, that makes 2 classes:
 include nginx
 include pkgrepo

 nginx class install nginx package and provide a define to deal with
 vhost definition:
      nginx::vhost { 'website.domain.tld':
          port     = 80,
          docroot  = '/var/www',
          priority = 00,
      }
 This define will create directory /var/www/website.domain.tld as well as
 deploying vhost file in /etc/nginx/sites-enabled/00-website.domain.tld

 pkgrepo class will install repo managment tools and deploy repository
 GPG key in /var/www/website.domain.tld/key.gpg

 Therefore, it will require vhost to be created before being able to copy
 GPG key.

 Here's my setup:
 node nodetest {
      include nginx
      nginx::vhost { 'website.domain.tld':
          port     = 80,
          docroot  = '/var/www',
          priority = 00,
      }
      include pkgrepo
      pkgrepo::repository { test:
          docroot     = /var/www/website.domain.tld,
          gpgkeyid    = C78033BD,
      }}

 And for classes definition, I got:
 class pkgrepo {
          Nginx::Vhost[packages.iscoolapp.com] - Class['Pkgrepo']
          include pkgrepo::install,pkgrepo::config

 }

 Problem is, when I try to executed it twice, I don't alway have
 dependency respected. For sure, I'm doing something wrong, but can not
 figure what. Bellow are the execution output.

 Best regards,
 Jean Baptiste Favre

 Wrong behaviour:
 # /usr/sbin/puppetd --no-daemonize --logdest console --onetime --verbose
 --preferred_serialization_format marshal
 notice: Ignoring --listen on onetime run
 info: Caching catalog for nodetest
 info: Applying configuration version '1319805719'
 notice: /Stage[main]/Pkgrepo::Install/Package[reprepro]/ensure: ensure
 changed 'purged' to 'present'
 notice:
 /Stage[main]//Node[nodetest]/Nginx::Vhost[website.domain.tld]/File[/etc/ngi 
 nx/sites-enabled/00-website.domain.tld]/ensure:
 defined content as '{md5}bad3fd5741e335516e2e51aaefe2963c'
 info:
 /Stage[main]//Node[nodetest]/Nginx::Vhost[website.domain.tld]/File[/etc/ngi 
 nx/sites-enabled/00-website.domain.tld]:
 Scheduling refresh of Service[nginx]
 notice: /Stage[main]/Nginx::Service/Service[nginx]: Triggered 'refresh'
 from 1 events
 notice: Finished catalog run in 6.25 seconds

 Good behaviour:
 # /usr/sbin/puppetd --no-daemonize --logdest console --onetime --verbose
 --preferred_serialization_format marshal
 notice: Ignoring --listen on onetime run
 info: Caching catalog for nodetest
 info: Applying configuration version '1319805719'
 notice:
 /Stage[main]//Node[nodetest]/Nginx::Vhost[website.domain.tld]/File[/etc/ngi 
 nx/sites-enabled/00-website.domain.tld]/ensure:
 defined content as '{md5}bad3fd5741e335516e2e51aaefe2963c'
 info:
 /Stage[main]//Node[nodetest]/Nginx::Vhost[website.domain.tld]/File[/etc/ngi 
 nx/sites-enabled/00-website.domain.tld]:
 Scheduling refresh of Service[nginx]
 notice: /Stage[main]/Pkgrepo::Install/Package[reprepro]/ensure: ensure
 changed 'purged' to 'present'
 notice: /Stage[main]/Nginx::Service/Service[nginx]: Triggered 'refresh'
 from 1 events
 notice: Finished catalog run in 6.23 seconds

-- 
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.



[Puppet Users] Unable to define order of modules

2011-10-29 Thread Baptiste Grenier
Hello,
I am trying to define the modules' run order like this:

--8
...  % cat test.pp
class baseclass {
  include sudo
}

class sudo {
  file { '/tmp/sudoers':
ensure  = 'present',
content = template('/tmp/sudoers.erb'),
  }
  notify { class_sudo: message = class sudo }
}

class aptdater::client {
  $sudo_allow_aptdater_user = true
  notify { class_aptdater_client: message = class aptdater_client }
}

class { sudo: require = Class[aptdater::client] }

node 'monster.maatg.fr' {
  include baseclass
  include aptdater::client
}

# vim: set tw=80 et smarttab sw=2 ts=2 softtabstop=2 nocindent noautoindent:
--8
..d  % cat /tmp/sudoers.erb
# DEBUG: has_variable?(aptdater::client:sudo_allow_aptdater_user) = %= 
has_variable?(aptdater::client::sudo_allow_aptdater_user) %
# DEBUG: scope.lookupvar(aptdater::client:sudo_allow_aptdater_user) = %= 
scope.lookupvar(aptdater::client::sudo_allow_aptdater_user) %
--8
d..  % puppet apply test.pp
warning: Scope(Class[Sudo]): Could not look up qualified variable 
'aptdater::client::sudo_allow_aptdater_user'; class aptdater::client has not 
been evaluated at /tmp/sudoers.erb:1
warning: Scope(Class[Sudo]): Could not look up qualified variable 
'aptdater::client::sudo_allow_aptdater_user'; class aptdater::client has not 
been evaluated
notice: class aptdater_client
notice: /Stage[main]/Aptdater::Client/Notify[class_aptdater_client]/message: 
defined 'message' as 'class aptdater_client'
notice: class sudo
notice: /Stage[main]/Sudo/Notify[class_sudo]/message: defined 'message' as 
'class sudo'
notice: Finished catalog run in 0.04 seconds
--8
...  % cat /tmp/sudoers
# DEBUG: has_variable?(aptdater::client:sudo_allow_aptdater_user) = false
# DEBUG: scope.lookupvar(aptdater::client:sudo_allow_aptdater_user) = 
undefined
--8

But you can see that the order does not seems to be respected.

If I change the order of the includes in the node manifests and remove
the class { sudo: require = Class[aptdater::client] } it works as
expected:

--8
... 1  % cat test.pp
class baseclass {
  include sudo
}

class sudo {
  file { '/tmp/sudoers':
ensure  = 'present',
content = template('/tmp/sudoers.erb'),
  }
  notify { class_sudo: message = class sudo }
}

class aptdater::client {
  $sudo_allow_aptdater_user = true
  notify { class_aptdater_client: message = class aptdater_client }
}

#class { sudo: require = Class[aptdater::client] }

node 'monster.maatg.fr' {
  include aptdater::client
  include baseclass
}

# vim: set tw=80 et smarttab sw=2 ts=2 softtabstop=2 nocindent noautoindent:
--8
... 1  % puppet apply test.pp
notice: class aptdater_client
notice: /Stage[main]/Aptdater::Client/Notify[class_aptdater_client]/message: 
defined 'message' as 'class aptdater_client'
notice: /Stage[main]/Sudo/File[/tmp/sudoers]/content: content changed 
'{md5}588dda775c2c1dcfa204510682a43458' to 
'{md5}a1b441f7f7b2c922ef06125e69265c39'
notice: class sudo
notice: /Stage[main]/Sudo/Notify[class_sudo]/message: defined 'message' as 
'class sudo'
notice: Finished catalog run in 0.04 seconds
--8
d.. 1  % cat /tmp/sudoers
# DEBUG: has_variable?(aptdater::client:sudo_allow_aptdater_user) = true
# DEBUG: scope.lookupvar(aptdater::client:sudo_allow_aptdater_user) = true
--8

But I would like to be able to use metaparameters or puppet functions to
force the order of the modules.

I also tried things like adding to aptdater::client class
--8
Class['aptdater::client'] - Class['sudo']
--8
or adding
--8
file { '/tmp/plop':
  notify = File['/tmp/sudoers'],
}
--8
or
--8
file { '/tmp/plop':
  notify = Class['sudo'],
}
--8

But without any success.
What am I doing wrong?

Regards,
Baptiste

-- 
\,,/_[-_-]_\,,/

BOFH Excuse #132:

SCSI Chain overterminated


pgpXdZpiQtlp6.pgp
Description: PGP signature


Re: [Puppet Users] Re: Puppet class dependency

2011-10-29 Thread Jean Baptiste FAVRE
Hello Andrew,
Thanks for your answer.

Infact, pkgrepo *is* already like you suggest:
class pkgrepo {
Nginx::Vhost[website.domain.tld] - Class['Pkgrepo']
include pkgrepo::install,pkgrepo::config
}

Just forget about Nginx::Vhost[packages.iscoolapp.com] and replace it
wherever you see it with Nginx::Vhost[website.domain.tld] (my bad for
the typo).

And, that's why I don't understand because
Nginx::Vhost['website.domain.tld'] - Class['Pkgrepo'] is supposed to
make vhost applied before pkgrepo. But in my output examples, package
reprepro definied in pkgrepo::install got installed before vhosts is set up.

About setting require for pkgrepo::repository, I will try asap.
My first thought was to specify dependencies between classes in root
class (ie, in pkgrepo and not in pkgrepo::install) for readability purpose.
But, it that case, I could specify it pkgrepo::repository since it
defined in node definition. Just wonder why I did not tought about it
before :-/

Will let you updated right after my tests.

Regards,
JB


On 29/10/2011 09:26, Andrew Hendry wrote:
 Hi Jean,
 
 Is Nginx::Vhost[packages.iscoolapp.com] getting set up somewhere
 else in your code?
 
 If not should your pkgrepo be like this?
 class pkgrepo {
  Nginx::Vhost[website.domain.tld] - Class['Pkgrepo']
  include pkgrepo::install,pkgrepo::config
 }
 
 Or
 
  pkgrepo::repository { test:
  docroot = /var/www/website.domain.tld,
  gpgkeyid= C78033BD,
  require = Nginx::Vhost[website.domain.tld],
  }
 
 Good luck.
 
 On Oct 29, 12:41 am, Jean Baptiste Favre
 jean.baptiste.fa...@gmail.com wrote:
 Hello,
 There's something I don't understand with classes dependency.
 I saw many thread about this subject, but still can not figure how it
 works exactly.

 I'm trying to setup a debian package repository. For that, I need:
 - a vhost, served by nginx
 - repo managment tools as well as GPG key copied into directory tree

 So, that makes 2 classes:
 include nginx
 include pkgrepo

 nginx class install nginx package and provide a define to deal with
 vhost definition:
  nginx::vhost { 'website.domain.tld':
  port = 80,
  docroot  = '/var/www',
  priority = 00,
  }
 This define will create directory /var/www/website.domain.tld as well as
 deploying vhost file in /etc/nginx/sites-enabled/00-website.domain.tld

 pkgrepo class will install repo managment tools and deploy repository
 GPG key in /var/www/website.domain.tld/key.gpg

 Therefore, it will require vhost to be created before being able to copy
 GPG key.

 Here's my setup:
 node nodetest {
  include nginx
  nginx::vhost { 'website.domain.tld':
  port = 80,
  docroot  = '/var/www',
  priority = 00,
  }
  include pkgrepo
  pkgrepo::repository { test:
  docroot = /var/www/website.domain.tld,
  gpgkeyid= C78033BD,
  }}

 And for classes definition, I got:
 class pkgrepo {
  Nginx::Vhost[packages.iscoolapp.com] - Class['Pkgrepo']
  include pkgrepo::install,pkgrepo::config

 }

 Problem is, when I try to executed it twice, I don't alway have
 dependency respected. For sure, I'm doing something wrong, but can not
 figure what. Bellow are the execution output.

 Best regards,
 Jean Baptiste Favre

 Wrong behaviour:
 # /usr/sbin/puppetd --no-daemonize --logdest console --onetime --verbose
 --preferred_serialization_format marshal
 notice: Ignoring --listen on onetime run
 info: Caching catalog for nodetest
 info: Applying configuration version '1319805719'
 notice: /Stage[main]/Pkgrepo::Install/Package[reprepro]/ensure: ensure
 changed 'purged' to 'present'
 notice:
 /Stage[main]//Node[nodetest]/Nginx::Vhost[website.domain.tld]/File[/etc/ngi 
 nx/sites-enabled/00-website.domain.tld]/ensure:
 defined content as '{md5}bad3fd5741e335516e2e51aaefe2963c'
 info:
 /Stage[main]//Node[nodetest]/Nginx::Vhost[website.domain.tld]/File[/etc/ngi 
 nx/sites-enabled/00-website.domain.tld]:
 Scheduling refresh of Service[nginx]
 notice: /Stage[main]/Nginx::Service/Service[nginx]: Triggered 'refresh'
 from 1 events
 notice: Finished catalog run in 6.25 seconds

 Good behaviour:
 # /usr/sbin/puppetd --no-daemonize --logdest console --onetime --verbose
 --preferred_serialization_format marshal
 notice: Ignoring --listen on onetime run
 info: Caching catalog for nodetest
 info: Applying configuration version '1319805719'
 notice:
 /Stage[main]//Node[nodetest]/Nginx::Vhost[website.domain.tld]/File[/etc/ngi 
 nx/sites-enabled/00-website.domain.tld]/ensure:
 defined content as '{md5}bad3fd5741e335516e2e51aaefe2963c'
 info:
 /Stage[main]//Node[nodetest]/Nginx::Vhost[website.domain.tld]/File[/etc/ngi 
 nx/sites-enabled/00-website.domain.tld]:
 Scheduling refresh of Service[nginx]
 notice: /Stage[main]/Pkgrepo::Install/Package[reprepro]/ensure: ensure
 changed 'purged' to 'present'
 notice: /Stage[main]/Nginx::Service/Service[nginx]: Triggered 'refresh'
 

[Puppet Users] What the?? (gem install puppet not working) sorta... read on...

2011-10-29 Thread Peter Berghold
Hi folks,

In the past when I've wanted to install puppet to a system Ive just done a
gem install puppet facter' and it has workd.

After runing the gem install I tried running puppetd and was told not
found.  OK, so I started to dig and discovered that puppetd was indeed
installed on the system, but in the directory /var/lib/gems/1.8/bin
directory along with facter and all the other puppet friends.

A quick round of symlinks and I was back in business.

This was on a debian (squeeze) system.

SO for all those that might run into what I did, I've blazed the trail...



-- 
Peter L. Berghold
Owner, Shark River Technical Solutions LLC

-- 
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.



Re: [Puppet Users] What the?? (gem install puppet not working) sorta... read on...

2011-10-29 Thread James Turnbull
Peter Berghold wrote:
 Hi folks,
 
 In the past when I've wanted to install puppet to a system Ive just
 done a gem install puppet facter' and it has workd. 
 
 After runing the gem install I tried running puppetd and was told not
 found.  OK, so I started to dig and discovered that puppetd was indeed
 installed on the system, but in the directory /var/lib/gems/1.8/bin
 directory along with facter and all the other puppet friends. 
 
 A quick round of symlinks and I was back in business.  
 
 This was on a debian (squeeze) system. 
 
 SO for all those that might run into what I did, I've blazed the trail...

This was a decision the Debian team made about how gems would be
deployed on Squeeze and maybe Etch (I think it changed later but when I
am not sure).

Some notes about it in this thread:

http://stackoverflow.com/questions/2846804/whats-the-deal-with-rubygems-on-debian-its-different-and-strange

Regards

James Turnbull

-- 
James Turnbull
Puppet Labs
1-503-734-8571

-- 
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.