vmware.vmware.vcenter_event_manager event source – Event Driven Ansible source for vCenter event manager.

Note

This EDA event source plugin is part of the vmware.vmware collection (version 2.13.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install vmware.vmware.

To use it in a playbook, specify: vmware.vmware.vcenter_event_manager.

Synopsis

  • Poll the vCenter Event Manager for events, using them as a source for Event Driven Ansible.

  • This plugin can use the same environment variables as the rest of the VMWare collection to configure the instance connection.

Parameters

Parameter

Comments

datacenter

string

Specify the name or MOID of the datacenter that should be used to filter events to track.

By specifying a datacenter, only events related to entities in that datacenter will be tracked.

event_tags

list / elements=string

A list of tags that events must have to be tracked.

If specified, only events with all of the tags listed will be tracked.

You can include an empty string to match events with no tags. See the examples below for more details.

event_type

string

Whether to include system or user events.

User events describe things like logins, logouts, etc.

System events describe things like VM power on, power off, etc.

You can filter either event type with user_names if desired.

Choices:

  • "system" ← (default)

  • "user"

event_type_ids

list / elements=string

A list of event type IDs to track.

If specified, only events with the type IDs listed will trigger the plugin.

Event IDs typically start with ‘vim.event.’ and can most easily be found in the vCenter Events Manager UI.

hostname

string

The hostname or IP address of the vSphere vCenter server.

If the value is not specified in the task, the value of environment variable VMWARE_HOST will be used instead.

initial_start_time

string

Specify the time that an event must be recorded after to be considered new and captured by this plugin.

This value should be a date string in the format of “%Y-%m-%d %H:%M:%S”.

If not specified, the plugin will use the current time as a default.

This option can be used to start tracking events from a specific time in the past.

interval

integer

The number of seconds to wait before performing another query.

Default: 60

password

aliases: pass, pwd

string

The password of the vSphere vCenter server.

If the value is not specified in the task, the value of environment variable VMWARE_PASSWORD will be used instead.

port

integer

The port number of the vSphere vCenter server.

If the value is not specified in the task, the value of environment variable VMWARE_PORT will be used instead.

Default: 443

proxy_host

string

The address of a proxy that will receive all HTTPS requests and relay them.

The format is a hostname or a IP.

If the value is not specified in the task, the value of environment variable VMWARE_PROXY_HOST will be used instead.

proxy_port

integer

The port of the HTTP proxy that will receive all HTTPS requests and relay them.

If the value is not specified in the task, the value of environment variable VMWARE_PROXY_PORT will be used instead.

proxy_protocol

aliases: protocol

string

The proxy connection protocol to use.

This option is used if the correct proxy protocol cannot be automatically determined.

Choices:

  • "http"

  • "https" ← (default)

severity

list / elements=string

The severity of the events to track (also known as ‘category’ in the vCenter UI).

If specified, only events with the severity listed will be tracked.

Not all events have an associated severity. It may be an empty string or be completely absent. For example, events of type ‘user’ have no severity. Setting this filter to any value will exclude these types of events.

Choices:

  • "info"

  • "warning"

  • "error"

user_names

list / elements=string

A list of usernames to filter events by.

If specified, only events from the users listed will trigger the plugin.

Usernames typically start with a domain name and a backslash. Examples can be found in the vCenter Events Manager UI.

Not all events have an associated user. It may be an empty string or be completely absent. Setting this filter to any value will exclude these types of events.

username

aliases: admin, user

string

The username of the vSphere vCenter server.

If the value is not specified in the task, the value of environment variable VMWARE_USER will be used instead.

validate_certs

boolean

Allows connection when SSL certificates are not valid. Set to false when certificates are not trusted.

If the value is not specified in the task, the value of environment variable VMWARE_VALIDATE_CERTS will be used instead.

Choices:

  • false

  • true ← (default)

Notes

Note

  • All modules require API write access and hence are not supported on a free ESXi license.

  • All variables and VMware object names are case sensitive.

  • Modules may rely on the ‘requests’ python library, which does not use the system certificate store by default. You can specify the certificate store by setting the REQUESTS_CA_BUNDLE environment variable. Note having this variable set may cause a ‘false’ value for the ‘validate_certs’ option to be ignored in some cases. Example: ‘export REQUESTS_CA_BUNDLE=/path/to/your/ca_bundle.pem’

Examples

---
# Full example rulebook
- name: Watch for new events
  hosts: localhost
  sources:
    - name: Watch for any system events
      vmware.vmware.vcenter_event_manager: {}

  rules:
    - name: New event
      condition: true
      action:
        debug:

---
# These are all different source examples
- name: Watch for alarm status changed events
  vmware.vmware.vcenter_event_manager:
    event_type: system
    event_type_ids:
     - vim.event.AlarmStatusChangedEvent

- name: Watch for a specific user's login/logout
  vmware.vmware.vcenter_event_manager:
    event_type: user
    user_names:
        - 'MY.DOMAIN.VSPHERE\some_username'

- name: Watch for updated change requests
  vmware.vmware.vcenter_event_manager:
    event_type: system
    severity:
        - warning

- name: Watch for events with the foo tag
  vmware.vmware.vcenter_event_manager:
    event_type: system
    event_tags:
        - "foo"

- name: Watch for events with the no tags
  vmware.vmware.vcenter_event_manager:
    event_type: system
    event_tags:
        - ""

- name: Watch for events relating to any entities in My-Datacenter
  vmware.vmware.vcenter_event_manager:
    event_type: system
    datacenter: My-Datacenter

Authors

  • Ansible Eco Content Team (@eco-ansible-content)