Slide 1

Slide 1 text

The value of personal configuration management

Slide 2

Slide 2 text

2

Slide 3

Slide 3 text

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,...)

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

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} ;

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

THANK YOU!