Class: ForemanAnsible::AnsibleInfo

Inherits:
HostInfo::Provider
  • Object
show all
Defined in:
app/services/foreman_ansible/ansible_info.rb

Instance Method Summary collapse

Instance Method Details

#ansible_paramsObject



7
8
9
10
11
12
13
14
15
16
# File 'app/services/foreman_ansible/ansible_info.rb', line 7

def ansible_params
  variables = AnsibleVariable.where(:ansible_role_id => host.all_ansible_roles.pluck(:id), :override => true)
  values = variables.values_hash(host)

  variables.each_with_object({}) do |var, memo|
    value = values[var]
    memo[var.key] = value unless value.nil?
    memo
  end
end

#host_infoObject



3
4
5
# File 'app/services/foreman_ansible/ansible_info.rb', line 3

def host_info
  { 'parameters' => ansible_params }
end