Class: Vagrant::Provisioners::Ansible::Config

Inherits:
Config::Base
  • Object
show all
Defined in:
lib/vagrant-ansible/provisioner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



16
17
18
# File 'lib/vagrant-ansible/provisioner.rb', line 16

def initialize
  @options = []
end

Instance Attribute Details

#ask_sudo_passObject

Returns the value of attribute ask_sudo_pass.



13
14
15
# File 'lib/vagrant-ansible/provisioner.rb', line 13

def ask_sudo_pass
  @ask_sudo_pass
end

#hostsObject

Returns the value of attribute hosts.



11
12
13
# File 'lib/vagrant-ansible/provisioner.rb', line 11

def hosts
  @hosts
end

#inventory_fileObject

Returns the value of attribute inventory_file.



12
13
14
# File 'lib/vagrant-ansible/provisioner.rb', line 12

def inventory_file
  @inventory_file
end

#playbookObject

Returns the value of attribute playbook.



10
11
12
# File 'lib/vagrant-ansible/provisioner.rb', line 10

def playbook
  @playbook
end

#sudoObject

Returns the value of attribute sudo.



14
15
16
# File 'lib/vagrant-ansible/provisioner.rb', line 14

def sudo
  @sudo
end

Instance Method Details

#optionsObject



39
40
41
# File 'lib/vagrant-ansible/provisioner.rb', line 39

def options
  @options
end

#options=(*opts) ⇒ Object

Allows for assigning one to many options to pass to ansible-playbook.



31
32
33
34
35
36
37
# File 'lib/vagrant-ansible/provisioner.rb', line 31

def options=(*opts)
  @options = if opts.is_a? String
    [opts]
  else
    opts
  end
end

#validate(env, errors) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/vagrant-ansible/provisioner.rb', line 20

def validate(env, errors)
  # Validate that the parameters are properly set
  if playbook.nil?
    errors.add(I18n.t("vagrant.provisioners.ansible.no_playbook"))
  end
  if hosts.nil? and inventory_file.nil?
    errors.add(I18n.t("vagrant.provisioners.ansible.no_hosts"))
  end
end