[Puppet Users] Puppet Bolt 0.8.0 released with sudo support

2017-11-17 Thread Alex Dreyer
Bolt 0.8.0 is released!  This is a feature release of the open-source task
runner, which includes:

- Sudo support: Tasks run over ssh can now connect as one user and
'--run_as' a different user via sudo.
- Winrm transport bug fixes
- Results when running tasks, commands, scripts and uploading files are
printed as each node finishes
- Bolt will output JSON on stdout with the --format json option

see https://puppet.com/docs/bolt/0.x/new_features.html for a full list of
changes.

Alex

-- 
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/CAMahoJuV0t4XJQP7G%3DT%2B6s2-2jUmgXeyEWLsqqTSFneWSUqnZQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Dynamic file content

2017-11-17 Thread Dave F
Hi

I'm pretty new to puppet and am still learning, so apologies for what is 
probably a daft question..

I'm using puppet to deploy tomcat, and as part of this I need to 
dynamically edit an XML file based on data passed to the class from heira.

I'm doing this by 

a) using a file resource to put the xml file in place
b) Using Augeas to search and replace a value within the file

This all works... except that, of course, everytime puppet runs, step a) 
notices that step b) has changed the file, which replaces it, and then step 
b edits it again...

How do I prevent this? I know I could tell step a to not replace an 
existing file, but then we'd fail to pick on unplanned changes.

I could also, I suppose, construct the file every time puppet runs in a 
temp location, and then check the resultant file against the actual xml 
file - but that seems counter-intuitive.

Is there a way to modify the existing file using augeas, and then check the 
result against the live version, while keeping the code fairly 
straightforward and self-contained within puppet?

Thanks
Dave

-- 
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/1c3ca846-584e-4381-9af0-7365c28c19eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Dynamic file content?

2017-11-17 Thread Dave F
Hi, 

I'm fairly new to puppet and am working my way through various approaches 
to problems - probably doing them in all the worst possible ways...

One thing I'm currently trying to do is configure an application using 
heira and puppet. The application comes with a selection of default 
template configuration files which I'm using Augeas in Puppet to configure 
with the valies from heira as required. 

Essentially my class is doing the following:

file{'config.file': 
  source=> "file://src/template.xml",
  path => "$destfolder/template.xml"
} -> 
augeas {"config.file_aug":
lens => "xml.lns",
incl => "$destfolder/template.xml",
changes => [ "setm... "]
}

Now, this is working... but what of course what's happening is that every 
time puppet runs, the first file resource replaces the template.xml with 
the original copy, then the augeas re-edits it to match the file that was 
just replaced. 

I could make sure the file resource doesn't replace the new one with 
'replace -> false', but then if unwanted changes occur, we'd never know. 

How can I combine a the required augeas changes to the xml template file 
before it's checked?  

Should I use puppet to construct the new version in a temporary folder, and 
the do a final file resource to compare the constructed version with the 
live version?

Thanks in advance,
Dave

-- 
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/c6ff68b8-ccb8-4ad7-8df5-52d4cbc06bb2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Puppet 5 ENC parameters and facts missing from PuppetDB 5 facts

2017-11-17 Thread treydock
In case anyone comes across this same problem, the issue was not with the 
fact the ENC parameters matched facts.  The issue was that I had a flat 
file fact in /etc/facter/facts.d/facts.txt that defined the hostgroup, 
which was populated during provisioning by the Foreman hostgroup value.  I 
also had a Ruby fact distributed by Puppet that defined hostgroup but for a 
subset of my systems using a confine to limit use to just masterless 
systems.  When the ruby fact was nil it the facts.txt would be ignored and 
the nil value used.  Based on debug output this appeared to be behavior in 
Facter and not Puppet.

- Trey

On Wednesday, November 8, 2017 at 3:36:26 PM UTC-5, treydock wrote:
>
> I just upgraded my Puppet masters and PuppetDB to latest Puppet 5 
> releases.  All other systems remain Puppet 3.8.6.  I've discovered that the 
> masters and puppetdb running puppet-agent 5.3.3 are no longer sending ENC 
> (Foreman) parameters as facts to PuppetDB [1].  What's really odd is one of 
> the parameters, hostgroup, is also put in /etc/facter/facts.d/facts.txt as 
> a static external fact.  The value is returned by "facter hostgroup".  This 
> value is no longer being sent to PuppetDB and this is only occurring for 
> agents running 5.3.3, my 3.8.6 agents are still sending their hostgroup 
> value as a fact to PuppetDB.  I also have custom ruby facts like 
> hostgroup_parent that are based on the value of hostgroup and these are 
> returned by facter but no longer exist in PuppetDB for puppet 5.x clients.  
> This hostgroup_parent is also returned by my ENC as a parameter.  It's as 
> if any facts that facter resolves and also exist in ENC as parameters are 
> omitted from uploads to PuppetDB.
>
> I ran puppet with debug on a 5.3.3 client and puppet is picking up the 
> external facts and resolving the values, so something else must be removing 
> the values before being sent to PuppetDB.
>
> Is this behavior intentional?  I don't want to rewrite all my hostgroup 
> based puppet code that queries from puppetdb if this is some kind of bug.
>
> Thanks,
> - Trey
>
> [1]:
>
> puppet-agent 5.3.3:
>
> # curl  --cacert /etc/puppetlabs/puppet/ssl/certs/ca.pem  --cert 
> /etc/puppetlabs/puppet/ssl/certs/$(hostname -f).pem  --key 
> /etc/puppetlabs/puppet/ssl/private_keys/$(hostname -f).pem  --tlsv1  -X GET 
> https://puppetdb.DOMAIN:8081/pdb/query/v4/facts  --data-urlencode 
> 'query=["and",["=", "certname", 
> "puppet0. DOMAIN"],["=","name","hostgroup"]]'
>
> []
>
> puppet 3.8.6:
>
> # curl  --cacert /etc/puppetlabs/puppet/ssl/certs/ca.pem  --cert 
> /etc/puppetlabs/puppet/ssl/certs/$(hostname -f).pem  --key 
> /etc/puppetlabs/puppet/ssl/private_keys/$(hostname -f).pem  --tlsv1  -X GET 
> https://puppetdb. DOMAIN:8081/pdb/query/v4/facts  --data-urlencode 
> 'query=["and",["=", "certname", "logs. DOMAIN"],["=","name","hostgroup"]]'
>
>
> [{"certname":"logs.DOMAIN","name":"hostgroup","value":"base/infrastructure","environment":"production"}]
>

-- 
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/730b556c-4b19-4638-aa3d-607eb9d557f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.