Skip to content

Instantly share code, notes, and snippets.

@augensalat
Created December 9, 2020 13:39
Show Gist options
  • Save augensalat/cbe61b621c7c4cbffc96b8ec1a674e56 to your computer and use it in GitHub Desktop.
Save augensalat/cbe61b621c7c4cbffc96b8ec1a674e56 to your computer and use it in GitHub Desktop.
perl -MMojo::Util=dumper -MYAML -wE '
no warnings "once";
sub Vault::yaml_load {
my ($class, $node) = @_;
my ($h, $s) = sub { my @l = split /\n/, $$node; return (shift @l, join("", @l)) }->();
my %h;
@h{qw(blurb version encryption id)} = split /;/, $h;
bless {%h, secret => $s}, $class;
}
$YAML::TagClass->{vault} = "Vault";
print dumper Load(<<"ETX");
the_secret: !vault |
\$ANSIBLE_VAULT;1.1;AES256
62313365396662343061393464336163383764373764613633653634306231386433626436623361
6134333665353966363534333632666535333761666131620a663537646436643839616531643561
63396265333966386166373632626539326166353965363262633030333630313338646335303630
3438626666666137650a353638643435666633633964366338633066623234616432373231333331
6564
ETX
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment