community.general/lib/ansible/modules/packaging/os/package.py

61 lines
1.9 KiB
Python
Raw Normal View History

2015-06-09 00:12:10 +00:00
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Ansible Project
2015-06-09 00:12:10 +00:00
#
# 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
2015-06-09 00:12:10 +00:00
2017-08-16 03:16:38 +00:00
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'core'}
2016-12-06 10:35:05 +00:00
2015-06-09 00:12:10 +00:00
DOCUMENTATION = '''
---
module: package
version_added: 2.0
2015-07-16 20:52:56 +00:00
author:
- Ansible Inc
2015-06-09 00:12:10 +00:00
short_description: Generic OS package manager
description:
- Installs, upgrade and removes packages using the underlying OS package manager.
- For Windows targets, use the M(win_package) module instead.
2015-06-09 00:12:10 +00:00
options:
name:
description:
2015-08-13 18:56:15 +00:00
- "Package name, or package specifier with version, like C(name-1.0)."
- "Be aware that packages are not always named the same and this module will not 'translate' them per distro."
2015-06-09 00:12:10 +00:00
required: true
state:
description:
2017-10-31 16:46:00 +00:00
- Whether to install (C(present), or remove (C(absent)) a package. Other states depend on the underlying package module, i.e C(latest).
2015-06-09 00:12:10 +00:00
required: true
2015-07-16 20:52:56 +00:00
use:
description:
- The required package manager module to use (yum, apt, etc). The default 'auto' will use existing facts or try to autodetect it.
2015-08-13 18:56:15 +00:00
- You should only use this field if the automatic selection is not working for some reason.
2015-07-16 20:52:56 +00:00
required: false
default: auto
2015-06-09 00:12:10 +00:00
requirements:
- Whatever is required for the package plugins specific for each system.
notes:
- This module actually calls the pertinent package modules for each system (apt, yum, etc).
- For Windows targets, use the M(win_package) module instead.
2015-06-09 00:12:10 +00:00
'''
EXAMPLES = '''
2017-10-31 16:46:00 +00:00
- name: install ntpdate
package:
name: ntpdate
2017-10-31 16:46:00 +00:00
state: present
2015-06-09 00:12:10 +00:00
2015-06-09 00:25:39 +00:00
# This uses a variable as this changes per distribution.
- name: remove the apache package
package:
name: "{{ apache }}"
state: absent
2015-06-09 00:12:10 +00:00
'''