PATH:
usr
/
lib
/
python3.9
/
site-packages
/
ansible
/
modules
# -*- mode: python -*- # Copyright: (c) 2012, Jeroen Hoekx (@jhoekx) # Copyright: Ansible Team # 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 = r''' --- module: group_by short_description: Create Ansible groups based on facts extends_documentation_fragment: - action_common_attributes - action_common_attributes.conn - action_common_attributes.flow - action_core description: - Use facts to create ad-hoc groups that can be used later in a playbook. - This module is also supported for Windows targets. version_added: "0.9" options: key: description: - The variables whose values will be used as groups. type: str required: true parents: description: - The list of the parent groups. type: list elements: str default: all version_added: "2.4" attributes: action: support: full become: support: none bypass_host_loop: support: full bypass_task_loop: support: none check_mode: details: While this makes no changes to target systems the 'in memory' inventory will still be altered support: partial core: details: While parts of this action are implemented in core, other parts are still available as normal plugins and can be partially overridden support: partial connection: support: none delegation: support: none diff_mode: support: none platform: platforms: all notes: - Spaces in group names are converted to dashes '-'. - Though this module does not change the remote host, we do provide 'changed' status as it can be useful for those trying to track inventory changes. seealso: - module: ansible.builtin.add_host author: - Jeroen Hoekx (@jhoekx) ''' EXAMPLES = r''' - name: Create groups based on the machine architecture ansible.builtin.group_by: key: machine_{{ ansible_machine }} - name: Create groups like 'virt_kvm_host' ansible.builtin.group_by: key: virt_{{ ansible_virtualization_type }}_{{ ansible_virtualization_role }} - name: Create nested groups ansible.builtin.group_by: key: el{{ ansible_distribution_major_version }}-{{ ansible_architecture }} parents: - el{{ ansible_distribution_major_version }} - name: Add all active hosts to a static group ansible.builtin.group_by: key: done '''
[-] getent.py
[edit]
[-] pause.py
[edit]
[-] iptables.py
[edit]
[+]
__pycache__
[-] import_playbook.py
[edit]
[-] stat.py
[edit]
[-] copy.py
[edit]
[-] slurp.py
[edit]
[-] service_facts.py
[edit]
[-] fetch.py
[edit]
[-] tempfile.py
[edit]
[-] pip.py
[edit]
[-] yum_repository.py
[edit]
[-] _include.py
[edit]
[-] assemble.py
[edit]
[-] user.py
[edit]
[-] sysvinit.py
[edit]
[-] lineinfile.py
[edit]
[-] find.py
[edit]
[-] replace.py
[edit]
[-] blockinfile.py
[edit]
[-] meta.py
[edit]
[-] hostname.py
[edit]
[-] reboot.py
[edit]
[-] shell.py
[edit]
[-] uri.py
[edit]
[-] script.py
[edit]
[-] async_status.py
[edit]
[-] include_vars.py
[edit]
[-] apt_repository.py
[edit]
[-] ping.py
[edit]
[-] expect.py
[edit]
[-] import_tasks.py
[edit]
[-] known_hosts.py
[edit]
[-] include_role.py
[edit]
[-] apt_key.py
[edit]
[-] apt.py
[edit]
[-] command.py
[edit]
[-] assert.py
[edit]
[-] subversion.py
[edit]
[-] cron.py
[edit]
[-] validate_argument_spec.py
[edit]
[-] wait_for.py
[edit]
[-] wait_for_connection.py
[edit]
[-] package.py
[edit]
[-] systemd.py
[edit]
[-] get_url.py
[edit]
[-] import_role.py
[edit]
[-] set_fact.py
[edit]
[-] group_by.py
[edit]
[-] yum.py
[edit]
[-] set_stats.py
[edit]
[-] dpkg_selections.py
[edit]
[-] add_host.py
[edit]
[-] fail.py
[edit]
[-] debug.py
[edit]
[-] debconf.py
[edit]
[-] setup.py
[edit]
[-] rpm_key.py
[edit]
[-] service.py
[edit]
[-] gather_facts.py
[edit]
[-] git.py
[edit]
[-] unarchive.py
[edit]
[-] include_tasks.py
[edit]
[+]
..
[-] async_wrapper.py
[edit]
[-] systemd_service.py
[edit]
[-] template.py
[edit]
[-] package_facts.py
[edit]
[-] raw.py
[edit]
[-] group.py
[edit]
[-] dnf.py
[edit]
[-] __init__.py
[edit]
[-] file.py
[edit]