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
Tweet

More Decks by Marco Marongiu

Other Decks in Technology

Transcript

  1. The value of personal configuration
    management

    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
    #!/bin/bash
    PATH="/sbin:/usr/sbin:/usr/bin:/bin"
    for ESSID in $( iwgetid --raw )
    do
    CESSID=$( echo $ESSID | tr -c "a-zA-Z0-9_"
    "_" | sed -e 's/_*$//' )
    CLASS="essid_${CESSID}"
    echo "+${CLASS}"
    done
    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
    =external_ip=87.19.216.129
    =external_fqdn=host129-216-dynamic.19-87-r.retail
    .telecomitalia.it
    +external_ip_87_19_216_129
    +domain_telecomitalia_it

    View Slide

  7. THANK YOU!

    View Slide