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

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

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'] -%> <%=

[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

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

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

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

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 %>')

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

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

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,

[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

[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

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,

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

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

[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

[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

[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

[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

[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

[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