Rex-GPU
view release on metacpan or search on metacpan
use Rex::Rancher::Agent;
use Rex::Rancher::Node;
use Rex::Rancher::Server;
use Rex::Rancher::Cilium;
my $key = $ENV{REX_KEY} || "$ENV{HOME}/.ssh/id_ed25519";
my $user = $ENV{REX_USER} || 'root';
set connection => 'LibSSH';
set user => $user;
set private_key => $key;
set public_key => "$key.pub";
set auth => 'key';
desc 'Detect GPUs on the host';
task 'detect', sub {
my $gpus = Rex::GPU::gpu_detect();
if (@{ $gpus->{nvidia} // [] }) {
for my $gpu (@{ $gpus->{nvidia} }) {
Rex::Logger::info("NVIDIA: $gpu->{name}" . ($gpu->{compute} ? " (compute)" : ""));
eg/custom-setup/Rexfile view on Meta::CPAN
# Testing the WORKING TREE: see eg/Rexfile -- prepend PERL5LIB=$PWD/lib.
use Rex -feature => ['1.4'];
use Rex::LibSSH;
use Rex::GPU;
my $key = $ENV{REX_KEY} || "$ENV{HOME}/.ssh/id_ed25519";
my $user = $ENV{REX_USER} || 'root';
set connection => 'LibSSH';
set user => $user;
set private_key => $key;
set public_key => "$key.pub";
set auth => 'key';
# Every gpu_setup / install_driver in this Rexfile uses the project's class.
set gpu_nvidia_setup => 'My::GPU::Setup';
desc 'GPU setup with My::GPU::Setup (chosen by set gpu_nvidia_setup)';
task 'setup', sub {
my ($params) = @_;
gpu_setup(
eg/hetzner-gpu.pl view on Meta::CPAN
use Rex -feature => ['1.4'];
use Rex::LibSSH;
use Rex::GPU;
use Rex::Rancher;
my $key = $ENV{REX_KEY} || "$ENV{HOME}/.ssh/id_ed25519";
my $user = $ENV{REX_USER} || 'root';
set connection => 'LibSSH';
set user => $user;
set private_key => $key;
set public_key => "$key.pub";
set auth => 'key';
group 'avatar' => 'avatar.conflict.industries';
desc 'Full deploy: node prep + GPU drivers (reboot) + RKE2 + Cilium + device plugin';
task 'deploy', group => 'avatar', sub {
rancher_deploy_server(
distribution => 'rke2',
gpu => 1,
eg/ubuntu-drivers/Rexfile view on Meta::CPAN
use Rex -feature => ['1.4'];
use Rex::LibSSH;
use Rex::GPU;
use Rex::GPU::NVIDIA;
my $key = $ENV{REX_KEY} || "$ENV{HOME}/.ssh/id_ed25519";
my $user = $ENV{REX_USER} || 'root';
set connection => 'LibSSH';
set user => $user;
set private_key => $key;
set public_key => "$key.pub";
set auth => 'key';
set gpu_nvidia_setup => 'Rex::GPU::NVIDIA::Setup::UbuntuDrivers';
desc 'GPU setup, driver package named by ubuntu-drivers';
task 'setup', sub {
my ($params) = @_;
gpu_setup(
containerd_config => ($params->{runtime} // 'rke2'),
misc/agent-context/.claude/skills/rex/SKILL.md view on Meta::CPAN
set connection => 'LibSSH';
# All Rex file operations now work without SFTP:
file '/etc/hostname', content => "myhost\n";
delete_lines_matching '/etc/fstab', matching => qr/\sswap\s/;
host_entry 'myhost.internal', ip => '127.0.1.1', aliases => ['myhost'];
```
Authentication:
```perl
Rex::Config->set_private_key('/root/.ssh/id_ed25519');
Rex::Config->set_public_key('/root/.ssh/id_ed25519.pub');
```
Host key checking is disabled by default (`strict_hostkeycheck => 0`).
## Getty's Rex distributions (CPAN)
### Rex::GPU (`Rex-GPU`)
```perl
( run in 2.383 seconds using v1.01-cache-2.11-cpan-036bef1c656 )