Add a Joker to pass raw options to ansible-playbook call
This commit is contained in:
parent
7bc6dd8a33
commit
66715de2ae
|
@ -11,6 +11,9 @@ module VagrantPlugins
|
||||||
attr_accessor :verbose
|
attr_accessor :verbose
|
||||||
attr_accessor :tags
|
attr_accessor :tags
|
||||||
|
|
||||||
|
# Joker attribute, used to pass unsupported arguments to ansible anyway
|
||||||
|
attr_accessor :raw_arguments
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@playbook = UNSET_VALUE
|
@playbook = UNSET_VALUE
|
||||||
@extra_vars = UNSET_VALUE
|
@extra_vars = UNSET_VALUE
|
||||||
|
@ -21,6 +24,7 @@ module VagrantPlugins
|
||||||
@sudo_user = UNSET_VALUE
|
@sudo_user = UNSET_VALUE
|
||||||
@verbose = UNSET_VALUE
|
@verbose = UNSET_VALUE
|
||||||
@tags = UNSET_VALUE
|
@tags = UNSET_VALUE
|
||||||
|
@raw_arguments = UNSET_VALUE
|
||||||
end
|
end
|
||||||
|
|
||||||
def finalize!
|
def finalize!
|
||||||
|
@ -33,6 +37,7 @@ module VagrantPlugins
|
||||||
@sudo_user = nil if @sudo_user == UNSET_VALUE
|
@sudo_user = nil if @sudo_user == UNSET_VALUE
|
||||||
@verbose = nil if @verbose == UNSET_VALUE
|
@verbose = nil if @verbose == UNSET_VALUE
|
||||||
@tags = nil if @tags == UNSET_VALUE
|
@tags = nil if @tags == UNSET_VALUE
|
||||||
|
@raw_arguments = nil if @raw_arguments == UNSET_VALUE
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate(machine)
|
def validate(machine)
|
||||||
|
|
|
@ -4,7 +4,13 @@ module VagrantPlugins
|
||||||
def provision
|
def provision
|
||||||
ssh = @machine.ssh_info
|
ssh = @machine.ssh_info
|
||||||
|
|
||||||
|
# Connect with Vagrant user (unless --user or --private-key are overidden by 'raw_arguments')
|
||||||
options = %W[--private-key=#{ssh[:private_key_path]} --user=#{ssh[:username]}]
|
options = %W[--private-key=#{ssh[:private_key_path]} --user=#{ssh[:username]}]
|
||||||
|
|
||||||
|
# Joker! Not (yet) supported arguments can be passed this way.
|
||||||
|
options << "#{config.raw_arguments}" if config.raw_arguments
|
||||||
|
|
||||||
|
# Append Provisioner options (higher precedence):
|
||||||
options << "--extra-vars=" + config.extra_vars.map{|k,v| "#{k}=#{v}"}.join(' ') if config.extra_vars
|
options << "--extra-vars=" + config.extra_vars.map{|k,v| "#{k}=#{v}"}.join(' ') if config.extra_vars
|
||||||
options << "--inventory-file=#{config.inventory_file}" if config.inventory_file
|
options << "--inventory-file=#{config.inventory_file}" if config.inventory_file
|
||||||
options << "--ask-sudo-pass" if config.ask_sudo_pass
|
options << "--ask-sudo-pass" if config.ask_sudo_pass
|
||||||
|
|
Loading…
Reference in New Issue