[Puppet Users] Making a file out of fragments

2009-06-19 Thread jchonig

I'm building apt source files in /etc/apt/sources.list.d on Ubuntu
based on a recipe on the puppet site.  This does have a few problems
though.  Some apps expect /etc/apt/sources.list to exist and get upset
if it doesn't.

I'd rather combine the individual files into one file that replaces /
etc/apt/sources.list.  Is there an easy way to do that?

Thanks.

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] Re: Is there a way to write to a file using puppet

2009-06-19 Thread lance dillon
On Fri, Jun 19, 2009 at 2:41 PM, RijilV  wrote:

>
> 2009/6/19 Swati Tiwari :
> > Hey Guys,
> >
> > I am sorry if this sounds silly but I am new to puppet. I am trying to
> > append a particular line to the apt.conf file on all the clients that are
> > running puppetd. Is there any way to do this using puppet. Any help would
> be
> > appreciated!
> >
> > Thank you!
> >
> > --
> > Regards,
> > Swati
>
>
> http://reductivelabs.com/trac/puppet/wiki/Recipes/SimpleText
>
> Or take a look at Augeas, provided there is already a lens for
> apt.conf or you're comfortable writing one, would likely be a cleaner
> way of handling this.
>
> .r'
>

Depending on the format of the file (I don't know what that one is), you may
not need a custom lens.  I modified /etc/sysconfig/sysstat (part of the
sysstat package on rhel).  These files are generally simple key=value files,
and the basic lens is sufficient for that.

--~--~-~--~~~---~--~~
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] exec "sudo apt-get -t unstable install rubygems" fails!

2009-06-19 Thread Swati Tiwari
Hi Everyone,

I am trying to install the latest unstable binary of rubygems using the
following exec

exec { "latestrubygems":
   command => "sudo apt-get -t unstable install rubygems"
}

I have the apt.conf and the sources.list file updated correctly for this
command to work. This command works well on the command line but not through
puppet. I am not sure where I am going wrong.. The output is

err: //Node[labserver4]/gempackages/Exec[latestrubygems]/returns: change
from notrun to 0 failed: sudo apt-get -t unstable install rubygems returned
1 instead of 0 at /etc/puppet/manifests/classes/gempackages.pp:87

Please guide me if I am going wrong somewhere.. Thanks a lot!

-- 
Regards,
Swati

--~--~-~--~~~---~--~~
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: Testing if a resource is already defined

2009-06-19 Thread Avi Miller

On 20/06/2009, at 8:01 AM, Scott Smith  wrote:

> Why don't you just define it virtually and realize it at will?

Because the value for the IP address changes depending on where it  
appears in the manifest. I'm working in an environment where each  
server has at least 2 and up to 6 addresses, and I have to  
programmatically determine which one to use in /etc/hosts.

It's not pretty, but it's working well for us.

Thanks,
Avi

--~--~-~--~~~---~--~~
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: Testing if a resource is already defined

2009-06-19 Thread Scott Smith

Avi Miller wrote:
> Eric Gerlach wrote:
>> It sounds like you might be trying to define a host in more than one place.
>> I'm just a journeryman myself, but I think according to The Puppet Way (TM)
>> that's a Bad Thing (TM).
> 
> Yes, I am and yes, it is, but I don't have (much) choice without making 
> our manifests rather larger and more cumbersome. Using the defined() 
> function and replacing the host{} type with a custom add_host{} 
> definition (that wraps the function) works just fine.
> 

Why don't you just define it virtually and realize it at will?

-scott

-- 
sc...@ohlol.net

http://github.com/ohlol

--~--~-~--~~~---~--~~
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: Testing if a resource is already defined

2009-06-19 Thread Avi Miller

Eric Gerlach wrote:
> It sounds like you might be trying to define a host in more than one place.
> I'm just a journeryman myself, but I think according to The Puppet Way (TM)
> that's a Bad Thing (TM).

Yes, I am and yes, it is, but I don't have (much) choice without making 
our manifests rather larger and more cumbersome. Using the defined() 
function and replacing the host{} type with a custom add_host{} 
definition (that wraps the function) works just fine.

cYa,
Avi

--~--~-~--~~~---~--~~
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: Testing if a resource is already defined

2009-06-19 Thread Eric Gerlach

