Re: [Puppet Users] MySQL server install with datadir != /var/lib/mysql

2013-12-17 Thread Chris McDermott
I'm a bit late to this thread, but I ran into the same problem with the
puppetlabs-mysql module - it's a bug in how the module was written. There
is a fork by the folks at MediaTemple which addressed that issue:

https://github.com/mediatemple/puppetlabs-mysql

I've been using that successfully for several months now to do exactly what
you propose - specify an alternate location for the datadir and have the
module install/configure/start mysqld with no intervention required.

Chris


On Wed, Dec 4, 2013 at 6:27 PM, Justin tcpan...@gmail.com wrote:

 Have you tried creating a symlink (eg. /var/lib/mysql - /mysql/data)
 before installing with yum?
 On Dec 3, 2013 8:40 PM, Thomas thomas.e.ke...@gmail.com wrote:

 Has anybody sucessfully used puppetlabs-mysql (or some other method) to
 install MySQL-server on Linux with a my.cnf where datadir != /var/lib/mysql
 ?

 --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to puppet-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/004002bb-577c-4d2d-8f51-ce62486dfeb6%40googlegroups.com
 .
 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 view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/CAAqoRT67a3k8U7UU0wOcAv-rPS_Vakeyjnv%2BQyN6G6W3AuTp5Q%40mail.gmail.com
 .

 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAFnaWbsHmJHbxPv%3Dqor%3D8uG7tqb0O5JdvnCx4uz7BKca9NY9Qg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] Error with Puppetlabs Dashboard module

2013-09-30 Thread Chris McDermott
I'm trying to use the Puppetlabs-dashboard module to install the dashboard
on a new host but I'm getting an error. I am using the latest versions of
the following Puppetlabs modules (as of 09/26/2013):

dashboard
mysql
passenger
apache
stdlib
concat

The other modules are not causing problems - I can include mysql or
whatever without issue. But when I include dashboard I get the following:

Error: Could not retrieve catalog from remote server: wrong header line
format Warning: Not using cache on failed catalog Error: Could not retrieve
catalog; skipping run

I have replicated this error on three different CentOS 6.x hosts at
slightly different patch levels. All were using puppet 3.2.x though.

Searching seems to indicate that this error usually indicates a faulty
template file. I found three templates in the dashboard module, but all of
them pass the syntax check. Likewise I ran puppet parser validate on all
.pp files but found no problems. I opened an Issue on the GitHub project,
but have not received any response, so I thought I would check on the
mailing list to see if anyone else has seen this issue, and if they have
any workarounds or solutions.

Thanks!

Chris

-- 
:wq

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] What's the best practice to manage software updates using puppet ?

2013-09-25 Thread Chris McDermott
I haven't found a solution that I'm totally happy with either, but what
I've done in a few cases is specify particular versions with ensure. Like
this:


$varnish_version = $::environment ? {
  'dev'  = '3.0.4-1.el6',
  'staging = '3.0.4-1.el6',
  'prod' = '3.0.3-1.el6',
}

package { 'varnish':
  ensure = $varnish_version
}
package { 'varnish-libs':
  ensure = $varnish_version,
}
package { 'varnish-libs-devel':
  ensure = $varnish_version,
}

Obviously you can't do that for every package installed on your hosts, but
it works if you're only managing a small number with puppet. You need to
watch out for dependencies though. Then to update your prod environment,
for instance, you can just update the version string to match dev and
staging. You could also move the version strings out into hiera, and manage
them there, so all package version data is in one place.

Chris



On Tue, Sep 24, 2013 at 2:31 PM, François Chenais 
francois.chen...@gmail.com wrote:

 Hello,

 I got many classes, using the well known template ...

   package
  ensure = XXX
  notify = service

   file
  require = package
  notify = service

   service
  require = File, Package


 ... with ensure value XXX set to 'latest'.


 This implies that package could be updated when I change a value
 in config file even if I don't want to update it  ... especially in
 production ...

 A solution can be changing all ensure value to 'present' or 'installed'
 but I'm not
 the owner of the code so I would like to know if there is a way to

 - deactivate the package update through a command line option ?
 - change the ensure value using

   - a command line option
   - a fact
   - a tag
   - ???



 More generally, what's the best practice to manage software updates using
 puppet :

 - ensure = present
 - fix pkg repositories   :/
 - ???


 Thanks a lot


  François








  --
 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.
 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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Re: Puppet requires second run to execute some catalog items.

