Missing defines when importing from puppet

Are defines supported to be used in Foreman? I've imported all my
Puppet classes but have not found any documentation or method
describing how to assign a define to a host.

Thanks

  • Trey

> Are defines supported to be used in Foreman? I've imported all my
> Puppet classes but have not found any documentation or method
> describing how to assign a define to a host.

··· On Aug 15, 2011, at 3:50 PM, treydock wrote: ---- Use parameters but beware that they come out as a string.

Craig

I think the complication is similar to a post I saw you posted, is
that I use defines that would require passing hashes as parameters
which isn't easy pre-2.7.x. Does anyone have an example of how to use
the create_resources library from here https://github.com/puppetlabs/puppetlabs-create_resources
? Is that the best approach to passing hashes to a class rather than
using defines? I just having a bit of trouble getting my head wrapped
around how to use create_resources.

Thanks

  • Trey
··· On Aug 16, 10:46 am, Craig White wrote: > On Aug 15, 2011, at 3:50 PM, treydock wrote: > > > Are defines supported to be used in Foreman? I've imported all my > > Puppet classes but have not found any documentation or method > > describing how to assign a define to a host. > > ---- > Use parameters but beware that they come out as a string. > > Craig

After a bit of clarification on how to use create_resources to pass
hashes…I now am wondering how I would use
create_resource("apache::vhost", $vhost) in Foreman. Would I include
that in a class called apache::vhost so it's visible in Foreman?

··· On Aug 17, 12:18 pm, treydock wrote: > I think the complication is similar to a post I saw you posted, is > that I use defines that would require passing hashes as parameters > which isn't easy pre-2.7.x. Does anyone have an example of how to use > the create_resources library from herehttps://github.com/puppetlabs/puppetlabs-create_resources > ? Is that the best approach to passing hashes to a class rather than > using defines? I just having a bit of trouble getting my head wrapped > around how to use create_resources. > > Thanks > - Trey > > On Aug 16, 10:46 am, Craig White wrote: > > > > > > > > > On Aug 15, 2011, at 3:50 PM, treydock wrote: > > > > Are defines supported to be used in Foreman? I've imported all my > > > Puppet classes but have not found any documentation or method > > > describing how to assign a define to a host. > > > ---- > > Use parameters but beware that they come out as a string. > > > Craig

>
>
>> I think the complication is similar to a post I saw you posted, is
>> that I use defines that would require passing hashes as parameters
>> which isn't easy pre-2.7.x. Does anyone have an example of how to use
>> the create_resources library from herehttps://github.com/puppetlabs/puppetlabs-create_resources
>> ? Is that the best approach to passing hashes to a class rather than
>> using defines? I just having a bit of trouble getting my head wrapped
>> around how to use create_resources.
>>
>> Thanks
>> - Trey
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>>> Are defines supported to be used in Foreman? I've imported all my
>>>> Puppet classes but have not found any documentation or method
>>>> describing how to assign a define to a host.
>>
>>> ----
>>> Use parameters but beware that they come out as a string.
>>
>>> Craig
>
>
> After a bit of clarification on how to use create_resources to pass
> hashes…I now am wondering how I would use
> create_resource("apache::vhost", $vhost) in Foreman. Would I include
> that in a class called apache::vhost so it's visible in Foreman?

··· On Aug 17, 2011, at 12:25 PM, treydock wrote: > On Aug 17, 12:18 pm, treydock wrote: >> On Aug 16, 10:46 am, Craig White wrote: >>> On Aug 15, 2011, at 3:50 PM, treydock wrote: ---- Fortunately for me, my boss called me off that because he didn't want virtual hosts to be configured within Foreman but wanted to maintain the virtual hosts the old fashioned way. ;-)

I was getting close I think but I did have to move on - just started deploying yesterday.

The gist of my understanding is this… it probably doesn’t matter if you use defines or create_resources - no matter what, you will have to compress what is essentially YAML into a string to enter in the ENC and then refactor the string back to YAML to use either in defines or create_resources. Start simple… remember that YAML is very sensitive to whitespace. I was of the mind set that I would write my input files out in YAML, write a program to convert that to an acceptable string and write a parser that would convert that string back to YAML before it was applied to ‘defines’.

This definitely could use a working example - I just never got it to work and had to move on.

Craig