mirror of
https://github.com/ansible/awx.git
synced 2026-03-01 08:48:46 -03:30
Improvements to the package scanner
* Support Amazon (because it's RH based) * Switch to using module_utils's get_distribution() method for more efficient distro detection
This commit is contained in:
@@ -72,14 +72,18 @@ def main():
|
|||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec = dict())
|
argument_spec = dict())
|
||||||
|
|
||||||
packages = []
|
ans_dist = get_distribution()
|
||||||
# TODO: module_utils/basic.py in ansible contains get_distribution() and get_distribution_version()
|
if ans_dist in ('Centos', 'Centos linux', 'Red hat enterprise linux server', 'Amazon'):
|
||||||
# which can be used here and is accessible by this script instead of this basic detector.
|
|
||||||
if os.path.exists("/etc/redhat-release"):
|
|
||||||
packages = rpm_package_list()
|
packages = rpm_package_list()
|
||||||
elif os.path.exists("/etc/os-release"):
|
elif ans_dist in ('Ubuntu'):
|
||||||
packages = deb_package_list()
|
packages = deb_package_list()
|
||||||
results = dict(ansible_facts=dict(packages=packages))
|
else:
|
||||||
|
packages = None
|
||||||
|
|
||||||
|
if packages is not None:
|
||||||
|
results = dict(ansible_facts=dict(packages=packages))
|
||||||
|
else:
|
||||||
|
results = dict(skipped=True, msg="Unsupported Distribution")
|
||||||
module.exit_json(**results)
|
module.exit_json(**results)
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user