summaryrefslogtreecommitdiffstats
path: root/lib/ansible/modules/package.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ansible/modules/package.py')
-rw-r--r--lib/ansible/modules/package.py87
1 files changed, 87 insertions, 0 deletions
diff --git a/lib/ansible/modules/package.py b/lib/ansible/modules/package.py
new file mode 100644
index 0000000..6078739
--- /dev/null
+++ b/lib/ansible/modules/package.py
@@ -0,0 +1,87 @@
+# -*- coding: utf-8 -*-
+
+# (c) 2015, Ansible Project
+#
+# 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
+
+
+DOCUMENTATION = '''
+---
+module: package
+version_added: 2.0
+author:
+ - Ansible Core Team
+short_description: Generic OS package manager
+description:
+ - This modules manages packages on a target without specifying a package manager module (like M(ansible.builtin.yum), M(ansible.builtin.apt), ...).
+ It is convenient to use in an heterogeneous environment of machines without having to create a specific task for
+ each package manager. C(package) calls behind the module for the package manager used by the operating system
+ discovered by the module M(ansible.builtin.setup). If C(setup) was not yet run, C(package) will run it.
+ - This module acts as a proxy to the underlying package manager module. While all arguments will be passed to the
+ underlying module, not all modules support the same arguments. This documentation only covers the minimum intersection
+ of module arguments that all packaging modules support.
+ - For Windows targets, use the M(ansible.windows.win_package) module instead.
+options:
+ name:
+ description:
+ - Package name, or package specifier with version.
+ - Syntax varies with package manager. For example C(name-1.0) or C(name=1.0).
+ - Package names also vary with package manager; this module will not "translate" them per distro. For example C(libyaml-dev), C(libyaml-devel).
+ required: true
+ state:
+ description:
+ - Whether to install (C(present)), or remove (C(absent)) a package.
+ - You can use other states like C(latest) ONLY if they are supported by the underlying package module(s) executed.
+ required: true
+ use:
+ description:
+ - The required package manager module to use (C(yum), C(apt), and so on). The default 'auto' will use existing facts or try to autodetect it.
+ - You should only use this field if the automatic selection is not working for some reason.
+ default: auto
+requirements:
+ - Whatever is required for the package plugins specific for each system.
+extends_documentation_fragment:
+ - action_common_attributes
+ - action_common_attributes.flow
+attributes:
+ action:
+ support: full
+ async:
+ support: full
+ bypass_host_loop:
+ support: none
+ check_mode:
+ details: support depends on the underlying plugin invoked
+ support: N/A
+ diff_mode:
+ details: support depends on the underlying plugin invoked
+ support: N/A
+ platform:
+ details: The support depends on the availability for the specific plugin for each platform and if fact gathering is able to detect it
+ platforms: all
+notes:
+ - While C(package) abstracts package managers to ease dealing with multiple distributions, package name often differs for the same software.
+
+'''
+EXAMPLES = '''
+- name: Install ntpdate
+ ansible.builtin.package:
+ name: ntpdate
+ state: present
+
+# This uses a variable as this changes per distribution.
+- name: Remove the apache package
+ ansible.builtin.package:
+ name: "{{ apache }}"
+ state: absent
+
+- name: Install the latest version of Apache and MariaDB
+ ansible.builtin.package:
+ name:
+ - httpd
+ - mariadb-server
+ state: latest
+'''