On Thu, Jun 18, 2009 at 12:14:59PM +1000, Avi Miller wrote:
> 
> Hi gang,
> 
> Is it possible to test if a particular resource has already been 
> defined? I'd like to do something like this:
> 
> if !Host["$fqdn"] {
> host {"$fqdn": ip => "$ipaddress_eth0" }
> }
> 
> Essentially, test to see if there is no Host resource defined for the 
> current server and if not, add a host entry for itself using the IP 
> address of eth0.
> 
> Possible?

It sounds like you might be trying to define a host in more than one place.
I'm just a journeryman myself, but I think according to The Puppet Way (TM)
that's a Bad Thing (TM).

If you make sure that the host is only potentially defined in one place, you
don't have to worry about this.

Cheers,

-- 
Eric Gerlach, Network Administrator
Federation of Students
University of Waterloo
p: (519) 888-4567 x36329
e: egerl...@feds.uwaterloo.ca

--~--~-~--~~~---~--~~
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: removing resources no longer specified

2009-06-19 Thread Udo Waechter

Hi.

We also do this for most of our classes and it increases the code that  
has to be written.


Usually we have something like:

class foo {
$presence_real = $presence {
"" => "present',
"absent" => "absent"
}
file{"xyz":
ensure => $presence_real,
}
package{"a_package":
ensure => $presence_real
}
case $presence_real {
"present": {
exec{"echo 'hello world' >/tmp/hello":
onlyif => "test ! -e /tmp/hello",
}   
}
"absent": {
file{"/tmp/hello":
ensure => $presence_real,
}
}
}   
# and so on
}

class foo::none {
$presence = "absent"
include foo
}

This works pretty well, but there is a lot of redundant code within  
all of our classes now.


In the last days I got the idea that it might be nice if puppet would  
create these 'anti' classes by itself


all resources in "class foo" that have an ensure parameter could be  
set to "absent" when the class is referenced via:


include foo::none

The other option would be to introduce arguments to classes. I think  
this is a feature request already.


include foo { ensure => "absent" }

Of course this would not solve the problem for all types ("exec" is  
hard...), but it is a good start. And it would save a lot of code  
already.


Bye,
udo.

On 15.06.2009, at 01:27, Geoff Crompton wrote:



Currently, if I want to remove resources from a node that I've
previously configured, I'm doing 'anti' patterns. Is there away for
puppet to do it for me? For example, if I started with:

define website () {
file { "/etc/apache2/sites-enabled/$name.conf":
content => template("website/apache2.conf.erb")
}
}
node 'oldwebserver' {
package { apache2:
ensure => installed,
}
website { "www.example.com":
}
}

And then I wanted to get ride of that website from that specific node:

define website::anti () {
file { "/etc/apache2/sites-enabled/$name.conf":
ensure => absent
}
}
node 'oldwebserver' {
package { apache2:
ensure => absent,
}
website::anti { "www.example.com":
}
}

But can puppet make this easier for me? What I'd like to do instead  
is:

node 'oldwebserver' {
}

At the moment puppet doesn't behave in that manner, it simply leaves  
the

Package and File resources in their last configured state, and forgets
about them. So I was wondering if it is possible for a storeconfigs
database to store some history of configs?

If it is possible (or if it's possible to build that feature in), is  
it

possible with that history to determine when a resource changes from
existing in the manifest, to not existing in the manifest?

If that is possible (or could be built in), could you make puppet
automatically remove that resource from the client system if it  
detects

a resource has been removed?

--
+-Geoff Crompton
+--Debian System Administrator
+---Trinity College

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



--
:: udo waechter - r...@zoide.net :: N 52º16'30.5" E 8º3'10.1"
:: genuine input for your ears: http://auriculabovinari.de
::  your eyes: http://ezag.zoide.net
::  your brain: http://zoide.net






smime.p7s
Description: S/MIME cryptographic signature


[Puppet Users] Re: Testing if a resource is already defined

2009-06-19 Thread Udo Waechter

Hello,

On 18.06.2009, at 10:03, Peter Meier wrote:



Hi


Is it possible to test if a particular resource has already been
defined? I'd like to do something like this:

if !Host["$fqdn"] {
   host {"$fqdn": ip => "$ipaddress_eth0" }
}

Essentially, test to see if there is no Host resource defined for the
current server and if not, add a host entry for itself using the IP
address of eth0.


http://reductivelabs.com/trac/puppet/wiki/FunctionReference#defined


In principle, this should do. Unfortunately there's this small catch  
that:


"This function is unfortunately dependent on the parse order of the  
configuration when testing whether a resource is defined."


I have many situations where i would like to test whether a class ist  
defined or not. This does not work for most situations.


Would it be possible to rewrite "defined" such that it is not  
dependent on the parse order of manifest?


As I understand puppet, this is not easily achievable. I am not sure,  
though.


All the best,
udo.
--
:: udo waechter - r...@zoide.net :: N 52º16'30.5" E 8º3'10.1"
:: genuine input for your ears: http://auriculabovinari.de
::  your eyes: http://ezag.zoide.net
::  your brain: http://zoide.net






smime.p7s
Description: S/MIME cryptographic signature


[Puppet Users] Having trouble with a new type

2009-06-19 Thread Pratod

Hi all,

I am writing a new type to handle files like sysctl.conf that are
basically name value pairs. Being new to both ruby and Puppet, I know
am doing something ridiculous.

This is the error I get:
Could not autoload "/var/lib/puppet/lib/puppet/provider/hash_config/
hash_config.rb": wrong number of arguments (0 for 1)
Could not autoload "/var/lib/puppet/lib/puppet/provider/hash_config/
hash_config.rb": wrong number of arguments (0 for 1)

class myhash {
hash_config{"test":
#   ensure => present,
value => "x",
comment_character => '#',
file => "/tmp/test_pratod",
}

When I uncomment the ensure statement, I get
err: //myhash/Hash_config[test]: Failed to retrieve current state of
resource: No ability to determine if hash_config exists


Thanks for your help


Here is the type

Puppet::Type.newtype(:hash_config) do
@doc = "Manage name value entries in config file. eg sysctl -
kernel.modprobe = /sbin/mod probe
Comments and blank lines are stripped. For now the only
separator value allowed is '=' with spaces around it"

ensurable

newparam(:name) do
desc "The name of the entry.  eg kernel.modprobe"
end

newparam(:comment_character) do
desc "What character does the config file use for a comment.
It defaults to '#'  - need to update to include ';'"

defaultto '#'
end

newparam(:file) do
desc "What configuration file to add resource to"
end

newparam(:value) do
desc "The value to be set. eg /sbin/mod probe"
end


end

__


Here is the provider

Puppet::Type.type(:hash_config).provide do
target_hash = Hash.new
fetched = Boolean.new(false)
changed = Boolean.new(false)
#
def prefetch
f = File.open(@resource[:file], "r")
lines = f.readlines
lines.each do |line|
if line !~ /@resource[:comment_character]/
key, target_hash[key] = line.split("=")
end
end
fetched = true
end
#
def flush
if changed do
f = File.open(@resource[:file], "w")
target_hash.keys.each do |key|
f.puts key + " " + target_hash[key] + "\n"
end
end
end
end

#
def create
if not fetched
self.prefetch
end
target_ha...@resource[:name]] = @resource[:value]
changed = true
self.flush

end
#
def destroy
end
#
def exists?
if not fetched
self.prefetch
end
true
end
#

def retrieve
if not fetched
  self.prefetch
end
if target_hash.has_key? @resource[:name]
return target_ha...@resource[:name]]
else
return ''
end
end
self.prefetch
self.create
self.flush
end

--~--~-~--~~~---~--~~
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: Automatically creating subdirectories?

2009-06-19 Thread Douglas Garstang
Thanks. Good to know I wasn't missing something.

On Fri, Jun 19, 2009 at 11:43 AM, Douglas  wrote:

>
> I'm relatively new to puppet.
>
> Searched online, and could not find an answer to this. I have the
> following manifest snippet...
>
> class openvpn {
>package { openvpn: ensure => latest }
>file {
>"/usr/share/openvpn/easy-rsa/2.0/keys":
>ensure => directory, owner => root, group => root, mode =>
> 600,
>file {
>"/usr/share/openvpn/easy-rsa/2.0/keys/ca.crt":
>source => "puppet://$server/openvpn/ca.crt",
>owner => root, group => root, mode => 600,
>require => File["/usr/share/openvpn/easy-rsa/2.0/keys"],
>}
> }
>
> Puppet is complaining with...
> Jun 19 11:35:59 node1 puppetd[3553]: (//Node[basenode]/openvpn/File[/
> usr/share/openvpn/easy-rsa/2.0/keys]/ensure) change from absent to
> directory failed: Cannot create /usr/share/openvpn/easy-rsa/2.0/
> keys; parent directory /usr/share/openvpn/easy-rsa/2.0 does not exist
>
> Shouldn't puppet automatically create all the subdirectories above usr/
> share/openvpn/easy-rsa/2.0 directory for me? If not, do I need to go
> and create dependancies for every single node in the directory
> hierarchy? That seems a little crazy. Isn't there a better way?
>
> Thanks,
> Doug.
>
>
>
>
>
>
>
> >
>


-- 
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-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: Automatically creating subdirectories?

2009-06-19 Thread Peter Meier

Hi

> Yeah, this is an old and know issue (unfortunately).
> 
> Original bug report:
> http://projects.reductivelabs.com/issues/86

well bug or more a philosphical question? The comments in the bug report
 describe a bit the problem puppet would run into if puppet would
auto-create them.

puppet manages resources and isn't just executing a bunch of commands in
a certain order.

cheers pete

--~--~-~--~~~---~--~~
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: Automatically creating subdirectories?

2009-06-19 Thread RijilV
2009/6/19 Douglas 

>
> I'm relatively new to puppet.
>
> Searched online, and could not find an answer to this. I have the
> following manifest snippet...



>
> [snip]



>
> Shouldn't puppet automatically create all the subdirectories above usr/
> share/openvpn/easy-rsa/2.0 directory for me? If not, do I need to go
> and create dependancies for every single node in the directory
> hierarchy? That seems a little crazy. Isn't there a better way?
>
> Thanks,
> Doug.
>

Yeah, this is an old and know issue (unfortunately).

Original bug report:
http://projects.reductivelabs.com/issues/86


You can work around it with a hackish exec:

exec { "mkdir -p /usr/share/openvpn/easy-rsa/2.0/keys": }

then tack that exec as a require to your file "/usr/share/openvpn/easy-rsa/
2.0/keys":

.r'



p.s.  puppet is smart enough to handle adding the dependency between the
directory and the file within that directory so you don't need that one
require you already have.  Also you can save yourself some typing by doing:

file {
"/dir":
   ensure => directory,
   mode => 644;
   "/dir/file":
content => "blah";
}

just note the ";" between items.

--~--~-~--~~~---~--~~
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: passenger on Mac OS X question

2009-06-19 Thread Nigel Kersten

On Fri, Jun 19, 2009 at 10:02 AM, Allan Marcus wrote:
>
> I think I found the issue. Looks like Passenger only works on Intel
> Macs. I'm using a PPC server for dev work. I will try on Intel.

Really? You should be able to compile it on PPC fine?

The passenger directives from the apache manual show you how to pick
the ruby interpreter.

It sounds to me like you're launching puppetmasterd some other way
other than inside Apache. Are you sure you're not?

>
> ---
> Thanks,
>
> Allan Marcus
> 505-667-5666
>
>
>
> On Jun 18, 2009, at 5:38 PM, Allan Marcus wrote:
>
>>
>> I think this might be a RUBYLIB issues. What is the best way to tell
>> my system to look for the libraries?
>>
>> For example: /opt/local/lib/ruby/gems/1.8/gems/rack-0.4.0/lib
>>
>> Is there any logging from Passenger as it tries to run the config.ru
>> file?
>>
>>
>> ---
>> Thanks,
>>
>> Allan Marcus
>> 505-667-5666
>>
>>
>>
>> On Jun 18, 2009, at 8:57 AM, Nigel Kersten wrote:
>>
>>>
>>>
>>> On Thu, Jun 18, 2009 at 6:28 AM, Allan Marcus  wrote:
>>>
>>> No, I'm not.
>>>
>>> bash-3.2# ps ax | grep -i pup
>>> 10815   ??  Ss     0:00.02 /opt/local/bin/ruby /opt/local/bin/
>>> puppetmasterd
>>>
>>> is there a special way I need to start puppetmasterd? Right now,
>>> since
>>> I'm just testing, I just start it on the command line as the root
>>> user.
>>>
>>> Don't start puppetmasterd. Just start Apache. It handles everything
>>> with Passenger so long as your virtual host and config.ru are set up
>>> correctly.
>>>
>>>
>>>
>>>
>>> ---
>>> Thanks,
>>>
>>> Allan Marcus
>>> 505-667-5666
>>>
>>>
>>>
>>> On Jun 17, 2009, at 7:41 PM, Nigel Kersten wrote:
>>>


 On Wed, Jun 17, 2009 at 5:46 PM, Allan Marcus 
>>> wrote:

 Yes, correct. But how can I tell if puppet is using Passenger?

 I see the following in my /var/log/apache2/error_log file:

 [Tue Jun 16 17:32:01 2009] [notice] Apache/2.2.11 (Unix) mod_ssl/
 2.2.11 OpenSSL/0.9.7l PHP/5.2.8 Phusion_Passenger/2.2.2 configured
>>> --
 resuming normal operations

 I see the following too:

 $ ps ax | grep -i Pass
 2436   ??  S      0:00.04 /opt/local/lib/ruby/gems/1.8/gems/
 passenger-2.2.2/ext/apache2/ApplicationPoolServerExecutable 0 /opt/
 local/lib/ruby/gems/1.8/gems/passenger-2.2.2/bin/passenger-spawn-
 server  /opt/local/bin/ruby  /tmp/passenger.2413
 2437   ??  S      1:28.57 Passenger spawn server

 but is a Passenger log? Is there anyway to confirm that puppet is
 using passenger?

 You're using passenger.

 Unless you also have a virtual host set up with mod_proxy to talk to
 mongrel backends, or have a standalone puppetmasterd process that is
 using webrick, you're using it.

 Are you seeing processes like this in your process listing?

 Rack: /usr/share/puppet/rack/puppetmasterd






 On Jun 17, 2009, at 6:34 PM, Nigel Kersten wrote:

>
>
> On Wed, Jun 17, 2009 at 5:21 PM, Allan Marcus 
 wrote:
>
> How can I tell if it's using Passenger?
>
> So how are you starting it now?
>
> If you've followed those instructions on the wiki, you should only
> be starting apache and nothing else, and the virtual host you've
> defined will be using passenger/Rack.
>
>
>
>
>
> ---
> Thanks,
>
> Allan Marcus
> 505-667-5666
>
>
>
> On Jun 16, 2009, at 6:24 PM, Nigel Kersten wrote:
>
>>
>> On Tue, Jun 16, 2009 at 4:39 PM, Allan Marcus
 wrote:
>>>
>>> hello,
>>>
>>> I have installed an configered passenger on my OS X server
> according
>>> to http://reductivelabs.com/trac/puppet/wiki/UsingPassenger
>>>
>>> Now, how do I tell puppet to use it? Do I need to put something
 in
>>> my /
>>> etc/puppet/puppet.conf file?
>>
>> Nope. If you have config.ru set up correctly, there's nothing
> special
>> for Passenger required in puppet.conf
>>
>> Just start apache, and it will set up a rack puppetmasterd
>> application.
>>
>>>
>>> ---
>>> Thanks,
>>>
>>> Allan Marcus
>>> 505-667-5666
>>>
>>>
>>>
>>>

>>>
>>
>>
>>
>> --
>> Nigel Kersten
>> nig...@google.com
>> System Administrator
>> Google, Inc.
>>
>>>
>
>
>
>
>
>
> --
> Nigel Kersten
> nig...@google.com
> System Administrator
> Google, Inc.
>
>>






 --
 Nigel Kersten
 nig...@google.com
 System Administrator
 Google, Inc.

>
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> Nigel Kersten
>>> nig...@google.com
>>> System Administrator
>>> Google, Inc.
>>>

>>
>>
>> >
>
>
> >
>



-- 
Nigel Kersten
nig...@google.com
System Administrator
Google, Inc.

--~--~-~--~~~---~--~~
You received this message because 

[Puppet Users] Automatically creating subdirectories?

2009-06-19 Thread Douglas

I'm relatively new to puppet.

Searched online, and could not find an answer to this. I have the
following manifest snippet...

class openvpn {
package { openvpn: ensure => latest }
file {
"/usr/share/openvpn/easy-rsa/2.0/keys":
ensure => directory, owner => root, group => root, mode =>
600,
file {
"/usr/share/openvpn/easy-rsa/2.0/keys/ca.crt":
source => "puppet://$server/openvpn/ca.crt",
owner => root, group => root, mode => 600,
require => File["/usr/share/openvpn/easy-rsa/2.0/keys"],
}
}

Puppet is complaining with...
Jun 19 11:35:59 node1 puppetd[3553]: (//Node[basenode]/openvpn/File[/
usr/share/openvpn/easy-rsa/2.0/keys]/ensure) change from absent to
directory failed: Cannot create /usr/share/openvpn/easy-rsa/2.0/
keys; parent directory /usr/share/openvpn/easy-rsa/2.0 does not exist

Shouldn't puppet automatically create all the subdirectories above usr/
share/openvpn/easy-rsa/2.0 directory for me? If not, do I need to go
and create dependancies for every single node in the directory
hierarchy? That seems a little crazy. Isn't there a better way?

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



[Puppet Users] Re: how to have "multilines" ?

2009-06-19 Thread Marziani, Michael

If this has already been mentioned in this thread i'm sorry (or if
you're not using an apt/yum capable system), but doesn't it seem simpler
to learn how to create a package of this and then you can simply use the
package facility:

package { $blender_current: ensure => installed }

best regards,

michael

From: puppet-users@googlegroups.com
[mailto:puppet-us...@googlegroups.com] On Behalf Of Trevor Vaughan

Serge,

If you want to do it this way, I would ditch the file type and do it
all in an exec:

define install_blender ( $version, $server ) {
  exec { "snarf_blender_$version":
command =>"wget -O /tmp/blender_$version.tar.gz
http://$server/blender_$version.tar.gz;
Just write the rest of your shell script;
normally here;",
onlyif => "test ! -f /tmp/blender_$version.tar.gz"
}

Good luck!

Trevor

On Thu, Jun 18, 2009 at 02:39, Serge LE
LOUARNE wrote:
> Hi,
>
> I install blender ;-)
>
> My pp file (in actual state, I have no backup of previous versions)  :
>
> class blender {
> file { "/tmp/blender-2.49-linux-glibc236-py25-i386.tar.bz2":
>owner => root,
>group => root,
>mode => 644,
> source =>
>
'puppet://formation01.giprecia.net/test/blender-2.49-linux-glibc236-py25
-i386.tar.bz2'}
> Exec { path => "/usr/bin:/bin:/usr/sbin:/sbin":logoutput => false,
> "tar -jxf
/tmp/blender-2.49-linux-glibc236-py25-i386.tar.bz2":logoutput
> => false,
> "cp -R  /tmp/blender-2.49-linux-glibc236-py25-i386
/opt/":logoutput =>
> false,
> "chmod -R  755
/opt/blender-2.49-linux-glibc236-py25-i386":logoutput =>
> false,
> "cp -R /opt/blender-2.49-linux-glibc236-py25-i386/.blender
> /home/serge/":logoutput => false,
> "chown -R serge:serge /home/serge/.blender":logoutput => false,
> unless => "test -d /home/serge/.blender" }
> }
>
> The "unless" statement isn't follow by the puppet agent. The logs said
that
> the 8th line is wrong : Puppet look for a "}" ...
>
> Thank
> Serge
>
> 2009/6/17 Evan Hisey 
>>
>> On Wed, Jun 17, 2009 at 8:56 AM,
>> serge.leloua...@free.fr wrote:
>> >
>> > Hi
>> >
>> > All is in title ;-)
>> >
>> > I have to run multiples Bash commands. It is just for readability
of
>> > the pp file.
>> >
>> > Thank
>> > Serge
>> What are you trying to do? It sounds like you are trying to work
>> against the way puppet operates.
>>
>> Evan
>>
>>
>
>
> >
>





--~--~-~--~~~---~--~~
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: Is there a way to write to a file using puppet

2009-06-19 Thread RijilV

2009/6/19 Swati Tiwari :
> Hey Guys,
>
> I am sorry if this sounds silly but I am new to puppet. I am trying to
> append a particular line to the apt.conf file on all the clients that are
> running puppetd. Is there any way to do this using puppet. Any help would be
> appreciated!
>
> Thank you!
>
> --
> Regards,
> Swati


http://reductivelabs.com/trac/puppet/wiki/Recipes/SimpleText

Or take a look at Augeas, provided there is already a lens for
apt.conf or you're comfortable writing one, would likely be a cleaner
way of handling this.

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



[Puppet Users] Is there a way to write to a file using puppet

2009-06-19 Thread Swati Tiwari
Hey Guys,

I am sorry if this sounds silly but I am new to puppet. I am trying to
append a particular line to the apt.conf file on all the clients that are
running puppetd. Is there any way to do this using puppet. Any help would be
appreciated!

Thank you!

-- 
Regards,
Swati

--~--~-~--~~~---~--~~
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: passenger on Mac OS X question

2009-06-19 Thread Allan Marcus

I think I found the issue. Looks like Passenger only works on Intel  
Macs. I'm using a PPC server for dev work. I will try on Intel.

---
Thanks,

Allan Marcus
505-667-5666



On Jun 18, 2009, at 5:38 PM, Allan Marcus wrote:

>
> I think this might be a RUBYLIB issues. What is the best way to tell
> my system to look for the libraries?
>
> For example: /opt/local/lib/ruby/gems/1.8/gems/rack-0.4.0/lib
>
> Is there any logging from Passenger as it tries to run the config.ru
> file?
>
>
> ---
> Thanks,
>
> Allan Marcus
> 505-667-5666
>
>
>
> On Jun 18, 2009, at 8:57 AM, Nigel Kersten wrote:
>
>>
>>
>> On Thu, Jun 18, 2009 at 6:28 AM, Allan Marcus  wrote:
>>
>> No, I'm not.
>>
>> bash-3.2# ps ax | grep -i pup
>> 10815   ??  Ss 0:00.02 /opt/local/bin/ruby /opt/local/bin/
>> puppetmasterd
>>
>> is there a special way I need to start puppetmasterd? Right now,  
>> since
>> I'm just testing, I just start it on the command line as the root
>> user.
>>
>> Don't start puppetmasterd. Just start Apache. It handles everything
>> with Passenger so long as your virtual host and config.ru are set up
>> correctly.
>>
>>
>>
>>
>> ---
>> Thanks,
>>
>> Allan Marcus
>> 505-667-5666
>>
>>
>>
>> On Jun 17, 2009, at 7:41 PM, Nigel Kersten wrote:
>>
>>>
>>>
>>> On Wed, Jun 17, 2009 at 5:46 PM, Allan Marcus 
>> wrote:
>>>
>>> Yes, correct. But how can I tell if puppet is using Passenger?
>>>
>>> I see the following in my /var/log/apache2/error_log file:
>>>
>>> [Tue Jun 16 17:32:01 2009] [notice] Apache/2.2.11 (Unix) mod_ssl/
>>> 2.2.11 OpenSSL/0.9.7l PHP/5.2.8 Phusion_Passenger/2.2.2 configured
>> --
>>> resuming normal operations
>>>
>>> I see the following too:
>>>
>>> $ ps ax | grep -i Pass
>>> 2436   ??  S  0:00.04 /opt/local/lib/ruby/gems/1.8/gems/
>>> passenger-2.2.2/ext/apache2/ApplicationPoolServerExecutable 0 /opt/
>>> local/lib/ruby/gems/1.8/gems/passenger-2.2.2/bin/passenger-spawn-
>>> server  /opt/local/bin/ruby  /tmp/passenger.2413
>>> 2437   ??  S  1:28.57 Passenger spawn server
>>>
>>> but is a Passenger log? Is there anyway to confirm that puppet is
>>> using passenger?
>>>
>>> You're using passenger.
>>>
>>> Unless you also have a virtual host set up with mod_proxy to talk to
>>> mongrel backends, or have a standalone puppetmasterd process that is
>>> using webrick, you're using it.
>>>
>>> Are you seeing processes like this in your process listing?
>>>
>>> Rack: /usr/share/puppet/rack/puppetmasterd
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Jun 17, 2009, at 6:34 PM, Nigel Kersten wrote:
>>>


 On Wed, Jun 17, 2009 at 5:21 PM, Allan Marcus 
>>> wrote:

 How can I tell if it's using Passenger?

 So how are you starting it now?

 If you've followed those instructions on the wiki, you should only
 be starting apache and nothing else, and the virtual host you've
 defined will be using passenger/Rack.





 ---
 Thanks,

 Allan Marcus
 505-667-5666



 On Jun 16, 2009, at 6:24 PM, Nigel Kersten wrote:

>
> On Tue, Jun 16, 2009 at 4:39 PM, Allan Marcus
>>> wrote:
>>
>> hello,
>>
>> I have installed an configered passenger on my OS X server
 according
>> to http://reductivelabs.com/trac/puppet/wiki/UsingPassenger
>>
>> Now, how do I tell puppet to use it? Do I need to put something
>>> in
>> my /
>> etc/puppet/puppet.conf file?
>
> Nope. If you have config.ru set up correctly, there's nothing
 special
> for Passenger required in puppet.conf
>
> Just start apache, and it will set up a rack puppetmasterd
> application.
>
>>
>> ---
>> Thanks,
>>
>> Allan Marcus
>> 505-667-5666
>>
>>
>>
>>
>>>
>>
>
>
>
> --
> Nigel Kersten
> nig...@google.com
> System Administrator
> Google, Inc.
>
>>






 --
 Nigel Kersten
 nig...@google.com
 System Administrator
 Google, Inc.

>
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> Nigel Kersten
>>> nig...@google.com
>>> System Administrator
>>> Google, Inc.
>>>

>>
>>
>>
>>
>>
>>
>> -- 
>> Nigel Kersten
>> nig...@google.com
>> System Administrator
>> Google, Inc.
>>
>>>
>
>
> >


--~--~-~--~~~---~--~~
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: how to have "multilines" ?

2009-06-19 Thread Trevor Vaughan

Serge,

If you want to do it this way, I would ditch the file type and do it
all in an exec:

define install_blender ( $version, $server ) {
  exec { "snarf_blender_$version":
command =>"wget -O /tmp/blender_$version.tar.gz
http://$server/blender_$version.tar.gz;
Just write the rest of your shell script;
normally here;",
onlyif => "test ! -f /tmp/blender_$version.tar.gz"
}

Good luck!

Trevor

On Thu, Jun 18, 2009 at 02:39, Serge LE
LOUARNE wrote:
> Hi,
>
> I install blender ;-)
>
> My pp file (in actual state, I have no backup of previous versions)  :
>
> class blender {
> file { "/tmp/blender-2.49-linux-glibc236-py25-i386.tar.bz2":
>owner => root,
>group => root,
>mode => 644,
> source =>
> 'puppet://formation01.giprecia.net/test/blender-2.49-linux-glibc236-py25-i386.tar.bz2'}
> Exec { path => "/usr/bin:/bin:/usr/sbin:/sbin":logoutput => false,
> "tar -jxf /tmp/blender-2.49-linux-glibc236-py25-i386.tar.bz2":logoutput
> => false,
> "cp -R  /tmp/blender-2.49-linux-glibc236-py25-i386 /opt/":logoutput =>
> false,
> "chmod -R  755 /opt/blender-2.49-linux-glibc236-py25-i386":logoutput =>
> false,
> "cp -R /opt/blender-2.49-linux-glibc236-py25-i386/.blender
> /home/serge/":logoutput => false,
> "chown -R serge:serge /home/serge/.blender":logoutput => false,
> unless => "test -d /home/serge/.blender" }
> }
>
> The "unless" statement isn't follow by the puppet agent. The logs said that
> the 8th line is wrong : Puppet look for a "}" ...
>
> Thank
> Serge
>
> 2009/6/17 Evan Hisey 
>>
>> On Wed, Jun 17, 2009 at 8:56 AM,
>> serge.leloua...@free.fr wrote:
>> >
>> > Hi
>> >
>> > All is in title ;-)
>> >
>> > I have to run multiples Bash commands. It is just for readability of
>> > the pp file.
>> >
>> > Thank
>> > Serge
>> What are you trying to do? It sounds like you are trying to work
>> against the way puppet operates.
>>
>> Evan
>>
>>
>
>
> >
>

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