[Puppet Users] Dependencies between nodes

2011-04-17 Thread Michael.Lausch
Hi,
I'm just getting my feet wet with puppet and I want to solve inter-
node dependencies.
For example I want to install client-server programs on different
nodes and make sure the version installed on the clients are the same
as on the server. The concrete example used C# WCF server and client
components.
I have two tasks to do

1) I will insert/configure the SOAP endpoints in the clients config
files using data from the SOAP server recipe (http port, host name(s)
of nodes where the server is installed

2) If configuring a client, check if a server with a matching version
is installed somewhere

I know that puppet may need some work to make it run on windows and
therefore i want to check if this scenario can be implemented using
puppet, before wasting work on making sure if this can be done

thx for your help

-- 
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] Confused about conditional include

2011-04-17 Thread Mohamed Lrhazi
I have code like this:

case $operatingsystem {
redhat: {
include gu_splunk::redhat
}
solaris: {
include gu_splunk::solaris_old
include gu_splunk::solaris
}
}

In gu_splunk::solaris_old I have an Exec like this:

exec { download_pkgrm_adminfile:
command = wget -q -O /tmp/$pkgrm_adminfile http://... ,
timeout = 60,
creates = /tmp/$pkgrm_adminfile,
}

Running puppet agent on a RedHat machine causes the Exec to execute
and the file to get downloaded!!

Why?

Thanks a lot.
Mohamed.

-- 
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: Confused about conditional include

2011-04-17 Thread Mohamed Lrhazi
Oh... is it because I have this in my site.pp:

stage { pre: before = Stage[main] }
class { gu_splunk::solaris_old: stage = pre }


If so then whats the correct way of doing what I am trying to do?

Thanks a lot,
Mohamed.

On Sun, Apr 17, 2011 at 2:15 PM, Mohamed Lrhazi lrh...@gmail.com wrote:
 I have code like this:

 case $operatingsystem {
        redhat: {
            include gu_splunk::redhat
        }
        solaris: {
            include gu_splunk::solaris_old
            include gu_splunk::solaris
        }
    }

 In gu_splunk::solaris_old I have an Exec like this:

 exec { download_pkgrm_adminfile:
        command = wget -q -O /tmp/$pkgrm_adminfile http://... ,
        timeout = 60,
        creates = /tmp/$pkgrm_adminfile,
    }

 Running puppet agent on a RedHat machine causes the Exec to execute
 and the file to get downloaded!!

 Why?

 Thanks a lot.
 Mohamed.


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



Re: [Puppet Users] Re: Confused about conditional include

2011-04-17 Thread Stefan Schulte
On Sun, Apr 17, 2011 at 02:17:59PM -0400, Mohamed Lrhazi wrote:
 Oh... is it because I have this in my site.pp:
 
 stage { pre: before = Stage[main] }
 class { gu_splunk::solaris_old: stage = pre }
 
 
 If so then whats the correct way of doing what I am trying to do?
 
 Thanks a lot,
 Mohamed.

remove the entry in site.pp. In your manifest replace the include:

case $operatingsystem {
      redhat: {
include gu_splunk::redhat
  }
  solaris: {
class { gu_splunk::solaris_old: stage = pre }
include gu_splunk::solaris
  }
}

include can only be used when you don't want to pass parameters.

-Stefan


pgpdBxsp9KsA7.pgp
Description: PGP signature


Re: [Puppet Users] Confused about conditional include

2011-04-17 Thread Denmat
Hi, 

I'm pretty sure you need to remove the quotation marks from $operatinngsystem 
and from redhat and solaris case matches.

Cheers,
Den

On 18/04/2011, at 4:15, Mohamed Lrhazi lrh...@gmail.com wrote:

 I have code like this:
 
 case $operatingsystem {
redhat: {
include gu_splunk::redhat
}
solaris: {
include gu_splunk::solaris_old
include gu_splunk::solaris
}
}
 
 In gu_splunk::solaris_old I have an Exec like this:
 
 exec { download_pkgrm_adminfile:
command = wget -q -O /tmp/$pkgrm_adminfile http://... ,
timeout = 60,
creates = /tmp/$pkgrm_adminfile,
}
 
 Running puppet agent on a RedHat machine causes the Exec to execute
 and the file to get downloaded!!
 
 Why?
 
 Thanks a lot.
 Mohamed.
 
 -- 
 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] Confused about conditional include

