Re: [Puppet Users] Passing a generated variable inside a template...how?

2015-11-25 Thread Rodent of Unusual Size
It's probably returning an object.  Try resolving @int_ip.to_s

-- 
Ken Coar
Sanagendamgagwedweinini

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


[Puppet Users] Cert generation messed up, fresh install

2015-11-25 Thread John Gateley
Puppet 4.3.0
Server Debian 7
Client Debian 8

I have verified the server is running and listening on port 8140
The client has the puppet service started, but there are no certs to verify 
on the server.
This is the error I am seeing:

root@puppetclient1:/opt/puppetlabs/puppet# puppet agent --test 

Error: Could not request certificate: SSL_connect SYSCALL returned=5 
errno=0 state=SSLv2/v3 read server hello A
Exiting; failed to retrieve certificate and waitforcert is disabled

I tried removing the client ssl directory, no change in behavior.

Any suggestions appreciated, I am very new to Puppet.

Thanks

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/dbcddf0e-9604-4f14-91f6-f41b99919b3b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Puppet 4.3.0 and Debian 7, fresh install, missing packages

2015-11-25 Thread John Gateley
Hello,

I have installed 4.3.0 on a Debian 7 system, and followed the instructions 
here:

https://docs.puppetlabs.com/puppetserver/2.2/install_from_packages.html

The puppetserver failed to start, due to an obscure error:
...
java.lang.IllegalStateException: There was a problem adding a JRubyPuppet 
instance to the pool.
...

After some searching, I found this:
http://tuxmea.blogspot.com/2015/05/puppet-enterprise-38-installation-steps.html
And towards the middle there is a fix for this error regarding several 
missing packages.

That did the trick, but these packages should be part of the package 
dependencies.
I used puppetlabs package to update sources.list, and got the packages from 
there.

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/81f89884-0840-4ce4-866f-36ace9907c5f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Passing a generated variable inside a template...how?

2015-11-25 Thread Dayton Jones
Yep...the IP's are all resolvable, and if I hardcode one of them in to the 
Resolv... line, it works and writes to the file... so I have no idea why 
passing @int_ip to Resolv (instead of the hardcoded IP) fails...

Thanks again for the help...

On Wednesday, November 25, 2015 at 4:04:00 PM UTC-6, denmat wrote:
>
> No, it is the same for the this test. You do need to have a resolvable IP 
> address for each interface IP it finds or it will error. For example I had 
> to add hostnames in my /etc/hosts file for my vagrant IPs (10.0.2.15, 
> 172.28.128.5). 
>
> That maybe the error you're seeing there, "cannot interpret as address".
>
> On Thu, Nov 26, 2015 at 8:54 AM, Dayton Jones  > wrote:
>
>> First, thanks for the help - I've been banging my head against the wall 
>> too much on this.
>>
>> Unfortunately, it's still not working for me..  
>>
>> I'm not using an inline template, I have an actual .erb file called out 
>> in my manifest - though I don't see why this would be any different.
>>
>> my erb now looks like:
>>
>> <% scope.lookupvar("interfaces").split(",").each do |interface| %>
>> <% @int_ip = scope.lookupvar("ipaddress_" + interface) %>
>> <% @int_name = Resolv.new.getname @int_ip %>
>> <%= "#{@int_ip}  #{@int_name}" %>
>> <% end %>
>>
>> (thanks, didn't realize I'd mixed up the single/double quotes)
>>
>> and here is the result when puppet runs and the class is applied:
>>
>>   Filepath: /usr/lib/ruby/1.8/resolv.rb
>>   Line: 429
>>   Detail: cannot interpret as address: 
>>
>>
>> Is there a difference in using an inline template inside of the class 
>> defintion as opposed to using an erb file called as a resource?
>>
>>>
>>> -- 
>> 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/f15d30b2-2be4-4267-a8eb-9c19bbb63034%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/1fdbbe47-4e4f-4ede-8226-cba9f2f90fb3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Passing a generated variable inside a template...how?

