Infrastruktur als Code
Wer bin ich? (Und wenn ja, wieviele?)
● Jan (1x)
● inovex / Systems Engineer (1x)
Und wenn sie nicht gestorben sind...
Von Hardware zu Software
Das muss schneller gehn!
Infrastruktur als Code
Rex - Remote Execution
● Community Projekt● Agentenlos (ssh, push)● Einfach zu bedienen● Perl als Konfigurationssprache● Alles beginnt in einem Rexfile● Ein Rexfile enthält Authentifizierung,
Servergruppen, Tasks, ...
Rex - Remote Execution
● Viele Module/Funktionen○ Dateimanipulation○ Pakete○ Services○ Prozesse○ Inventarisierung○ Partitionierung, LVM○ Virtualisierung, Cloud○ ...
use Rex -feature => ["1.0"];
user "root";private_key "keys/root.key";public_key "keys/root.key.pub";
use Rex -feature => ["1.0"];
user "admin";private_key "keys/admin.key";public_key "keys/admin.key.pub";
sudo_password "f00b4r";sudo TRUE;
use Rex -feature => ["1.0"];
user "root";private_key "keys/root.key";public_key "keys/root.key.pub";
group frontends => "fe-[01..10].int.lan", "fe-preview.int.lan";
group backends => "be-[01..10].int.lan";
task "setup", group => ["frontends", "backends"], sub { pkg ["httpd", "perl-Mojolicious"], ensure => "present";
file "/etc/httpd/httpd.conf", content => template("httpd.conf.tpl"), owner => "root", group => "root", mode => 644, on_change => sub { service httpd => "restart"; };
service "httpd", ensure => "started"; };
$ rex setup
task "patch", sub { do_task [ qw/disable_in_lb patch_backends enable_in_lb/ ]; };
task "patch_backends", group => ["backends"], sub { update_package_db; update_system; };
$ rex patch
irc: irc.freenode.net #rexWebsite: http://www.rexops.org/Github: https://github.com/RexOpsTwitter: @RexOps
Danke