Skip to content

Instantly share code, notes, and snippets.

@nickanderson
nickanderson / main.cf
Created February 1, 2023 15:42
A simple example for alexfromgalax
View main.cf
# services/main.cf
bundle agent mpf_main
# User Defined Service Catalogue
{
methods:
# Activate your custom policies here
"my_classification";
"my_stuff";
@nickanderson
nickanderson / example.cf
Created January 26, 2023 19:09
preserve old rxdirs behaviro
View example.cf
bundle agent __main__
{
files:
# If you had:
"/path/to/something./"
depth_search => recurse( "inf" ),
perms => mog( "600", "root", "root");
# And you want to have the old rxdirs behavior:
"/path/to/something./"
@nickanderson
nickanderson / cfengine-chocolatey-windows.org
Created January 20, 2023 20:20
CFEngine with Chocolatey on Windows
View cfengine-chocolatey-windows.org

Note: Windows package management *may* be better handled via integration with Chocolatey and open source package manager for Windows similar to yum or apt-get.

  • Product Name:: 7-Zip 16.04 (x64 edition)
Version
16.04.00.0

Product Name and version (inside the MSI) can be found (or changed) using Orca. http://www.7-zip.org/a/7z1604-x64.msi


@nickanderson
nickanderson / example-namespaces.org
Created January 20, 2023 19:29
Simple example showing CFEngine namespaces
View example-namespaces.org
bundle agent __main__
{
   methods:
    "" usebundle => my_bundle("first");
    "" usebundle => default:my_bundle("second");
    "" usebundle => nickanderson:my_bundle("third");
}
bundle agent my_bundle(input)
{
@nickanderson
nickanderson / README.org
Created November 23, 2022 01:18
Example for michael2 using variables to minimize other promises
View README.org

using variables to minimize other promises

bundle agent __main__
{
    vars:
      "package"
        string => ifelse( "redhat", "httpd",
                          "debian", "apache2"
@nickanderson
nickanderson / README.org
Created November 20, 2022 19:54
How to use cfbs to manage an overlay with modifications to the MPF
View README.org

Create a folder containing your overlay at the root of your cfbs project.

For example:

[root@hub local_deploy]# find . | grep -v git
.
./overlay
./overlay/controls
./overlay/controls/def.cf
View example-org-roam-workflow.org

I’m currently using Org-roam to facilitate most new note creation.

Org-roam has a concept of “daily” files. I consider these are collections of nodes that the target location (especially the filename, at least in my case) based on the date.

I use dailies (org-roam-capture-today) for:

  • Recurring meeting notes
    • Daily stand-ups
    • Customer meetings
@nickanderson
nickanderson / example.org
Created November 8, 2022 14:30
Example illustrating munging YAML data structure into a list of strings
View example.org

Example illustrating munging YAML data structure into a list of strings

bundle agent main
{
  vars:
      "yaml" data => parseyaml ('
  books:
    scifi_schema:
      isbn: "isbn_scifi"
@nickanderson
nickanderson / example.org
Created November 7, 2022 15:00
Work with yaml and output in specific format
View example.org

Use the YAML to generate output matching the following format:

scifi::isbn: 'isbn' with book_name: 'book_name'
travel::isbn: 'isbn' with book_name: 'book_name'

Policy:


@nickanderson
nickanderson / example.org
Created October 27, 2022 16:21
Example expanding interface name in classic cfengine template for Sparky in #cfengine on irc.libera.chat
View example.org
### Managed by CFEngine
$(sys.ipv4) is on $(sys.ip2iface[$(sys.ipv4)])
bundle agent __main__
{