Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
a9aab23f
Commit
a9aab23f
authored
Mar 17, 2014
by
patrickheeney
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for hostkey directory
parent
d1753046
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
lib/ansible/module_utils/known_hosts.py
+11
-3
No files found.
lib/ansible/module_utils/known_hosts.py
View file @
a9aab23f
...
@@ -119,13 +119,21 @@ def add_host_key(module, fqdn, key_type="rsa"):
...
@@ -119,13 +119,21 @@ def add_host_key(module, fqdn, key_type="rsa"):
result
=
False
result
=
False
keyscan_cmd
=
module
.
get_bin_path
(
'ssh-keyscan'
,
True
)
keyscan_cmd
=
module
.
get_bin_path
(
'ssh-keyscan'
,
True
)
if
not
os
.
path
.
exists
(
os
.
path
.
expanduser
(
"~/.ssh/"
)):
if
'USER'
in
os
.
environ
:
module
.
fail_json
(
msg
=
"
%
s does not exist"
%
os
.
path
.
expanduser
(
"~/.ssh/"
))
user_ssh_dir
=
os
.
path
.
expandvars
(
"~${USER}/.ssh/"
)
user_host_file
=
os
.
path
.
expandvars
(
"~${USER}/.ssh/known_hosts"
)
else
:
user_ssh_dir
=
"~/.ssh/"
user_host_file
=
"~/.ssh/known_hosts"
user_ssh_dir
=
os
.
path
.
expanduser
(
user_ssh_dir
)
if
not
os
.
path
.
exists
(
user_ssh_dir
):
module
.
fail_json
(
msg
=
"
%
s does not exist"
%
user_ssh_dir
)
this_cmd
=
"
%
s -t
%
s
%
s"
%
(
keyscan_cmd
,
key_type
,
fqdn
)
this_cmd
=
"
%
s -t
%
s
%
s"
%
(
keyscan_cmd
,
key_type
,
fqdn
)
rc
,
out
,
err
=
module
.
run_command
(
this_cmd
)
rc
,
out
,
err
=
module
.
run_command
(
this_cmd
)
module
.
append_to_file
(
"~/.ssh/known_hosts"
,
out
)
module
.
append_to_file
(
user_host_file
,
out
)
return
rc
,
out
,
err
return
rc
,
out
,
err
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment