profile template vs module template

13 views
Skip to first unread message

Asif Iqbal

unread,
Sep 16, 2017, 12:02:47 AM9/16/17
to puppet...@googlegroups.com
I need to use a template from profile module instead of from a component module and not sure how.

This is what I have tried so far

# cat /etc/puppet/modules/profile/manifests/sssd.pp 
class profile::sssd ( 
  $ldap_default_bind_dn = hiera('ldap_default_bind_dn'),
  $ldap_base = hiera('ldap_base'),
  $ldap_uri  = hiera('ldap_uri'),
  $ldap_access_filter = hiera('ldap_access_filter'),
  $ldap_tls_cacert = hiera('ldap_tls_cacert'),
) {
   include ::sssd
    
   file { '/etc/sssd/sssd.conf':
    ensure  => 'file',
    owner   => 'root',
    group   => 'root',
    mode    => '0600',
    content => template('profile/sssd.conf.erb'),
  } 
}

# cat sssd.pp 
include profile::sssd

# puppet apply sssd.pp 
Error: Duplicate declaration: File[/etc/sssd/sssd.conf] is already declared in file /etc/puppet/modules/sssd/manifests/config.pp:26; cannot redeclare at /etc/puppet/modules/profile/manifests/sssd.pp:16 on node localhost
Error: Duplicate declaration: File[/etc/sssd/sssd.conf] is already declared in file /etc/puppet/modules/sssd/manifests/config.pp:26; cannot redeclare at /etc/puppet/modules/profile/manifests/sssd.pp:16 on node localhost

I need to setup the config file sssd.conf based on profile's template file since some of the parameters I introduced are missing from the component module 

My component module is  evenup-sssd

Need help for a recommended way to fix this

Thanks

--
Asif Iqbal
PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

David Schmitt

unread,
Sep 18, 2017, 9:41:31 AM9/18/17
to puppet...@googlegroups.com
According to http://www.puppetmodule.info/modules/evenup-sssd/puppet_classes/sssd there is no way to pass in an override to the content of the file.

You can hack it like this:

include ::sssd
File['/etc/sssd/sssd.conf'] {
    content => template('profile/sssd.conf.erb'),
    source => undef,
}

Cheers, David

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAOHBbgWWyndHej7L%3D2Sr9M0CzfYUpAvUFeXLCHhQJzfUsbtrLg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages