[Puppet Users] Re: help needed with reduce function

2024-04-15 Thread Arnau
With a bit more of debuging I figured out that my code was wrong.
what I really need is:

  $extra_proxy_pass = $options.reduce([$base_proxy_pass])|$memo, $value| {
$memo  << { 'path' => "${value[0]}", 'url' => '!' }
}


in my previous code I was passing Strings instead of Hashes.

Now I'm calling redcue twice and got it working .

Best


On Monday, April 15, 2024 at 5:17:59 PM UTC+2 Arnau wrote:

> Dear all,
>
> I'm working on a custom puppet (7.28) module to deploy python applciations 
> like django, streamlint, etc... A part from the python part, the module 
> also deploys an apache vhost (using puppet apache module from the forge).
>
> I have some default options for apache vhost but I like to extend those 
> defaults with custom options based on some data that I get from hiera 
> (mainly, some excpetions to the proxy and adding some directories so apache 
> serves the static files). 
> As an example, one of my apps look like this in hiera:
>
> python_apps:
>   biostars:
> type: uwsgi
> apache:
>   enable: true
>   servername: forum
>   app_protocol: https
>   extra_proxy_pass:
>static: 'export/static'
>images: 'export/images'
>
> the relevant part here is the extra_proxy_pass. What I'd like to achieve 
> is create something like
>
> proxy_pass => { 'path' => 'static', 'url' => '!' }
> directories => [ 'path' => "${path}/${name}/static", 'Allow ' = >  => '
> from all', 'Options' => 'Indexes'}]
>
> proxy_pass => { 'path' => 'images', 'url' => '!' }
> directories => [ 'path' => "${path}/${name}/images", 'Allow ' = >  => '
> from all', 'Options' => 'Indexes'}]
>
> To later on pass it to my vhost definition.
>
> So, as for my understaning, I could use reduce 
> <https://www.puppet.com/docs/puppet/7/function.html#reduce>to achieve 
> that.But it's not clear to me how to use memo to append thos extar 
> proxy_pass or directories to it in a reusable format.
>
> My code, so far, looks like this:
>
>  $base_proxy_pass =
>   { 'path' => '/',
> 'url' => "${apache[app_protocol]}://127.0.0.1:${port}/"
>   }
> if $apache.has_key(extra_proxy_pass) {
>   $options = $apache[extra_proxy_pass]
>   $extra_proxy_pass = $options.reduce([{proxy_pass => $base_proxy_pass}])| 
> $memo, $value| {
>   $memo <<  "proxy_pass => { 'path' => ${value[0]}, 'url' => '!' }"
>   #   directories => {
>   #   'path'=> "${path}/${name}/${value},
>   #   'Allow'   => 'from all',
>   #   'Options' => 'Indexes',
>   #   }
>
>   }
> }
>   notify {"EXTRA_MEMORY_PATH: $extra_proxy_pass":;}
>
> This produces proxy_pass as I need it:
>
>   Notice: EXTRA_MEMORY_PATH: [{proxy_pass => {path => /, url => https://
> 127.0.0.1:8000/} <http://127.0.0.1:8000/%7D>}, proxy_pass => { 'path' => 
> static, 'url' => '!' }, proxy_pass => { 'path' => images, 'url' => '!' }]
>
> But now I am not sure if I can use memo for building the directories array 
> of hashes in the same piece of code. Reading reduce docs seems like memo 
> can be used to store differnt values:
>
> $data = {a => 1, b => 2, c => 3}
> $combine = $data.reduce |$memo, $value| {
>   $string = "${memo[0]}${value[0]}"
>   $number = $memo[1] + $value[1]
>   [$string, $number]
> }
> # $combine contains [abc, 6]
>
> but I've tried several options and none did work.
>
> Also, is ther a way to reuse memo for the directories? or should I split 
> my code in two calls to reduce, one for building the extra_proxy array and 
> another call for the directories?
>
> Maybe I using a wrong approach and there is a simplest way to achieve what 
> I'm trying to do. I'm open to suggestions.
>
>
> 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/c0ddd7ca-e06a-417c-be21-8ae343a264ffn%40googlegroups.com.


[Puppet Users] help needed with reduce function

2024-04-15 Thread Arnau
Dear all,

I'm working on a custom puppet (7.28) module to deploy python applciations
like django, streamlint, etc... A part from the python part, the module
also deploys an apache vhost (using puppet apache module from the forge).

I have some default options for apache vhost but I like to extend those
defaults with custom options based on some data that I get from hiera
(mainly, some excpetions to the proxy and adding some directories so apache
serves the static files).
As an example, one of my apps look like this in hiera:

python_apps:
  biostars:
type: uwsgi
apache:
  enable: true
  servername: forum
  app_protocol: https
  extra_proxy_pass:
   static: 'export/static'
   images: 'export/images'

the relevant part here is the extra_proxy_pass. What I'd like to achieve is
create something like

proxy_pass => { 'path' => 'static', 'url' => '!' }
directories => [ 'path' => "${path}/${name}/static", 'Allow ' = >  => 'from
all', 'Options' => 'Indexes'}]

proxy_pass => { 'path' => 'images', 'url' => '!' }
directories => [ 'path' => "${path}/${name}/images", 'Allow ' = >  => 'from
all', 'Options' => 'Indexes'}]

To later on pass it to my vhost definition.

So, as for my understaning, I could use reduce
to achieve
that.But it's not clear to me how to use memo to append thos extar
proxy_pass or directories to it in a reusable format.

My code, so far, looks like this:

 $base_proxy_pass =
  { 'path' => '/',
'url' => "${apache[app_protocol]}://127.0.0.1:${port}/"
  }
if $apache.has_key(extra_proxy_pass) {
  $options = $apache[extra_proxy_pass]
  $extra_proxy_pass = $options.reduce([{proxy_pass => $base_proxy_pass}])|
$memo, $value| {
  $memo <<  "proxy_pass => { 'path' => ${value[0]}, 'url' => '!' }"
  #   directories => {
  #   'path'=> "${path}/${name}/${value},
  #   'Allow'   => 'from all',
  #   'Options' => 'Indexes',
  #   }

  }
}
  notify {"EXTRA_MEMORY_PATH: $extra_proxy_pass":;}

This produces proxy_pass as I need it:

  Notice: EXTRA_MEMORY_PATH: [{proxy_pass => {path => /, url => https://
127.0.0.1:8000/}}, proxy_pass => { 'path' => static, 'url' => '!' },
proxy_pass => { 'path' => images, 'url' => '!' }]

But now I am not sure if I can use memo for building the directories array
of hashes in the same piece of code. Reading reduce docs seems like memo
can be used to store differnt values:

$data = {a => 1, b => 2, c => 3}
$combine = $data.reduce |$memo, $value| {
  $string = "${memo[0]}${value[0]}"
  $number = $memo[1] + $value[1]
  [$string, $number]
}
# $combine contains [abc, 6]

but I've tried several options and none did work.

Also, is ther a way to reuse memo for the directories? or should I split my
code in two calls to reduce, one for building the extra_proxy array and
another call for the directories?

Maybe I using a wrong approach and there is a simplest way to achieve what
I'm trying to do. I'm open to suggestions.


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/CAM69jx_ZMFGcdQHkBN2UD_TzHviBOoNeD3SFc7Wkzg7b7pDHWQ%40mail.gmail.com.


[Puppet Users] Re: Unkown function mysql::password

2020-06-05 Thread Arnau
HI,

I've foudn that the problem is where the functions are saved:
/opt/puppetlabs/puppet/cache/lib/puppet/parser/functions/
vs /opt/puppetlabs/puppet/cache/lib/puppet/functions/

If I put the functions in the first path , it works. Otherwise I see the
error mentioned in the first post.

I see functions in both paths, so I wonder why the functions from the
second are not collected.

# puppet agent --configprint libdir
> /opt/puppetlabs/puppet/cache/lib
> # rpm -qa|grep puppet
> puppet-agent-5.5.17-1.el7.x86_64


Any idea?

TIA,
Arnau


El jue., 4 jun. 2020 a las 16:09, Arnau () escribió:

> Dear all,
>
> I recently upgraded the Mysql module from version 5 to 10 :
> https://forge.puppet.com/puppetlabs/mysql
>
> I'm testing if my "old" code is still compatible with this new version but
> I'm facing and issue.
> My code looks like:
>
>
>>   mysql_user { 'nagios@localhost':
>>   ensure=> 'present',
>>   password_hash => mysql_password($nagios_passwd),
>> }
>
>
> and the first ran said:
>
> Unknown function: 'mysql_password'
>
>
> Looking into the code
> (/opt/puppetlabs/puppet/cache/lib/puppet/functions/mysql_password.rb) it
> says :
>
> *"This method has been deprecated, please use the namespaced version
> 'mysql::password' instead."*
>
> So I update my code accordingly but now it says:
>
> Unknown function: 'mysql::password'
>
>
> I see the function in here:
> /opt/puppetlabs/puppet/cache/lib/puppet/functions/mysql/password.rb and
> also tried  mysql::mysql_password (
> https://github.com/puppetlabs/puppetlabs-mysql/blob/master/REFERENCE.md#mysqlmysql_password)
> I don't manage to make it work.
>
> What am I not seeing?
>
> TIA,
> Arnau
>

-- 
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/CAM69jx-T_J0gR2JWN5TfbrbdL-e6yQP7Unc8Y%2BH_ewHdvRh%3DDQ%40mail.gmail.com.


[Puppet Users] Unkown function mysql::password

2020-06-04 Thread Arnau
Dear all,

I recently upgraded the Mysql module from version 5 to 10 :
https://forge.puppet.com/puppetlabs/mysql

I'm testing if my "old" code is still compatible with this new version but
I'm facing and issue.
My code looks like:


>   mysql_user { 'nagios@localhost':
>   ensure=> 'present',
>   password_hash => mysql_password($nagios_passwd),
> }


and the first ran said:

Unknown function: 'mysql_password'


Looking into the code
(/opt/puppetlabs/puppet/cache/lib/puppet/functions/mysql_password.rb) it
says :

*"This method has been deprecated, please use the namespaced version
'mysql::password' instead."*

So I update my code accordingly but now it says:

Unknown function: 'mysql::password'


I see the function in here:
/opt/puppetlabs/puppet/cache/lib/puppet/functions/mysql/password.rb and
also tried  mysql::mysql_password (
https://github.com/puppetlabs/puppetlabs-mysql/blob/master/REFERENCE.md#mysqlmysql_password)
I don't manage to make it work.

What am I not seeing?

TIA,
Arnau

-- 
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/CAM69jx_s%3DK8sPK4QmvELS%2B07VViUyxb%2B7p9KVwekZ2E%3D94w7UA%40mail.gmail.com.


Re: [Puppet Users] create an array of hashes with reduce

2018-11-09 Thread Arnau
Hi Henrik,

I did not answer before cause I was playing a little more with the code
thanks a lot for your asnwers and your explanation.

El mié., 7 nov. 2018 a las 11:37, Henrik Lindberg (<
henrik.lindb...@puppet.com>) escribió:

> > what am I doing wrong now?
> >
> Not sure - but I simplified your code, and this works:
>
>
My code is working as well. But, for soe reason, I have to move the notify
below in my code 


> >
> > BTW, I find the hash notation/manipulation a little confusing...
> > According to https://puppet.com/docs/puppet/5.4/lang_data_hash.html it
> > must be as simple as:
> >
> > $key[$value]
> >
> > And quotes should be used in "keys" when they are strings, but in the
> > above example:
> >
> > $var = Array($apache['static_served'])
> >
> >   you are quoting the $value when it's a array and not a string...
> >
> > what is the generic rule for quoting in hashes?
> >
> >
> There is something you must have misunderstood. You need to quote values
>
> Thanks for this explanatin!! very clarifying!

Best,
Arnau

-- 
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/CAM69jx8zR0r8StVQJT3_Hef2kbaf5pmWa%2BHr0h7AnS%2Bt-000iA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] create an array of hashes with reduce

2018-11-07 Thread Arnau
Hi Henrik,

first of all, thanks for your answer.

El mar., 6 nov. 2018 a las 20:12, Henrik Lindberg (<
henrik.lindb...@puppet.com>) escribió:
[...]

> > $dirs = ['static','media','photos']
> > $proxy = $dirs.reduce([ { 'path' => '/', 'url' =>
> > "http://localhost:${port}/; } ]) |$memo, $value| { $memo + [ { 'path'
> =>
> > "/$value/", 'url' => '!' } ] }
> > notify { "MemoOut: $proxy" : ;}
> >
> > If I puppet apply the above code the output looks like:
>
> Avoid having  notify with a title containing [ ] - it can get very
> confusing. Use a title like "testing", and set the message instead.
>

Ok, thanks. Then:
 notify {"test $name" :
message => "static_served: ${apache[static_served]}",
 }
produces:
 defined 'message' as 'static_served: [static]'

*I need to enclose the hash in curly braces otherwise it shows the whole
hash like:*
defined 'message' as 'Message {enable => true, servername => application,
static_served => [static]}[static_served]'


You give the reduce an array with a hash in it, and you then append to
> that array with an array containing a hash. The result will be an
> array where each element is a hash.
>

Yes, exaclty. That's what I need (if I have not missunderstood it) to pass
tot he proxy_pass parameter in the apache forge module:

 proxy_pass => [
{ 'path' => '/a', 'url' => 'http://backend-a/' },
{ 'path' => '/b', 'url' => 'http://backend-b/' },
]

[...]

> > I make this an array using any2array (array un puppet 5) so I can still
> > call the reduce function::
> >
> > $var=(Array("${apache['static_served']}"))
> >
> > so the /reduce /line now looks like:
> >
> You are asking Array to create an array out of a string. It will
> construct that as an array where each element is a single character string.
>

Ah, ok, cause I'm passing the first element of the array and not the array
to the Array function? and this is becasue of the quoting, right?

You probably wanted
>
> $var = Array($apache['static_served'])
>


> > $_proxy_pass = $var.reduce([ { 'path' => '/', 'url' =>
> > "http://localhost:${port}/; } ]) |$memo, $value| { $memo + [ { 'path'
> =>
> > "/$value/", 'url' => '!' } ] }
> >
> > And here is where everythiong starts to make even less sense:
> >
>
> You are now performing a reduce based on a sequence of single character
> strings. This is indeed confusing as you have already gone off the road.
>

So, at the end it was as simple as calling the reduce function like:
$apache['static_served'].reduce

(I as using a more larger hiera data and, in the very first application,
the static_serverd array was empty, so reduce was failling all the time
cause the array was empty... Damn!!

now the code looks like:

if $apache['static_served'] {
$_proxy_pass =  $apache['static_served'].reduce([ { 'path' => '/', 'url'
=> "http://localhost:${port}/; } ]) |$memo, $value| { $memo + [ { 'path' =>
"/$value/", 'url' => '!' } ] }
  }else{
   $_proxy_pass =  [ { 'path' => '/', 'url' => "http://localhost:${port}/;
} ]
  }
  notify { "PROXY: $name" :
message => $_proxy_pass,
  }

But the reduce is now not working:

Notice: {"path"=>"/", "url"=>"http://localhost:56902/"}
Notify[PROXY: application]/message: defined 'message' as {
  'path' => '/',
  'url' => 'http://localhost:56902/'
}


what am I doing wrong now?



BTW, I find the hash notation/manipulation a little confusing... According
to https://puppet.com/docs/puppet/5.4/lang_data_hash.html it must be as
simple as:

$key[$value]

And quotes should be used in "keys" when they are strings, but in the above
example:

$var = Array($apache['static_served'])

 you are quoting the $value when it's a array and not a string...

what is the generic rule for quoting in hashes?


Hope this helps you get back on track.
>
> - henrik
>

Thanks again!
Arnau

-- 
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/CAM69jx9evODEdpT%2B-aCoHtf6iZc1j1pxguA7%2B6onaBAb31daBA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] create an array of hashes with reduce

2018-11-06 Thread Arnau
Hi all,

I'm using puppet 5.3.

I'd like to build proxy_pass array of hashes using the *reduce *puppet
built-in function  <https://puppet.com/docs/puppet/5.5/function.html#reduce>and
picking the values from a nested hash in hiera.

I first played a little bit with the reduce function:

$dirs = ['static','media','photos']
$proxy = $dirs.reduce([ { 'path' => '/', 'url' => "http://localhost:
${port}/" } ]) |$memo, $value| { $memo + [ { 'path' => "/$value/", 'url' =>
'!' } ] }
notify { "MemoOut: $proxy" : ;}

If I puppet apply the above code the output looks like:

Notice: MemoOut: [{path => /, url => http://localhost:189/}, {path =>
/static/, url => !}, {path => /media/, url => !}, {path => /photos/, url =>
!}]
Notice: /Stage[main]/Main/Node[default]/Notify[MemoOut: [{path => /, url =>
http://localhost:189/}, {path => /static/, url => !}, {path => /media/, url
=> !}, {path => /photos/, url => !}]]/message: defined 'message' as 'MemoOut:
[{path => /, url => http://localhost:189/}, {path => /static/, url => !},
{path => /media/, url => !}, {path => /photos/, url => !}]'

*To my eyes this is an array of hashes, and that's what I need to pass to
the apache vhost define.*

So, now I want to pick the array (list of directories) from a nested hash
in hiera that look like:

  application:
apache:
  enable: true
  servername: application
  static_served:
- static

I have a define that picks the above hash The array with the list of
directories becomes "${apache['static_served']}" inside teh define.
I can print it using notice ${apache['static_served']}":

Notice: static_served: application [static]

This looks like an array but *is_array *says that this is *not *an array
anymore.
And this is my first question, why it is not an array anymore?


I make this an array using any2array (array un puppet 5) so I can still
call the reduce function::

$var=(Array("${apache['static_served']}"))

so the *reduce *line now looks like:

$_proxy_pass =  $var.reduce([ { 'path' => '/', 'url' => "http://localhost:
${port}/" } ]) |$memo, $value| { $memo + [ { 'path' => "/$value/", 'url' =>
'!' } ] }

And here is where everythiong starts to make even less sense:

If I print the output (using notice $_proxy_pass and )  and I get a weird
output:

Notice: /Stage[main]/.../Python::Virtualenv[application]/Notify[PROXY_PASS:
[{path => /, url => http://local
host:11080/}, {path => /[/, url => !}, {path => /s/, url => !}, {path => /t/,
url => !}, {path => /a/, url => !}, {path => /t/, url => !}, {path => /i/,
url => !},
 {path => /c/, url => !}, {path => /]/, url => !}]]/message: defined
'message' as 'PROXY_PASS: [{path => /, url => http://localhost:11080/},
{path => /[/, url => !
}, {path => /s/, url => !}, {path => /t/, url => !}, {path => /a/, url =>
!}, {path => /t/, url => !}, {path => /i/, url => !}, {path => /c/, url =>
!}, {path => /
]/, url => !}]'

reduce is taking all letters from "static" instead of 'static" as the first
(an uniqe) element from the array

Later, in my code, I configure the proxy_pass in the apache:vhost like:

apache::vhost { "${apache['servername']}":
[...]
proxy_pass => "$_proxy_pass",
[...]

But, in the apache file, the proxy pass parameters  looks like

 ProxyPass path url
 ProxyPassReverse path url
 ProxyPass path url
 ProxyPassReverse path url
[...]

So it's picking the keys from the hashes in the above array of hashes and
not the values.

I don't understand what is going on. Any help will be appreciated.

Best,
Arnau

-- 
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/CAM69jx-wKXmP%3DhfPLsMsrYDeOS7TCTQaQ9XyhUaoWJ9uq%3DeZEg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Managing mounted NFS shares, when having no write permission on that share

2018-08-17 Thread Arnau
Hi,

Are you sure you are mounting nfs v3 and not 4?
Puppet does nothing with the content of the mount so it has to be some
(missing/wrong) mount option.

HTH,
Arnau


El dv., 17 ag. 2018 , 23:03, Mike Langhorst  va
escriure:

> I'm having some issues with managing a mount point for an NFS server.
> Specifically when the client system has no root write privileges to that
> NFS share.
>
> I need to mount a NetApp NFS/Cifs share to a filesystem location
> /data/app.   So I'll need to manage the file resource /data/app, and as
> typical the owner and mode.
>
> file { '/data/app':
>   ensure => directory,
>   owner => root,
>   group  => root,
>   mode   => '0755',
> }
>
> mount { '/data/app':
>   ensure  => mounted,
>   device   => nfs_server:/app
>   dump=> 0,
>   fstype=> 'nfs',
>   target=> '/etc/fstab',
>   require  => File['/data/app'],
> }
>
>
> So when I mount this nfs to /data/app,  that share and it's contents are
> nfsnobody, or some other high numbered uid,  with varying permissions,
> sometimes 777.  The NetApp may show 777, but it's applying other ACLs due
> to the CIFS share.  For the different shares I've had to mount, that uid
> and permissions have been different so I couldn't do something like
> updating the module/hiera data to match after the fact as I still wouldn't
> want that underling directory /data/app to be 777.
>
> I don't see anything in the file resource spec to allow for an "onlyif" or
> such.
>
> Any ideas on how to manage this?
>
> --
> 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/c06294e4-21c7-43a8-9c06-1ac8b8c90731%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/c06294e4-21c7-43a8-9c06-1ac8b8c90731%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAM69jx-oYKk2bnpbmLpN5V%2B1vsXfOiwfBSAiYS1fS0FZ-Hvu6A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Re: Duplicate declaration error

2018-06-11 Thread Arnau
Hi,

"include" shouldn't be a problem:

https://puppet.com/docs/puppet/5.3/lang_classes.html#include-like-behavior


the problematic declariation must be one of the resource like declaration.
You can only declare a class in such format once.

define custom::apache::vhost () {
  include custom::apache
}
class custom::apache {
  class { '::apache': <- WRONG
#parameters
  }
}

Your define calls custom::apache and in custom::apache you declar ::apache
in the resource-like format as much times as vhost you create.

Could you please show the full code? and the exact error?


Arnau



2018-06-10 23:50 GMT+02:00 Clemens Bergmann :

> Hi,
>
> I found out that it does only break if I add one special vhost.
> The problematic vhost is defined as follows:
>
> class vhost::vhost3 {
>   custom::apache::vhost{
>   #parameter
>}
>
>   include ::apache::mod::proxy
>   include ::apache::mod::proxy_http
> }
>
> If I remove the Includes everything works (but I need mod_proxy for this
> vhost).
>
>
> On Saturday, June 9, 2018 at 8:45:46 AM UTC+2, Clemens Bergmann wrote:
>>
>> What confuses me is that I before switching to puppetlabs-apache I had a
>> layout with a custom apache module as follows:
>>
>> class vhost::vhost1 {
>>   custom_apache::site{
>> #parameters
>>   }
>> }
>>
>> define custom_apache::site (#parameters) {
>>   include custom_apache::ssl
>> }
>>
>> class custom_apache::ssl (#parameters){
>>   class { 'custom_apache':
>>#parameters
>>  }
>> }
>>
>> class custom_apache (#parameters) {
>>   include custom_apache::params
>>   class {'custom_apache::install':
>> #parameters
>>   }
>>   class {'custom_apache::config':
>> #parameters
>>   }
>>   class {'custom_apache::service':
>> #parameters
>>   }
>> }
>>
>> and that worked.
>>
>> I also suspect the the line https://github.com/puppet
>> labs/puppetlabs-apache/blob/master/manifests/mod/ssl.pp#L24 to be the
>> problem. But that would also be a problem with only one vhost and that
>> works fine on another node.
>>
> --
> 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/0665b012-601b-4fac-83ff-fa7acfae9fa7%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/0665b012-601b-4fac-83ff-fa7acfae9fa7%40googlegroups.com?utm_medium=email_source=footer>
> .
>
> 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/CAM69jx8D7TOBc8ZX4Z%2B7tWc_fv1GVfDVjU2xaniwCeEXxf1BUw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Style (syntax?) question

2018-06-06 Thread Arnau
2018-06-06 14:30 GMT+02:00 jcbollinger :

>
>
> On Tuesday, June 5, 2018 at 9:00:47 AM UTC-5, Arnau wrote:
>
>
>> ( fun fact: https://groups.google.com/forum/#!topic/puppet-users/T1cIUuK
>> BU0E isn't this you using "Class"? or am I missing something?
>>
>
> Sure is.  But those are (valid) resource / class references (
> Class['someclass']),  not the invalid mutant form appearing in the OP's
> example (Class { 'somclass': }).  Note differences in bracketing and
> presence vs absence of a colon.
>

You're totally right... I think my brain did reformat the OP message :-)
Now I see that even the second line is totally wrong:

 -> class('someclass::configure':}# right... <- Opening with a
parenthesis closing with a bracket...
     -> Class{'someclass':}


>
> John
>
>
Sorry for the noise,
Arnau

-- 
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/CAM69jx-_JKPU1sQZjeaunm0%3DbU0gQgnh7J9QVw8YARCRNZE7oQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Style (syntax?) question

2018-06-05 Thread Arnau
2018-06-05 15:01 GMT+02:00 jcbollinger :

>
>
> On Monday, June 4, 2018 at 1:06:52 PM UTC-5, Ramin K wrote:
>>
>> On 6/4/18 8:25 AM, Peter Berghold wrote:
>> > I was looking at someone else's code one day last week and saw a
>> pattern
>> > I've not seen before. Maybe that's what I get for developing Puppet
>> code
>> > in a vacuum. :-)
>> >
>> > class someclass (
>> >  $parm1 = $::someclass::params::parm1,
>> >  $parm2 = $::someclass::params::parm2   # so far I get it.
>> > ) inherits someclass::params { # ok, I get it
>> >
>> >   class{'someclass::package': }# OK
>> >   -> class('someclass::configure':}# right...
>> >   -> Class{'someclass':}#  HUH?  What does that
>> do?
>> > }
>> >
>> > Is that last step necessary and why?
>>
>>
>> The last step was fairly common in Puppet 2.7 code before Anchors.
>
>
>
> Are you sure about that, Ramin?  I've been around Puppet since well before
> v2.7, and to the best of my knowledge, Class{'someclass':} (with capital
> 'C') is and always has been syntactically invalid.  I'm prepared to learn
> something new today, but you'll need to point me to some docs to support
> your assertion.
>

I've been using that syntax in 3.8 for a long time:

  contain ::soge::install
  contain ::soge::configure
  contain ::soge::service

  Class ['::soge::install'] ->
  Class ['::soge::configure'] ~>
  Class ['::soge::service']

Maybe this ->
https://blog.mayflower.de/4573-The-Puppet-Anchor-Pattern-in-Practice.html

I remeber start using it when the contain function was released...

( fun fact: https://groups.google.com/forum/#!topic/puppet-users/T1cIUuKBU0E
isn't this you using "Class"? or am I missing something?

Best,
Arnau


>

-- 
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/CAM69jx8ne4QP9mHaGO59Bz7iTWhBATnjrLtER7Cj5xXPc8hvmQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] file resource issue?

2018-06-01 Thread Arnau
Hi,

Looks like you're not the only one having such issue:
https://tickets.puppetlabs.com/browse/PUP-6624


A workaround is to force md5 checksumming:

With apache, set ContentDigest On
<https://httpd.apache.org/docs/2.4/de/mod/core.html#contentdigest> and use:

puppet apply -e 'file { "/tmp/foo": source => "http://localhost/bar;,
checksum => md5 }'



unfortunately I don't think you can modify the webserver confgiuration in
githubusercontent.com.

Maybe adding an extra step where you do wget first, then file -> source =>
file:///my_path then the other exec?

something like: (I've not tested the code, only giving the idea):



exec {'get_file':
  command => 'wget
https://raw.githubusercontent.com/Azure/WALinuxAgent/master/config/66-azure-storage.rules
'
  cwd => 'tmp',
}

 file { 'azure_udev_rule':
path   => '/etc/udev/rules.d/66-azure-storage.rules',
ensure => 'file',
require => Exec['get_file],
source => '/tmp/ 66-azure-storage.rules ',
notify => Exec['azure_udev_reload'],
}

exec { 'azure_udev_reload':
command => 'udevadm control --reload-rules && udevadm
trigger --subsystem-match=block',
path=> ['/usr/sbin', '/usr/bin'],
refreshonly => true,
}


for content hosted in a git repository I use the vcsrepo puppet module
https://forge.puppet.com/puppetlabs/vcsrepo.

HTH,
Arnau


2018-06-01 2:22 GMT+02:00 Jason McMahan :

> Good day,
> I am using the file resource to check if a file has changed or altered on
> github.
> the code i am using is
>
> file { 'azure_udev_rule':
> path   => '/etc/udev/rules.d/66-azure-storage.rules',
> ensure => 'file',
> source => 'https://raw.githubusercontent.com/Azure/
> WALinuxAgent/master/config/66-azure-storage.rules',
> notify => Exec['azure_udev_reload'],
> }
>
> exec { 'azure_udev_reload':
> command => 'udevadm control --reload-rules && udevadm
> trigger --subsystem-match=block',
> path=> ['/usr/sbin', '/usr/bin'],
> refreshonly => true,
> }
>
> The problem i have is every puppet run it sees the content as changed.
> Notice: /Stage[main]/Profile::Azure/File[azure_udev_rule]/content:
>
> Info: Computing checksum on file /etc/udev/rules.d/66-azure-storage.rules
> Info: /Stage[main]/Profile::Azure/File[azure_udev_rule]: Filebucketed
> /etc/udev/rules.d/66-azure-storage.rules to puppet with sum
> b775eb19522b919062b1e4aaff4c018e
> Debug: HTTP GET request to https://raw.githubusercontent.
> com/Azure/WALinuxAgent/master/config/66-azure-storage.rules returned 200
> OK
> Notice: /Stage[main]/Profile::Azure/File[azure_udev_rule]/content:
> content changed '{mtime}2018-05-31 16:28:31 -0500' to '{mtime}2018-05-31
> 16:31:11 -0500'
> Info: /Stage[main]/Profile::Azure/File[azure_udev_rule]: Scheduling
> refresh of Exec[azure_udev_reload]
> Debug: /Stage[main]/Profile::Azure/File[azure_udev_rule]: The container
> Class[Profile::Azure] will propagate my refresh event
> Debug: Exec[azure_udev_reload](provider=posix): Executing 'udevadm
> control --reload-rules && udevadm trigger --subsystem-match=block'
> Debug: Executing: 'udevadm control --reload-rules && udevadm trigger
> --subsystem-match=block'
> Notice: /Stage[main]/Profile::Azure/Exec[azure_udev_reload]: Triggered
> 'refresh' from 1 events
>
>
> Is this a bug, am i doing something wrong?
>
> Any help or suggestions would be greatly appreciated.
>
> I tried using checksum => mtime and ctime but that did not help either.
> The masters are 5.3.3 version.
>
> Thank you
>
> --
> 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/27d76968-bce6-4c17-aa7d-092ea9b0a768%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/27d76968-bce6-4c17-aa7d-092ea9b0a768%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAM69jx-bPJntyuo0DOodZjqVc5VHqc%3D%2BMtEndr6Ngyu7mGpU3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] hiera lookup

2018-05-29 Thread Arnau
2018-05-29 12:24 GMT+02:00 Ugo Bellavance :

>
>
> On Tuesday, May 29, 2018 at 5:54:54 AM UTC-4, Arnau wrote:
>>
>> Hi,
>>
>> postgresql::server::contrib::package_name: 'rh-postgresql96-postgresql-
>> contrib'
>> postgresql::server::contrib::packages_ensure: present
>>
>>
> I don't get the error anymore.  It's not doing what it's supposed but I'll
> look into it. I'll try the same thing with the manifest just to see.
>

What is it doing ?
What vesion of pupet/hiera? what version of the postgres module are you
using?



> But why do we have to use create_resources for the postgresql::server::db
> section but all the others are OK? Is it just because
> postgresql::server::db is an array?
>


*create_resources*

Converts a hash into a set of resources and adds them to the catalog.

This function takes two mandatory arguments: a resource type, and a hash
describing a set of resources. The hash should be in the form {title =>
{parameters} }:


*postgresql::server::db *is a *define*
*postgresql::server::contrib* is a *class*

In the first case you use create_resources cause you want to create
resources from the type postgresql::server::db (one or many). So the
create_resources function expects a hash with a list of databases + its
parameters.

The second case you want to pass values to a class parameters. The class
does not expect any has:

class postgresql::server::contrib (
String $package_name = $postgresql::params::contrib_package_name,
String[1] $package_ensure = 'present'
) inherits postgresql::params {


HTH,
arnau




>
> Thanks,
>
> --
> 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/d796f5ff-311a-46a0-b703-f12d7f1555b7%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/d796f5ff-311a-46a0-b703-f12d7f1555b7%40googlegroups.com?utm_medium=email_source=footer>
> .
>
> 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/CAM69jx99Yr86-7OMpOUEdaKEqT2snh-XEne-EHzudTpmHH4Xuw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] hiera lookup

2018-05-29 Thread Arnau
Hi,

postgresql::server::contrib::package_name: 'rh-postgresql96-postgresql-
contrib'
postgresql::server::contrib::packages_ensure: present

HTH,
Arnau

2018-05-29 11:50 GMT+02:00 Ugo Bellavance :

> Hi,
>
> Here's the content of my whole file, thanks:
>
> ---
>
> postgresql::globals::client_package_name: 'rh-postgresql96-postgresql'
> postgresql::globals::createdb_path: '/opt/rh/rh-postgresql96/root/
> usr/bin/createdb'
> postgresql::globals::datadir: '/var/opt/rh/rh-postgresql96/lib/pgsql/data'
> postgresql::globals::manage_package_repo: true
> postgresql::globals::needs_initdb: false
> postgresql::globals::psql_path: '/opt/rh/rh-postgresql96/root/
> usr/bin/psql'
> postgresql::globals::server_package_name: 'rh-postgresql96-postgresql-
> server'
>
>
> postgresql::server::service_name: 'rh-postgresql96-postgresql.service'
> postgresql::server::service_reload: 'systemctl reload
> rh-postgresql96-postgresql.service'
> postgresql::server::ip_mask_deny_postgres_user: '0.0.0.0/32'
> postgresql::server::ip_mask_allow_all_users: '0.0.0.0/0'
> postgresql::server::listen_addresses: '*'
> postgresql::server::service_restart_on_change: false
>
> postgresql::server::contrib:
>   package_name:
> 'rh-postgresql96-postgresql-contrib'
>   packages_ensure:
> true
>
> postgresql::server::db:
>   'mydb1':
> user:  'db1'
> password:  'db1'
>   'mydb2':
> user:  'db2'
> password:  'db2'
>   'mydb3':
> user:  'db3'
> password:  'db3'
>
> On Tuesday, May 29, 2018 at 3:09:08 AM UTC-4, Arnau wrote:
>>
>> Hi,
>>
>> are you sure the errors is about the contrib?
>> can you show us the hiera content for ' postgresql::server::db' ? Could
>> it be that you have an string when a Hash is expected (for the
>> create_resource).
>>
>> Best,
>> Arnau
>>
>> 2018-05-28 22:19 GMT+02:00 Ugo Bellavance :
>>
>>> Hi,
>>>
>>> I am using the postgresql module and I wanted to put all my data in
>>> hiera. Some parameters were simply looked up automatically, like
>>> postgresql::globals:: and postgresql::server::.
>>>
>>> For postgresql::server::db, I had to put this in my manifest:
>>>
>>>   $dbs=hiera('postgresql::server::db')
>>>   create_resources('postgresql::server::db', $dbs)
>>>
>>> And it works.  However, I'm looking for a way to make
>>> postgresql::server::contrib work as well, but I can't make it to work.
>>> When I use the same recipe I get this error:
>>>
>>> no implicit conversion of String into Hash
>>>
>>> How can I make postgresql::server::contrib work as well and why aren't
>>> ::db and ::contrib working out-of the box like globals and server?
>>>
>>> Format for ::db is:
>>>
>>> postgresql::server::db { 'db1':
>>>   user => 'user1',
>>>   password => password,
>>> }
>>>
>>> Format for ::contrib is
>>>
>>> class {'postgresql::server::contrib':
>>>   package_name=> 'rh-postgresql96-postgresql-contrib',
>>>   package_ensure  => true,
>>> }
>>>
>>>
>>> Thanks,
>>>
>>> --
>>> 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...@googlegroups.com.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/puppet-users/61c18a0f-76fe-4be8-83fc-aa8703f28cb5%40googlegroups.com
>>> <https://groups.google.com/d/msgid/puppet-users/61c18a0f-76fe-4be8-83fc-aa8703f28cb5%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> 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/93053ac8-a9ba-46e8-a6b7-e46fa150fad8%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/93053ac8-a9ba-46e8-a6b7-e46fa150fad8%40googlegroups.com?utm_medium=email_source=footer>
> .
>
> 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/CAM69jx9zGKPvEsC2eivkaqtdLTbyXd2B3-y%3D-k-zW%2BY8eA%2B0uw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] hiera lookup

2018-05-29 Thread Arnau
Hi,

are you sure the errors is about the contrib?
can you show us the hiera content for ' postgresql::server::db' ? Could it
be that you have an string when a Hash is expected (for the
create_resource).

Best,
Arnau

2018-05-28 22:19 GMT+02:00 Ugo Bellavance :

> Hi,
>
> I am using the postgresql module and I wanted to put all my data in hiera.
> Some parameters were simply looked up automatically, like
> postgresql::globals:: and postgresql::server::.
>
> For postgresql::server::db, I had to put this in my manifest:
>
>   $dbs=hiera('postgresql::server::db')
>   create_resources('postgresql::server::db', $dbs)
>
> And it works.  However, I'm looking for a way to make postgresql::server::
> contrib work as well, but I can't make it to work.  When I use the same
> recipe I get this error:
>
> no implicit conversion of String into Hash
>
> How can I make postgresql::server::contrib work as well and why aren't
> ::db and ::contrib working out-of the box like globals and server?
>
> Format for ::db is:
>
> postgresql::server::db { 'db1':
>   user => 'user1',
>   password => password,
> }
>
> Format for ::contrib is
>
> class {'postgresql::server::contrib':
>   package_name=> 'rh-postgresql96-postgresql-contrib',
>   package_ensure  => true,
> }
>
>
> Thanks,
>
> --
> 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/61c18a0f-76fe-4be8-83fc-aa8703f28cb5%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/61c18a0f-76fe-4be8-83fc-aa8703f28cb5%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAM69jx9j%2B6R_kPJ4T0daXu7R9-Zw-z109ag3%3DV2F4q%2B1R-WVFw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Re: Hiera and roles/profiles

2018-05-24 Thread Arnau
Hi John,

thanks for your answer and your examples.

2018-05-21 16:09 GMT+02:00 jcbollinger <john.bollin...@stjude.org>:

> I think you're trying to get Hiera to shoulder a bit too much of the
> load.
>

Yes, maybe, but I wanted to take all advantages from the new hiera and
still use the old profiles/roles classes approach when needed.



> Nevertheless, you could make a similar data structure work for you with
> just a little help on the Puppet side.  For example, consider this class:
>

> class site::role_classes(Array[String] $profiles) {
>   $profiles.each |$profile| {
> $profile_classes = lookup("profile_${profile}_classes", Array[String[1
> ]], 'unique', [])
> $profile_classes.each |$profile_class| {
>   include $profile_class
> }
>   }
> }
>
> Having that, instead of hiera_include('classes'), which seems to be what
> you were aiming toward, you can instead declare
>
> include site::role_classes
>
> Again, you cannot expect to put your per-profile class lists into
> different files at the same hierarchy level, at least with the standard
> YAML back-end.  You need to distinguish by keys instead.  But the above is
> all the manifest code you need around data that look like this:
>
> *roleA.yaml*
>
> site::role_classes::profiles:
>  - profileA
>  - profileB
>
> *profile_classes.yaml*
>
> profile_profileA_classes:
>  - apache
>
> profile_profileB_classes:
>  - mysql
>
> Note that only two hierarchy levels are represented there: one with a
> separate file per role, defining the profiles for that role, and one with a
> single file declaring all the classes for each profile.  The latter
> structure follows from the fact that, as you observed at the outset, most
> nodes have multiple profiles.
>

That's a nice approach, but, aprt from the classes, in my mind i also
wanted to have some hiera data in each profile file... but it could be
that, by mistake, i duplicate the data in two different profiles, then what
is hiera supposed to do?


> Alternatively, if having the profile data split out into separate files is
> important to you, but you insist on achieving that some other way than via
> DSL code, then perhaps you would be better off writing a *bona fide* ENC
> for yourself.  It probably would not have to be that much more complicated
> than the class above, and you then would not need any DSL code at all
> outside the module-level classes.
>


Too much for my approach. as i said, having hiera data in the same
hierarchy level and expect hiera to take the right decission is not
possible,

I can use the typical profile/role with hiera approach and keep putting
stuff in role and cert levels.

>
> I would be remiss, however, to fail to note that actual profile classes
> can do more for you than your 100% data-driven approach can do.  Profile
> classes can set up relationships among the classes they declare, for
> example.  They can provide containment.  They can 'include' other profile
> classes to function as extensions.  They can perform arbitrary conditional
> logic to choose classes and / or class parameters.  Even though you might
> not usually want any of those things in your profiles, are you sure you
> don't want to reserve the ability to use those and similar capabilities?
>

Yes, I know, and i still use it, but I thought that my approach could
simplify my life for some basic cases where it's clear what the class ha to
do and has no depdency with other stuff. Clear example: autofs. If the node
has the profile "autofs" I wanted it to include the class and read data
from the profile/autofs.yaml file.
But I can put that data in other hierarchy files and move the class include
to the role level.


>
>
> John
>
> Thanks a lot for your answer,
Arnau

-- 
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/CAM69jx9JfMaCsh7NOVyOq7xfGyMf43qKaaQQVKnd8a4bdSVKqg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Re: Hiera and roles/profiles

2018-05-18 Thread Arnau
Hi John,

first of all, thanks for your answer.


2018-05-18 14:15 GMT+02:00 jcbollinger <john.bollin...@stjude.org>:

>
>
>
>>
>> "%{environment}/hieradb/profile/profileA.yaml"
>> "%{environment}/hieradb/profile/profileB.yaml"
>> "%{environment}/hieradb/profile/profileC.yaml"
>>
>> Based on my tests (yup, I tried this) if hiera finds the value in, let's
>> say, profileB.yaml it stops scanning this level and profileC.yaml is not
>> evaluated.
>>
>
>
> I find that doubtful.  Given the hierarchy definition you specified
> earlier, I expect Hiera to read at most one of those files whether it finds
> the value there or not.
>

Ah, ok, so it only reads one file. Then the conclusions from my tests were
wrong (and probbaly because of werid coincidence).



>
>
>> In any case, even if hiera continues scanning all files in the same
>> lelve, this approach will create a conflic in hiera itself whenever it
>> finds the same variable defined in 2 profiles. ¿Which one should I choose?
>>
>
>
> For data at different hierarchy levels, this is where Hiera's various
> merge behaviors come into play.  The default is that the first value found
> is used, but you can instead collect all values into an array, or, for
> hashes, merge the various hashes in one of two ways.
>
> But note well that if you have different profiles trying to specify values
> for the same data then that's a serious conflict that you need to work out
> -- a data design problem, not inherently an Hiera problem.
>

Sure, I never said it was a hiera issue. Hiera itself, in the case of
reading the same data from 2 differnet profiles, will never be able to
decide which data to choose. Totally clear.


>
>
>> So, the (obvious) solution is to move any profile customization to the
>> role level, the same I've been doing till now.
>> But I was wondering if some part of my approach could be possible
>> (without having to decalre all the possible profiles in my hiera  tree) or
>> if someone was somehow using the "profile" in the hiera tree (and how)?.
>>
>
>
> You can parameterize your profile classes, and then rely on standard data
> binding to obtain the values from Hiera.  The data for different profiles
> are then distinguished by different keys, and they can appear at any
> Hierarchy level.
>

That's what I was doing in my previous hiera tree. The issue now was that I
wanted to use the "profile" custom_fact as a key to hiera.


> For data that you want to share among profiles without duplication, you
> can define well-known keys and explicitly call the lookup() function in
> each profile to retrieve the (same) associated data.  Or you can define a
> separate class to host the variables, set their values via automated data
> binding, and have all the profiles that want access obtain it via that one
> class.  Either way, again, the data can then appear at any hierarchy level.
>
> If this is about class parameters for the classes your profiles use, then
> you could perhaps risk having the profiles declare those with resource-like
> class declarations (instead of include-like ones), whereby you can bind
> data to the classes' parameters via DSL code.
>

Let me tell you what I wanted to do: I wanted to build the "classes" hash
based on different profiles. So, insetad of writing classes for each
profile and then "collect" them in the role in hiera:

roleA.yaml
classes:
  - profileA
  - profileB

and then declaring the classes:

class  profileA {
   include  apache
}

class profleB {
  include mysl
}


I wanted to do:

profileA.yaml
classes:
  - apache


profileB.yaml
classes:
  - mysql

roleA.yaml
custom_facts:
  - profileA
  - profileB


then "merge" the classes hash so it pick classes for all the profiles a
node belongs to


The main reason is to not having to write classes for each profile and do
as much as I can in hiera.
I'm not sure if my idea makes sense to you, or if I explained it properly.
But with teh potential of hiera3 + Puppetfile I wanted to avoid writing
puppet code as much as possible.



>
> John
>
>
Arnau

-- 
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/CAM69jx8NUR8QbPZnYuxcFbmw0ri6aG9Bjv%2BvUH4zX0jCt__A%3Dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Hiera and roles/profiles

2018-05-18 Thread Arnau
Hi all,

I recently moved from puppet 3 to puppet 5 and hiera 1 to 3. I'm taking
this opportunity to change a little bit the hierarchy setup I've been using
for the last years.
In my previous conf I used to create a custom fact for each role so I could
do something like:

- "%{environment}/hieradb/role/%{::role}"

and in each role file I specified the classes and any other role bases
customizations for the role. So far so good. This approach is something
that I'll continue using.


But now I'd like to do something similar with profiles: add a custom fact
for each profile so I can later use something like:

- "%{environment}/hieradb/profile/%{::profile}"

Obviously this approach does not work when you have more than one profile:

First, I'd need to create the profile custom_fact as an array of several
profiles and, then, I'd have to tell hiera to look in every profile from
the same hierarchy level. In a node with profiles A/B/C hiera should have
to look in the files:

"%{environment}/hieradb/profile/profileA.yaml"
"%{environment}/hieradb/profile/profileB.yaml"
"%{environment}/hieradb/profile/profileC.yaml"

Based on my tests (yup, I tried this) if hiera finds the value in, let's
say, profileB.yaml it stops scanning this level and profileC.yaml is not
evaluated.
In any case, even if hiera continues scanning all files in the same lelve,
this approach will create a conflic in hiera itself whenever it finds the
same variable defined in 2 profiles. ¿Which one should I choose?

So, the (obvious) solution is to move any profile customization to the role
level, the same I've been doing till now.
But I was wondering if some part of my approach could be possible (without
having to decalre all the possible profiles in my hiera  tree) or if
someone was somehow using the "profile" in the hiera tree (and how)?.


TIA,
Arnau

-- 
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/CAM69jx9szrMR3gqN_q2YLUYZq6qsROkRfoRea%3D-KvhGQ3%2BqH2g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] How to organizing puppet code on the master

2018-05-16 Thread Arnau
Hi,

my opinion: create modules for everything, even if it's a single file copy.
But create something that you can expand in the future.

It's quite easy to create a puppet module (
http://fullstack-puppet-docs.readthedocs.io/en/latest/puppet_modules.html)
so it will take you 5 minutes to write your own module(s).

No matter how you start, working with modules is something that you'll
thank in the future when you decide to add more stuff (code/hosts) to your
puppet installation..

Then, create a manifest.pp and configure your nodes like:

node 'abc' {
}

node 'xyz' {
}

HTH,
Arnau

2018-05-15 23:00 GMT+02:00 jeffster <jol...@gmail.com>:

> Good day all,
>
> Newbie looking for some insight on how to organize manifests on puppet
> master. Simple setup with only a couple of machines to manage. One of my
> main sticking point is that according to the literature I've seen, they all
> seem to agree upon the fact that code must be organized using modules. My
> question is--If my setup is so simple, can I do without them? All I have
> are a few manifest files and templates.
>
> Secondly, should I go with the modules approach and divide my code in said
> modules, what happens when a portion of puppet code doesn't really fit
> logically into any of them? Would the code be kept at the site.pp level
> instead?
>
> Thank you
>
> jeff
>
> --
> 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/bb6a05e9-fe38-4bdf-9a77-702cc8227824%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/bb6a05e9-fe38-4bdf-9a77-702cc8227824%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAM69jx93Qgt4OShRycGzjibCv%2Bb%3DiNer3GAXrBhT5hWWb3vTyQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Dealing with hashes (again)

2018-05-11 Thread Arnau
Hi Henrik,

something from your previous answer made me think and I've been playing a
little bit with what you said:


>> class cb_sync(
>>Hash $cb_sync = lookup(cb_data_sync),
>>
> The lookup here has no effect - it will use APL to do exactly what the
> default expression is doing - thus, it will never be called.
>

without the lookup the APL will look in hiera for the variable
cb_sync::cb_sync: (https://puppet.com/docs/puppet/5.2/hiera_automatic.html)

   1. *Puppet automatically looks up the remaining parameters with Hiera,
   using :: as the lookup key (for
   example, ntp::servers for the ntp class’s $servers parameter).*


But, if I want the class to look for a top scope variable (like what I was
doing in my class), then the lookup is needed.
without lookup it does not work, that's why you afirmation : "the lookup
here has no effect" made my think.

TIA,
Arnau

-- 
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/CAM69jx9-oi2grQ9W3OK-2Oi2V5NOi6ek4%2B4n4SZgAR3U%3DmAYPg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Dealing with hashes (again)

2018-05-09 Thread Arnau
Hi Henrik,

thanks for your answer.

The answer is:

* => $data_sync['ssh_key']

Without interpolation the resource is created as it's areal hash... (you
can't imagine how much time I spent in this one Fun fact: the notify is
correct)


* The localdata key does not exists in the define as it's the main key of
the hash passed from the main class.

Thanks a lot for your answer.

Best,
Arnau

2018-05-09 14:09 GMT+02:00 Henrik Lindberg <henrik.lindb...@puppet.com>:

> On 09/05/18 13:36, Arnau wrote:
>
>> Hi all,
>>
>> I  have a hash of hashes in hiera:
>>
>> cb_data_sync:
>>localdata:
>>  peers: peer1 peer2
>>  source: /data/1
>>  target: /data/2
>>  ssh_key:
>>key: XYZ
>>type: ssh-rsa
>>user: root
>>
>> Then, in a main class, I call a define using the above data:
>>
>> class cb_sync(
>>Hash $cb_sync = lookup(cb_data_sync),
>>
> The lookup here has no effect - it will use APL to do exactly what the
> default expression is doing - thus, it will never be called.
> (Not the source of your problem, but you can remove that call).
>
> ) {
>>
>>$cb_sync.each |$name, $data| {
>>
>
> Variable $name will shadow the meta parameter $name in the outer scope.
> better to use a different variable name here. However, doubt this will
> cause the problem.
>
>  cb_sync::rsync{ $name:
>>data_sync => $data,
>>  }
>>}
>>
>> }
>>
>> so far, so good.
>>
>> cb_sync::rsync is a define and there I'd like to create a
>> ssh_authorized_key from the ssh_key nested hash.
>>
>> So, my code looks like:
>>
>> define cb_sync::rsync (
>>Hash $data_sync = undef,
>> ) {
>>
>>  ssh_authorized_key {
>>"${name}-ssh_key":
>>  * => "${data_sync['ssh_key']}",
>>
>
> You are expecting 'ssh_key' to be a key. Your hiera data shows there is a
> "localdata" key under which there is a hash with that key.
> So, you end up with an empty hash.
>
> Also, you are using interpolation to interpolate a hash as a string.
> That is not right. You probably want this:
>
> * => $data_sync['localdata']['ssh_key']
>
>
>}
>> But puppet complains cause it says that it gets a string  but expects a
>> Hash.
>>
>
> Well, you interpolated a hash into a string...
>
> If I "notify" data_sync['ssh_key'] I get:
>>
>> Notice: {key => XYZ, type => ssh-rsa, user => root}
>>
>
> ok, then maybe your hieradata above is not exactly what you are using?
> If that key worked, change what I said you should use above and drop
> the 'lokaldata' part.
>
>
>> (which looks like a hash to me,am I wrong?).
>>
>
> A hash in string form (printed) looks very much like a hash in source code
> form, but a Hash it was not.
>
> - henrik
>
>
>
> --
>
> Visit my Blog "Puppet on the Edge"
> http://puppet-on-the-edge.blogspot.se/
>
> --
> 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/ms
> gid/puppet-users/pcuoa2%249ml%241%40blaine.gmane.org.
> 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/CAM69jx82RtmrYD%2Btd%2BeV5x2YFspNKjU2qDQnJceTZ2htXsOHRA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Dealing with hashes (again)

2018-05-09 Thread Arnau
Hi all,

I  have a hash of hashes in hiera:

cb_data_sync:
  localdata:
peers: peer1 peer2
source: /data/1
target: /data/2
ssh_key:
  key: XYZ
  type: ssh-rsa
  user: root

Then, in a main class, I call a define using the above data:

class cb_sync(
  Hash $cb_sync = lookup(cb_data_sync),
) {

  $cb_sync.each |$name, $data| {
cb_sync::rsync{ $name:
  data_sync => $data,
}
  }

}

so far, so good.

cb_sync::rsync is a define and there I'd like to create a
ssh_authorized_key from the ssh_key nested hash.

So, my code looks like:

define cb_sync::rsync (
  Hash $data_sync = undef,
) {

ssh_authorized_key {
  "${name}-ssh_key":
* => "${data_sync['ssh_key']}",
  }

But puppet complains cause it says that it gets a string  but expects a
Hash.
If I "notify" data_sync['ssh_key'] I get:

Notice: {key => XYZ, type => ssh-rsa, user => root}

(which looks like a hash to me,am I wrong?).


If I try to to create the suthorized_key using the next code:

ssh_authorized_key {
 "${name}-ssh_key":
key  => "${data_sync['ssh_key']['key']}",
type => "${data_sync['ssh_key']['type']}",
user => "${data_sync['ssh_key']['user']}",
 }

Puppet does add the entry in the authorized_keys file

So, what I'm not seeing here?


TIA,
Arnau

-- 
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/CAM69jx8RnODYGRR5RFeAkEOqbv9DwbkjOY%2B71_m0VdaR8cyvEQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Accessgin facts hash from manifests

2018-04-25 Thread Arnau
Thanks a lot for your answer! it worked.

Best,
Arnau

2018-04-23 11:01 GMT+02:00 Henrik Lindberg <henrik.lindb...@puppet.com>:

> On 23/04/18 08:33, Johan De Wit wrote:
>
>> first notify, the index should be quoted 
>>
>> notify { "OS: $facts['os']['family']": }
>>
>>
>> That us unfortunately wrong - it will produce the entire $facts hash as a
> string followed by the *text* "['os']['family']".
>
> The correct way is to write:
>
>   notify { "OS: ${facts['os']['family']}": }
>
> Or, if you like:
>
>   notify { "OS: ${facts.dig('os', 'family')}
>
> (or by using the "pick()" function from stdlib which is similar to "dig()")
>
> Best,
> - henrik
>
> Grts
>>
>>
>>
>>
>> -Original message-
>> *From:* Arnau <listsar...@gmail.com>
>> *Sent:* Friday 20th April 2018 14:22
>> *To:* puppet-users@googlegroups.com
>> *Subject:* [Puppet Users] Accessgin facts hash from manifests
>>
>>
>> Hi all,
>>
>> I'm having the first experiences with puppet 5 & facter 3
>>
>> In old puppet versions I tend to add debug messages like:
>>
>> notify { "OS : {::osfamily}: }
>>
>> and it usually worked.
>>
>> According to
>> https://puppet.com/docs/puppet/5.3/lang_facts_and_builtin_
>> vars.html#accessing-facts-from-puppet-code
>> <https://puppet.com/docs/puppet/5.3/lang_facts_and_builtin_
>> vars.html#accessing-facts-from-puppet-code>
>> I can still access the facts using the old way, but it recommend to
>> use the facts has, so the new code should look like:
>>
>>
>>notify { "OS: $facts[os][family]": }
>>
>> But when I do that I get the full list of facts and [os][family] at
>> the bottom:
>>
>>
>> Notice: OS: {agent_specified_environment => test, aio_agent_version
>> => 5.5.1, architecture => x86_64, augeas => {version => 1.10.1}
>> [ TONS OF FACTS ...]  clientversion => 5.5.1, clientnoop =>
>> false}['os]['family']"
>>
>> If I use the same syntax in a conditiona statement:
>>
>>if $facts['os']['family'] == 'RedHat' {
>>  notify { "I'm a RedHat": }
>>}
>>
>> then it works:
>>
>> Notice: /Stage[main]/Common::Yumrepos/Notify[I'm a RedHat]/message:
>> defined 'message' as 'I\'m a RedHat'
>>
>> So, what's wrong with the above notify?
>>
>>
>> TIA,
>> Arnau
>>
>>
>> -- 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 discussion on the web visit
>> https://groups.google.com/d/msgid/puppet-users/CAM69jx_sAms0
>> %3Da%2B5MhHBtnydtPKsUDeAAcera8tXSsaANaTchA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/puppet-users/CAM69jx_sAms
>> 0%3Da%2B5MhHBtnydtPKsUDeAAcera8tXSsaANaTchA%40mail.gmail.
>> com?utm_medium=email_source=footer>.
>> 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 > puppet-users+unsubscr...@googlegroups.com>.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/puppet-users/zarafa.5add7e24.7f1a.78dfd5c52ec466fa%
>> 40zarafa7.open-future.be <https://groups.google.com/d/m
>> sgid/puppet-users/zarafa.5add7e24.7f1a.78dfd5c52ec466fa%
>> 40zarafa7.open-future.be?utm_medium=email_source=footer>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
>
> Visit my Blog "Puppet on the Edge"
> http://puppet-on-the-edge.blogspot.se/
>
> --
> 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/ms
> gid/puppet-users/pbk789%242rk%241%40blaine.gmane.org.
>
> 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/CAM69jx9wOv-s4TkGYX_vKKUX1k02tO9eLSLbOfbJqyVc3B-0QQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Accessgin facts hash from manifests

2018-04-25 Thread Arnau
Hi,

first of all, thanks for your answer.
Using your code I still see the whole $facts hash

notify { "OS: $facts['os']['family']": }


As Henrik mentioned it must be:

notify { "OS: ${facts['os']['family']}": }

Best,
Arnau

2018-04-23 8:33 GMT+02:00 Johan De Wit <jo...@open-future.be>:

> first notify, the index should be quoted 
>
> notify { "OS: $facts['os']['family']": }
>
> Grts
>
>
>
>
> -Original message-
> *From:* Arnau <listsar...@gmail.com>
> *Sent:* Friday 20th April 2018 14:22
> *To:* puppet-users@googlegroups.com
> *Subject:* [Puppet Users] Accessgin facts hash from manifests
>
> Hi all,
>
> I'm having the first experiences with puppet 5 & facter 3
>
> In old puppet versions I tend to add debug messages like:
>
> notify { "OS : {::osfamily}: }
>
> and it usually worked.
>
> According to https://puppet.com/docs/puppet/5.3/lang_facts_and_builtin
> _vars.html#accessing-facts-from-puppet-code I can still access the facts
> using the old way, but it recommend to use the facts has, so the new code
> should look like:
>
>
>   notify { "OS: $facts[os][family]": }
>
> But when I do that I get the full list of facts and [os][family] at the
> bottom:
>
>
> Notice: OS: {agent_specified_environment => test, aio_agent_version =>
> 5.5.1, architecture => x86_64, augeas => {version => 1.10.1}
> [ TONS OF FACTS ...]  clientversion => 5.5.1, clientnoop =>
> false}['os]['family']"
>
> If I use the same syntax in a conditiona statement:
>
>   if $facts['os']['family'] == 'RedHat' {
> notify { "I'm a RedHat": }
>   }
>
> then it works:
>
> Notice: /Stage[main]/Common::Yumrepos/Notify[I'm a RedHat]/message:
> defined 'message' as 'I\'m a RedHat'
>
> So, what's wrong with the above notify?
>
>
> TIA,
> Arnau
>
>
> --
> 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/CAM69jx_sAms0%3Da%2B5MhHBtnydtPKsUDeAAcera8tXSsa
> ANaTchA%40mail.gmail.com
> <https://groups.google.com/d/msgid/puppet-users/CAM69jx_sAms0%3Da%2B5MhHBtnydtPKsUDeAAcera8tXSsaANaTchA%40mail.gmail.com?utm_medium=email_source=footer>
> .
> 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/zarafa.5add7e24.7f1a.78dfd5c52ec466fa%40zarafa7.
> open-future.be
> <https://groups.google.com/d/msgid/puppet-users/zarafa.5add7e24.7f1a.78dfd5c52ec466fa%40zarafa7.open-future.be?utm_medium=email_source=footer>
> .
> 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/CAM69jx9JZXckwVUn6ATYi5Arr6cKE8jDgMHyeh-ebBPawjq00g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Accessgin facts hash from manifests

2018-04-20 Thread Arnau
Hi all,

I'm having the first experiences with puppet 5 & facter 3

In old puppet versions I tend to add debug messages like:

notify { "OS : {::osfamily}: }

and it usually worked.

According to https://puppet.com/docs/puppet/5.3/lang_facts_and_
builtin_vars.html#accessing-facts-from-puppet-code I can still access the
facts using the old way, but it recommend to use the facts has, so the new
code should look like:


  notify { "OS: $facts[os][family]": }

But when I do that I get the full list of facts and [os][family] at the
bottom:


Notice: OS: {agent_specified_environment => test, aio_agent_version =>
5.5.1, architecture => x86_64, augeas => {version => 1.10.1}
[ TONS OF FACTS ...]  clientversion => 5.5.1, clientnoop =>
false}['os]['family']"

If I use the same syntax in a conditiona statement:

  if $facts['os']['family'] == 'RedHat' {
notify { "I'm a RedHat": }
  }

then it works:

Notice: /Stage[main]/Common::Yumrepos/Notify[I'm a RedHat]/message: defined
'message' as 'I\'m a RedHat'

So, what's wrong with the above notify?


TIA,
Arnau

-- 
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/CAM69jx_sAms0%3Da%2B5MhHBtnydtPKsUDeAAcera8tXSsaANaTchA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Git hooks for puppet 5

2018-04-18 Thread Arnau
Hi all,

I've installed a new puppet server (v5) and I'm looking for git hooks
(server side) that do manifests/yaml/r10k syntax check.

I've found https://github.com/drwahl/puppet-git-hooks which seems quite
complete (but without activity for more than a year).

I'm wondering if there are any "officialy" supported by puppetlabs or some
other much active.

TIA,
Arnau

-- 
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/CAM69jx_Sxyw0C5Db%2BsHHrT5yy8uqg%2BzwAkQt5DQXOJ%3DPbZ45wQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Controlling Puppet class execution order with parameters.

2017-05-25 Thread Arnau
Hi,

https://puppet.com/blog/class-containment-puppet

I'd say
1.- one module for you stuuf (moduleA)
2.- one file per class
3.-) one class that "contain" the others and set order.

moduleA/class1.pp
class moduleA::class1 { }

moduleA/class2.pp
class moduleA::class2 { }

moduleaA/class3.pp
class moduleA::class3 { }


moduleA/init.pp
contain moduelA::class1
contain moduelA::class2
contain moduelA::class3

Class['moduelA::class1'] ->
Class['moduelA::class2'] ->
Class['moduelA::class3']


HTH,
Arnau

2017-05-24 17:57 GMT+02:00 Harish Kothuri <harishkoth...@gmail.com>:

> Hi,
>
> I have 3 classes and i need to execute class 3 only when class 1 and class
> 2 completes. All of these classes must be attached to a host.
>
> class1($version='1.1.1'){
>.
>.
>.
> }
> class2($version='2.2.2'){
>.
>.
>.
> }
>
> and
>
> class3(){
> import class1
> import class2
>
> exec{ 'something':
>   cmd => 'some command here',
>   before => [Class['class1'], Class['class2']]
> }
> }
>
> When i try to apply the above relation, i get the following error
>
> *Error: Could not retrieve catalog from remote server: Error 400 on
> SERVER: Duplicate declaration: Class[class1] is already declared; cannot re
> declare on node machine.domain.com <http://machine.domain.com>*
>
> Can any one guide me how to handle this scenario?
>
> Thanks
>
>
>
>
> --
> 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/5e5d0f57-5df3-43f5-8d96-48896ed258b2%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/5e5d0f57-5df3-43f5-8d96-48896ed258b2%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAM69jx8nbaraMUNv9cmR24Xtenjx%3DKmWzVk4%2BCPLC-t1BJcPJw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Puppet with Hiera - Custom variables

2017-05-25 Thread Arnau
Hi,

the typical scenario for running nodes in differnet environments is to use
r10k.
https://docs.puppet.com/pe/latest/r10k_run.html

git + r10k . It's a well known combo that works perefctly.

Best,
Arnau


2017-05-25 12:15 GMT+02:00 Stephen <whitt...@gmail.com>:

>
> Thank you very much for this. I have successfully tested it!
>
> I perfer the idea of Puppet 'knowing' which yaml file to use by way of a
> passed variable, rather than having to read from disk for it (and if there
> is a way to do this, I'd like to hear it).
>
> But your solution works and it's not complicated, so thank you :)
>
> Kind regards,
> Stephen
>
>
> On Wednesday, 24 May 2017 15:51:38 UTC+1, Arnau wrote:
>>
>> Hi,
>>
>> I don't know if there's another (or better) way, but I use a custom fact
>> for the *environment*. Then you can tell hiera to use this new fact in
>> the hierarchy tree:
>>
>> As an example:
>> node:
>>
>> /etc/facter/facts.d/local.yaml
>> ---
>> env: "prod"
>>
>> puppet server:
>> /etc/puppet/hiera.yaml
>>
>> ---
>> :backends:
>>   - yaml
>>   - eyaml
>> :hierarchy:
>>   - "%{environment}/hieradb/%{::env}/cert/%{::clientcert}"
>>
>>
>> *Notice that %{environment} refers to puppet environemnt
>> <https://docs.puppet.com/puppet/4.10/environments.html>. (In my case those
>> are the git branches that I create).*
>>
>>
>> HTH,
>> Arnau
>>
>>
>> 2017-05-24 16:17 GMT+02:00 Stephen <whit...@gmail.com>:
>>
>>> Hello,
>>>
>>> At the moment I do not use Hiera to store any config at all, but I want
>>> to.
>>>
>>> Currently, I can use the variable "$mysettings::config::envtype" in my
>>> classes, as long as I put 'require mysettings::config' at the head of those
>>> classes.
>>>
>>> In my environment, I use this variable to hold "PROD", "DEV",
>>> "PERFTEST", "QA", etc (It derives this from IP subnet).
>>>
>>>
>>> I have this in my hiera.yaml file, which successfully pulls the data
>>> from, for example, the *os/RedHat.yaml* file when needed.
>>>   - name: "OS defaults"
>>> path: "os/%{facts.os.family}.yaml"
>>>
>>>
>>>
>>> How do I use my variable above in the same way? I've tried the below,
>>> and a number of other syntaxes, and can't get it working. ie. I want to
>>> retrieve config from the *envtype/DEV.yaml* file, but it's not
>>> returning anything.
>>>   - name: "Envtype data"
>>> path: "envtype/%{'mysettings::config::envtype'}.yaml"
>>>
>>>
>>> Apologies if this is explained in documentation, I have gone over it and
>>> it's just not clicking for me. Should I be doing it this way, should I be
>>> using custom facts, should I be doing something else?
>>>
>>> I'm on Puppet PE v2017.1.0.
>>>
>>> Thanks for any help.
>>>
>>> --
>>> 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...@googlegroups.com.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/puppet-users/c569bc63-69b5-481c-8f38-7e3388ea49a3%40googlegroups.com
>>> <https://groups.google.com/d/msgid/puppet-users/c569bc63-69b5-481c-8f38-7e3388ea49a3%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> 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/48209bb7-1c96-4a51-abc1-7ca7ccc1bb95%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/48209bb7-1c96-4a51-abc1-7ca7ccc1bb95%40googlegroups.com?utm_medium=email_source=footer>
> .
>
> 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/CAM69jx_FvJSZuMM0xEFjh-uzD22hiV6vEeyoTHmuSVhXGf3QrQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Puppet with Hiera - Custom variables

2017-05-24 Thread Arnau
Hi,

I don't know if there's another (or better) way, but I use a custom fact
for the *environment*. Then you can tell hiera to use this new fact in the
hierarchy tree:

As an example:
node:

/etc/facter/facts.d/local.yaml
---
env: "prod"

puppet server:
/etc/puppet/hiera.yaml

---
:backends:
  - yaml
  - eyaml
:hierarchy:
  - "%{environment}/hieradb/%{::env}/cert/%{::clientcert}"


*Notice that %{environment} refers to puppet environemnt
<https://docs.puppet.com/puppet/4.10/environments.html>. (In my case those
are the git branches that I create).*


HTH,
Arnau


2017-05-24 16:17 GMT+02:00 Stephen <whitt...@gmail.com>:

> Hello,
>
> At the moment I do not use Hiera to store any config at all, but I want to.
>
> Currently, I can use the variable "$mysettings::config::envtype" in my
> classes, as long as I put 'require mysettings::config' at the head of those
> classes.
>
> In my environment, I use this variable to hold "PROD", "DEV", "PERFTEST",
> "QA", etc (It derives this from IP subnet).
>
>
> I have this in my hiera.yaml file, which successfully pulls the data from,
> for example, the *os/RedHat.yaml* file when needed.
>   - name: "OS defaults"
> path: "os/%{facts.os.family}.yaml"
>
>
>
> How do I use my variable above in the same way? I've tried the below, and
> a number of other syntaxes, and can't get it working. ie. I want to
> retrieve config from the *envtype/DEV.yaml* file, but it's not returning
> anything.
>   - name: "Envtype data"
> path: "envtype/%{'mysettings::config::envtype'}.yaml"
>
>
> Apologies if this is explained in documentation, I have gone over it and
> it's just not clicking for me. Should I be doing it this way, should I be
> using custom facts, should I be doing something else?
>
> I'm on Puppet PE v2017.1.0.
>
> Thanks for any help.
>
> --
> 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/c569bc63-69b5-481c-8f38-7e3388ea49a3%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/c569bc63-69b5-481c-8f38-7e3388ea49a3%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAM69jx-rY2ODWcJx0mesL0-GD6qO_bebrsx%2B%2BT4fDfxi0z8a1g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] create_resource from a HoH

2017-05-22 Thread Arnau
Hi all,

I'm running hiera 1.3.1 and puppet 3.8.6.

I'd like to create resources based on some custom data structure. I'd like
to group all data related to a tomcat instance in the same hash key in
hiera:

cert/hostname.yaml

tomcatinst:
  instA:
instance:
 server_control_port : '8001'
 http_port  : '8011'
 ajp_port   : '8111'
 ajp_params  :
   tomcatAuthentication : 'false'
 manage_firewall : true
warfile:
 path: '/var/lib/tomcats/instaA/webapps/sample.war'
 owner   : tomcat
 group   : root
 source  : '/custom/sample.war'


*InstA *is the common key for the tomcat instance plus its warfile.  *(Instance
is a ::tomcat::instance resource and warfile is a file resource).*

There is a main class that creates the tomcat instance + the warfile using
a custom define (my_tomcat::instances)::

*my_tomcat/init.pp*

create_resources ('my_tomcat::instances', hiera_hash(tomcatinst))


** I need this define cause I'll be creating more than one insatnce per
host.*

The define where I called create_resource for the above resources (and here
is where I have all the problems):

*my_tomcat/instance.pp*

define my_tomcat::instance (
  $instance  ='',
  $war= '',
) {

$instance_hash={$name => $instance }
create_resource('::tomcat::instance', "$instance_hash")
$war_hash={$name => $war }
create_resource('file', "$war_hash")




Inside the define I don't have a hash that I can directly use in the
creat_resource calls (such hash would make everything simple), $name is the
key of the hash, and $name['insatnce'] and $name['warfile'] are the actual
hashes that I must use for each resource. So, acording to my understanding,
I must pass the hash { $name => $instance } and { $name => $war } to the
create_resource function.
but it fails to create the resources. AFAIU it fails cause in puppet 3 the
creation of hashes with variables as keys is not working
<https://tickets.puppetlabs.com/browse/PUP-2523> ( I tried to use static
values as keys and my code works). But it could be that I'm
misunderstanding the whole thing :-) .


The workaround I'm implementing is a define that does not create resources
with create_resources:

define my_tomcat::instances (
 $instance = '',
 $war  = '',
 $extra= '',
) {
#create_resources('::tomcat::instance', "{$name => $instance}", $defaults)
tomcat::instance { "$name" :
server_control_port  => $instance['server_control_port'],
http_port=> $instance['http_port'],
ajp_port => $instance['ajp_port'],
ajp_params   => $instance['ajp_params'],
manage_firewall  => $instance['manage_firewall'],
}

#$mywars = hiera("my_tomcat::instances::$name::wars")
file { "$name" :
path   => $war['path'],
owner  => $war['owner'],
group  => $war['group'],
source => $war['source'],
}



which works as expected.

But I'm wondering if if there is way to use the create_resource function
directy with the above HoH.

TIA,
Arnau

-- 
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/CAM69jx8gU1yFF%3DWMn60EoYcS99D5dru%3DMU7oGLQqKecdJXoHkQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Questions on puppetlabs/apache

2017-01-12 Thread Arnau
Hi all,

I'm using puppetlabs/apache 1.7.0, puppet 3.8.7 and hiera 1.3.4.
I'd like to ask you 3 questions:

1) Is there any way to set CustomLog in the httpd.conf without changing the
default template? I don't find a way to add custom entries in the server
conf file.

2) how can I scape %{Refer}in hiera? I have the line:
  vhost_combined: '%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\"
\"%{User-Agent}i\"'

and tried several ways to escape %{Refer} and %{User-Agent} but both are
always interpreted as a vriables, thus become and empty string:

   LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"i\" \"i\"" vhost_combined

I tried %% , \%, \%\{, literal  none worked .

3) apache::vhost is a define, how can I set in hiera a default for all
vhosts? the same way that I do for classes, something like:

apache::vhost::access_log: false

but for a define... is that possible? (without calling create_resource).

TIA,
Arnau

-- 
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/CAM69jx9-xq6RP%3DFeOvQjnhP0-FeT%3D%2BKN4JUVe7xaf456JC53XA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Puppet hiera error

2016-09-26 Thread Arnau
You could try to debug it from the server side. I usually run:

hiera -c /etc/puppet/hiera.yaml -d classes environment=your_env
 ::fqdn=hostname

soemtimes this is useful.

Best,
Arnau

2016-09-24 0:51 GMT+02:00 Jagga Soorma <jagg...@gmail.com>:

> Hi Guys,
>
> I am trying to setup a new puppet environment using hiera and have
> everything setup.  However, when I do a puppet agent run I get the
> following error:
>
> --
> Error: Could not retrieve catalog from remote server: Error 400 on
> SERVER: Could not find data item classes in any Hiera data file and no
> default supplied at
> /etc/puppet/environments/production/manifests/site.pp:26 on node
> resmesostst01.gene.com
> Warning: Not using cache on failed catalog
> Error: Could not retrieve catalog; skipping run
> --
>
> I am running puppet version 3.8.7.  Here is my site.pp:
>
> --
> # cat /etc/puppet/environments/production/manifests/site.pp | grep -v
> '#' | sed '/^$/d'
> filebucket { 'main':
>   server => 'resforetst01.gene.com',
>   path   => false,
> }
> File { backup => 'true' }
> Package { allow_virtual => true }
> node default {
>   hiera_include('classes')
> }
> notify { 'debug_location': name => "THE NODE LOCATION IS: ${location}" }
> notify { 'debug_environment': name => "THE NODE ENVIRONMENT IS:
> ${environment}" }
> notify { 'debug_ype': name => "THE NODE TYPE IS: ${pr_type}" }
> notify { 'debug_hostgroup': name => "THE NODE HOST GROUP IS: ${hostgroup}"
> }
> --
>
> Here is my hiera.yaml:
>
> --
> [root@resforetst01 production]# cat /etc/puppet/hiera.yaml  | grep -v '#'
> ---
> :backends:
>   - yaml
> :hierarchy:
>   - "node/%{::fqdn}"
>   - "role/%{::hostgroup}"
>   - "type/%{::pr_type}"
>   - "site/%{::domain}"
>   - common
> :yaml:
>   :datadir: "/etc/puppet/environments/%{::environment}/hieradata"
> :logger: console
> --
>
> Any clues on what I seem to be missing?
>
> Thanks!
>
> --
> 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/CAKyjK51g9opXvj0UpVEs8owG7V3kn
> 5v%3DjJb7s4j%2B%2Ba9iwGvwdg%40mail.gmail.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/CAM69jx9OYeP9OfL-%3DA0%3D%3DCQo9-xMXn%3DnNzDQSmpcg0XPZt2bQw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] simple node classification and custom facts

2016-09-07 Thread Arnau
Hi,

my 2 cents below:

2016-09-04 22:32 GMT+02:00 Berkeley <berkeleychurch...@gmail.com>:

> [...]
>
> :hierarchy:
> - "fqdn/%{clientcert}"
> - "env/%{environment}"
> - "roles/%{role}"
> - "os/%{osfamily}
> - common
>
>
> I should add that I'm very comfortable writing ruby code, but for
> something so basic I don't feel like I should be trying to write custom
> facts.  Even a simple way to just specify, per-node, an extra fact I could
> use for hiera's hierarchy would be helpful.
>

I use https://forge.puppet.com/abstractit/puppet to define custom facts.

Then, in hiera, for each node I do something like:

nodeXYZ.yaml
facts::custom_facts: { role: sge_execution_node }


during the first puppet run, it creates the custom fact, the second, the
node know what role it is and does what its expected (same when you switch
roles in a node).

I prefer using a custom fact cause I can interrogate the node about its
role:

# facter -p role
sge_execution_node


I also use the role yaml file in hiera for including classes based:

role/sge_execution_node.yaml
---
classes:
 - role::sge_execution_node
sge::node_type: 'execution'



Best,
Arnau

-- 
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/CAM69jx9Mod8c-z-Pd05DLR0hVt7qPxuV3Cj1LZnBdCfM6Z9MAw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] augeasproviders_pam and some account entries (iteration in puppet 3)

2015-11-23 Thread Arnau
Hello all,

I'm trying to configure pam.d/password-auth file with the pam
augeasprovider from herculesteam
<https://forge.puppetlabs.com/herculesteam/augeasproviders_pam/> . I'm
running RH6 system with puppet 3.7 and version 2.1 of augeasprovider.

I'd like to configure pam from a list of groups. Something like:

class::allowed:
 -graoupA
 -groupB
 -groupC


and the result should be:

account [default=ignore success=3]   pam_succeed_if.so uid < 1000 quiet
account [default=ignore success=2]   pam_succeed_if.so user ingroup
groupA
account [default=ignore success=1]   pam_succeed_if.so user ingroup
groupB
account [default=bad success=ignore] pam_succeed_if.so user ingroup
groupC

I should configure some entries like:

  'Add account in system-auth 1' :
ensure   => present,
service  => 'system-auth',
type => 'account',
control  => '[default=ignore success=2] ',
control_is_param => true,
module   => 'pam_succeed_if.so',
arguments  => ['uid < 1000 quiet];

  'Add account in system-auth 2' :
ensure   => present,
service  => 'system-auth',
type => 'account',
control  => '[default=ignore success=1] ',
control_is_param => true,
module   => 'pam_succeed_if.so',
arguments  => ['user ingroup groupA'];

and so on...


I need some iteration when creating the pam entries as the "success" value
is based the number of entries in $allowed. And also some case/if for the
first/ last entry.

I've looking for away and found something like "recursion in puppet
<https://ttboj.wordpress.com/2012/11/20/recursion-in-puppet-for-no-particular-reason/>",
or even using a file template and add some ruby, but I'm wondering if there
is another approach for this problem using augeasproviders_pam . And
upgrade to puppet 4 is not an option.


Thanks in advance,
Arnau

-- 
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/CAM69jx_y_JOHa0L1S0nVm_AL5RJ9JaNOA2OdY%3DaMtwVdtNucgQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] puppet agent --tag (and hiera) during Scientific Linux installation

2015-11-11 Thread Arnau
Hi Martin,


> The only env where it's defined is the one I'm using.
>
> Maybe that is the reason.
>

Sorry, but I don't see why this could be the reason. Could you please
explain it to me?



> Can you please have a look at the nagios::client code and check whether
> there is a default set for $selinux?


the default is "true".

I've compared facts during installation and after reboot. there's a
difference in selinux value
selinux = true during installation
selinux = false after installation

but this is ::selinux and not ::nagios::client::selinux

I've tried to set nagios::client::selinux = false  in the puppet
master/environment/class. the source file that triggers the error. And the
error is still there. The only thing that really fix teh problem is
commenting out the if statement in the nagios client code:

  ## With selinux, some nrpe plugins require additional rules to work
  #if $selinux and $::selinux_enforced {
   # selinux::audit2allow { 'nrpe':
  #source => "puppet:///modules/${module_name}/messages.nrpe",
 #   }
#  }



Even if the value is true/false the nagios client code refers to a type
defined in a different module (selinux):


  # With selinux, some nrpe plugins require additional rules to work
  if $selinux and $::selinux_enforced {
selinux::audit2allow { 'nrpe':
  source => "puppet:///modules/${module_name}/messages.nrpe",
}
  }

and the parsers gives the error because the resource type is unknown.

I think this explains what's going on. Does it make sense?

but I'm still wondering why the parser does not complain after the node
reboot. any answer to this?

Thanks,
Arnau

-- 
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/CAM69jx8GnEhiKLW7ZPBxPWm%2BLmj9eYiKb172k6hndhjFaPOPrA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Re: puppet agent --tag (and hiera) during Scientific Linux installation

2015-11-11 Thread Arnau
 only my uses hiera.
I should not pasted different commands becasue they are the same. I just
copied & pasted from another terminal.

[... at this point I join your answer from the other e-mail]

Change ::selinux to false (append selinux=0 in the kernel line) and
> everything works as expected.
>
>
> still (very) confused
> It is plausible that disabling selinux on the machine would result in
> selinux-related classes declaring no resources, or otherwise behaving
> differently then when selinux is enabled.  That would be a function of the
> classes involved, but the enablement status would be visible to them via a
> node fact.  I'm inclined to think that the behavior change you describe
> arises from such a provision, but I cannot be sure without reviewing the
> classes involved.
>

yes, it's plausible, but looking into nagios code again, it refers to :

if $selinux and $::selinux_enforced {

::selinux_eforced = true because selinux is enabled during installation.
but I though that $selinux value inside nagios::client class  _should_ come
from hiera as it's nagios::client::hiera.  this is my mistake, am I wrong?

and after the reboot puppet runs because all selinux variables (facts)
equal to false as selinux has been disabled after reboot. I'm not setting
the variable properly in hiera.


> More generally, it would be helpful both to you and to us if you could
> narrow down the failure case as much as possible, and present a complete,
> minimal example with which we could reproduce the problem.  There's far too
> much that we don't know about your manifest set and data; without (much)
> more, it's difficult for us to offer more than guesswork.
>

I think I've asked the proper question now did I?

Again, thanks to all of you for your answers,

Best,
Arnau

-- 
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/CAM69jx_3SV0vwPaRJ63WM%3DHDBa0mFPY%2B3VxCDWrkKrTa8S%3D0hQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] puppet agent --tag (and hiera) during Scientific Linux installation

2015-11-11 Thread Arnau
Change ::selinux to false (append selinux=0 in the kernel line) and
everything works as expected.


still (very) confused

Arnau

2015-11-11 12:37 GMT+01:00 Arnau <listsar...@gmail.com>:

> Hi Martin,
>
>
> > The only env where it's defined is the one I'm using.
>>
>> Maybe that is the reason.
>>
>
> Sorry, but I don't see why this could be the reason. Could you please
> explain it to me?
>
>
>
>> Can you please have a look at the nagios::client code and check whether
>> there is a default set for $selinux?
>
>
> the default is "true".
>
> I've compared facts during installation and after reboot. there's a
> difference in selinux value
> selinux = true during installation
> selinux = false after installation
>
> but this is ::selinux and not ::nagios::client::selinux
>
> I've tried to set nagios::client::selinux = false  in the puppet
> master/environment/class. the source file that triggers the error. And the
> error is still there. The only thing that really fix teh problem is
> commenting out the if statement in the nagios client code:
>
>   ## With selinux, some nrpe plugins require additional rules to work
>   #if $selinux and $::selinux_enforced {
># selinux::audit2allow { 'nrpe':
>   #source => "puppet:///modules/${module_name}/messages.nrpe",
>  #   }
> #  }
>
>
>
> Even if the value is true/false the nagios client code refers to a type
> defined in a different module (selinux):
>
>
>   # With selinux, some nrpe plugins require additional rules to work
>   if $selinux and $::selinux_enforced {
> selinux::audit2allow { 'nrpe':
>   source => "puppet:///modules/${module_name}/messages.nrpe",
> }
>   }
>
> and the parsers gives the error because the resource type is unknown.
>
> I think this explains what's going on. Does it make sense?
>
> but I'm still wondering why the parser does not complain after the node
> reboot. any answer to this?
>
> Thanks,
> Arnau
>
>
>

-- 
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/CAM69jx9%3DFW%3D6uHmrUtzu6Cp2QR6KxUT-cLTYT%3DUjh333jjB2xQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: puppet agent --tag (and hiera) during Scientific Linux installation

2015-11-10 Thread Arnau
Hi,

>
> I see two possible entry points for your problem:
>
> 1. environment specific hiera data
> according to your hiera.yaml file you have hieradata per environment.
> can you please cross check that the nagios::client::selinux key is set to
false in all environment default.yaml files.

The only env where it's defined is the one I'm using.
But, in any case,if I specify the env in command line, puppet should not
mix data from other envs, am I wrong?

> 2. foreman providing data to modules.
> check whether you set the selinux parameter for the nagios::client class
in foreman based upon environments.
Foreman has no parameter defined. Only the env.

What really confuses me is the fact that everything wlrks as expected once
the node has been rebooted. i must compare facter outputs, and anything
else?

Also, i'll try to remlve all hierarchy entries except defaults.yaml, just
to be sure that that's the only file checked.

I've been trying to download the catalog, with no luck. If the compilation
fails, is there any way for downloading it anyway?

Thanks,
Arnau

-- 
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/CAM69jx9VhnXR6S2J8uoosWy8bVDBGE27%2BeYSguBaa4z6BSfOiw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] puppet agent --tag (and hiera) during Scientific Linux installation

2015-11-10 Thread Arnau
2015-11-10 14:39 GMT+01:00 Martin Alfke <tux...@gmail.com>:

> Hi Arnau
>
Hi Martin,


> Are your hiera data generic or specific to environments?
>

specific to hiera.


> > …
>
> > * Hiera works and returns the expected values:
> > #  hiera -c /etc/puppet/hiera.yaml -d  classes environment=basic_conf
> clientcert=XX
>
> Here you make use of the ::environment.
>

Yes, because the default environment is not "basic_conf" .



> > My kickstart posinstall section runs puppet like:
> > puppet agent --test --tags=kickstart::bootstrap --report --pluginsync
> --no-noop
>
> Here you do not specify the environment.


I've tried to run the puppet command + --environment=basic_conf inside the
kickstart process and it still gives me the error. I should have pasted the
complete command and not this one. Sorry.


The reason why I specify the environment is becasue the default env in the
puppet master is not basic_conf. The node env  (AND ONLY NODE ENV) is
defined in foreman. (yes, maybe I should have talked about foreman before,
but, as the same command with/without environment fails, I did not consider
that foreman was interefering with my current issue).



> Can you provide the content and location of your hiera.yaml file?
>

 # cat /etc/puppet/hiera.yaml
---
:backend:
  - yaml
:hierarchy:
  - "%{environment}/hieradb/global"
  - "%{environment}/hieradb/cert/%{clientcert}"
  - "%{environment}/hieradb/net/%{netlocation}"
  - "%{environment}/hieradb/location/%{location}"
  - "%{environment}/hieradb/env/%{environment}"
  -
"%{environment}/hieradb/dist/%{operatingsystem}/%{operatingsystemrelease}"
  -
"%{environment}/hieradb/dist/%{operatingsystem}/%{operatingsystemmajrelease}"
  - "%{environment}/hieradb/dist/%{operatingsystem}"
  - "%{environment}/hieradb/dist/%{lsbdistid}/%{lsbdistrelease}"
  - "%{environment}/hieradb/dist/%{lsbdistid}/%{lsbmajdistrelease}"
  - "%{environment}/hieradb/dist/%{lsbdistid}"
  - "%{environment}/hieradb/defaults"

:yaml:
  :datadir: "/var/lib/puppet-deploy/XX-environments"



>
> Best,
> Martin


Cheers,
Arnau

-- 
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/CAM69jx-JRhRtHhrSo92nW%3DgkQE4Sw7G1RVhnvh-JOjx8%2BX6axA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] puppet agent --tag (and hiera) during Scientific Linux installation

2015-11-10 Thread Arnau
Hello all,

I'm running puppet 3.7.5 + hiera 1.3.4 and facter 2.3.0 .

My site.pp:

$ cat manifests/site.pp
node default {
  hiera_include('classes')}


in *hiera, *I've defined the default classes to be included:

$ cat hieradb/defaults.yaml
---#Default classes
classes:
 - profiles::base


and the *base proflie *includes few classes like:

class profiles::base {

  contain ntp
  contain resolv
  contain smtp
  contain ssh
  contain common
  contain puppet::agent
  contain repos
  contain nagios::client
...}


in hiera *defaults.yaml *I've also defined a couple of *nagios::client*[1]
variables (for not including selinux):

$cat hieradb/defaults.yaml[...]
nagios::client::selinux: 'false'
nagios::client::selinux_enforced: 'false'[...]

**Default for selinux is true.*

the relevant code from *nagios*[1] module:

# nagios/manifests/client.pp
[...]
  # With selinux, some nrpe plugins require additional rules to work
  if $selinux and $::selinux_enforced {
selinux::audit2allow { 'nrpe':
  source => "puppet:///modules/${module_name}/messages.nrpe",
}
  }[...]

*and ONLY NTP class has the tag kickstart::bootstrap defined.*


** Hiera works and returns the expected values:*

#  hiera -c /etc/puppet/hiera.yaml -d  classes environment=basic_conf
clientcert=XX
DEBUG: Tue Nov 10 14:14:39 +0100 2015: Hiera YAML backend starting
DEBUG: Tue Nov 10 14:14:39 +0100 2015: Looking up classes in YAML backend
DEBUG: Tue Nov 10 14:14:39 +0100 2015: Looking for data source
basic_conf/hieradb/global
DEBUG: Tue Nov 10 14:14:39 +0100 2015: Looking for data source
basic_conf/hieradb/cert/XX
DEBUG: Tue Nov 10 14:14:39 +0100 2015: Looking for data source
basic_conf/hieradb/env/basic_conf
DEBUG: Tue Nov 10 14:14:39 +0100 2015: Cannot find datafile
/var/lib/puppet-deploy/.../basic_conf.yaml, skipping
DEBUG: Tue Nov 10 14:14:39 +0100 2015: Looking for data source
basic_conf/hieradb/defaults
DEBUG: Tue Nov 10 14:14:39 +0100 2015: Found classes in
basic_conf/hieradb/defaults["profiles::cb::base"]

#  hiera -c /etc/puppet/hiera.yaml -d  nagios::client::selinux
environment=basic_cb_conf clientcert=inhas01883.eu.boehringer.com

[...]

false



My kickstart posinstall section runs puppet like:

puppet agent --test --tags=kickstart::bootstrap --report --pluginsync --no-noop


*I expect puppet to run, not include selinux and ONLY configure ntp*

But it gives me an error (failed catalog) because
*selinux::audit2allow *is an invlaid resource type. (which means that
the nagios variables are not picked up from hiera (false)  so selinux
is included)

If I reboot the node, and run the same exact puppet agent line, then
puppet runs (no selinux complain) and only NTP class is configured:

#  /usr/bin/puppet agent --test --environment=basic_cb_conf
--tags=kickstart::bootstrap
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for XXX
Info: Applying configuration version ''
Notice: /Stage[main]/Ntp/File[/etc/ntp.conf]/content:
--- /etc/ntp.conf   2015-11-10 12:23:14.946909373 +
+++ /tmp/puppet-file20151110-5619-gw8wio-0  2015-11-10
12:24:05.208909327 +
@@ -1,54 +1,10 @@
-# For more information about this file, see the man pages
-# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5),
ntp_mon(5).[...]

the expected behaivour.

So, what are (or could be) the differences between puppet runs inside the
kickstart postinstall process and puppet runs outside it?
Why is hiera ignored?

[1] (https://forge.puppetlabs.com/thias/nagios)

TIA,

-- 
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/CAM69jx_uAbfBc1aU0hYUv%3DGfkGu1oTCx%3D1%3DkgS1JUE1ifsxMxQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] puppetlabs apache and extra conf.d files

2015-11-08 Thread Arnau
Thanks a lot for your answer,

Cheers

2015-11-06 16:34 GMT+01:00 Matthew Hyclak <hyc...@gmail.com>:

> No, because puppet is now "managing" the file, it won't be included in the
> purge.
>
> On Fri, Nov 6, 2015 at 9:11 AM, Arnau <listsar...@gmail.com> wrote:
>
>> Hi,
>>
>> thanks for your answer.
>> But with this file + apache doing a directory purge on each run, isn't it
>> going to be add/remove the file in every run?
>>
>> (custom_config is working like a charm)
>> TIA,
>> Arnau
>>
>> 2015-11-06 14:48 GMT+01:00 Matthew Hyclak <hyc...@gmail.com>:
>>
>>> Could/should be as simple as
>>>
>>> class thruk {
>>>   package { 'thruck':
>>> ensure => 'installed',
>>>   }
>>>   file { '/etc/httpd/conf.d/thruk.conf':
>>> ensure => 'file',
>>> require => Package['thruk'],
>>>   }
>>> }
>>>
>>> Salt to taste.
>>>
>>> On Fri, Nov 6, 2015 at 5:00 AM, Arnau <listsar...@gmail.com> wrote:
>>>
>>>> Hi Hunter,
>>>>
>>>> thanks for your answer.
>>>> I don't see how to do what you suggest, could you please give me a
>>>> short example?
>>>> (I was using apache::custom_config as a workaround)
>>>>
>>>> TIA,
>>>> Arnau
>>>>
>>>> --
>>>> 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/CAM69jx9Z5phMNuUpyEbVji7TjzV-zXpJ0MUhe5PxuX%3Din%2B7gSg%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/puppet-users/CAM69jx9Z5phMNuUpyEbVji7TjzV-zXpJ0MUhe5PxuX%3Din%2B7gSg%40mail.gmail.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>>> 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/CAO7w0s6qNWzgAeYu13S9AOGFoq6D-W%2B8JfUQVtFfuxCZ39Q%2Bjg%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/puppet-users/CAO7w0s6qNWzgAeYu13S9AOGFoq6D-W%2B8JfUQVtFfuxCZ39Q%2Bjg%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>>
>>> 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/CAM69jx-xWFoWq9EbwFUPiWtg4n5irSR3B55yxbX0r8j1NXvAqQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/puppet-users/CAM69jx-xWFoWq9EbwFUPiWtg4n5irSR3B55yxbX0r8j1NXvAqQ%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
>> 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/CAO7w0s7qQifeho5YbA6DjS3XV%2B4TOtkQ_ouhJQ_4K8nYAxuh5g%40mail.gmail.com
> <https://groups.google.com/d/msgid/puppet-users/CAO7w0s7qQifeho5YbA6DjS3XV%2B4TOtkQ_ouhJQ_4K8nYAxuh5g%40mail.gmail.com?utm_medium=email_source=footer>
> .
>
> 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/CAM69jx_Xfj7_vDiyOdi08PJSHBz%2Bv%3DgChXQdFh3Tiq%2BjJoQQGg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] puppetlabs apache and extra conf.d files

2015-11-06 Thread Arnau
Hi Hunter,

thanks for your answer.
I don't see how to do what you suggest, could you please give me a short
example?
(I was using apache::custom_config as a workaround)

TIA,
Arnau

-- 
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/CAM69jx9Z5phMNuUpyEbVji7TjzV-zXpJ0MUhe5PxuX%3Din%2B7gSg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] puppetlabs apache and extra conf.d files

2015-11-06 Thread Arnau
Hi,

thanks for your answer.
But with this file + apache doing a directory purge on each run, isn't it
going to be add/remove the file in every run?

(custom_config is working like a charm)
TIA,
Arnau

2015-11-06 14:48 GMT+01:00 Matthew Hyclak <hyc...@gmail.com>:

> Could/should be as simple as
>
> class thruk {
>   package { 'thruck':
> ensure => 'installed',
>   }
>   file { '/etc/httpd/conf.d/thruk.conf':
> ensure => 'file',
> require => Package['thruk'],
>   }
> }
>
> Salt to taste.
>
> On Fri, Nov 6, 2015 at 5:00 AM, Arnau <listsar...@gmail.com> wrote:
>
>> Hi Hunter,
>>
>> thanks for your answer.
>> I don't see how to do what you suggest, could you please give me a short
>> example?
>> (I was using apache::custom_config as a workaround)
>>
>> TIA,
>> Arnau
>>
>> --
>> 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/CAM69jx9Z5phMNuUpyEbVji7TjzV-zXpJ0MUhe5PxuX%3Din%2B7gSg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/puppet-users/CAM69jx9Z5phMNuUpyEbVji7TjzV-zXpJ0MUhe5PxuX%3Din%2B7gSg%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
>> 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/CAO7w0s6qNWzgAeYu13S9AOGFoq6D-W%2B8JfUQVtFfuxCZ39Q%2Bjg%40mail.gmail.com
> <https://groups.google.com/d/msgid/puppet-users/CAO7w0s6qNWzgAeYu13S9AOGFoq6D-W%2B8JfUQVtFfuxCZ39Q%2Bjg%40mail.gmail.com?utm_medium=email_source=footer>
> .
>
> 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/CAM69jx-xWFoWq9EbwFUPiWtg4n5irSR3B55yxbX0r8j1NXvAqQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] puppetlabs apache and extra conf.d files

2015-11-05 Thread Arnau
Hi all,

Puppetlab apache module [1] by default purges everything under
/etc/httpd/conf.d . If you want to add an extra file, you must use
apache::vhost.
I'm writing a module for managin thruk. The trhuk rpm packge provides a
apache conf file (/etc/httpd/conf.d/thruk.conf). At this point I'm
wondering what is the best way for "translating" the conf file provided by
the rpm into a apache:vhost.

Is there any automatic way for writing the apache::vhost from a http conf
file (something like puppet resource ... ? )

How do other people deal with this?

TIA,
Arnau



[1] https://forge.puppetlabs.com/puppetlabs/apache

-- 
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/CAM69jx8aMtQoA80VpmVgvGGX2iLytbfB80%2BzURWq%3DiOCLKt-%2BQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Write a basic custom module for puppet

2015-09-17 Thread Arnau
Hi,

https://docs.puppetlabs.com/puppet/latest/reference/modules_fundamentals.html

Maybe start with:

puppet module generate user-modulename 

you'll get the basic stuff.

HTH,

2015-09-17 8:46 GMT+02:00 :

> I have some experience handling puppet modules but this time I wrote some
> code in Ruby that I'd like to port to a custom puppet module. I already
> have read puppetlabs documentation( puppetforge
> , Beginner's guide
>  )about
> writing custom modules but I still don't get a basic idea to build from
> zero a dummy custom puppet module to test it.
>
>
> Do you know where can I find some practical examples to build a dummy
> custom puppet module?
>
> --
> 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/4cca7c51-e51a-46be-8b3f-ff8fc802d038%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/CAM69jx9Zhfd4npRUc26csPoF%2BnOcKTo5keHO-Zk3jWYB0mMTGQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Problems with wdijkerman/zabbix module

2015-05-20 Thread Arnau Bria
Dear all,

I've installed wdijkerman/zabbix module in puppet server.

Now I've been modifying its conf in hiera :

zabbix::zabbix_url: 'zabbix.linux.crg.es'
zabbix::zabbix_version: '2.2'
zabbix::manage_repo: 'false'

But seems that the module is ignoring those parameters.
I've to modify them in zabbix::params .

So, anyone how is using this module has seen the same problem?

then I have a second question. If I use postgres DDBB, the run fails
with the error:

Notice: 
/Stage[main]/Zabbix::Database::Postgresql/Exec[zabbix_server_create.sql]/returns:
 /bin/sh: line 0: cd: /usr/share/zabbix-*-pgsql: No such file or directory
Error: cd /usr/share/zabbix-*-pgsql  psql -h 'localhost' -U 'zabbix_server' 
-d 'zabbix_server' -f schema.sql  touch /etc/zabbix/.schema.done returned 1 
instead of one of [
0]
Error: 
/Stage[main]/Zabbix::Database::Postgresql/Exec[zabbix_server_create.sql]/returns:
 change from notrun to 0 failed: cd /usr/share/zabbix-*-pgsql  psql -h 
'localhost' -U
 'zabbix_server' -d 'zabbix_server' -f schema.sql  touch 
/etc/zabbix/.schema.done returned 1 instead of one of [0]
Notice: 
/Stage[main]/Zabbix::Database::Postgresql/Exec[zabbix_server_images.sql]: 
Dependency Exec[zabbix_server_create.sql] has failures: true


where are those pgsql files? I dont' have any pgsql file in my system.


TIA,
Arnau

-- 
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/20150520150657.54299e31%40eidolon.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Problems with wdijkerman/zabbix module

2015-05-20 Thread Arnau Bria
On Wed, 20 May 2015 15:06:57 +0200
Arnau Bria wrote:

Hello,

me again with answer to both problems :-)

 Now I've been modifying its conf in hiera :
 
 zabbix::zabbix_url: 'zabbix.linux.crg.es'
 zabbix::zabbix_version: '2.2'
 zabbix::manage_repo: 'false'
 
 But seems that the module is ignoring those parameters.
 I've to modify them in zabbix::params .

https://github.com/dj-wasabi/puppet-zabbix/pull/88
 
 then I have a second question. If I use postgres DDBB, the run fails
 with the error:
 
[...]
 
 where are those pgsql files? I dont' have any pgsql file in my system.

 # Allow to customize the path to the Database Schema,
  if ! $database_schema_path {
case $::operatingsystem {
  'centos','redhat','oraclelinux' : {
$schema_path   =
 /usr/share/doc/zabbix-*-pgsql-${zabbix_version}*/create }
default : {
$schema_path   = '/usr/share/zabbix-*-pgsql'
  }
}

I'm runnnig Scientifi Linux which is not listed in the above case
statement.


Sorry for the noise,
Arnau

-- 
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/20150520152639.68a01401%40eidolon.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] mysql module v 1.0 mysql_grant - database_grant

2013-12-09 Thread Arnau Bria
Hi,

I'm using mysql module version 0.6.1 and I wanted to upgrade. After
reading a little I saw that migrating from v 1 to 2 must be studied, so
I decided to upgrde to version 1.

BUT, I've seen a couple of warnings on my first run and I'm updating my
code, but I've found that my old sysntax for database_grant is not
compatible with mysql_grant.

So, if I had something like:

mysql_database{ [  'biosql' , 'biosql-test' ] : 
ensure  = present, 
require = Class['mysql::server'],

}

   database_user  { 'biocore@%.X' :
password_hash = mysql_password('X') ;
}
database_grant { [ 'biocore@%.XX/biosql' , 
'biocore@%./biosql-test'  ] :
privileges = ['all'] ;
}


now I must write soemthing like:

mysql_grant { 'biocore' :
user= 'biocore@%.X',
table   = 'biosql.*',
privileges = ['all'];
}

So, for each user/DB pair, now I must specify much more info. ( I have
hundrets of DDBBs)...

I've been reading the type code but I do not understand if I can still
use some simpler syntax as before...

Anyone using the module knows how to write it?

Cheers,
Arnau

-- 
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/20131209133410.6a41c7ee%40eidolon.linux.crg.es.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Re: ssh_keys created every puppet run

2013-04-25 Thread Arnau Bria
Hi,

the key is not the problem (i copy it into 3 users' home and only
one complained). What's special about thta one user? it's
home. it's nfs and had file permission problems.
Solved.


Thanks a lot!
Cheers,
Arnau

-- 
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 post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[Puppet Users] ssh_keys created every puppet run

2013-04-23 Thread Arnau Bria
Hi,

I haveA class with several ssh_key resources:

class web_cluster::ssh_keys( $ensure='present')  {
if ! ($ensure in [ present, absent ]) {
fail(cluster ensure parameter must be absent or present)
}

# Set local variables based on the desired state

if ($ensure == present) {
$service_enable = true
$service_ensure = running
$package_ensure = latest
$file_ensure= file
$user_ensure= present
}elsif ($ensure == absent) {
$service_enable = false
$service_ensure = stopped
$package_ensure = absent
$file_ensure= absent
$user_ensure= absent
}

Ssh_authorized_key {
type= 'ssh-rsa',
}

ssh_authorized_key {

[...]
'user@key_3':
ensure  = $hostname ? {
/host/= $user_ensure,
default = absent,
},
user= 'www-bi',
key = 'XXXx1zKQ==';
}


and every time I run puppet it says:

notice: 
/Stage[main]/Web_cluster::Ssh_keys/Ssh_authorized_key[user@key_3]/ensure: 
created
notice: Finished catalog run in 15.78 seconds

but I only have a key there:


$ cat .ssh/authorized_keys 
# HEADER: This file was autogenerated at Tue Apr 23 11:27:37 +0200 2013
# HEADER: by puppet.  While it can still be managed manually, it
# HEADER: is definitely not recommended.
ssh-rsa  user@key_3


Running it with debug:


notice: 
/Stage[main]/Web_cluster::Ssh_keys/Ssh_authorized_key[user@key_3]/ensure: 
created
debug: Flushing ssh_authorized_key provider target 
/data/www-bi/.ssh/authorized_keys
debug: /Stage[main]/Web_cluster::Ssh_keys/Ssh_authorized_key[user@key_3]: The 
container Class[Web_cluster::Ssh_keys] will propagate my refresh event


I cannot figure out why puppet is pushing the key everytime it runs.
I happens with other keys in other servers.
Could it be becuase of some strange charactes in the key?

# rpm -qa|grep puppet
puppet-2.7.21-1.el6.noarch


TIA,
Arnau

-- 
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 post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[Puppet Users] Puppet MySQL Module

2013-03-05 Thread Arnau Bria
Hi all,

I'm using the MySQL module
https://forge.puppetlabs.com/puppetlabs/mysql and I can't find the way
to give certain permission to a secondary user over an already created
DB (which has it own user):


mysql::db { 'galaxy':
user = 'galaxy',
password = 'XX',
host = 'localhost',
grant= ['all'],
}

Now I would like to give select privileges on galaxy DB to user arnau,
but I can't find the way for doing so.

Could someone give a hand?

TIA,
Arnau

-- 
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 post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Puppet Users] Puppet MySQL Module

2013-03-05 Thread Arnau Bria
On Tue, 5 Mar 2013 10:48:16 +0200
Nikola Petrov wrote:

Hi Nikola,

 You can use the database_grant resource type. Here is an example:
 
   database_grant { ${user}@${::hostname}/${db}:
 privileges = ['select'], # anything you want
 require= Database_user[${user}@${::hostname}],
   }
 
 set the $user and $db variables to what you want ;)
 
 More information can be found on the github README file for module.

thanks alot, I already had one database_grant but I've realized that I
had a typo in the dtaabses (well, I was refering to antoher...
galaxytest, for that reason it was not working.

thanks a lot, 

Cheers,
Arnau

-- 
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 post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Puppet Users] Puppet MySQL Module

2013-03-05 Thread Arnau Bria
On Tue, 5 Mar 2013 10:48:16 +0200
Nikola Petrov wrote:

 You can use the database_grant resource type. Here is an example:

But how may I set its password? (it's working cause my user was
correctly created and I set its passwd before).


*Sorry, I did reply too early..

Cheers,
Arnau

-- 
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 post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[Puppet Users] managing java with puppet (RH)

2012-11-20 Thread Arnau Bria
Hi all,

In my systems (SL 6.3, RH like) I'm installing Oracle's Java. 
I'm managing the package and several links under /etc/alternatives
with puppet, but for configuring it, all the 'official' docs recommends
'alternatives'. I've been looking for some module which already
deals with it, but I've not found any... anyone knows any module with
deals with alternatives?


TIA,
Arnau

-- 
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] Compile catalog time: 2.6 vs 2.7.X

2012-05-08 Thread Arnau Bria
Hi all,

I'm in the procedure of migrating my old puppet server
(puppet-2.6.14-1.el5) with mongrel to a new one
(puppet-2.7.14-1.el6.noarch) with passenger.

I'm facing a really strange behaviour with the catalog compilation
time. I've 3 servers:

1.-) Centos 5.8 puppet-2.6.14-1.el5 + rubygem-mongrel-1.0.1-6.el5

Client:
Compiled catalog for td055.pic.es in environment production in 4.25 seconds
Server:
time puppet master --verbose --compile td055.pic.es
[...]
real0m14.891s
user0m11.263s
sys 0m1.793s

puppet master --verbose --compile td055.pic.es|wc -l
22930


2.-) SL 6.1 puppet-2.7.11-2.el6.noarch + passenger-3.0.11

Client:
Compiled catalog for td055.pic.es in environment production in 76.99 seconds
Server:
time puppet master --verbose --compile td055.pic.es
[...]
real1m10.661s
user1m5.739s
sys 0m4.903s
puppet master --verbose --compile td055.pic.es|wc -l
22933


3.-) SL 6.1 puppet-2.7.14-1.el6.noarch + passenger-3.0.12

Client:
err: Could not retrieve catalog from remote server: execution expired
Server:
real2m13.377s
user2m7.615s
sys 0m5.728s

puppet master --verbose --compile td055.pic.es|wc -l
23008

* Obviously I'm trying to compile the same code in all cases
** I've only 8 warnings about dyanmic lookup.

As you can see, in last version it gets a timeout because it takes too
long to compile. 
So, at this point, I'm wondering what could be causing this behaviour. 
Why my code is being compiled fast in 2.6 but not in 2.7? What language
programing considerations do I have to take into account when migrating?

TIA,
Arnau

-- 
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] 12% of my puppet clients -- Could not retrieve catalog from remote server: execution expired

2012-05-08 Thread Arnau Bria
On Tue, 8 May 2012 05:35:34 -0700 (PDT)
Tim Lank wrote:

 how do I troubleshoot this error that occurs for about 12% of the
 puppet clients (~70 out of ~550.)
