[Puppet Users] Embedding Puppet / using it as a library / api
Hey there, I'm thinking about reusing custom types from existing puppet infrastructure in standalone (ruby) applications. Example - Custom Type for a storage pool consisting of volume groups, logical volumes, drbd resources, filesystems, nfs export... you get the idea. Suppose that we have already defined this type in the form of a puppet module / custom type. Instead of reimplementing this stuff in an external library / script I'd rather reuse the puppet module, and as an additional goody, use some of the puppet datatypes / features (reporting differences in system state, noop, transaction, ...) So far I stumbled upon some different concepts in puppet land which might make this possible: puppet internal dsl puppet faces rest api One requirement would be the standalone aspect. While interacting with this hypthetical storage pool, I'd rather not do network roundtrips to the puppet master, as I prefer robustness over freshness in this case. I looked somewhat into the faces variant but coldn't find a way to construct a catalog without talking to the master. And by using just the Faces[:resource, ..] - stuff I'm missing some other nice features of the catalog. Any ideas / snippets / tips / tutorials to get me started? Thanks alot in advance Cheers Robert -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/CaaCOxX_UK4J. 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] $title as default value for argument in defintion
Hey there, I'd like to provide a definition with an argument which is optional and defaults to the title: net::route_default{first: gateway = 192.168.0.1} or the shortcut: net::route_default{192.168.0.1} class net { define route_default($gateway=$title) { exec {echo $gateway /etc/defaultrouter: unless = grep $gateway /etc/defaultrouter } ... } node foo { net::route_default{192.168.0.1} } trying it with noop: notice: //Node[myhost.local]/Net::Route_default[192.168.0.1]/Exec[echo myhost.local /etc/defaultrouter]/returns: is notrun Funny - puppet substitutes $title with the fully qualified hostname - can someone shed some light on this one? :) Thanks cheers Robert -- You received this message because you are subscribed to the Google Groups Puppet Users group. To post to this group, send email to puppet-us...@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] Re: $title as default value for argument in defintion
makes sense, thanks Robert On Mar 8, 4:19 pm, Thomas Bellman bell...@nsc.liu.se wrote: robert.gstoehl wrote: I'd like to provide a definition with an argument which is optional and defaults to the title: net::route_default{first: gateway = 192.168.0.1} or the shortcut: net::route_default{192.168.0.1} Do it like this: define route_default($gateway=) { if $gateway == { $xgateway = $title } else { $xgateway = $gateway } # Use $xgateway here instead of $gateway } define route_default($gateway=$title) { exec {echo $gateway /etc/defaultrouter: unless = grep $gateway /etc/defaultrouter } ... Funny - puppet substitutes $title with the fully qualified hostname - can someone shed some light on this one? :) The default values for definition parameters are evaluated when the definition is defined, not when the definition is used. And when you are outside of definitions, $title is set to the node name. /Bellman -- You received this message because you are subscribed to the Google Groups Puppet Users group. To post to this group, send email to puppet-us...@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] Re: Traversal of class inheritance - chain
Hey John, Thanks for the clarification. Makes kind of sense ;) Cheers Robert On Feb 17, 3:50 pm, jcbollinger john.bollin...@stjude.org wrote: On Feb 17, 2:56 am, robert.gstoehl robert.gsto...@gmail.com wrote: Can one include muliple parts of a (class) - inheritance chain? And if yes, how does this chain get traversed? Are there any limitations / sideffects / documentation? You can include classes from multiple parts of an inheritance tree, including classes from different branches of the tree, provided that there are no conflicting overrides. Two overrides conflict if they attempt to set different values for the same resource property, and they occur in two classes where neither is a descendant of the other. The two overrides in your syslog and ueber_syslog classes are perfect examples of conflicting overrides. I see nothing wrong with your classes individually, but including both syslog and ueber_syslog on the same node will fail. That makes sense, because doing so declares that the syslog service must be both running and stopped, which is impossible. There is no problem, however, with including class base along with either one of the other two. The solution, quite simply, is to avoid declaring conflicting resources or resource properties. In the example, that means each node may include at most one of the syslog and ueber_syslog classes. To achieve that you can hard-code per node group which class to use, use if or case statements to choose one class for each node based on its available facts, or use an external node classifier. Cheers, John -- You received this message because you are subscribed to the Google Groups Puppet Users group. To post to this group, send email to puppet-us...@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] Behaviour overloading through inheritance
Hey there, I'd like to migrate some of our solaris hardening mechanisms from sst (jass) to puppet. One part of the work involves disabling services in a secure base class while letting the administrator override specific services through sepcialized classes (kind of a secure - by default - mechanism). In puppet language: class solaris { } class lamp_services inherits solaris { } class mailservices inherits solaris { } -- You received this message because you are subscribed to the Google Groups Puppet Users group. To post to this group, send email to puppet-us...@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] Re: Where are the puppet logs on Solaris 10?
A stock Solaris 10 syslog logs to /var/adm/messages. Cheers Robert On Nov 8, 3:01 pm, Erlend Leganger elegan...@gmail.com wrote: I set up puppet for the first time yesterday, on two Solaris 10 machines, each running puppet v0.24.7. I made a modified version of the initial manifest described inhttp://reductivelabs.com/trac/puppet/wiki/InstallationGuide(updating /etc/passwd, sudoers doesn't exist in Solaris). Things work fine both on master and client, but where are the log files so that I can see what is going on? I understand puppet logs to syslog, but grep -i puppet $(find /var/log) returns nothing, where else should I look? - Erlend Leganger Here is what I see on the client: r...@sol10u7ga-02:/$ puppetd --test info: No classes to store info: Caching catalog at /var//opt/csw/puppet/state/localconfig.yaml notice: Starting catalog run notice: Finished catalog run in 0.03 seconds r...@sol10u7ga-02:/$ r...@sol10u7ga-02:/$ r...@sol10u7ga-02:/$ cat /var/opt/csw/ cswclassutils/ pkg-hooks/ puppet/ svc/ r...@sol10u7ga-02:/$ cat /var/opt/csw/puppet/ clientbucket/ lib/ log/ run/ state/ r...@sol10u7ga-02:/$ cat /var/opt/csw/puppet/state/localconfig.yaml --- !ruby/object:Puppet::TransBucket classes: [] children: - !ruby/object:Puppet::TransObject params: group: root mode: 440 owner: root file: /etc//opt/csw/puppet/manifests/site.pp tags: - file - class - main line: 3 name: /etc/passwd type: file name: :main type: Class r...@sol10u7ga-02:/$ uname -a SunOS sol10u7ga-02 5.10 Generic_139556-08 i86pc i386 i86pc r...@sol10u7ga-02:/$ --~--~-~--~~~---~--~~ 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] Re: custom definitions require and +
Seems to work so far, thanks. What happens when a $require is passed to the definition which contains an array? require = [ Package[wget], $require ] My quick test (printing out $require via a notify) indicate that only the first item of the array is included. Is there a way to merge arrays? On Jul 13, 7:12 pm, David Schmitt da...@dasz.at wrote: robert.gstoehl wrote: I'm trying to get the dependencies right: define wget($source, $options = , $unless = ) { include pkg::virtual_packages realize (Package[wget]) exec {wget $options -O $title $source: path = /usr/bin:/opt/csw/bin, unless = $unless, timeout = 18000, require = Package[wget] } if $require { Exec [wget $options -O $title $source]{ require + $require } } } Bombs with: err: Could not retrieve configuration: Parameter 'require' is already set on Exec[wget -O ... ] by wget at /etc/opt/csw/puppet/ manifests/definitions/wget.pp:8; cannot redefine at /etc/opt/csw/ puppet/manifests/definitions/wget.pp:14 The docs say: Note that all defined types support automatically all metaparameters. Therefore you can pass any later used parameters like $require to a define, without any definition of it: define svn_repo($path) { exec {create_repo_${name}: command = /usr/bin/svnadmin create $path/$title, unless = /bin/test -d $path, } if $require { Exec[create_repo_${name}]{ require + $require, } } } What am I doing wrong? Is there another way to add the require metaparameter to the nested exec resource? + is only valid when inheriting resources. Instead do this: define wget($source, $options = , $unless = ) { include pkg::virtual_packages realize (Package[wget]) exec {wget $options -O $title $source: path = /usr/bin:/opt/csw/bin, unless = $unless, timeout = 18000, } if $require { Exec [wget $options -O $title $source]{ require = [ Package[wget], $require ] } } else { Exec [wget $options -O $title $source]{ require = [ Package[wget] ] } } } Regards, DavidS --~--~-~--~~~---~--~~ 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] Re: custom definitions require and +
Hm, with --debug it seems like all the dependencies, even an array of them, get passed to the nested exec. Voodoo :) Thanks for your help. On Jul 15, 9:55 am, robert.gstoehl robert.gsto...@gmail.com wrote: Seems to work so far, thanks. What happens when a $require is passed to the definition which contains an array? require = [ Package[wget], $require ] My quick test (printing out $require via a notify) indicate that only the first item of the array is included. Is there a way to merge arrays? On Jul 13, 7:12 pm, David Schmitt da...@dasz.at wrote: robert.gstoehl wrote: I'm trying to get the dependencies right: define wget($source, $options = , $unless = ) { include pkg::virtual_packages realize (Package[wget]) exec {wget $options -O $title $source: path = /usr/bin:/opt/csw/bin, unless = $unless, timeout = 18000, require = Package[wget] } if $require { Exec [wget $options -O $title $source]{ require + $require } } } Bombs with: err: Could not retrieve configuration: Parameter 'require' is already set on Exec[wget -O ... ] by wget at /etc/opt/csw/puppet/ manifests/definitions/wget.pp:8; cannot redefine at /etc/opt/csw/ puppet/manifests/definitions/wget.pp:14 The docs say: Note that all defined types support automatically all metaparameters. Therefore you can pass any later used parameters like $require to a define, without any definition of it: define svn_repo($path) { exec {create_repo_${name}: command = /usr/bin/svnadmin create $path/$title, unless = /bin/test -d $path, } if $require { Exec[create_repo_${name}]{ require + $require, } } } What am I doing wrong? Is there another way to add the require metaparameter to the nested exec resource? + is only valid when inheriting resources. Instead do this: define wget($source, $options = , $unless = ) { include pkg::virtual_packages realize (Package[wget]) exec {wget $options -O $title $source: path = /usr/bin:/opt/csw/bin, unless = $unless, timeout = 18000, } if $require { Exec [wget $options -O $title $source]{ require = [ Package[wget], $require ] } } else { Exec [wget $options -O $title $source]{ require = [ Package[wget] ] } } } Regards, DavidS --~--~-~--~~~---~--~~ 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] Re: custom definitions require and +
I'm still on 0.23.2 for some time. Planning the upgrade at the moment. On Jul 15, 10:09 am, David Schmitt da...@dasz.at wrote: robert.gstoehl wrote: Seems to work so far, thanks. What happens when a $require is passed to the definition which contains an array? require = [ Package[wget], $require ] My quick test (printing out $require via a notify) indicate that only the first item of the array is included. Is there a way to merge arrays? Use the append functionality of newer puppet releases: http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#appending-... Regards, DavidS --~--~-~--~~~---~--~~ 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] custom definitions require and +
I'm trying to get the dependencies right: define wget($source, $options = , $unless = ) { include pkg::virtual_packages realize (Package[wget]) exec {wget $options -O $title $source: path= /usr/bin:/opt/csw/bin, unless = $unless, timeout = 18000, require = Package[wget] } if $require { Exec [wget $options -O $title $source]{ require + $require } } } Bombs with: err: Could not retrieve configuration: Parameter 'require' is already set on Exec[wget -O ... ] by wget at /etc/opt/csw/puppet/ manifests/definitions/wget.pp:8; cannot redefine at /etc/opt/csw/ puppet/manifests/definitions/wget.pp:14 The docs say: Note that all defined types support automatically all metaparameters. Therefore you can pass any later used parameters like $require to a define, without any definition of it: define svn_repo($path) { exec {create_repo_${name}: command = /usr/bin/svnadmin create $path/$title, unless = /bin/test -d $path, } if $require { Exec[create_repo_${name}]{ require + $require, } } } What am I doing wrong? Is there another way to add the require metaparameter to the nested exec resource? Regards Robert --~--~-~--~~~---~--~~ 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] Re: client facter values 0.23.2
I'll take another shot at it as soon we have upgraded to a more recent version. Thanks Ohad Levy. On Jul 7, 3:28 pm, robert.gstoehl robert.gsto...@gmail.com wrote: Two yaml files outside the var/puppet/reports/* dir: /var/puppet/state/localconfig.yaml /var/puppet/state/state.yaml Nothing else. I don't have a yamldir entry in my (generated) config file. On Jul 7, 2:57 pm, Ohad Levy ohadl...@gmail.com wrote: i think its under the yaml/facts directory, maybe a simple find under puppetdir for all yaml files? On Tue, Jul 7, 2009 at 8:11 PM, robert.gstoehl robert.gsto...@gmail.comwrote: Hi, I need to do some reporting on the client (installed packages, patchlevel, ... you get the idea) I'd like to use some custome facts for this. According the documentation, the clients facter values should be stored on the puppetmaster as yaml files: http://reductivelabs.com/trac/puppet/wiki/AddingFacts: You can also determine what facts (and their values) your clients return by checking the contents of the client's yaml output. To do this we check the $yamldir (by default $vardir/yaml/) on the Puppet master: # grep kernel /var/lib/puppet/yaml/node/puppetslave.example.org.yaml kernel: Linux kernelrelease: 2.6.18-92.el5 kernelversion: 2.6.18 I can't find any yaml files on my 0.23.2 puppet masters. Is this feature available before 0.24? Regards Robert --~--~-~--~~~---~--~~ 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] client facter values 0.23.2
Hi, I need to do some reporting on the client (installed packages, patchlevel, ... you get the idea) I'd like to use some custome facts for this. According the documentation, the clients facter values should be stored on the puppetmaster as yaml files: http://reductivelabs.com/trac/puppet/wiki/AddingFacts: You can also determine what facts (and their values) your clients return by checking the contents of the client's yaml output. To do this we check the $yamldir (by default $vardir/yaml/) on the Puppet master: # grep kernel /var/lib/puppet/yaml/node/puppetslave.example.org.yaml kernel: Linux kernelrelease: 2.6.18-92.el5 kernelversion: 2.6.18 I can't find any yaml files on my 0.23.2 puppet masters. Is this feature available before 0.24? Regards Robert --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---