Add install_repoquery parameter to the yum module
This commit is contained in:
parent
607e66fb27
commit
6d63780ad6
1 changed files with 25 additions and 0 deletions
|
@ -94,6 +94,16 @@ options:
|
|||
default: "no"
|
||||
choices: ["yes", "no"]
|
||||
aliases: []
|
||||
|
||||
install_repoquery:
|
||||
description:
|
||||
- If repoquery is not available, install yum-utils
|
||||
required: false
|
||||
version_added: "1.5"
|
||||
default: no
|
||||
choices: ["yes", "no"]
|
||||
aliaes: []
|
||||
|
||||
notes: []
|
||||
# informational: requirements for nodes
|
||||
requirements: [ yum, rpm ]
|
||||
|
@ -154,6 +164,17 @@ def yum_base(conf_file=None, cachedir=False):
|
|||
|
||||
return my
|
||||
|
||||
def install_yum_utils(module):
|
||||
|
||||
if not module.check_mode:
|
||||
yum_path = module.get_bin_path('yum')
|
||||
if yum_path:
|
||||
rc, so, se = module.run_command('%s -y install yum-utils' % yum_path)
|
||||
if rc == 0:
|
||||
this_path = module.get_bin_path('repoquery')
|
||||
global repoquery
|
||||
repoquery = this_path
|
||||
|
||||
def po_to_nevra(po):
|
||||
|
||||
if hasattr(po, 'ui_nevra'):
|
||||
|
@ -789,6 +810,7 @@ def main():
|
|||
list=dict(),
|
||||
conf_file=dict(default=None),
|
||||
disable_gpg_check=dict(required=False, default="no", type='bool'),
|
||||
install_repoquery=dict(required=False, default="no", type='bool'),
|
||||
),
|
||||
required_one_of = [['name','list']],
|
||||
mutually_exclusive = [['name','list']],
|
||||
|
@ -797,6 +819,9 @@ def main():
|
|||
|
||||
params = module.params
|
||||
|
||||
if params.install_repoquery and not repoquery and not module.check_mode:
|
||||
install_yum_utils(module)
|
||||
|
||||
if params['list']:
|
||||
if not repoquery:
|
||||
module.fail_json(msg="repoquery is required to use list= with this module. Please install the yum-utils package.")
|
||||
|
|
Loading…
Reference in a new issue