plugins/provisioners/ansible/config.rb in tnargav-1.2.3 vs plugins/provisioners/ansible/config.rb in tnargav-1.3.3
- old
+ new
@@ -1,41 +1,58 @@
module VagrantPlugins
module Ansible
class Config < Vagrant.plugin("2", :config)
attr_accessor :playbook
attr_accessor :extra_vars
- attr_accessor :inventory_file
+ attr_accessor :inventory_path
attr_accessor :ask_sudo_pass
attr_accessor :limit
attr_accessor :sudo
attr_accessor :sudo_user
attr_accessor :verbose
+ attr_accessor :tags
+ attr_accessor :skip_tags
+ attr_accessor :start_at_task
+ attr_accessor :host_key_checking
+ # Joker attribute, used to pass unsupported arguments to ansible anyway
+ attr_accessor :raw_arguments
+
def initialize
- @playbook = UNSET_VALUE
- @extra_vars = UNSET_VALUE
- @inventory_file = UNSET_VALUE
- @ask_sudo_pass = UNSET_VALUE
- @limit = UNSET_VALUE
- @sudo = UNSET_VALUE
- @sudo_user = UNSET_VALUE
- @verbose = UNSET_VALUE
+ @playbook = UNSET_VALUE
+ @extra_vars = UNSET_VALUE
+ @inventory_path = UNSET_VALUE
+ @ask_sudo_pass = UNSET_VALUE
+ @limit = UNSET_VALUE
+ @sudo = UNSET_VALUE
+ @sudo_user = UNSET_VALUE
+ @verbose = UNSET_VALUE
+ @tags = UNSET_VALUE
+ @skip_tags = UNSET_VALUE
+ @start_at_task = UNSET_VALUE
+ @raw_arguments = UNSET_VALUE
+ @host_key_checking = "true"
end
def finalize!
- @playbook = nil if @playbook == UNSET_VALUE
- @extra_vars = nil if @extra_vars == UNSET_VALUE
- @inventory_file = nil if @inventory_file == UNSET_VALUE
- @ask_sudo_pass = nil if @ask_sudo_pass == UNSET_VALUE
- @limit = nil if @limit == UNSET_VALUE
- @sudo = nil if @sudo == UNSET_VALUE
- @sudo_user = nil if @sudo_user == UNSET_VALUE
- @verbose = nil if @verbose == UNSET_VALUE
+ @playbook = nil if @playbook == UNSET_VALUE
+ @extra_vars = nil if @extra_vars == UNSET_VALUE
+ @inventory_path = nil if @inventory_path == UNSET_VALUE
+ @ask_sudo_pass = nil if @ask_sudo_pass == UNSET_VALUE
+ @limit = nil if @limit == UNSET_VALUE
+ @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
+ @skip_tags = nil if @skip_tags == UNSET_VALUE
+ @start_at_task = nil if @start_at_task == UNSET_VALUE
+ @raw_arguments = nil if @raw_arguments == UNSET_VALUE
+ @host_key_checking = nil if @host_key_checking == UNSET_VALUE
end
def validate(machine)
- errors = []
+ errors = _detected_errors
# Validate that a playbook path was provided
if !playbook
errors << I18n.t("vagrant.provisioners.ansible.no_playbook")
end
@@ -54,14 +71,14 @@
if !extra_vars.kind_of?(Hash)
errors << I18n.t("vagrant.provisioners.ansible.extra_vars_not_hash")
end
end
- # Validate the existence of the inventory_file, if specified
- if inventory_file
- expanded_path = Pathname.new(inventory_file).expand_path(machine.env.root_path)
- if !expanded_path.file?
- errors << I18n.t("vagrant.provisioners.ansible.inventory_file_path_invalid",
+ # Validate the existence of the inventory_path, if specified
+ if inventory_path
+ expanded_path = Pathname.new(inventory_path).expand_path(machine.env.root_path)
+ if !expanded_path.exist?
+ errors << I18n.t("vagrant.provisioners.ansible.inventory_path_invalid",
:path => expanded_path)
end
end
{ "ansible provisioner" => errors }