homeblogpuppet and vmware photon os

Puppet and VMware Photon OS

Photon OS is a minimal Linux container host, optimized to run on VMware platforms. It's part of the wider VMware effort around vSphere Integrated Containers (VIC), which aims to make containers a first-class citizen on vSphere. VMware does this by wrapping the containers in Photon OS. When running in vSphere, this exposes information about those containers to the standard vSphere management tools in the same way that VMware tools do for VM operations. With VMworld coming up this week, we thought it would be interesting to demonstrate how Puppet can help with managing Photon OS hosts.

We don’t have a native agent at the moment for Photon OS. But we recently made puppet-agent available on Docker Hub. Photon OS is designed to run containers, so why not run Puppet in one as well? Along with new features available in the 1.6 release of Puppet agent shipped just last week, we can extend our management to Photon OS-based machines.

Running a Photon OS host

Standing up your own Photon OS host for testing couldn't be simpler. The official documentation provides an ISO image, as well as an OVA and images for launching in GCE and EC2. VMware, handily, also makes available a Vagrant box running PhotonOS. Logged into a Photon OS host, we can now try out Puppet.

Using Facter with Photon OS

We’ll start by demonstrating Facter. Facter is a low-level tool used by Puppet to provide context to your Puppet code. Facter provides a simple cross-platform interface (for both humans and machines) to system-level information about the host — for instance, the network configuration, available memory or operating system version.

This should correctly identify Photon as the operating system, along with details of the version number. For instance:

A quick note on all those arguments: Facter is available in the puppet/facter image on Docker Hub. But you’re interested in information about the host, not about the container. So we mount a series of folders from the host, and connect the running container to the host network.

Using Puppet with Photon OS

Lets try another example. We’ll use the puppet-agent image, and we’ll use the puppet resource subcommand to list out all the packages installed on the host

Here’s a sample of the output. As you can see Puppet is correctly picking up packages managed by the tdnf package management tool used by Photon OS.

We’re just using puppet resource as an example here. You can also use puppet agent or apply to make changes to the underlying Photon OS host. For instance, let’s ensure rsync is installed using Puppet.

Assuming rsync wasn’t already installed, this should output something like the following:

The same image can also be used to run a full Puppet agent and connect to your Puppet master. Here we daemonize the container so it will keep running, and the agent will contact the Puppet master at puppet.example.com. The image is simply exposing Puppet as the entry point for the container, so any standard Puppet command line parameters and arguments will work.

We run the Puppet agent in the foreground (with the --no-daemonize flag), as the Docker container itself deals with the daemonizing the process due to the -D flag on docker run.

Hopefully, the above is enough to get you started adding Photon OS hosts to your existing Puppet-managed infrastructure. If you’re interested in other examples, or what else you can do with Puppet and Photon OS (or other VMware products like vRealize Automation or vSphere), then do visit the Puppet booth at VMworld, or let us know in the comments for this post.

Gareth Rushgrove is a senior engineer at Puppet.

Learn more