The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Ansible::Util::Run

VERSION

version 0.001

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);
    

DESCRIPTION

A thin wrapper around the Ansible CLI tools.

ATTRIBUTES

vaultPasswordFiles

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

type: ArrayRef[Str]
required: no

METHODS

All methods confess on error unless otherwise specified.

ansiblePlaybook()

Invokes the ansible-playbook command with the specified args.

usage:

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

returns:

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

args:

playbook

The name of the playbook file.

type: Str
required: yes
extraArgs

Any additional args you want to pass to the command line.

type: ArrayRef[Str]
required: no
confessOnError

If the command exits with an error, the call will simply confess with the output from stderr.

type: Bool
required: no
default: 1
wantArrayRefs

The stdout and stderr are returned as array refs split across newlines.

type: Bool
required: no
default: 0