2013-09-24 Thread Chris McDermott
I guess I'm confused at why aptitude would remove php5-memcache in order to
upgrade php5-common. Or if it really needed to do that, shouldn't it be
smart enough to automatically install the upgraded version? I confess I'm
more familiar with RedHat/CentOS, and Yum is smart enough to handle
upgrading packages and their dependencies smoothly. I had though aptitude
was smart enough too, based on my limited experience with it. Anyway, if
you're still stuck I guess that's what I would try to figure out.


On Thu, Sep 19, 2013 at 9:23 AM, Sam Tresler samtres...@gmail.com wrote:

 Actually, that isn't going to work, I don't think.  I need to have some
 method of flagging the uninstalled packages as needing reinstallation mid
 puppet run, or I need aptitude to not uninstall them in the first place, or
 I need to I need puppet to get kicked off on a second run at the end of the
 first.  Of those I like the first or second options best. I'll do more
 digging, but would love to hear people's suggestions on this as well.


 On Thursday, September 19, 2013 9:58:21 AM UTC-4, Sam Tresler wrote:

 Ah. That makes a lot of sense. I'd noticed the php5-mysql 'upgrade' and
 assumed I was getting an erroneous message, but if puppet thinks it is
 doing that there is actually no difference in the aptitude commands between
 an install and an upgrade.  The packages with names that match php5-common
 *do* register as needing an upgrade at the beginning of the run, and are
 actually caught and reinstalled mistakenly. Anything that doesn't need an
 upgrade is never touched because it didn't need anything in the first
 place.

 My predecessor switched to running puppet non-daemonized on a 20m cron
 job. And I think this would not be an issue in a daemonized mode (perhaps)
 - as puppet would see the inconsistency faster, which is why I can find
 NOTHING on google about a similar problem.

 So, I think I'll proceed by having the php extensions without the same
 versioning schema subscribe to the php5-common resource and (I'll have to
 see what options are there) and check themselves again or kick off a second
 puppet run immediately.

 Thanks a ton. I had all the pieces but couldn't quite see it.

 On Thursday, September 19, 2013 9:39:01 AM UTC-4, jcbollinger wrote:



 On Wednesday, September 18, 2013 3:01:49 PM UTC-5, Sam Tresler wrote:

 Hi, I've inherited a puppet setup for automating php installation and
 extension management.  We're on Debian and we've encountered a strange
 issue that I've traced down back to puppet I think. I've stripped back the
 configuration and made the problem reproducible, logs and config pasted
 below.

 1. php5-common, php5-memcache, and php5-mysql are all installed.
 2. php5-common and php5-mysql receive an update, say from
 5.3.3-7+squeeze14 to 5.3.3-7+squeeze17
 3. Puppet runs and php5-common upgrade conflicts. Apt's first solution
 removes php5-mysql and php5-memcache.
 4. Puppet continues run and re-installs/upgrades php5-mysql. It skips
 php5-memcache.
 5. On a subsequent run php5-memcache is installed again as expected.

 This appears to only happen to packages that don't share the php5
 version naming schema, but that may be just a clue, not a cause. e.g.
 php5-memcache is 3.0.4-4+squeeze1.



 Yes, that's a clue, not the cause.  Here's what I think is happening:

 Early in the run, before applying any resources, the Puppet agent
 prefetches the installed apt packages.  This is a common behavior of
 providers for many resource types where it is more efficient than loading
 each declared resource's initial state individually.  Puppet thereafter
 assumes that the data it has prefetched do not change except as the agent
 itself explicitly changes them.  In particular, it will be caught quite by
 surprise if one of the resources it has prefetched is no longer present on
 the system when it comes time to apply it.

 If you look carefully at the log, you will see that it is not just
 php5-memcache about which the agent is confused.  The log also says:
 'php5-mysql 5.3.3-7+squeeze14 is installed', which is no longer true at
 the time that that message is emitted.  It happens that the result is
 nevertheless what you want in that case, however, because the reason the
 package was removed is correlated with the availability of a later version
 of it.

 This explanation assumes that the latest available version of
 php5-memcache is the same one that was already installed at the start of
 the Puppet run.  In that case, however, it is a mystery beyond my
 understanding why that package needed to be removed for the update to
 php5-common to proceed, and it was not automatically reinstalled, yet it
 could later be reinstalled manually.


 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 

Re: [Puppet Users] Retrieving Hiera arrays from init.pp

2013-09-24 Thread Chris McDermott
I'm confused at your snippets because they don't seem right. For instance,
you show:

#log_special::log_vars: test
$log_vars=log_vars,

But that doesn't look syntactically correct... I'm pretty sure that would
fail to compile.

Anyway, I think if this really is what your yaml looks like:

log_special::log_vars:
a: - 'jklkl'
   - 'test'

Then in your pp manifest, you'd want to have something like this:

$log_vars = hiera_hash('log_special::log_vars', false)

if ($log_vars) {

  $array = $log_vars['a']

}


And then $array should be an array containing 'jklkl' and 'test'.

Chris


On Thu, Sep 19, 2013 at 12:12 PM, Jeremiah Jester
jeremiahjes...@gmail.comwrote:

 Chad,

 Thanks for the reply. I am using /etc/puppet/heiradata for the
 location of all my hiera files.

 [root@puppet-master-t1 puppet]# ls hieradata/
 defaults.yaml  global.yaml  groups  hosts

 Referencing non hashed/array variables from init.pp works. However, I
 cannot get the array variable $log_status2 - it is being returned as a
 string. I've included a snip of my init.pp file with comments to give
 more details. I've looked at the limited hiera docs included the one
 you sent, I'm clearly doing something wrong.

 Appreciate the help.
 JJ

 class log_special
 (
 #log_special::log_vars: test
 $log_vars=log_vars,

 #log_special::log_vars2:
 #b: 'fdsa'
 #c: 'fds'
 $log_vars2=hiera_hash('log_vars'),
 $log_vars2=$log_vars2['b']
 )
 {
   exec{log_vars: command= /bin/echo '${log_vars}', logoutput=true;}
   #Debug: Executing '/bin/echo 'test'
   exec{log_vars2: command= /bin/echo '${log_vars2}', logoutput=true;}
   #Debug: Executing '/bin/echo 'bfdsacfds''
 }


 On Thu, Sep 19, 2013 at 10:02 AM, Chad Huneycutt
 chad.huneyc...@gmail.com wrote:
  I'm pretty sure we need more information than that.
 
  1. Is puppet using the proper hiera.yaml?  The command line client at
  least used to use a different config than puppet (/etc/hiera.yaml vs
  /etc/puppet/hiera.yaml).  It sounds like you have this right, if you
  are able to pull basic variables from your data files.
 
  2. Are you sure that hiera is not working?  What have you tried, and
  what happened when you tried it?
 
  Have you looked at http://docs.puppetlabs.com/hiera/1/index.html ?
  There are examples there.
 
  - Chad
 
  On Thu, Sep 19, 2013 at 11:53 AM, Jeremiah Jester
  jeremiahjes...@gmail.com wrote:
  I've been able to retrieve data from hiera via init.pp from a basic
  variable. However, when i try and pull an associative array from hiera,
 I'm
  unable to get the data. I've verified that my yaml syntax is correct by
  running hiera via the command line:
 
  *hiera yaml file
 
  log_special::log_vars:
  a: - 'jklkl'
 - 'test'
 
  *heira via cmd line
  [jjest@puppet-master-t1 templates]$ hiera log_special::log_vars
  hostname=puppet-client-t1
  {a=[jklkl, test]}
 
 
  Anyone know how to pull and parse this from init.pp? Precise code would
 be
  helpful.
 
  Thanks,
  JJ
 
  --
  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.
  For more options, visit https://groups.google.com/groups/opt_out.
 
 
 
  --
  Chad M. Huneycutt
 
  --
  You received this message because you are subscribed to a topic in the
 Google Groups Puppet Users group.
  To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/puppet-users/3A5F9Wh6RdY/unsubscribe.
  To unsubscribe from this group and all its topics, 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.
  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.
 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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Automation of puppet configuration code

2013-09-24 Thread Chris McDermott
I haven't heard of any libraries for parsing or building puppet resources.
But the syntax check should be fairly trivial - you can use the puppet
parser validate file.pp command. It's fairly common practice to set up a
pre-commit hook script to run that against all files modified in a git
repo, for instance.

If you aren't having any luck looking for libraries to parse puppet
manifests, you might consider using hiera to define resources and
parameters. You can use yaml or json to structure the data, and there are
plenty of libraries for parsing that stuff. Then you could use
create_resources to generate the appropriate resources automatically during
catalog compilation. For example, if your hiera yaml had this:

classes:
  - users

users:
  tom:
uid: 512
home: '/home/tom'
  dick:
uid: 513
home: '/home/dick'


And then your modules/users/manifests/init.pp file contained this (that
classes array will auto-load the users module as long as you have
hiera_include('classes') somewhere like in your site.pp - alternatively
you could just include users for the relevant nodes):

class users {
  $users_hash = hiera_hash('users', false)
  if ($users_hash) {
create_resources('new_user', $users_hash)
  }
}

define new_user (
  $uid = undef,
  $home = undef,
) {
  user { $title:
uid = $uid,
home = $home,
  }
}

It's a bit odd and seems backwards at first, but it moves the configuration
elements out into a pure structured format.

Chris


On Fri, Sep 20, 2013 at 10:48 AM, mo...@wisc.edu wrote:

 Hello,

I work for the CHTC (Center for High Throughput Computing) at the
 University of Wisconsin, Madison.  We utilize puppet for most of our
 configuration management.  Currently we have a web application that
 performs the tasks of user account management.  When a new user is
 registered with the application, the application does some very limited
 parsing of a puppet manifest that has resources like this one:

 @useraccount { 'johndoe':
 uid = 'X',
 fullname = 'John Doe',
 email = 'john...@wisc.edu',
 home = '/home/johndoe',
 password = 'SOMEHASH',
 ensure = 'present',
 group = 'mathdepartment',
 tag = 'cluster-users'
 }

 If a resource doesn't exist for the new users, the application edits the
 file and creates the resource, populating the fields with the proper
 values.  The code that does this is very limited.  I would like it to do
 things like:

 - Change fields that the user web application governs;  Leave fields alone
 that the web application is not aware of
 - For fields that are arrays or hashes, allow for appending values to the
 array or hash, rather than replacing it
 - Do resource dependency checking;  Does the group resource
 'mathdepartment' exist? Will it be 'present'? Will the manifest that the
 'mathdepartment' group resource is in be read and the class declared?
 - Check to see if there are any puppet errors in the code at all.  If a
 client pulls the configuration for the manager, will it receive an error?

 I would think the best way to accomplish these goals would be to use an
 existing API or library that can actually parse puppet code, save it into
 data structures, and run functions of the puppet engine on said data
 structures.  Basically, the functions of the parser the puppet engine
 itself uses.  Is it possible to use the puppet code/engine in such a way?
  Even better would be if it could take puppet data structures and write
 them into a puppet manifest.

 Google reveals that there are various third party open source projects
 that do something similar, written in various languages.  If one of these
 works well for you, I would like to hear which one and why you like it.
  However, it would be advantageous for me to use the actual puppet engine
 since it will keep pace with updates to puppet.

 I'd appreciate any help or advice you can give.

 Cheers,
 Aaron Moate
 CHTC Infrastructure Team

  --
 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.
 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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] symlink creation using facter, but facter is nil at first run.

2013-09-24 Thread Chris McDermott
Hmm. Perhaps you could have something like this (assuming your fact is
called $jdk_version):

package { 'jdk':
  ensure = latest,
}

