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. 2

  2. 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,...)
  3. 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
  4. 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} ;