[Puppet Users] augeas

2013-04-29 Thread Stanislas LEVEAU
Hello

I use augeas to replace a value in a config file:

example (this example is good) :

/etc/ssh/sshd_config file

LogLevel INFO


class ssh::redhat {
augeas { "sshd_config":
  context => "/files/etc/ssh/sshd_config",
  changes => [
"set LogLevel VERBOSE",
  ],
  notify => Service["sshd"],
}

This configuration is good

but how do when the file is written like this:

parameter = value (with =)


/etc/webmin/config file

lang = us


class webmin::redhat {
augeas { "config":
  context => "/files/etc/webmin/config",
  changes => [
"set "lang =" fr]",
  ],
}
}

this configuration is not good, did you have an idea?
regards

-- 
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] High Availability of Puppet server for separate geographical location

2013-04-29 Thread shyam sundar Keshari
Hi Team,

I have to configure puppet server in Primary-Secondary mode for 2
distributed location .

Site A is already running 1 Puppet server .Now I need to configure
another puppet secondary server at site B ,so that

all client at location B ,only connect to that server .And site A
puppet client only connect to site A .

But mine requirement is of that suppose site A server goes down then
Site B server handle all client request and

same if Site B server down then server A handles all .

Kindly guide me to implement this scenario .

Thanks in Advance

Shyam

-- 
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] rspec-puppet testing with puppet $::settings

2013-04-29 Thread Simon Piette
Hi all,

Let's say I have this in a manifest:

file { "${::settings::vardir}/files":
  ensure => directory
}

And I want to test it in the catalog using:

it { should create_file('/var/lib/puppet/files') }

It won't work because an mktemp directory is made for vardir for each
catalogue. The catalogue will containt a
File[/tmp/d20130429-26229-3glbki/files] reference.

Curiously, in the "it" block, Puppet[:ssldir] is expanded to /dev/null/ssl
and Puppet[:vardir] to /dev/null (consequently).

Is it possible to access the Puppet[:vardir] from the
{Class,Define,Host}ExampleGroup?
Or any other $::settings variables?

Other ways would be to include a puppet.conf to inject settings, or as we
already do with facts, inject :settings at the beginning of the describe
block.

Any solution for testing variables that depends on settings will be welcome.

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




Re: [Puppet Users] [ANN] puppet-cleaner 0.2.0

2013-04-29 Thread Chris Hirsch

On 4/29/13 7:43 PM, Gerardo Santana Gómez Garrido wrote:

This release was tested successfully with puppet 3.
If I understand correctly this should be compatible with puppet 3 so you 
may want to update your Requirements as it says it's 2.7.11 only. Thank 
for the work I'll be checking this out tomorrow!


--
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] [ANN] puppet-cleaner 0.2.0

2013-04-29 Thread Gerardo Santana Gómez Garrido
This release was tested successfully with puppet 3.

puppet-cleaner is a set of tools that helps you keep your manifests 
compliant with the style guide.

Website:
  https://github.com/santana/puppet-cleaner/

How to install:
  sudo gem install puppet-cleaner

-- 
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] What's my syntax problem: "Could not match 'c:/tmp' " ?

2013-04-29 Thread Larry Fast
I assume I have a syntax problem of some kind. I created a class file and 
puppet complains on line 4.  If I remove that block of code it complains 
about the next block. What silly little mistake have I made?  The error 
reported for the code example below is:

Could not match ‘george’, at 
/etc/puppet/environments/dev22/modules/custom_facts/manifests/virtuals.pp:4

class custom_facts::virtuals() {
  
  $tmp1 = $operatingsystem ? {
/hello/   => ‘george’,
/windows/ => 'C:/tmp',
default  => ‘/tmp’,
  }
  @file { 'tmp':
   ensure => directory,
   path => "$tmp1",
  }

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




Re: [Puppet Users] Help me with overriding define resource

2013-04-29 Thread Felix Frank
John, you're such a tease ;-)

While I mostly agree with the points you're making (as so often), I feel
that this thread is incomplete without giving an example of the
syntactically correct implementation of the original idea.

Note that this approach has a number of issues and should usually be
avoided. Use at your own peril.

class composition {
  include base_class

  // wrong:
  //Definition['TestCase'] {
  // right:
  Definition<| title == 'TestCase' |> {
var => '/tmp/bar',
  }
}

On 04/24/2013 03:56 PM, jcbollinger wrote:
> A class represents some coherent unit of configuration space (or ought
> to do), so why would it be sensible to allow random declarations in any
> unrelated place to override the declarations a given class makes?  Using
> a subclass to declare overrides involves at least a pro forma
> acknowledgement that the purpose and use of the overridden declaration
> is understood at the point where it is override is declared. 
> Composition does not have the same effect.

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 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] Re: hiera malformed format string - %S

2013-04-29 Thread Luca Gioppo
This happens when one doesn't study all specs around :D

Thanks.

Luca

-- 
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] Re: Sharing data between nodes with hiera

2013-04-29 Thread Luca Gioppo
I'm new of hiera and I was thinking that it was possible to declare hiera 
variables just linked to nodes or classes.

Indeed the option of getting the data using the hiera() function allows for 
a common.yaml file to host the global information and thus will follow your 
suggestion on having classes that build the needed configuration.
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 post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Puppet Users] ppg: Scheduled rollouts and dashboard with git in decentralized setup

2013-04-29 Thread Felix Frank
Interesting. It seems nicely thought out, but I stumbled here, reading:

On 04/23/2013 11:22 PM, Martin Langhoff wrote:
> I am less certain of this part, and input will be specially valuable here.
> 
> ppg pullapply will...
> 
>  -  apply changes locally, capture stderr/stdout, perhaps more info
> that can be negotiated with the puppet client ("facts"?).
>  - write state to file(s) in a "puppet-feedback" git repo, commit that state
>  - push to a "feedback" rw repo on the gold server (or on the proxy server)

Uhm, what? Why? Why is there a git repository for your transient puppet
reports?

You're reinventing the wheel I think (although your's a bit square-ish ;)

Doesn't the dashboard usually consume the report as generated by the
agent? Therefor, isn't what you want a way to transfer that very report
from the agents to the dashboard? I vaguely remember an issue with
masterless not generating reports, but I may misremember this one.

> Once the data reaches the dashboard server, it gets fed to the Puppet
> Dashboard thingamajig, butterfly-mode is automagically enabled in your
> emacs session and you're so so glad you took the blue pill.
> 
> thoughts? comments? bikesheds?

Yes, actually: I disbelieve puppet runs in Emacs (yet).

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




Re: [Puppet Users] Re: Hiera error in Puppet: undefined method `empty?'

2013-04-29 Thread Felix Frank
Oh, didn't see that at first. Way to go!

On 04/22/2013 11:55 PM, John George wrote:
> I just figured out the error. The keyring had the wrong ownership
> permissions!
> 
> I guess writing out the problem can help figure out the issue. Hope this
> will help someone else save time and effort.

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




Re: [Puppet Users] Hiera error in Puppet: undefined method `empty?'

2013-04-29 Thread Felix Frank
Hi John,

this is me replying late because I can't thrawl the list that often.

On 04/22/2013 10:53 PM, John George wrote:
> 
> The error message indicates to me that the lookup from Hiera is failing.

How so?

Anyway, first debugging steps:

1. Does the error disappear when you set $lookup = 'foo'

2. Does the error disapper when you change the variable name, say $foo =
hiera(...)

3. Does the error disappear when you comment out the other declarations
in the class body?

Thanks,
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 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] Re: How do I automagically remove old versions of jar files?

2013-04-29 Thread Larry Fast
Thank you all.  Yes, tidy should be exactly what I need.

-- 
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] Re: hiera malformed format string - %S

2013-04-29 Thread Ellison Marks
Tabs are not allowed as indentation in yaml. They are allowed as whitespace.

http://www.yaml.org/spec/1.2/spec.html#id2775170
http://www.yaml.org/spec/1.2/spec.html#id2777534

