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%2Fcfengine.html | 43 ++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 devdocs/vagrant/provisioning%2Fcfengine.html (limited to 'devdocs/vagrant/provisioning%2Fcfengine.html') diff --git a/devdocs/vagrant/provisioning%2Fcfengine.html b/devdocs/vagrant/provisioning%2Fcfengine.html new file mode 100644 index 00000000..95394d81 --- /dev/null +++ b/devdocs/vagrant/provisioning%2Fcfengine.html @@ -0,0 +1,43 @@ +

CFEngine Provisioner

Provisioner name: cfengine

The Vagrant CFEngine provisioner allows you to provision the guest using CFEngine. It can set up both CFEngine policy servers and clients. You can configure both the policy server and the clients in a single multi-machine Vagrantfile.

Warning: If you are not familiar with CFEngine 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 CFEngine.

+

Let us look at some common examples first. See the bottom of this document for a comprehensive list of options.

Setting up a CFEngine server and client

The CFEngine provisioner automatically installs the latest CFEngine Community packages on the VM, then configures and starts CFEngine according to your specification.

Configuring a VM as a CFEngine policy server is easy:

Vagrant.configure("2") do |config|
+  config.vm.provision "cfengine" do |cf|
+    cf.am_policy_hub = true
+  end
+end
+
+

The host will automatically be bootstrapped to itself to become a policy server.

If you already have a working CFEngine policy server, you can get a CFEngine client installed and bootstrapped by specifying its IP address:

Vagrant.configure("2") do |config|
+  config.vm.provision "cfengine" do |cf|
+    cf.policy_server_address = "10.0.2.15"
+  end
+end
+
+

Copying files to the VM

If you have some policy or other files that you want to install by default on a VM, you can use the files_path attribute:

Vagrant.configure("2") do |config|
+   config.vm.provision "cfengine" do |cf|
+      cf.am_policy_hub = true
+      cf.files_path = "cfengine_files"
+    end
+  end
+
+

Everything under cfengine_files/ in the Vagrant project directory will be recursively copied under /var/cfengine/ in the VM, on top of its default contents.

A common use case is to add your own files to /var/cfengine/masterfiles/ in the policy server. Assuming your extra files are stored under cfengine_files/masterfiles/, the line shown above will add them to the VM after CFEngine is installed, but before it is bootstrapped.

Modes of operation

The default mode of operation is :bootstrap, which results in CFEngine being bootstrapped according to the information provided in the Vagrantfile. You can also set mode to :single_run, which will run cf-agent once on the host to execute the file specified in the run_file parameter, but will not bootstrap it, so it will not be executed periodically.

The recommended mode of operation is :bootstrap, as you get the full benefits of CFEngine when you have it running periodically.

Running a standalone file

If you want to run a standalone file, you can specify the run_file parameter. The file will be copied to the VM and executed on its own using cf-agent. Note that the file needs to be a standalone policy, including its own body common control.

The run_file parameter is mandatory if mode is set to :single_run, but can also be specified when mode is set to :bootstrap - in this case the file will be executed after the host has been bootstrapped.

Full Alphabetical List of Configuration Options

+

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

+
-- cgit v1.2.3