Search code examples
ubuntupuppet

Upgrade puppet on Ubuntu to puppet 5


I'm very new to puppet and VMs so I'm struggling to understand the documentation and everything.

I've been given a repo which needs to run on puppet 5, so I set myself out to running it and see what it does.

I started by grabbing a linux VM (Ubuntu 16.04) and doing puppet --version on the terminal which gives me version 3.8.5, thus I need to upgrade this.

Question now is how do I upgrade it? The documentation from PuppetLabs go into detail about upgrading puppet-agents and masters and servers and I'm lost in it all... I think what I want is a standalone self-contained architecture? The agent/master architecture seems like even more work and unnecessary for my case. PuppetLabs documentation (https://puppet.com/docs/puppet/5.0/install_pre.html) focuses more on agent/server setup with pretty much nothing on the standalone architecture. I've tried the steps for Ubuntu 16.04 Xenial Xerus at https://puppet.com/docs/puppet/5.0/puppet_platform.html#ubuntu-1604-xenial-xerus to no avail, the version remains at 3.8.5 even when installing puppet5.

I tried this puppet not upgrading in Ubuntu 12.04 which got me to version 3.8.5, but how do I get to v5?

For a little more context, here's a simple test I want to do, call test::passVar and print to the terminal the value being passed:

init.pp

class test() {
    notice("test")
    test::passVar { "Test passing a variable":
      test_var => 'testVar',
    }
}


passVar.pp

define test::passVar (
    $test_var,
) {
    notice("test notice")
    notice($test_var)
}

To run this, I've done

puppet apply init.pp

The output says it's compiled and finished but I don't see anything printed out from the notice() calls.

So perhaps I need v5 to run this?


Solution

  • If you look at the docs over at https://puppet.com/docs/puppet/5.3/install_linux.html you'll see a section (after setting up the appropriate repositories, which you did above)

    3.Install the puppet-agent package on your Puppet agent nodes using the command appropriate to your system:

    ◦Yum – sudo yum install puppet-agent

    ◦Apt – sudo apt-get install puppet-agent

    ◦Zypper – sudo zypper install puppet-agent

    It appears that you did sudo apt-get install puppet, which still points to the system package in the base Ubuntu repositories, which is version 3.8.5

    The other thing to mention is that puppet is not in your path by default, it is installed under /opt/puppetlabs/bin/puppet, as referenced in step 5 of the above mentioned setup doc If you wish to call it from your terminal, you will need to make sure that location is in your path.

    5.Start the puppet service: sudo /opt/puppetlabs/bin/puppet resource service puppet ensure=running enable=true.