do they run as daemon?
always the 70 same hosts are failling?
do they run at same time?

Cheers,
Arnau 

-- 
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: Compile catalog time: 2.6 vs 2.7.X

2012-05-08 Thread Arnau Bria
On Tue, 8 May 2012 13:07:04 +0200
Arnau Bria wrote:

I should add more info on servers and manifests:

 1.-) Centos 5.8 puppet-2.6.14-1.el5 + rubygem-mongrel-1.0.1-6.el5
 
 Client:
 Compiled catalog for td055.pic.es in environment production in 4.25
 seconds Server:
 time puppet master --verbose --compile td055.pic.es
 [...]
 real  0m14.891s
 user  0m11.263s
 sys   0m1.793s
 
 puppet master --verbose --compile td055.pic.es|wc -l
 22930

4 x Intel(R) Xeon(R) CPU5160  @ 3.00GHz  8GB of RAM

 2.-) SL 6.1 puppet-2.7.11-2.el6.noarch + passenger-3.0.11
 
 Client:
 Compiled catalog for td055.pic.es in environment production in 76.99
 seconds Server:
 time puppet master --verbose --compile td055.pic.es
 [...]
 real  1m10.661s
 user  1m5.739s
 sys   0m4.903s
 puppet master --verbose --compile td055.pic.es|wc -l
 22933

4 x Intel(R) Xeon(R) CPU5160  @ 3.00GHz  8GB of RAM

 3.-) SL 6.1 puppet-2.7.14-1.el6.noarch + passenger-3.0.12
 
 Client:
 err: Could not retrieve catalog from remote server: execution expired
 Server:
 real  2m13.377s
 user  2m7.615s
 sys   0m5.728s
 
 puppet master --verbose --compile td055.pic.es|wc -l
 23008

8 x Quad-Core AMD Opteron(tm) Processor 2356  16 GB of RAM


My code has about 40 classes. I do use Stages (not a lot, for few
repos) and I have many interclass dependecy (Service require file which
require package).

Puppet is installed via yum using puppetlabs repo.
First server is shared by ~600 hosts, second one shared by ~200 nodes
and last one is only used by this test node.
 

I don't know If I could more info... I'm quiete lost.

Cheers,
Arnau

-- 
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] puppet-dashboard running on puppet-server (SL6)

2012-03-13 Thread Arnau Bria
Hi all,

I've installed a new puppet-server and I wanted to add
puppet-dash-board for reports (only). 

# rpm -qa|grep puppet|sort
puppet-2.7.11-2.el6.noarch
puppet-dashboard-1.2.6-1.el6.noarch
puppet-server-2.7.11-2.el6.noarch

