class QB::Ansible::ConfigFile
A parse of an `ansible.cfg` file, extending {ParseConfig}.
We need these to read role path and other Ansible variables so we can setup paths correctly.
Constants
- FILE_NAME
The “well-known” name we look for.
Attributes
rel_root[R]
@!attribute [r] rel_root
@return [Pathname] Absolute path to the directory `ansible.cfg` is in; used as the root for relative paths found in there.
Public Class Methods
end_with_config_file?(file_path)
click to toggle source
Test if a file path looks like it points to an Ansible config file - a file with {FILE_NAME} as the basename.
*Explicitly does not check if the file actually exists and is a file.* This is because we need this test to differentiate role search path elements that are meant to point to Ansible config files from those that aren't in {QB::Role.search_path}.
@param [String, Pathname] file_path
@return [Boolean]
`true` if `path`'s basename is {FILE_NAME}.
# File lib/qb/ansible/config_file.rb, line 111 def self.end_with_config_file? file_path File.basename(file_path).to_s == FILE_NAME end
new(path)
click to toggle source
Instantiate a new `QB::Ansible::ConfigFile`.
Calls superclass method
# File lib/qb/ansible/config_file.rb, line 130 def initialize path super path @rel_root = QB::Util.resolve(path).dirname end
Public Instance Methods
defaults()
click to toggle source
@todo Document defaults method.
@return [QB::Ansible::ConfigFile::Defaults]
@todo Document return value.
# File lib/qb/ansible/config_file.rb, line 144 def defaults Defaults.new (self['defaults'] || {}), rel_root: @rel_root end