Rex-GPU
view release on metacpan or search on metacpan
.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`).
## Workspace Distributions
### Rex::GPU (`rex-gpu`)
```perl
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/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,
( run in 0.575 second using v1.01-cache-2.11-cpan-39bf76dae61 )