Vom Kunsthandwerk zum Wegwerf-Server
<mathias.muench@tngtech.com>
"Infrastructure as code". I love the phrase. Where devops is a word that is sadly open to so much (mis)interpretation, "Infrastructure as code" is pretty clear. Treat your infrastructure as code. Programmable. Testable. Deployable. (John E. Vincent)
"'Real Programmers' are reluctant to actually edit a program that is close to working. They find it much easier to just patch the binary object code directly" (Ed Post, Real Programmers Don't Use PASCAL)
Wir installieren unsere perfekt versionierte, automatisch getestete, kontinuierlich integrierte Software auf Servern mit einem unbekannten Status.
Jede Konfigurationsänderung bedeutet eine Neuinstallation.
# import mounted dvd
cobbler import --path=/mnt --name=CentOS-6 --kickstart=/var/lib/cobbler/kickstarts/default.ks
cobbler distro report --name CentOS-6
cobbler profile add --name latest --comment "profile for development hosts"
cobbler repo add --name latest --mirror /var/www/yum/latest --comment "yum repo for development" ...
cobbler profile add --name int --comment "profile for integration hosts"
cobbler repo add --name int --mirror /var/www/yum/int --comment "yum repo for integration"
cobbler system add --name int1 --profile int --interface eth0 --mac ... --ip ...
cobbler profile add --name prod --comment "profile for prod1 hosts"
cobbler repo add --name prod --mirror /var/www/yum/prod --comment "yum repo for prod"
cobbler system add --name prod1 --profile prod
# dhcp, tftp... synchronisieren
cobbler sync
Koan ist ein Cobbler-Client, der Konfigurationen von Cobbler abrufen und Systeme installieren kann.
koan --server=cobbler.example.org --virt --profile=name
Koan erfordert konzeptionell einen Hosted-Hypervisor.
Bei einem Bare-Metal-Hypervisor muss der Hypervisor direkt gesteuert werden - per Code!
"The vSphere API is exposed as a Web service"
#!/usr/bin/perl
use strict;
use warnings;
# Step 1: Import the vSphere SDK for Perl Modules.
use VMware::VIRuntime;
# Step 2: (Optional) Define Script-Specific Command-Line Options.
my %opts = (
entity => {
type => "=s",
help => "ManagedEntity type: VirtualMachine, etc",
required => 1,
},
);
Opts::add_options(%opts);
Opts::parse();
Opts::validate();
# Step 3: Connect to the Server.
Util::connect();
# Step 4: Obtain View Objects of Server-Side Managed Objects.
# Obtain all inventory objects of the specified type
my $entity_type = Opts::get_option('entity');
my $entity_views = Vim::find_entity_views(view_type => $entity_type);
# Step 5: Process Views and Report Results.
# Process the findings and output to the console
foreach my $entity_view (@$entity_views) {
my $entity_name = $entity_view->name;
Util::trace(0, "Found $entity_type: $entity_name\n");
}
# Step 6: Close the Server Connection.
# Disconnect from the server
Util::disconnect();