Re: [Puppet Users] Virtual resources ?

2016-03-31 Thread Jakov Sosic

On 03/31/2016 05:40 PM, Martin Alfke wrote:

Generally it works:
https://github.com/puppetlabs/puppet/blob/master/lib/puppet/parser/functions/create_resources.rb

But no longer required since Puppet 4:
https://docs.puppetlabs.com/puppet/latest/reference/lang_resources_advanced.html#implementing-the-createresources-function


Thanks!

I've decided to stick with create_resources :)

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


Re: [Puppet Users] Virtual resources ?

2016-03-31 Thread Martin Alfke

On 31 Mar 2016, at 17:28, Jakov Sosic  wrote:

> On 03/31/2016 05:10 PM, Martin Alfke wrote:
> 
>> You are passing a Hash as an parameter to a define.
>> Inside the define you expect the parameter to be of type String - according 
>> to what you do in the define.
>> 
>> You need to take care of splitting data accordingly in your define:
>> With Puppet 4 this is very easy to achieve:
>> 
>> define basket (
>>   Hash $arg,
>> ){
>>   $arg.each |String $key, Hash $value| {
>> file { “/tmp/${key}”:
>>   ensure => file,
>>   content => $value[‘arg’],
>> }
>>   }
>> }
> 
> 
> Thanks for an idea. I didn't know something like that is possible...
> 
> 
> 
> Why couldn't I just use create_resources? If I try with create_resources:
> 
> create_resources(@basket, $foobar)
> 
> 
> I get this:
> 
> Error: Could not parse for environment production: Virtual (@) can only be 
> applied to a Resource Expression at /tmp/pero.pp:16:1 on node workstation

You need to fix the content of $foobar

Generally it works:
https://github.com/puppetlabs/puppet/blob/master/lib/puppet/parser/functions/create_resources.rb

But no longer required since Puppet 4:
https://docs.puppetlabs.com/puppet/latest/reference/lang_resources_advanced.html#implementing-the-createresources-function


> 
> -- 
> 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/56FD423A.2080203%40gmail.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/75C2B4D4-EB13-4536-A347-032A018AEAD0%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Virtual resources ?

2016-03-31 Thread Jakov Sosic

On 03/31/2016 05:10 PM, Martin Alfke wrote:


You are passing a Hash as an parameter to a define.
Inside the define you expect the parameter to be of type String - according to 
what you do in the define.

You need to take care of splitting data accordingly in your define:
With Puppet 4 this is very easy to achieve:

define basket (
   Hash $arg,
){
   $arg.each |String $key, Hash $value| {
 file { “/tmp/${key}”:
   ensure => file,
   content => $value[‘arg’],
 }
   }
}



Thanks for an idea. I didn't know something like that is possible...



Why couldn't I just use create_resources? If I try with create_resources:

create_resources(@basket, $foobar)


I get this:

Error: Could not parse for environment production: Virtual (@) can only 
be applied to a Resource Expression at /tmp/pero.pp:16:1 on node workstation


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


Re: [Puppet Users] Virtual resources ?

2016-03-31 Thread Martin Alfke
Hi,

On 31 Mar 2016, at 16:38, Jakov Sosic  wrote:

> Hi guys,
> 
> I have a `test.pp` manifest that looks like:
> 
> 
> ```
> define basket($arg) {
>  file { "/tmp/$name":
>ensure  => present,
>content => $arg,
>  }
> }
> 
> foobar = {
>  'fruit' => { arg => 'apple' },
>  'berry' => { arg => 'watermelon' }
> }
> 
> @basket[$foobar]
> 
> realize( Basket[fruit] )
> realize( Basket[berry] )
> ```
> 
> 
> When I run `puppet apply test.pp`, this is what I get:
> 
> Error: Could not parse for environment production: Virtual (@) can only be 
> applied to a Resource Expression at /tmp/pero.pp:16:1 on node workstation

You are passing a Hash as an parameter to a define.
Inside the define you expect the parameter to be of type String - according to 
what you do in the define.

You need to take care of splitting data accordingly in your define:
With Puppet 4 this is very easy to achieve:

define basket (
  Hash $arg,
){
  $arg.each |String $key, Hash $value| {
file { “/tmp/${key}”:
  ensure => file,
  content => $value[‘arg’],
}
  }
}

hth,
Martin

> 
> 
> Any ideas?
> 
> -- 
> 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/56FD367F.9%40gmail.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/69D9ED57-136E-4394-9404-F85DC1E5B413%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Virtual resources not refreshing, how to clean out and re-do?

2015-08-06 Thread jcbollinger


On Wednesday, August 5, 2015 at 3:24:33 PM UTC-5, Steve Wray wrote:

 Oh thanks, that worked. 

 I guess I was confused with the semantics of 'clean' and 'deactivate' and 
 thought 'deactivate' would... deactivate the node not just 'clean' out its 
 virtual resources :)

 It would be nice if there was a curl interface for puppetdb to delete 
 specific virtual resources! So far as I can tell it doesn't work with -X 
 DELETE at all.



For future reference, the term you are looking for is *exported* resource.  
Virtual resources are a different, albeit related, thing.  Exported 
resources are primarily for collection and application on nodes different 
from the one that declares them.  Virtual resources can be collected / 
realized and applied only to the same node that declares them.


John

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/e34f46c7-f938-4605-a059-102cdfbc6545%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Virtual resources not refreshing, how to clean out and re-do?

2015-08-05 Thread Steve Wray
I have a problem where a virtual resource has, in an early run, got the 
wrong value. I've fixed the manifest so that the virtual resource gets the 
correct values and I've rerun Puppet on the node that populates the virtual 
resource. However when it is instantiated it still gets the old value.

I've used 'puppet node clean' for both the node where the virtual resource 
is created/populated and on the node where the virtual resource is 
instantiated and its still coming in with the wrong value. 

If I drop the puppetdb database (its postgres) and rerun Puppet on both 
sides the virtual resource gets the correct new values. 

This seems like a very extreme measure for an environment with many nodes 
and many virtual resources, just to clean out one incorrect value.

What is the correct way to fix this situation?

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/72cfddcf-151f-4615-8e30-0e6594161213%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Virtual resources not refreshing, how to clean out and re-do?

2015-08-05 Thread Matthew Burgess
On 5 Aug 2015 19:10, Steve Wray st...@wtfast.com wrote:

 I have a problem where a virtual resource has, in an early run, got the
wrong value. I've fixed the manifest so that the virtual resource gets the
correct values and I've rerun Puppet on the node that populates the virtual
resource. However when it is instantiated it still gets the old value.

 I've used 'puppet node clean' for both the node where the virtual
resource is created/populated and on the node where the virtual resource is
instantiated and its still coming in with the wrong value.

 If I drop the puppetdb database (its postgres) and rerun Puppet on both
sides the virtual resource gets the correct new values.

 This seems like a very extreme measure for an environment with many nodes
and many virtual resources, just to clean out one incorrect value.

 What is the correct way to fix this situation?

Run

puppet node deactivate agent-hostname

on your master. That nullifies all exported resources for that host, which
then get repopulated on the next agent run.

Matt.

-- 
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/CAKUTv3L%3D9V%3DZ%2BG7ogDjrkXMgR%2Be0UkDd%3DOi3gB0XL_%2BatA8bpw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Virtual resources not refreshing, how to clean out and re-do?

2015-08-05 Thread Steve Wray
Oh thanks, that worked. 

I guess I was confused with the semantics of 'clean' and 'deactivate' and 
thought 'deactivate' would... deactivate the node not just 'clean' out its 
virtual resources :)

It would be nice if there was a curl interface for puppetdb to delete 
specific virtual resources! So far as I can tell it doesn't work with -X 
DELETE at all.



On Wednesday, August 5, 2015 at 11:28:49 AM UTC-7, Matthew Burgess wrote:

 On 5 Aug 2015 19:10, Steve Wray st...@wtfast.com javascript: wrote:
 
  I have a problem where a virtual resource has, in an early run, got the 
 wrong value. I've fixed the manifest so that the virtual resource gets the 
 correct values and I've rerun Puppet on the node that populates the virtual 
 resource. However when it is instantiated it still gets the old value.
 
  I've used 'puppet node clean' for both the node where the virtual 
 resource is created/populated and on the node where the virtual resource is 
 instantiated and its still coming in with the wrong value. 
 
  If I drop the puppetdb database (its postgres) and rerun Puppet on both 
 sides the virtual resource gets the correct new values. 
 
  This seems like a very extreme measure for an environment with many 
 nodes and many virtual resources, just to clean out one incorrect value.
 
  What is the correct way to fix this situation?

 Run

 puppet node deactivate agent-hostname

 on your master. That nullifies all exported resources for that host, which 
 then get repopulated on the next agent run.

 Matt.


-- 
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/c9195c3b-6d1a-4c95-bbaf-ae47606e30af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Virtual resources, collectors, and overrides.

2015-07-17 Thread Robert Davidson
When collecting virtual resources, is there a way to override them to *remove* 
specific attributes?

For example, I have a set of service definitions with requires, and I want to 
collect them without those. (It's rather more complicated than that, but 
illustrates what I want to do.) Is this even possible? I haven't found a way 
yet.

-- 
Robert Davidson

-- 
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/1EE73329D6577F44A3C2FB0F7D4ACAE98CF32299%40mbx-02.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Virtual resources, collectors, and overrides.

2015-07-17 Thread Hunter Haugen
Both of these methods seems to work on puppet 4, and you could try on
puppet 3:

@notify { 'one': before = Notify['two'], }
@notify { 'two': }
Notify | title == 'one' | {
  before = undef,
}

OR

@notify { 'one': before = Notify['two'], }
@notify { 'two': }
Notify | title == 'one' | {
  before = [],
}

On Fri, Jul 17, 2015 at 12:28 PM Robert Davidson 
robert.david...@nominum.com wrote:

 When collecting virtual resources, is there a way to override them to
 *remove* specific attributes?

 For example, I have a set of service definitions with requires, and I want
 to collect them without those. (It's rather more complicated than that, but
 illustrates what I want to do.) Is this even possible? I haven't found a
 way yet.

 --
 Robert Davidson

 --
 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/1EE73329D6577F44A3C2FB0F7D4ACAE98CF32299%40mbx-02
 .
 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/CAJaQvGAb9PKPvup%2BSDLMVdSKkxibRUnNJ6Ktzr12_1Qy36er0w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Virtual Resources in PE3.7.0

2014-12-22 Thread Felix Frank
On 12/20/2014 05:35 AM, Varun Utagikar wrote:
 Am sorry for the goof up

Never mind.

Please, as originally requested, add notice() calls and notify resources
to *all* pertinent code paths, especially the body of define users::virtual.

-- 
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/54983C14.5010501%40alumni.tu-berlin.de.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Virtual Resources in PE3.7.0

2014-12-19 Thread Felix Frank
On 12/19/2014 05:08 AM, Varun Utagikar wrote:
 
 Any idea to what mistake am I doing ?

Well, kind of.

The code you posted originally was not accurate, apparently, for you are
actually declaring a virtual resource of type users::virtual::localuser
- this cannot ever be realized by a users::virtual collector.

-- 
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/5493F431.305%40alumni.tu-berlin.de.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Virtual Resources in PE3.7.0

2014-12-19 Thread Varun Utagikar
I am so sorry Felix

I was experimenting with different methods My manifest is as below (ignore 
::localuser)

/etc/puppetlabs/puppet/modules/users/manifests/init.pp
snip
class users {
notify { 'Adding User varun' : }
@users::virtual { 'varun':
uid =  1002,
pass=  '$1$Qrt51$JpQOHlU9lMpthG9U5dWiG.',
name=  'admin',
}
}
/snip 

o/p snip

snip
Debug: Executing '/sbin/chkconfig pe-mcollective'
Notice: Adding User varun
Notice: /Stage[main]/Users/Notify[Adding User varun]/message: defined 
'message' as 'Adding User varun'
Debug: /Stage[main]/Users/Notify[Adding User varun]: The container 
Class[Users] will propagate my refresh event
Debug: Class[Users]: The container Stage[main] will propagate my refresh 
event
Debug: Finishing transaction 42629900
/snip

Am sorry for the goof up :(


On Friday, 19 December 2014 15:17:40 UTC+5:30, Felix.Frank wrote:

 On 12/19/2014 05:08 AM, Varun Utagikar wrote: 
  
  Any idea to what mistake am I doing ? 

 Well, kind of. 

 The code you posted originally was not accurate, apparently, for you are 
 actually declaring a virtual resource of type users::virtual::localuser 
 - this cannot ever be realized by a users::virtual collector. 


-- 
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/c4b59ec2-d452-4560-80d6-060aca28a658%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Virtual Resources in PE3.7.0

2014-12-18 Thread Felix Frank
On 12/18/2014 08:46 AM, Varun Utagikar wrote:
 nodedefault {
 }
 ###
 node'hdpnamenode1.xor.in' {
 include users
 realize (Users::Virtual ['varun'])
 }

Weird.

Please sprinkle all the code that you pasted with notify resources and
notice() calls, so that you get immediate feedback on both master and
agent of what code paths are trodden.

For fun, try and realize using

Users::Virtual| title == 'varun' |

and even

Users::Virtual| |

Good luck,
Felix

-- 
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/54929BDB.5010303%40alumni.tu-berlin.de.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Virtual Resources in PE3.7.0

2014-12-18 Thread Felix Frank
On 12/18/2014 10:18 AM, Felix Frank wrote:
 realize (Users::Virtual ['varun'])

Oh I just noticed - are you using parser=future now?

I seem to recall a comment from Erik that the space in the resource
reference is a problem now, i.e.

Users::Virtual ['varun'] # wrong

vs

Users::Virtual['varun']  # right

...but I might have that wrong altogether.

HTH,
Felix

-- 
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/54929CC1.1010306%40alumni.tu-berlin.de.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Virtual Resources in PE3.7.0

2014-12-18 Thread Varun Utagikar
Hey Felix

I tried realizing the user via :

Users::Virtual| title == 'varun' | and also with
realize Users::Virtual['varun']

but to no avail.

I put a notify in my manifest but it gives no significant o/p help just :

/etc/puppetlabs/puppet/modules/users/manifests/init.pp
snip
class users {
notify { 'Adding User varun' : }
@users::virtual::localuser { 'varun':
uid =  1002,
pass=  '$1$Qrt51$JpQOHlU9lMpthG9U5dWiG.',
name=  'admin',
}
}
/snip 

o/p snip

snip
Debug: Executing '/sbin/chkconfig pe-mcollective'
Notice: Adding User varun
Notice: /Stage[main]/Users/Notify[Adding User varun]/message: defined 
'message' as 'Adding User varun'
Debug: /Stage[main]/Users/Notify[Adding User varun]: The container 
Class[Users] will propagate my refresh event
Debug: Class[Users]: The container Stage[main] will propagate my refresh 
event
Debug: Finishing transaction 42629900
/snip

Any idea to what mistake am I doing ?

Thanks
Varun

On Thursday, 18 December 2014 14:52:17 UTC+5:30, Felix.Frank wrote:

 On 12/18/2014 10:18 AM, Felix Frank wrote: 
  realize (Users::Virtual ['varun']) 

 Oh I just noticed - are you using parser=future now? 

 I seem to recall a comment from Erik that the space in the resource 
 reference is a problem now, i.e. 

 Users::Virtual ['varun'] # wrong 

 vs 

 Users::Virtual['varun']  # right 

 ...but I might have that wrong altogether. 

 HTH, 
 Felix 


-- 
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/5c04d787-1a19-4681-b124-15aa605608b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Virtual Resources in PE3.7.0

2014-12-17 Thread Varun Utagikar
Hello All

I could successfully declare and realize virtual users in PE 3.2.3. I am 
now testing the same with PE 3.7.0. Unfortunately the user is not being 
realized and I am getting no warnings/errors.

I am pasting a snippet of my module manifests :

/etc/puppetlabs/puppet/modules/users/manifests/init.pp

snip
class users {
@users::virtual { 'varun':
uid =  1002,
pass=  '$1$Qrt51$JpQOHlU9lMpthG9U5dWiG.',
name=  'admin',
}
}
/snip

/etc/puppetlabs/puppet/modules/users/manifests/virtual.pp

snip
define users::virtual ($uid,$name,$pass) {

  user { $title:
ensure=  'present',
uid   =  $uid,
gid   =  $title,
shell =  '/bin/bash',
home  =  /home/${title},
comment   =  $name,
password  =  $pass,
managehome=  true,
  }
}
/snip
/etc/puppetlabs/puppet/manifests/nodes/hdpnamenode1.pp

snip
nodedefault {
}
###
node'hdpnamenode1.xor.in' {
include users
realize (Users::Virtual ['varun'])
}
/snip

All hostnames can be resolved . I also referenced 
https://docs.puppetlabs.com/puppet/latest/reference/lang_virtual.html 

Help would be apprciated.

Thanks in Advance

Varun

-- 
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/23d67d6e-f9df-476a-a43d-fdc22c902997%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] virtual resources: cannot change gid before delete group

2013-02-14 Thread Vlados Vlados
Please help.
I using virtual resource @user and @group.

If i using next construction i get error with cycles
class  users {
  Group | ENABLED_GROUPS |   -User | ENABLED_USERS' | -  User 
| DISABLED_USERS' |  -Group | DISABLED_GROUPS | 
}

This construction good, but puppet don't want change gid before delete 
vacant group.
class  users {
  Group | ENABLED_GROUPS |   -User | ENABLED_USERS' |
  User | DISABLED_USERS' |  -Group | DISABLED_GROUPS | 
}


I think, firstly,  gid must apply to user. Then delete vacant group.

