Skip to content

Instantly share code, notes, and snippets.

@neilhwatson
neilhwatson / equalto.cf
Created September 19, 2014 12:49
CFEngine comparing two numbers using strcmp
neil@ettin ~/.cfagent/inputs $ cat equalto.cf
body common control
{
bundlesequence => {
"main",
};
}
bundle agent main
{
@neilhwatson
neilhwatson / gist:db17a2628af15629c71a
Created October 3, 2014 17:37
Alternative package promising with CFEngine
body common control
{
bundlesequence => { "main", };
}
bundle agent main
{
vars:
'packages' string => "
any ;; nano ;; install
@neilhwatson
neilhwatson / gist:3e26a0907c1582aff7bf
Created October 6, 2014 19:34
virsh capabilities
<capabilities>
<host>
<uuid>scrubbed</uuid>
<cpu>
<arch>x86_64</arch>
<model>SandyBridge</model>
<vendor>Intel</vendor>
<topology sockets='1' cores='4' threads='2'/>
<feature name='invtsc'/>
@neilhwatson
neilhwatson / cf-verbose
Created October 31, 2014 18:20
script to clean up cfengine 3.6.x verbose output
This file has been truncated, but you can view the full file.
#!/usr/bin/perl
use strict;
use warnings;
use feature qw/say/;
use Pod::Usage;
use Data::Dumper; # TODO safe to remove after testing.
my $VERSION = 0.01;
body common control
{
bundlesequence => {
"main",
};
}
bundle agent main
{
vars:
@neilhwatson
neilhwatson / gist:20dcb107ee27929273c3
Created December 11, 2014 18:57
Testing EFL with serverspec
vm.swappiness = 67
cd test/masterfiles; cf-agent -Kf ./promises.cf -D 019_efl_test
cd test/serverspec; rspec spec/localhost/019_efl_test_spec.rb
.
Finished in 0.04985 seconds
1 example, 0 failures
/sbin/sysctl vm.swappiness='60'
vm.swappiness = 60
body file_select dirs_by_name( name )
{
# Notice that names is a list, do not pass a string!
leaf_name => { @{names} };
file_types => { "dir" };
file_result => "leaf_name.file_types";
}
2015-01-05T10:42:29-0500 critical: /default/efl_server_json/access/'/opt/delta_reporting/bin/dhlogmaker'[0]: StrList_Append: Success
@neilhwatson
neilhwatson / gist:539cb218a337c96e8938
Created January 14, 2015 15:30
bug in data_readstringarrayindx
The order is mixed up
body common control
{
bundlesequence => { "efl_c", "init", "array", "data" };
}
bundle common efl_c
{
vars:
## Installation
1. Copy the contents of masterfiles into your masterfiles or equivilant repository.
1. Include all EFL .cf files in your inputs list in the common control body. Example:
```
bundle common efl_lib
{
vars:
cfengine_3_6::