Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The value of personal configuration management

Marco Marongiu
September 20, 2013

The value of personal configuration management

Slides of the five-minute lightning talk held at the OSS4B conference in Prato, Italy, Semptember 19-20th, 2013

Marco Marongiu

September 20, 2013

More Decks by Marco Marongiu

Other Decks in Technology


  1. The value of personal configuration

    View Slide

  2. 2

    View Slide

  3. modules in CFEngine

    modules are programs that the agent can run and that
    will write to STDOUT according to "the module protocol"

    they can be used in commands promises, or with the
    usemodule function in classes promises.
    – Ref.: modules in commands: http://tinyurl.com/oc7h9wj
    – Ref. usemodule function: http://tinyurl.com/nhjzhag

    they can set/cancel classes, and set/unset variables
    and lists

    they can be written in any language (any shell, Perl,
    Python, awk, sed, C,...)

    View Slide

  4. module examples: essid.sh
    for ESSID in $( iwgetid --raw )
    CESSID=$( echo $ESSID | tr -c "a-zA-Z0-9_"
    "_" | sed -e 's/_*$//' )
    echo "+${CLASS}"
    exit 0

    View Slide

  5. module examples: location_via_exip.pl
    my @exip_servers = map { "api-${_}01.exip.org" } qw{sth ams nyc} ;
    my $ua = LWP::UserAgent->new ;
    [... tries to get our external ip from exip ...]
    exit 1 if not defined $ip ;
    my $name = gethostbyaddr(inet_aton($ip),AF_INET) ;
    my ($second_level_domain) = ( $name =~ m{([^\.]+\.[^\.]+)$} ) ;
    my $ip_class = qq{external_ip_$ip} ;
    my $domain_class = qq{domain_$second_level_domain} ;
    $ip_class =~ tr{.}{_} ;
    $domain_class =~ tr{.}{_} ;
    print qq{=external_ip=$ip\n} ;
    print qq{=external_fqdn=$name\n} ;
    print qq{+$ip_class\n} ;
    print qq{+$domain_class\n} ;

    View Slide

  6. module examples: location_via_exip.pl

    View Slide


    View Slide