2011-04-17 Thread Mohamed Lrhazi
Thanks Stefan. That worked.

Denmat, the quotes seem to work fine for both the fact name and the values.

On Sun, Apr 17, 2011 at 5:04 PM, Denmat tu2bg...@gmail.com wrote:
 Hi,

 I'm pretty sure you need to remove the quotation marks from $operatinngsystem 
 and from redhat and solaris case matches.

 Cheers,
 Den

 On 18/04/2011, at 4:15, Mohamed Lrhazi lrh...@gmail.com wrote:

 I have code like this:

 case $operatingsystem {
        redhat: {
            include gu_splunk::redhat
        }
        solaris: {
            include gu_splunk::solaris_old
            include gu_splunk::solaris
        }
    }

 In gu_splunk::solaris_old I have an Exec like this:

 exec { download_pkgrm_adminfile:
        command = wget -q -O /tmp/$pkgrm_adminfile http://... ,
        timeout = 60,
        creates = /tmp/$pkgrm_adminfile,
    }

 Running puppet agent on a RedHat machine causes the Exec to execute
 and the file to get downloaded!!

 Why?

 Thanks a lot.
 Mohamed.

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



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



Re: [Puppet Users] Re: puppet dashboard performance issue

2011-04-17 Thread Andrew Forgue
I also tried to look at this; since it was causing me issues as well.  I had 
800,000 rows or so in the reports table but I accidentally corrupted it 
(kill -9) so I won't have that many for a few more days.

I created the separate indexex for kind and status but MySQL didn't use 
them.  It uses indexes for everything except the report.status != failed and 
then it switches to a full table scan, even if the query is a simple select 
with only the where and no join.  The documentation for MySQL indexes says 
that if MySQL thinks not using an index will be better it will not use 
indexes.

mysql explain select * from reports WHERE reports.status = 'failed';
*** 1. row ***
   id: 1
  select_type: SIMPLE
table: reports
 type: ref
possible_keys: index_reports_on_status
  key: index_reports_on_status
  key_len: 258
  ref: const
 rows: 274
Extra: Using where
1 row in set (0.00 sec)

mysql explain select * from reports WHERE reports.status != 'failed';
*** 1. row ***
   id: 1
  select_type: SIMPLE
table: reports
 type: ALL
possible_keys: index_reports_on_status
  key: NULL
  key_len: NULL
  ref: NULL
 rows: 108828
Extra: Using where
1 row in set (0.00 sec)

Presumably it's doing this because the number of rows that are != failed are 
the vast majority so a full table scan is actually faster.

It looks like it's selecting all the reports, and then grouping so we get 
the latest one.  Doing a cartesian join and then grouping seems extremely 
slow.  I re-wrote the query to use a sub-select:

select reports.*,nodes.* from nodes, (select node_id,max(time) from reports 
where reports.kind = 'apply' and reports.status != 'failed' GROUP by 
node_id) as reports WHERE reports.node_id = nodes.id;
1424 rows in set (0.12 sec).

So you're only getting the latest report and then the nodes for each.

How fast does that query run?

-Andrew

-- 
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] Certificate Issues.... again

2011-04-17 Thread Lance Reed
Not sure if the book has been closed on this, but I had this problem
recently on new installs.
The problem was fixed by keeping the hosts in time sync.   They were 5
hours out of sync.
Not sure why this caused an issue unless there is some sort of SSL
computation issue?

Your mileage may vary

L.

On Sun, Apr 10, 2011 at 6:20 PM, Douglas Garstang
doug.garst...@gmail.com wrote:
 I don't know what it is with puppet's certificates, but once again, they are
 behaving strangely.
 Client is reporting:
 debug: Using cached certificate for auth01.fre.livegamer.com
 /usr/lib/ruby/site_ruby/1.8/puppet/ssl/host.rb:166:in `certificate'
 /usr/lib/ruby/site_ruby/1.8/puppet/ssl/host.rb:227:in `wait_for_cert'
 /usr/lib/ruby/site_ruby/1.8/puppet/application/agent.rb:194:in `setup_host'
 /usr/lib/ruby/site_ruby/1.8/puppet/application/agent.rb:257:in `setup'
 /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:286:in `run'
 /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:393:in `exit_on_fail'
 /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:286:in `run'
 /usr/sbin/puppetd:4
 err: Could not request certificate: Retrieved certificate does not match
 private key; please remove certificate from server and regenerate it with
 the current key
 I:
 Stopped puppet on client
 Removed /var/lib/puppet on client
 Cleaned certificate on server
 Restarted server
 Started puppet on client
 and again it occurs. It doesn't happen every time, but often does after the
 first install of a new system. Also, puppet will be part way through it's
 process, and then report the certificates are not valid. Performing the
 above steps _usually_ fixes it.
 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.


-- 
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] Are facts cached?

2011-04-17 Thread Mohamed Lrhazi
Am trying to debug a weird issue...It seems that my custom facts
generated when puppet agent is run against my test master are not the
same as when run against my prod master. What could explain that?

A bit more specifically, my custom facts are generated by the fact:
http://www.devco.net/archives/2008/04/17/easy_per-machine_custom_facts_for_puppet.php

I changed one line to allow for whitespace in the keys and values, like this:

var = $1.strip and val = $2.strip if line =~ /^(.+)=(.+)$/

I synced up the configs between my test and prod masters, so
everything should be the same... Still, when I run an agent against my
test server I get correct facts, key1: val1... against prod master I
get some buggy key1: val1

I even removed all whitespace from my facts.txt, that the facts are
generated out of, run the agent many times, still same behavior.

Any idea what could be the cause? am sure its something left over for
my earlier attempts.. but what?

Thanks a lot.
Mohamed.

-- 
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: Are facts cached?

2011-04-17 Thread Mohamed Lrhazi
I removed my call to strip(), and somehow the old buggy facts still appear:

The custom fact that generates extra custom facts:

bash-3.00# cat /var/opt/csw/puppet/lib/facter/host_facts.rb
if File.exists?('/GU/facts.txt')
   File.open('/GU/facts.txt').each do |line|
  var = nil
  value = nil

  var = $1 and val = $2 if line =~ /^(.+)=(.+)$/

  if var != nil  val != nil
 Facter.add(var) do
setcode { val }
 end
  end
   end
end

bash-3.00# cat /GU/facts.txt
gu_environment=unset
gu_app_oracle_rac=unset
gu_app_oracle_oem=unset
gu_app_gdoc=unset
gu_app_banner=unset
gu_app_bboard=unset

the buggy facts:
bash-3.00# cat /etc/mcollective/facts.yaml|grep gu_
  gu_app_bboard   : unset
  gu_app_oracle_rac: unset
  gu_app_gdoc: unset
  gu_app_oracle_oem   : unset
  gu_app_banner: unset
  gu_environment  : unset


Any pointers highly appreciated.
Thanks.

On Sun, Apr 17, 2011 at 9:29 PM, Mohamed Lrhazi lrh...@gmail.com wrote:
 Am trying to debug a weird issue...It seems that my custom facts
 generated when puppet agent is run against my test master are not the
 same as when run against my prod master. What could explain that?

 A bit more specifically, my custom facts are generated by the fact:
 http://www.devco.net/archives/2008/04/17/easy_per-machine_custom_facts_for_puppet.php

 I changed one line to allow for whitespace in the keys and values, like this:

 var = $1.strip and val = $2.strip if line =~ /^(.+)=(.+)$/

 I synced up the configs between my test and prod masters, so
 everything should be the same... Still, when I run an agent against my
 test server I get correct facts, key1: val1... against prod master I
 get some buggy key1    : val1

 I even removed all whitespace from my facts.txt, that the facts are
 generated out of, run the agent many times, still same behavior.

 Any idea what could be the cause? am sure its something left over for
 my earlier attempts.. but what?

 Thanks a lot.
 Mohamed.


-- 
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] Certificate Issues.... again

2011-04-17 Thread James Turnbull
Lance Reed wrote:
 Not sure if the book has been closed on this, but I had this problem
 recently on new installs.
 The problem was fixed by keeping the hosts in time sync.   They were 5
 hours out of sync.
 Not sure why this caused an issue unless there is some sort of SSL
 computation issue?
 
 Your mileage may vary

SSL relies on the time on the different hosts being in sync otherwise it
assumes certificates are invalid or bogus.  It's a security feature of SSL.

Regards

James Turnbull

-- 
James Turnbull
Puppet Labs
1-503-734-8571

-- 
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: Are facts cached?

2011-04-17 Thread Mohamed Lrhazi
This was driving me nuts... I did an rm -rf /var/lib/puppet, on a
client machine, and after a rerun of puppet agent, the buggy facts
appear again.
when I run the agent against the test master, no buggy facts... and
then it hit me that I am using stored configs, and the facts are in
mysql db, but why would that effect the facts as generated on the
clients?
I dropped the puppet db and restarted the master, and viola! buggy
facts gone... almost, they still reappear as I must have one or two
nodes who are still generating them, but will fix soon.

anyone understand what I am talking about? :) What exactly is
happening? what I call buggy fact ar the once with extra whitespace in
them:

mysql select concat('[',name,']')  from fact_names where name like '%gu_%';
++
| concat('[',name,']')   |
++
| [gu_app_baner] |
| [gu_app_banner]|
| [gu_app_bboard]|
| [gu_app_gdoc]  |
| [gu_app_oracle_oem]|
| [gu_app_oracle_rac]|
| [gu_env]   |
| [gu_environment]   |
| [gu_host]  |
++
9 rows in set (0.00 sec)




On Sun, Apr 17, 2011 at 9:45 PM, Mohamed Lrhazi lrh...@gmail.com wrote:
 I removed my call to strip(), and somehow the old buggy facts still appear:

 The custom fact that generates extra custom facts:

 bash-3.00# cat /var/opt/csw/puppet/lib/facter/host_facts.rb
 if File.exists?('/GU/facts.txt')
   File.open('/GU/facts.txt').each do |line|
      var = nil
      value = nil

      var = $1 and val = $2 if line =~ /^(.+)=(.+)$/

      if var != nil  val != nil
         Facter.add(var) do
            setcode { val }
         end
      end
   end
 end

 bash-3.00# cat /GU/facts.txt
 gu_environment=unset
 gu_app_oracle_rac=unset
 gu_app_oracle_oem=unset
 gu_app_gdoc=unset
 gu_app_banner=unset
 gu_app_bboard=unset

 the buggy facts:
 bash-3.00# cat /etc/mcollective/facts.yaml|grep gu_
  gu_app_bboard       : unset
  gu_app_oracle_rac: unset
  gu_app_gdoc: unset
  gu_app_oracle_oem   : unset
  gu_app_banner: unset
  gu_environment      : unset


 Any pointers highly appreciated.
 Thanks.

 On Sun, Apr 17, 2011 at 9:29 PM, Mohamed Lrhazi lrh...@gmail.com wrote:
 Am trying to debug a weird issue...It seems that my custom facts
 generated when puppet agent is run against my test master are not the
 same as when run against my prod master. What could explain that?

 A bit more specifically, my custom facts are generated by the fact:
 http://www.devco.net/archives/2008/04/17/easy_per-machine_custom_facts_for_puppet.php

 I changed one line to allow for whitespace in the keys and values, like this:

 var = $1.strip and val = $2.strip if line =~ /^(.+)=(.+)$/

 I synced up the configs between my test and prod masters, so
 everything should be the same... Still, when I run an agent against my
 test server I get correct facts, key1: val1... against prod master I
 get some buggy key1    : val1

 I even removed all whitespace from my facts.txt, that the facts are
 generated out of, run the agent many times, still same behavior.

 Any idea what could be the cause? am sure its something left over for
 my earlier attempts.. but what?

 Thanks a lot.
 Mohamed.



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