We want JSON WANT_JSON
AnsibleModule - Port of AnsibleModule helper from Ansible distribution
my $pkg_mod=AnsibleModule->new(argument_spec=> { name => { aliases => 'pkg' }, state => { default => 'present', choices => [ 'present', 'absent'], list => {} }, required_one_of => [ qw/ name list / ], mutually_exclusive => [ qw/ name list / ], supports_check_mode => 1, ); ... $pkg_mod->exit_json(changed => 1, foo => 'bar');
This is a helper class for building ansible modules in Perl. It's a straight port of the AnsibleModule class that ships with the ansible distribution.
Argument specification. Takes a hashref of arguments, along with a set of parameters for each.
The argument specification for your module.
Exit with a json msg. changed will default to false.
Exit with a failure. msg is required.
To install AnsibleModule, copy and paste the appropriate command in to your terminal.
cpanm
cpanm AnsibleModule
CPAN shell
perl -MCPAN -e shell install AnsibleModule
For more information on module installation, please visit the detailed CPAN module installation guide.