Add some FreeBSD facts
added: * ansible_distribution * ansible_distribution_release * ansible_distribution_version * ansible_os_family * ansible_pkg_mgr * ansible_ssh_host_key_ecdsa_public Also adds ECDSA public key for all plaforms.
This commit is contained in:
parent
344257481d
commit
626cbc4e8b
1 changed files with 14 additions and 1 deletions
15
system/setup
15
system/setup
|
@ -121,6 +121,7 @@ class Facts(object):
|
||||||
{ 'path' : '/opt/local/bin/pkgin', 'name' : 'pkgin' },
|
{ 'path' : '/opt/local/bin/pkgin', 'name' : 'pkgin' },
|
||||||
{ 'path' : '/opt/local/bin/port', 'name' : 'macports' },
|
{ 'path' : '/opt/local/bin/port', 'name' : 'macports' },
|
||||||
{ 'path' : '/sbin/apk', 'name' : 'apk' },
|
{ 'path' : '/sbin/apk', 'name' : 'apk' },
|
||||||
|
{ 'path' : '/usr/sbin/pkg', 'name' : 'pkgng' },
|
||||||
]
|
]
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -175,7 +176,8 @@ class Facts(object):
|
||||||
SLED = 'Suse', OpenSuSE = 'Suse', SuSE = 'Suse', Gentoo = 'Gentoo',
|
SLED = 'Suse', OpenSuSE = 'Suse', SuSE = 'Suse', Gentoo = 'Gentoo',
|
||||||
Archlinux = 'Archlinux', Mandriva = 'Mandrake', Mandrake = 'Mandrake',
|
Archlinux = 'Archlinux', Mandriva = 'Mandrake', Mandrake = 'Mandrake',
|
||||||
Solaris = 'Solaris', Nexenta = 'Solaris', OmniOS = 'Solaris', OpenIndiana = 'Solaris',
|
Solaris = 'Solaris', Nexenta = 'Solaris', OmniOS = 'Solaris', OpenIndiana = 'Solaris',
|
||||||
SmartOS = 'Solaris', AIX = 'AIX', Alpine = 'Alpine', MacOSX = 'Darwin'
|
SmartOS = 'Solaris', AIX = 'AIX', Alpine = 'Alpine', MacOSX = 'Darwin',
|
||||||
|
FreeBSD = 'FreeBSD'
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.facts['system'] == 'AIX':
|
if self.facts['system'] == 'AIX':
|
||||||
|
@ -189,6 +191,10 @@ class Facts(object):
|
||||||
rc, out, err = module.run_command("/usr/bin/sw_vers -productVersion")
|
rc, out, err = module.run_command("/usr/bin/sw_vers -productVersion")
|
||||||
data = out.split()[-1]
|
data = out.split()[-1]
|
||||||
self.facts['distribution_version'] = data
|
self.facts['distribution_version'] = data
|
||||||
|
elif self.facts['system'] == 'FreeBSD':
|
||||||
|
self.facts['distribution'] = 'FreeBSD'
|
||||||
|
self.facts['distribution_release'] = platform.release()
|
||||||
|
self.facts['distribution_version'] = platform.version()
|
||||||
else:
|
else:
|
||||||
dist = platform.dist()
|
dist = platform.dist()
|
||||||
self.facts['distribution'] = dist[0].capitalize() or 'NA'
|
self.facts['distribution'] = dist[0].capitalize() or 'NA'
|
||||||
|
@ -245,12 +251,15 @@ class Facts(object):
|
||||||
def get_public_ssh_host_keys(self):
|
def get_public_ssh_host_keys(self):
|
||||||
dsa_filename = '/etc/ssh/ssh_host_dsa_key.pub'
|
dsa_filename = '/etc/ssh/ssh_host_dsa_key.pub'
|
||||||
rsa_filename = '/etc/ssh/ssh_host_rsa_key.pub'
|
rsa_filename = '/etc/ssh/ssh_host_rsa_key.pub'
|
||||||
|
ecdsa_filename = '/etc/ssh/ssh_host_ecdsa_key.pub'
|
||||||
|
|
||||||
if self.facts['system'] == 'Darwin':
|
if self.facts['system'] == 'Darwin':
|
||||||
dsa_filename = '/etc/ssh_host_dsa_key.pub'
|
dsa_filename = '/etc/ssh_host_dsa_key.pub'
|
||||||
rsa_filename = '/etc/ssh_host_rsa_key.pub'
|
rsa_filename = '/etc/ssh_host_rsa_key.pub'
|
||||||
|
ecdsa_filename = '/etc/ssh_host_ecdsa_key.pub'
|
||||||
dsa = get_file_content(dsa_filename)
|
dsa = get_file_content(dsa_filename)
|
||||||
rsa = get_file_content(rsa_filename)
|
rsa = get_file_content(rsa_filename)
|
||||||
|
ecdsa = get_file_content(ecdsa_filename)
|
||||||
if dsa is None:
|
if dsa is None:
|
||||||
dsa = 'NA'
|
dsa = 'NA'
|
||||||
else:
|
else:
|
||||||
|
@ -259,6 +268,10 @@ class Facts(object):
|
||||||
rsa = 'NA'
|
rsa = 'NA'
|
||||||
else:
|
else:
|
||||||
self.facts['ssh_host_key_rsa_public'] = rsa.split()[1]
|
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]
|
||||||
|
|
||||||
def get_pkg_mgr_facts(self):
|
def get_pkg_mgr_facts(self):
|
||||||
self.facts['pkg_mgr'] = 'unknown'
|
self.facts['pkg_mgr'] = 'unknown'
|
||||||
|
|
Loading…
Add table
Reference in a new issue