Before this change, only the ansible_local provisioner supported this option (for ansible version requirement, and pip installation). Now, the ansible host-based provisioner can also require a exact ansible version. Resolve #8914 Note: this has been added as part of #6570 resolution, since the introduction of the `compatibility_mode` auto-detection made both provisioners made capable to detect ansible version. Pending: optimize the code to avoid duplicated executions of "ansible --version" command.
54 lines
1.4 KiB
Ruby
54 lines
1.4 KiB
Ruby
require_relative "base"
|
|
require_relative "../helpers"
|
|
|
|
module VagrantPlugins
|
|
module Ansible
|
|
module Config
|
|
class Guest < Base
|
|
|
|
attr_accessor :provisioning_path
|
|
attr_accessor :tmp_path
|
|
attr_accessor :install
|
|
attr_accessor :install_mode
|
|
attr_accessor :pip_args
|
|
|
|
def initialize
|
|
super
|
|
|
|
@install = UNSET_VALUE
|
|
@install_mode = UNSET_VALUE
|
|
@pip_args = UNSET_VALUE
|
|
@provisioning_path = UNSET_VALUE
|
|
@tmp_path = UNSET_VALUE
|
|
end
|
|
|
|
def finalize!
|
|
super
|
|
|
|
@install = true if @install == UNSET_VALUE
|
|
@install_mode = :default if @install_mode == UNSET_VALUE
|
|
@pip_args = "" if @pip_args == UNSET_VALUE
|
|
@provisioning_path = "/vagrant" if provisioning_path == UNSET_VALUE
|
|
@tmp_path = "/tmp/vagrant-ansible" if tmp_path == UNSET_VALUE
|
|
end
|
|
|
|
def validate(machine)
|
|
super
|
|
|
|
case @install_mode.to_s.to_sym
|
|
when :pip
|
|
@install_mode = :pip
|
|
when :pip_args_only
|
|
@install_mode = :pip_args_only
|
|
else
|
|
@install_mode = :default
|
|
end
|
|
|
|
{ "ansible local provisioner" => @errors }
|
|
end
|
|
|
|
end
|
|
end
|
|
end
|
|
end
|