Quantcast
Channel: Ask Puppet: Puppet DevOps Q&A Community - RSS feed
Viewing all articles
Browse latest Browse all 75

How to use external file for template or inline_template function

$
0
0
Hi all, I have a puppet recipe who should download and extract an archive file which contain an ERB file. I would like to use this extracted resource as a base for a new file content resource. Do you think it is possible ? An example of code may be :
class test_erb {

 $destdir="/tmp"

  archive::artifactory { "config.zip":
    archive_path => "$destdir",
    url                   => "$artifactory/config.zip",
    extract           => true,
    extract_path => "$destdir/extracted",
    creates => File["$destdir/config.xml.erb"],
    cleanup      => false,
  }

file { "$destdir/config.xml" :
    ensure  => 'file',
    # content => template("$destdir/config.xml.erb"),
    content => inline_template(file("$destdir/config.xml.erb")),
    require      => File["$destdir/config.xml.erb"],
  }

}
in this case, Puppet (puppet apply) complains about not founding the resource $destdir/config.xml.erb How can I be sure that this file will be present at deployment time an not compile-time? Should I put a dependency between the two resource declarations ? Thanks a lot for your answers!

Viewing all articles
Browse latest Browse all 75

Trending Articles