task "test02", "192.168.137.3", sub {
my $parameters = shift;
my $parameter1_value = $parameters->{parameter1};
my $output= run "echo $parameter1_value >/tmp/aaa ";
say $output;
};
task "myexec","192.168.137.3", sub {
my $current_server=connection->server;
sudo {
command => sub {
shell_block template('files/test.sh');
},
user => 'mqm'
};
};
task "uptime", "192.168.137.3", sub {
say run "uptime";
run "uptime", sub {
my ($stdout, $stderr) = @_;
my $server = Rex::get_current_connection()->{server};
say "[$server] $stdout
";
};
};
task "nofify","192.168.137.3", sub {
run "extract-something",
command => "hostname",
only_notified => TRUE;
# some code ...
notify "run", "extract-something"; # now the command gets executed
};
[root@node01 Rex]# rex test02 --parameter1=dasdad