Add support for "ansible.tags" attribute

This commit is contained in:
Gilles Cornu 2013-05-06 21:17:45 +02:00
parent ccfd321ef9
commit 7bc6dd8a33
2 changed files with 11 additions and 9 deletions

View File

@ -9,6 +9,7 @@ module VagrantPlugins
attr_accessor :sudo
attr_accessor :sudo_user
attr_accessor :verbose
attr_accessor :tags
def initialize
@playbook = UNSET_VALUE
@ -19,6 +20,7 @@ module VagrantPlugins
@sudo = UNSET_VALUE
@sudo_user = UNSET_VALUE
@verbose = UNSET_VALUE
@tags = UNSET_VALUE
end
def finalize!
@ -30,6 +32,7 @@ module VagrantPlugins
@sudo = nil if @sudo == UNSET_VALUE
@sudo_user = nil if @sudo_user == UNSET_VALUE
@verbose = nil if @verbose == UNSET_VALUE
@tags = nil if @tags == UNSET_VALUE
end
def validate(machine)

View File

@ -8,15 +8,8 @@ module VagrantPlugins
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 << "--ask-sudo-pass" if config.ask_sudo_pass
if config.limit
if not config.limit.kind_of?(Array)
config.limit = [config.limit]
end
config.limit = config.limit.join(",")
options << "--limit=#{config.limit}"
end
options << "--tags=#{as_list_argument(config.tags)}" if config.tags
options << "--limit=#{as_list_argument(config.limit)}" if config.limit
options << "--sudo" if config.sudo
options << "--sudo-user=#{config.sudo_user}" if config.sudo_user
options << "--verbose" if config.verbose
@ -40,6 +33,12 @@ module VagrantPlugins
raise Vagrant::Errors::AnsiblePlaybookAppNotFound
end
end
private
def as_list_argument(v)
v.kind_of?(Array) ? v.join(',') : v
end
end
end
end