Class: VagrantPlugins::AnsibleLocal::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::AnsibleLocal::Config
- Defined in:
- lib/vagrant-ansible-local/config.rb
Instance Attribute Summary collapse
-
#ask_sudo_pass ⇒ Object
Returns the value of attribute ask_sudo_pass.
-
#extra_vars ⇒ Object
Returns the value of attribute extra_vars.
-
#guest_folder ⇒ Object
Returns the value of attribute guest_folder.
-
#host_key_checking ⇒ Object
Returns the value of attribute host_key_checking.
-
#inventory_path ⇒ Object
Returns the value of attribute inventory_path.
-
#limit ⇒ Object
Returns the value of attribute limit.
-
#playbook ⇒ Object
Returns the value of attribute playbook.
-
#privileged ⇒ Object
Returns the value of attribute privileged.
-
#raw_arguments ⇒ Object
Joker attribute, used to pass unsupported arguments to ansible anyway.
-
#skip_tags ⇒ Object
Returns the value of attribute skip_tags.
-
#start_at_task ⇒ Object
Returns the value of attribute start_at_task.
-
#sudo ⇒ Object
Returns the value of attribute sudo.
-
#sudo_user ⇒ Object
Returns the value of attribute sudo_user.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
Instance Method Summary collapse
- #finalize! ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #validate(machine) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/vagrant-ansible-local/config.rb', line 22 def initialize super @playbook = UNSET_VALUE @guest_folder = UNSET_VALUE @extra_vars = UNSET_VALUE @inventory_path = UNSET_VALUE @ask_sudo_pass = UNSET_VALUE @limit = UNSET_VALUE @privileged = 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 |
Instance Attribute Details
#ask_sudo_pass ⇒ Object
Returns the value of attribute ask_sudo_pass.
8 9 10 |
# File 'lib/vagrant-ansible-local/config.rb', line 8 def ask_sudo_pass @ask_sudo_pass end |
#extra_vars ⇒ Object
Returns the value of attribute extra_vars.
6 7 8 |
# File 'lib/vagrant-ansible-local/config.rb', line 6 def extra_vars @extra_vars end |
#guest_folder ⇒ Object
Returns the value of attribute guest_folder.
5 6 7 |
# File 'lib/vagrant-ansible-local/config.rb', line 5 def guest_folder @guest_folder end |
#host_key_checking ⇒ Object
Returns the value of attribute host_key_checking.
17 18 19 |
# File 'lib/vagrant-ansible-local/config.rb', line 17 def host_key_checking @host_key_checking end |
#inventory_path ⇒ Object
Returns the value of attribute inventory_path.
7 8 9 |
# File 'lib/vagrant-ansible-local/config.rb', line 7 def inventory_path @inventory_path end |
#limit ⇒ Object
Returns the value of attribute limit.
9 10 11 |
# File 'lib/vagrant-ansible-local/config.rb', line 9 def limit @limit end |
#playbook ⇒ Object
Returns the value of attribute playbook.
4 5 6 |
# File 'lib/vagrant-ansible-local/config.rb', line 4 def playbook @playbook end |
#privileged ⇒ Object
Returns the value of attribute privileged.
10 11 12 |
# File 'lib/vagrant-ansible-local/config.rb', line 10 def privileged @privileged end |
#raw_arguments ⇒ Object
Joker attribute, used to pass unsupported arguments to ansible anyway
20 21 22 |
# File 'lib/vagrant-ansible-local/config.rb', line 20 def raw_arguments @raw_arguments end |
#skip_tags ⇒ Object
Returns the value of attribute skip_tags.
15 16 17 |
# File 'lib/vagrant-ansible-local/config.rb', line 15 def @skip_tags end |
#start_at_task ⇒ Object
Returns the value of attribute start_at_task.
16 17 18 |
# File 'lib/vagrant-ansible-local/config.rb', line 16 def start_at_task @start_at_task end |
#sudo ⇒ Object
Returns the value of attribute sudo.
11 12 13 |
# File 'lib/vagrant-ansible-local/config.rb', line 11 def sudo @sudo end |
#sudo_user ⇒ Object
Returns the value of attribute sudo_user.
12 13 14 |
# File 'lib/vagrant-ansible-local/config.rb', line 12 def sudo_user @sudo_user end |
#tags ⇒ Object
Returns the value of attribute tags.
14 15 16 |
# File 'lib/vagrant-ansible-local/config.rb', line 14 def @tags end |
#verbose ⇒ Object
Returns the value of attribute verbose.
13 14 15 |
# File 'lib/vagrant-ansible-local/config.rb', line 13 def verbose @verbose end |
Instance Method Details
#finalize! ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/vagrant-ansible-local/config.rb', line 42 def finalize! super @playbook = nil if @playbook == UNSET_VALUE @guest_folder = "/tmp/vagrant-ansible-local" if @guest_folder == 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 @privileged = nil if @privileged == 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 if @extra_vars && @extra_vars.is_a?(Hash) @extra_vars.each do |k, v| @extra_vars[k] = v.to_s end end end |
#validate(machine) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/vagrant-ansible-local/config.rb', line 68 def validate(machine) errors = _detected_errors # Validate that a playbook path was provided if !playbook errors << I18n.t("vagrant.provisioners.ansible.no_playbook") end # Validate the existence of said playbook on the host if playbook = Pathname.new(playbook).(machine.env.root_path) if !.file? errors << I18n.t("vagrant.provisioners.ansible.playbook_path_invalid", :path => ) end end # Validate that extra_vars is a hash, if set if extra_vars if !extra_vars.kind_of?(Hash) errors << I18n.t("vagrant.provisioners.ansible.extra_vars_not_hash") end end # Validate the existence of the inventory_path, if specified if inventory_path = Pathname.new(inventory_path).(machine.env.root_path) if !.exist? errors << I18n.t("vagrant.provisioners.ansible.inventory_path_invalid", :path => ) end end { "ansible-local provisioner" => errors } end |