-
-
05 Jul 2021 21:04:56 UTC
- Distribution: Rex
- Module version: v1.13.4
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues
- Testers (711 / 4 / 2)
- Kwalitee
Bus factor: 2- 49.25% Coverage
- License: apache_2_0
- Perl: v5.10.1
- Activity
24 month- Tools
- Download (342.78KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 118 contributors-
Jan Gehring
-
A Happy User
-
Alexander Romanenko
-
Alexandr Ciornii
-
Alex Mestiashvili
-
Ali Polatel
-
alx542
-
Anders Ossowicki
-
Andrej Zverev
-
Andrew Solomon
-
Andy Beverley
-
Arnold Bechtoldt
-
Boris Däppen
-
Brian Manning
-
Cameron Daniel
-
Chris Steigmeier
-
Christophe Wolfhugel
-
Crimson Thompson
-
Daniel Bäurer
-
Daniel Cesario
-
Daniel Dico
-
Denis Silakov
-
Dmitry Kopytov
-
Dominik Schulz
-
E. Choroba
-
Eduardo J
-
Eivin Giske Skaaren
-
elisdg
-
Elmer Quintanilla
-
Eric Johnson
-
Erik Huelsmann
-
Ferenc Erki
-
Franky Van Liedekerke
-
Fran Rodriguez
-
Gabor Szabo
-
Graham Todd
-
Harm Müller
-
Hayato Imai
-
Hiroaki Nakamura
-
Hiroki Matsuo
-
iblinder
-
Ilya Pavlov
-
James D Bearden
-
jdelgado7
-
Jean Charles Passard
-
Jean-Marie Renouard
-
Jeen Lee
-
Jens Berthold
-
Joachim Bargsten
-
John Karr
-
Jon Gentle
-
Joris DE POOTER
-
Jose Luis Martinez
-
Jose Luis Perez Diez
-
Kasim Tuman
-
Keedi Kim
-
Ken Crowell
-
Kent Fredric
-
Kirill Babikhin
-
labbeduddel
-
Leah Neukirchen
-
LeMerP
-
Mario Domgoergen
-
Max E. Aubrey
-
Mitch Broadhead
-
Nathan Abu
-
Naveed Massjouni
-
necrophcodr
-
Nicolas Leclercq
-
Nigel Gregoire
-
Nikolay A. Fetisov
-
Nils Domrose
-
okaoka
-
Oleg Hardt
-
Olivier Cherrier
-
Orange
-
Paco Esteban
-
Patrick Lauer
-
Pavel Timofeev
-
perlancar
-
Peter H. Ezetta
-
Peter Manthey
-
petersonchen
-
Pierrick DINTRAT
-
Piotr Karbowski
-
Prajithp
-
Randy Lauen
-
Renée Bäcker
-
Robert Abraham
-
Roy Storey
-
Samuele Tognini
-
Sascha Askani
-
Sascha Guenther
-
Simon Bertrang
-
Solène Rapenne
-
Stephane Benoit
-
Steve Dondley
-
Sven Dowideit
-
Tamas Molnar
-
Tianon Gravi
-
Tokuhiro Matsuno
-
Tomohiro Hosaka
-
Volker Kroll
-
Walery Wysotsky
-
Yanick Champoux
-
Yegor Korablev
-
Zane C. Bowers-Hadley
-
Сергей Романов
-
范野人
-
饶琛琳
-
Cuong Manh Le
-
David Golovan
-
Dominik Danter
-
Ilya Evseev
-
Niklas Larsson
-
Qiao Liu
-
Renato CRON
-
Peter Jankovics
- Dependencies
- AWS::Signature4
- Carp
- Cwd
- Data::Dumper
- Data::Validate::IP
- Devel::Caller
- Digest::HMAC_SHA1
- Digest::MD5
- English
- Exporter
- Fcntl
- File::Basename
- File::Spec
- File::Spec::Unix
- File::Spec::Win32
- FindBin
- HTTP::Request
- HTTP::Request::Common
- Hash::Merge
- IO::File
- IO::Select
- IO::Socket
- IO::String
- IPC::Open3
- JSON::MaybeXS
- LWP::UserAgent
- List::Util
- MIME::Base64
- Net::OpenSSH::ShellQuoter
- POSIX
- Scalar::Util
- Sort::Naturally
- Storable
- Symbol
- Term::ReadKey
- Test::Builder::Module
- Text::Glob
- Text::Wrap
- Time::HiRes
- UNIVERSAL
- URI
- URI::QueryParam
- XML::Simple
- YAML
- attributes
- base
- constant
- lib
- overload
- strict
- vars
- version
- warnings
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
- NAME
- DESCRIPTION
- SYNOPSIS
- METHODS
- new
- connection
- executor
- hidden
- server
- set_server(@server)
- delete_server
- current_server
- desc
- set_desc($description)
- is_remote
- is_local
- is_http
- is_https
- is_openssh
- want_connect
- get_connection_type
- modify($key, $value)
- rethink_connection
- user
- set_user($user)
- password
- set_password($password)
- name
- code
- set_code(\&code_ref)
- run_hook($server, $hook)
- set_auth($key, $value)
- merge_auth($server)
- get_sudo_password
- parallelism
- set_parallelism($count)
- connect($server)
- disconnect
- get_data
- run($server, %options)
- modify_task($task, $key => $value)
- is_task
- get_tasks
- get_desc
- exit_on_connect_fail
- set_exit_on_connect_fail
- get_args
- get_opts
- set_args
- set_opt
- set_opts
- clone
NAME
Rex::Task - The Task Object
DESCRIPTION
The 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->create->get_task('my_task');
METHODS
new
This 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, ...], );
connection
Returns the current connection object.
executor
Returns the current executor object.
hidden
Returns true if the task is hidden. (Should not be displayed on ,,rex -T''.)
server
Returns 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_server
Delete every server registered to the task.
current_server
Returns the current server on which the tasks gets executed right now.
desc
Returns the description of a task.
set_desc($description)
Set the description of a task.
is_remote
Returns true (1) if the task will be executed remotely.
is_local
Returns true (1) if the task gets executed on the local host.
is_http
Returns true (1) if the task gets executed over http protocol.
is_https
Returns true (1) if the task gets executed over https protocol.
is_openssh
Returns true (1) if the task gets executed with openssh.
want_connect
Returns true (1) if the task will establish a connection to a remote system.
get_connection_type
This 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_connection
Deletes current connection object.
user
Returns the username the task will use.
set_user($user)
Set the username of a task.
password
Returns the password that will be used.
set_password($password)
Set the password of the task.
name
Returns the name of the task.
code
Returns 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_password
Returns the sudo password.
parallelism
Get the parallelism count of a task.
set_parallelism($count)
Set the parallelism of the task.
connect($server)
Initiate the connection to $server.
disconnect
Disconnect from the current connection.
get_data
Dump 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_task
Returns true(1) if the passed object is a task.
get_tasks
Returns list of tasks.
get_desc
Returns description of task.
exit_on_connect_fail
Returns true if rex should exit on connect failure.
set_exit_on_connect_fail
Sets if rex should exit on connect failure.
get_args
Returns arguments of task.
get_opts
Returns options of task.
set_args
Sets arguments for task.
set_opt
Sets an option for task.
set_opts
Sets options for task.
clone
Clones a task.
Module Install Instructions
To install Rex, copy and paste the appropriate command in to your terminal.
cpanm Rex
perl -MCPAN -e shell install Rex
For more information on module installation, please visit the detailed CPAN module installation guide.