Skip to content

Instantly share code, notes, and snippets.

@nickanderson
nickanderson / README.org
Created November 23, 2022 01:18
Example for michael2 using variables to minimize other promises

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

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

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

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

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
### Managed by CFEngine
$(sys.ipv4) is on $(sys.ip2iface[$(sys.ipv4)])
bundle agent __main__
{
@nickanderson
nickanderson / cfengine-example-strip-suffixes-from-a-list.org
Created October 7, 2022 22:13
A few different ways of stripping suffixes from a list of filenames, asked about in IRC.

Here are a few different ways to take ~”numbered” slist > {'1.txt','2.txt','3.txt'};~ and get a list where =.txt is stripped from each element.

bundle agent __main__
{

  vars:

      "numbered" slist => {'1.txt','2.txt','3.txt'};

Example illustrating methods-inherit

bundle agent __main__
{
  methods:
      "parent";

}
bundle agent parent
@nickanderson
nickanderson / classes-inherit.org
Created October 3, 2022 19:12
How to inherit bundle scoped classes
bundle agent main
{
    methods: "guac";
}
bundle agent guac
{
    classes:
      "tomcat" expression => "guacamole";
@nickanderson
nickanderson / example.org
Last active September 22, 2022 19:23
Example for Michael2
bundle agent __main__
{
  vars:
      # Using in-line yaml
      "my_yaml" data => parseyaml('
mykey: myvalue
domain:
  name: example.com