[Puppet Users] Re: Custom Facts using awk

2017-03-22 Thread Michael Watters
You can do everything you need entirely in ruby. For example, here's a custom fact that returns the number of screens reported by the X server. Facter.add(:screen_count) do confine :kernel => 'Linux' setcode do @screens = Facter::Core::Execution.exec("/usr/bin/xrandr -display :0

Re: [Puppet Users] Custom Facts using awk

2017-03-22 Thread warron.french
Thanks Rob. I will try both approaches; for me there is more appeal in simply using a shell script. Peter, can I generate multiple key=value pairs inside the same shell script? I don't explicitly have to do it the way you presented with key="key_name" value="evaluated_expression" echo "${key}=

Re: [Puppet Users] Custom Facts using awk

2017-03-22 Thread warron.french
Oh wow! That cool! Thanks for the different method Peter! -- Warron French On Wed, Mar 22, 2017 at 7:07 PM, Peter Bukowinski wrote: > Hi Warron, > > I'd consider using an external, executable fact to avoid ruby altogether. > > https://docs.puppet.com/facter/3.6/cust

Re: [Puppet Users] Custom Facts using awk

2017-03-22 Thread Rob Nelson
That's probably one of the best ways to do this. But... You CAN use double quotes around a string. You will need to escape characters that will otherwise be interpolated like double quotes and dollar signs. I'm going off memory but I think `"awk '{print \$1_\$2}'"` should interpolate to `awk '{pri

Re: [Puppet Users] Custom Facts using awk

2017-03-22 Thread Peter Bukowinski
Hi Warron, I'd consider using an external, executable fact to avoid ruby altogether. https://docs.puppet.com/facter/3.6/custom_facts.html#executable-facts-unix Basically, you can write a bash script (or use any language you want), drop it into '//facts.d/' on your puppet server, and it wil

[Puppet Users] Custom Facts using awk

2017-03-22 Thread warron.french
Hello, I have finally learned how to write a Custom Fact; and duplicated the syntax several times over inside the same .rb file. I am using syntax that looks like the following: Facter.add('qty_monitors_total') do setcode do Facter::Util::Resolution.exec('/bin/grep " connected

[Puppet Users] how to pxe boot and preseed puppet-agent install in ubuntu from puppetlabs repo

2017-03-22 Thread Peter K
In my googling I did not find a simple recipe for how to install and run puppet for the first time (for a pxe / tftpboot / ubuntu / preseed / puppetlabs-repo scenario). Here's what I tagged onto the bottom on my preseed.cfg script: d-i preseed/late_command string in-target wget -O /home//puppe

[Puppet Users] First Time Installing Puppet

2017-03-22 Thread Net Warrior
Hi there guys Need some help, this is my first time installing puppet , this is my conf: Installed the repo https://docs.puppet.com/puppet/3.8/install_el.html rpm -ivh https://yum.puppetlabs.com/puppetlabs-release-el-7.noarch.rpm RHEL 7 x64 3.10.0-327.13.1.el7.x86_64 #1 SMP Mon Feb 29 13:22:02 ES