Rex::Task - Online Linux Manual PageSection : 3
Updated : 2021-03-06
Source : perl v5.32.1
Note : User Contributed Perl Documentation
NAMERex::Task − The Task Object
DESCRIPTIONThe Task Object. Typically you only need this class if you want to manipulate tasks after their initial creation.
SYNOPSIS use Rex::Task;
# create a new task
my $task = Rex::Task−>new(name => "testtask");
$task−>set_server("remoteserver");
$task−>set_code(sub { say "Hello"; });
$task−>modify("no_ssh", 1);
# retrieve an existing task
use Rex::TaskList;
my $existing_task = Rex::TaskList−>get_task('my_task');
METHODS
newThis is the constructor. $task = Rex::Task−>new(
func => sub { some_code_here },
server => [ @server ],
desc => $description,
no_ssh => $no_ssh,
hidden => $hidden,
auth => {
user => $user,
password => $password,
private_key => $private_key,
public_key => $public_key,
},
before => [sub {}, sub {}, ...],
after => [sub {}, sub {}, ...],
around => [sub {}, sub {}, ...],
before_task_start => [sub {}, sub {}, ...],
after_task_finished => [sub {}, sub {}, ...],
name => $task_name,
executor => Rex::Interface::Executor−>create,
opts => {key1 => val1, key2 => val2, ...},
args => [arg1, arg2, ...],
);
connectionReturns the current connection object.
executorReturns the current executor object.
hiddenReturns true if the task is hidden. (Should not be displayed on ,,rex −T''.)
serverReturns the servers on which the task should be executed as an ArrayRef.
set_server(@server)With this method you can set new servers on which the task should be executed on.
delete_serverDelete every server registered to the task.
current_serverReturns the current server on which the tasks gets executed right now.
descReturns the description of a task.
set_desc($description)Set the description of a task.
is_remoteReturns true(1) if the task will be executed remotely.
is_localReturns true(1) if the task gets executed on the local host.
is_httpReturns true(1) if the task gets executed over http protocol.
is_httpsReturns true(1) if the task gets executed over https protocol.
is_opensshReturns true(1) if the task gets executed with openssh.
want_connectReturns true(1) if the task will establish a connection to a remote system.
get_connection_typeThis method tries to guess the right connection type for the task and returns it. Current return values are below: • SSH: connect to the remote server using Net::SSH2 • OpenSSH: connect to the remote server using Net::OpenSSH • Local: runs locally (without any connections) • HTTP: uses experimental HTTP connection • HTTPS: uses experimental HTTPS connection • Fake: populate the connection properties, but do not connect So you can use this type to iterate over a list of remote hosts, but don't let rex build a connection. For example if you want to use Sys::Virt or other modules.
modify($key, $value)With this method you can modify values of the task.
rethink_connectionDeletes current connection object.
userReturns the username the task will use.
set_user($user)Set the username of a task.
passwordReturns the password that will be used.
set_password($password)Set the password of the task.
nameReturns the name of the task.
codeReturns the code of the task.
set_code(\&code_ref)Set the code of the task.
run_hook($server, $hook)This method is used internally to execute the specified hooks.
set_auth($key, $value)Set the authentication of the task. $task−>set_auth("user", "foo");
$task−>set_auth("password", "bar");
merge_auth($server)Merges the authentication information from $server into the task. Tasks authentication information have precedence.
get_sudo_passwordReturns the sudo password.
parallelismGet the parallelism count of a task.
set_parallelism($count)Set the parallelism of the task.
connect($server)Initiate the connection to $server.
disconnectDisconnect from the current connection.
get_dataDump task data.
run($server, %options)Run the task on $server, with %options.
modify_task($task, $key => $value)Modify $task, by setting $key to $value.
is_taskReturns true (1) if the passed object is a task.
get_tasksReturns list of tasks.
get_descReturns description of task.
exit_on_connect_failReturns true if rex should exit on connect failure.
set_exit_on_connect_failSets if rex should exit on connect failure.
get_argsReturns arguments of task.
get_optsReturns options of task.
set_argsSets arguments for task.
set_optSets an option for task.
set_optsSets options for task.
cloneClones a task. 0
Johanes Gumabo
Data Size : 25,089 byte
man-Rex::Task.3pmBuild : 2024-12-29, 07:25 :
Visitor Screen : x
Visitor Counter ( page / site ) : 5 / 257,284
Visitor ID : :
Visitor IP : 18.221.93.44 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.29
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.
ERROR : Need New Coding : (parse_manual_page_|252|Rex::Task.3pm|36/37|el══─{─══.|.el══─{─══. ds -- \|\(em\|
) (htmlprn|149|Rex::Task.3pm|36/37|.el══─{─══. ds -- — |.el══─{─══. ds -- \|\(em\|
) (parse_manual_page_|252|Rex::Task.3pm|43|br══─}─══|'br══─}─══
) (htmlprn|149|Rex::Task.3pm|43|'br══─}─══ |'br══─}─══
)