mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-23 05:04:56 +09:00
(cherry picked from commit aa0d49fed1)
This commit is contained in:
1 parent
77732df1d7
commit
149bcb3d79
2 files changed
+21
-18
No files matched your search
@@ -1,14 +1,11 @@
|
||||
[defaults]
|
||||
retry_files_enabled = False
|
||||
deprecation_warnings = False
|
||||
retry_files_enabled = False
|
||||
deprecation_warnings = False
|
||||
display_skipped_hosts = False
|
||||
callback_whitelist =
|
||||
stdout_callback = skippy
|
||||
host_key_checking = False
|
||||
remote_user = <%= remote_user %>
|
||||
remote_port = <%= remote_port %>
|
||||
private_key_file = <%= private_key %>
|
||||
roles_path = <%= roles %>
|
||||
callback_whitelist =
|
||||
stdout_callback = skippy
|
||||
host_key_checking = False
|
||||
roles_path = <%= roles %>
|
||||
|
||||
[privilege_escalation]
|
||||
become = yes
|
||||
|
||||
@@ -289,6 +289,20 @@ module OneProvision
|
||||
|
||||
c << "\n"
|
||||
|
||||
c << "[targets]\n"
|
||||
|
||||
hosts.each do |h|
|
||||
h.info
|
||||
|
||||
conn = get_host_template_conn(h)
|
||||
|
||||
c << "#{h['NAME']} "
|
||||
c << 'ansible_connection=ssh '
|
||||
c << "ansible_ssh_private_key_file=#{conn['private_key']} "
|
||||
c << "ansible_user=#{conn['remote_user']} "
|
||||
c << "ansible_port=#{conn['remote_port']}\n"
|
||||
end
|
||||
|
||||
Driver.write_file_log("#{ansible_dir}/inventory", c)
|
||||
|
||||
# Generate "host_vars" directory
|
||||
@@ -315,18 +329,10 @@ module OneProvision
|
||||
# TODO: what if private_key isn't filename, but content
|
||||
# TODO: store private key / packet
|
||||
# credentials securely in the ONE
|
||||
ruser = hosts[0]['TEMPLATE/PROVISION_CONNECTION/REMOTE_USER']
|
||||
rport = hosts[0]['TEMPLATE/PROVISION_CONNECTION/REMOTE_PORT']
|
||||
prkey = hosts[0]['TEMPLATE/PROVISION_CONNECTION/PRIVATE_KEY']
|
||||
roles = "#{ANSIBLE_LOCATION}/roles"
|
||||
|
||||
vals = { :remote_user => ruser,
|
||||
:remote_port => rport,
|
||||
:private_key => prkey,
|
||||
:roles => roles }
|
||||
|
||||
c = File.read("#{ANSIBLE_LOCATION}/ansible.cfg.erb")
|
||||
c = ERBVal.render_from_hash(c, vals)
|
||||
c = ERBVal.render_from_hash(c, :roles => roles)
|
||||
|
||||
Driver.write_file_log("#{ansible_dir}/ansible.cfg", c)
|
||||
|
||||
|
||||
Reference in new issue
Block a user