LPS:CFEngine3/hands-on
Z HelpDesk
Instalace
echo "deb http://cfengine.com/pub/apt stable main" >> /etc/apt/sources.list echo "deb http://download.zcu.cz/public/software/linux/debian stable main" >> /etc/apt/sources.list
apt-get update apt-get install cfengine-community vim-syntax-cfengine3
Ukázkové bundly
Hello world
body common control { bundlesequence => {"main"}; } bundle agent main { reports: verbose:: "Hello World"; }
cf-agent -Kf ./test1.cf cf-agent -Kf ./test1.cf -D verbose
New file
body common control { bundlesequence => { "main" }; } bundle agent main { vars: any:: "file" string => "/tmp/cftest.txt"; classes: any:: "file_exists" expression => fileexists("$(file)"); files: any:: "/tmp/cftest.txt" create => "true", classes => if_repaired("file_created"); reports: file_exists:: "Soubor existuje"; file_created:: "Soubor byl vytvoren"; }
cf-promises -cf ./test2.cf ./test2.cf:20:0: error: Undefined body if_repaired with type classes
Ukradneme z lib/3.5/common.cf
body classes if_repaired(x) { promise_repaired => { "$(x)" }; }
cf-promises -cf ./test2.cf cf-agent -KInf ./test2.cf
Prvni kontakt
cf-agent --bootstrap cf.civ.zcu.cz
Co jsme získali?
cd /var/cfengine/ ls inputs ls masterfiles