Re: [Puppet Users] function that returns parameters from a webservice

2016-06-10 Thread Pearl Raj
Peter and Henrik, thanks for writing in. 

Let me explain the scenario once. We use puppet 3 with Hiera for appX 
application. But due to some internal issues (management, company policy), 
the team which supports the application (Support-appX) do not have access 
to Hiera and those who manages Hiera (Support-Hiera) refuses to update 
Hiera parameters and instead has suggested a work around - to avoid Hiera 
and to replace it with a webservice which essentially mimics Hiera. 

1) Sample Webservice which returns host specific json hash
-

from flask import abort
{
  "hosts": [
{
  "description": "host vm 1",
  "done": false,
  "id": 1,
  "title": "xyz",
  "role" : "agent"
 },
 {
  "description": "host vm 2",
  "done": false,
  "id": 2,
  "title": "abc",
  "role" : "loadbalancer" 
 }
  ]}@app.route('/appX/hosts/', methods=['GET'])def 
get_host(host_id):
host = [host for host in hosts if host['id'] == host_id]
if len(host) == 0:
abort(404)
return jsonify({'host': host[0]})


So calling http://localhost:5000/appX/hosts/2 
will return the following json 
hash corresponding to host vm 2 (only representational)

{
  "description": "host vm 2",
  "done": false,
  "id": 2,
  "title": "abc",
  "role" : "loadbalancer"
 }


2) Create a puppet module with a function "get_host_hash" which essentially 
returns the above json hash as in the following example :

(ruby example - this need to be replaced by a puppet function get_host_hash)

require 'net/http'

url = 'http://localhost:5000/appX/hosts/2 
'
resp = Net::HTTP.get_response(URI.parse(url)) # get_response takes an URI object

return resp.body 


3) Write a class to retrieve config for host

class new_appx_class {
$config = get_host_hash ($::hostname)
$role = $config['role']

#calls roll specific wrapper class that passes parameters to underlying 
appx puppet classes

class { "appx::$role":
config => $config
}
}

4) Wrapper classes for different roles