I got error
Notice: /Stage[main]/Users::Groups_list/Group[shvakov]/ensure: created
Notice: /Stage[main]/Users::Groups_list/Group[developers]/ensure: removed

Error: Could not delete group admins: Execution of '/usr/sbin/groupdel 
admins' returned 8: groupdel: cannot remove the primary group of user 
'shvakov'
Error: /Stage[main]/Users::Groups_list/Group[admins]/ensure: change from 
present to absent failed: Could not delete group admins: Execution of 
'/usr/sbin/groupdel admins' returned 8: groupdel: cannot remove the primary 
group of user 'shvakov'

Notice: /Stage[main]/Users::Users_list/User[shvakov]/gid: gid changed 
'10' to '10110'
Notice: Finished catalog run in 3.32 seconds

How change gid before delete group?


-- 
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] Virtual Resources and create_resources

2012-09-11 Thread Douglas Garstang
So, it seems that create_resources doesn't support virtual resources.

Suggestions? Workarounds?

Doug.

-- 
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] Virtual Resources and create_resources

2012-09-11 Thread Jeff McCune
On Tuesday, September 11, 2012, Douglas Garstang wrote:

 So, it seems that create_resources doesn't support virtual resources.


What problem are you trying to solve?

-Jeff

-- 
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] Virtual Resources with variables

2012-08-21 Thread Douglas Brancaglion
Hi!

I am facing difficulties in using the virtual resource types in resorce
custom, I have a definition of user creation as shown below:

define add_user ( $email, $uid, $key, $groups ) {

$username = $title

user { $username:
comment= $email,
groups = $groups,
managehome = true,
home   = /home/$username,
shell  = /bin/bash,
uid= $uid
}


file { /home/$username/:
ensure  = directory,
owner   = $username,
group   = $username,
mode= 700,
require = [ user[$username] ]
}

file { /home/$username/.ssh:
ensure  = directory,
owner   = $username,
group   = $username,
mode= 700,
require = file[/home/$username/]
}


# now make sure that the ssh key authorized files is around
file { /home/$username/.ssh/authorized_keys:
ensure  = present,
owner   = $username,
group   = $username,
mode= 600,
require = file[/home/$username/]
}

ssh_authorized_key{ ${username}:
ensure  = present,
type= ssh-rsa,
user= $username,
key = $key,

}

}

And in my users manifests I declare this way:

@add_user { test:
 email   = user test,
 uid = 1040,
 groups  = apache,
 key  =
B3NzaC1yc2EDAQfTRr6mUam1rIiwWhseaRP9M83L2NXFBMix4d7q1xkO/bMqCvvRPjzVzQNGhEJFn8Pjz2pr+QcK2c2yqceSTpbVoxM8Gg5/dXwKv+ct4qKjLVtSty8s/VW8g+kI3N5R9Xv1SG7exJdutKfEnoCGY4lXjrU11fvCZq5Zrc5,
}

and in my node i declare this way:

import custom_resource
import users_manifests

node server01.domain {

realize User[test]
}

but i receive that error message:
err: Could not retrieve catalog from remote server: Error 400 on SERVER:
Failed to realize virtual resources User[dbrancaglion]

Sorry duplicate message, my browser crashed!!

Can help me?

Tks!
-- 
Douglas Brancaglion
Security Analist

-- 
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] Virtual Resources with variables

2012-08-21 Thread Walter Heck
Realize add_user instead of user..

Sent from my galaxy tab
On Aug 22, 2012 3:01 AM, Douglas Brancaglion douglas.rea...@gmail.com
wrote:

 realize  }
 On Aug 22, 2012 3:01 AM, Douglas Brancaglion douglas.rea...@gmail.com
wrote:

 Hi!

 I am facing difficulties in using the virtual resource types in resorce
 custom, I have a definition of user creation as shown below:

 define add_user ( $email, $uid, $key, $groups ) {

 $username = $title

 user { $username:
 comment= $email,
 groups = $groups,
 managehome = true,
 home   = /home/$username,
 shell  = /bin/bash,
 uid= $uid
 }


 file { /home/$username/:
 ensure  = directory,
 owner   = $username,
 group   = $username,
 mode= 700,
 require = [ user[$username] ]
 }

 file { /home/$username/.ssh:
 ensure  = directory,
 owner   = $username,
 group   = $username,
 mode= 700,
 require = file[/home/$username/]
 }


 # now make sure that the ssh key authorized files is around
 file { /home/$username/.ssh/authorized_keys:
 ensure  = present,
 owner   = $username,
 group   = $username,
 mode= 600,
 require = file[/home/$username/]
 }

 ssh_authorized_key{ ${username}:
 ensure  = present,
 type= ssh-rsa,
 user= $username,
 key = $key,

 }

 }

 And in my users manifests I declare this way:

 @add_user { test:
  email   = user test,
  uid = 1040,
  groups  = apache,
  key  =
 B3NzaC1yc2EDAQfTRr6mUam1rIiwWhseaRP9M83L2NXFBMix4d7q1xkO/bMqCvvRPjzVzQNGhEJFn8Pjz2pr+QcK2c2yqceSTpbVoxM8Gg5/dXwKv+ct4qKjLVtSty8s/VW8g+kI3N5R9Xv1SG7exJdutKfEnoCGY4lXjrU11fvCZq5Zrc5,
 }

 and in my node i declare this way:

 import custom_resource
 import users_manifests

 node server01.domain {

 realize User[test]
 }

 but i receive that error message:
 err: Could not retrieve catalog from remote server: Error 400 on SERVER:
 Failed to realize virtual resources User[dbrancaglion]

 Sorry duplicate message, my browser crashed!!

 Can help me?

 Tks!
 --
 Douglas Brancaglion
 Security Analist

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


-- 
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] Virtual Resources with variables

2012-08-21 Thread Douglas Brancaglion
Tks!

Work fine now.

Hugs,

2012/8/21 Walter Heck walterh...@gmail.com

 Realize add_user instead of user..

 Sent from my galaxy tab
 On Aug 22, 2012 3:01 AM, Douglas Brancaglion douglas.rea...@gmail.com
 wrote:

  realize  }
  On Aug 22, 2012 3:01 AM, Douglas Brancaglion douglas.rea...@gmail.com
 wrote:

 Hi!

 I am facing difficulties in using the virtual resource types in resorce
 custom, I have a definition of user creation as shown below:

 define add_user ( $email, $uid, $key, $groups ) {

 $username = $title

 user { $username:
 comment= $email,
 groups = $groups,
 managehome = true,
 home   = /home/$username,
 shell  = /bin/bash,
 uid= $uid
 }


 file { /home/$username/:
 ensure  = directory,
 owner   = $username,
 group   = $username,
 mode= 700,
 require = [ user[$username] ]
 }

 file { /home/$username/.ssh:
 ensure  = directory,
 owner   = $username,
 group   = $username,
 mode= 700,
 require = file[/home/$username/]
 }


 # now make sure that the ssh key authorized files is around
 file { /home/$username/.ssh/authorized_keys:
 ensure  = present,
 owner   = $username,
 group   = $username,
 mode= 600,
 require = file[/home/$username/]
 }

 ssh_authorized_key{ ${username}:
 ensure  = present,
 type= ssh-rsa,
 user= $username,
 key = $key,

 }

 }

 And in my users manifests I declare this way:

 @add_user { test:
  email   = user test,
  uid = 1040,
  groups  = apache,
  key  =
 B3NzaC1yc2EDAQfTRr6mUam1rIiwWhseaRP9M83L2NXFBMix4d7q1xkO/bMqCvvRPjzVzQNGhEJFn8Pjz2pr+QcK2c2yqceSTpbVoxM8Gg5/dXwKv+ct4qKjLVtSty8s/VW8g+kI3N5R9Xv1SG7exJdutKfEnoCGY4lXjrU11fvCZq5Zrc5,
 }

 and in my node i declare this way:

 import custom_resource
 import users_manifests

 node server01.domain {

 realize User[test]
 }

 but i receive that error message:
 err: Could not retrieve catalog from remote server: Error 400 on SERVER:
 Failed to realize virtual resources User[dbrancaglion]

 Sorry duplicate message, my browser crashed!!

 Can help me?

 Tks!
 --
 Douglas Brancaglion
 Security Analist

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

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




-- 
Douglas Brancaglion
Security Analist

-- 
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] virtual resources spaceship syntax

2012-06-29 Thread Brett Maton
I'm probably missing something really simple here, but I can't get the 
following to work:

node 'puppet-slave.test.net' {
  include users::accounts
  User | title=account |
}

Any suggestions welcomed :)

Modules:

modules/users/manifests/virtual.pp 

class users::virtual {
  define account ( $uid, 
   $gid = '', 
   $home = '',
   $groups = '',
   $realName = '',
   $pass = '',
   $shell = '/bin/bash',
   $sshkey = '') {

$userGroup = $gid ? {
   ''  = $uid,
   default = $gid,
 }

$homeDir = $home ? {
 ''  = /home/${title},
 default = $home,
   }
$comment = $realName ? {
 ''  = $title,
 default = $realName,
   }

  #  Create User Group
group { $title:
  ensure = 'present',
  gid= $userGroup,
}

  #  Create User Account
user { $title:
  ensure = 'present',
  uid= $uid,
  gid= $userGroup,
  shell  = $shell,
  home   = $homeDir,
  comment= $comment,
  password   = $pass,
  groups = $groups,
  managehome = 'true',
}
#  Add SSH Key if defined.
if ( $sshkey != '' ) {
  ssh_authorized_key { $title:
ensure  = 'present',
type= 'ssh-rsa',
key = ${sshkey},
user= ${title},
require = User[ ${title} ],
name= ${title},
  }
}
  }
}

modules/users/manifests/accounts.pp 

class users::accounts {
  include users::virtual

  # Brett Maton
  @users::virtual::account { 
'account':
  uid  = '1001',
  realName = 'account',
  groups   = 'wheel',
  sshkey   = [ Key Data ];

'account2':
  uid  = '1002',
  realName = 'Second Account',
  groups   = 'wheel',
  sshkey   = [ Key Data ]
  }
}

-- 
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] virtual resources spaceship syntax

2012-06-29 Thread puppet-users
Hi,

On Fri, 29 Jun 2012 15:36:35 +0100
Brett Maton brett.ma...@googlemail.com wrote:

 I'm probably missing something really simple here, but I can't get
 the following to work:
 
 node 'puppet-slave.test.net' {
   include users::accounts
   User | title=account |
 }

It’s supposed to be a comparison, not an assignment, so
title == 'account'

Best regards

Hendrik Jäger


signature.asc
Description: PGP signature


Re: [Puppet Users] virtual resources spaceship syntax

2012-06-29 Thread matonb
Thanks for looking Henk,

  I think my email client replaced == with =, it is using the comparison op 
in the actual code

On Friday, 29 June 2012 16:07:55 UTC+1, (unknown) wrote:

 Hi, 

 On Fri, 29 Jun 2012 15:36:35 +0100 
 Brett Maton brett.ma...@googlemail.com wrote: 

  I'm probably missing something really simple here, but I can't get 
  the following to work: 
  
  node 'puppet-slave.test.net' { 
include users::accounts 
User | title=account | 
  } 

 It’s supposed to be a comparison, not an assignment, so 
 title == 'account' 

 Best regards 

 Hendrik Jäger 


-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/4k8Mo2ehCUQJ.
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] virtual resources spaceship syntax

2012-06-29 Thread Kristof Willaert
Hi,

[snip]

 node 'puppet-slave.test.net' {
include users::accounts
User | title=account |
  }


Your virtual resource is not a user, but a define called
users::virtual::account.
So you need to realize it using:

Users::Virtual::Account | title == account |

Kind regards,

kristof

-- 
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] virtual resources spaceship syntax

2012-06-29 Thread Brett Maton
:D

  I knew it would be something simple,  thanks Kristof that's working now.

Brett

On 29 Jun 2012, at 16:54, Kristof Willaert wrote:

 Hi,
 
 [snip]
 
  node 'puppet-slave.test.net' { 
include users::accounts 
User | title=account | 
  }
 
 Your virtual resource is not a user, but a define called 
 users::virtual::account.
 So you need to realize it using:
 
 Users::Virtual::Account | title == account |
 
 Kind regards,
 
 kristof
 
 -- 
 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.

-- 
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] Virtual resources for a list of server ip addresses in Apache config

2012-04-18 Thread Robert Rothenberg
I have an internal web site that can only be accessed from other servers.

It seems to me that I should pass an array of the addresses to the class 
that instantiates the template for the Apache configuration. That seems 
easy.

The hard part is getting every node to register itself so that it's IP 
address is added to the array.

I imagine using virtual resources, e.g. something like

define website::client {
  $website::clients += [ $title ]
}

and in each node definition (specifically outside the node { ... } 
declaration)

@website::client{ $ip_address_of_node: }

and somewhere else

Website::Client | |

I would expect that for every node, it's ip address would be added to the 
array. But this doesn't seem to work. In the website class, the $clients 
array is never changed from what it is initialized to.

What are the best practices for doing something like this?

Thanks,
Robert


-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/9xKEBi6ZyTcJ.
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] virtual resources vs fqdn_rand

2012-03-22 Thread Adam Heinz
Running puppet-2.6.13-2.el6.noarch on CentOS 6.

define backup($apphost, $appfqdn) {
cron { backup-${apphost}-daily:
command = /usr/bin/rsync -a $appfqdn:backups/ $backdir/daily
--delete,
hour= 2,
minute  = fqdn_rand(60),
}
}

then elsewhere

@@backup { $::hostname:
appfqdn = $::fqdn,
apphost = $::hostname,
}

Easy enough, or so I thought.  Some time after I initially wrote this,
I investigated some I/O spikes and sure enough, all of my backups are
running at the same minute -- the fqdn_rand is being calculated for
the backup server, not for the slaves being backed up.

I have worked around this by passing in a $minute argument, but this
seems a bit inelegant -- the slave certainly has no business
determining the backup schedule.  Other than a feature request for
fqdn_rand to allow a value to be passed in, any ideas on a more
elegant way to accomplish this?  Criticism welcome!

-- 
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] Virtual resources and hashes

2011-06-08 Thread Randall Hansen
On Tue, Jun 7, 2011 at 4:15 PM, Aaron Grewell aaron.grew...@gmail.com wrote:

 $users = [{ username = bill, uid = 12345 },
  { username = ted,  uid = 12346 }]

Aaron, I think this is a completely sane request.  We've talked about
it before, but I can't find an existing ticket.  This one seems close,
but very old; will you take a look?
http://projects.puppetlabs.com/issues/1858

If we can work out a good syntax we'll put this on the roadmap.  I
know some of our PS guys are eager for it, too.

r

-- 
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] Virtual resources and hashes

2011-06-08 Thread Aaron Grewell
The request in the ticket is related but might not solve the same problem.
What I think I'm looking for is the generic ability to specify an array of
hashes as a resource title and have Puppet handle it intelligently (that is,
produce a locally scoped hash split from the array and easily accessible
inside the resource specification as well as knowing what value it should
use for $name or supporting e.g. $alias = hash[key] for specifying the
appropriate value).  The reason I think that's preferable to the ability to
transform a hash to a resource is because it will work everywhere.  What I
don't know is whether the hash - resource transform can be made to declare
an instance of a define().  If so, it would handle my needs quite well.  If
OTOH it will only declare native resource types then it won't do all of what
I'm looking for.  It would be a step in the right direction though.

On Wed, Jun 8, 2011 at 10:17 AM, Randall Hansen rand...@puppetlabs.comwrote:

 On Tue, Jun 7, 2011 at 4:15 PM, Aaron Grewell aaron.grew...@gmail.com
 wrote:

  $users = [{ username = bill, uid = 12345 },
   { username = ted,  uid = 12346 }]

 Aaron, I think this is a completely sane request.  We've talked about
 it before, but I can't find an existing ticket.  This one seems close,
 but very old; will you take a look?
 http://projects.puppetlabs.com/issues/1858

 If we can work out a good syntax we'll put this on the roadmap.  I
 know some of our PS guys are eager for it, too.

 r

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



-- 
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] Virtual resources and hashes

2011-06-07 Thread Aaron Grewell
Hmmm, either I'm doing something wrong or virtual resources are incompatible
with hashes.

When I do this:
$users = [{ username = bill, uid = 12345 },
 { username = ted,  uid = 12346 }]

define usertest ($alias = $name[username]) {
user {$name[username]:
ensure = present,
uid= $name[uid]
}
}
@usertest { $users: }
realize Usertest[bill]

I get this:
warning: alias is a metaparam; this value will inherit to all contained
resources
Failed to realize virtual resources Usertest[bill] on node

Which seems unfortunate.  Hash support is a really cool idea but I keep
tripping over parts of Puppet that don't handle it well.

-- 
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] Virtual resources stopped working...

2011-02-18 Thread Felix Frank
 Why would this be?  Does anyone know any reliable way to list every
 class a node is including?  Is there a reason the users::sys class
 cannot realise resources defined in users?

There is /var/lib/puppet/state/classes.txt.

 We originally tried to use tags to achieve this, but they are
 completely useless as they are not global...

I didn't get this last paragraph.

Can you post excerpts from both classes?

Cheers,
Felix

-- 
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] Virtual Resources realization problems

2011-02-17 Thread Felix Frank
Hi,

On 02/17/2011 12:12 AM, Forrie wrote:
 I'm somewhat new to Puppet.   I'm trying to establish some Virtual
 Resources so I can realize them based on a TAG.
 
 The error I continue to get is:
 
 Feb 16 18:02:38 test-fms puppet-agent[8590]: Could not retrieve
 catalog from remote server: Error 400 on SERVER: Syntax error at
 '201001'; expected '}' at /etc/puppet/modules/dce/manifests/mounts.pp:
 4 on node test-fms.domain.com
 
 The structure is, I believe, fairly simple.   I'm using another module
 as a template (ghoneycutt::generic).
 
 There is a define of nfsmount under the init.pp:
 
 [ file name: init.pp ]
 
 class dce {
   define nfsmount(options} {
  }
 }
 
 a separate file, mounts.pp has this and is included as include
 dce::mounts:
 
 [ file name:  mounts.pp ]
 
 class dce::mounts {
 
 # 2010
  @Dce::Nfsmount { 201001:

why is this capitalized? I disbelieve it should be.

 device  = 10.101.0.133,
 exportPath  = /dce/prod/201001,
 name= /home/201001,
 tag = 2010,
  }
 
 } # class dce::mounts
 
 
 There is no missing bracket.  I've looked at it a 100 times and I'm
 convinced of this.
 
 in the final script, called mounttest.pp (also under the dce module)
 I'm doing this:
 
 [ file name:  mounttest.pp ]
 
 class dce::mounttest inherits dce {
 include dce::mounts
 
 Dce::Nfsmount | tag == 2010 |
 
 }
 
 Whether I inherit this or not does not change the outcome of the
 error.   I would think that because it's under the same module of dce
 that I would not need to include or inherit it.

Don't go around randomly inheriting classes.

If you need to override a resource, inherit a class (and do not much
more that override resources).
Otherwise, don't inherit (include instead).

HTH,
Felix

 The dce::mounts file is just a list of Virtual Resources, that's it.
 
 I simply can't understand what I'm doing wrong.  It's probably so
 simple that I'm overlooking it.
 
 If anyone can lend a hand, I'd appreciate it.
 
 
 Thanks!
 
 

-- 
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] Virtual resources stopped working...

2011-02-17 Thread Steve Shipway
Since I moved our pre-prod puppet master to RHEL6, things have
broken.  This is how:

We have two classes, 'users' (which defines all our users as virtual)
and 'users::sys' which realises the systems-admin users.

I then have (this is simplified to show the problem):

node basenode  {
  include users
}
node foo inherits basenode {
  include defaults::systems
}
class defaults::systems {
  include users::sys
}

Previously, this worked -- but now, it doesnt!  The virtual users seem
to be created, but nothing is realised.

I also have another class -- sudo -- which is included in basenode.
This uses the class collection in a template file to build the sudoers
file, based on which of the users::xxx classes have been included.
Again, this used to work, but now it seems to be unable to see the
defaults::systems or users::sys classes for some reason.  I know they
are being included because I've added a notice() call in the class to
verify its inclusion.

Why would this be?  Does anyone know any reliable way to list every
class a node is including?  Is there a reason the users::sys class
cannot realise resources defined in users?

We originally tried to use tags to achieve this, but they are
completely useless as they are not global...

Hope someone can help.

Steve

-- 
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] Virtual Resources realization problems

2011-02-16 Thread Forrie
I'm somewhat new to Puppet.   I'm trying to establish some Virtual
Resources so I can realize them based on a TAG.

The error I continue to get is:

Feb 16 18:02:38 test-fms puppet-agent[8590]: Could not retrieve
catalog from remote server: Error 400 on SERVER: Syntax error at
'201001'; expected '}' at /etc/puppet/modules/dce/manifests/mounts.pp:
4 on node test-fms.domain.com

The structure is, I believe, fairly simple.   I'm using another module
as a template (ghoneycutt::generic).

There is a define of nfsmount under the init.pp:

[ file name: init.pp ]

class dce {
  define nfsmount(options} {
 }
}

a separate file, mounts.pp has this and is included as include
dce::mounts:

[ file name:  mounts.pp ]

class dce::mounts {

# 2010
 @Dce::Nfsmount { 201001:
device  = 10.101.0.133,
exportPath  = /dce/prod/201001,
name= /home/201001,
tag = 2010,
 }

} # class dce::mounts


There is no missing bracket.  I've looked at it a 100 times and I'm
convinced of this.

in the final script, called mounttest.pp (also under the dce module)
I'm doing this:

[ file name:  mounttest.pp ]

class dce::mounttest inherits dce {
include dce::mounts

Dce::Nfsmount | tag == 2010 |

}

Whether I inherit this or not does not change the outcome of the
error.   I would think that because it's under the same module of dce
that I would not need to include or inherit it.

The dce::mounts file is just a list of Virtual Resources, that's it.

I simply can't understand what I'm doing wrong.  It's probably so
simple that I'm overlooking it.

If anyone can lend a hand, I'd appreciate it.


Thanks!


-- 
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] Virtual resources, account module help.

2011-01-13 Thread Adam Crews
Hello,

I'm trying to rebuild my accounts module so that will completely
manage users via puppet.  In my env, as much as I would like to, I
cannot use nis or ldap for authentication, so I'm trying to do it the
puppet way, but I seem to be a little stuck.

I would like to maintain a list of users (currently in a csv file
accessed via an extlookup function), then just specify unix groups to
appear on the node.  All users of those groups would be realized and
appear on the target system.

If a user is in more than one group, then I run into a duplicate
resource definition issue, and I can't quite figure out a better way
to get around it.

I've seen the various methods in the mail archive, but those all
appear to have static definitions for the users.  I'm trying to
dynamically create the users resources.

class accounts::users {

  define douser {
  $extlookup_datadir = /etc/puppet/manifests/extdata
  $extlookup_precedence = [ people ]
  $extuser = extlookup($name)
  # At this point extuser look like [ acrews, 1000, Adam
Crews, /bin/bash, enabled, devuser:qauser:group1:group2:group3
]

  $groups = split($extuser[4], '[:]')

  @group {
$name:
 $gid = $extuser[1],
 $ensure = $extuser[4];
   }

  @user {
$name:
ensure = $extuser[4],
uid  = $extuser[1],
groups = [ $groups ],
 ... (and so on for the user values)
   }
  }

  define dogroup {
  $extlookup_datadir = /etc/puppet/manifests/extdata
  $extlookup_precedence = [ groups ]
  $extgroup = extlookup($name)
  # at this point $extgroup is an array of users that are in the
group specified in $name

  douser { [ $extgroup ]: }

  }
}

node foo {
   include accounts::users
   accounts::users::dogroup {[devuser, qauser]}
}

So if acrews appears in both devuser and qauser, I get Duplicate
definition: Accounts::Users::Douser[acrews] is already defined.
This is obvious to me since the dogroup define is invoked for each of
the groups.  I'm thinking that I need to tag the resources, then
collect and realize them all, but I so far I haven't found the right
path to make that happen.

Can someone nudge me in the right direction to sort this out?

Thanks
-Adam

-- 
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] Virtual Resources

2010-09-10 Thread Frederik Wagner
Hi Doug,

On Thu, Sep 9, 2010 at 7:06 PM, Douglas Garstang
doug.garst...@gmail.com wrote:
 Would it be safe to say that virtual resources, once defined, sort of
 become like a globally scoped object within the node? Ie, in one
 module I can require= an object defined as a virtual resource in
 another module, as long as they are both being run on the node? The
 docs really don't make a lot of sense from a practical perspective.

this sounds right to me. I am using virutal resources in exactly this way.

Bye,
Frederik


 Doug.

 --
 You received this message because you are subscribed to the Google Groups 
 Puppet Users group.
 To post to this group, send email to puppet-us...@googlegroups.com.
 To unsubscribe from this group, send email to 
 puppet-users+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/puppet-users?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Virtual Resources

2010-09-10 Thread Douglas Garstang
Woo! Tanx!

On Thu, Sep 9, 2010 at 11:41 PM, Frederik Wagner fner...@googlemail.com wrote:
 Hi Doug,

 On Thu, Sep 9, 2010 at 7:06 PM, Douglas Garstang
 doug.garst...@gmail.com wrote:
 Would it be safe to say that virtual resources, once defined, sort of
 become like a globally scoped object within the node? Ie, in one
 module I can require= an object defined as a virtual resource in
 another module, as long as they are both being run on the node? The
 docs really don't make a lot of sense from a practical perspective.

 this sounds right to me. I am using virutal resources in exactly this way.

 Bye,
 Frederik


 Doug.

 --
 You received this message because you are subscribed to the Google Groups 
 Puppet Users group.
 To post to this group, send email to puppet-us...@googlegroups.com.
 To unsubscribe from this group, send email to 
 puppet-users+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/puppet-users?hl=en.



 --
 You received this message because you are subscribed to the Google Groups 
 Puppet Users group.
 To post to this group, send email to puppet-us...@googlegroups.com.
 To unsubscribe from this group, send email to 
 puppet-users+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/puppet-users?hl=en.





-- 
Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: doug.garst...@gmail.com
Cell: +1-805-340-5627

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Virtual Resources

2010-09-09 Thread Douglas Garstang
Would it be safe to say that virtual resources, once defined, sort of
become like a globally scoped object within the node? Ie, in one
module I can require= an object defined as a virtual resource in
another module, as long as they are both being run on the node? The
docs really don't make a lot of sense from a practical perspective.

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Virtual Resources

2010-09-07 Thread Douglas Garstang
Would it be safe to say that virtual resources, once defined, sort of
become like a globally scoped object within the node? Ie, in one
module I can require= an object defined as a virtual resource in
another module, as long as they are both being run on the node? The
docs really don't make a lot of sense from a practical perspective.

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Virtual Resources with Variables

2010-06-15 Thread Doug Warner
I've seen the workarounds to use the concatenated file resource to fake this,
but is it possible to use something like virtual resources to realize an
array?  My pseudo-classes would be like this:

class foo {
  @$arr = ['a', 'b']

  realize($arr)
}

class foo::c inherits foo {
  $arr += ['c']
}

class foo::d inherits foo {
  $arr += ['d']
}

node ab {
  include foo
}

node abc {
  include foo:c
}

node abcd {
  include foo:c
  include foo:d
}

I think the way things currently are, node abc would be fine but node abcd
would fail because of trying to reassign the variable.

If not virtual resouces, what is the best way to append to an array when you
don't know what the final outcome of the array needs to be?

-Doug



signature.asc
Description: OpenPGP digital signature


[Puppet Users] virtual resources

2010-04-13 Thread Roy Nielsen

Hello,

I want to vitualize a resources - but want to realize an array of 
resources...


somthing like:

@file { $myarray :
   ensure = directory,
   ...
}

Can I realize the resources with:

File | title == $myarray |

?

Thanks,
-Roy

--
You received this message because you are subscribed to the Google Groups Puppet 
Users group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Virtual Resources: Nagios_host - only getting one entry each run

2009-10-22 Thread Joel Heenan
OK So I'm doing something silly here, but this is the behaviour I'm seeing.
I am instatiating a large number of virtual @nagios_host objects and
@nagios_service objects. Then at run time I see the Nagios_service objects
get propagated but it appears like it selects one of the Nagios_host
objects. Of course the nagios config fails. If I restart the puppetmaster it
will then select the next nagios object in turn. So the nagios_service.cfg
is being completely built but nagios_host.cfg gets a only one host added per
puppet run.

Maybe I am instatiating virtual resources with the same name? I have looked
through the manifests and can't see how this is possible.

I also see DNS entries only come through one at a time. So you see:

[r...@c008operations01-prod nagios]# puppetd --test
info: /Host[c008lvs01-prod]: Adding aliases c008lvs01-prod.threatmetrix.com

info: /Nagios_host[c003fp02-prod]: Adding aliases c003fp02-prod
info: /Host[localhost]: Adding aliases localhost.localdomain
info: Caching catalog at /var/lib/puppet/localconfig.yaml
notice: Starting catalog run

That should be filled with lots of Host[] and Nagios_host[] objects, yet
there is only two.

Using puppet 0.24.5 on Centos 5.3

Thanks for your help

Joel

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