This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nodes": { | |
"devenv": { | |
"locked": { | |
"dir": "src/modules", | |
"lastModified": 1701187605, | |
"narHash": "sha256-NctguPdUeDVLXFsv6vI1RlEiHLsXkeW3pgZe/mwn1BU=", | |
"owner": "cachix", | |
"repo": "devenv", | |
"rev": "a7c4dd8f4eb1f98a6b8f04bf08364954e1e73e4f", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Rex::Commands::SimpleCheck; | |
sub wait_for_system_to_come_back { | |
my ($server) = @_; | |
# give some time for the reboot | |
Rex::Logger::info("Waiting for system reboot of $server..."); | |
sleep 30; | |
while ( !is_port_open $server, 22 ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my ($task) = Rex::TaskList->create()->get_task('taskname'); | |
my @servers_raw = @{ $task->{server} }; | |
my @servers = map { $_->get_servers } @servers_raw; | |
print Dumper \@servers; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
### USAGE: perl test-yaml.pl file.yml | |
### | |
use strict; | |
use warnings; | |
use Data::Dumper; | |
use YAML; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task "one", sub { | |
if(in_batch()) { | |
say "in batch"; | |
} | |
}; | |
task "two", sub {}; | |
sub in_batch { | |
return Rex::Args->is_opt('b'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Rex::Ext::Encryption::OpenSSL; | |
use Rex -base; | |
use Carp; | |
use Crypt::OpenSSL::RSA; | |
use MIME::Base64; | |
require Exporter; | |
use base qw(Exporter); | |
use vars qw(@EXPORT); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Rex -feature => ['0.45']; | |
use Rex::Commands::SimpleCheck; | |
user "root"; | |
password "box"; | |
group servers => "10.211.55.168", "10.211.55.169"; | |
# this task is flagged with "no_ssh". so it won't create a ssh connection | |
# to the server, but the connection() method works as usual |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use POSIX ":sys_wait_h"; | |
use Rex -feature => ['exit_status']; | |
group "servers", "localhost", "127.0.1.2"; | |
task test => group => servers => sub { | |
my $output = run "hostname"; | |
say $output; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Rex -feature => ['use_server_auth']; | |
use Term::ReadKey; | |
user "sudouser"; | |
password "test"; | |
group somegr => "10.211.55.28", "10.211.55.61"; | |
# get the CLI parameters | |
my %args = Rex::Args->getopts; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# USAGE: daemonize --user root --group root --pid_file /var/run/mydaemon.pid --command /usr/local/bin/myscript | |
use strict; | |
use warnings; | |
use Net::Server::Daemonize 'daemonize'; | |
use Getopt::Long; | |
use File::Basename; |
NewerOlder