2015-11-25 Thread denmat
No, it is the same for the this test. You do need to have a resolvable IP
address for each interface IP it finds or it will error. For example I had
to add hostnames in my /etc/hosts file for my vagrant IPs (10.0.2.15,
172.28.128.5).

That maybe the error you're seeing there, "cannot interpret as address".

On Thu, Nov 26, 2015 at 8:54 AM, Dayton Jones 
wrote:

> First, thanks for the help - I've been banging my head against the wall
> too much on this.
>
> Unfortunately, it's still not working for me..
>
> I'm not using an inline template, I have an actual .erb file called out in
> my manifest - though I don't see why this would be any different.
>
> my erb now looks like:
>
> <% scope.lookupvar("interfaces").split(",").each do |interface| %>
> <% @int_ip = scope.lookupvar("ipaddress_" + interface) %>
> <% @int_name = Resolv.new.getname @int_ip %>
> <%= "#{@int_ip}  #{@int_name}" %>
> <% end %>
>
> (thanks, didn't realize I'd mixed up the single/double quotes)
>
> and here is the result when puppet runs and the class is applied:
>
>   Filepath: /usr/lib/ruby/1.8/resolv.rb
>   Line: 429
>   Detail: cannot interpret as address:
>
>
> Is there a difference in using an inline template inside of the class
> defintion as opposed to using an erb file called as a resource?
>
>>
>> --
> 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/f15d30b2-2be4-4267-a8eb-9c19bbb63034%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/CAJsPER0VK81hmbFLcuSRxCTMQ086x5kM9V5%3DT1Mp%3DdEvSR%3DwSA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Passing a generated variable inside a template...how?

2015-11-25 Thread Dayton Jones
First, thanks for the help - I've been banging my head against the wall too 
much on this.

Unfortunately, it's still not working for me..  

I'm not using an inline template, I have an actual .erb file called out in 
my manifest - though I don't see why this would be any different.

my erb now looks like:

<% scope.lookupvar("interfaces").split(",").each do |interface| %>
<% @int_ip = scope.lookupvar("ipaddress_" + interface) %>
<% @int_name = Resolv.new.getname @int_ip %>
<%= "#{@int_ip}  #{@int_name}" %>
<% end %>

(thanks, didn't realize I'd mixed up the single/double quotes)

and here is the result when puppet runs and the class is applied:

  Filepath: /usr/lib/ruby/1.8/resolv.rb
  Line: 429
  Detail: cannot interpret as address: 


Is there a difference in using an inline template inside of the class 
defintion as opposed to using an erb file called as a resource?

>
>

-- 
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/f15d30b2-2be4-4267-a8eb-9c19bbb63034%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Passing a generated variable inside a template...how?

2015-11-25 Thread denmat
okay, this works.

test.pp
class a {

  $inline = inline_template(
'<% scope.lookupvar("interfaces").split(",").each do |interface| %>
 <% @int_ip = scope.lookupvar("ipaddress_" + interface) %>
 <% @int_name = Resolv.new.getname @int_ip %>
 <%= "#{@int_ip}  #{@int_name}" %>
 <% end %>')

notify { $inline: }

}

include a


$ puppet apply test.pp

Notice: /Stage[main]/A/Notify[
 10.0.2.15  fake.name.net
 172.28.128.5  another.faker.net
 127.0.0.1  localhost
 ]/

Sorry to mess you around before. Maybe it was your mixing of "'" and """?



On Thu, Nov 26, 2015 at 8:21 AM, Dayton Jones 
wrote:

> Right, that works -- but I want to get the IP by using the scope.lookup
> var and not hardcode an IP in the template.  I know both the
> "scope.lookupvar('ipaddress_'+interface)" and "@int_name =
> Resolv.new.getname " works, but I'm struggling on how to send the IP
> gained from the lookupvar to the Resolv.new.getname function inside the
> template.. It should just be a syntax issue, but I'm new to ruby/erb  so
> I'm not sure the correct way to pass a generated string to a function
> within the same structure...
>
> On Wednesday, November 25, 2015 at 3:10:55 PM UTC-6, denmat wrote:
>>
>> Sorry, rushing around on trains. Try this:
>>
>> irb(main):002:0> require 'resolv'
>> => true
>> irb(main):003:0> Resolv.new.getname('127.0.0.1')
>> => "localhost"
>>
>> On Thu, Nov 26, 2015 at 7:54 AM, Denmat  wrote:
>>
>>> Sorry, ignore my suggestion. That won't work.
>>>
>>> On 26 Nov 2015, at 06:57, Dayton Jones  wrote:
>>>
>>> I'm writing a template to populate a file - easy enough...
>>>
>>> What I want is to to grab the list of interfaces, get the ip assigned to
>>> that interface and then do a lookup of the ip to get the dns name.
>>>
>>> I'm able to get the interfaces/ips just fine, but can't figure out how
>>> to then pass the IP to the function to do the lookup.  Any help is greatly
>>> appreciated...
>>>
>>> ===
>>> start ERB
>>>
>>> <% scope.lookupvar('interfaces').split(",").each do |interface| %>
>>> <% @int_ip = scope.lookupvar('ipaddress_'+interface) %>
>>> <% @int_name = Resolv.new.getname @int_ip %>
>>> ...
>>> <% end %>
>>>
>>> end ERB
>>> 
>>>
>>> @int_ip gets popluated and I can manipulate it as needed, but how do I
>>> properly pass it to 'Resolv.new.getname' to set the int_name string?
>>>
>>> --
>>> 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/6bf51a8e-eb7f-4bcd-ac77-2451bcbec5ce%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/14fe0e25-b0b6-4118-8212-87734e580029%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/CAJsPER0kBDxCpkdZqWoav_EJqmDeCtLFPU4Z6wh1uU_WL%2BTVXg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Passing a generated variable inside a template...how?

2015-11-25 Thread Dayton Jones
Right, that works -- but I want to get the IP by using the scope.lookup var 
and not hardcode an IP in the template.  I know both the 
"scope.lookupvar('ipaddress_'+interface)" and "@int_name = 
Resolv.new.getname " works, but I'm struggling on how to send the IP 
gained from the lookupvar to the Resolv.new.getname function inside the 
template.. It should just be a syntax issue, but I'm new to ruby/erb  so 
I'm not sure the correct way to pass a generated string to a function 
within the same structure... 

On Wednesday, November 25, 2015 at 3:10:55 PM UTC-6, denmat wrote:
>
> Sorry, rushing around on trains. Try this:
>
> irb(main):002:0> require 'resolv'
> => true
> irb(main):003:0> Resolv.new.getname('127.0.0.1')
> => "localhost"
>
> On Thu, Nov 26, 2015 at 7:54 AM, Denmat > 
> wrote:
>
>> Sorry, ignore my suggestion. That won't work.
>>
>> On 26 Nov 2015, at 06:57, Dayton Jones > 
>> wrote:
>>
>> I'm writing a template to populate a file - easy enough...
>>
>> What I want is to to grab the list of interfaces, get the ip assigned to 
>> that interface and then do a lookup of the ip to get the dns name.
>>
>> I'm able to get the interfaces/ips just fine, but can't figure out how to 
>> then pass the IP to the function to do the lookup.  Any help is greatly 
>> appreciated...
>>
>> ===
>> start ERB
>>
>> <% scope.lookupvar('interfaces').split(",").each do |interface| %>
>> <% @int_ip = scope.lookupvar('ipaddress_'+interface) %>
>> <% @int_name = Resolv.new.getname @int_ip %>
>> ...
>> <% end %>
>>
>> end ERB
>> 
>>
>> @int_ip gets popluated and I can manipulate it as needed, but how do I 
>> properly pass it to 'Resolv.new.getname' to set the int_name string?
>>
>> -- 
>> 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/6bf51a8e-eb7f-4bcd-ac77-2451bcbec5ce%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/14fe0e25-b0b6-4118-8212-87734e580029%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Passing a generated variable inside a template...how?

2015-11-25 Thread denmat
Sorry, rushing around on trains. Try this:

irb(main):002:0> require 'resolv'
=> true
irb(main):003:0> Resolv.new.getname('127.0.0.1')
=> "localhost"

On Thu, Nov 26, 2015 at 7:54 AM, Denmat  wrote:

> Sorry, ignore my suggestion. That won't work.
>
> On 26 Nov 2015, at 06:57, Dayton Jones  wrote:
>
> I'm writing a template to populate a file - easy enough...
>
> What I want is to to grab the list of interfaces, get the ip assigned to
> that interface and then do a lookup of the ip to get the dns name.
>
> I'm able to get the interfaces/ips just fine, but can't figure out how to
> then pass the IP to the function to do the lookup.  Any help is greatly
> appreciated...
>
> ===
> start ERB
>
> <% scope.lookupvar('interfaces').split(",").each do |interface| %>
> <% @int_ip = scope.lookupvar('ipaddress_'+interface) %>
> <% @int_name = Resolv.new.getname @int_ip %>
> ...
> <% end %>
>
> end ERB
> 
>
> @int_ip gets popluated and I can manipulate it as needed, but how do I
> properly pass it to 'Resolv.new.getname' to set the int_name string?
>
> --
> 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/6bf51a8e-eb7f-4bcd-ac77-2451bcbec5ce%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/CAJsPER2DYP5ma%2B_KUA8FA1rxKZBfm%3DWWyyhZ%2BZV%2B%3DApnU-cjbg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Passing a generated variable inside a template...how?

2015-11-25 Thread Denmat
Sorry, ignore my suggestion. That won't work.

> On 26 Nov 2015, at 06:57, Dayton Jones  wrote:
> 
> I'm writing a template to populate a file - easy enough...
> 
> What I want is to to grab the list of interfaces, get the ip assigned to that 
> interface and then do a lookup of the ip to get the dns name.
> 
> I'm able to get the interfaces/ips just fine, but can't figure out how to 
> then pass the IP to the function to do the lookup.  Any help is greatly 
> appreciated...
> 
> ===
> start ERB
> 
> <% scope.lookupvar('interfaces').split(",").each do |interface| %>
> <% @int_ip = scope.lookupvar('ipaddress_'+interface) %>
> <% @int_name = Resolv.new.getname @int_ip %>
> ...
> <% end %>
> 
> end ERB
> 
> 
> @int_ip gets popluated and I can manipulate it as needed, but how do I 
> properly pass it to 'Resolv.new.getname' to set the int_name string?
> -- 
> 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/6bf51a8e-eb7f-4bcd-ac77-2451bcbec5ce%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/51F5321E-2ED9-40C0-AB2B-1B26DC639C1B%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Passing a generated variable inside a template...how?

2015-11-25 Thread Denmat
> <%= @int_name = Resolv.new.getname @int_ip %>
??

Maybe this would work better as a custom fact though?

HTH
Den

> On 26 Nov 2015, at 06:57, Dayton Jones  wrote:
> 
> I'm writing a template to populate a file - easy enough...
> 
> What I want is to to grab the list of interfaces, get the ip assigned to that 
> interface and then do a lookup of the ip to get the dns name.
> 
> I'm able to get the interfaces/ips just fine, but can't figure out how to 
> then pass the IP to the function to do the lookup.  Any help is greatly 
> appreciated...
> 
> ===
> start ERB
> 
> <% scope.lookupvar('interfaces').split(",").each do |interface| %>
> <% @int_ip = scope.lookupvar('ipaddress_'+interface) %>
> <% @int_name = Resolv.new.getname @int_ip %>
> ...
> <% end %>
> 
> end ERB
> 
> 
> @int_ip gets popluated and I can manipulate it as needed, but how do I 
> properly pass it to 'Resolv.new.getname' to set the int_name string?
> -- 
> 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/6bf51a8e-eb7f-4bcd-ac77-2451bcbec5ce%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/70A7C917-8436-4688-A6FD-44DC88ED984D%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Passing a generated variable inside a template...how?

2015-11-25 Thread Dayton Jones
I'm writing a template to populate a file - easy enough...

What I want is to to grab the list of interfaces, get the ip assigned to 
that interface and then do a lookup of the ip to get the dns name.

I'm able to get the interfaces/ips just fine, but can't figure out how to 
then pass the IP to the function to do the lookup.  Any help is greatly 
appreciated...

===
start ERB

<% scope.lookupvar('interfaces').split(",").each do |interface| %>
<% @int_ip = scope.lookupvar('ipaddress_'+interface) %>
<% @int_name = Resolv.new.getname @int_ip %>
...
<% end %>

end ERB


@int_ip gets popluated and I can manipulate it as needed, but how do I 
properly pass it to 'Resolv.new.getname' to set the int_name string?

-- 
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/6bf51a8e-eb7f-4bcd-ac77-2451bcbec5ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Puppetlabs/mysql forge module - user accounts

2015-11-25 Thread Garrett Honeycutt
On 11/25/15 9:03 AM, Matt Shields wrote:
> I'm using the Puppetlabs/mysql forge module and I have it creating a db
> and adding a few users.  Is there a way to automatically remove any
> accounts that are not defined in my puppet script?  For example, if an
> admin manually created a user?
> 
> -matt
> 

Hi Matt,

You should be able to specify purging using the resources resource. This
will purge any mysql_user that is not explicitly defined through Puppet.

resources { 'mysql_user':
  purge => true,
}

Best regards,
-g

-- 
Garrett Honeycutt
@learnpuppet
Puppet Training with LearnPuppet.com
Mobile: +1.206.414.8658

-- 
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/5655F53D.5040401%40garretthoneycutt.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] random hex string in erb template

2015-11-25 Thread tobias . koeck
Works great. Thanks.

Am Mittwoch, 25. November 2015 16:39:02 UTC+1 schrieb Peter Kristolaitis:
>
> Just realized my code is slightly wrong for you since you wanted hex 
> values rather than alphanumeric string.
>
> The first line should be:
>
> <% range = [*'0'..'9',*'a'..'f'] -%>
>
>
>
> On 11/25/2015 10:36 AM, Peter Kristolaitis wrote:
>
> <% range = [*'0'..'9',*'A'..'Z',*'a'..'z'] -%>
> <%= Array.new(7){range.sample}.join + "-" + 
> Array.new(3){range.sample}.join %>
>
> The "<% range ... -%>" can be anywhere in your template as long as it's 
> before where you generate the random value.  I usually put stuff like that 
> near the top of the template.  If you're generating multiple random values 
> you only need to specify it once.
>
>
> On 11/25/2015 09:48 AM, tobias...@gmail.com  
> wrote:
>
> I want to create a random hex string in the format
>
> 041f798-a5f
>
> inclusive the dash in a XML file.
>
> I have tried using a self written shell script which generates the string 
> with
>
> <%= exec('/var/somedir/somescript') %>
>
> in the template. That unfortunately didn't work.
>
> I suspect I have to write a small embedded ruby template / code snipplet 
> to generate this structure but after some web search I still have no idea 
> how to do that in Embedded Ruby. Does somebody have a short erb suggestion?
>
>
>
>
> -- 
> 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/17c87311-bf8c-4aba-98ed-af30f62e3aca%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...@googlegroups.com .
> To view this discussion on the web visit 
> 
> https://groups.google.com/d/msgid/puppet-users/5655D56A.3040803%40alter3d.ca
> .
> 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/4f4184dd-756f-476d-b03e-041d1a282e12%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] random hex string in erb template

2015-11-25 Thread Peter Kristolaitis
Just realized my code is slightly wrong for you since you wanted hex 
values rather than alphanumeric string.


The first line should be:

<% range = [*'0'..'9',*'a'..'f'] -%>



On 11/25/2015 10:36 AM, Peter Kristolaitis wrote:

<% range = [*'0'..'9',*'A'..'Z',*'a'..'z'] -%>
<%= Array.new(7){range.sample}.join + "-" + 
Array.new(3){range.sample}.join %>


The "<% range ... -%>" can be anywhere in your template as long as 
it's before where you generate the random value.  I usually put stuff 
like that near the top of the template.  If you're generating multiple 
random values you only need to specify it once.



On 11/25/2015 09:48 AM, tobias.ko...@gmail.com wrote:

I want to create a random hex string in the format

|
041f798-a5f
|
/
/inclusive the dash in a XML file.

I have tried using a self written shell script which generates the 
string with


|
<%=exec('/var/somedir/somescript')%>
|

in the template. That unfortunately didn't work.

I suspect I have to write a small embedded ruby template / code 
snipplet to generate this structure but after some web search I still 
have no idea how to do that in Embedded Ruby. Does somebody have a 
short erb suggestion?





--
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/17c87311-bf8c-4aba-98ed-af30f62e3aca%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/5655D56A.3040803%40alter3d.ca 
.

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/5655D60C.9090403%40alter3d.ca.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] random hex string in erb template

2015-11-25 Thread Peter Kristolaitis

<% range = [*'0'..'9',*'A'..'Z',*'a'..'z'] -%>
<%= Array.new(7){range.sample}.join + "-" + 
Array.new(3){range.sample}.join %>


The "<% range ... -%>" can be anywhere in your template as long as it's 
before where you generate the random value.  I usually put stuff like 
that near the top of the template.  If you're generating multiple random 
values you only need to specify it once.



On 11/25/2015 09:48 AM, tobias.ko...@gmail.com wrote:

I want to create a random hex string in the format

|
041f798-a5f
|
/
/inclusive the dash in a XML file.

I have tried using a self written shell script which generates the 
string with


|
<%=exec('/var/somedir/somescript')%>
|

in the template. That unfortunately didn't work.

I suspect I have to write a small embedded ruby template / code 
snipplet to generate this structure but after some web search I still 
have no idea how to do that in Embedded Ruby. Does somebody have a 
short erb suggestion?





--
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/17c87311-bf8c-4aba-98ed-af30f62e3aca%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/5655D56A.3040803%40alter3d.ca.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: puppet calling systemctl instead of /etc/init.d/xxx even when told to use debian provider

2015-11-25 Thread Aqueos Aqueos
in 
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/service/debian.rb 
the lines:

if ((os == 'debian' && majversion >= 8) || (os == 'ubuntu' && 
majversion >= 15))
  # SysVInit scripts will always return '0' for status when the service 
is masked,
  # even if the service is actually stopped. Use the SysVInit-Systemd 
compatibility
  # layer to determine the actual status. This is only necessary when 
the SysVInit
  # version of a service is queried. I.e, 'ntp' instead of 
'ntp.service'.
  (@resource[:hasstatus] == :true) && ["systemctl", "is-active", 
@resource[:name]]
else
  super
end


this force people to install the systemd package where there is not any 
need for it. I don't think puppet should force install of unecessary 
package, if we want systemd we would not overide the default provider to 
debian and let it to systemd therefor those lines are more a pain thn an 
help for me.

best regards,
Ghislain.

-- 
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/c6ae0b59-254f-4561-b799-96df30c4e634%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] random hex string in erb template

2015-11-25 Thread tobias . koeck
I want to create a random hex string in the format

041f798-a5f

inclusive the dash in a XML file.

I have tried using a self written shell script which generates the string 
with

<%= exec('/var/somedir/somescript') %>

in the template. That unfortunately didn't work.

I suspect I have to write a small embedded ruby template / code snipplet to 
generate this structure but after some web search I still have no idea how 
to do that in Embedded Ruby. Does somebody have a short erb suggestion?




-- 
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/17c87311-bf8c-4aba-98ed-af30f62e3aca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Migrating to future parser (on 3.8) in preparation for upgrade to 4.0

2015-11-25 Thread jcbollinger


On Tuesday, November 24, 2015 at 2:03:04 PM UTC-6, Matthew Ceroni wrote:
>
> Working on migrating my manifests to work with Puppet 4.0. Currently on 
> 3.8 and have started to experiment with the future parser (probably not so 
> much future anymore).
>
> I am stuck on an error that is being reported.
>
> Error: Could not retrieve catalog from remote server: Error 400 on SERVER: 
> Evaluation Error: Error while evaluating a Function Call, ensure parameter 
> must be specified at 
> /etc/puppet/environments/sandbox/modules/sudo/manifests/init.pp:51:2 on 
> node op1227
>
> The code is a simple check and fail if not met
>
> if ! ($ensure in [ 'present', 'absent' ]) {
> fail("sudo 'ensure' parameter must be set to either 'absent' or 
> 'present'")
> }
>
> It isn't liking something about the function call fail. 
>
>
In a sense, the whole point of fail() is for Puppet to not like it: its 
purpose is to abort catalog building.  I think you are mistaken, however; 
the error message text is not consistent with the manifest code you 
presented, so I don't think that specific code is directly related to your 
problem.  You may be looking at the wrong line or at the wrong file (maybe 
the wrong version of the file).  Perhaps you are looking at a manifest for 
the wrong environment.

The result you described would be the natural effect of the fail() function 
if the message reported in the log matched the function argument.  The 
message that is emitted is similar enough to the argument in the code you 
presented, and the condition under which the function is called is enough 
reminiscent of it, that I'm leaning toward the theory that you're looking 
at the wrong version of the manifest, with the root problem being that an 
unsupported (or no) value has been given for $ensure.


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/5faae111-0e39-474e-a069-fc56097894a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] puppet calling systemctl instead of /etc/init.d/xxx even when told to use debian provider

2015-11-25 Thread Aqueos Aqueos
hi,

 i am on puppet 4.3 and on debian jessie with sysV init system (  not 
systemd). I have issues because even if i put:

Service{
provider=>  $operatingsystem ? {
Debian  =>  'debian',
}
}


in site.pp puppet still try to call systemctl:

Debug: Executing: 'systemctl is-active postfix'
Debug: Executing: 'systemctl is-active ssh'
Debug: Executing: 'systemctl is-active proftpd'


 i don't know why it insist on using systemd that is not installed and not 
used in any recipe when we told it to use debian style init.

even if i REMOVE 
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/service/systemd.rb 
, IT STILL CALL systemctl.. this drive me mad

 Any ideas ?



regards,
Ghislain.

-- 
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/96589415-ae39-46bc-8a63-d70a528b5a29%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Data Type: Hashes

2015-11-25 Thread jcbollinger


On Tuesday, November 24, 2015 at 6:36:09 PM UTC-6, Matthew Ceroni wrote:
>
> I am having an issue accessing elements of a hash.
>
> First, it is defined in hiera as such:
>
> lb::rules:
>   VCC: rule1
>   GR: rule2
>
> I retrieve the value using
>
> $lb_rules = hiera('lb::rules')
>
> Then I simply try to print out one of the values
> ex:
>
>  notify { "$lb_rules[VCC]": }
>
> But get 
>
> Error 400 on SERVER: Evaluation Error: Missing title. The title expression 
> resulted in undef at 
> /etc/puppet/environments/sandbox/manifests/site.pp:14:11
>
> If I don't specify a key and instead do
>
> notify { "$lb_rules": }
>
> I get 
>
> Error 400 on SERVER: Evaluation Error: Illegal title type at index 0. 
> Expected String, got Hash[String, String]
>
> Confirming that lb_rules is a hash.
>
>

I've found that it's always a good idea to use the ${} form when you 
interpolate a value into a string.  Sometimes you don't actually need it, 
but sometimes you do, and it's just easier to do it all the time.  Thus,

notify { "${lb_rules[VCC]}": }

or, even better,

notify { "${lb_rules['VCC']}": }


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/5497c5f8-bf56-4cf0-92d6-a1f2d94ac536%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Puppetlabs/mysql forge module - user accounts

2015-11-25 Thread Matt Shields
I'm using the Puppetlabs/mysql forge module and I have it creating a db and 
adding a few users.  Is there a way to automatically remove any accounts 
that are not defined in my puppet script?  For example, if an admin 
manually created a user?

-matt

-- 
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/475587a1-8b92-48f4-91a0-35d908548d62%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.