From the course: Learning Puppet (2017)

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Write modules: Write the code

Write modules: Write the code - Puppet Tutorial

From the course: Learning Puppet (2017)

Start my 1-month free trial

Write modules: Write the code

- [Instructor] Now that we have the basic outline, we're ready to start writing a module. First we'll create some directories and files in the control_repo. These should go under site, which is where we set up our custom modules. First we'll create a new file. That's in site/minecraft/manifests, and it will be called init.pp. Remember, manifests/init.pp should always contain a class with the same name as the module itself. So first we'll create a class and a file resource for the opt/minecraft directory, class minecraft, and then file ('/opt/minecraft'), ensure => directory. Now we wanted a way of downloading the Minecraft server jar. Thankfully, that's a built-in feature of the file resource type. So we can just set the source to the URL we used earlier, file ('/opt/minecraft/minecraft_server.jar', ensure => file, source =>, and I'll paste in the URL from before. This will also take care of renaming the file so that we don't have to keep track of the version number. Next, Java needs…

Contents