Module: Ansible::Config

Included in:
Ansible, AdHoc, Playbook
Defined in:
lib/ansible/config.rb

Defined Under Namespace

Classes: DefaultConfig

Constant Summary collapse

PATH =
'lib/ansible/'
IP_OR_HOSTNAME =
/((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3})$|^((([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9]))/
SKIP_HOSTVARS =
%w(ansible_version inventory_dir inventory_file inventory_hostname inventory_hostname_short group_names groups omit playbook_dir)
VERSION =

nil when Ansible not installed

`ansible --version`.split("\n").first.split.last rescue nil

Instance Method Summary collapse

Instance Method Details

#configObject



50
51
52
# File 'lib/ansible/config.rb', line 50

def config
  @config || configure
end

#configure {|@config| ... } ⇒ Object

Yields:



42
43
44
45
46
47
48
# File 'lib/ansible/config.rb', line 42

def configure
  @config ||= DefaultConfig.new
  yield(@config) if block_given?

  # allow chaining if block given
  block_given? ? self : @config
end