if ($::jdk_version) {
  file { '/usr/java/jdk':
ensure  = link,
target  = /usr/java/${::jdk_version},
require = Package['jdk'],
  }
} else {
  exec { 'create-symlink':
command = '/bin/ln -s /usr/java/jdk-* /usr/java/jdk',
path= '/bin',
creates = '/usr/java/jdk',
require = Package['jdk'],
  }
}

This way, in either case the jdk package would be installed first. If it
existed prior to the puppet run, the fact will evaluate to TRUE and the
file resource will ensure that the appropriate link exists. Alternatively,
if the package was not installed prior to the run, the fact will evaluate
to FALSE, but the exec will still create the appropriate symlink. But only
if the symlink doesn't already exist.

You'll still have a problem if the jdk package is updated by puppet,
however. In that case the fact would have the old version and try to ensure
that the link points to a non-existent target. Maybe there's a way to make
the exec work in that case, with a refreshonly or something, but I can't
quite think of it right now, because ln -s will fail if the link already
exists (even if it's pointing to a target that no longer exists).

Chris


On Fri, Sep 20, 2013 at 9:30 PM, Frederiko Costa freder...@gmail.comwrote:

 Hi all,

 I'm trying to find a better way to implement this, but I can't think of. I
 have a jdk module that requires to create a symlink to whatever version is
 the one installed. Say I install jdk-6u35, it will create something like
 /usr/java/jdk_1.6.35. I would like to create a symlink /usr/java/jdk whose
 target would be /usr/java/jdk_1.6.35.

 The point here isn't to ask how to create the symlink - that's
 straightforward. I'm in a chicken-egg problem. I'm sure there's got a
 better and easier way to do this that I can't think of.

 I wrote a facter to report the jdk version running. Based on the string
 returned by the facter, it works great. However, I jdk is not installed,
 this facter returns nil - the catalog is compiled and the value was nil at
 compilation time - and the file resource, property target, fails. I bypass
 this with an if clause and everything runs fine because jdk is already
 there and the symlink will be created. I know I could tell my facter to
 return something else (actually I create a link to latest, and that works,
 but it's a poor's man solution).

 Have any you run into this situation? Any suggestion? Not convinced if
 facter is the way to go in this particular case.

 Thanks,
 -fred

 --
 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.
 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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] error when create database mysql with puppetlabs-mysql (v1.0.0)

2013-09-24 Thread Chris McDermott
Make sure you have set pluginsync = true in your puppet.conf.


On Mon, Sep 23, 2013 at 6:59 PM, Eduardo Terzella eterze...@gmail.comwrote:


 Good evening, folks.

 Using the module's puppet forge to create a database I get an error below.

 Could you help me?

 *puppetlabs-mysql (v1.0.0) *

 *class mysql_default {*
 *
 *
 *mysql::db { 'mydb':*
 *  user = 'root',*
 *  password = '123456',*
 *  host = 'localhost',*
 *  grant= ['SELECT', 'UPDATE'],*
 *}*
 *  *
 *  *
 *}*


 Error: Could not retrieve catalog from remote server: Error 400 on SERVER:
 Invalid parameter provider at
 /etc/puppet/environments/development/modules/mysql/manifests/db.pp:60 on
 node stfbsbpentaho02.dmz
 Warning: Not using cache on failed catalog
 Error: Could not retrieve catalog; skipping run




  --
 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.
 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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Fail/stop after a step fails?

2013-09-18 Thread Chris McDermott
Try the fail() function. Something like this:

if ($continue != true) {
  fail('Condition not met, failing now.')
}


On Tue, Sep 17, 2013 at 1:36 PM, Robin Lee Powell 
rlpow...@digitalkingdom.org wrote:

 On Tue, Sep 17, 2013 at 12:35:15PM -0700, Robin Lee Powell wrote:
 
  Is it possible to get puppet to just *give up* if a particular
  step fails?  Thousands upon thousands of Skipping because of
  failed dependencies gets really old.

 Or, indeed, have it stop after a particular step *succeeds* would be
 fine too.

 -Robin

 --
 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.
 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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] CREATE command denied to user 'dashboard'@'localhost' for table 'schema_migrations'

2013-08-29 Thread Chris McDermott
It looks like the mysql user 'dashboard'@'localhost' doesn't have the right
set of privilege grants.