So, I've followed
http://docs.puppetlabs.com/dashboard/manual/1.2/bootstrapping.html
+
http://docs.puppetlabs.com/dashboard/manual/1.2/bootstrapping.html#configuring-puppet

but I don't see any report in my dash-board.

Logs periodically show:

Processing ReportsController#upload (for X.Y.Z.W at 2012-03-13 14:38:09) [POST]
  Parameters: {controller=reports, action=upload}
Completed in 104ms (View: 0, DB: 100) | 200 OK 
[http://puppet-server-alias.domain.com/reports/upload]

and dashboard shows:

456 pending tasks.


My database.tml looks like:

production:
  database: dashboard
  username: X
  password: Y
  encoding: utf8
  adapter: mysql


Mysql databases has the correct tables;

mysql show tables
- ;
+--+
| Tables_in_dashboard  |
+--+
| delayed_job_failures |
| delayed_jobs |
[...]
| timeline_events  |
+--+
18 rows in set (0.00 sec)

Puppet.conf at master:

[master]
[...]
reports = http, store
reporturl = http://puppet-server-alias.domain.com:3000/reports/upload

and clients have reports enabled (but they run puppet 2.6.X).


I can see reports in the master:

# ls -lsa /var/lib/puppet/reports/
Display all 101 possibilities? (y or n)



Could someone help me to find what I'm missing in this conf?


TIA,
Arnau

-- 
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] puppet-dashboard running on puppet-server (SL6)

2012-03-13 Thread Arnau Bria
On Tue, 13 Mar 2012 10:20:37 -0400
Peter Bukowinski wrote:

Hi Peter,

 This is documented here:
 http://docs.puppetlabs.com/dashboard/manual/1.2/bootstrapping.html#starting-and-managing-delayed-job-workers

Thanks a lot, I can't figure out how I did not see that part of the
doc.

Cheers,
Arnau

-- 
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] Doc about RH6 + Passenger

2012-02-29 Thread Arnau Bria
On Tue, 28 Feb 2012 09:02:09 -0500
Eric Lake wrote:

 If I remember right I used a combination of mostly
 http://projects.puppetlabs.com/projects/1/wiki/Using_Passenger and a
 little of
 http://www.uncompiled.com/centos-6-puppet-27-mcollective-foreman-rabbitto
 get my install working on CentOS 6.
Thanks!

I'll take a look.


Cheers,
Arnau

-- 
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] Doc about RH6 + Passenger

2012-02-28 Thread Arnau Bria
Hi all,

I'm installing a new puppet server and I'd like to move from mongrel to
passenger. So, I'm looking for official doc abou passenger and found:

http://docs.puppetlabs.com/guides/passenger.html

the doc does not talk about RH6 nor 2.7.* ...

Anyone has configured his server with the above doc? any other
official doc with same subject?

TIA,
Arnau

-- 
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 facts loaded twice

2011-12-20 Thread Arnau Bria
Hi all,

Every time I run puppet manually I see the message:

# puppetd --test --server $SERVER
info: Retrieving plugin
info: Loading facts in hwtype
info: Loading facts in odd_ip
info: Loading facts in default_gateway
info: Loading facts in hwtype
info: Loading facts in odd_ip
info: Loading facts in default_gateway
info: Caching catalog for XX


As you can see facts are loaded twice.

Everything works fine, but I'm wondering if this is normal or we have some 
missconfiguration.

Honestly, I don't know what conf provide apart from client's puppet conf file:


[main]
# Where Puppet stores dynamic and growing data.
# The default value is '/var/puppet'.
vardir = /var/lib/puppet

# The Puppet log directory.
# The default value is '$vardir/log'.
logdir = /var/log/puppet

# Where Puppet PID files are kept.
# The default value is '$vardir/run'.
rundir = /var/run/puppet

# Where SSL certificates are kept.
# The default value is '$confdir/ssl'.
ssldir = $vardir/ssl
pluginsync = true

[agent]
# The file in which puppetd stores a list of the classes
# associated with the retrieved configuratiion.  Can be loaded in
# the separate ``puppet`` executable using the ``--loadclasses``
# option.
# The default value is '$confdir/classes.txt'.
classfile = $vardir/classes.txt

# Where puppetd caches the local configuration.  An
# extension indicating the cache format is added automatically.
# The default value is '$confdir/localconfig'.
localconfig = $vardir/localconfig
report = false

Cheers,
Arnau

-- 
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] Templates + Parameterised classes

2011-11-28 Thread Arnau Bria
On Mon, 28 Nov 2011 16:20:13 +0200
Graham Leggett wrote:

 Hi all,
Hi,
 
[...]
 I am trying to embed the parameter name using % parameter_name %
maybe:
%= parameter %

[...]

 Regards,
 Graham
HTH,
Arnau

-- 
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: declare and include classes

2011-11-23 Thread Arnau
Thanks Nan.

Cheers,
Arnau

-- 
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] declare and include classes

2011-11-22 Thread Arnau Bria
Hi all,

after moving to parametrized classes, I've started to declare them
instead of including.

Now, I'm trying to understand the differences (internal) between
declare and include, and, reading
http://docs.puppetlabs.com/guides/parameterized_classes.html again, I
found some sentence which confuses me:

Since include wasn’t designed for use with parameterized classes

I know you can't include a resource, so a class eith parameters must be
 declared. But, If I don't use params, I can include the class...

so, what are the big differnces between declare and include?

TIA,
Arnau

-- 
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] yumrepo absent not working on 2.6.12

2011-11-16 Thread Arnau Bria
Ok,

thnaks a lot.

Cheers,
Arnau

-- 
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] Multiple nodes.pp files

2011-11-16 Thread Arnau Bria
On Wed, 16 Nov 2011 15:32:41 +0100
Hugo Deprez wrote:

 Dear community,
Hi Hugo,
 
 I would like to know if it is possible to use different files for the
 nodes.pp
 
 Can we use in nodes.pp the following syntax :
 
 include nodes2.pp

we have several node files but use import.


[...]
 Thank you.
 
 hugo
HTH,
Arnau

-- 
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] yumrepo absent not working on 2.6.12

2011-11-15 Thread Arnau Bria
Hi all,

Seems that ensure   = absent is not working on puppet 2.6.12
yumrepo type.

'sl-5.5-base' :
  baseurl = 'http://reposerver/computing-SL-55-base-x86_64/RPMS.base/',
  descr   = 'SL 5.5 base',
  enabled = absent,
  exclude = 'yum-conf* c-ares';

# ls -lsa /etc/yum.repos.d/sl-5.5-base.repo 
4 -rw-r--r-- 1 root root 187 Nov 15 15:35 /etc/yum.repos.d/sl-5.5-base.repo

#puppetd --test --server $server
[...]
info: create new repo sl-5.5-base in file /etc/yum.repos.d/sl-5.5-base.repo
notice: 
/Stage[pre]/Common::Os::Release5::Sl55::Repos/Yumrepo[sl-5.5-base]/descr: descr 
changed '' to 'SL 5.5 base'
notice: 
/Stage[pre]/Common::Os::Release5::Sl55::Repos/Yumrepo[sl-5.5-base]/baseurl: 
baseurl changed '' to 'http://reposerver/computing-SL-55-base-x86_64/RPMS.bas
e/'
notice: 
/Stage[pre]/Common::Os::Release5::Sl55::Repos/Yumrepo[sl-5.5-base]/gpgcheck: 
gpgcheck changed '' to '0'
notice: 
/Stage[pre]/Common::Os::Release5::Sl55::Repos/Yumrepo[sl-5.5-base]/exclude: 
exclude changed '' to 'yum-conf* c-ares'
notice: 
/Stage[pre]/Common::Os::Release5::Sl55::Repos/Yumrepo[sl-5.5-base]/enablegroups:
 enablegroups changed '' to '1'
notice: 
/Stage[pre]/Common::Os::Release5::Sl55::Repos/Yumrepo[sl-5.5-base]/metadata_expire:
 metadata_expire changed '' to '43200'
info: changing mode of /etc/yum.repos.d/sl-5.5-base.repo from 600 to 644
info: create new repo sl-5.5-fastbugs in file 
/etc/yum.repos.d/sl-5.5-fastbugs.repo
[...]

notice that enabled parameter is ignored


I've been looking at list and bug and only found something nearly
related:
http://projects.puppetlabs.com/issues/9410

but it's not my problem.


Is this a know problem/bug? 

TIA,
Arnau

-- 
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: yumrepo absent not working on 2.6.12

2011-11-15 Thread Arnau Bria
Sorry,

forgot to mention that if we set 0 instead of absent, the parameter
works:

notice: 
/Stage[pre]/Common::Os::Release5::Sl55::Repos/Yumrepo[sl-5.5-base]/enabled: 
enabled changed '' to '0'

Cheers,
Arnau

-- 
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] Re: yumrepo absent not working on 2.6.12

2011-11-15 Thread Arnau Bria
On Tue, 15 Nov 2011 10:06:43 -0500
Nan Liu wrote:

[...]
 A quick glance at the type shows you need to set 1 or 0, absent means
 the property should not exist rather than puppet should configure the
 value to 0. 
Ok. I understood that absent removes the file. My fault.

any way for removing the repo without using a file type?


Many thanks for your reply Nan,
Arnau

-- 
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] problems with concat

2011-11-02 Thread Arnau Bria
Hi all,

I've downloaded and installed puppet-concat module and was trying to
use it.

After reading doc, I've set concatdir to /tmp only for test purpose,
but I'm wondering what is a good value for concatdir.
Maybe /var/lib/puppet/concat? I guess I have to create it, am I right?

So, following the example at github, I've created some code like:

class common::sudo {
include concat::setup
concat::fragment{'test_2' :
target  = '/etc/sudoers' ,
content = test;
}
}

And then:

node 'Node' {
class {
'common::sudo' : ;
}
}

But I get the error:

err: Failed to apply catalog: Could not find dependent
Exec[concat_/etc/sudoers] for
File[/tmp/_etc_sudoers/fragments/10_test_2]
at /etc/puppet/modules/concat/manifests/fragment.pp:48


What am I doing wrong? Anyone has seen this error before?

TIA,
Arnau

-- 
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] problems with concat

2011-11-02 Thread Arnau Bria
On Wed, 02 Nov 2011 11:22:05 - (GMT)
R.I.Pienaar R.I.Pienaar wrote:

 you're missing the concat{/etc/sudoers: }
 
 # set up a file for being managed by snippets
 concat{somefile: } 
 
 # add a snippet to it:
 concat::fragment{foo:.}
 
 needs both

solved.

Thanks !
Arnau

-- 
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] rpm packages for el4

2011-10-27 Thread Arnau Bria
On Wed, 26 Oct 2011 14:29:32 -0700
Michael Stahnke wrote:

Hi Michael,

 We've discussed it.  The issue is that el4 ships with ruby 1.8.1.
 Puppet doesn't work to well with 1.8.1 any more.  If you rebuild or
 pull in a newer ruby stack (even 1.8.5) then the el5 rpms probably
 work.

Ok.  I'll look if thoses hosts have any ruby dependency more than
pupppet.

 Keep in mind el4 goes End of Life Feb 29, 2012.  So, there isn't too
 much time left on it either.
I know. But we have some services which are still not ported to el5.
 
 
 Mike
Thanks,
Arnau

-- 
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] rpm packages for el4

2011-10-27 Thread Arnau Bria
Mike,

where is the tarball for 2.6.12-2 ?

I can't find it at http://downloads.puppetlabs.com/puppet/

Cheers,
Arnau

-- 
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] rpm packages for el4

2011-10-27 Thread Arnau Bria
On Thu, 27 Oct 2011 11:04:35 +0200
Arnau Bria wrote:

 Mike,
 
 where is the tarball for 2.6.12-2 ?
 
 I can't find it at http://downloads.puppetlabs.com/puppet/
I found src.rpm for el5.

http://yum.puppetlabs.com/el/5/products/SRPMS/

Cheers,
Arnau

-- 
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] rpm packages for el4

2011-10-26 Thread Arnau Bria
Hi all,


anyone has created the rpm packages of new versions for el4?

only 5/6 at http://yum.puppetlabs.com/el/


TIA,
Arnau

-- 
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] Variables syntax

2011-10-19 Thread Arnau Bria
On Mon, 17 Oct 2011 17:53:39 +0200
Martijn Grendelman wrote:

 Hi,
Hi,

[...] 
 These give me errors like:
 
   Could not parse for environment production: Could not match
 ${::operatingsystem} at...
Where are you setting those vars?

I've seen that, on 2.6, setting those vars in selectors does not work.

source  = $operatingsystem ? {
 
 Isn't that supposed to work?
 
 Best regards,
 Martijn Grendelman
HTH,
Arnau 

-- 
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] how to modify a parameter inside a parametrized class

2011-10-07 Thread Arnau Bria
Hi all,

I think I'm not understanding something... 

from http://docs.puppetlabs.com/guides/parameterized_classes.html :

The parameters you name can be used as normal local variables
throughout the class definition

so, I have a class like:

class common::nrpe($ensure='absent') {
[...]

if ($::kernel=='Linux') and ($::lsbmajdistrelease=='6') {
$ensure='present'
}

so, by default the class is dissabled, but if it's a Linux release 6,
the value must be present.

so, I define the class in a Linux release 6 like:

nodes 'test' {
class { 'common::nrpe' : } 
}


pupet fails with error:

Cannot reassign variable ensure

So, what am I missunderstanding? What is the correct way for doing what
I'm trying?


TIA,
Arnau

-- 
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] Re: how to modify a parameter inside a parametrized class

2011-10-07 Thread Arnau Bria
On Fri, 7 Oct 2011 05:55:34 -0700 (PDT)
jcbollinger jcbollinger wrote:

Hi John,

 You are misunderstanding that Puppet variables' values can never be
 reassigned.  Once a variable has a value, it never changes throughout
 the compilation of that catalog.  This is an aspect of Puppet DSL's
 declarative nature.
 
 As to how to accomplish what you ask, the usual way would be to use
 the parameter and any other data you want to select the value of a
 *different* variable, and then use that second variable.  The same
 thing is fairly common practice in defined types:
 
 class common::nrpe($ensure='absent') {
 [...]
 
 if ($::kernel=='Linux') and ($::lsbmajdistrelease=='6') {
   $really_ensure = 'present'
 } else {
   $really_ensure = $ensure
 }
 
 [...]
 
 }

