Ansible-Util

 view release on metacpan or  search on metacpan

lib/Ansible/Util/Run.pm  view on Meta::CPAN

package Ansible::Util::Run;
$Ansible::Util::Run::VERSION = '0.001';
use Modern::Perl;
use Moose;
use namespace::autoclean;
use Kavorka 'method';
use Data::Printer alias => 'pdump';

=head1 NAME

Ansible::Util::Run

=head1 VERSION

version 0.001

=head1 SYNOPSIS

  $run = Ansible::Util::Run->new;
  ( $stdout, $stderr, $exit ) = $run->ansiblePlaybook(playbook => $playbook);

  $run = Ansible::Util::Run->new(
      vaultPasswordFiles => ['secret1', 'secret2']
  );
  ( $stdout, $stderr, $exit ) = $run->ansiblePlaybook(playbook => $playbook);
    
=head1 DESCRIPTION

A thin wrapper around the Ansible CLI tools.
 
=cut

with 'Ansible::Util::Roles::Constants';

##############################################################################
# PUBLIC ATTRIBUTES
##############################################################################

=head1 ATTRIBUTES

=head2 vaultPasswordFiles

A list of vault-password-files to pass to the command line.

=over

=item type: ArrayRef[Str]

=item required: no

=back

=cut

with
  'Ansible::Util::Roles::Attr::VaultPasswordFiles',
  'Util::Medley::Roles::Attributes::Spawn';

##############################################################################
# PRIVATE_ATTRIBUTES
##############################################################################

##############################################################################
# CONSTRUCTOR
##############################################################################

##############################################################################
# PUBLIC METHODS
##############################################################################

=head1 METHODS

All methods confess on error unless otherwise specified.

=head2 ansiblePlaybook()

Invokes the ansible-playbook command with the specified args.

=head3 usage:

  ($stdout, $stderr, $exit) = 
    $run->ansiblePlaybook(playbook        => $file,
                          [extraArgs      => $aref],
                          [confessOnError => $bool],
                          [wantArrayRefs  => $bool]);

=head3 returns:

An array containing the stdout, stderr, and exit status from the 
ansible-playbook command.
                        
=head3 args:

=over

=item playbook

The name of the playbook file.

=over

=item type: Str



( run in 0.760 second using v1.01-cache-2.11-cpan-5b529ec07f3 )