Last active
July 5, 2022 12:17
-
-
Save rwp0/a4fee5083dc7c0b863f5dbe7b8d16974 to your computer and use it in GitHub Desktop.
FreeBSD package upgrade with Perl's Rex automation
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 v5.36; | |
use Rex -feature => [ '1.4' ]; | |
port 2222; # custom port | |
user 'root'; # PermitRootLogin prohibit-password | |
private_key '<path to SSH key>'; | |
# password "<SSH key's passphrase>"; # passphrase if any | |
key_auth; | |
group servers => qw( | |
s3.exaple.com | |
s10.exaple.com | |
s23.exaple.com | |
s24.exaple.com | |
); | |
desc 'Install utility packages'; # describe task, description shown in rex -T | |
task 'install_packages', | |
group => 'servers', | |
sub { | |
my @packages = qw( | |
tmux | |
ccze | |
moreutils | |
cmdwatch | |
p5-Archive-Tar | |
p5-Config-General | |
git-lite | |
); | |
pkg( [ @packages ], ensure => 'present' ); | |
# first argument is arrayref to install in batch (undocumented) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Embedded in Medium post:
https://rwp0.medium.com/freebsd-package-upgrade-with-perls-rex-automation-5f09bbea0ccf