On Monday, April 29, 2013 7:07:55 AM UTC-7, Luca Gioppo wrote:
>
> OK, solved!!
> The problem was the TAV character that notepad++ added to the hash.
> It seems that something in ruby does not like it (do not know ruby so...) 
>
> If this is the correct behaviour there should be somewhere in the docs a 
> warning for DO NOT USE TABS IN YAML file as it took quite asome time to 
> find out.
>
> If is not a correct behaviour than is a bug :P
> Luca
>
>
> Il giorno lunedì 29 aprile 2013 15:15:05 UTC+2, Luca Gioppo ha scritto:
>>
>> I'm trying to use hiera.
>>
>> The common.yaml is
>>
>>
>> greg: 
>> db_type: "mysql"
>> db_host: %{::domain}
>> db_name: "odaigreg"
>> db_user: "odaigreg"
>> db_password: "odaigreg1"
>> db_tag: "greg_db"
>> is_remote: "true"
>>
>> and the command
>> hiera -c /etc/puppet/environments/production/hiera.yaml greg 
>> environment=production confdir="/etc/puppet" -d
>>
>> returns:
>> DEBUG: Mon Apr 29 15:11:48 +0200 2013: Hiera YAML backend starting
>> DEBUG: Mon Apr 29 15:11:48 +0200 2013: Looking up greg in YAML backend
>> DEBUG: Mon Apr 29 15:11:48 +0200 2013: Looking for data source common
>> /usr/lib/ruby/site_ruby/1.8/hiera/filecache.rb:35:in `%': malformed 
>> format string - %S (ArgumentError)
>> from /usr/lib/ruby/site_ruby/1.8/hiera/filecache.rb:35:in `read'
>> from 
>> /usr/lib/ruby/site_ruby/1.8/hiera/backend/yaml_backend.rb:22:in `lookup'
>> from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:68:in 
>> `datasources'
>> from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:66:in `map'
>> from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:66:in 
>> `datasources'
>> from 
>> /usr/lib/ruby/site_ruby/1.8/hiera/backend/yaml_backend.rb:16:in `lookup'
>> from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:182:in `lookup'
>> from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:179:in `each'
>> from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:179:in `lookup'
>> from /usr/lib/ruby/site_ruby/1.8/hiera.rb:64:in `lookup'
>> from /usr/bin/hiera:220
>>
>>
>> The hiera.yaml is:
>> :backends: yaml
>> :yaml:
>>   :datadir: /etc/puppet/environments/production/hieradata
>> :hierarchy: common
>> :logger: console
>>
>> Any hints on something I missed?
>> Thanks
>> Luca
>>
>>

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




Re: [Puppet Users] Microsoft dotNet Framework 4.0 (.net, .netfx, dotnetfx)

2013-04-29 Thread Kevin D
In order to resolve this limitation, I wrote a PowerShell script to install 
.NET 4.  The script checks if the specified components (MSIs) are 
installed. If one or all of the components are missing, the script will 
perform a silent install of 'dotNetFx40_Full_x86_x64.exe'.

-Kevin

On Tuesday, April 16, 2013 6:06:27 PM UTC-6, Kevin D wrote:
>
> Josh,
>
> Thanks for the prompt reply!  I forgot about that requirement for the 
> resource name.  
>
> This leads to an interesting issue.  The file 
> 'dotNetFx40_Full_x86_x64.exe' performs, two installations:
>
>- Microsoft .NET Framework 4 Extended
>
>
>- Microsoft .NET Framework 4 Client Profile
>
> Is there a suggestion other than extracting the associated MSIs 
> 'dotNetFx40_Full_x86_x64.exe' and writing two resources (to install each of 
> the MSIs [so the resource name may match the display DisplayName])?
>
> -Kevin
>
> On Tuesday, April 16, 2013 2:55:19 PM UTC-6, Josh Cooper wrote:
>>
>>
>>
>>
>> On Tue, Apr 16, 2013 at 12:56 PM, Kevin D  wrote:
>>
>>> I noticed an issue when trying to deploy Microsoft .NET Framework 4.0 
>>> using Puppet's package resource type.  On first run, Puppet appropriately 
>>> installs the package.  But on each subsequent run, puppet invokes a repair 
>>> of the framework (see attached picture).
>>>
>>> Has anyone else encountered this? Is there a resolution?
>>>
>>> -Kevin
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Puppet Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to puppet-users...@googlegroups.com.
>>> To post to this group, send email to puppet...@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.
>>>  
>>>  
>>>
>>
>> This is almost certainly because the name of the resource in your 
>> manifest needs to match the product that was installed. Otherwise, puppet 
>> thinks the product isn't installed and will re-install it, which results in 
>> the repair dialog.
>>
>> See http://projects.puppetlabs.com/issues/19747 and 
>> http://docs.puppetlabs.com/windows/writing.html#packagepackage
>>
>> Nearly every Windows user runs into this, and Klavs submitted a proposal 
>> to at least warn if you get in this state: 
>> http://projects.puppetlabs.com/issues/19782.
>>
>> Josh
>>
>> -- 
>> Josh Cooper
>> Developer, Puppet Labs
>>
>> *Join us at PuppetConf 2013, August 22-23 in San Francisco - *
>> http://bit.ly/pupconf13*
>> **The first 150 tickets sold will be available at a 35% discount - 
>> register now! Offer expires April 22.*
>>  
>

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




[Puppet Users] Puppet Windows - Mapped Network Drive and Service Account

2013-04-29 Thread Kevin D
On Windows 2008 R2 SP1, after joining to the domain, there is an issue with 
a mapped network drive when Puppet agent runs by the "LOCAL SYSTEM" service 
account.

Using dependency chaining, a near the beginning module is 
"map-networkdrivez". The module execs a batch file that if Z:\ does not 
exist (not already mapped), maps Z:\ to a Windows 2008 R2 SP1 file server 
with a hidden share "data$". The file server is configured for anonymous to 
allow share access (with the appropriate NTFS and Share permissions).

By default, when the puppet agent runs as the service, the associated 
service account is "local system". On first run, the batch file 
appropriately maps the drive and the modules have access to the resources 
of the mapped network drive.

Once a module executes that joins the computer to the domain and restarts 
the computer, subsequent puppet runs fail because of a failed resource 
dependency on Z:\:

 Could not evaluate. Could not retrieve information from environment 
production source(s) file:/z:/Install-Exe.ps1

I setup a SysInternal's Process Monitor trace during a puppet run:

Path   = "\\;LanmanRedirector\;Z:03e7\10.202.1.27\Data$\"
Result = "ACCESS DENIED".

I verified the same result using psexec to open a cmd prompt under the 
"LOCAL SYSTEM" account by opening a CMD with administrative privileges, 
running "psexec -hsi cmd" and navigating to "z:"

Access is denied.

If using the local administrator account I open a cmd prompt  run 
"C:\Program Files(x86)\Puppet Labs\Puppet\bin\puppet agent -t" all the 
modules will execute successfully.
If I change the Puppet service account from "LOCAL SYSTEM" to 
"testwindows004\Administrator" all the modules will execute successfully.

Has anyone else seen this behavior? Any thoughts on how to overcome this 
issue?

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


@ECHO OFF

NET USE * /DELETE /YES

IF NOT EXIST Z:\ (
ECHO "Z:\ Does not exist.  Will connect to Z:\"
NET USE Z: \\10.202.1.27\Data$ /PERSISTENT:NO
) ELSE (
ECHO "Z:\ exists."
)

ECHO "Pause 10 seconds"
Ping 1.1.1.1 -n 10 > NUL

ECHO "NET USE"
NET USE

ECHO "Map Network Drive script complete."



init.pp
Description: Binary data


[Puppet Users] Re: Sharing data between nodes with hiera

2013-04-29 Thread jcbollinger


On Monday, April 29, 2013 2:12:54 AM UTC-5, Luca Gioppo wrote:
>
> I have this, I think common, situation:
>
> - NodeDB VM with MySQL
> - NodeApp VM with an application that uses the MySQL DB
>
> Obivuously both needs to have information on the DB (like user, DB name, 
> etc.)
> Since DB will be created in the NodeDB by the MySQL module from puppetlabs 
> and the app will just connect to the DB and do its work, but need to set 
> the configuration parameters.
>
> Now ...
> since App can be installed at any moments at a precise point in time will 
> have to modify the NodeDB definition adding the DB for app and than 
> create/modify the NodeApp to configure app.
>
> Can I write down the DB info just once in hiera and refer to these common 
> data from the two nodes?



Yes, absolutely.  This sort of thing is one of hiera's core use cases.  Did 
you have specific concerns about it?

 

> Also passing this data to standard modules in a proper way?
>
>

I don't understand what you're asking.  In particular, I don't know what 
"standard modules" means to you.  Generally speaking, however, there are 
three key ways by which classes (in modules) can obtain data to work with:

   1. The data can be hard-coded into the class
   2. The data can be drawn from class variables (including a class's own 
   parameters)
   3. The data can be retrieved or computed via a function

If the main source of the data is hiera, then ultimately option 3 is how 
the data get into Puppet (using the hiera() function explicitly or else 
relying on automated class parameter binding).  The main decision you have 
here is whether option 3 will be used everywhere the data in question are 
needed, or whether it will be used once to set class variables (maybe 
parameters) of one or more classes, and then other classes will obtain it 
via those class variables.

 

> This could become handy when I'll have to add a third node, let's say 
> NodeBI that needs to access the app DB for business intelligence reasons, 
> so I'll have to configure a new node with the same DB data.
>
> I think that there is the need to access a much higher scope information, 
> but haven't found any clear (at least for me) documentation on this.
>


You should consider creating a class purposed with stewardship of the 
data.  It would load them from hiera either via explicit hiera() calls (my 
preference) or via automated binding to class parameters (Puppet 3+ only).  
Other classes that need the data would then reference the steward class's 
class variables to get them.  Place the steward class in an appropriate 
module and give it an appropriate name for the scope of the data it handles.


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




Re: [Puppet Users] checking puppet run status of node A during puppet run of node B

2013-04-29 Thread Keith Burdis
I don't believe there is any existing Puppet functionality that does this
though the Capabilities
armature
discusses
a potential future solution.

You might find 
dalen/puppetdbquery
useful
for your solution.

  - Keith



On 29 April 2013 14:18, Schofield  wrote:

> I have some middleware where the successful configuration of node B is
> dependent on the successful configuration of node A.  Node B must pull
> additional information from node A during its configuration.  Is there any
> built in functionality in puppet for checking the completion status of
> other nodes?  Right now my intent is to write a custom function to query
> the puppetdb which is storing reports.  I want to make sure I am not
> missing some other elegant solution in puppet that already does this.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users+unsubscr...@googlegroups.com.
> To 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.
>
>
>

-- 
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] Re: hiera malformed format string - %S

2013-04-29 Thread Luca Gioppo
OK, solved!!
The problem was the TAV character that notepad++ added to the hash.
It seems that something in ruby does not like it (do not know ruby so...) 

If this is the correct behaviour there should be somewhere in the docs a 
warning for DO NOT USE TABS IN YAML file as it took quite asome time to 
find out.

If is not a correct behaviour than is a bug :P
Luca


Il giorno lunedì 29 aprile 2013 15:15:05 UTC+2, Luca Gioppo ha scritto:
>
> I'm trying to use hiera.
>
> The common.yaml is
>
>
> greg: 
> db_type: "mysql"
> db_host: %{::domain}
> db_name: "odaigreg"
> db_user: "odaigreg"
> db_password: "odaigreg1"
> db_tag: "greg_db"
> is_remote: "true"
>
> and the command
> hiera -c /etc/puppet/environments/production/hiera.yaml greg 
> environment=production confdir="/etc/puppet" -d
>
> returns:
> DEBUG: Mon Apr 29 15:11:48 +0200 2013: Hiera YAML backend starting
> DEBUG: Mon Apr 29 15:11:48 +0200 2013: Looking up greg in YAML backend
> DEBUG: Mon Apr 29 15:11:48 +0200 2013: Looking for data source common
> /usr/lib/ruby/site_ruby/1.8/hiera/filecache.rb:35:in `%': malformed format 
> string - %S (ArgumentError)
> from /usr/lib/ruby/site_ruby/1.8/hiera/filecache.rb:35:in `read'
> from 
> /usr/lib/ruby/site_ruby/1.8/hiera/backend/yaml_backend.rb:22:in `lookup'
> from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:68:in 
> `datasources'
> from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:66:in `map'
> from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:66:in 
> `datasources'
> from 
> /usr/lib/ruby/site_ruby/1.8/hiera/backend/yaml_backend.rb:16:in `lookup'
> from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:182:in `lookup'
> from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:179:in `each'
> from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:179:in `lookup'
> from /usr/lib/ruby/site_ruby/1.8/hiera.rb:64:in `lookup'
> from /usr/bin/hiera:220
>
>
> The hiera.yaml is:
> :backends: yaml
> :yaml:
>   :datadir: /etc/puppet/environments/production/hieradata
> :hierarchy: common
> :logger: console
>
> Any hints on something I missed?
> Thanks
> Luca
>
>

