diff --git a/examples/playbook/modules/custom_perl_json_args_module.pl b/examples/playbook/modules/custom_perl_json_args_module.pl new file mode 100644 index 00000000..c999ca6c --- /dev/null +++ b/examples/playbook/modules/custom_perl_json_args_module.pl @@ -0,0 +1,15 @@ +#!/usr/bin/perl + +binmode STDOUT, ":utf8"; +use utf8; + +use JSON; + +my $json_args = <<'END_MESSAGE'; +<> +END_MESSAGE + +print encode_json({ + message => "I am a perl script! Here is my input.", + input => [decode_json($json_args)] +}); diff --git a/examples/playbook/modules/custom_perl_want_json_module.pl b/examples/playbook/modules/custom_perl_want_json_module.pl new file mode 100644 index 00000000..8b45e5b4 --- /dev/null +++ b/examples/playbook/modules/custom_perl_want_json_module.pl @@ -0,0 +1,21 @@ +#!/usr/bin/perl + +binmode STDOUT, ":utf8"; +use utf8; + +my $WANT_JSON = 1; + +use JSON; + +my $json; +{ + local $/; #Enable 'slurp' mode + open my $fh, "<", $ARGV[0]; + $json_args = <$fh>; + close $fh; +} + +print encode_json({ + message => "I am a want JSON perl script! Here is my input.", + input => [decode_json($json_args)] +}); diff --git a/examples/playbook/runner.yml b/examples/playbook/runner.yml index fb8baa64..4a2fed81 100644 --- a/examples/playbook/runner.yml +++ b/examples/playbook/runner.yml @@ -4,6 +4,8 @@ - import_playbook: runner__custom_binary_producing_json.yml - import_playbook: runner__custom_binary_producing_junk.yml - import_playbook: runner__custom_binary_single_null.yml +- import_playbook: runner__custom_perl_json_args_module.yml +- import_playbook: runner__custom_perl_want_json_module.yml - import_playbook: runner__custom_python_json_args_module.yml - import_playbook: runner__custom_python_new_style_module.yml - import_playbook: runner__custom_python_want_json_module.yml diff --git a/examples/playbook/runner__custom_perl_json_args_module.yml b/examples/playbook/runner__custom_perl_json_args_module.yml new file mode 100644 index 00000000..1ee24ccb --- /dev/null +++ b/examples/playbook/runner__custom_perl_json_args_module.yml @@ -0,0 +1,5 @@ +- hosts: all + tasks: + - custom_perl_json_args_module: + foo: true + with_sequence: start=1 end={{end|default(100)}} diff --git a/examples/playbook/runner__custom_perl_want_json_module.yml b/examples/playbook/runner__custom_perl_want_json_module.yml new file mode 100644 index 00000000..4b821bef --- /dev/null +++ b/examples/playbook/runner__custom_perl_want_json_module.yml @@ -0,0 +1,5 @@ +- hosts: all + tasks: + - custom_perl_want_json_module: + foo: true + with_sequence: start=1 end={{end|default(100)}}