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
02d78459
Commit
02d78459
authored
May 15, 2015
by
Till Maas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
facts: Simplify ssh key fetching
parent
e7846343
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
27 deletions
+10
-27
lib/ansible/module_utils/facts.py
+10
-27
No files found.
lib/ansible/module_utils/facts.py
View file @
02d78459
...
...
@@ -471,36 +471,19 @@ class Facts(object):
pass
def
get_public_ssh_host_keys
(
self
):
dsa_filename
=
'/etc/ssh/ssh_host_dsa_key.pub'
rsa_filename
=
'/etc/ssh/ssh_host_rsa_key.pub'
ecdsa_filename
=
'/etc/ssh/ssh_host_ecdsa_key.pub'
ed25519_filename
=
'/etc/ssh/ssh_host_ed25519_key.pub'
keytypes
=
(
'dsa'
,
'rsa'
,
'ecdsa'
,
'ed25519'
)
if
self
.
facts
[
'system'
]
==
'Darwin'
:
dsa_filename
=
'/etc/ssh_host_dsa_key.pub'
rsa_filename
=
'/etc/ssh_host_rsa_key.pub'
ecdsa_filename
=
'/etc/ssh_host_ecdsa_key.pub'
ed25519_filename
=
'/etc/ssh_host_ed25519_key.pub'
dsa
=
get_file_content
(
dsa_filename
)
rsa
=
get_file_content
(
rsa_filename
)
ecdsa
=
get_file_content
(
ecdsa_filename
)
ed25519
=
get_file_content
(
ed25519_filename
)
if
dsa
is
None
:
dsa
=
'NA'
keydir
=
'/etc'
else
:
self
.
facts
[
'ssh_host_key_dsa_public'
]
=
dsa
.
split
()[
1
]
if
rsa
is
None
:
rsa
=
'NA'
else
:
self
.
facts
[
'ssh_host_key_rsa_public'
]
=
rsa
.
split
()[
1
]
if
ecdsa
is
None
:
ecdsa
=
'NA'
else
:
self
.
facts
[
'ssh_host_key_ecdsa_public'
]
=
ecdsa
.
split
()[
1
]
if
ed25519
is
None
:
ed25519
=
'NA'
else
:
self
.
facts
[
'ssh_host_key_ed25519_public'
]
=
ed25519
.
split
()[
1
]
keydir
=
'/etc/ssh'
for
type_
in
keytypes
:
key_filename
=
'
%
s/ssh_host_
%
s_key.pub'
%
(
keydir
,
type_
)
keydata
=
get_file_content
(
key_filename
)
if
keydata
is
not
None
:
factname
=
'ssh_host_key_
%
s_public'
%
type_
self
.
facts
[
factname
]
=
keydata
.
split
()[
1
]
def
get_pkg_mgr_facts
(
self
):
self
.
facts
[
'pkg_mgr'
]
=
'unknown'
...
...
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