-- 
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] Re: Learning puppet: how to use a module?

2013-04-29 Thread jcbollinger


On Sunday, April 28, 2013 4:40:01 AM UTC-5, Leonard Ehrenfried wrote:
>
> Hi,
>
> I'm currently learning puppet but I have come across something which I 
> can't figure out from the docs.
>
> I have a rails app, which needs a few Ubuntu packages installed to work. 
> Some of those come from a PPA, which is a non-standard repository, which 
> needs to be added to the list of repos. I would like to automate this step, 
> too.
>
> I have just one node where puppet needs to run, so I just have one file 
> which I execute with `puppet apply`. I'm not using a puppetmaster.
>
> The pp file can be viewed here: 
> https://github.com/lenniboy/jcheld/blob/master/puppet/jcheld.pp
>
> I have installed the puppetlabs-apt module and I can see that that was 
> successful like this:
>
> $ puppet module list
> /home/lenni/.puppet/modules
> ├── puppetlabs-apt (v1.1.0)
> └── puppetlabs-stdlib (v4.0.2)
>
> Now, when I run puppet I get the following error:
>
> $ sudo puppet apply puppet/jcheld.pp
> Error: Could not find class apt for 
> ip-10-59-51-209.eu-west-1.compute.internal on node 
> ip-10-59-51-209.eu-west-1.compute.internal
> Error: Could not find class apt for 
> ip-10-59-51-209.eu-west-1.compute.internal on node 
> ip-10-59-51-209.eu-west-1.compute.internal
>
> I think it is likely that I'm not understanding something fundamentally 
> about how modules are supposed to be used.
>

I think a key thing you have missed is that when you install a module by 
hand, you are meant to remove the leading "-" segment of its 
directory name.  Use of such prefixes helps avoid accidentally clobbering 
one module's contents with those of a distinct yet like-named module's, but 
you cannot actually have two different modules with the same name installed 
(and functional) at the same time.


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 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] Re: Create a file which lists all server names with a given environment variable

2013-04-29 Thread jcbollinger


On Friday, April 26, 2013 12:36:21 PM UTC-5, phundisk wrote:
>
> I am presuming that this is something I need to do with stored configs, 
> but there might also be another way to do it.
>
> I am looking to create a file called /root/production.servers which will 
> list all my production servers.  All production servers have the puppet 
> variable of $environment='production' in the nodes.pp.  Is there a way I 
> can utilize this variable to create this file?  Is stored configs the best 
> option here?
>

There are basically two approaches:

   1. The master knows at all times which nodes are supposed to be 
   production servers.  This would involve an exhaustive list of the 
   production servers in a Puppet manifest or in a data file read by the 
   master.  In this case, you would probably just build the file via a 
   template and apply it as a normal File resource.  No stored configs are 
   needed for this.
   2. What I think you're saying, though, is that you want Puppet to 
   dynamically recognize nodes based on their self-declared environment (if 
   the master were choosing the environment rather than the agent, then you 
   would have case 1).  The most natural way to handle this situation is via 
   exported resources (which requires stored configs).

For case 2, the key thing to remember is that each production server must 
declare and export a distinct resource that describes its own node-specific 
data.  That's not the whole file, but rather just a piece of one.  The 
Concat add-in module is perfect for this sort of thing.  You might use it 
like so:

# This class must be included on production servers
# (and not on other nodes).
class prod::server {
  # Export a line of the production server list
  @@concat::fragment { "prodserver-${hostname}":
target => '/root/production.servers',
content => "${hostname}\n"
  }
}

# Nodes that should have the server list declare this class;
# they may be production servers, but do not need to be.
class prod::serverlist {

  # The target file
  concat { '/root/production.servers':
owner => 'root',
group => 'root',
mode => '0644'
  }

  # Import all the fragments:
  Concat::Fragment<<| target == '/root/production.servers' |>>
}


The final piece, then, is to ensure that class 'prod::server' gets declared 
on all the production servers, and only those.  If you're going to use the 
$environment variable to control this, then that means putting a 
conditional statement such as this one somewhere that that is evaluated for 
every node:

if $environment == 'production' {
  include 'prod::server'
}

That could go in a shared base node or in a common class that all nodes 
declare.


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 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] Re: can puppet agent use 2 independent puppet master ?

2013-04-29 Thread jcbollinger


On Saturday, April 27, 2013 3:32:36 AM UTC-5, Alex Leonhardt wrote:
>
> Hi all, 
>
> I havent seen a similar post, so thought I'd ask - 
>
> Is it possible to make a puppet agent use 2 different puppet masters ?
>


One agent is associated with one master.  It cannot talk to two.  In 
principle, you could run two independent agents on the same node, talking 
to different masters, but this is a very bad idea.

 

> E.g. I want to use 1 master to do basic configuration changes, etc. and a 
> 2nd master to do other more application specific changes - the idea is to 
> keep the system changes fully separated from the application changes that 
> would be applied. 
>


Impossible.  Your application is dependent on the underlying basic system 
configuration, so no matter what you do you cannot keep them fully 
separated.  You could draw an arbitrary line somewhere to partition your 
configured resources between two masters, but all that really would do is 
make things harder for you by preventing you from expressing relationships 
between resources assigned to different partitions.

There are a number of things you can do to organize resources within a 
single master.  The most basic is to use modules appropriately.  If you 
want physical separation of manifests on your master, then you can add one 
or more directories to your module path so that you can put your 
application modules in a separate tree from your base-system modules.  
There may be other things you can do to address specific concerns.


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 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] checking puppet run status of node A during puppet run of node B

2013-04-29 Thread Schofield
I have some middleware where the successful configuration of node B is 
dependent on the successful configuration of node A.  Node B must pull 
additional information from node A during its configuration.  Is there any 
built in functionality in puppet for checking the completion status of 
other nodes?  Right now my intent is to write a custom function to query 
the puppetdb which is storing reports.  I want to make sure I am not 
missing some other elegant solution in puppet that already does this.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To 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] hiera malformed format string - %S

2013-04-29 Thread Luca Gioppo
I'm trying to use hiera.

The common.yaml is


greg: 
db_type: "mysql"
db_host: %{::domain}
db_name: "odaigreg"
db_user: "odaigreg"
db_password: "odaigreg1"
db_tag: "greg_db"
is_remote: "true"

and the command
hiera -c /etc/puppet/environments/production/hiera.yaml greg 
environment=production confdir="/etc/puppet" -d

