Class: Kitchen::Provisioner::YansiblePusher

Inherits:
Base
  • Object
show all
Defined in:
lib/kitchen/provisioner/yansible_pusher.rb

Overview

YansiblePusher is a Kitchen provisioner plugin for Ansible. It allows you to use Ansible playbooks to provision test instances in Test Kitchen.

Examples:

Using YansiblePusher in your kitchen.yml

provisioner:
  name: yansible_pusher
  playbook: playbooks/playbook.yml
  env_vars:
    MARIO: "MUSHROOM_KINGDOM"
    LINK: "HYRULE_KINGDOM"

See Also:

Author:

  • <MY_NAME>

Version:

  • 0.1.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#sandbox_pathObject (readonly)

Returns the value of attribute sandbox_path.



42
43
44
# File 'lib/kitchen/provisioner/yansible_pusher.rb', line 42

def sandbox_path
  @sandbox_path
end

Instance Method Details

#init_commandObject



49
50
51
52
# File 'lib/kitchen/provisioner/yansible_pusher.rb', line 49

def init_command
  # No initialization command needed on the remote instance
  nil
end

#install_commandObject



44
45
46
47
# File 'lib/kitchen/provisioner/yansible_pusher.rb', line 44

def install_command
  # No initialization command needed on the remote instance
  nil
end

#prepare_commandObject



54
55
56
57
# File 'lib/kitchen/provisioner/yansible_pusher.rb', line 54

def prepare_command
  # No preparation command needed on the remote instance
  nil
end

#run_commandObject



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/kitchen/provisioner/yansible_pusher.rb', line 59

def run_command
  info("Running Ansible Playbook: #{config[:playbook]}")
  begin
    create_sandbox
    run_ansible
    info('Ansible Playbook Complete!')
  ensure
    cleanup_sandbox
  end
  ensure_windows_exit_code if windows_instance?
end