zabbix.zabbix.zabbix_inventory (1.3.6) — inventory

Zabbix inventory plugin

Authors: Zabbix Ltd (@zabbix)

Install collection

Install with ansible-galaxy collection install zabbix.zabbix:==1.3.6


Add to requirements.yml

  collections:
    - name: zabbix.zabbix
      version: 1.3.6

Description

This plugin is designed to work with Zabbix API.

This inventory plugin allows Ansible users to generate a dynamic inventory based on data from Zabbix installation.

Using the available filtering methods, the user can specify the search criteria for hosts in Zabbix, as well as limit the set of returned fields.

Inputs

    
cache:
    default: false
    description:
    - Toggle to enable/disable the caching of the inventory's source data, requires a
      cache plugin setup to work.
    env:
    - name: ANSIBLE_INVENTORY_CACHE
    ini:
    - key: cache
      section: inventory
    type: bool

query:
    default: {}
    description:
    - Additional parameters for getting linked objects for the host.
    - List of available fields depends on Zabbix version.
    - Available query for Zabbix 6.0
    - selectDiscoveries, selectDiscoveryRule, selectGraphs, selectHostDiscovery, selectGroups,
      selectHttpTests, selectInterfaces, selectInventory, selectItems, selectMacros, selectParentTemplates,
      selectDashboards, selectTags, selectInheritedTags, selectTriggers, selectValueMaps.
    - In Zabbix 6.4 selectGroups was deprecated. Please use selectHostGroups instead.
    - See also U(https://www.zabbix.com/documentation/current/en/manual/api/reference/host/get#parameters)
    type: dict

filter:
    default: {}
    description:
    - The parameter is used to select hosts in Zabbix. Each parameter refines the search.
    - For multiple parameters, 'AND' logic is applied.
    - If you specify host groups and templates, this means a host that both is a member
      of any of the specified host groups and has any of the specified templates will
      be found.
    suboptions:
      host:
        description:
        - List of host names (technical names) for host search in Zabbix.
        - Will return hosts that match the given technical host names.
        - Wildcard search is possible.
        - Case-sensitive search.
        elements: str
        type: list
      hostgroups:
        description:
        - List of host groups for host search in Zabbix.
        - Will return hosts that are linked to the given host groups.
        - Wildcard search is possible.
        - Case-sensitive search.
        elements: str
        type: list
      name:
        description:
        - List of host names (visible names) for host search in Zabbix.
        - Will return hosts that match the given visible host names.
        - Wildcard search is possible.
        - Case-sensitive search.
        elements: str
        type: list
      proxy:
        description:
        - List of proxies for host search in Zabbix.
        - Will return hosts that are linked to the given proxies.
        - Wildcard search is possible.
        - Case-sensitive search.
        elements: str
        type: list
      status:
        choices:
        - enabled
        - disabled
        description:
        - Desired host status for host search in Zabbix.
        - Can be only 'enabled' or 'disabled'.
        type: str
      tags:
        description:
        - List of tags for host search in Zabbix.
        - For multiple tags, the logic to be applied is determined by 'tags_behavior'
          parameter
        elements: dict
        suboptions:
          operator:
            choices:
            - contains
            - equals
            - not like
            - not equal
            - exists
            - not exists
            default: contains
            description: Mode of searching by tags.
            type: str
          tag:
            description: Tag name for host search in Zabbix.
            required: true
            type: str
          value:
            default: ''
            description: Tag value for host search in Zabbix.
            type: str
        type: list
      tags_behavior:
        choices:
        - and/or
        - or
        default: and/or
        description:
        - Desired logic for searching by tags.
        - This parameter impacts the logic of searching by tags.
        - Specify the logic of searching by multiple tags.
        type: str
      templates:
        description:
        - List of templates for host search in Zabbix.
        - Will return hosts that are linked to the given templates.
        - Wildcard search is possible.
        - Case-sensitive search.
        elements: str
        type: list
    type: dict

groups:
    default: {}
    description: Add hosts to group based on Jinja2 conditionals.
    type: dict

output:
    default:
    - extend
    description:
    - Object properties to be returned.
    - List of available fields depends on Zabbix version.
    - See also U(https://www.zabbix.com/documentation/6.0/en/manual/api/reference/host/object)
    - See also U(https://www.zabbix.com/documentation/current/en/manual/api/reference/host/object)
    - Fields 'hostid' and 'host' will always be given from Zabbix.
    elements: str
    type: list

prefix:
    default: zabbix_
    description: Prefix to use for parameters given from Zabbix API.
    type: str

strict:
    default: false
    description:
    - If V(yes) make invalid entries a fatal error, otherwise skip and continue.
    - Since it is possible to use facts in the expressions they might not always be available
      and we ignore those errors by default.
    type: bool

compose:
    default: {}
    description: Create vars from jinja2 expressions.
    type: dict

http_login:
    description: Username for basic HTTP authorization to Zabbix API.
    type: str

http_proxy:
    description: Address of HTTP proxy for connection to Zabbix API.
    type: str

zabbix_user:
    description: User name for logging in to Zabbix API.
    env:
    - name: ZABBIX_USER
    type: str

cache_plugin:
    default: memory
    description:
    - Cache plugin to use for the inventory's source data.
    env:
    - name: ANSIBLE_CACHE_PLUGIN
    - name: ANSIBLE_INVENTORY_CACHE_PLUGIN
    ini:
    - key: fact_caching
      section: defaults
    - key: cache_plugin
      section: inventory
    type: str

cache_prefix:
    default: ansible_inventory_
    description:
    - Prefix to use for cache plugin files/tables
    env:
    - name: ANSIBLE_CACHE_PLUGIN_PREFIX
    - name: ANSIBLE_INVENTORY_CACHE_PLUGIN_PREFIX
    ini:
    - key: fact_caching_prefix
      section: defaults
    - key: cache_prefix
      section: inventory

keyed_groups:
    default: []
    description: Add hosts to group based on the values of a variable.
    elements: dict
    suboptions:
      default_value:
        description:
        - The default value when the host variable's value is an empty string.
        - This option is mutually exclusive with O(keyed_groups[].trailing_separator).
        type: str
        version_added: '2.12'
        version_added_collection: ansible.builtin
      key:
        description:
        - The key from input dictionary used to generate groups
        type: str
      parent_group:
        description: parent group for keyed group
        type: str
      prefix:
        default: ''
        description: A keyed group name will start with this prefix
        type: str
      separator:
        default: _
        description: separator used to build the keyed group name
        type: str
      trailing_separator:
        default: true
        description:
        - Set this option to V(False) to omit the O(keyed_groups[].separator) after the
          host variable when the value is an empty string.
        - This option is mutually exclusive with O(keyed_groups[].default_value).
        type: bool
        version_added: '2.12'
        version_added_collection: ansible.builtin
    type: list

cache_timeout:
    default: 3600
    description:
    - Cache duration in seconds
    env:
    - name: ANSIBLE_CACHE_PLUGIN_TIMEOUT
    - name: ANSIBLE_INVENTORY_CACHE_TIMEOUT
    ini:
    - key: fact_caching_timeout
      section: defaults
    - key: cache_timeout
      section: inventory
    type: int

http_password:
    description: Password for basic HTTP authorization to Zabbix API.
    type: str

use_extra_vars:
    default: false
    description: Merge extra vars into the available variables for composition (highest
      precedence).
    env:
    - name: ANSIBLE_INVENTORY_USE_EXTRA_VARS
    ini:
    - key: use_extra_vars
      section: inventory_plugins
    type: bool
    version_added: '2.11'
    version_added_collection: ansible.builtin

validate_certs:
    default: true
    description: Whether the connection should be made with validation certificates.
    type: bool

zabbix_api_url:
    description: Path to access Zabbix API.
    env:
    - name: ZABBIX_API_URL
    required: true
    type: str

zabbix_password:
    description: Password for logging in to Zabbix API.
    env:
    - name: ZABBIX_PASSWORD
    type: str

cache_connection:
    description:
    - Cache connection data or path, read cache plugin documentation for specifics.
    env:
    - name: ANSIBLE_CACHE_PLUGIN_CONNECTION
    - name: ANSIBLE_INVENTORY_CACHE_CONNECTION
    ini:
    - key: fact_caching_connection
      section: defaults
    - key: cache_connection
      section: inventory
    type: str

zabbix_api_token:
    description: Token for authorization to Zabbix API.
    env:
    - name: ZABBIX_API_TOKEN
    type: str

leading_separator:
    default: true
    description:
    - Use in conjunction with keyed_groups.
    - By default, a keyed group that does not have a prefix or a separator provided will
      have a name that starts with an underscore.
    - This is because the default prefix is "" and the default separator is "_".
    - Set this option to False to omit the leading underscore (or other separator) if
      no prefix is given.
    - If the group name is derived from a mapping the separator is still used to concatenate
      the items.
    - To not use a separator in the group name at all, set the separator for the keyed
      group to an empty string instead.
    type: boolean
    version_added: '2.11'
    version_added_collection: ansible.builtin

connection_timeout:
    default: 10
    description: Timeout for connecting to Zabbix API.
    type: int