Chris


On Wed, Aug 28, 2013 at 10:15 PM, karl hui karl@gmail.com wrote:

 Hi Puppet Users group,

 I have followed the guide to the puppet-dashboard DB Preparing Schema
 part, once I run  rake RAILS_ENV=production db:migrate --trace, it shows
 the following errors:

 (in /usr/share/puppet-dashboard)
 rake aborted!
 Mysql::Error: CREATE command denied to user 'dashboard'@'localhost' for
 table 'schema_migrations': CREATE TABLE `schema_migrations` (`version`
 varchar(255) NOT NULL) ENGINE=InnoDB
 /usr/share/puppet-dashboard/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in
 `log'
 /usr/share/puppet-dashboard/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:324:in
 `execute'
 /usr/share/puppet-dashboard/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb:109:in
 `create_table'
 /usr/share/puppet-dashboard/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:478:in
 `create_table'
 /usr/share/puppet-dashboard/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb:371:in
 `initialize_schema_migrations_table'
 /usr/share/puppet-dashboard/vendor/rails/activerecord/lib/active_record/migration.rb:441:in
 `initialize'
 /usr/share/puppet-dashboard/vendor/rails/activerecord/lib/active_record/migration.rb:401:in
 `new'
 /usr/share/puppet-dashboard/vendor/rails/activerecord/lib/active_record/migration.rb:401:in
 `up'
 /usr/share/puppet-dashboard/vendor/rails/activerecord/lib/active_record/migration.rb:383:in
 `migrate'

 /usr/share/puppet-dashboard/vendor/rails/railties/lib/tasks/databases.rake:112
 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:635:in `call'
 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:635:in `execute'
 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:630:in `each'
 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:630:in `execute'
 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in
 `invoke_with_call_chain'
 /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:589:in
 `invoke_with_call_chain'
 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:582:in `invoke'
 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2050:in `invoke_task'
 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2028:in `top_level'
 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2028:in `each'
 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2028:in `top_level'
 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2067:in
 `standard_exception_handling'
 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2022:in `top_level'
 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2000:in `run'
 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2067:in
 `standard_exception_handling'
 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1997:in `run'
 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
 /usr/bin/rake:19:in `load'
 /usr/bin/rake:19


 Anyone knows what happen?  I have install puppet-dashboard before but
 never experience this error.

 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.
 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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Problem using resources and types from puppetlabs/lvm

2013-08-27 Thread Chris McDermott
I don't see where you declare this resource:

require = Filesystem[ /dev/mapper/root_vg-WebSphere ],


In order to require that, you would first need to declare it somewhere, for
instance:

filesystem { '/dev/mapper/root_vg-WebSphere':
  ensure = present,
  fstype  = 'ext4',
}

Of course, that will only format a filesystem on that device node - it
wouldn't set up a volume group or logical volume or mount point or anything
else. In fact, I think a normal use of the puppetlabs-lvm module would look
something more like this:

lvm::volume { 'WebSphere':
  ensure = present,
  pv= '/dev/sdb',
  vg= 'WebSphere',
  fstype  = 'ext4',
  before  = File['/opt/wasadmin'],
}

file { '/opt/wasadmin':
  ensure = directory
}

mount { '/opt/wasadmin':
  ensure = mounted,
  device  = '/dev/WebSphere/WebSphere',
  fstype  = 'ext4',
  require = File['/opt/wasadmin'],
}

And then in your websphere::deploy you could:

require = Mount['/opt/wasadmin']

And that would ensure that the whole stack was created - the physical
volume, the volume group, the logical volume, the filesystem, and that it
was mounted under /opt/wasadmin.

Chris

