Thank you for the information. Now I have got a solution.

class facts::app_fact(
  $app = hiera('app_fact',undef)
){
  file{'/etc/facter':
    ensure => directory,
    owner  => 'root',
    group  => 'root',
    mode   => '0755',
  }
  file{'/etc/facter/facts.d':
    ensure  => directory,
    owner   => 'root',
    group   => 'root',
    mode    => '0755',
    require => File['/etc/facter'],
  }
  if $app != undef {
    file{'/etc/facter/facts.d/app.txt':
      ensure  => file,
      owner   => 'root',
      group   => 'root',
      mode    => '0644',
      content => template('facts/app.erb'),
    }
  }
  else {
    file{'/etc/facter/facts.d/app.txt':
      ensure => absent,
    }
  }
}

cat app.erb 
app=<%= @app %>


-- 
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/0a79c776-7d9f-4a51-ad34-5bdb0cf9dfb7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to