class appx::loadbalancer($config) {
class {'lvs'::real_server':
  param1 => $config['lvs::real_server']['param1']
  paramx => $config['lvs::real_server']['paramx']
}

class appx::agent($config) {
class {'lvs'::agent':
  param1 => $config['lvs::agent']['param1']
  paramx => $config['lvs::agent']['paramx']
}

My doubt is about step 2. Whether it is possible to write a puppet function 
get_host_hash to call the webservice.  

Thanks and Regards,
Pearl

On Saturday, 11 June 2016 07:14:02 UTC+5:30, Henrik Lindberg wrote:
>
> On 10/06/16 17:53, Pearl Raj wrote: 
> > I am trying to write a module containing a function that returns 
> > parameters from a webservice 
> > - http://localhost:5000/app/api/nodes/node_id. This function should 
> > return a hash of configuration settings specific to that host. How do I 
> > do this? I am using puppet 3.0. 
> > 
> > pseudo code is as follows 
> > 
> > new module.pp 
> > 
> > function get_config_from_host(host_id): 
> > call http://localhost:5000/app/api/nodes/node_id and get the config 
> > hash of host_id 
> > return config hash 
> > 
> > I am new to puppet, so confused whether it is possible to do this in 
> puppet 
> > 
> > [Purpose of this exercise is to replace hiera] 
>
> In recent 4.x version of puppet, you can use "data in modules and 
> environment" using the lookup function. It provides an alternative way 
> of looking up data to hiera in that you can write a function (named 
> mymodule::data() for a module, and environment::data() in an 
> environment. Those functions can be written in the puppet language. 
>
> You will still need a function that makes the http call and transforms 
> the result back to a hash. 
>
> BTW: You can certainly return a hash from a custom function. 
>
> What you get with hiera (lookup in later versions of puppet) is also 
> automatic data binding of class parameters. That kind of data injection 
> is the recommended way to set parameters as it makes your code a lot 
> cleaner and more flexible to control. 
>
> If you just write an arbitrary function you miss out on the automatic 
> data binding. If you instead wrap that into the data() function 
> supported as a "backend" (data provider) for lookup you will get both 
> things. 
>
> - henrik 
>
> > 
> > -- 
> > 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 view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/puppet-users/dc8258ac-59f6-4aa0-b3fa-1c989e39fee6%40googlegroups.com
>  
> > <
> https://groups.google.com/d/msgid/puppet-users/dc8258ac-59f6-4aa0-b3f

[Puppet Users] Broken puppetdb

2016-06-10 Thread jdehnert
Greetings All,

I decided to try and implement the puppetlabs-puppetdb and 
puppetlabs-postgres modules after I had both puppetdb and postgres 
installed and working on my puppet server.  This was ill advised as it 
broke my working setup and no amount of re-configuring seems to be able to 
get things working again.   

I finally pulled the manifest that "describes" my configuration, but now I 
cannot seem to get puppetdb working at all.  My clients are giving me these 
kind of errors:

Error: Could not retrieve catalog from remote server: Error 400 on 
SERVER: Failed to execute 
'/pdb/cmd/v1?checksum=2b3883d84fd2c7f9899bd6280247edbccc31cf15&version=4&certname=it-lnx-01.myhost.com&command=replace_facts'
 
on at least 1 of the following 'server_urls': 
https://puppetmaster.myhost.com:8081
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

I have crawled through  the puppet docs to try and fix my configurations, 
but I can't seem to get things operating properly. 

It seemed pretty clear that I did not need to configure the SSL portion of 
puppetdb, but these errors seem to be flying the the face of what I read.

Do I need to configure SSL for puppetdb to get it to work?  and  What's my 
best chance of getting things working again.  Start from scratch, or am I 
just overlooking something from my configs.?

Thanks,
  jdehn...@gmail.com
  

-- 
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/1f1b527d-9637-4ec4-b214-adf51555927e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find class

2016-06-10 Thread Luke Tinker
Looks to actually be an issue with selinux,
im still looking into it as its not actually logging the issue,
but setting selinux to permissive is resolving the problem,

since this isn't a puppet issue i was barking up the wrong tree.

On Tuesday, 7 June 2016 00:09:53 UTC+10, jcbollinger wrote:
>
>
>> I ran 'puppet module list' and got the following.
>> /etc/puppet/environments/production/modules
>>
>
> [...]
>
> And are you certain that node server01 is in the 'production' 
> environment?  That is the default, but you do mention that you have at 
> least one other.
>
> Does file 
> /etc/puppet/environments/production/modules/apache/manifests/init.pp 
> exist on the master?  Is it, and every directory in the path to it, 
> accessible to the master process (which ordinarily runs unprivileged)?
>
> Do you see any relevant diagnostics in the master's log that you can 
> correlate with the diagnostic emitted by the agent?
>
>
> John
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/c1bfb594-3ffb-4224-8ccf-8bfe6303f390%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] function that returns parameters from a webservice

2016-06-10 Thread Henrik Lindberg

On 10/06/16 17:53, Pearl Raj wrote:

I am trying to write a module containing a function that returns
parameters from a webservice
- http://localhost:5000/app/api/nodes/node_id. This function should
return a hash of configuration settings specific to that host. How do I
do this? I am using puppet 3.0.

pseudo code is as follows

new module.pp

function get_config_from_host(host_id):
call http://localhost:5000/app/api/nodes/node_id and get the config
hash of host_id
return config hash

I am new to puppet, so confused whether it is possible to do this in puppet

[Purpose of this exercise is to replace hiera]


In recent 4.x version of puppet, you can use "data in modules and 
environment" using the lookup function. It provides an alternative way 
of looking up data to hiera in that you can write a function (named 
mymodule::data() for a module, and environment::data() in an 
environment. Those functions can be written in the puppet language.


You will still need a function that makes the http call and transforms 
the result back to a hash.


BTW: You can certainly return a hash from a custom function.

What you get with hiera (lookup in later versions of puppet) is also 
automatic data binding of class parameters. That kind of data injection 
is the recommended way to set parameters as it makes your code a lot 
cleaner and more flexible to control.


If you just write an arbitrary function you miss out on the automatic 
data binding. If you instead wrap that into the data() function 
supported as a "backend" (data provider) for lookup you will get both 
things.


- henrik



--
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/dc8258ac-59f6-4aa0-b3fa-1c989e39fee6%40googlegroups.com
.
For more options, visit https://groups.google.com/d/optout.



--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

--
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/9f6b5d36-1628-6b59-81c4-5a54b47e66ec%40puppet.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Unexpected behavior when using variable interpolation on a subkey in hiera

2016-06-10 Thread Henrik Lindberg

On 10/06/16 20:14, aru...@berkeley.edu wrote:

Yikes. When I originally posted I cleaned up identifiable and I took
away too much. I actually was passing everything through like I should.
Since I deleted my test data from the original post, Here's the hiera
data I am having trouble with:

ucb::mail::senders:
  "@%{::clientcert}":
relay: 'berkeley.edu'

And the resulting hiera call that returns the unexpected entry:

# hiera -h ucb::mail::senders ::clientcert=myhost.ist.berkeley.edu
::environment=arusso_postfix ::fqdn=myhost.ist.berkeley.edu -c
/etc/hiera-test.yaml
{"@%{::clientcert}"=>{"relay"=>"berkeley.edu"},
 "@myhost.ist.berkeley.edu"=>{"relay"=>"berkeley.edu"}}



It looks like hiera is doing it wrong - it ends up adding the 
interpolated key to the hash without removing the original.


Is the hiera_hash function doing the same from within puppet?

- henrik


The template generated on the host also reflects the fact that the extra
entry is being sent over. I also tried it with other facts, like fqdn
and hostname, and confirmed they all exhibit the same behavior.

Thanks,

Aaron

On Friday, June 10, 2016 at 12:08:59 AM UTC-7, Johan De Wit wrote:

Hi,


running hiera from the command line, you have to provide the
variables you use yourself like


hiera somekey clientcert=node.example.net 


Here is some reading

https://puppet.com/blog/debugging-hiera




hth


Johan




-Original message-
*From:* aru...@berkeley.edu  >
*Sent:* Thursday 9th June 2016 23:17
*To:* Puppet Users >
*Subject:* [Puppet Users] Unexpected behavior when using
variable interpolation on a subkey in hiera

Greetings,

I'm having trouble using hiera variable interpolation on a
sub-key. It appears that along with interpolating the variable,
hiera is also returning the un-interpolated data as well, which
is causing issues because the un-interpolated data is nonsense.
I'm currently running Hiera 1.3.4 and Puppet 3.8.5 on RHEL6.

Here's an example of what I have in hiera:

# common.yaml
somekey:
"%{::clientcert}":
subsubkey: "data"

And here's what I get when I query hiera directly:

$ hiera -h somekey
{"myhost.example.com
"=>{"subsubkey"=>"data"},
 "%{::clientcert}"=>{"subsubkey"=>"data"}}

Oddly enough, if I run it without the -h flag, I only get the
un-interpolated data.

$ hiera somekey
{"%{::clientcert}"=>{"subsubkey"=>"data"}}

Based on my reading of the docs[1], in both cases I would expect
to get back: {{"myhost.example.com
"=>{"subsubkey"=>"data"}}

I also tested variable interpolation with the value of
subsubkey, and hiera properly interpolated it correctly, even on
the returned entry where %{::clientcert} was left un-interpolated.

Initially I thought this was somehow related to deep_merge, but
I tested it out by disabling deep_merge (removing the
merge_behavior key) and I get the same results.

Am I misunderstanding how interpolation on sub-keys in hiera
should work, or is this unintended behavior?

Thanks,

Aaron

[1] https://docs.puppet.com/hiera/1/variables.html


--
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 view this discussion on the web visit

https://groups.google.com/d/msgid/puppet-users/3f69f394-e680-4c4e-9a2f-25e6bf2a961e%40googlegroups.com

.
For more options, visit https://groups.google.com/d/optout
.

--
You received this message because you are subscribed to the Google
Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to puppet-users+unsubscr...@googlegroups.com
.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/f76ea91b-41e8-4282-9e4c-db75c8ef5ac0%40googlegroups.com
.
For more options, visit https://groups.google.com/d/optout.



--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

--
You received this message because you are subs

Re: [Puppet Users] Unexpected behavior when using variable interpolation on a subkey in hiera

2016-06-10 Thread arusso
Yikes. When I originally posted I cleaned up identifiable and I took away 
too much. I actually was passing everything through like I should. Since I 
deleted my test data from the original post, Here's the hiera data I am 
having trouble with:

ucb::mail::senders:
  "@%{::clientcert}":
relay: 'berkeley.edu'

And the resulting hiera call that returns the unexpected entry:

# hiera -h ucb::mail::senders ::clientcert=myhost.ist.berkeley.edu 
::environment=arusso_postfix ::fqdn=myhost.ist.berkeley.edu -c 
/etc/hiera-test.yaml
{"@%{::clientcert}"=>{"relay"=>"berkeley.edu"},
 "@myhost.ist.berkeley.edu"=>{"relay"=>"berkeley.edu"}}

The template generated on the host also reflects the fact that the extra 
entry is being sent over. I also tried it with other facts, like fqdn and 
hostname, and confirmed they all exhibit the same behavior.

Thanks,

Aaron

On Friday, June 10, 2016 at 12:08:59 AM UTC-7, Johan De Wit wrote:
>
> Hi,
>
>
> running hiera from the command line, you have to provide the variables you 
> use yourself like 
>
>
> hiera somekey clientcert=node.example.net
>
>
> Here is some reading
>
> https://puppet.com/blog/debugging-hiera
>
> 
>
> hth
>
>
> Johan
>
>
>
>
> -Original message-
> *From:* aru...@berkeley.edu   >
> *Sent:* Thursday 9th June 2016 23:17
> *To:* Puppet Users >
> *Subject:* [Puppet Users] Unexpected behavior when using variable 
> interpolation on a subkey in hiera
>
> Greetings,
>
> I'm having trouble using hiera variable interpolation on a sub-key. It 
> appears that along with interpolating the variable, hiera is also returning 
> the un-interpolated data as well, which is causing issues because the 
> un-interpolated data is nonsense. I'm currently running Hiera 1.3.4 and 
> Puppet 3.8.5 on RHEL6.
>
> Here's an example of what I have in hiera:
>
> # common.yaml
> somekey:
> "%{::clientcert}":
> subsubkey: "data"
>
> And here's what I get when I query hiera directly:
>
> $ hiera -h somekey
> {"myhost.example.com"=>{"subsubkey"=>"data"},
>  "%{::clientcert}"=>{"subsubkey"=>"data"}}
>
> Oddly enough, if I run it without the -h flag, I only get the 
> un-interpolated data.
>
> $ hiera somekey
> {"%{::clientcert}"=>{"subsubkey"=>"data"}}
>
> Based on my reading of the docs[1], in both cases I would expect to get 
> back: {{"myhost.example.com"=>{"subsubkey"=>"data"}}
>
> I also tested variable interpolation with the value of subsubkey, and 
> hiera properly interpolated it correctly, even on the returned entry where 
> %{::clientcert} was left un-interpolated.
>
> Initially I thought this was somehow related to deep_merge, but I tested 
> it out by disabling deep_merge (removing the merge_behavior key) and I get 
> the same results.
>
> Am I misunderstanding how interpolation on sub-keys in hiera should work, 
> or is this unintended behavior?
>
> Thanks,
>
> Aaron
>
> [1] https://docs.puppet.com/hiera/1/variables.html
>
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/puppet-users/3f69f394-e680-4c4e-9a2f-25e6bf2a961e%40googlegroups.com
>  
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/f76ea91b-41e8-4282-9e4c-db75c8ef5ac0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] function that returns parameters from a webservice

2016-06-10 Thread Peter Kristolaitis
You can write custom functions[1], but I don't think they can return a 
hash -- only a single value.  This functionality is designed for things 
like calculating password hashes, etc, not generalized data lookup.  
This is probably also completely the wrong approach, in the Puppet 
model, if your goal is to parameterize entire classes.


A much better solution is to keep Hiera, but write a custom backend[2] 
to integrate the data returned by your API into Hiera's structure.  This 
keeps all the benefits of Hiera while also giving you back-end flexibility.


[1] https://docs.puppet.com/guides/custom_functions.html
[2] https://docs.puppet.com/hiera/3.1/custom_backends.html


On 2016-06-10 11:53 AM, Pearl Raj wrote:
I am trying to write a module containing a function that returns 
parameters from a webservice 
- http://localhost:5000/app/api/nodes/node_id. This function should 
return a hash of configuration settings specific to that host. How do 
I do this? I am using puppet 3.0.


pseudo code is as follows

new module.pp

function get_config_from_host(host_id):
call http://localhost:5000/app/api/nodes/node_id and get the 
config hash of host_id

return config hash

I am new to puppet, so confused whether it is possible to do this in 
puppet


[Purpose of this exercise is to replace hiera]
--
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/dc8258ac-59f6-4aa0-b3fa-1c989e39fee6%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


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


[Puppet Users] Augeas help

2016-06-10 Thread mike r
Hello, Im tryign to use Augeas in my manifest to manage /etc/fstab file

specifically I want to make sure my /etc/fstab file has the following line

/tmp /tmp nodev,noexec 0 0


Augeas syntax is like learning Chinese, Im trying to make my manifest 
figure out whether 

1) /etc/fstab has a line ^/tmp, if not add a new line with /tmp

2) if this line exists, then if it has nodev option, if not, append the 
'nodev' to this line (/tmp nodev)

3) if this line exists, check if noexec option is there, of not, append to 
the line (/tmp nodev, noexec)

anyone have idea how to actually write this out? Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/48405a04-ab52-4b78-bb05-64d4c3f59a1c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] function that returns parameters from a webservice

2016-06-10 Thread Pearl Raj
I am trying to write a module containing a function that returns parameters 
from a webservice - http://localhost:5000/app/api/nodes/node_id. This 
function should return a hash of configuration settings specific to that 
host. How do I do this? I am using puppet 3.0.

pseudo code is as follows 

new module.pp 

function get_config_from_host(host_id):
call http://localhost:5000/app/api/nodes/node_id and get the config 
hash of host_id
return config hash

I am new to puppet, so confused whether it is possible to do this in puppet

[Purpose of this exercise is to replace hiera]

-- 
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/dc8258ac-59f6-4aa0-b3fa-1c989e39fee6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Git Repo Strategy

2016-06-10 Thread Rich Burroughs
I'm assuming this could be done. We're talking about UNIX she'll commands
and there's a way to do just about anything. But I can't imagine it being
simple or fun to use. Like could you do Pull Requests on Github between
these repos? Maybe, depending on how you set it up. People nowadays
recommend against monolithic repos too, and that's what you'd have. You'd
just have a bunch of them.

The normal recommended workflow with r10k is using branches for those
environments, not separate repos. Then you have the ability to merge
between branches, so it's easy to promote those changes along your pipeline.

I remember back before I started using r10k, it seemed very confusing to
me. I think there's a bit more info out about it now. In terms of getting a
Puppetfile setup, one of the hard things there is that you need to account
for all of the dependencies. Rob Nelson made this cool Ruby gem that makes
generating the file a bit easier. You can pass it a set of Forge modules
and it will also include their dependencies:

https://github.com/rnelson0/puppet-generate-puppetfile/blob/master/README.md

It's pretty slick.

Personally I'd recommend you stick it out and figure out how to make r10k
work for what you're doing. I would bet you'd be glad you did after. If you
have problems ask specific question here or IRC or Slack. There are a lot
of people using it now and there should be lots who can help.


Rich
On Fri, Jun 10, 2016 at 7:34 AM Funsaized  wrote:

> Hello,
>
> I am relatively new to puppet and am trying to develop a good workflow in
> conjunction with git/github to keep a better version control system. The
> version of puppet that I am working with and has been implemented is a bit
> dated, and using R10k and developing a puppetfile would be quite time
> consuming. I know that R10k and dynamic environments is the recommended way
> of doing things, though for now I'm not sure if its the best for my
> scenario and how everything has been previously set up. My question is is
> there a simple way to just map one git repo for each environment (dev, QA,
> production, etc). That way changes could be made in the dev environment,
> then moved over to the correct repos when the changes are confirmed in
> order? Would this be as simple as declaring each folder withing the
> /puppet/environments folder as a git repo and controlling that way?
>
> Deployment strategy
>
> -   Upload changes to Dev repo
>
> -   Deploy Dev changes to Dev master
>
> -   Test
>
> -   Merge Dev changes to QA repo
>
> -   Rinse and repeat
>
> --
> 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/fe80ff27-af02-4437-bbc9-57c1cd56e5aa%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [Puppet Users] Git Repo Strategy

2016-06-10 Thread Christopher Wood
On Fri, Jun 10, 2016 at 05:57:13AM -0700, Funsaized wrote:
>Hello,
> 
>I am relatively new to puppet and am trying to develop a good workflow in
>conjunction with git/github to keep a better version control system. The
>version of puppet that I am working with and has been implemented is a bit
>dated, and using R10k and developing a puppetfile would be quite time
>consuming.

Yes it would be time consuming. It's worth the time. An upgrade would probably 
help you too.

>I know that R10k and dynamic environments is the recommended
>way of doing things, though for now I'm not sure if its the best for my
>scenario and how everything has been previously set up. My question is is
>there a simple way to just map one git repo for each environment (dev, QA,
>production, etc). That way changes could be made in the dev environment,
>then moved over to the correct repos when the changes are confirmed in
>order? Would this be as simple as declaring each folder withing the
>/puppet/environments folder as a git repo and controlling that way?

Been there, tried it, moved to r10k. The above is a great way to see your 
environments drift over time.

If you want each environment to be a separate git repo you can, but it sounds 
like you may as well have them all as branches in a single git repo. That way 
you can at least diff different branches easily and cherry pick single changes 
from one to the other.

>Deployment strategy
> 
>-   Upload changes to Dev repo
> 
>-   Deploy Dev changes to Dev master
> 
>-   Test
> 
>-   Merge Dev changes to QA repo
> 
>-   Rinse and repeat

What is QA for, in this scenario? Determining that you've brought up the 
correct set of changes from dev? If so, why not use git itself to prove that 
you've brought up the correct changes, as specified by git commits, to your 
mainline branch?

>--
>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 [1]puppet-users+unsubscr...@googlegroups.com.
>To view this discussion on the web visit
>
> [2]https://groups.google.com/d/msgid/puppet-users/fe80ff27-af02-4437-bbc9-57c1cd56e5aa%40googlegroups.com.
>For more options, visit [3]https://groups.google.com/d/optout.
> 
> References
> 
>Visible links
>1. mailto:puppet-users+unsubscr...@googlegroups.com
>2. 
> https://groups.google.com/d/msgid/puppet-users/fe80ff27-af02-4437-bbc9-57c1cd56e5aa%40googlegroups.com?utm_medium=email&utm_source=footer
>3. https://groups.google.com/d/optout

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


[Puppet Users] Git Repo Strategy

2016-06-10 Thread Funsaized
Hello, 

I am relatively new to puppet and am trying to develop a good workflow in 
conjunction with git/github to keep a better version control system. The 
version of puppet that I am working with and has been implemented is a bit 
dated, and using R10k and developing a puppetfile would be quite time 
consuming. I know that R10k and dynamic environments is the recommended way 
of doing things, though for now I'm not sure if its the best for my 
scenario and how everything has been previously set up. My question is is 
there a simple way to just map one git repo for each environment (dev, QA, 
production, etc). That way changes could be made in the dev environment, 
then moved over to the correct repos when the changes are confirmed in 
order? Would this be as simple as declaring each folder withing the 
/puppet/environments folder as a git repo and controlling that way? 

Deployment strategy

-   Upload changes to Dev repo

-   Deploy Dev changes to Dev master

-   Test

-   Merge Dev changes to QA repo

-   Rinse and repeat

-- 
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/fe80ff27-af02-4437-bbc9-57c1cd56e5aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Conrol class order of execution

2016-06-10 Thread Lowe Schmidt
You can use the same operators to express dependencies between classes.

--
Lowe Schmidt | +46 723 867 157

On 10 June 2016 at 15:08, Harish Kothuri  wrote:

>
>
> On Friday, June 10, 2016 at 6:29:27 PM UTC+5:30, Harish Kothuri wrote:
>>
>> Hi,
>>
>> Thanks for your reply.
>>
>> I'm looking how to control the execution classes with different manifest
>> files. I'm aware and already controlling the order within the manifests.
>>
>> Thanks
>>
>> On Friday, June 10, 2016 at 6:16:18 PM UTC+5:30, Lowe Schmidt wrote:
>>>
>>> You can use the relationships operators described here here
>>> https://docs.puppet.com/puppet/latest/reference/lang_relationships.html
>>>
>>>
>>> --
>>> Lowe Schmidt | +46 723 867 157
>>>
>>> On 10 June 2016 at 14:05, Harish Kothuri  wrote:
>>>
 Hi,

 I have several classes attached to a host and i want to control the
 execution order the classes.

 Ex: i have a class which collect some custom facts and i want to
 execute this class after completion of all the other classes.

 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...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/6b476924-b0ba-4d98-8551-41a8ce3b84fc%40googlegroups.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>
>>> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/f656446f-dd46-4057-95fe-66bb2f25e95d%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAC-wWcQyB%2Bjr0TMe_HqxAsgEdb3vo3%3Di9nq%2B_%3Di_2LtWXONkdA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Conrol class order of execution

2016-06-10 Thread Harish Kothuri


On Friday, June 10, 2016 at 6:29:27 PM UTC+5:30, Harish Kothuri wrote:
>
> Hi,
>
> Thanks for your reply.
>
> I'm looking how to control the execution classes with different manifest 
> files. I'm aware and already controlling the order within the manifests.
>
> Thanks
>
> On Friday, June 10, 2016 at 6:16:18 PM UTC+5:30, Lowe Schmidt wrote:
>>
>> You can use the relationships operators described here here 
>> https://docs.puppet.com/puppet/latest/reference/lang_relationships.html 
>>
>>
>> --
>> Lowe Schmidt | +46 723 867 157
>>
>> On 10 June 2016 at 14:05, Harish Kothuri  wrote:
>>
>>> Hi,
>>>
>>> I have several classes attached to a host and i want to control the 
>>> execution order the classes.
>>>
>>> Ex: i have a class which collect some custom facts and i want to execute 
>>> this class after completion of all the other classes.
>>>
>>> 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...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/puppet-users/6b476924-b0ba-4d98-8551-41a8ce3b84fc%40googlegroups.com
>>>  
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/f656446f-dd46-4057-95fe-66bb2f25e95d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Conrol class order of execution

2016-06-10 Thread Harish Kothuri
Hi,

Thanks for your reply.

I'm looking how to control the execution classes with different manifest 
files. I'm aware and already controlling the order within the manifests.

Thanks

On Friday, June 10, 2016 at 6:16:18 PM UTC+5:30, Lowe Schmidt wrote:
>
> You can use the relationships operators described here here 
> https://docs.puppet.com/puppet/latest/reference/lang_relationships.html 
>
>
> --
> Lowe Schmidt | +46 723 867 157
>
> On 10 June 2016 at 14:05, Harish Kothuri  > wrote:
>
>> Hi,
>>
>> I have several classes attached to a host and i want to control the 
>> execution order the classes.
>>
>> Ex: i have a class which collect some custom facts and i want to execute 
>> this class after completion of all the other classes.
>>
>> 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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/puppet-users/6b476924-b0ba-4d98-8551-41a8ce3b84fc%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/3b922708-d32e-4d60-9cf4-c6b9a49f417e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Conrol class order of execution

2016-06-10 Thread Lowe Schmidt
You can use the relationships operators described here here
https://docs.puppet.com/puppet/latest/reference/lang_relationships.html


--
Lowe Schmidt | +46 723 867 157

On 10 June 2016 at 14:05, Harish Kothuri  wrote:

> Hi,
>
> I have several classes attached to a host and i want to control the
> execution order the classes.
>
> Ex: i have a class which collect some custom facts and i want to execute
> this class after completion of all the other classes.
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/6b476924-b0ba-4d98-8551-41a8ce3b84fc%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAC-wWcRpjTGyhtmzGmaCgDF3ROyM%3DR9UGE5ox6VoFv-eLD5mpw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Conrol class order of execution

2016-06-10 Thread Harish Kothuri
Hi,

I have several classes attached to a host and i want to control the 
execution order the classes.

Ex: i have a class which collect some custom facts and i want to execute 
this class after completion of all the other classes.

Thanks 

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/6b476924-b0ba-4d98-8551-41a8ce3b84fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Re: Hiera, define, class, putting all together

2016-06-10 Thread Helmut Schneider
jcbollinger wrote:

> 
> On Tuesday, June 7, 2016 at 8:02:24 AM UTC-5, Helmut Schneider wrote:
> > 
> > jcbollinger wrote: 
> > 
> > 
> Without the case statement, how can I make sure that ubuntu only 
> > receives classes for ubuntu and not e.g. for Windows then? 
> > 
> > 
> 
> That is where your data hierarchy comes in.  You have a level named 
> "ubuntu-common"; it therefore stands to reason that if you have any
> Windows machines under management then there is also a
> "windows-common" (even if it's only notional).  These would be
> alternatives for a particular level of your hierarchy, and you would
> select which to use based on node facts.  That's precisely what you
> presently do via the 'case' statement, but you can, and probably
> should, do it directly in your hierarchy definition.  This is one of
> the primary uses of Hiera interpolation tokens.  The Hiera docs for
> defining a hierarchy
>  discuss this and
> provide an example.  (I've linked to the Hiera 3.1 docs, but
> substantially the same thing applies to older Hiera as well.)

I changed my config accordingly:

:hierarchy:
  - "nodes/%{::fqdn}"
  - "%{::operatingsystem}"
  - "%{::osfamily}"
  - common

Thank you!

-- 
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/xn0k7324iwgvkxm000%40news.gmane.org.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] mysql - granting permissions twith puppet

2016-06-10 Thread Lowe Schmidt
Can you show us the code that you've written for this?
It looks quite straight forward when looking at this documentation
https://github.com/puppetlabs/puppetlabs-mysql#mysql_grant



--
Lowe Schmidt | +46 723 867 157

On 9 June 2016 at 23:19, kaustubh chaudhari  wrote:

> Hi All,
>
> I am trying to grant permissions to a user from multiple hosts. I am not
> able to achieve it with the default mysql module. Trying to avoid exec.
>
> This is what happens with i use mysql_grant resource. i am not able to
> identify it with a password. Due to which authentication fails.
>
>
> #
> select host, user, password from mysql.user;
>
>
>  10.20.1.210 | wikitwo |   |
> | 10.20.1.210 | wikione |   |
> | 10.20.1.220 | wikitwo | *D5F5E87658841ABF16379CF80D9B340303EC1BE9 |
> | 10.20.1.220 | wikione | *FE49E8ACAE9F986F5AD538EB6C92B92FF20152F1
>
>
> Offcourse  i can do it manually but is there way i can do this with puppet
> ?
>
> -Cheers
> Kaustubh
>
> --
> 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/43f9cf26-da43-44de-9ae9-876b1ebe387d%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAC-wWcSTeaidmsML3fvzcZXxnf9woOCvEL%2BjUBVq8O00%2BRw60w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


RE: [Puppet Users] Unexpected behavior when using variable interpolation on a subkey in hiera

2016-06-10 Thread Johan De Wit
Hi,



running hiera from the command line, you have to provide the variables you use 
yourself like 



hiera somekey clientcert=node.example.net



Here is some reading

https://puppet.com/blog/debugging-hiera



hth



Johan







-Original message-
From: aru...@berkeley.edu 
Sent: Thursday 9th June 2016 23:17
To: Puppet Users 
Subject: [Puppet Users] Unexpected behavior when using variable interpolation 
on a subkey in hiera

Greetings,

I'm having trouble using hiera variable interpolation on a sub-key. It appears 
that along with interpolating the variable, hiera is also returning the 
un-interpolated data as well, which is causing issues because the 
un-interpolated data is nonsense. I'm currently running Hiera 1.3.4 and Puppet 
3.8.5 on RHEL6.

Here's an example of what I have in hiera:

# common.yaml
somekey:
    "%{::clientcert}":
        subsubkey: "data"

And here's what I get when I query hiera directly:

$ hiera -h somekey
{"myhost.example.com"=>{"subsubkey"=>"data"},
 "%{::clientcert}"=>{"subsubkey"=>"data"}}

Oddly enough, if I run it without the -h flag, I only get the un-interpolated 
data.

$ hiera somekey
{"%{::clientcert}"=>{"subsubkey"=>"data"}}

Based on my reading of the docs[1], in both cases I would expect to get back: 
{{"myhost.example.com"=>{"subsubkey"=>"data"}}

I also tested variable interpolation with the value of subsubkey, and hiera 
properly interpolated it correctly, even on the returned entry where 
%{::clientcert} was left un-interpolated.

Initially I thought this was somehow related to deep_merge, but I tested it out 
by disabling deep_merge (removing the merge_behavior key) and I get the same 
results.

Am I misunderstanding how interpolation on sub-keys in hiera should work, or is 
this unintended behavior?

Thanks,

Aaron

[1] https://docs.puppet.com/hiera/1/variables.html

-- 
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/3f69f394-e680-4c4e-9a2f-25e6bf2a961e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/zarafa.575a677a.0d71.2aa59bac7febfe16%40zarafa.open-future.be.
For more options, visit https://groups.google.com/d/optout.