summaryrefslogtreecommitdiff
path: root/devdocs/vagrant/provisioning%2Fcfengine.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/vagrant/provisioning%2Fcfengine.html
new repository
Diffstat (limited to 'devdocs/vagrant/provisioning%2Fcfengine.html')
-rw-r--r--devdocs/vagrant/provisioning%2Fcfengine.html43
1 files changed, 43 insertions, 0 deletions
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 @@
+<h1 id="cfengine-provisioner"> CFEngine Provisioner </h1> <p><strong>Provisioner name: <code>cfengine</code></strong></p> <p>The Vagrant CFEngine provisioner allows you to provision the guest using <a href="https://cfengine.com/">CFEngine</a>. It can set up both CFEngine policy servers and clients. You can configure both the policy server and the clients in a single <a href="../multi-machine/index">multi-machine <code>Vagrantfile</code></a>.</p> <blockquote class="alert alert-warning"> <p><strong>Warning:</strong> If you are not familiar with CFEngine and Vagrant already, I recommend starting with the <a href="shell">shell provisioner</a>. However, if you are comfortable with Vagrant already, Vagrant is the best way to learn CFEngine.</p> </blockquote>
+<p>Let us look at some common examples first. See the bottom of this document for a comprehensive list of options.</p> <h2 id="setting-up-a-cfengine-server-and-client"> Setting up a CFEngine server and client </h2> <p>The CFEngine provisioner automatically installs the latest <a href="https://cfengine.com/cfengine-linux-distros">CFEngine Community packages</a> on the VM, then configures and starts CFEngine according to your specification.</p> <p>Configuring a VM as a CFEngine policy server is easy:</p> <div class="highlight"><pre class="highlight ruby" data-language="ruby">Vagrant.configure("2") do |config|
+ config.vm.provision "cfengine" do |cf|
+ cf.am_policy_hub = true
+ end
+end
+</pre></div>
+<p>The host will automatically be <a href="https://cfengine.com/docs/3.5/manuals-architecture-networking.html#bootstrapping">bootstrapped</a> to itself to become a policy server.</p> <p>If you already have a working CFEngine policy server, you can get a CFEngine client installed and bootstrapped by specifying its IP address:</p> <div class="highlight"><pre class="highlight ruby" data-language="ruby">Vagrant.configure("2") do |config|
+ config.vm.provision "cfengine" do |cf|
+ cf.policy_server_address = "10.0.2.15"
+ end
+end
+</pre></div>
+<h2 id="copying-files-to-the-vm"> Copying files to the VM </h2> <p>If you have some policy or other files that you want to install by default on a VM, you can use the <code>files_path</code> attribute:</p> <div class="highlight"><pre class="highlight ruby" data-language="ruby">Vagrant.configure("2") do |config|
+ config.vm.provision "cfengine" do |cf|
+ cf.am_policy_hub = true
+ cf.files_path = "cfengine_files"
+ end
+ end
+</pre></div>
+<p>Everything under <code>cfengine_files/</code> in the Vagrant project directory will be recursively copied under <code>/var/cfengine/</code> in the VM, on top of its default contents.</p> <p>A common use case is to add your own files to <code>/var/cfengine/masterfiles/</code> in the policy server. Assuming your extra files are stored under <code>cfengine_files/masterfiles/</code>, the line shown above will add them to the VM after CFEngine is installed, but before it is bootstrapped.</p> <h2 id="modes-of-operation"> Modes of operation </h2> <p>The default mode of operation is <code>:bootstrap</code>, which results in CFEngine being bootstrapped according to the information provided in the <code>Vagrantfile</code>. You can also set <code>mode</code> to <code>:single_run</code>, which will run <code>cf-agent</code> once on the host to execute the file specified in the <code>run_file</code> parameter, but will not bootstrap it, so it will not be executed periodically.</p> <p>The recommended mode of operation is <code>:bootstrap</code>, as you get the full benefits of CFEngine when you have it running periodically.</p> <h2 id="running-a-standalone-file"> Running a standalone file </h2> <p>If you want to run a standalone file, you can specify the <code>run_file</code> parameter. The file will be copied to the VM and executed on its own using <code>cf-agent</code>. Note that the file needs to be a standalone policy, including its own <a href="https://cfengine.com/docs/3.5/reference-components.html#common-control"><code>body common control</code></a>.</p> <p>The <code>run_file</code> parameter is mandatory if <code>mode</code> is set to <code>:single_run</code>, but can also be specified when <code>mode</code> is set to <code>:bootstrap</code> - in this case the file will be executed after the host has been bootstrapped.</p> <h2 id="full-alphabetical-list-of-configuration-options"> Full Alphabetical List of Configuration Options </h2> <ul> <li>
+<a href="#am_policy_hub"><code>am_policy_hub</code></a> (boolean, default <code>false</code>) determines whether the VM will be configured as a CFEngine policy hub (automatically bootstrapped to its own IP address). You can combine it with <code>policy_server_address</code> if the VM has multiple network interfaces and you want to bootstrap to a specific one. </li> <li>
+<a href="#extra_agent_args"><code>extra_agent_args</code></a> (string, default <code>nil</code>) can be used to pass additional arguments to <code>cf-agent</code> when it is executed. For example, you could use it to pass the <code>-I</code> or <code>-v</code> options to enable additional output from the agent. </li> <li>
+<a href="#classes"><code>classes</code></a> (array, default <code>nil</code>) can be used to define additional classes during <code>cf-agent</code> runs. These classes will be defined using the <code>-D</code> option to <code>cf-agent</code>. </li> <li>
+<a href="#deb_repo_file"><code>deb_repo_file</code></a> (string, default <code>"/etc/apt/sources.list.d/cfengine-community.list"</code>) specifies the file in which the CFEngine repository information will be stored in Debian systems. </li> <li>
+<a href="#deb_repo_line"><code>deb_repo_line</code></a> (string, default <code>"deb https://cfengine.com/pub/apt
+$(lsb_release -cs) main"</code>) specifies the repository to use for <code>.deb</code> packages. </li> <li>
+<a href="#files_path"><code>files_path</code></a> (string, default <code>nil</code>) specifies a directory that will be copied to the VM on top of the default <code>/var/cfengine/</code> (the contents of <code>/var/cfengine/</code> will not be replaced, the files will added to it). </li> <li>
+<a href="#force_bootstrap"><code>force_bootstrap</code></a> (boolean, default <code>false</code>) specifies whether CFEngine will be bootstrapped again even if the host has already been bootstrapped. </li> <li>
+<a href="#install"><code>install</code></a> (boolean or <code>:force</code>, default <code>true</code>) specifies whether CFEngine will be installed on the VM if needed. If you set this parameter to <code>:force</code>, then CFEngine will be reinstalled even if it is already present on the machine. </li> <li>
+<a href="#mode"><code>mode</code></a> (<code>:bootstrap</code> or <code>:single_run</code>, default <code>:bootstrap</code>) specifies whether CFEngine will be bootstrapped so that it executes periodically, or will be run a single time. If <code>mode</code> is set to <code>:single_run</code> you have to set <code>run_file</code>. </li> <li>
+<a href="#policy_server_address"><code>policy_server_address</code></a> (string, no default) specifies the IP address of the policy server to which CFEngine will be bootstrapped. If <code>am_policy_hub</code> is set to <code>true</code>, this parameter defaults to the VM's IP address, but can still be set (for example, if the VM has more than one network interface). </li> <li>
+<a href="#repo_gpg_key_url"><code>repo_gpg_key_url</code></a> (string, default <code>"https://cfengine.com/pub/gpg.key"</code>) contains the URL to obtain the GPG key used to verify the packages obtained from the repository. </li> <li>
+<a href="#run_file"><code>run_file</code></a> (string, default <code>nil</code>) can be used to specify a file inside the Vagrant project directory that will be copied to the VM and executed once using <code>cf-agent</code>. This parameter is mandatory if <code>mode</code> is set to <code>:single_run</code>, but can also be specified when <code>mode</code> is set to <code>:bootstrap</code> - in this case the file will be executed after the host has been bootstrapped. </li> <li>
+<a href="#upload_path"><code>upload_path</code></a> (string, default <code>"/tmp/vagrant-cfengine-file"</code>) specifies the file to which <code>run_file</code> (if specified) will be copied on the VM before being executed. </li> <li>
+<a href="#yum_repo_file"><code>yum_repo_file</code></a> (string, default <code>"/etc/yum.repos.d/cfengine-community.repo"</code>) specifies the file in which the CFEngine repository information will be stored in RedHat systems. </li> <li>
+<a href="#yum_repo_url"><code>yum_repo_url</code></a> (string, default <code>"https://cfengine.com/pub/yum/"</code>) specifies the URL of the repository to use for <code>.rpm</code> packages. </li> <li>
+<a href="#package_name"><code>package_name</code></a> (string, default <code>"cfengine-community"</code>) specifies the name of the package used to install CFEngine. </li> </ul><div class="_attribution">
+ <p class="_attribution-p">
+ &copy; 2010&ndash;2018 Mitchell Hashimoto<br>Licensed under the MPL 2.0 License.<br>
+ <a href="https://www.vagrantup.com/docs/provisioning/cfengine.html" class="_attribution-link">https://www.vagrantup.com/docs/provisioning/cfengine.html</a>
+ </p>
+</div>