returns:
DEBUG: Mon Apr 29 15:11:48 +0200 2013: Hiera YAML backend starting
DEBUG: Mon Apr 29 15:11:48 +0200 2013: Looking up greg in YAML backend
DEBUG: Mon Apr 29 15:11:48 +0200 2013: Looking for data source common
/usr/lib/ruby/site_ruby/1.8/hiera/filecache.rb:35:in `%': malformed format 
string - %S (ArgumentError)
from /usr/lib/ruby/site_ruby/1.8/hiera/filecache.rb:35:in `read'
from 
/usr/lib/ruby/site_ruby/1.8/hiera/backend/yaml_backend.rb:22:in `lookup'
from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:68:in 
`datasources'
from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:66:in `map'
from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:66:in 
`datasources'
from 
/usr/lib/ruby/site_ruby/1.8/hiera/backend/yaml_backend.rb:16:in `lookup'
from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:182:in `lookup'
from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:179:in `each'
from /usr/lib/ruby/site_ruby/1.8/hiera/backend.rb:179:in `lookup'
from /usr/lib/ruby/site_ruby/1.8/hiera.rb:64:in `lookup'
from /usr/bin/hiera:220


The hiera.yaml is:
:backends: yaml
:yaml:
  :datadir: /etc/puppet/environments/production/hieradata
:hierarchy: common
:logger: console

Any hints on something I missed?
Thanks
Luca

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




Re: [Puppet Users] How do I check whether an imported resource has already been defined?

2013-04-29 Thread Patricia Jung

Am 26.04.2013 um 15:45 schrieb jcbollinger :
> Moreover, I think that this could probably be handled in a data-driven 
> manner, especially if all the per-customer trees on node A are uniform, or at 
> least characterized by a small number of fixed parameters.  That is, you 
> likely could arrange things such that you just need to add a bit of 
> information to an external file (e.g. an hiera data file) to induce the 
> needed declarations for a given group to be made for node A.
> 
Thanks a lot, I'll consider this.


Best

  Patricia

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




Re: [Puppet Users] Re: Design pattern for exported resources from EC2 autoscaled instances

2013-04-29 Thread Keith Burdis
You should be able to cluster Tomcat without using multicast by having a
static members list with TCP pings to check the cluster nodes. You could of
course use exported resources to create the static members list.

Not sure about Glassfish but I'd expect it to be possible to do something
similar as Weblogic allows the use of unicast instead of multicast for
static clusters.

  - Keith
On 29 Apr 2013 05:43, "Shiva Narayanaswamy" 
wrote:

> Thanks for your replies.
>
> mco is the solution I like. However AWS doesnt allow multicast, and hence
> I figured I cannot succesfully cluster glassfish or tomcat in AWS!
>
> On Monday, April 22, 2013 9:31:57 AM UTC+10, Shiva Narayanaswamy wrote:
>>
>> My setup has an EC2 autoscaling group of clustered glassfish application
>> servers. Each glassfish instance will register itself with a DAS (Domain
>> Administration Server) to become a member of the cluster, and deregister
>> itself when it is killed. I was intending to orchestrate this via puppet
>> exported resources. However I am stuck with trying to figure out how to get
>> the DAS server to apply puppet configuration everytime an instance is born
>> in the autoscaling group.
>> I can schedule puppet to run on the DAS server every 30 minutes, but I
>> cant afford to wait 30 minutes. I would like to do this as soon as an
>> instance is provisioned. The only way I can think of doing this is using
>> mcollective. Am I overlooking something?
>>
>> If I havent made myself very clear, please let me know, and I can try to
>> explain better.
>>
>> Looking forward to some design patterns from some experienced gurus!
>>
>> Thanks,
>> Shiva
>>
>  --
> 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.
>
>
>

-- 
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] Sharing data between nodes with hiera

2013-04-29 Thread Luca Gioppo
I have this, I think common, situation:

- NodeDB VM with MySQL
- NodeApp VM with an application that uses the MySQL DB

Obivuously both needs to have information on the DB (like user, DB name, 
etc.)
Since DB will be created in the NodeDB by the MySQL module from puppetlabs 
and the app will just connect to the DB and do its work, but need to set 
the configuration parameters.

Now ...
since App can be installed at any moments at a precise point in time will 
have to modify the NodeDB definition adding the DB for app and than 
create/modify the NodeApp to configure app.

Can I write down the DB info just once in hiera and refer to these common 
data from the two nodes? Also passing this data to standard modules in a 
proper way?

This could become handy when I'll have to add a third node, let's say 
NodeBI that needs to access the app DB for business intelligence reasons, 
so I'll have to configure a new node with the same DB data.

I think that there is the need to access a much higher scope information, 
but haven't found any clear (at least for me) documentation on this.
Thanks
Luca

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