Re: [Puppet Users] Exclude an element from array
Hi! What's about the stdlib member function: https://github.com/puppetlabs/puppetlabs-stdlib/blob/master/README.markdown#member Untested Example: ``` if ($::osfamily != 'RedHat') and (! member($stop_services, 'auditd')) { service {...} } ``` Perhaps you can use the fact $::operatingsystemrelease or $::operatingsystemmajrelease to check if it's RedHat or CentOS 7. Julian > On 10 Oct 2015, at 13:47, Vikas Kumar wrote: > > Hello Everyone, > > I have a very basic code to stop and disable few services which I am running > for CentOS/RHEL 6/7 servers. > > > > $stop_services = [ "ip6tables", "iptables", "auditd", "cups" ] > > service { $stop_services >ensure => stopped >enable => false > } > > > Is it possible to not run this code when the OS is CentOS/RHEL 7 and the > stop_services value is auditd. > > > > Regards, > > Vikas > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to puppet-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/puppet-users/8f5a3e93-6a4e-4875-a4dc-cda501d4e5ec%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/E172DCBD-6467-4C00-BBC5-3C62876BBB50%40mailtower.ch. For more options, visit https://groups.google.com/d/optout.
Re: [Puppet Users] hiera-eyaml not decrypting on puppet agent runs - but works from CL
Hi I'm wondering if the gem hiera-eyaml is installed? Are you using puppet server? puppetserver gem list puppetserver gem install hiera-eyaml Julian > On 18 Nov 2015, at 20:45, raycharlesistheman > wrote: > > > > Hi - > > > Hoping that someone can provide a direction to get this working, I've > exhausted my own attempts. > I am simply following the hiera complete example from puppetlabs and shimming > in eyaml as a backend. > > > While I am able to get my encrypted hiera datastore to decrypt from the > command line using hiera or puppet apply, things don't work when doing a real > puppet agent run. > I put everything about my setup into a paste at http://pastebin.com/8CnppUTS > > > If there is anyone here with hiera-eyaml experience, please take a look and > let me know what's not proper. > > > -Thanks in advance! > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to puppet-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/puppet-users/b39812ef-918b-41a8-a0bf-66240a6a2a9e%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/06FC9543-F0E5-4F63-ADCB-58DBFDFC39B6%40mailtower.ch. For more options, visit https://groups.google.com/d/optout.
[Puppet Users] Vagrant with Shared Folder for rspec-puppet
Hi! I'm working on several puppet modules and try to run the rspec tests in a vagrant vm (virtualbox). The module directory is mounted to the vm in /vagrant. Normally rspec-puppet seems to create a symlink in spec/fixtures/modules to the module directory. This symlink doesn't work on the virtualbox shared folder. My workaround in .fixtures.yml is: ``` fixtures: repositories: mymodule: "file://#{source_dir}" ``` Is this workaround okay or do you have a better solution? Thanks, Julian -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/a7a2bbc01284aaf82f12cb4cb2de1895%40mailtower.ch. For more options, visit https://groups.google.com/d/optout.
[Puppet Users] Duplicate declaration - class is already declared
Hi all I’ve got three classes (example): ``` class mymodule ( $user = 'foobar', ) {} class mymodule::classone ( $foo = 'bar', ) inherits ::mymodule::classone::params { require mymodule notify { "username: ${::mymodule::user}": } } class mymodule::classtwo ( $foo = 'bar', ) inherits ::mymodule::classtwo::params { require mymodule notify { "username: ${::mymodule::user}": } } class mymodule::classone::params {} class mymodule::classtwo::params {} ``` My idea is to have a class `mymodule` with parameters used by any other class. If someone would like to change the default parameters of `mymodule` he can do it like (or with hiera and autolookup): ``` class { ::mymodule: user => 'foo', } class { ::mymodule::classone: } ``` And for `classtone` and `classtwo` there is a specific `params.pp` (inherits)… My problem: the declaration above can cause dependency cycles… If `classone` gets used before class `mymodule`. :-( Do you have a better idea or design? Thanks for any input and your help! Julian -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/156F5D16-F2C8-423D-A565-4DBA089D24B7%40mailtower.ch. For more options, visit https://groups.google.com/d/optout.
Re: [Puppet Users] Duplicate declaration - class is already declared
Thanks you! The explanation about private and public classes is just great! So, there seems to be no way to define IN the module how public classes get evaluated (order), right? I really want to use some params from `::ospuppet` in `::ospuppet::master` and `::ospuppet::server` (https://github.com/juame/juame-ospuppet/tree/0.3.0 <https://github.com/juame/juame-ospuppet/tree/0.3.0>). Julian > On 14 Sep 2015, at 15:52, jcbollinger wrote: > > > > On Friday, September 11, 2015 at 4:31:40 PM UTC-5, Julian Meier wrote: > Hi all > > I’ve got three classes (example): > > ``` > class mymodule ( > $user = 'foobar', > ) {} > > class mymodule::classone ( > $foo = 'bar', > ) inherits ::mymodule::classone::params { > require mymodule > notify { "username: ${::mymodule::user}": } > } > > class mymodule::classtwo ( > $foo = 'bar', > ) inherits ::mymodule::classtwo::params { > require mymodule > notify { "username: ${::mymodule::user}": } > } > > class mymodule::classone::params {} > class mymodule::classtwo::params {} > ``` > > My idea is to have a class `mymodule` with parameters used by any other > class. If someone would like to change the default parameters of `mymodule` > he can do it like (or with hiera and autolookup): > ``` > class { ::mymodule: user => 'foo', } > class { ::mymodule::classone: } > ``` > And for `classtone` and `classtwo` there is a specific `params.pp` > (inherits)… > > My problem: the declaration above can cause dependency cycles… If `classone` > gets used before class `mymodule`. :-( > > > > What you are observing is not a dependency cycle, it is an evaluation-order > dependency. > > > Do you have a better idea or design? > > > Yes: never use a resource-like class declaration > <http://docs.puppetlabs.com/puppet/4.2/reference/lang_classes.html#include-like-vs-resource-like> > to declare any public class of any module. > > A "public class" is one that is intended to be declared from outside the > module, which appears to include at least classes ::Mymodule and > ::Mymodule::Classone in your example. Do not use a resource-like class > declaration for such a class either outside its module or inside. Instead > use include-like declarations for such classes, and rely on automated data > binding via Hiera to assign non-default class parameter values to them. > > The particular problem in this case is that if the catalog builder evaluates > a resource-like declaration of a given class, that declaration must be the > very first declaration of the given class it sees. The 'require mymodule' > appearing in ::Mymodule::Classone and ::Mymodule::Classtwo is an include-like > declaration of class ::Mymodule, and it is evaluated as part of evaluating > the declaration of either of those classes. When a resource-like declaration > of the same class is encountered later, the catalog builder objects. > > This constraint is basically about determining the applicable class parameter > values: Puppet permits the same class to be declared multiple times, with the > second and subsequent ones being no-ops. Class parameter values must be > determined at the first declaration. And that's why you must avoid > resource-like declarations of public classes -- it is very difficult to > predict where another declaration of such a class may be (since it's public), > or the relative order in which such a declaration may be evaluated. > > As a secondary design consideration, it rarely makes sense to have one public > class of a module that depends on another public class of the same module. > Many modules have only a single public class, and a few have multiple, > independent public classes, but I can't name any off the top of my head that > use the type of pattern you presented, with dependent public classes. Those > I can think of that have something like that provide defined resource types > instead of dependent public classes. Indeed, it may be that your > Mymodule::Classone and Mymodule::Classtwo really want to be different > instances of one defined type. That's not going to get you around a > class-declaration issue such as the one you presented, however. > > > John > > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to puppet-users+unsubscr...@googlegroups.com > <mailto:puppet-users+unsubscr...@googlegroups.com>. > To view this
Re: [Puppet Users] Hiera lookup function doesnt fail if attr isnt found
Hi Can't you just set a fallback or default value in the manifest? Example: `$attr = hiera('other::attr','fallback')` http://docs.puppetlabs.com/hiera/1/puppet.html#hiera-lookup-functions Julian > On 18 Sep 2015, at 23:36, Joao Morais wrote: > > > Hello list. I am using the hiera() lookup function in order to query some few > attributes from a http backend. Something like this: > > common.yaml > --- > ... > class::attr: "%{hiera('other::attr')}" > > This works very well if other::attr is defined, but an empty string is > returned in the lookup above if the other::attr isn't found. The hiera() > function on the manifest fails the compilation if I do the same query, which > is what I'd expect from the lookup above. > > Is there a way to enforce the declaration of the other::attr when using > hiera() lookup function inside the hieradata? > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to puppet-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/puppet-users/55FC83C6.7080007%40joaomorais.com.br. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/0BAFA81B-B030-4D51-977C-9191182ED893%40mailtower.ch. For more options, visit https://groups.google.com/d/optout.