» Home » Docs » Release notes » Release notes for 0.12
Release notes for 0.12
Rex
Added sudo command
sudo_password "mypassword";
Allow to manage multiple services at once.
task "start", sub { service [qw/apache2 rsyslog ftp/] => "start"; };
Added possibility to add and remove services from runlevels
use Rex::Commands::Iptables; task "prepare", sub { service apache2 => "ensure", "started"; service apache2 => "ensure", "stopped"; };
Added an iptables module to manage basic iptables rules.
task "firewall", sub { # clear all rules iptables_clear; # open port 22 on all devices open_port 22; # open port 22 and 80 on eth0 open_port [ 22, 80 ] => { dev => "eth0", }; # close all ports on all devices close_port "all"; # close port 22 on dev eth0 close_port 22 => { dev => "eth0", }; # redirect port 80 to 10080 redirect_port 80 => 10080; # redirect port 80 to 10080 on eth0 redirect_port 80 => { dev => "eth0", to => 10080, }; # set default state rules (RELATED,ESTABLISHED) to accept on all devices default_state_rule; # set default state rules (RELATED,ESTABLISHED) to accept on eth0 default_state_rule dev => "eth0"; # make the system a nat gateway for its default route # this will set the sysctl entry net.ipv4.ip_forward to 1, too. is_nat_gateway; # define a custom iptables rule iptables t => "filter", A => "INPUT", i => "eth0", ...; };
Added Amazon EC2 Support
use Data::Dumper; use Rex::Commands::Cloud;
# set the cloud service provider to "Amazon" cloud_service "Amazon";
# set cloud auth cloud_auth "$access_key", "$secret_access_key";
# set cloud region cloud_region "ec2.eu-west-1.amazonaws.com";
# define a group with all running ec2 instances group ec2 => get_cloud_instances_as_group();
task "list", sub { print Dumper cloud_instances_list; print Dumper cloud_volume_list;
<span class="hljs-function">print</span> Dumper get_cloud_regions;
<span class="hljs-function">print</span> Dumper get_cloud_availability_zones;
};
task "create", sub {
<span class="hljs-comment"># if you want an ebs volume, create it. if not, you don't need this.</span><span class="hljs-comment">
my $vol_id = cloud_volume create => { size => 1, zone => "eu-west-1a"; };
<span class="hljs-comment"># create the cloud instances and attach the just created ebs volume.</span><span class="hljs-comment">
cloud_instance create => { image_id => "ami-02103876", name => "test-ec2", key => "my-test-key", volume => $vol_id, # if you don't have a volume, skip this zone => "eu-west-1a", # the volume and the instance must be in the same zone. skip this if you don't have a volume. }; };
task "destroy", sub { cloud_volume detach => "vol-xxaabb"; cloud_instance terminate => "i-ffgghhjj"; cloud_colume delete => "vol-xxaabb"; };
task "prepare", group => "ec2", sub { run "apt-get update"; install package => "apache2"; service apache2 => "start"; };
- Some improvements and bug fixes