W3cubDocs

/Ansible

community.vmware.vmware_vcenter_settings – Configures general settings on a vCenter server

Note

This plugin is part of the community.vmware collection (version 1.15.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 community.vmware.

To use it in a playbook, specify: community.vmware.vmware_vcenter_settings.

Synopsis

  • This module can be used to configure the vCenter server general settings (except the statistics).
  • The statistics can be configured with the module vmware_vcenter_statistics.

Requirements

The below requirements are needed on the host that executes this module.

  • python >= 2.6
  • PyVmomi

Parameters

Parameter Choices/Defaults Comments
advanced_settings
dictionary
added in 1.11.0 of community.vmware
Default:
{}
A dictionary of advanced settings.
database
dictionary
Default:
{"event_cleanup": true, "event_retention": 30, "max_connections": 50, "task_cleanup": true, "task_retention": 30}
The database settings for vCenter server.
event_cleanup
boolean
    Choices:
  • no
  • yes
Event cleanup.
event_retention
integer
Default:
30
Event retention in days.
max_connections
integer
Default:
50
Maximum connections.
task_cleanup
boolean
    Choices:
  • no
  • yes
Task cleanup.
task_retention
integer
Default:
30
Task retention in days.
hostname
string
The hostname or IP address of the vSphere vCenter or ESXi server.
If the value is not specified in the task, the value of environment variable VMWARE_HOST will be used instead.
Environment variable support added in Ansible 2.6.
logging_options
string
    Choices:
  • none
  • error
  • warning
  • info
  • verbose
  • trivia
The level of detail that vCenter server usesfor log files.
mail
dictionary
Default:
{"sender": "", "server": ""}
The settings vCenter server uses to send email alerts.
sender
string
Mail sender address.
server
string
Mail server.
password
string
The password of the vSphere vCenter or ESXi server.
If the value is not specified in the task, the value of environment variable VMWARE_PASSWORD will be used instead.
Environment variable support added in Ansible 2.6.

aliases: pass, pwd
port
integer
Default:
443
The port number of the vSphere vCenter or ESXi server.
If the value is not specified in the task, the value of environment variable VMWARE_PORT will be used instead.
Environment variable support added in Ansible 2.6.
proxy_host
string
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.
This feature depends on a version of pyvmomi greater than v6.7.1.2018.12
proxy_port
integer
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.
runtime_settings
dictionary
The unique runtime settings for vCenter server.
managed_address
string
vCenter server managed address.
unique_id
integer
vCenter server unique ID.
vcenter_server_name
string
vCenter server name. Default is FQDN.
snmp_receivers
dictionary
Default:
{"snmp_receiver_1_community": "public", "snmp_receiver_1_enabled": true, "snmp_receiver_1_port": 162, "snmp_receiver_1_url": "localhost", "snmp_receiver_2_community": "", "snmp_receiver_2_enabled": false, "snmp_receiver_2_port": 162, "snmp_receiver_2_url": "", "snmp_receiver_3_community": "", "snmp_receiver_3_enabled": false, "snmp_receiver_3_port": 162, "snmp_receiver_3_url": "", "snmp_receiver_4_community": "", "snmp_receiver_4_enabled": false, "snmp_receiver_4_port": 162, "snmp_receiver_4_url": ""}
SNMP trap destinations for vCenter server alerts.
snmp_receiver_1_community
string
Default:
"public"
Community string.
snmp_receiver_1_enabled
boolean
    Choices:
  • no
  • yes
Enable receiver.
snmp_receiver_1_port
integer
Default:
162
Receiver port.
snmp_receiver_1_url
string
Default:
"localhost"
Primary Receiver ULR.
snmp_receiver_2_community
string
Default:
""
Community string.
snmp_receiver_2_enabled
boolean
    Choices:
  • no
  • yes
Enable receiver.
snmp_receiver_2_port
integer
Default:
162
Receiver port.
snmp_receiver_2_url
string
Default:
""
Receiver 2 ULR.
snmp_receiver_3_community
string
Default:
""
Community string.
snmp_receiver_3_enabled
boolean
    Choices:
  • no
  • yes
Enable receiver.
snmp_receiver_3_port
integer
Default:
162
Receiver port.
snmp_receiver_3_url
string
Default:
""
Receiver 3 ULR.
snmp_receiver_4_community
string
Default:
""
Community string.
snmp_receiver_4_enabled
boolean
    Choices:
  • no
  • yes
Enable receiver.
snmp_receiver_4_port
integer
Default:
162
Receiver port.
snmp_receiver_4_url
string
Default:
""
Receiver 4 ULR.
timeout_settings
dictionary
Default:
{"long_operations": 120, "normal_operations": 30}
The vCenter server connection timeout for normal and long operations.
long_operations
integer
Default:
120
Long operation timeout.
normal_operations
integer
Default:
30
Normal operation timeout.
user_directory
dictionary
Default:
{"query_limit": true, "query_limit_size": 5000, "timeout": 60, "validation": true, "validation_period": 1440}
The user directory settings for the vCenter server installation.
query_limit
boolean
    Choices:
  • no
  • yes
Query limit.
query_limit_size
integer
Default:
5000
Query limit size.
timeout
integer
Default:
60
User directory timeout.
validation
boolean
    Choices:
  • no
  • yes
Mail Validation.
validation_period
integer
Default:
1440
Validation period.
username
string
The username of the vSphere vCenter or ESXi server.
If the value is not specified in the task, the value of environment variable VMWARE_USER will be used instead.
Environment variable support added in Ansible 2.6.

aliases: admin, user
validate_certs
boolean
    Choices:
  • no
  • yes
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.
Environment variable support added in Ansible 2.6.
If set to true, please make sure Python >= 2.7.9 is installed on the given machine.

Notes

Note

  • Tested with vCenter Server Appliance (vCSA) 6.5 and 6.7
  • All modules requires API write access and hence is not supported on a free ESXi license.

Examples

- name: Configure vCenter general settings
  community.vmware.vmware_vcenter_settings:
    hostname: '{{ vcenter_hostname }}'
    username: '{{ vcenter_username }}'
    password: '{{ vcenter_password }}'
    database:
      max_connections: 50
      task_cleanup: true
      task_retention: 30
      event_cleanup: true
      event_retention: 30
    runtime_settings:
      unique_id: 1
      managed_address: "{{ lookup('dig', inventory_hostname) }}"
      vcenter_server_name: "{{ inventory_hostname }}"
    user_directory:
      timeout: 60
      query_limit: true
      query_limit_size: 5000
      validation: true
      validation_period: 1440
    mail:
      server: mail.example.com
      sender: vcenter@{{ inventory_hostname }}
    snmp_receivers:
      snmp_receiver_1_url: localhost
      snmp_receiver_1_enabled: true
      snmp_receiver_1_port: 162
      snmp_receiver_1_community: public
    timeout_settings:
      normal_operations: 30
      long_operations: 120
    logging_options: info
  delegate_to: localhost

- name: Enable Retreat Mode for cluster with MOID domain-c8 (https://kb.vmware.com/kb/80472)
  community.vmware.vmware_vcenter_settings:
    hostname: '{{ vcenter_hostname }}'
    username: '{{ vcenter_username }}'
    password: '{{ vcenter_password }}'
    advanced_settings:
      'config.vcls.clusters.domain-c8.enabled': 'false'
  delegate_to: localhost

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
results
dictionary
always
metadata about vCenter settings
supported diff mode from version 1.8.0

Sample:
{'changed': False, 'db_event_cleanup': True, 'db_event_retention': 30, 'db_max_connections': 50, 'db_task_cleanup': True, 'db_task_retention': 30, 'diff': {'after': {'db_event_cleanup': True, 'db_event_retention': 30, 'db_max_connections': 50, 'db_task_cleanup': True, 'db_task_retention': 30, 'directory_query_limit': True, 'directory_query_limit_size': 5000, 'directory_timeout': 60, 'directory_validation': True, 'directory_validation_period': 1440, 'logging_options': 'info', 'mail_sender': '[email protected]', 'mail_server': 'mail.example.com', 'runtime_managed_address': '192.168.1.10', 'runtime_server_name': 'vcenter01.example.com', 'runtime_unique_id': 1, 'snmp_receiver_1_community': 'public', 'snmp_receiver_1_enabled': True, 'snmp_receiver_1_port': 162, 'snmp_receiver_1_url': 'localhost', 'snmp_receiver_2_community': '', 'snmp_receiver_2_enabled': False, 'snmp_receiver_2_port': 162, 'snmp_receiver_2_url': '', 'snmp_receiver_3_community': '', 'snmp_receiver_3_enabled': False, 'snmp_receiver_3_port': 162, 'snmp_receiver_3_url': '', 'snmp_receiver_4_community': '', 'snmp_receiver_4_enabled': False, 'snmp_receiver_4_port': 162, 'snmp_receiver_4_url': '', 'timeout_long_operations': 120, 'timeout_normal_operations': 30}, 'before': {'db_event_cleanup': True, 'db_event_retention': 30, 'db_max_connections': 50, 'db_task_cleanup': True, 'db_task_retention': 30, 'directory_query_limit': True, 'directory_query_limit_size': 5000, 'directory_timeout': 60, 'directory_validation': True, 'directory_validation_period': 1440, 'logging_options': 'info', 'mail_sender': '[email protected]', 'mail_server': 'mail.example.com', 'runtime_managed_address': '192.168.1.10', 'runtime_server_name': 'vcenter01.example.com', 'runtime_unique_id': 1, 'snmp_receiver_1_community': 'public', 'snmp_receiver_1_enabled': True, 'snmp_receiver_1_port': 162, 'snmp_receiver_1_url': 'localhost', 'snmp_receiver_2_community': '', 'snmp_receiver_2_enabled': False, 'snmp_receiver_2_port': 162, 'snmp_receiver_2_url': '', 'snmp_receiver_3_community': '', 'snmp_receiver_3_enabled': False, 'snmp_receiver_3_port': 162, 'snmp_receiver_3_url': '', 'snmp_receiver_4_community': '', 'snmp_receiver_4_enabled': False, 'snmp_receiver_4_port': 162, 'snmp_receiver_4_url': '', 'timeout_long_operations': 120, 'timeout_normal_operations': 30}}, 'directory_query_limit': True, 'directory_query_limit_size': 5000, 'directory_timeout': 60, 'directory_validation': True, 'directory_validation_period': 1440, 'logging_options': 'info', 'mail_sender': '[email protected]', 'mail_server': 'mail.example.com', 'msg': 'vCenter settings already configured properly', 'runtime_managed_address': '192.168.1.10', 'runtime_server_name': 'vcenter01.example.com', 'runtime_unique_id': 1, 'timeout_long_operations': 120, 'timeout_normal_operations': 30}


Authors

  • Christian Kotte (@ckotte)

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/vmware/vmware_vcenter_settings_module.html