how to disable vcenter alarm for esxi host

86 views
Skip to first unread message

Tony Wong

unread,
Jun 27, 2023, 2:12:56 PM6/27/23
to Ansible Project
any idea how to disable/enable vcenter alarm for esxi host in ansible task?

Atul Nasir

unread,
Aug 19, 2023, 2:12:57 PM8/19/23
to Ansible Project
Ansible does not have a built-in module specifically designed to manage vCenter alarms for ESXi hosts. However, you can use the vmware_vm_vm_drs_rule module to work with DRS rules which are closely related to alarms.
---
- name: Disable vCenter alarm for ESXi host
  hosts: localhost
  gather_facts: no
  tasks:
    - name: Create DRS Rule to disable alarm
      community.vmware.vm_vm_drs_rule:
        hostname: "{{ vcenter_hostname }}"
        username: "{{ vcenter_username }}"
        password: "{{ vcenter_password }}"
        cluster_name: "{{ cluster_name }}"
        enabled: no  # Set to yes to enable the rule, no to disable
        affinity_rule: False  # Set to True if you're working with affinity rules
        drs_rule_name: "Disable Alarm Rule"
        affinity_rule_name: "Affinity Rule"
        enabled_rule_name: "Enabled Rule"
        disabled_rule_name: "Disabled Rule"
        state: "present"

Reply all
Reply to author
Forward
0 new messages