SlideShare ist ein Scribd-Unternehmen logo
(R)?ex - A framework to simplify system administration
Geschichte
• (R)?ex - Remote Execution
• Entstanden um Deployments
  unterschiedlicher Projekte zu vereinfachen
  und zu vereinheitlichen.
• Deployments auf unterschiedliche
  Umgebungen (Live, Prelive, Testing)
• Einfaches/Automatisiertes Deployment auf
  mehreren Servern.
Mittlerweile
• Framework zur Administration von Linux
  Servern.
• Remote Commands werden über SSH
  ausgeführt.
• Viele Befehle werden transparent
  umgeschrieben.
• Konfigurationsmanagement
Und was ist‘s jetzt?

• Ganz grob, so was ähnliches wie Make
• Es gibt ein Rexfile
• Ein normales Perl Script
Rexfile
user “jan“;
task “uptime“, sub {
    say run “uptime“;
};
Rexfile
user “jan“;
task “uptime“, sub {
    say run “uptime“;
};

$ rex -H “server[01..02]“ uptime
Rexfile
user “jan“;
task “uptime“, sub {
    say run “uptime“;
};

$ rex -H “server[01..02]“ uptime

[2011-06-24 18:27:28] - INFO - Running task: uptime
[2011-06-24 18:27:28] - INFO - Connecting to server01 (jan)
 21:18:19 up 2:18, 1 user, load average: 0.00, 0.01, 0.03
[2011-06-24 18:27:28] - INFO - Connecting to server02 (jan)
 18:27:18 up 1 min, 1 user, load average: 2.12, 0.80, 0.28
Administratives
Paketverwaltung
task “prepare“, sub {
    install package => “apache2“;
    install package => [
                          “apache2“,
                          “vim“,
                          “libapache2-mod-php5“
                       ];
};
Paketverwaltung


task “prepare“, sub {
    remove package => “apache2“;
};
Hardwareinfos
task “memory“, sub {
    my $mem = memory();
    say “Free: “ . $mem->{“free“};
};
Hardwareinfos
task “memory“, sub {
    my $mem = memory();
    say “Free: “ . $mem->{“free“};
};


task “network“, sub {
    my $net_info = network_interfaces();
    for my $dev ( keys %{ $net_info } ) {
         say “$dev hat die ip: “ . $net_info->{$dev}->{“ip“};
    }
};
Prozesse
task “ps“, sub {
    for my $process ( ps() ) {
         say “cmd: “ . $process->{“command“};
         say “pid:“ . $process->{“pid“};
    }

     kill 9931;
};
Filesystem

task “prepare“, sub {
   unless( is_dir(“/srv/httpd/htdocs“) ) {
       mkdir(“/srv/httpd/htdocs“);
       cp(“/mnt/templates/htdocs/*“, “/srv/httpd/htdocs“);
   }
};
Dateien und Aktionen
task “prepare“, sub {
   install file => “/etc/apache2/httpd.conf“, {
          source => “files/apache/httpd.conf“,
          owner => “root“,
          group => “root“,
          mode => 644,
          on_change => service(apache2 => “restart“)
   };
};
Deployments
Apache Deployments
use Rex::Apache::Deploy Symlink;

my $VERSION = “1.0“;

deploy_to “/var/www/deploy“;
document_root “/var/www/html“;

generate_deploy_directory sub {
   return $VERSION;
};

desc “Deploy Application“;
task “deploy“, “server[01..04]“, sub {
   deploy “myapp-$VERSION.tar.gz“;
};
Tomcat Deployments
use Rex::Apache::Deploy Tomcat;

context_path “/myapp“;

desc “Deploy Application“;
task “deploy“, “server[01..04]“, sub {
   deploy “myapp-1.0.war“, {
      username => “manager-user“,
      password => “manager-password“,
      port      => 8080
   };
};
Danke für die Aufmerksamkeit.
      http://rexify.org/

Weitere ähnliche Inhalte

PDF
German Perl Workshop 2015 - Infrastruktur als Code
ODP
Rex - Infrastruktur als Code
ODP
Von Test nach Live mit Rex
PDF
Automation with Ansible
PDF
Foreman: Provisionierungswege (Webinar vom 31. März 2016)
PDF
Einführung in Elasticsearch - August 2014
PDF
Foreman: Klassen und Parametrisierung in Puppet (Webinar vom 20. Mai 2016)
PPTX
Nginx
German Perl Workshop 2015 - Infrastruktur als Code
Rex - Infrastruktur als Code
Von Test nach Live mit Rex
Automation with Ansible
Foreman: Provisionierungswege (Webinar vom 31. März 2016)
Einführung in Elasticsearch - August 2014
Foreman: Klassen und Parametrisierung in Puppet (Webinar vom 20. Mai 2016)
Nginx

Was ist angesagt? (20)

PPT
Einführung in Laravel und GulpJS
PDF
Systemmanagement mit Puppet und Foreman
PPT
Überblick über aktuelle Versionsmanagementsysteme
PDF
Infrastructure as code: Cloud-Umgebungen mit Terraform verwalten
PDF
TechTalkThursday 26.11.2015: Manage the minions - Docker Container mit Kubern...
PDF
Ceph Introduction @GPN15
PDF
Unser Weg zum Frankenstack
PDF
TechTalkThursday: Zentrales Metriken-System - ist der Flügelschlag des Schmet...
PPTX
check_sap_health
PDF
Der oracle dba_und_seine_passwoerter
PDF
Ldap sqlnet
PDF
Introduction into Oracle Data Pump 11g/12c - Export and Import Data
KEY
Varnish PHP Unconference Hamburg 2012
PDF
Nagios Conference 2007 | Vmware Monitoring by Ingo Latschner
PDF
Von Test nach live mit Rex
PDF
OSMC 2010 | Monitoring mit Shinken by Gerhard Laußer
PDF
Einfuehrung in die Erstellung von Software-Paketen mit dem RPM Package Manager
PPT
PDF
OSMC 2008 | Monitoring Microsoft SQL Server by Michael Streb
PDF
Synology Workshop07 06
Einführung in Laravel und GulpJS
Systemmanagement mit Puppet und Foreman
Überblick über aktuelle Versionsmanagementsysteme
Infrastructure as code: Cloud-Umgebungen mit Terraform verwalten
TechTalkThursday 26.11.2015: Manage the minions - Docker Container mit Kubern...
Ceph Introduction @GPN15
Unser Weg zum Frankenstack
TechTalkThursday: Zentrales Metriken-System - ist der Flügelschlag des Schmet...
check_sap_health
Der oracle dba_und_seine_passwoerter
Ldap sqlnet
Introduction into Oracle Data Pump 11g/12c - Export and Import Data
Varnish PHP Unconference Hamburg 2012
Nagios Conference 2007 | Vmware Monitoring by Ingo Latschner
Von Test nach live mit Rex
OSMC 2010 | Monitoring mit Shinken by Gerhard Laußer
Einfuehrung in die Erstellung von Software-Paketen mit dem RPM Package Manager
OSMC 2008 | Monitoring Microsoft SQL Server by Michael Streb
Synology Workshop07 06
Anzeige

Automatisierte Linux Administration mit (R)?ex

  • 1. (R)?ex - A framework to simplify system administration
  • 2. Geschichte • (R)?ex - Remote Execution • Entstanden um Deployments unterschiedlicher Projekte zu vereinfachen und zu vereinheitlichen. • Deployments auf unterschiedliche Umgebungen (Live, Prelive, Testing) • Einfaches/Automatisiertes Deployment auf mehreren Servern.
  • 3. Mittlerweile • Framework zur Administration von Linux Servern. • Remote Commands werden über SSH ausgeführt. • Viele Befehle werden transparent umgeschrieben. • Konfigurationsmanagement
  • 4. Und was ist‘s jetzt? • Ganz grob, so was ähnliches wie Make • Es gibt ein Rexfile • Ein normales Perl Script
  • 5. Rexfile user “jan“; task “uptime“, sub { say run “uptime“; };
  • 6. Rexfile user “jan“; task “uptime“, sub { say run “uptime“; }; $ rex -H “server[01..02]“ uptime
  • 7. Rexfile user “jan“; task “uptime“, sub { say run “uptime“; }; $ rex -H “server[01..02]“ uptime [2011-06-24 18:27:28] - INFO - Running task: uptime [2011-06-24 18:27:28] - INFO - Connecting to server01 (jan) 21:18:19 up 2:18, 1 user, load average: 0.00, 0.01, 0.03 [2011-06-24 18:27:28] - INFO - Connecting to server02 (jan) 18:27:18 up 1 min, 1 user, load average: 2.12, 0.80, 0.28
  • 9. Paketverwaltung task “prepare“, sub { install package => “apache2“; install package => [ “apache2“, “vim“, “libapache2-mod-php5“ ]; };
  • 10. Paketverwaltung task “prepare“, sub { remove package => “apache2“; };
  • 11. Hardwareinfos task “memory“, sub { my $mem = memory(); say “Free: “ . $mem->{“free“}; };
  • 12. Hardwareinfos task “memory“, sub { my $mem = memory(); say “Free: “ . $mem->{“free“}; }; task “network“, sub { my $net_info = network_interfaces(); for my $dev ( keys %{ $net_info } ) { say “$dev hat die ip: “ . $net_info->{$dev}->{“ip“}; } };
  • 13. Prozesse task “ps“, sub { for my $process ( ps() ) { say “cmd: “ . $process->{“command“}; say “pid:“ . $process->{“pid“}; } kill 9931; };
  • 14. Filesystem task “prepare“, sub { unless( is_dir(“/srv/httpd/htdocs“) ) { mkdir(“/srv/httpd/htdocs“); cp(“/mnt/templates/htdocs/*“, “/srv/httpd/htdocs“); } };
  • 15. Dateien und Aktionen task “prepare“, sub { install file => “/etc/apache2/httpd.conf“, { source => “files/apache/httpd.conf“, owner => “root“, group => “root“, mode => 644, on_change => service(apache2 => “restart“) }; };
  • 17. Apache Deployments use Rex::Apache::Deploy Symlink; my $VERSION = “1.0“; deploy_to “/var/www/deploy“; document_root “/var/www/html“; generate_deploy_directory sub { return $VERSION; }; desc “Deploy Application“; task “deploy“, “server[01..04]“, sub { deploy “myapp-$VERSION.tar.gz“; };
  • 18. Tomcat Deployments use Rex::Apache::Deploy Tomcat; context_path “/myapp“; desc “Deploy Application“; task “deploy“, “server[01..04]“, sub { deploy “myapp-1.0.war“, { username => “manager-user“, password => “manager-password“, port => 8080 }; };
  • 19. Danke für die Aufmerksamkeit. http://rexify.org/

Hinweis der Redaktion