Thanks to GitHub Sponsors, Rex::Hook::File::Impostor has already been published \o/
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; | |
use Secret::Store; | |
my $store = Secret::Store->new( backend => 'pass' ); | |
sudo_password $store->get('sudo/username'); | |
task 'whoami' => sub { | |
sudo TRUE; | |
say run 'whoami'; |
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 strict; | |
use warnings; | |
use Rex -feature => [ '1.4', 'exec_autodie' ]; | |
use Data::Printer; | |
BEGIN { | |
use Rex::Shared::Var; | |
share qw(%results_for); | |
} |
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; | |
task 'files', sub { | |
# utf8 disabled | |
say 'disabling utf8 pragma'; | |
no utf8; | |
my $file = '/tmp/test'; | |
file $file, content => 'Daniel Böhmer'; |
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::Hook::File::Diff; | |
use strict; | |
use warnings; | |
use Rex -base; | |
use Rex::Hook; | |
use Text::Diff; |
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 strict; | |
use warnings; | |
use Rex -feature => [ '1.4', 'exec_autodie' ]; | |
use Parallel::Subs; | |
use Parallel::Forker; | |
desc 'Sleep for some time'; | |
task 'rexsleep', sub { | |
my $params = shift; |
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 strict; | |
use warnings; | |
use Rex -feature => [ '1.4', 'exec_autodie' ]; | |
sudo_password get_password('path/to/sudo/password/in/pass'); | |
user 'myuser'; | |
task 'a' => sub { | |
say run 'whoami'; # should be myuser |
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 strict; | |
use warnings; | |
use Rex -feature => [ '1.4', 'exec_autodie' ]; | |
use Linux::Inotify2; | |
use File::Basename qw(dirname); | |
use Time::HiRes qw(time tv_interval); | |
use DDP; | |
my $inotify = Linux::Inotify2->new(); |
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 strict; | |
use warnings; | |
use Rex -feature => [ '1.4', 'exec_autodie' ]; | |
use Net::MQTT::Simple; | |
use Time::HiRes qw(time); | |
no_ssh task 'agent', sub { | |
my $mqtt = Net::MQTT::Simple->new('localhost'); | |
$mqtt->run( |