On Tue, Aug 27, 2013 at 5:09 AM, Andy Stevens ant.st...@gmail.com wrote:

 Chris,

 Already have the pluginsync directive in the [agent] section of my
 puppet.conf - thanks for covering that off anyway.  I've included the
 relevant Puppet manifest snippets below as I could be doing something very
 very silly at a code level that someone could identify:

 Firstly I have declared a class called 'websphere' which resides in
 /etc/puppet/modules/websphere and my class code is in the init.pp file
 located at /etc/puppet/modules/websphere/manifests. The code for this is as
 follows:

 */etc/puppet/modules/websphere/manifests/init.pp*

 class websphere::deploy {


   include lvm::filesystem


   file { /opt/wasadmin/backup/build_NdmBase.tar:

 source  = puppet:///files/build/websphere/build_NdmBase.tar,

 mode= 0640,

 owner   = wasadmin,

 group   = wasgrp,

 require = Filesystem[ /dev/mapper/root_vg-WebSphere ],

   }

 }

 The second component is my node definition which occurs on the nodes.pp
 file, as follows:

 */etc/puppet/manifests/nodes.pp*

 node websphereNode inherits base {


   include websphere::deploy


 }

 The third component is actually specifying an instance of the above node,
 as follows:

 */etc/puppet/manifests/nodes.pp*

 node node.foo.com inherits websphereNode {


 }

 I also have the puppetlabs/lvm module installed in the /etc/puppet/modules
 directory.

 Hope the code I have included in this response is of assistance to someone
 to help me resolve this issue.

 Thanks

 On Friday, August 23, 2013 4:20:32 PM UTC+1, mcd wrote:

 I'm kind of guessing, but it might be that you need to push out the
 custom providers to the client. Try putting pluginsync = true in the
 [agent] section of your puppet.conf on that client, and try again.

 Chris


 On Fri, Aug 23, 2013 at 8:07 AM, Andy Stevens ant@gmail.com wrote:

 Hi,

 I'm struggling to make use of the resources and types provided by
 puppetlabs/lvm.

 If I attempt to make use of the various resource types i.e. filesystem,
 lvm etc. from within my nodes.pp then I have no problem at all.  However if
 I attempt to reference them from a class I have created, when i invoke
 puppet agent --test I get the output below:

 *Error: Failed to apply catalog: Could not find dependency
 Filesystem[/dev/mapper/root_vg-WebSphere] for File*.

 I'm guessing that my custom class can't see within it's scope the
 various resources and types provided by puppetlabs/lvm?  So how do I
 resolve this?  the puppetlabs/lvm isn't a class so I can't include it.

 Any assistance would be greatly appreciated



 Thanks

 Andy

 --
 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-usershttp://groups.google.com/group/puppet-users
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://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.
 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 

[Puppet Users] Cloud Provisioning

2013-08-27 Thread Chris McDermott
I'm looking for ways to manage multiple public cloud resources. Ideally I
would like to support the following providers:

AWS
GCE
Rackspace
Digital Ocean
Linode

And I would like to be able to manage everything - instances, volumes, load
balancers, IP addresses, database instances, etc. Even VPC's and their
equivalents.

I know this is totally pie-in-the-sky and there's nothing that meets all
those needs right now, which is OK - I'm happy to pick something with good
foundations and then help extend it. But I'm not even sure which modules to
pick to work on. Puppetlabs has Cloud Provisioner, which claims to be what
I'm looking for except that it only supports AWS, and then only ec2
instances as far as I can tell. But Puppetlabs also makes a separate AWS
module, and a GCE module. I can't find any references to Rackspace, Digital
Ocean, or Linode.

Has anyone else attempted anything like this? Is anyone currently using
Cloud Provisioner, and if so, how is it working out?

Thanks!

Chris
-- 
:wq

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Problem using resources and types from puppetlabs/lvm

2013-08-23 Thread Chris McDermott
I'm kind of guessing, but it might be that you need to push out the custom
providers to the client. Try putting pluginsync = true in the [agent]
section of your puppet.conf on that client, and try again.

Chris


On Fri, Aug 23, 2013 at 8:07 AM, Andy Stevens ant.st...@gmail.com wrote:

 Hi,

 I'm struggling to make use of the resources and types provided by
 puppetlabs/lvm.

 If I attempt to make use of the various resource types i.e. filesystem,
 lvm etc. from within my nodes.pp then I have no problem at all.  However if
 I attempt to reference them from a class I have created, when i invoke
 puppet agent --test I get the output below:

 *Error: Failed to apply catalog: Could not find dependency
 Filesystem[/dev/mapper/root_vg-WebSphere] for File*.

 I'm guessing that my custom class can't see within it's scope the various
 resources and types provided by puppetlabs/lvm?  So how do I resolve this?
 the puppetlabs/lvm isn't a class so I can't include it.

 Any assistance would be greatly appreciated



 Thanks

 Andy

 --
 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.
 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.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] Test the result of a hiera_hash() lookup

2013-08-23 Thread Chris McDermott
Hi folks,

Is there a way to test the result of a hiera_hash() lookup in a manifest? I 
am trying to use hiera to do most of my configuration, like this for 
example:

mysql::grants:
  'user1@localhost':
privileges:
  - select_priv
  'user2@localhost':
privileges:
  - select_priv
  - insert_priv
  - lock_tables_priv

I have a wrapper class that then does this:

class custom::mysql::grants {
  $grantoptions = hiera_hash('mysql::grants')
  create_resources('database_grant', $grantoptions)
}

That works fine as long as I include the custom::mysql::grants class. But 
right now I can only include that class on nodes where I define explicit 
grants. If I don't have the mysql::grants hash defined for that node in 
hiera, puppet complains:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: 
Could not find data item mysql::grants in any Hiera data file and no 
default supplied at /path/to/custom/manifests/mysql.pp:34

I tried testing the $grantoptions variable after calling hiera_hash() but 
that's too late - it's the hiera_hash function itself that produces that 
error. I would love to be able to just include this wrapper class globally, 
and then have it only run create_resources if it actually finds a usable 
hash for that node, so I don't have as many includes on each individual 
node. 

Any thoughts?

Thanks!

Chris

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Using hiera lookups with defined types

2013-08-23 Thread Chris McDermott
Well normally you would use hiera_hash() and create_resources() to do it,
like this:

# yaml data source
---
cron_jobs::logrotate::users
  kenweiss:
hour = 5
  tomjones:
hour = 3


# pp file
---
class cron_jobs::logrotate ( $hour, $minute, $weekday ) {
  ...
  $user_cron_options = hiera_hash('cron_jobs::logrotate::users', false)
  if $user_cron_options{
create_resources('cron_jobs::logrotate::user_cron', $user_cron_options)
  }
}

One thing I don't know is how to do that for defined types that do not have
any parameters.  Unfortunately create_resources requires a hash for the
second argument, so you have to use hiera_hash to pull in the data, so it
has to be a hash in hiera. And I haven't figured out how to define an empty
hash yet. Or transform an array into a hash that would work for
create_resources.

/shrug

Chris


On Fri, Aug 23, 2013 at 5:01 PM, Ken Weiss ken.we...@ucop.edu wrote:

 Hi all,

 I am trying to use hiera and .yaml files to load parameters into my
 declared classes. For basic classes it works great. For example:

 class cron_jobs::logrotate ( $hour, $minute, $weekday ) {...

 node fqdn: test.my.com

 I declare the class for my node very simply:

 class {'cron_jobs::logrotate': }

 If I create a file in the default hiera data directory called
 test.my.com.yaml and include this:

 cron_jobs::logrotate::hour: 5

 then sure enough, when I do a puppet apply the cron job is created to run
 at 5:00 AM.


 My problem is extending this to work with defined types. Let's say my
 defined type looks like this when I declare it:

 cron_jobs::logrotate::user_cron {'kenweiss' :}

 What do I put in my .yaml file in order to get Puppet to load the
 parameters automatically?

 I tried a couple of things...

 cron_jobs::logrotate::user_cron::kenweiss::hour 5
 cron_jobs::logrotate::user_cron[kenweiss]::hour 5

 Neither worked, and I can't think of any other reasonable syntax. Can
 anyone point me in the right direction?

 --Ken Weiss

 --
 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.
 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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Re: I can't seem to create mountpoint and change permissions after mounting in 2.7.3

2011-10-06 Thread Chris McDermott
I haven't used them yet, but isn't this what stages are meant to facilitate?

http://docs.puppetlabs.com/references/stable/metaparameter.html#stage

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