The appropriate attribute in this case should be 'content' instead of
'source' ... so instead of this:
file { '/etc/openldap/ldap.conf':
ensure => file,
source => template('ldap/ldap.conf.erb'),
require => Class["ldap::install"],
}
Use this:
file { '/etc/openldap/ldap.conf':
ensure => file,
content => template('ldap/ldap.conf.erb'),
require => Class["ldap::install"],
}
See:
https://docs.puppet.com/puppet/latest/types/file.html#file-attribute-content
ken.
On Tue, Aug 29, 2017 at 1:00 PM, Michael Burling
<[email protected]> wrote:
> Me, too! How did you fix the above? I'm running into the same error.
>
> On Sunday, March 23, 2014 at 7:35:16 PM UTC-5, Grant wrote:
>>
>> Scrap that. I'm an idiot.
>>
>>
>>
>> On 24 March 2014 10:29, Grant Byers <[email protected]> wrote:
>>>
>>> Hi,
>>>
>>> I'm having some trouble using a template to construct URIs in a target
>>> file. How can I prevent the puppet templating engine from trying to
>>> interpret the URIs?
>>>
>>> For example, I've got the following class ;
>>>
>>> class ldap::config {
>>> $ldap_sizelimit = extlookup("ldap_sizelimit", "500")
>>> $ldap_timelimit = extlookup("ldap_timelimit", "15")
>>> $ldap_deref = extlookup("ldap_deref", "never")
>>> $ldap_uri = extlookup("ldap_uri", "ldap://<host1> ldap://<host2>
>>> ldap://<host3>")
>>> $ldap_basedn = extlookup("<basedn>")
>>> $ldap_referrals = extlookup("ldap_referrals", "off")
>>>
>>> file { '/etc/openldap/ldap.conf':
>>> ensure => file,
>>> source => template('ldap/ldap.conf.erb'),
>>> require => Class["ldap::install"],
>>> }
>>> }
>>>
>>> And my template ;
>>>
>>> #
>>> # LDAP Defaults
>>> #
>>>
>>> # See ldap.conf(5) for details
>>> # This file should be world readable but not world writable.
>>>
>>> SIZELIMIT <%= @ldap_sizelimit %>
>>> TIMELIMIT <%= @ldap_timelimit %>
>>>
>>> REFERRALS <%= @ldap_referrals %>
>>> DEREF <%= @ldap_deref %>
>>>
>>> URI <%= @ldap_uri %>
>>> BASE <%= @ldap_basedn %>
>>>
>>> TLS_CACERTDIR /etc/pki/tls/certs
>>>
>>>
>>> However, this barfs when I attempt to apply ;
>>>
>>> err: Failed to apply catalog: Parameter source failed on
>>> File[/etc/openldap/ldap.conf]: Could not understand source #
>>> # LDAP Defaults
>>> #
>>>
>>> # See ldap.conf(5) for details
>>> # This file should be world readable but not world writable.
>>>
>>> SIZELIMIT 500
>>> TIMELIMIT 15
>>>
>>> REFERRALS off
>>> DEREF never
>>>
>>> URI ldap://<host1> ldap://<host2> ldap://<host3>
>>> BASE <basedn>
>>>
>>> TLS_CACERTDIR /etc/pki/tls/certs
>>> : bad URI(is not URI?):
>>> %23%0A%23%20LDAP%20Defaults%0A%23%0A%0A%23%20See%20ldap.conf(5)%20for%20details%0A%23%20This%20file%20should%20be%20world%20readable%20but%20not%20world%20writable.%0A%0ASIZELIMIT%09500%0ATIMELIMIT%0915%0A%0AREFERRALS%09off%0ADEREF%09%09never%0A%0AURI%09%09ldap://<host1>%20ldap://<host2>%20ldap://<host3>%0ABASE%20%09%09<basedn>%0A%0ATLS_CACERTDIR%09/etc/pki/tls/certs%0A
>>> at /etc/puppet/environments/testing/modules/ldap/manifests/config.pp:16
>>>
>>>
>>> Thanks,
>>> Grant
>>
>>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/7275ae03-e70d-46d1-aaa0-15cb3a73a87c%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/CAE4bNT%3D11n%2Bs5njb58hHm%2B5TpPtNu2t%3DSJM7EWQg9Gfigj%3Dj0g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.