diff --git a/lib/ansible/modules/packaging/os/yum.py b/lib/ansible/modules/packaging/os/yum.py index bc1cacfea13..5ce456b8cd8 100644 --- a/lib/ansible/modules/packaging/os/yum.py +++ b/lib/ansible/modules/packaging/os/yum.py @@ -1,21 +1,19 @@ #!/usr/bin/python -tt # -*- coding: utf-8 -*- -# (c) 2012, Red Hat, Inc +# Copyright: (c) 2012, Red Hat, Inc # Written by Seth Vidal -# (c) 2014, Epic Games, Inc. -# +# Copyright: (c) 2014, Epic Games, Inc. + # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type - ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['stableinterface'], 'supported_by': 'core'} - DOCUMENTATION = ''' --- module: yum @@ -35,110 +33,78 @@ options: several packages this can accept a comma separated list of packages or (as of 2.0) a list of packages. required: true - default: null - aliases: [ 'pkg' ] + aliases: [ pkg ] exclude: description: - "Package name(s) to exclude when state=present, or latest" - required: false version_added: "2.0" - default: null list: description: - "Package name to run the equivalent of yum list against. In addition to listing packages, use can also list the following: C(installed), C(updates), C(available) and C(repos)." - required: false - default: null state: description: - Whether to install (C(present) or C(installed), C(latest)), or remove (C(absent) or C(removed)) a package. - required: false - choices: [ "present", "installed", "latest", "absent", "removed" ] - default: "present" + choices: [ absent, installed, latest, present, removed ] + default: present enablerepo: description: - I(Repoid) of repositories to enable for the install/update operation. These repos will not persist beyond the transaction. When specifying multiple repos, separate them with a ",". - required: false version_added: "0.9" - default: null - aliases: [] - disablerepo: description: - I(Repoid) of repositories to disable for the install/update operation. These repos will not persist beyond the transaction. When specifying multiple repos, separate them with a ",". - required: false version_added: "0.9" - default: null - aliases: [] - conf_file: description: - The remote yum configuration file to use for the transaction. - required: false version_added: "0.6" - default: null - aliases: [] - disable_gpg_check: description: - Whether to disable the GPG checking of signatures of packages being installed. Has an effect only if state is I(present) or I(latest). - required: false - version_added: "1.2" + type: bool default: "no" - choices: ["yes", "no"] - aliases: [] - + version_added: "1.2" skip_broken: description: - Resolve depsolve problems by removing packages that are causing problems from the transā€ action. - required: false - version_added: "2.3" + type: bool default: "no" - choices: ["yes", "no"] - aliases: [] - + version_added: "2.3" update_cache: description: - Force yum to check if cache is out of date and redownload if needed. Has an effect only if state is I(present) or I(latest). - required: false - version_added: "1.9" + type: bool default: "no" - choices: ["yes", "no"] - aliases: [ "expire-cache" ] - + aliases: [ expire-cache ] + version_added: "1.9" validate_certs: description: - This only applies if using a https url as the source of the rpm. e.g. for localinstall. If set to C(no), the SSL certificates will not be validated. - This should only set to C(no) used on personally controlled sites using self-signed certificates as it avoids verifying the source site. - Prior to 2.1 the code worked as if this was set to C(yes). - required: false + type: bool default: "yes" - choices: ["yes", "no"] version_added: "2.1" - installroot: description: - Specifies an alternative installroot, relative to which all packages will be installed. - required: false - version_added: "2.3" default: "/" - aliases: [] - + version_added: "2.3" security: description: - If set to C(yes), and C(state=latest) then only installs updates that have been marked security related. + type: bool default: "no" - choices: ["yes", "no"] version_added: "2.4" - allow_downgrade: description: - Specify if the named package and version is allowed to downgrade @@ -149,11 +115,9 @@ options: packages to install (because dependencies between the downgraded package and others can cause changes to the packages which were in the earlier transaction). - required: false + type: bool default: "no" - choices: ["yes", "no"] version_added: "2.4" - notes: - When used with a loop of package names in a playbook, ansible optimizes the call to the yum module. Instead of calling the module with a single @@ -177,13 +141,14 @@ notes: Use the "yum group list" command to see which category of group the group you want to install falls into.' # informational: requirements for nodes -requirements: [ yum ] +requirements: +- yum author: - - "Ansible Core Team" - - "Seth Vidal" - - "Eduard Snesarev (github.com/verm666)" - - "Berend De Schouwer (github.com/berenddeschouwer)" - - "Abhijeet Kasurde (github.com/akasurde)" + - Ansible Core Team + - Seth Vidal + - Eduard Snesarev (github.com/verm666) + - Berend De Schouwer (github.com/berenddeschouwer) + - Abhijeet Kasurde (github.com/akasurde) ''' EXAMPLES = ''' @@ -1252,27 +1217,27 @@ def main(): module = AnsibleModule( argument_spec=dict( - name=dict(aliases=['pkg'], type="list"), - exclude=dict(required=False, default=None), + name=dict(type='list', aliases=['pkg']), + exclude=dict(type='str'), # removed==absent, installed==present, these are accepted as aliases - state=dict(default='installed', choices=['absent', 'present', 'installed', 'removed', 'latest']), - enablerepo=dict(), - disablerepo=dict(), - list=dict(), - conf_file=dict(default=None), - disable_gpg_check=dict(required=False, default="no", type='bool'), - skip_broken=dict(required=False, default="no", aliases=[], type='bool'), - update_cache=dict(required=False, default="no", aliases=['expire-cache'], type='bool'), - validate_certs=dict(required=False, default="yes", type='bool'), - installroot=dict(required=False, default="/", type='str'), + state=dict(type='str', default='installed', choices=['absent', 'installed', 'latest', 'present', 'removed']), + enablerepo=dict(type='str'), + disablerepo=dict(type='str'), + list=dict(type='str'), + conf_file=dict(type='str'), + disable_gpg_check=dict(type='bool', default=False), + skip_broken=dict(type='bool', default=False), + update_cache=dict(type='bool', default=False, aliases=['expire-cache']), + validate_certs=dict(type='bool', default=True), + installroot=dict(type='str', default="/"), # this should not be needed, but exists as a failsafe - install_repoquery=dict(required=False, default="yes", type='bool'), - allow_downgrade=dict(required=False, default="no", type='bool'), - security=dict(default="no", type='bool'), + install_repoquery=dict(type='bool', default=True), + allow_downgrade=dict(type='bool', default=False), + security=dict(type='bool', default=False), ), required_one_of=[['name', 'list']], mutually_exclusive=[['name', 'list']], - supports_check_mode=True + supports_check_mode=True, ) error_msgs = []