From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/vagrant/provisioning%2Fpuppet_apply.html | 78 ++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 devdocs/vagrant/provisioning%2Fpuppet_apply.html (limited to 'devdocs/vagrant/provisioning%2Fpuppet_apply.html') diff --git a/devdocs/vagrant/provisioning%2Fpuppet_apply.html b/devdocs/vagrant/provisioning%2Fpuppet_apply.html new file mode 100644 index 00000000..1640e113 --- /dev/null +++ b/devdocs/vagrant/provisioning%2Fpuppet_apply.html @@ -0,0 +1,78 @@ +

Puppet Apply Provisioner

Provisioner name: puppet

The Vagrant Puppet provisioner allows you to provision the guest using Puppet, specifically by calling puppet apply, without a Puppet Master.

Warning: If you are not familiar with Puppet and Vagrant already, I recommend starting with the shell provisioner. However, if you are comfortable with Vagrant already, Vagrant is the best way to learn Puppet.

+

Options

This section lists the complete set of available options for the Puppet provisioner. More detailed examples of how to use the provisioner are available below this section.

Bare Minimum

The quickest way to get started with the Puppet provisioner is to just enable it:

Vagrant.configure("2") do |config|
+  config.vm.provision "puppet"
+end
+
+

By default, Vagrant will configure Puppet to look for manifests in the "manifests" folder relative to the project root, and will use the "default.pp" manifest as an entry-point. This means, if your directory tree looks like the one below, you can get started with Puppet with just that one line in your Vagrantfile.

$ tree
+.
+|-- Vagrantfile
+|-- manifests
+|   |-- default.pp
+
+

Custom Manifest Settings

Of course, you are able to put and name your manifests whatever you would like. You can override both the directory where Puppet looks for manifests with manifests_path, and the manifest file used as the entry-point with manifest_file:

Vagrant.configure("2") do |config|
+  config.vm.provision "puppet" do |puppet|
+    puppet.manifests_path = "my_manifests"
+    puppet.manifest_file = "default.pp"
+  end
+end
+
+

The path can be relative or absolute. If it is relative, it is relative to the project root.

You can also specify a manifests path that is on the remote machine already, perhaps put in place by a shell provisioner. In this case, Vagrant will not attempt to upload the manifests directory. To specify a remote manifests path, use the following syntax:

Vagrant.configure("2") do |config|
+  config.vm.provision "puppet" do |puppet|
+    puppet.manifests_path = ["vm", "/path/to/manifests"]
+    puppet.manifest_file = "default.pp"
+  end
+end
+
+

It is a somewhat odd syntax, but the tuple (two-element array) says that the path is located in the "vm" at "/path/to/manifests".

Environments

If you are using Puppet 4 or higher, you can provision using Puppet Environments by specifying the name of the environment and the path on the local disk to the environment files:

Vagrant.configure("2") do |config|
+  config.vm.provision "puppet" do |puppet|
+    puppet.environment_path = "../puppet/environments"
+    puppet.environment = "testenv"
+  end
+end
+
+

The default manifest is the environment's manifests directory. If the environment has an environment.conf the manifest path is parsed from there. Relative paths are assumed to be relative to the directory of the environment. If the manifest setting in environment.conf use the Puppet variables $codedir or $environment they are resolved to the parent directory of environment_path and environment respectively.

Modules

Vagrant also supports provisioning with Puppet modules. This is done by specifying a path to a modules folder where modules are located. The manifest file is still used as an entry-point.

Vagrant.configure("2") do |config|
+  config.vm.provision "puppet" do |puppet|
+    puppet.module_path = "modules"
+  end
+end
+
+

Just like the manifests path, the modules path is relative to the project root if a relative path is given.

Custom Facts

Custom facts to be exposed by Facter can be specified as well:

Vagrant.configure("2") do |config|
+  config.vm.provision "puppet" do |puppet|
+    puppet.facter = {
+      "vagrant" => "1"
+    }
+  end
+end
+
+

Now, the $vagrant variable in your Puppet manifests will equal "1".

Configuring Hiera

Hiera configuration is also supported. hiera_config_path specifies the path to the Hiera configuration file stored on the host. If the :datadir setting in the Hiera configuration file is a relative path, working_directory should be used to specify the directory in the guest that path is relative to.

Vagrant.configure("2") do |config|
+  config.vm.provision "puppet" do |puppet|
+    puppet.hiera_config_path = "hiera.yaml"
+    puppet.working_directory = "/tmp/vagrant-puppet"
+  end
+end
+
+

hiera_config_path can be relative or absolute. If it is relative, it is relative to the project root. working_directory is an absolute path within the guest.

Additional Options

Puppet supports a lot of command-line flags. Basically any setting can be overridden on the command line. To give you the most power and flexibility possible with Puppet, Vagrant allows you to specify custom command line flags to use:

Vagrant.configure("2") do |config|
+  config.vm.provision "puppet" do |puppet|
+    puppet.options = "--verbose --debug"
+  end
+end
+
+

+ © 2010–2018 Mitchell Hashimoto
Licensed under the MPL 2.0 License.
+ https://www.vagrantup.com/docs/provisioning/puppet_apply.html +

+
-- cgit v1.2.3