class Shelter::Ansible::Inventory

Ansible Inventory representation

Public Class Methods

new() click to toggle source
  # File lib/ansible/inventory.rb
7 def initialize
8   @inv = {}
9 end

Public Instance Methods

add_group_vars(group, vars) click to toggle source
   # File lib/ansible/inventory.rb
11 def add_group_vars(group, vars)
12   @inv[group] ||= { hosts: [], vars: {} }
13   @inv[group][:vars].merge! vars
14 end
add_server(group, ip, vars: {}) click to toggle source
   # File lib/ansible/inventory.rb
16 def add_server(group, ip, vars: {})
17   @inv[group] ||= { hosts: [], vars: {} }
18 
19   @inv[group][:hosts] << ip
20   @inv[group][:vars].merge!(vars)
21 end
to_json() click to toggle source
   # File lib/ansible/inventory.rb
23 def to_json
24   @inv.to_json
25 end