Ok, I solved the issue with something like that but I thought it was
some kind of ugly workaround... but if it's common I feel better with my
code.


 While I'm on this topic, I'll throw in that I would find it terribly
 confusing if a class or definition failed to honor my specification
 for a parameter named 'ensure'.  

Sorry John, but I don't understand this point.

 I'd also find it confusing, though
 less so, for the default value of an 'ensure' parameter to be
 'absent'.  I recommend that you tweak your design a bit so as to not
 leave little traps like those for yourself and others to stumble over
 later.  Or at least document the wazoo out of that thing.

I'm playing with this class. First time I do something like above.
Our production services have a default present, but this one is still
in test and I'd like to test it only on Linux 6., so I was playing with
logic inside new class :-)
 
 John
Many thanks for your reply,
Arnau

-- 
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] Re: how to modify a parameter inside a parametrized class

2011-10-07 Thread Arnau Bria
On Fri, 7 Oct 2011 06:34:00 -0700 (PDT)
jcbollinger jcbollinger wrote:

 On Oct 7, 8:11 am, Arnau Bria arnaub...@pic.es wrote:
  On Fri, 7 Oct 2011 05:55:34 -0700 (PDT)
 
  jcbollinger jcbollinger wrote:
   While I'm on this topic, I'll throw in that I would find it
   terribly confusing if a class or definition failed to honor my
   specification for a parameter named 'ensure'.  
 
  Sorry John, but I don't understand this point.
 
 Because of the consistent manner of ensure parameters' use in
 Puppet's built-in resources, and the associated conventions even for
 custom and defined types, I would be very surprised if I ever declared
 something with ensure = 'absent' but that specification was
 overridden to the opposite.  Indeed, I would be at least somewhat
 surprised by that with *any* parameter.  Don't give me the option if
 you don't intend to honor it.

Ok, now it's clear.
I should put that logic outside the class, in node/param definitions ..
something like:

if ($::kernel=='Linux') and ($::lsbmajdistrelease=='6') {
class { 'common::nrpe' :
ensure = absnet,
}else{
class { 'common::nrpe' :
ensure = present,
}

 
 Inasmuch as this is for testing purposes, however, that's a different
 story.  I don't think I would test in the way you are doing, but then
 again, maybe I would.

 
 John
 
Many thanks for your reply,
Arnau

-- 
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] Re: qualified variables in templates

2011-09-21 Thread Arnau Bria
Ok.
so template and class share the scope and tehre's no need to qualify its
vars.

Thanks for your replies and for the link.
Cheers,
Arnau

-- 
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] qualified variables in templates

2011-09-20 Thread Arnau Bria
Hi all,

is there a way for qualifying variables inside a template?
I've tried :

Name = %= ${::hostname} %

but the var gets ${::hostname} value.

thinking in version 2.8, is it needed?
http://docs.puppetlabs.com/guides/scope_and_puppet.html says nothing
about this...


TIA,
Arnau

-- 
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] Parameterized class of Parameterized classes

2011-09-20 Thread Arnau Bria
Hi all,

is there any problem in creating a parameterized class of parameterized
classes? 
something like:

class A ($var1,$var2,$var3) {
class { 'B' :
param   = ${var1} ;
'C' :
param   = ${var2} ;
'D' :
param   = ${var3} ;
}
}

node Z {
class { 'A' :
var1= 'value1',
var2= 'value2',
var3= 'value3',
}
}


This is working fine in my test set (2.7.3), but I'm wondering if this
could cause issues in any way (most probably scope), or there's a
better way for grouping several classes into one (avoiding inheritance).


TIA,
Arnau

-- 
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: Scope and puppet 2.7

2011-09-15 Thread Arnau Bria
On Wed, 14 Sep 2011 15:16:45 +0200
Arnau Bria wrote:

 Hi all,
Hi !

I reply myself... maybe it's useful for someone in the future.
 
 I'm planning to upgrade our server/client to 2.7 and would like to
 completely understand the big change in the dynamic scope deprecation.
 
 
 It says that 2.7 will issue deprecation warning. Ok, so I've upgraded
 a test server, test node and moved my code there. ran puppet and  no
 warnings. Great!

Warning are logged into puppetmaster log, not at client level.
 
[...]
 So,i.e, $mcast_ip and $cluster which refer to ganglia module should
 they be renamed to $common::ganglia::mcast_ip and
 $common::ganglia::cluster ?
 
 Cause this is not working and giving a error:
 
 Cannot assign to variables in other namespaces
from: http://docs.puppetlabs.com/guides/language_guide.html

Qualified variables are read-only — you cannot set a variable’s value
from other class.

so, the var's value must be set inside the class (local scope) or in
the top (outside any class in site.pp). 


Cheers,
Arnau

-- 
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] Scope and puppet 2.7

2011-09-14 Thread Arnau Bria
Hi all,

I'm planning to upgrade our server/client to 2.7 and would like to
completely understand the big change in the dynamic scope deprecation.


It says that 2.7 will issue deprecation warning. Ok, so I've upgraded a
test server, test node and moved my code there. ran puppet and  no
warnings. Great!

So, now, I'd like to qualify my vars. In a code like:

class global_defaults {
include common::ganglia
include common::bacula
[...]
include common::snmp
}


node 'mynode' {
$mcast_ip = '22.22.11.11'
$cluster = 'Test'
$pakiti_tag = 'tag1'
$grid_service = 'ui'
$root_password = 'ui'
$rootkit_detector_mail = 'arnaubria_at_my_domain'
include global_defaults
}


all the vars defined into mynode refer to classes included in
global_defaults.

So,i.e, $mcast_ip and $cluster which refer to ganglia module should
they be renamed to $common::ganglia::mcast_ip and
$common::ganglia::cluster ?

Cause this is not working and giving a error:

Cannot assign to variables in other namespaces

**same if I declare them global variables $::mcast_ip

So, what's wrong with my code? why I can't rename my vars to new syntax?


TIA,
Arnau

-- 
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] Module organization: file serving

2011-08-30 Thread Arnau Bria
On Mon, 29 Aug 2011 10:04:42 -0700
Nigel Kersten wrote:

 On Mon, Aug 29, 2011 at 8:23 AM, Arnau Bria arnaub...@pic.es wrote:

Hi Nigel,

I think my question was not clear:
 
  MODULE_PATH
  |-module_name
 |-files
 |-manifests
 |-foo.pp
 |-bar
 |-bar.pp
 
 
  My question is: is there a similar behaviour for file serving? May I
  create a file dir under bar directory and serve files from there?
 
 
 Yes.
 
 $module_name/files/foo/bar/baz
 
 is
 
 puppet:///modules/$module_name/foo/bar/baz

and:

$module_name/manifests/bar/files/baz?

is accessible?

Cheers,
Arnau

-- 
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] Module organization: file serving

2011-08-30 Thread Arnau Bria
On Tue, 30 Aug 2011 09:44:59 -0400
Nan Liu wrote:

Hi Nan,

 No, files in the manifests directory are not accesible through source
 = puppet:///... The manifests directory is intended to be
 inaccessible to the agent since it contains files that should be
 compiled on the master. 

thanks. now it's clear. What I request is impossible.

 Any reason, you intend to give the agent
 access to the manifests directory instead of using the files
 directory?

No, I simply thought that could be easy to manage files if they are
stored under each subdirectory. Anyway, I'll create a similar
manifests tree under files directory.

 MODULE_PATH
 |-module_name
|-files
|-bar
   |-baz
|-manifests
|-foo.pp
|-bar
|-bar.pp
 
 So for the agent to retrieve files/bar/baz:
 source = ${module_name}/bar/baz

Yep, that's how we current work.

Thanks for your reply.
 
 Thanks,
 Nan
Cheers,
Arnau

-- 
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] Module organization: file serving

2011-08-29 Thread Arnau Bria
Hi all,

Puppet's module organization looks like:

MODULE_PATH
|-module_name
|-files
|-manifests
|-foo.pp
|-bar
|-bar.pp


And module autoloading will find bar.pp if I define it as

module_name::bar::bar

My question is: is there a similar behaviour for file serving? May I
create a file dir under bar directory and serve files from there?

I don't find find refenreces to such behaviour at
http://docs.puppetlabs.com/guides/modules.html ... and my test don't
work.

TIA,
Arnau

-- 
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] mount remounts not working

2011-08-17 Thread Arnau Bria
On Tue, 16 Aug 2011 18:31:48 +0200
Stefan Schulte wrote:

[...]
 Solution: remove the name (so name will implicitly be /srv/cloud) or
 change name to /srv/cloud (with no trailing slash)
 
 FTW: This is filed as https://projects.puppetlabs.com/issues/6793
thanks a lot!

 -Stefan
Cheers,
Arnau

-- 
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] mount remounts not working

2011-08-16 Thread Arnau Bria
Hi all,

I have some code like:

{
'/srv/cloud' :
name = '/srv/cloud/' ,
atboot   = true ,
device   = 'iscsidisk01.domain.org:/volumes/POOL/one' ,
fstype   = 'nfs' ,
remounts = true ,
options  = 'defaults' ,
ensure   = 'mounted' ,
require  = File['/srv/cloud'] ;
}

So I'd like to use remount at mount time, but puppet does:

Execution of '/bin/mount -o defaults /srv/cloud/' instead of:

/bin/mount -o remount /srv/cloud/

and that make puppet fail.

Am I miss-understanding remount option? is there any problem with it?

$rpm -qa|grep puppet
puppet-2.6.8-1.el6.noarch

$cat /etc/redhat-release 
Scientific Linux release 6.0 (Carbon)


TIA,
Arnau

-- 
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] Re: cleaning puppet dashboard

2011-08-12 Thread Arnau Bria
On Thu, 11 Aug 2011 08:36:41 -0700 (PDT)
Luke Bigum wrote:

 Hi Arnau,
Hi Luke,
 
 This is not a Puppet Dashboard problem, it's a MySQL feature of
 InnoDB. You're using per-table InnoDB data files. InnoDB data files
 grow. They never, ever, ever shrink. So what you've got there is a
 22GB sparse file that MySQL will fill up with more resource_statuses
 rows. It won't use that space for any other table because you've for
 per-table InnoDB data files configured on.

You're right!! 
 
 I *think* one solution is to convert the resource_statuses to MyISAM
 then back to InnoDB again but I've never done it. Another way is to
 dump the database out, blow away the InnoDB data files and import the
 dump (see
 http://dev.mysql.com/doc/refman/5.5/en/innodb-data-log-reconfiguration.html).

I'll try to do so.
 
 Hope that helps,
it does.
 
 -Luke
Cheers,
Arnau

-- 
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] Re: cleaning puppet dashboard

2011-08-12 Thread Arnau Bria
On Thu, 11 Aug 2011 08:36:41 -0700 (PDT)
Luke Bigum wrote:

 Hi Arnau,
Hi Luke,

[...] 
 dump the database out, blow away the InnoDB data files and import the
 dump (see
 http://dev.mysql.com/doc/refman/5.5/en/innodb-data-log-reconfiguration.html).

I'm dumping my dashboard data.  My cron prunes de DB and keeps 1 week
info. I have about ~100 nodes in that server and the dump is 6GB and
grwoing... is that size normal? I mean, what's the normal size for
the scenario I've described? (I know it depends on the amount os
resoruces, but do you have any approach?)


 Hope that helps,
 
 -Luke
Cheers,
Arnau

-- 
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] cleaning puppet dashboard

2011-08-11 Thread Arnau Bria
Hi all,

I have a cron that follows
http://docs.puppetlabs.com/dashboard/manual/1.2/maintaining.html and
cleans our puppet dashboard:

[...]
rake RAILS_ENV=production reports:prune upto=1 unit=wk
rake RAILS_ENV=production db:raw:optimize
[...]

but I've found a table which is 22GB and I'm not able to clean its space:


22G -rw-rw 1 mysql mysql  22G Aug 11 17:15 resource_statuses.ibd

Our DB started to work on March, so I've removed all table entries
before July, but the table is still 22GB .

mysql delete from resource_statuses where time  2011-07-12%;
Query OK, 76040474 rows affected (1 hour 50 min 2.07 sec)

So, how may I get some free space from dashboard DB?

TIA,
Arnau

-- 
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] autosign by hostname not working?

2011-05-20 Thread Arnau Bria
On Thu, 19 May 2011 09:10:22 -0700
Patrick Patrick wrote:

Hi,

 Sorry.  I ready your whole email backwords.  I can only blame being
 tired. 
no problem!
 
 Did you clean using puppetca --clean hostname on the server, by
 using rm on the client, or both?

clean on the server.
 
 Are you using Passenger?
Mongrel

That was the source of the issue

I had to restart http/puppetmaster for new autosign to take effect.

Now it works fine. I can block/unblock hosts with autosign.

Thanks!

Cheers,
Arnau

-- 
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] autosign by hostname not working?

2011-05-20 Thread Arnau Bria
On Thu, 19 May 2011 23:46:32 +
Nan Liu wrote:


thanks Nan,

with your help and Patrick's I've understood the problem and solved.


Many thanks for you reply!

Cheers,
Arnau

-- 
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] autosign by hostname not working?

2011-05-19 Thread Arnau Bria
Hi all,

till today we had a *.our.doamin in autosign.conf. So any host from
our.domain could get a signed certificate if it contacts our master.
But we've decide to move that * to a complet list of hostnames.

So, I've pasted all the names to autosign file, restarted master (not
sure if needed) So far, so good. So, I removed one name from autosign
file, clean its cert, and ran puppet on the host, but it's still able
to contact master and get its catalogue when it's supposed to get any
kind of error.

So, how is it possible? where am I'm missunderstanding autosign
behiavour?

# puppetmasterd --genconfig|grep autosign
# Whether to enable autosign.  Valid values are true (which
# autosigns any key request, and is a very bad idea), false (which
# never autosigns any key request), and the path to a file, which
# The default value is '$confdir/autosign.conf'.
autosign = /etc/puppet/autosign.conf

# wc -l /etc/puppet/autosign.conf
660 /etc/puppet/autosign.conf
# grep tditaller027.pic.es /etc/puppet/autosign.conf
# 

[root@tditaller027 ~]# puppetd --test --server ser01.pic.es
info: Retrieving plugin
info: Loading facts in odd_ip
info: Loading facts in odd_ip
info: Caching catalog for tditaller027.pic.es
info: Applying configuration version '1305815351'
notice: Finished catalog run in 33.76 seconds

# rpm -qa|grep puppet
puppet-2.6.1-0.6.el5
puppet-server-2.6.1-0.6.el5

same version on client.

TIA,
Arnau

-- 
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] how to add same ssh_key to two diff accounts

2011-05-12 Thread Arnau Bria
On Thu, 12 May 2011 09:59:21 +0200
Felix Frank wrote:

 On 05/11/2011 05:36 PM, Arnau Bria wrote:
  If you're keen to get it anyway, you may want to open a ticket.
  I think I've already asked here... but I have an example where that
  feature is really interesting: we have some user pool, aout 1000
  users, and I'd like to distrbute one key to all those users. Why the
  trivial workaround, I could do it, but with 1000 lines :-)
 
 That's just not true.
 
 You surely have some defined type for your users, no? Such as
Nop, we use an other software for creating those users.
So, I must redefine each key for each user, and then my problem
appears. 

[...]
 my_user($fullname) {
   user { $name: fullname = $fullname, ... }
   ssh_authorized_key { key-for-$name:
 user = $name,
 key = AAznbwet...,
 ...
   }
 }

 That's what I meant - the workaround is really *that* trivial.
 
 I'm quite sure you'll have a hard time finding a use case that really
 requires the authorized key resource to be effective for multiple
 target users.

From your example I think I can play with a false define for something
else trivial and add my key there 


 Regards,
 Felix
Cheers,
Arnau

-- 
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] how to add same ssh_key to two diff accounts

2011-05-11 Thread Arnau Bria
On Tue, 10 May 2011 12:48:21 +0200
Felix Frank wrote:

  Do you know if this is going to be supportted in future?
 
 Redeclaration of the same resource is not going to work ;-)

:-)
 
 As for the distribution of one authorized_key to multiple user
 accounts...I'm not sure that it's as useful as it sounds, given the
 trivial workaround.
 
 If you're keen to get it anyway, you may want to open a ticket.
I think I've already asked here... but I have an example where that
feature is really interesting: we have some user pool, aout 1000
users, and I'd like to distrbute one key to all those users. Why the
trivial workaround, I could do it, but with 1000 lines :-)

so, I'll open a ticket and pray for developers finding it interesting
too. 

 Regards,
 Felix
Many thanks for your reply,
Cheers,
Arnau

-- 
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] how to add same ssh_key to two diff accounts

2011-05-10 Thread Arnau Bria
Hi all,

I'm trying to add same ssh key to two diff accounts and I'm getting
an error.

My code:
'key_1'
name= 'arnau@my_pc.domain',
user= 'user1',
key = rsa_key;

'key_2':
name= 'arnau@my_pc.domain',
user= 'user2',
key = rsa_key;

On the client the error is:


err: Could not retrieve catalog from remote server: Error 400 on SERVER: 
Puppet::Parser::AST::Resource failed with error ArgumentError: Cannot alias 
Ssh_authorized_key[key_1] to [arnau@my_pc.domain]; resource 
[Ssh_authorized_key, [arnau@my_pc.domain]] already exists at 
/etc/puppet/manifests/services/common/modules/common_si/manifests/init.pp:165 
on node X.pic.es

Is there something wrong in my code?
Am I trying to do something not supported? 
Anyone faced this before? how did you solve it?

TIA,
Arnau

-- 
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] how to add same ssh_key to two diff accounts

2011-05-10 Thread Arnau Bria
On Tue, 10 May 2011 12:26:06 +0200
Felix Frank wrote:

 Hi,
Hi Felix,
 
  Am I trying to do something not supported?
 
 Yes.
Do you know if this is going to be supportted in future?
 
 Just rename on of the keys. The name of a public key is really quite
 arbitrary and SSH doesn't use it for anything important (that I am
 aware of).
thanks, that worked perfectly!
 
 Cheers,
 Felix
Cheers,
Arnau

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



  1   2   3   >