Skip to content

Commit

Permalink
fixes #20407 - incorporates feedback from pull request
Browse files Browse the repository at this point in the history
 - Removes host_become & host_private_key_file
 - Left settings in Ansible Settings module
 - Reverted ansible_ssh_pass to default parameter (as it was
   prior to pull request)
  • Loading branch information
mriedel-pgdx committed Aug 1, 2017
1 parent e6ebeeb commit 7619263
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions app/services/foreman_ansible/inventory_creator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,9 @@ def connection_params(host)
'ansible_user' => host_user(host),
'ansible_become' => host_become(host),
'ansible_connection' => connection_type(host),
'ansible_ssh_pass' => host_ssh_pass(host),
'ansible_winrm_server_cert_validation' => winrm_cert_validation(host)
}
# Check if private_key is defined, if it is use that. Otherwise
# use ssh_pass
if !host_private_key_file.empty?
params['ansible_ssh_private_key_file'] = host_private_key_file(host)
else
params['ansible_ssh_pass'] = host_ssh_pass(host)
end
# Backward compatibility for Ansible 1.x
params['ansible_ssh_port'] = params['ansible_port']
params['ansible_ssh_user'] = params['ansible_user']
Expand Down Expand Up @@ -84,19 +78,10 @@ def host_user(host)
host.host_params['ansible_user'] || Setting[:ansible_user]
end

def host_become(host)
host.host_params['ansible_become'] || Setting[:ansible_become]
end

def host_ssh_pass(host)
host.host_params['ansible_ssh_pass'] || Setting[:ansible_ssh_pass]
end

def host_private_key_file(host)
host.host_params['ansible_ssh_private_key_file'] ||
Setting[:ansible_ssh_private_key_file]
end

private

def render_rabl(host, template)
Expand Down

0 comments on commit 7619263

Please sign in to comment.