community.vmware.vmware_vcenter_settings module – Configures general settings on a vCenter server
Note
This module is part of the community.vmware collection (version 1.18.2).
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 |
Comments |
---|---|
A dictionary of advanced settings. Default: {} |
|
The database settings for vCenter server. Default: {“event_cleanup”: true, “event_retention”: 30, “max_connections”: 50, “task_cleanup”: true, “task_retention”: 30} |
|
Event cleanup. Choices:
|
|
Event retention in days. Default: 30 |
|
Maximum connections. Default: 50 |
|
Task cleanup. Choices:
|
|
Task retention in days. Default: 30 |
|
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 Environment variable support added in Ansible 2.6. |
|
The level of detail that vCenter server usesfor log files. Choices:
|
|
The settings vCenter server uses to send email alerts. Default: {“sender”: “”, “server”: “”} |
|
Mail sender address. |
|
Mail server. |
|
The password of the vSphere vCenter or ESXi server. If the value is not specified in the task, the value of environment variable Environment variable support added in Ansible 2.6. |
|
The port number of the vSphere vCenter or ESXi server. If the value is not specified in the task, the value of environment variable Environment variable support added in Ansible 2.6. Default: 443 |
|
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 This feature depends on a version of pyvmomi greater than v6.7.1.2018.12 |
|
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 |
|
The unique runtime settings for vCenter server. |
|
vCenter server managed address. |
|
vCenter server unique ID. |
|
vCenter server name. Default is FQDN. |
|
SNMP trap destinations for vCenter server alerts. 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”: “”} |
|
Community string. Default: “public” |
|
Enable receiver. Choices:
|
|
Receiver port. Default: 162 |
|
Primary Receiver ULR. Default: “localhost” |
|
Community string. Default: “” |
|
Enable receiver. Choices:
|
|
Receiver port. Default: 162 |
|
Receiver 2 ULR. Default: “” |
|
Community string. Default: “” |
|
Enable receiver. Choices:
|
|
Receiver port. Default: 162 |
|
Receiver 3 ULR. Default: “” |
|
Community string. Default: “” |
|
Enable receiver. Choices:
|
|
Receiver port. Default: 162 |
|
Receiver 4 ULR. Default: “” |
|
The vCenter server connection timeout for normal and long operations. Default: {“long_operations”: 120, “normal_operations”: 30} |
|
Long operation timeout. Default: 120 |
|
Normal operation timeout. Default: 30 |
|
The user directory settings for the vCenter server installation. Default: {“query_limit”: true, “query_limit_size”: 5000, “timeout”: 60, “validation”: true, “validation_period”: 1440} |
|
Query limit. Choices:
|
|
Query limit size. Default: 5000 |
|
User directory timeout. Default: 60 |
|
Mail Validation. Choices:
|
|
Validation period. Default: 1440 |
|
The username of the vSphere vCenter or ESXi server. If the value is not specified in the task, the value of environment variable Environment variable support added in Ansible 2.6. |
|
Allows connection when SSL certificates are not valid. Set to If the value is not specified in the task, the value of environment variable Environment variable support added in Ansible 2.6. If set to Choices:
|
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 |
Description |
---|---|
metadata about vCenter settings supported diff mode from version 1.8.0 Returned: always 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”: “vcenter@vcenter01.example.com”, “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”: “vcenter@vcenter01.example.com”, “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”: “vcenter@vcenter01.example.com”, “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)