[Puppet Users] Avoiding duplicate declaration in a loop?

2017-07-06 Thread buoyant_puppy
Excuse my newbieness, but I'm having a basic misunderstanding regarding loops. Say I have: joesfriends = jack, sam, sally I need to add each entry into a file - one per line. $joesfriends.each | String $joesfriends| {# loop file { "/etc/list_of_joes_friends": line => "${joesfrie

[Puppet Users] Duplicate declaration error - what's the correct approach to avoid this?

2017-11-23 Thread buoyant_puppy
Why does this: class mymodule { notify { "booboo": } notify { "booboo": } provoke the error: Error while evaluating a Resource Statement, Duplicate declaration: Notify[booboo] is already declared in file That's is a simplified version of my actual use case: $mythings.each |

[Puppet Users] Re: Duplicate declaration error - what's the correct approach to avoid this?

2017-11-24 Thread buoyant_puppy
On Thursday, November 23, 2017 at 5:20:54 PM UTC+1, Peter Faller wrote: > > > The error occurs because you have two resources of the same type (notify) > with the same name ('booboo'). Remember that 'notify' is not like a ' > log.info' - it is a resource in it's own right, and each 'notify' has

[Puppet Users] loadjson reads from the master

2017-12-01 Thread buoyant_puppy
I'm trying to pull data from my cmdb into a variable, by downloading my relevant data to a local json file and reading it in: class get_cmdb { file { "/tmp/${::hostname}.json": source => "http://mycmdb.example.com/${::hostname}"; } $mydata = loadjson("/tmp/${::hostname}.json") The is

Re: [Puppet Users] loadjson reads from the master

2017-12-05 Thread buoyant_puppy
On Friday, December 1, 2017 at 5:59:51 PM UTC+1, R.I. Pienaar wrote: > > > All functions like foo() run on the master during compile. It's a multi > phase process, the only way a node can influence the compile time is > using facts. > > You could integrate your CMDB with puppet using a hiera

Re: [Puppet Users] loadjson reads from the master

2017-12-05 Thread buoyant_puppy
an be used > during catalog compilation. That seems like the perfect fit for your use > case, except ENCs need to return yaml, not json. > > Thanks, I'll investigate that option. > > > Rob Nelson > rnel...@gmail.com > > On Tue, Dec 5, 2017 at 5:13 AM, buoyant_

[Puppet Users] Conditional actions based on result of other actions?

2017-12-20 Thread buoyant_puppy
How can I get the result of an action and use it conditionally in my code? As a very simple example: package { "wget" : ensure => 'present' } # if that failed, do X To put this in context, some actual use cases I have: - attempt to register an agent to a remote service and if that fails, open a

[Puppet Users] Re: Conditional actions based on result of other actions?

2018-01-03 Thread buoyant_puppy
On Thursday, December 28, 2017 at 2:10:22 AM UTC+1, John Gelnaw wrote: > > > ... which *should* require the resource 'pkg::wget' to be compiled first, > and then test for the package to be defined. > Thanks, that may work in some cases. I'm still trying to find a more general approach, though.

[Puppet Users] 'require' option is ignored?

2018-02-14 Thread buoyant_puppy
This is an example I found online that would do what I want: check if a dir exists and if so, do something: class foo { exec { "is foo present": command => "/bin/true", onlyif => "/usr/bin/test -d /foo" } file { "create a file if dir foo is present": path => "/path/otherfoo",

[Puppet Users] Re: 'require' option is ignored?

2018-02-15 Thread buoyant_puppy
I think I got this. My main issue was the 'true' logic with an 'onlyif', because that's always only going to either run (= and therefore meet the requirement) or not run at all (= which also meets the requirement since it's not a failure). I feel the choice of words here leaves room for confusi

[Puppet Users] Re: 'require' option is ignored?

2018-02-15 Thread buoyant_puppy
Got it, thanks everyone. Just one small point to add - I'm not actually directly concerned with Execs here. If you look at my original example, I was needing to do a conditional check like "if directory exists then...", and my Exec-based solution for it is just an ugly workaround. I understand

[Puppet Users] Setting puppet up to use a dns alias as a servername

2018-05-02 Thread buoyant_puppy
Can I configure puppet to use a DNS name that would work on two different hosts? For example, I have host1 and host2.example.com. I'd like agents to connect to "puppet.example.com" which will point to one of these. I wamt to be sure agents can connect to either without certificate errors. How

[Puppet Users] Re: Setting puppet up to use a dns alias as a servername

2018-05-03 Thread buoyant_puppy
On Wednesday, May 2, 2018 at 2:59:33 PM UTC+2, jcbollinger wrote: > > > > On Wednesday, May 2, 2018 at 6:25:37 AM UTC-5, Gavin Williams wrote: >> >> 'dns_alt_names' is the config you're looking for... >> >> >> https://puppet.com/docs/puppetserver/5.1/scaling_puppet_server.html#creating-and-confi

[Puppet Users] Re: Setting puppet up to use a dns alias as a servername

2018-05-07 Thread buoyant_puppy
On Friday, May 4, 2018 at 3:13:41 PM UTC+2, jcbollinger wrote: > > > > On Thursday, May 3, 2018 at 9:54:11 AM UTC-5, buoyant_puppy wrote: >> >> >> >> On Wednesday, May 2, 2018 at 2:59:33 PM UTC+2, jcbollinger wrote: >>> >>> >>> &g