code
stringlengths 2.5k
150k
| kind
stringclasses 1
value |
---|---|
ansible community.aws.ecs_cluster – Create or terminate ECS clusters. community.aws.ecs\_cluster – Create or terminate ECS clusters.
==============================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.ecs_cluster`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Creates or terminates ecs clusters.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **delay** integer | **Default:**10 | Number of seconds to wait. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **name** string / required | | The cluster name. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **repeat** integer | **Default:**10 | The number of times to wait for the cluster to have an instance. |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string / required | **Choices:*** present
* absent
* has\_instances
| The desired state of the cluster. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* When deleting a cluster, the information returned is the state of the cluster prior to deletion.
* It will also wait for a cluster to have instances registered to it.
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
- name: Cluster creation
community.aws.ecs_cluster:
name: default
state: present
- name: Cluster deletion
community.aws.ecs_cluster:
name: default
state: absent
- name: Wait for register
community.aws.ecs_cluster:
name: "{{ new_cluster }}"
state: has_instances
delay: 10
repeat: 10
register: task_output
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **activeServicesCount** integer | 0 if a new cluster | how many services are active in this cluster |
| **clusterArn** string | 0 if a new cluster | the ARN of the cluster just created **Sample:** arn:aws:ecs:us-west-2:172139249013:cluster/test-cluster-mfshcdok |
| **clusterName** string | always | name of the cluster just created (should match the input argument) **Sample:** test-cluster-mfshcdok |
| **pendingTasksCount** integer | 0 if a new cluster | how many tasks are waiting to run in this cluster |
| **registeredContainerInstancesCount** integer | 0 if a new cluster | how many container instances are available in this cluster |
| **runningTasksCount** integer | 0 if a new cluster | how many tasks are running in this cluster |
| **status** string | always | the status of the new cluster **Sample:** ACTIVE |
### Authors
* Mark Chance (@Java1Guy)
ansible community.aws.ec2_elb – De-registers or registers instances from EC2 ELBs community.aws.ec2\_elb – De-registers or registers instances from EC2 ELBs
==========================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.ec2_elb`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module de-registers or registers an AWS EC2 instance from the ELBs that it belongs to.
* Returns fact “ec2\_elbs” which is a list of elbs attached to the instance if state=absent is passed as an argument.
* Will be marked changed when called only if there are ELBs found to operate on.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* boto
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_elbs** list / elements=string | | List of ELB names, required for registration. The ec2\_elbs fact should be used if there was a previous de-register. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **enable\_availability\_zone** boolean | **Choices:*** no
* **yes** ←
| Whether to enable the availability zone of the instance on the target ELB if the availability zone has not already been enabled. If set to no, the task will fail if the availability zone is not enabled on the ELB. |
| **instance\_id** string / required | | EC2 Instance ID |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string / required | **Choices:*** present
* absent
| register or deregister the instance |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
| **wait** boolean | **Choices:*** no
* **yes** ←
| Wait for instance registration or deregistration to complete successfully before returning. |
| **wait\_timeout** integer | **Default:**0 | Number of seconds to wait for an instance to change state. If 0 then this module may return an error if a transient error occurs. If non-zero then any transient errors are ignored until the timeout is reached. Ignored when wait=no. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# basic pre_task and post_task example
pre_tasks:
- name: Instance De-register
community.aws.ec2_elb:
instance_id: "{{ ansible_ec2_instance_id }}"
state: absent
roles:
- myrole
post_tasks:
- name: Instance Register
community.aws.ec2_elb:
instance_id: "{{ ansible_ec2_instance_id }}"
ec2_elbs: "{{ item }}"
state: present
loop: "{{ ec2_elbs }}"
```
### Authors
* John Jarvis (@jarv)
ansible community.aws.aws_s3_cors – Manage CORS for S3 buckets in AWS community.aws.aws\_s3\_cors – Manage CORS for S3 buckets in AWS
===============================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.aws_s3_cors`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage CORS for S3 buckets in AWS
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* boto
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **name** string / required | | Name of the s3 bucket |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **rules** list / elements=dictionary | | Cors rules to put on the s3 bucket |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string / required | **Choices:*** present
* absent
| Create or remove cors on the s3 bucket |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Create a simple cors for s3 bucket
- community.aws.aws_s3_cors:
name: mys3bucket
state: present
rules:
- allowed_origins:
- http://www.example.com/
allowed_methods:
- GET
- POST
allowed_headers:
- Authorization
expose_headers:
- x-amz-server-side-encryption
- x-amz-request-id
max_age_seconds: 30000
# Remove cors for s3 bucket
- community.aws.aws_s3_cors:
name: mys3bucket
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **changed** boolean | always | check to see if a change was made to the rules **Sample:** True |
| **name** string | always | name of bucket **Sample:** bucket-name |
| **rules** list / elements=string | always | list of current rules **Sample:** [{'allowed\_headers': ['Authorization'], 'allowed\_methods': ['GET'], 'allowed\_origins': ['\*'], 'max\_age\_seconds': 30000}] |
### Authors
* Oyvind Saltvik (@fivethreeo)
| programming_docs |
ansible community.aws.ec2_vpc_nacl – create and delete Network ACLs. community.aws.ec2\_vpc\_nacl – create and delete Network ACLs.
==============================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.ec2_vpc_nacl`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Read the AWS documentation for Network ACLS <https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_ACLs.html>
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* json
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **egress** list / elements=list | **Default:**[] | A list of rules for outgoing traffic. Each rule must be specified as a list. Each rule may contain the rule number (integer 1-32766), protocol (one of ['tcp', 'udp', 'icmp', 'ipv6-icmp', '-1', 'all']), the rule action ('allow' or 'deny') the CIDR of the IPv4 or IPv6 network range to allow or deny, the ICMP type (-1 means all types), the ICMP code (-1 means all codes), the last port in the range for TCP or UDP protocols, and the first port in the range for TCP or UDP protocols. See examples. |
| **ingress** list / elements=list | **Default:**[] | List of rules for incoming traffic. Each rule must be specified as a list. Each rule may contain the rule number (integer 1-32766), protocol (one of ['tcp', 'udp', 'icmp', 'ipv6-icmp', '-1', 'all']), the rule action ('allow' or 'deny') the CIDR of the IPv4 or IPv6 network range to allow or deny, the ICMP type (-1 means all types), the ICMP code (-1 means all codes), the last port in the range for TCP or UDP protocols, and the first port in the range for TCP or UDP protocols. See examples. |
| **nacl\_id** string | | NACL id identifying a network ACL. One and only one of the *name* or *nacl\_id* is required. |
| **name** string | | Tagged name identifying a network ACL. One and only one of the *name* or *nacl\_id* is required. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** **present** ←
* absent
| Creates or modifies an existing NACL Deletes a NACL and reassociates subnets to the default NACL |
| **subnets** list / elements=string | | The list of subnets that should be associated with the network ACL. Must be specified as a list Each subnet can be specified as subnet ID, or its tagged name. |
| **tags** dictionary | | Dictionary of tags to look for and apply when creating a network ACL. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
| **vpc\_id** string | | VPC id of the requesting VPC. Required when state present. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Complete example to create and delete a network ACL
# that allows SSH, HTTP and ICMP in, and all traffic out.
- name: "Create and associate production DMZ network ACL with DMZ subnets"
community.aws.ec2_vpc_nacl:
vpc_id: vpc-12345678
name: prod-dmz-nacl
region: ap-southeast-2
subnets: ['prod-dmz-1', 'prod-dmz-2']
tags:
CostCode: CC1234
Project: phoenix
Description: production DMZ
ingress:
# rule no, protocol, allow/deny, cidr, icmp_type, icmp_code,
# port from, port to
- [100, 'tcp', 'allow', '0.0.0.0/0', null, null, 22, 22]
- [200, 'tcp', 'allow', '0.0.0.0/0', null, null, 80, 80]
- [205, 'tcp', 'allow', '::/0', null, null, 80, 80]
- [300, 'icmp', 'allow', '0.0.0.0/0', 0, 8]
- [305, 'ipv6-icmp', 'allow', '::/0', 0, 8]
egress:
- [100, 'all', 'allow', '0.0.0.0/0', null, null, null, null]
- [105, 'all', 'allow', '::/0', null, null, null, null]
state: 'present'
- name: "Remove the ingress and egress rules - defaults to deny all"
community.aws.ec2_vpc_nacl:
vpc_id: vpc-12345678
name: prod-dmz-nacl
region: ap-southeast-2
subnets:
- prod-dmz-1
- prod-dmz-2
tags:
CostCode: CC1234
Project: phoenix
Description: production DMZ
state: present
- name: "Remove the NACL subnet associations and tags"
community.aws.ec2_vpc_nacl:
vpc_id: 'vpc-12345678'
name: prod-dmz-nacl
region: ap-southeast-2
state: present
- name: "Delete nacl and subnet associations"
community.aws.ec2_vpc_nacl:
vpc_id: vpc-12345678
name: prod-dmz-nacl
state: absent
- name: "Delete nacl by its id"
community.aws.ec2_vpc_nacl:
nacl_id: acl-33b4ee5b
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **nacl\_id** string | success | The id of the NACL (when creating or updating an ACL) **Sample:** acl-123456789abcdef01 |
| **task** dictionary | success | The result of the create, or delete action. |
### Authors
* Mike Mochan (@mmochan)
ansible community.aws.ec2_customer_gateway – Manage an AWS customer gateway community.aws.ec2\_customer\_gateway – Manage an AWS customer gateway
=====================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.ec2_customer_gateway`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage an AWS customer gateway.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **bgp\_asn** integer | | Border Gateway Protocol (BGP) Autonomous System Number (ASN), required when *state=present*. |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **ip\_address** string / required | | Internet-routable IP address for customers gateway, must be a static address. |
| **name** string / required | | Name of the customer gateway. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **routing** string | **Choices:*** static
* **dynamic** ←
| The type of routing. |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** **present** ←
* absent
| Create or terminate the Customer Gateway. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* You cannot create more than one customer gateway with the same IP address. If you run an identical request more than one time, the first request creates the customer gateway, and subsequent requests return information about the existing customer gateway. The subsequent requests do not create new customer gateway resources.
* Return values contain customer\_gateway and customer\_gateways keys which are identical dicts. You should use customer\_gateway. See <https://github.com/ansible/ansible-modules-extras/issues/2773> for details.
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- name: Create Customer Gateway
community.aws.ec2_customer_gateway:
bgp_asn: 12345
ip_address: 1.2.3.4
name: IndianapolisOffice
region: us-east-1
register: cgw
- name: Delete Customer Gateway
community.aws.ec2_customer_gateway:
ip_address: 1.2.3.4
name: IndianapolisOffice
state: absent
region: us-east-1
register: cgw
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **gateway.customer\_gateways** complex | success | details about the gateway that was created. |
| | **bgp\_asn** string | when exists and gateway is available. | The Border Gateway Autonomous System Number. **Sample:** 65123 |
| | **customer\_gateway\_id** string | when exists and gateway is available. | gateway id assigned by amazon. **Sample:** cgw-cb6386a2 |
| | **ip\_address** string | when exists and gateway is available. | ip address of your gateway device. **Sample:** 1.2.3.4 |
| | **state** string | when gateway exists and is available. | state of gateway. **Sample:** available |
| | **tags** list / elements=string | when gateway exists and is available, and when tags exist. | Any tags on the gateway. |
| | **type** string | when gateway exists and is available. | encryption type. **Sample:** ipsec.1 |
### Authors
* Michael Baydoun (@MichaelBaydoun)
ansible community.aws.iam_user_info – Gather IAM user(s) facts in AWS community.aws.iam\_user\_info – Gather IAM user(s) facts in AWS
===============================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.iam_user_info`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to gather IAM user(s) facts in AWS.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **group** string | | The group name name of the IAM user to look for. Mutually exclusive with `path`. |
| **name** string | | The name of the IAM user to look for. |
| **path** string | **Default:**"/" | The path to the IAM user. Mutually exclusive with `group`. If specified, then would get all user names whose path starts with user provided value. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Gather facts about "test" user.
- name: Get IAM user facts
community.aws.iam_user_info:
name: "test"
# Gather facts about all users in the "dev" group.
- name: Get IAM user facts
community.aws.iam_user_info:
group: "dev"
# Gather facts about all users with "/division_abc/subdivision_xyz/" path.
- name: Get IAM user facts
community.aws.iam_user_info:
path: "/division_abc/subdivision_xyz/"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **iam\_users** complex | success | list of maching iam users |
| | **arn** string | if user exists | the ARN of the user **Sample:** arn:aws:iam::156360693172:user/dev/test\_user |
| | **create\_date** string | if user exists | the datetime user was created **Sample:** 2016-05-24T12:24:59+00:00 |
| | **password\_last\_used** string | if password was used at least once | the last datetime the password was used by user **Sample:** 2016-05-25T13:39:11+00:00 |
| | **path** string | if user exists | the path to user **Sample:** /dev/ |
| | **user\_id** string | if user exists | the unique user id **Sample:** AIDUIOOCQKTUGI6QJLGH2 |
| | **user\_name** string | if user exists | the user name **Sample:** test\_user |
### Authors
* Constantin Bugneac (@Constantin07)
* Abhijeet Kasurde (@Akasurde)
| programming_docs |
ansible community.aws.cloudwatchlogs_log_group – create or delete log_group in CloudWatchLogs community.aws.cloudwatchlogs\_log\_group – create or delete log\_group in CloudWatchLogs
========================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.cloudwatchlogs_log_group`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create or delete log\_group in CloudWatchLogs.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* json
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **kms\_key\_id** string | | The Amazon Resource Name (ARN) of the CMK to use when encrypting log data. |
| **log\_group\_name** string / required | | The name of the log group. |
| **overwrite** boolean | **Choices:*** **no** ←
* yes
| Whether an existing log group should be overwritten on create. Mutually exclusive with *purge\_retention\_policy*. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **purge\_retention\_policy** boolean | **Choices:*** **no** ←
* yes
| Whether to purge the retention policy or not. Mutually exclusive with *retention* and *overwrite*. |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **retention** integer | | The number of days to retain the log events in the specified log group. Valid values are: [1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, 3653] Mutually exclusive with *purge\_retention\_policy*. |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** **present** ←
* absent
| Whether the rule is present or absent. |
| **tags** dictionary | | The key-value pairs to use for the tags. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* For details of the parameters and returns see <http://boto3.readthedocs.io/en/latest/reference/services/logs.html>.
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
- community.aws.cloudwatchlogs_log_group:
log_group_name: test-log-group
- community.aws.cloudwatchlogs_log_group:
state: present
log_group_name: test-log-group
tags: { "Name": "test-log-group", "Env" : "QA" }
- community.aws.cloudwatchlogs_log_group:
state: present
log_group_name: test-log-group
tags: { "Name": "test-log-group", "Env" : "QA" }
kms_key_id: arn:aws:kms:region:account-id:key/key-id
- community.aws.cloudwatchlogs_log_group:
state: absent
log_group_name: test-log-group
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **log\_groups** complex | success | Return the list of complex objects representing log groups |
| | **arn** string | always | The Amazon Resource Name (ARN) of the log group. |
| | **creation\_time** integer | always | The creation time of the log group. |
| | **kms\_key\_id** string | always | The Amazon Resource Name (ARN) of the CMK to use when encrypting log data. |
| | **log\_group\_name** string | always | The name of the log group. |
| | **metric\_filter\_count** integer | always | The number of metric filters. |
| | **retention\_in\_days** integer | always | The number of days to retain the log events in the specified log group. |
| | **stored\_bytes** string | always | The number of bytes stored. |
### Authors
* Willian Ricardo (@willricardo) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#36415f5a5a445f5557445259101505010d101503040d1015020e0d515b575f5a101502000d55595b)>
ansible community.aws.dms_endpoint – Creates or destroys a data migration services endpoint community.aws.dms\_endpoint – Creates or destroys a data migration services endpoint
====================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.dms_endpoint`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Creates or destroys a data migration services endpoint, that can be used to replicate data.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* boto
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **certificatearn** string | | Amazon Resource Name (ARN) for the certificate. |
| **databasename** string | | Name for the database on the origin or target side. |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **dmstransfersettings** dictionary | | The settings in JSON format for the DMS transfer type of source endpoint. |
| **dynamodbsettings** dictionary | | Settings in JSON format for the target Amazon DynamoDB endpoint if source or target is dynamodb. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **elasticsearchsettings** dictionary | | Settings in JSON format for the target Elasticsearch endpoint. |
| **endpointidentifier** string / required | | An identifier name for the endpoint. |
| **endpointtype** string / required | **Choices:*** source
* target
| Type of endpoint we want to manage. |
| **enginename** string / required | **Choices:*** mysql
* oracle
* postgres
* mariadb
* aurora
* redshift
* s3
* db2
* azuredb
* sybase
* dynamodb
* mongodb
* sqlserver
| Database engine that we want to use, please refer to the AWS DMS for more information on the supported engines and their limitations. |
| **externaltabledefinition** string | | The external table definition. |
| **extraconnectionattributes** string | | Extra attributes for the database connection, the AWS documentation states " For more information about extra connection attributes, see the documentation section for your data store." |
| **kinesissettings** dictionary | | Settings in JSON format for the target Amazon Kinesis Data Streams endpoint. |
| **kmskeyid** string | | Encryption key to use to encrypt replication storage and connection information. |
| **mongodbsettings** dictionary | | Settings in JSON format for the source MongoDB endpoint. |
| **password** string | | Password used to connect to the database this attribute can only be written the AWS API does not return this parameter. |
| **port** integer | | TCP port for access to the database. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **retries** integer | | number of times we should retry when deleting a resource Required when *wait=true*. |
| **s3settings** dictionary | | S3 buckets settings for the target Amazon S3 endpoint. |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **servername** string | | Servername that the endpoint will connect to. |
| **serviceaccessrolearn** string | | Amazon Resource Name (ARN) for the service access role that you want to use to create the endpoint. |
| **sslmode** string | **Choices:*** **none** ←
* require
* verify-ca
* verify-full
| Mode used for the SSL connection. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the endpoint. |
| **tags** dictionary | | A list of tags to add to the endpoint. |
| **timeout** integer | | Time in seconds we should wait for when deleting a resource. Required when *wait=true*. |
| **username** string | | Username our endpoint will use to connect to the database. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
| **wait** boolean | **Choices:*** **no** ←
* yes
| Whether Ansible should wait for the object to be deleted when *state=absent*. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details
- name: Endpoint Creation
community.aws.dms_endpoint:
state: absent
endpointidentifier: 'testsource'
endpointtype: source
enginename: aurora
username: testing1
password: testint1234
servername: testing.domain.com
port: 3306
databasename: 'testdb'
sslmode: none
wait: false
```
### Authors
* Rui Moreira (@ruimoreira)
ansible community.aws.s3_logging – Manage logging facility of an s3 bucket in AWS community.aws.s3\_logging – Manage logging facility of an s3 bucket in AWS
==========================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.s3_logging`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Manage logging facility of an s3 bucket in AWS
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* boto
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **name** string / required | | Name of the s3 bucket. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** **present** ←
* absent
| Enable or disable logging. |
| **target\_bucket** string | | The bucket to log to. Required when state=present. |
| **target\_prefix** string | **Default:**"" | The prefix that should be prepended to the generated log files written to the target\_bucket. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
- name: Enable logging of s3 bucket mywebsite.com to s3 bucket mylogs
community.aws.s3_logging:
name: mywebsite.com
target_bucket: mylogs
target_prefix: logs/mywebsite.com
state: present
- name: Remove logging on an s3 bucket
community.aws.s3_logging:
name: mywebsite.com
state: absent
```
### Authors
* Rob White (@wimnat)
| programming_docs |
ansible community.aws.route53_health_check – Add or delete health-checks in Amazons Route53 DNS service community.aws.route53\_health\_check – Add or delete health-checks in Amazons Route53 DNS service
=================================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.route53_health_check`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Creates and deletes DNS Health checks in Amazons Route53 service.
* Only the port, resource\_path, string\_match and request\_interval are considered when updating existing health-checks.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* boto
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **failure\_threshold** integer | **Choices:*** 1
* 2
* 3
* 4
* 5
* 6
* 7
* 8
* 9
* 10
**Default:**3 | The number of consecutive health checks that an endpoint must pass or fail for Amazon Route 53 to change the current status of the endpoint from unhealthy to healthy or vice versa. |
| **fqdn** string | | Domain name of the endpoint to check. Either this or *ip\_address* has to be provided. When both are given the `fqdn` is used in the `Host:` header of the HTTP request. |
| **ip\_address** string | | IP address of the end-point to check. Either this or *fqdn* has to be provided. |
| **port** integer | | The port on the endpoint on which you want Amazon Route 53 to perform health checks. Required for TCP checks. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **request\_interval** integer | **Choices:*** 10
* 30
**Default:**30 | The number of seconds between the time that Amazon Route 53 gets a response from your endpoint and the time that it sends the next health-check request. |
| **resource\_path** string | | The path that you want Amazon Route 53 to request when performing health checks. The path can be any value for which your endpoint will return an HTTP status code of 2xx or 3xx when the endpoint is healthy, for example the file /docs/route53-health-check.html. Required for all checks except TCP. The path must begin with a / Maximum 255 characters. |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** **present** ←
* absent
| Specifies the action to take. |
| **string\_match** string | | If the check type is HTTP\_STR\_MATCH or HTTP\_STR\_MATCH, the string that you want Amazon Route 53 to search for in the response body from the specified resource. If the string appears in the first 5120 bytes of the response body, Amazon Route 53 considers the resource healthy. |
| **type** string / required | **Choices:*** HTTP
* HTTPS
* HTTP\_STR\_MATCH
* HTTPS\_STR\_MATCH
* TCP
| The type of health check that you want to create, which indicates how Amazon Route 53 determines whether an endpoint is healthy. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- name: Create a health-check for host1.example.com and use it in record
community.aws.route53_health_check:
state: present
fqdn: host1.example.com
type: HTTP_STR_MATCH
resource_path: /
string_match: "Hello"
request_interval: 10
failure_threshold: 2
register: my_health_check
- community.aws.route53:
action: create
zone: "example.com"
type: CNAME
record: "www.example.com"
value: host1.example.com
ttl: 30
# Routing policy
identifier: "host1@www"
weight: 100
health_check: "{{ my_health_check.health_check.id }}"
- name: Delete health-check
community.aws.route53_health_check:
state: absent
fqdn: host1.example.com
```
### Authors
* zimbatm (@zimbatm)
ansible community.aws.wafv2_ip_set_info – Get information about wafv2 ip sets community.aws.wafv2\_ip\_set\_info – Get information about wafv2 ip sets
========================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.wafv2_ip_set_info`.
New in version 1.5.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Get information about existing wafv2 ip sets.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **name** string / required | | The name of the IP set. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **scope** string / required | **Choices:*** CLOUDFRONT
* REGIONAL
| Specifies whether this is for an AWS CloudFront distribution or for a regional application. |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- name: test ip set
wafv2_ip_set_info:
name: test02
scope: REGIONAL
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **addresses** list / elements=string | Always, as long as the ip set exists | Current addresses of the ip set **Sample:** ['8.8.8.8/32', '8.8.4.4/32'] |
| **arn** string | Always, as long as the ip set exists | IP set arn **Sample:** arn:aws:wafv2:eu-central-1:11111111:regional/ipset/test02/4b007330-2934-4dc5-af24-82dcb3aeb127 |
| **description** string | Always, as long as the ip set exists | Description of the ip set **Sample:** Some IP set description |
| **ip\_address\_version** string | Always, as long as the ip set exists | IP version of the ip set **Sample:** IPV4 |
| **name** string | Always, as long as the ip set exists | IP set name **Sample:** test02 |
### Authors
* Markus Bergholz (@markuman)
ansible community.aws.cloudwatchlogs_log_group_info – Get information about log_group in CloudWatchLogs community.aws.cloudwatchlogs\_log\_group\_info – Get information about log\_group in CloudWatchLogs
===================================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.cloudwatchlogs_log_group_info`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Lists the specified log groups. You can list all your log groups or filter the results by prefix.
* This module was called `cloudwatchlogs_log_group_facts` before Ansible 2.9. The usage did not change.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **log\_group\_name** string | | The name or prefix of the log group to filter by. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
- community.aws.cloudwatchlogs_log_group_info:
log_group_name: test-log-group
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **log\_groups** complex | success | Return the list of complex objects representing log groups |
| | **arn** string | always | The Amazon Resource Name (ARN) of the log group. |
| | **creation\_time** integer | always | The creation time of the log group. |
| | **kms\_key\_id** string | always | The Amazon Resource Name (ARN) of the CMK to use when encrypting log data. |
| | **log\_group\_name** string | always | The name of the log group. |
| | **metric\_filter\_count** integer | always | The number of metric filters. |
| | **retention\_in\_days** integer | always | The number of days to retain the log events in the specified log group. |
| | **stored\_bytes** string | always | The number of bytes stored. |
### Authors
* Willian Ricardo (@willricardo) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#f6819f9a9a849f9597849299d0d5c5c1cdd0d5c3c4cdd0d5c2cecd919b979f9ad0d5c2c0cd95999b)>
| programming_docs |
ansible community.aws.aws_codepipeline – Create or delete AWS CodePipelines community.aws.aws\_codepipeline – Create or delete AWS CodePipelines
====================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.aws_codepipeline`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create or delete a CodePipeline on AWS.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **artifact\_store** dictionary / required | | Location information where artifacts are stored (on S3). Dictionary with fields type and location. |
| | **location** string | | Bucket name for artifacts. |
| | **type** string | | Type of the artifacts storage (only 'S3' is currently supported). |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **name** string / required | | Name of the pipeline |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **role\_arn** string / required | | ARN of the IAM role to use when executing the pipeline |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **stages** list / elements=dictionary / required | | List of stages to perform in the CodePipeline. List of dictionaries containing name and actions for each stage. |
| | **actions** list / elements=dictionary | | List of action configurations for that stage. See the boto3 documentation for full documentation of suboptions: <https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/codepipeline.html#CodePipeline.Client.create_pipeline> |
| | **name** string | | Name of the stage (step) in the codepipeline |
| **state** string | **Choices:*** **present** ←
* absent
| Create or remove code pipeline |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
| **version** integer | | Version number of the pipeline. This number is automatically incremented when a pipeline is updated. |
Notes
-----
Note
* for details of the parameters and returns see <http://boto3.readthedocs.io/en/latest/reference/services/codepipeline.html>
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Example for creating a pipeline for continuous deploy of Github code to an ECS cluster (container)
- community.aws.aws_codepipeline:
name: my_deploy_pipeline
role_arn: arn:aws:iam::123456:role/AWS-CodePipeline-Service
artifact_store:
type: S3
location: my_s3_codepipline_bucket
stages:
- name: Get_source
actions:
-
name: Git_pull
actionTypeId:
category: Source
owner: ThirdParty
provider: GitHub
version: '1'
outputArtifacts:
- { name: my-app-source }
configuration:
Owner: mediapeers
Repo: my_gh_repo
PollForSourceChanges: 'true'
Branch: master
# Generate token like this:
# https://docs.aws.amazon.com/codepipeline/latest/userguide/GitHub-rotate-personal-token-CLI.html
# GH Link: https://github.com/settings/tokens
OAuthToken: 'abc123def456'
runOrder: 1
- name: Build
actions:
-
name: CodeBuild
actionTypeId:
category: Build
owner: AWS
provider: CodeBuild
version: '1'
inputArtifacts:
- { name: my-app-source }
outputArtifacts:
- { name: my-app-build }
configuration:
# A project with that name needs to be setup on AWS CodeBuild already (use code_build module).
ProjectName: codebuild-project-name
runOrder: 1
- name: ECS_deploy
actions:
-
name: ECS_deploy
actionTypeId:
category: Deploy
owner: AWS
provider: ECS
version: '1'
inputArtifacts:
- { name: vod-api-app-build }
configuration:
# an ECS cluster with that name needs to be setup on AWS ECS already (use ecs_cluster and ecs_service module)
ClusterName: ecs-cluster-name
ServiceName: ecs-cluster-service-name
FileName: imagedefinitions.json
region: us-east-1
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **pipeline** complex | success | Returns the dictionary describing the code pipeline configuration. |
| | **artifact\_store** complex | always | Information about where the build artifacts are stored |
| | | **encryption\_key** string | when configured | The encryption key used to encrypt the artifacts store, such as an AWS KMS key. |
| | | **location** string | always | The location of the artifacts storage (s3 bucket name) **Sample:** my\_s3\_codepipline\_bucket |
| | | **type** string | always | The type of the artifacts store, such as S3 **Sample:** S3 |
| | **name** string | always | Name of the CodePipeline **Sample:** my\_deploy\_pipeline |
| | **role\_arn** string | always | ARN of the IAM role attached to the code pipeline **Sample:** arn:aws:iam::123123123:role/codepipeline-service-role |
| | **stages** list / elements=string | always | List of stages configured for this pipeline |
| | **version** integer | always | The version number of the pipeline. This number is auto incremented when pipeline params are changed. |
### Authors
* Stefan Horning (@stefanhorning) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#056d6a776b6c6b62232636323e232630373e2326313d3e6860616c647560607776232631333e666a68)>
ansible community.aws.iam_user – Manage AWS IAM users community.aws.iam\_user – Manage AWS IAM users
==============================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.iam_user`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage AWS IAM users.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **managed\_policies** list / elements=string | | A list of managed policy ARNs or friendly names to attach to the user. To embed an inline policy, use [community.aws.iam\_policy](iam_policy_module).
aliases: managed\_policy |
| **name** string / required | | The name of the user to create. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **purge\_policies** boolean | **Choices:*** **no** ←
* yes
| When *purge\_policies=true* any managed policies not listed in *managed\_policies* will be detatched.
aliases: purge\_policy, purge\_managed\_policies |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string / required | **Choices:*** present
* absent
| Create or remove the IAM user. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Note: This module does not allow management of groups that users belong to.
# Groups should manage their membership directly using `iam_group`,
# as users belong to them.
- name: Create a user
community.aws.iam_user:
name: testuser1
state: present
- name: Create a user and attach a managed policy using its ARN
community.aws.iam_user:
name: testuser1
managed_policies:
- arn:aws:iam::aws:policy/AmazonSNSFullAccess
state: present
- name: Remove all managed policies from an existing user with an empty list
community.aws.iam_user:
name: testuser1
state: present
purge_policies: true
- name: Delete the user
community.aws.iam_user:
name: testuser1
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **user** complex | success | dictionary containing all the user information |
| | **arn** string | success | the Amazon Resource Name (ARN) specifying the user **Sample:** arn:aws:iam::1234567890:user/testuser1 |
| | **create\_date** string | success | the date and time, in ISO 8601 date-time format, when the user was created **Sample:** 2017-02-08T04:36:28+00:00 |
| | **path** string | success | the path to the user **Sample:** / |
| | **user\_id** string | success | the stable and unique string identifying the user **Sample:** AGPAIDBWE12NSFINE55TM |
| | **user\_name** string | success | the friendly name that identifies the user **Sample:** testuser1 |
### Authors
* Josh Souza (@joshsouza)
ansible community.aws.sts_session_token – Obtain a session token from the AWS Security Token Service community.aws.sts\_session\_token – Obtain a session token from the AWS Security Token Service
==============================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.sts_session_token`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Obtain a session token from the AWS Security Token Service.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **duration\_seconds** integer | | The duration, in seconds, of the session token. See <https://docs.aws.amazon.com/STS/latest/APIReference/API_GetSessionToken.html#API_GetSessionToken_RequestParameters> for acceptable and default values. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **mfa\_serial\_number** string | | The identification number of the MFA device that is associated with the user who is making the GetSessionToken call. |
| **mfa\_token** string | | The value provided by the MFA device, if the trust policy of the user requires MFA. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* In order to use the session token in a following playbook task you must pass the *access\_key*, *access\_secret* and *access\_token*.
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
# (more details: https://docs.aws.amazon.com/STS/latest/APIReference/API_GetSessionToken.html)
- name: Get a session token
community.aws.sts_session_token:
duration_seconds: 3600
register: session_credentials
- name: Use the session token obtained above to tag an instance in account 123456789012
amazon.aws.ec2_tag:
aws_access_key: "{{ session_credentials.sts_creds.access_key }}"
aws_secret_key: "{{ session_credentials.sts_creds.secret_key }}"
security_token: "{{ session_credentials.sts_creds.session_token }}"
resource: i-xyzxyz01
state: present
tags:
MyNewTag: value
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **changed** boolean | always | True if obtaining the credentials succeeds |
| **sts\_creds** list / elements=string | always | The Credentials object returned by the AWS Security Token Service **Sample:** {'access\_key': 'ASXXXXXXXXXXXXXXXXXX', 'expiration': '2016-04-08T11:59:47+00:00', 'secret\_key': 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'session\_token': 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'} |
### Authors
* Victor Costan (@pwnall)
| programming_docs |
ansible community.aws.ecs_task – Run, start or stop a task in ecs community.aws.ecs\_task – Run, start or stop a task in ecs
==========================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.ecs_task`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Creates or deletes instances of task definitions.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* json
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **cluster** string / required | | The name of the cluster to run the task on. |
| **container\_instances** list / elements=string | | The list of container instances on which to deploy the task. |
| **count** integer | | How many new instances to start. |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **launch\_type** string | **Choices:*** EC2
* FARGATE
| The launch type on which to run your service. |
| **network\_configuration** dictionary | | Network configuration of the service. Only applicable for task definitions created with *network\_mode=awsvpc*.
*assign\_public\_ip* requires botocore >= 1.8.4 |
| | **assign\_public\_ip** boolean added in 1.5.0 of community.aws | **Choices:*** no
* yes
| Whether the task's elastic network interface receives a public IP address. |
| | **security\_groups** list / elements=string | | A list of group names or group IDs for the task. |
| | **subnets** list / elements=string | | A list of subnet IDs to which the task is attached. |
| **operation** string / required | **Choices:*** run
* start
* stop
| Which task operation to execute. When *operation=run* *task\_definition* must be set. When *operation=start* both *task\_definition* and *container\_instances* must be set. When *operation=stop* both *task\_definition* and *task* must be set. |
| **overrides** dictionary | | A dictionary of values to pass to the new instances. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **started\_by** string | | A value showing who or what started the task (for informational purposes). |
| **tags** dictionary | | Tags that will be added to ecs tasks on start and run |
| **task** string | | The ARN of the task to stop. |
| **task\_definition** string | | The task definition to start, run or stop. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Simple example of run task
- name: Run task
community.aws.ecs_task:
operation: run
cluster: console-sample-app-static-cluster
task_definition: console-sample-app-static-taskdef
count: 1
started_by: ansible_user
register: task_output
# Simple example of start task
- name: Start a task
community.aws.ecs_task:
operation: start
cluster: console-sample-app-static-cluster
task_definition: console-sample-app-static-taskdef
task: "arn:aws:ecs:us-west-2:172139249013:task/3f8353d1-29a8-4689-bbf6-ad79937ffe8a"
tags:
resourceName: a_task_for_ansible_to_run
type: long_running_task
network: internal
version: 1.4
container_instances:
- arn:aws:ecs:us-west-2:172139249013:container-instance/79c23f22-876c-438a-bddf-55c98a3538a8
started_by: ansible_user
network_configuration:
subnets:
- subnet-abcd1234
security_groups:
- sg-aaaa1111
- my_security_group
register: task_output
- name: RUN a task on Fargate
community.aws.ecs_task:
operation: run
cluster: console-sample-app-static-cluster
task_definition: console-sample-app-static-taskdef
task: "arn:aws:ecs:us-west-2:172139249013:task/3f8353d1-29a8-4689-bbf6-ad79937ffe8a"
started_by: ansible_user
launch_type: FARGATE
network_configuration:
subnets:
- subnet-abcd1234
security_groups:
- sg-aaaa1111
- my_security_group
register: task_output
- name: RUN a task on Fargate with public ip assigned
community.aws.ecs_task:
operation: run
count: 2
cluster: console-sample-app-static-cluster
task_definition: console-sample-app-static-taskdef
task: "arn:aws:ecs:us-west-2:172139249013:task/3f8353d1-29a8-4689-bbf6-ad79937ffe8a"
started_by: ansible_user
launch_type: FARGATE
network_configuration:
assign_public_ip: yes
subnets:
- subnet-abcd1234
register: task_output
- name: Stop a task
community.aws.ecs_task:
operation: stop
cluster: console-sample-app-static-cluster
task_definition: console-sample-app-static-taskdef
task: "arn:aws:ecs:us-west-2:172139249013:task/3f8353d1-29a8-4689-bbf6-ad79937ffe8a"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **task** complex | success | details about the task that was started |
| | **clusterArn** string | only when details is true | The Amazon Resource Name (ARN) of the of the cluster that hosts the task. |
| | **containerInstanceArn** string | only when details is true | The Amazon Resource Name (ARN) of the container running the task. |
| | **containers** list / elements=dictionary | only when details is true | The container details. |
| | **createdAt** string | only when details is true | The timestamp of when the task was created. |
| | **desiredStatus** string | only when details is true | The desired status of the task. |
| | **lastStatus** string | only when details is true | The last recorded status of the task. |
| | **launchType** string | always | The launch type on which to run your task. |
| | **overrides** list / elements=dictionary | only when details is true | The container overrides set for this task. |
| | **startedAt** string | only when details is true | The timestamp of when the task was started. |
| | **startedBy** string | only when details is true | The used who started the task. |
| | **stoppedAt** string | only when details is true | The timestamp of when the task was stopped. |
| | **stoppedReason** string | only when details is true | The reason why the task was stopped. |
| | **taskArn** string | always | The Amazon Resource Name (ARN) that identifies the task. |
| | **taskDefinitionArn** string | only when details is true | The Amazon Resource Name (ARN) of the task definition. |
### Authors
* Mark Chance (@Java1Guy)
ansible community.aws.ec2_asg_lifecycle_hook – Create, delete or update AWS ASG Lifecycle Hooks. community.aws.ec2\_asg\_lifecycle\_hook – Create, delete or update AWS ASG Lifecycle Hooks.
===========================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.ec2_asg_lifecycle_hook`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Will create a new hook when *state=present* and no given Hook is found.
* Will update an existing hook when *state=present* and a Hook is found, but current and provided parameters differ.
* Will delete the hook when *state=absent* and a Hook is found.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3>=1.4.4
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **autoscaling\_group\_name** string / required | | The name of the Auto Scaling group to which you want to assign the lifecycle hook. |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **default\_result** string | **Choices:*** **ABANDON** ←
* CONTINUE
| Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **heartbeat\_timeout** integer | | The amount of time, in seconds, that can elapse before the lifecycle hook times out. When the lifecycle hook times out, Auto Scaling performs the default action. You can prevent the lifecycle hook from timing out by calling RecordLifecycleActionHeartbeat. By default Amazon AWS will use 3600 (1 hour) |
| **lifecycle\_hook\_name** string / required | | The name of the lifecycle hook. |
| **notification\_meta\_data** string | | Contains additional information that you want to include any time Auto Scaling sends a message to the notification target. |
| **notification\_target\_arn** string | | The ARN of the notification target that Auto Scaling will use to notify you when an instance is in the transition state for the lifecycle hook. This target can be either an SQS queue or an SNS topic. If you specify an empty string, this overrides the current ARN. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **role\_arn** string | | The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target. |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** **present** ←
* absent
| Create or delete Lifecycle Hook. When *state=present* updates existing hook or creates a new hook if not found. |
| **transition** string | **Choices:*** autoscaling:EC2\_INSTANCE\_TERMINATING
* autoscaling:EC2\_INSTANCE\_LAUNCHING
| The instance state to which you want to attach the lifecycle hook. Required when *state=present*. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- name: Create / Update lifecycle hook
community.aws.ec2_asg_lifecycle_hook:
region: eu-central-1
state: present
autoscaling_group_name: example
lifecycle_hook_name: example
transition: autoscaling:EC2_INSTANCE_LAUNCHING
heartbeat_timeout: 7000
default_result: ABANDON
- name: Delete lifecycle hook
community.aws.ec2_asg_lifecycle_hook:
region: eu-central-1
state: absent
autoscaling_group_name: example
lifecycle_hook_name: example
```
### Authors
* Igor ‘Tsigankov’ Eyrich (@tsiganenok) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#deaaadb7b9bfb0bbb0b1b5f8fdede9e5f8fdebece5f8fdeae6e5b9b3bfb7b2f8fdeae8e5bdb1b3)>
ansible community.aws.ec2_placement_group – Create or delete an EC2 Placement Group community.aws.ec2\_placement\_group – Create or delete an EC2 Placement Group
=============================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.ec2_placement_group`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create an EC2 Placement Group; if the placement group already exists, nothing is done. Or, delete an existing placement group. If the placement group is absent, do nothing. See also <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html>
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* boto
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **name** string / required | | The name for the placement group. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** **present** ←
* absent
| Create or delete placement group. |
| **strategy** string | **Choices:*** **cluster** ←
* spread
| Placement group strategy. Cluster will cluster instances into a low-latency group in a single Availability Zone, while Spread spreads instances across underlying hardware. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide
# for details.
- name: Create a placement group.
community.aws.ec2_placement_group:
name: my-cluster
state: present
- name: Create a Spread placement group.
community.aws.ec2_placement_group:
name: my-cluster
state: present
strategy: spread
- name: Delete a placement group.
community.aws.ec2_placement_group:
name: my-cluster
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **placement\_group** complex | when state != absent | Placement group attributes |
| | **name** string | success | PG name **Sample:** my-cluster |
| | **state** string | success | PG state **Sample:** available |
| | **strategy** string | success | PG strategy **Sample:** cluster |
### Authors
* Brad Macpherson (@iiibrad)
| programming_docs |
ansible community.aws.aws_direct_connect_gateway – Manage AWS Direct Connect gateway community.aws.aws\_direct\_connect\_gateway – Manage AWS Direct Connect gateway
===============================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.aws_direct_connect_gateway`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Creates AWS Direct Connect Gateway.
* Deletes AWS Direct Connect Gateway.
* Attaches Virtual Gateways to Direct Connect Gateway.
* Detaches Virtual Gateways to Direct Connect Gateway.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **amazon\_asn** string | | The Amazon side ASN. Required when *state=present*. |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **direct\_connect\_gateway\_id** string | | The ID of an existing Direct Connect Gateway. Required when *state=absent*. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **name** string | | Name of the Direct Connect Gateway to be created or deleted. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** **present** ←
* absent
| Set *state=present* to ensure a resource is created. Set *state=absent* to remove a resource. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
| **virtual\_gateway\_id** string | | The VPN gateway ID of an existing virtual gateway. |
| **wait\_timeout** integer | **Default:**320 | How long to wait for the association to be deleted. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- name: Create a new direct connect gateway attached to virtual private gateway
community.aws.aws_direct_connect_gateway:
state: present
name: my-dx-gateway
amazon_asn: 7224
virtual_gateway_id: vpg-12345
register: created_dxgw
- name: Create a new unattached dxgw
community.aws.aws_direct_connect_gateway:
state: present
name: my-dx-gateway
amazon_asn: 7224
register: created_dxgw
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **result** complex | *state=present* | The attributes of the Direct Connect Gateway |
| | **amazon\_side\_asn** string | success | ASN on the amazon side. |
| | **direct\_connect\_gateway\_id** string | success | The ID of the direct connect gateway. |
| | **direct\_connect\_gateway\_name** string | success | The name of the direct connect gateway. |
| | **direct\_connect\_gateway\_state** string | success | The state of the direct connect gateway. |
| | **owner\_account** string | success | The AWS account ID of the owner of the direct connect gateway. |
### Authors
* Gobin Sougrakpam (@gobins)
ansible community.aws.iam_saml_federation – Maintain IAM SAML federation configuration. community.aws.iam\_saml\_federation – Maintain IAM SAML federation configuration.
=================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.iam_saml_federation`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Provides a mechanism to manage AWS IAM SAML Identity Federation providers (create/update/delete metadata).
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **name** string / required | | The name of the provider to create. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **saml\_metadata\_document** string | | The XML document generated by an identity provider (IdP) that supports SAML 2.0. |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** **present** ←
* absent
| Whether to create or delete identity provider. If 'present' is specified it will attempt to update the identity provider matching the name field. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
# It is assumed that their matching environment variables are set.
# Creates a new iam saml identity provider if not present
- name: saml provider
community.aws.iam_saml_federation:
name: example1
# the > below opens an indented block, so no escaping/quoting is needed when in the indentation level under this key
saml_metadata_document: >
<?xml version="1.0"?>...
<md:EntityDescriptor
# Creates a new iam saml identity provider if not present
- name: saml provider
community.aws.iam_saml_federation:
name: example2
saml_metadata_document: "{{ item }}"
with_file: /path/to/idp/metdata.xml
# Removes iam saml identity provider
- name: remove saml provider
community.aws.iam_saml_federation:
name: example3
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **saml\_provider** complex | present | Details of the SAML Identity Provider that was created/modified. |
| | **arn** string | present | The ARN of the identity provider. **Sample:** arn:aws:iam::123456789012:saml-provider/my\_saml\_provider |
| | **create\_date** string | present | The date and time when the SAML provider was created in ISO 8601 date-time format. **Sample:** 2017-02-08T04:36:28+00:00 |
| | **expire\_date** string | present | The expiration date and time for the SAML provider in ISO 8601 date-time format. **Sample:** 2017-02-08T04:36:28+00:00 |
| | **metadata\_document** string | present | The XML metadata document that includes information about an identity provider. |
### Authors
* Tony (@axc450)
* Aidan Rowe (@aidan-)
ansible community.aws.ec2_scaling_policy – Create or delete AWS scaling policies for Autoscaling groups community.aws.ec2\_scaling\_policy – Create or delete AWS scaling policies for Autoscaling groups
=================================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.ec2_scaling_policy`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Can create or delete scaling policies for autoscaling groups.
* Referenced autoscaling groups must already exist.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* boto
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **adjustment\_type** string | **Choices:*** ChangeInCapacity
* ExactCapacity
* PercentChangeInCapacity
| The type of change in capacity of the autoscaling group. Required if *state* is `present`. |
| **asg\_name** string | | Name of the associated autoscaling group. Required if *state* is `present`. |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **cooldown** integer | | The minimum period of time (in seconds) between which autoscaling actions can take place. Only used when *policy\_type* is `SimpleScaling`. |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **estimated\_instance\_warmup** integer | | The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics. |
| **metric\_aggregation** string | **Choices:*** Minimum
* Maximum
* **Average** ←
| The aggregation type for the CloudWatch metrics. Only used when *policy\_type* is not `SimpleScaling`. |
| **min\_adjustment\_step** integer | | Minimum amount of adjustment when policy is triggered. Only used when *adjustment\_type* is `PercentChangeInCapacity`. |
| **name** string / required | | Unique name for the scaling policy. |
| **policy\_type** string | **Choices:*** StepScaling
* **SimpleScaling** ←
| Auto scaling adjustment policy. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **scaling\_adjustment** integer | | The amount by which the autoscaling group is adjusted by the policy. A negative number has the effect of scaling down the ASG. Units are numbers of instances for `ExactCapacity` or `ChangeInCapacity` or percent of existing instances for `PercentChangeInCapacity`. Required when *policy\_type* is `SimpleScaling`. |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** **present** ←
* absent
| Register or deregister the policy. |
| **step\_adjustments** list / elements=dictionary | | list of dicts containing *lower\_bound*, *upper\_bound* and *scaling\_adjustment*
Intervals must not overlap or have a gap between them. At most, one item can have an undefined *lower\_bound*. If any item has a negative lower\_bound, then there must be a step adjustment with an undefined *lower\_bound*. At most, one item can have an undefined *upper\_bound*. If any item has a positive upper\_bound, then there must be a step adjustment with an undefined *upper\_bound*. The bounds are the amount over the alarm threshold at which the adjustment will trigger. This means that for an alarm threshold of 50, triggering at 75 requires a lower bound of 25. See <http://docs.aws.amazon.com/AutoScaling/latest/APIReference/API_StepAdjustment.html>. |
| | **lower\_bound** integer | | The lower bound for the difference between the alarm threshold and the CloudWatch metric. |
| | **scaling\_adjustment** integer / required | | The amount by which to scale. |
| | **upper\_bound** integer | | The upper bound for the difference between the alarm threshold and the CloudWatch metric. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- name: Simple Scale Down policy
community.aws.ec2_scaling_policy:
state: present
region: US-XXX
name: "scaledown-policy"
adjustment_type: "ChangeInCapacity"
asg_name: "application-asg"
scaling_adjustment: -1
min_adjustment_step: 1
cooldown: 300
# For an alarm with a breach threshold of 20, the
# following creates a stepped policy:
# From 20-40 (0-20 above threshold), increase by 50% of existing capacity
# From 41-infinity, increase by 100% of existing capacity
- community.aws.ec2_scaling_policy:
state: present
region: US-XXX
name: "step-scale-up-policy"
policy_type: StepScaling
metric_aggregation: Maximum
step_adjustments:
- upper_bound: 20
scaling_adjustment: 50
- lower_bound: 20
scaling_adjustment: 100
adjustment_type: "PercentChangeInCapacity"
asg_name: "application-asg"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **adjustment\_type** string | always | Scaling policy adjustment type **Sample:** PercentChangeInCapacity |
| **alarms** complex | always | Cloudwatch alarms related to the policy |
| | **alarm\_arn** string | always | ARN of the Cloudwatch alarm **Sample:** arn:aws:cloudwatch:us-east-2:1234567890:alarm:cpu-very-high |
| | **alarm\_name** string | always | name of the Cloudwatch alarm **Sample:** cpu-very-high |
| **arn** string | always | ARN of the scaling policy. Provided for backward compatibility, value is the same as *policy\_arn*
**Sample:** arn:aws:autoscaling:us-east-2:123456789012:scalingPolicy:59e37526-bd27-42cf-adca-5cd3d90bc3b9:autoScalingGroupName/app-asg:policyName/app-policy |
| **as\_name** string | always | Auto Scaling Group name. Provided for backward compatibility, value is the same as *auto\_scaling\_group\_name*
**Sample:** app-asg |
| **auto\_scaling\_group\_name** string | always | Name of Auto Scaling Group **Sample:** app-asg |
| **metric\_aggregation\_type** string | when *policy\_type* is `StepScaling` | Method used to aggregate metrics **Sample:** Maximum |
| **name** string | always | Name of the scaling policy. Provided for backward compatibility, value is the same as *policy\_name*
**Sample:** app-policy |
| **policy\_arn** string | always | ARN of scaling policy. **Sample:** arn:aws:autoscaling:us-east-2:123456789012:scalingPolicy:59e37526-bd27-42cf-adca-5cd3d90bc3b9:autoScalingGroupName/app-asg:policyName/app-policy |
| **policy\_name** string | always | Name of scaling policy **Sample:** app-policy |
| **policy\_type** string | always | Type of auto scaling policy **Sample:** StepScaling |
| **scaling\_adjustment** integer | When *policy\_type* is `SimpleScaling` | Adjustment to make when alarm is triggered **Sample:** 1 |
| **step\_adjustments** complex | always | List of step adjustments |
| | **metric\_interval\_lower\_bound** float | if step has a lower bound | Lower bound for metric interval **Sample:** 20.0 |
| | **metric\_interval\_upper\_bound** float | if step has an upper bound | Upper bound for metric interval **Sample:** 40.0 |
| | **scaling\_adjustment** integer | always | Adjustment to make if this step is reached **Sample:** 50 |
### Authors
* Zacharie Eakin (@zeekin)
* Will Thames (@willthames)
| programming_docs |
ansible community.aws.ec2_lc – Create or delete AWS Autoscaling Launch Configurations community.aws.ec2\_lc – Create or delete AWS Autoscaling Launch Configurations
==============================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.ec2_lc`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Can create or delete AWS Autoscaling Configurations.
* Works with the ec2\_asg module to manage Autoscaling Groups.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3 >= 1.4.4
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **assign\_public\_ip** boolean | **Choices:*** no
* yes
| Used for Auto Scaling groups that launch instances into an Amazon Virtual Private Cloud. Specifies whether to assign a public IP address to each instance launched in a Amazon VPC. |
| **associate\_public\_ip\_address** boolean | **Choices:*** no
* yes
| The *associate\_public\_ip\_address* option does nothing and will be removed after 2022-06-01 |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **classic\_link\_vpc\_id** string | | Id of ClassicLink enabled VPC |
| **classic\_link\_vpc\_security\_groups** list / elements=string | | A list of security group IDs with which to associate the ClassicLink VPC instances. |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ebs\_optimized** boolean | **Choices:*** **no** ←
* yes
| Specifies whether the instance is optimized for EBS I/O (true) or not (false). |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **image\_id** string | | The AMI unique identifier to be used for the group. |
| **instance\_id** string | | The Id of a running instance to use as a basis for a launch configuration. Can be used in place of *image\_id* and *instance\_type*. |
| **instance\_monitoring** boolean | **Choices:*** **no** ←
* yes
| Specifies whether instances are launched with detailed monitoring. |
| **instance\_profile\_name** string | | The name or the Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the instances. |
| **instance\_type** string | | Instance type to use for the instance. Required when creating a new Launch Configuration. |
| **kernel\_id** string | | Kernel id for the EC2 instance. |
| **key\_name** string | | The SSH key name to be used for access to managed instances. |
| **name** string / required | | Unique name for configuration. |
| **placement\_tenancy** string | **Choices:*** default
* dedicated
| Determines whether the instance runs on single-tenant hardware or not. When not set AWS will default to `default`. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **ramdisk\_id** string | | A RAM disk id for the instances. |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_groups** list / elements=string | | A list of security groups to apply to the instances. Since version 2.4 you can specify either security group names or IDs or a mix. Previous to 2.4, for VPC instances, specify security group IDs and for EC2-Classic, specify either security group names or IDs. |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **spot\_price** float | | The spot price you are bidding. Only applies for an autoscaling group with spot instances. |
| **state** string | **Choices:*** **present** ←
* absent
| Register or deregister the instance. |
| **user\_data** string | | Opaque blob of data which is made available to the ec2 instance. Mutually exclusive with *user\_data\_path*. |
| **user\_data\_path** path | | Path to the file that contains userdata for the ec2 instances. Mutually exclusive with *user\_data*. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
| **volumes** list / elements=dictionary | | A list dictionaries defining the volumes to create. For any volume, a volume size less than 1 will be interpreted as a request not to create the volume. |
| | **delete\_on\_termination** boolean | **Choices:*** **no** ←
* yes
| Whether the volume should be automatically deleted when the instance is terminated. |
| | **device\_name** string / required | | The name for the volume (For example `/dev/sda`). |
| | **encrypted** boolean | **Choices:*** **no** ←
* yes
| Whether the volume should be encrypted using the 'aws/ebs' KMS CMK. |
| | **ephemeral** string | | Whether the volume should be ephemeral. Data on ephemeral volumes is lost when the instance is stopped. Mutually exclusive with the *snapshot* parameter. |
| | **iops** integer | | The number of IOPS per second to provision for the volume. Required when *volume\_type=io1*. |
| | **no\_device** boolean | **Choices:*** no
* yes
| When *no\_device=true* the device will not be created. |
| | **snapshot** string | | The ID of an EBS snapshot to copy when creating the volume. Mutually exclusive with the *ephemeral* parameter. |
| | **volume\_size** integer | | The size of the volume (in GiB). Required unless one of *ephemeral*, *snapshot* or *no\_device* is set. |
| | **volume\_type** string | | The type of volume to create. See <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html> for more information on the available volume types. |
| **vpc\_id** string | | VPC ID, used when resolving security group names to IDs. |
Notes
-----
Note
* Amazon ASG Autoscaling Launch Configurations are immutable once created, so modifying the configuration after it is changed will not modify the launch configuration on AWS. You must create a new config and assign it to the ASG instead.
* encrypted volumes are supported on versions >= 2.4
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# create a launch configuration using an AMI image and instance type as a basis
- name: note that encrypted volumes are only supported in >= Ansible 2.4
community.aws.ec2_lc:
name: special
image_id: ami-XXX
key_name: default
security_groups: ['group', 'group2' ]
instance_type: t1.micro
volumes:
- device_name: /dev/sda1
volume_size: 100
volume_type: io1
iops: 3000
delete_on_termination: true
encrypted: true
- device_name: /dev/sdb
ephemeral: ephemeral0
- name: create a launch configuration using a running instance id as a basis
community.aws.ec2_lc:
name: special
instance_id: i-00a48b207ec59e948
key_name: default
security_groups: ['launch-wizard-2' ]
volumes:
- device_name: /dev/sda1
volume_size: 120
volume_type: io1
iops: 3000
delete_on_termination: true
- name: create a launch configuration to omit the /dev/sdf EBS device that is included in the AMI image
community.aws.ec2_lc:
name: special
image_id: ami-XXX
key_name: default
security_groups: ['group', 'group2' ]
instance_type: t1.micro
volumes:
- device_name: /dev/sdf
no_device: true
- name: Use EBS snapshot ID for volume
block:
- name: Set Volume Facts
ansible.builtin.set_fact:
volumes:
- device_name: /dev/sda1
volume_size: 20
ebs:
snapshot: snap-XXXX
volume_type: gp2
delete_on_termination: true
encrypted: no
- name: Create launch configuration
community.aws.ec2_lc:
name: lc1
image_id: ami-xxxx
assign_public_ip: yes
instance_type: t2.medium
key_name: my-key
security_groups: "['sg-xxxx']"
volumes: "{{ volumes }}"
register: lc_info
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **arn** string | when *state=present* | The Amazon Resource Name of the launch configuration. **Sample:** arn:aws:autoscaling:us-east-1:148830907657:launchConfiguration:888d9b58-d93a-40c4-90cf-759197a2621a:launchConfigurationName/launch\_config\_name |
| **changed** boolean | always | Whether the state of the launch configuration has changed. |
| **created\_time** string | when *state=present* | The creation date and time for the launch configuration. **Sample:** 2017-11-03 23:46:44.841000 |
| **image\_id** string | when *state=present* | The ID of the Amazon Machine Image used by the launch configuration. **Sample:** ami-9be6f38c |
| **instance\_type** string | when *state=present* | The instance type for the instances. **Sample:** t1.micro |
| **name** string | when *state=present* | The name of the launch configuration. **Sample:** launch\_config\_name |
| **result** complex | when *state=present* | The specification details for the launch configuration. |
| | **associate\_public\_ip\_address** boolean | when *state=present* | (EC2-VPC) Indicates whether to assign a public IP address to each instance. |
| | **block\_device\_mappings** complex | when *state=present* | A block device mapping, which specifies the block devices. |
| | | **device\_name** string | when *state=present* | The device name exposed to the EC2 instance (for example, /dev/sdh or xvdh). **Sample:** /dev/sda1 |
| | | **ebs** complex | when *state=present* | The information about the Amazon EBS volume. |
| | | | **snapshot\_id** string | when *state=present* | The ID of the snapshot. |
| | | | **volume\_size** string | when *state=present* | The volume size, in GiB. **Sample:** 100 |
| | | **virtual\_name** string | when *state=present* | The name of the virtual device (for example, ephemeral0). **Sample:** ephemeral0 |
| | **classic\_link\_vpc\_id** string | when *state=present* | The ID of a ClassicLink-enabled VPC to link your EC2-Classic instances to. |
| | **classic\_link\_vpc\_security\_groups** list / elements=string | when *state=present* | The IDs of one or more security groups for the VPC specified in ClassicLinkVPCId. |
| | **created\_time** string | when *state=present* | The creation date and time for the launch configuration. **Sample:** 2017-11-03 23:46:44.841000 |
| | **delete\_on\_termination** boolean | when *state=present* | Indicates whether the volume is deleted on instance termination. **Sample:** True |
| | **ebs\_optimized** boolean | when *state=present* | Indicates whether the instance is optimized for EBS I/O (true) or not (false). |
| | **image\_id** string | when *state=present* | The ID of the Amazon Machine Image used by the launch configuration. **Sample:** ami-9be6f38c |
| | **instance\_monitoring** boolean | when *state=present* | Indicates whether instances in this group are launched with detailed (true) or basic (false) monitoring. **Sample:** True |
| | **instance\_profile\_name** string | when *state=present* | The name or Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the instance. |
| | **instance\_type** string | when *state=present* | The instance type for the instances. **Sample:** t1.micro |
| | **iops** integer | when *state=present* | The number of I/O operations per second (IOPS) to provision for the volume. |
| | **kernel\_id** string | when *state=present* | The ID of the kernel associated with the AMI. |
| | **key\_name** string | when *state=present* | The name of the key pair. **Sample:** testkey |
| | **launch\_configuration\_arn** string | when *state=present* | The Amazon Resource Name (ARN) of the launch configuration. **Sample:** arn:aws:autoscaling:us-east-1:148830907657:launchConfiguration:888d9b58-d93a-40c4-90cf-759197a2621a:launchConfigurationName/launch\_config\_name |
| | **member** string | when *state=present* | **Sample:** |
| | **name** string | when *state=present* | The name of the launch configuration. **Sample:** launch\_config\_name |
| | **PlacementTenancy** string | when *state=present* | The tenancy of the instances, either default or dedicated. **Sample:** default |
| | **ramdisk\_id** string | when *state=present* | The ID of the RAM disk associated with the AMI. |
| | **security\_groups** list / elements=string | when *state=present* | The security groups to associate with the instances. **Sample:** ['sg-5e27db2f'] |
| | **spot\_price** float | when *state=present* | The price to bid when launching Spot Instances. |
| | **use\_block\_device\_types** boolean | when *state=present* | Indicates whether to suppress a device mapping. |
| | **user\_data** string | when *state=present* | The user data available to the instances. |
| | **volume\_type** string | when *state=present* | The volume type (one of standard, io1, gp2). **Sample:** io1 |
| **security\_groups** list / elements=string | when *state=present* | The security groups to associate with the instances. **Sample:** ['sg-5e27db2f'] |
### Authors
* Gareth Rushgrove (@garethr)
* Willem van Ketwich (@wilvk)
ansible community.aws.ec2_asg – Create or delete AWS AutoScaling Groups (ASGs) community.aws.ec2\_asg – Create or delete AWS AutoScaling Groups (ASGs)
=======================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.ec2_asg`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Can create or delete AWS AutoScaling Groups.
* Can be used with the [community.aws.ec2\_lc](ec2_lc_module#ansible-collections-community-aws-ec2-lc-module) module to manage Launch Configurations.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **availability\_zones** list / elements=string | | List of availability zone names in which to create the group. Defaults to all the availability zones in the region if *vpc\_zone\_identifier* is not set. |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **default\_cooldown** integer | **Default:**300 | The number of seconds after a scaling activity completes before another can begin. |
| **desired\_capacity** integer | | Desired number of instances in group, if unspecified then the current group value will be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **health\_check\_period** integer | **Default:**300 | Length of time in seconds after a new EC2 instance comes into service that Auto Scaling starts checking its health. |
| **health\_check\_type** string | **Choices:*** **EC2** ←
* ELB
| The service you want the health status from, Amazon EC2 or Elastic Load Balancer. |
| **launch\_config\_name** string | | Name of the Launch configuration to use for the group. See the community.aws.ec2\_lc) module for managing these. If unspecified then the current group value will be used. One of *launch\_config\_name* or *launch\_template* must be provided. |
| **launch\_template** dictionary | | Dictionary describing the Launch Template to use |
| | **launch\_template\_id** string | | The id of the launch template. Only one of *launch\_template\_name* or *launch\_template\_id* is required. |
| | **launch\_template\_name** string | | The name of the launch template. Only one of *launch\_template\_name* or *launch\_template\_id* is required. |
| | **version** string | | The version number of the launch template to use. Defaults to latest version if not provided. |
| **lc\_check** boolean | **Choices:*** no
* **yes** ←
| Check to make sure instances that are being replaced with *replace\_instances* do not already have the current *launch\_config*. |
| **load\_balancers** list / elements=string | | List of ELB names to use for the group. Use for classic load balancers. |
| **lt\_check** boolean | **Choices:*** no
* **yes** ←
| Check to make sure instances that are being replaced with *replace\_instances* do not already have the current *launch\_template or I(launch\_template* *version*. |
| **max\_instance\_lifetime** integer | | The maximum amount of time, in seconds, that an instance can be in service. Maximum instance lifetime must be equal to 0, between 604800 and 31536000 seconds (inclusive), or not specified. Value of 0 removes lifetime restriction. |
| **max\_size** integer | | Maximum number of instances in group, if unspecified then the current group value will be used. |
| **metrics\_collection** boolean | **Choices:*** **no** ←
* yes
| Enable ASG metrics collection. |
| **metrics\_granularity** string | **Default:**"1Minute" | When *metrics\_collection=true* this will determine the granularity of metrics collected by CloudWatch. |
| **metrics\_list** list / elements=string | **Default:**["GroupMinSize", "GroupMaxSize", "GroupDesiredCapacity", "GroupInServiceInstances", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"] | List of autoscaling metrics to collect when *metrics\_collection=true*. |
| **min\_size** integer | | Minimum number of instances in group, if unspecified then the current group value will be used. |
| **mixed\_instances\_policy** dictionary | | A mixed instance policy to use for the ASG. Only used when the ASG is configured to use a Launch Template (*launch\_template*). See also <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-mixedinstancespolicy.html>
|
| | **instance\_types** list / elements=string | | A list of instance\_types. |
| | **instances\_distribution** dictionary added in 1.5.0 of community.aws | | Specifies the distribution of On-Demand Instances and Spot Instances, the maximum price to pay for Spot Instances, and how the Auto Scaling group allocates instance types to fulfill On-Demand and Spot capacity. See also <https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_InstancesDistribution.html>
|
| | | **on\_demand\_allocation\_strategy** string added in 1.5.0 of community.aws | | Indicates how to allocate instance types to fulfill On-Demand capacity. |
| | | **on\_demand\_base\_capacity** integer added in 1.5.0 of community.aws | | The minimum amount of the Auto Scaling group's capacity that must be fulfilled by On-Demand Instances. This base portion is provisioned first as your group scales. Default if not set is 0. If you leave it set to 0, On-Demand Instances are launched as a percentage of the Auto Scaling group's desired capacity, per the OnDemandPercentageAboveBaseCapacity setting. |
| | | **on\_demand\_percentage\_above\_base\_capacity** integer added in 1.5.0 of community.aws | | Controls the percentages of On-Demand Instances and Spot Instances for your additional capacity beyond OnDemandBaseCapacity. Default if not set is 100. If you leave it set to 100, the percentages are 100% for On-Demand Instances and 0% for Spot Instances. Valid range: 0 to 100 |
| | | **spot\_allocation\_strategy** string added in 1.5.0 of community.aws | | Indicates how to allocate instances across Spot Instance pools. |
| | | **spot\_instance\_pools** integer added in 1.5.0 of community.aws | | The number of Spot Instance pools across which to allocate your Spot Instances. The Spot pools are determined from the different instance types in the Overrides array of LaunchTemplate. Default if not set is 2. Used only when the Spot allocation strategy is lowest-price. Valid Range: Minimum value of 1. Maximum value of 20. |
| | | **spot\_max\_price** string added in 1.5.0 of community.aws | | The maximum price per unit hour that you are willing to pay for a Spot Instance. If you leave the value of this parameter blank (which is the default), the maximum Spot price is set at the On-Demand price. To remove a value that you previously set, include the parameter but leave the value blank. |
| **name** string / required | | Unique name for group to be created or deleted. |
| **notification\_topic** string | | A SNS topic ARN to send auto scaling notifications to. |
| **notification\_types** list / elements=string | **Default:**["autoscaling:EC2\_INSTANCE\_LAUNCH", "autoscaling:EC2\_INSTANCE\_LAUNCH\_ERROR", "autoscaling:EC2\_INSTANCE\_TERMINATE", "autoscaling:EC2\_INSTANCE\_TERMINATE\_ERROR"] | A list of auto scaling events to trigger notifications on. |
| **placement\_group** string | | Physical location of your cluster placement group created in Amazon EC2. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **replace\_all\_instances** boolean | **Choices:*** **no** ←
* yes
| In a rolling fashion, replace all instances that used the old launch configuration with one from the new launch configuration. It increases the ASG size by *replace\_batch\_size*, waits for the new instances to be up and running. After that, it terminates a batch of old instances, waits for the replacements, and repeats, until all old instances are replaced. Once that's done the ASG size is reduced back to the expected size. |
| **replace\_batch\_size** integer | **Default:**1 | Number of instances you'd like to replace at a time. Used with *replace\_all\_instances*. |
| **replace\_instances** list / elements=string | | List of *instance\_ids* belonging to the named AutoScalingGroup that you would like to terminate and be replaced with instances matching the current launch configuration. |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** **present** ←
* absent
| Register or deregister the instance. |
| **suspend\_processes** list / elements=string | **Default:**[] | A list of scaling processes to suspend. Valid values include:
`Launch`, `Terminate`, `HealthCheck`, `ReplaceUnhealthy`, `AZRebalance`, `AlarmNotification`, `ScheduledActions`, `AddToLoadBalancer`
Full documentation of valid values can be found in the AWS documentation: <https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-suspend-resume-processes.html> |
| **tags** list / elements=dictionary | | A list of tags to add to the Auto Scale Group. Optional key is *propagate\_at\_launch*, which defaults to true. When *propagate\_at\_launch* is true the tags will be propagated to the Instances created. |
| **target\_group\_arns** list / elements=string | | List of target group ARNs to use for the group. Use for application load balancers. |
| **termination\_policies** list / elements=string | **Default:**"Default" | An ordered list of criteria used for selecting instances to be removed from the Auto Scaling group when reducing capacity. Using *termination\_policies=Default* when modifying an existing AutoScalingGroup will result in the existing policy being retained instead of changed to `Default`. Valid values include: `Default`, `OldestInstance`, `NewestInstance`, `OldestLaunchConfiguration`, `ClosestToNextInstanceHour`
Full documentation of valid values can be found in the AWS documentation: <https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-instance-termination.html#custom-termination-policy> |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
| **vpc\_zone\_identifier** list / elements=string | | List of VPC subnets to use |
| **wait\_for\_instances** boolean | **Choices:*** no
* **yes** ←
| Wait for the ASG instances to be in a ready state before exiting. If instances are behind an ELB, it will wait until the ELB determines all instances have a lifecycle\_state of "InService" and a health\_status of "Healthy". |
| **wait\_timeout** integer | **Default:**300 | How long to wait for instances to become viable when replaced. If you experience the error "Waited too long for ELB instances to be healthy", try increasing this value. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Basic configuration with Launch Configuration
- community.aws.ec2_asg:
name: special
load_balancers: [ 'lb1', 'lb2' ]
availability_zones: [ 'eu-west-1a', 'eu-west-1b' ]
launch_config_name: 'lc-1'
min_size: 1
max_size: 10
desired_capacity: 5
vpc_zone_identifier: [ 'subnet-abcd1234', 'subnet-1a2b3c4d' ]
tags:
- environment: production
propagate_at_launch: no
# Rolling ASG Updates
# Below is an example of how to assign a new launch config to an ASG and terminate old instances.
#
# All instances in "myasg" that do not have the launch configuration named "my_new_lc" will be terminated in
# a rolling fashion with instances using the current launch configuration, "my_new_lc".
#
# This could also be considered a rolling deploy of a pre-baked AMI.
#
# If this is a newly created group, the instances will not be replaced since all instances
# will have the current launch configuration.
- name: create launch config
community.aws.ec2_lc:
name: my_new_lc
image_id: ami-lkajsf
key_name: mykey
region: us-east-1
security_groups: sg-23423
instance_type: m1.small
assign_public_ip: yes
- community.aws.ec2_asg:
name: myasg
launch_config_name: my_new_lc
health_check_period: 60
health_check_type: ELB
replace_all_instances: yes
min_size: 5
max_size: 5
desired_capacity: 5
region: us-east-1
# To only replace a couple of instances instead of all of them, supply a list
# to "replace_instances":
- community.aws.ec2_asg:
name: myasg
launch_config_name: my_new_lc
health_check_period: 60
health_check_type: ELB
replace_instances:
- i-b345231
- i-24c2931
min_size: 5
max_size: 5
desired_capacity: 5
region: us-east-1
# Basic Configuration with Launch Template
- community.aws.ec2_asg:
name: special
load_balancers: [ 'lb1', 'lb2' ]
availability_zones: [ 'eu-west-1a', 'eu-west-1b' ]
launch_template:
version: '1'
launch_template_name: 'lt-example'
launch_template_id: 'lt-123456'
min_size: 1
max_size: 10
desired_capacity: 5
vpc_zone_identifier: [ 'subnet-abcd1234', 'subnet-1a2b3c4d' ]
tags:
- environment: production
propagate_at_launch: no
# Basic Configuration with Launch Template using mixed instance policy
- community.aws.ec2_asg:
name: special
load_balancers: [ 'lb1', 'lb2' ]
availability_zones: [ 'eu-west-1a', 'eu-west-1b' ]
launch_template:
version: '1'
launch_template_name: 'lt-example'
launch_template_id: 'lt-123456'
mixed_instances_policy:
instance_types:
- t3a.large
- t3.large
- t2.large
instances_distribution:
on_demand_percentage_above_base_capacity: 0
spot_allocation_strategy: capacity-optimized
min_size: 1
max_size: 10
desired_capacity: 5
vpc_zone_identifier: [ 'subnet-abcd1234', 'subnet-1a2b3c4d' ]
tags:
- environment: production
propagate_at_launch: no
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **auto\_scaling\_group\_arn** string | success | The unique ARN of the autoscaling group **Sample:** arn:aws:autoscaling:us-east-1:123456789012:autoScalingGroup:6a09ad6d-eeee-1234-b987-ee123ced01ad:autoScalingGroupName/myasg |
| **auto\_scaling\_group\_name** string | success | The unique name of the auto scaling group **Sample:** myasg |
| **availability\_zones** list / elements=string | success | The availability zones for the auto scaling group **Sample:** ['us-east-1d'] |
| **created\_time** string | success | Timestamp of create time of the auto scaling group **Sample:** 2017-11-08T14:41:48.272000+00:00 |
| **default\_cooldown** integer | success | The default cooldown time in seconds. **Sample:** 300 |
| **desired\_capacity** integer | success | The number of EC2 instances that should be running in this group. **Sample:** 3 |
| **healthcheck\_period** integer | success | Length of time in seconds after a new EC2 instance comes into service that Auto Scaling starts checking its health. **Sample:** 30 |
| **healthcheck\_type** string | success | The service you want the health status from, one of "EC2" or "ELB". **Sample:** ELB |
| **healthy\_instances** integer | success | Number of instances in a healthy state **Sample:** 5 |
| **in\_service\_instances** integer | success | Number of instances in service **Sample:** 3 |
| **instance\_facts** dictionary | success | Dictionary of EC2 instances and their status as it relates to the ASG. **Sample:** {'i-0123456789012': {'health\_status': 'Healthy', 'launch\_config\_name': 'public-webapp-production-1', 'lifecycle\_state': 'InService'}} |
| **instances** list / elements=string | success | list of instance IDs in the ASG **Sample:** ['i-0123456789012'] |
| **launch\_config\_name** string | success | Name of launch configuration associated with the ASG. Same as launch\_configuration\_name, provided for compatibility with ec2\_asg module. **Sample:** public-webapp-production-1 |
| **load\_balancers** list / elements=string | success | List of load balancers names attached to the ASG. **Sample:** ['elb-webapp-prod'] |
| **max\_instance\_lifetime** integer | success | The maximum amount of time, in seconds, that an instance can be in service. **Sample:** 604800 |
| **max\_size** integer | success | Maximum size of group **Sample:** 3 |
| **metrics\_collection** list / elements=string | success | List of enabled AutosSalingGroup metrics **Sample:** [{'Granularity': '1Minute', 'Metric': 'GroupInServiceInstances'}] |
| **min\_size** integer | success | Minimum size of group **Sample:** 1 |
| **mixed\_instances\_policy** list / elements=string | success | Returns the list of instance types if a mixed instances policy is set. **Sample:** ['t3.micro', 't3a.micro'] |
| **mixed\_instances\_policy\_full** dictionary | success | Returns the full dictionary representation of the mixed instances policy if a mixed instances policy is set. **Sample:** {'instances\_distribution': {'on\_demand\_allocation\_strategy': 'prioritized', 'on\_demand\_base\_capacity': 0, 'on\_demand\_percentage\_above\_base\_capacity': 0, 'spot\_allocation\_strategy': 'capacity-optimized'}, 'launch\_template': {'launch\_template\_specification': {'launch\_template\_id': 'lt-53c2425cffa544c23', 'launch\_template\_name': 'random-LaunchTemplate', 'version': '2'}, 'overrides': [{'instance\_type': 'm5.xlarge'}, {'instance\_type': 'm5a.xlarge'}]}} |
| **pending\_instances** integer | success | Number of instances in pending state **Sample:** 1 |
| **tags** list / elements=string | success | List of tags for the ASG, and whether or not each tag propagates to instances at launch. **Sample:** [{'key': 'Name', 'propagate\_at\_launch': 'true', 'resource\_id': 'public-webapp-production-1', 'resource\_type': 'auto-scaling-group', 'value': 'public-webapp-production-1'}, {'key': 'env', 'propagate\_at\_launch': 'true', 'resource\_id': 'public-webapp-production-1', 'resource\_type': 'auto-scaling-group', 'value': 'production'}] |
| **target\_group\_arns** list / elements=string | success | List of ARNs of the target groups that the ASG populates **Sample:** ['arn:aws:elasticloadbalancing:ap-southeast-2:123456789012:targetgroup/target-group-host-hello/1a2b3c4d5e6f1a2b', 'arn:aws:elasticloadbalancing:ap-southeast-2:123456789012:targetgroup/target-group-path-world/abcd1234abcd1234'] |
| **target\_group\_names** list / elements=string | success | List of names of the target groups that the ASG populates **Sample:** ['target-group-host-hello', 'target-group-path-world'] |
| **termination\_policies** list / elements=string | success | A list of termination policies for the group. **Sample:** ['Default'] |
| **unhealthy\_instances** integer | success | Number of instances in an unhealthy state |
| **viable\_instances** integer | success | Number of instances in a viable state **Sample:** 1 |
| **vpc\_zone\_identifier** string | success | VPC zone ID / subnet id for the auto scaling group **Sample:** subnet-a31ef45f |
### Authors
* Gareth Rushgrove (@garethr)
| programming_docs |
ansible community.aws.wafv2_rule_group – wafv2_web_acl community.aws.wafv2\_rule\_group – wafv2\_web\_acl
==================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.wafv2_rule_group`.
New in version 1.5.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, modify and delete wafv2 rule groups.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **capacity** integer | | capacity of wafv2 rule group. |
| **cloudwatch\_metrics** boolean | **Choices:*** no
* **yes** ←
| Enable cloudwatch metric for wafv2 rule group |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **description** string | | Description of wafv2 rule group. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **metric\_name** string | | Name of cloudwatch metrics. If not given and cloudwatch\_metrics is enabled, the name of the rule group itself will be taken. |
| **name** string / required | | The name of the rule group. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **purge\_rules** boolean | **Choices:*** no
* **yes** ←
| When set to `no`, keep the existing load balancer rules in place. Will modify and add, but will not delete. |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **rules** list / elements=dictionary | | The Rule statements used to identify the web requests that you want to allow, block, or count. |
| **sampled\_requests** boolean | **Choices:*** **no** ←
* yes
| Sampled requests, true or false. |
| **scope** string / required | **Choices:*** CLOUDFRONT
* REGIONAL
| Scope of wafv2 rule group. |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string / required | **Choices:*** present
* absent
| Whether the rule is present or absent. |
| **tags** dictionary | | tags for wafv2 rule group. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- name: change description
community.aws.wafv2_rule_group:
name: test02
state: present
description: hallo eins zwei
scope: REGIONAL
capacity: 500
rules:
- name: eins
priority: 1
action:
allow: {}
visibility_config:
sampled_requests_enabled: yes
cloud_watch_metrics_enabled: yes
metric_name: fsd
statement:
ip_set_reference_statement:
arn: "{{ IPSET.arn }}"
cloudwatch_metrics: yes
tags:
A: B
C: D
register: out
- name: add rule
community.aws.wafv2_rule_group:
name: test02
state: present
description: hallo eins zwei
scope: REGIONAL
capacity: 500
rules:
- name: eins
priority: 1
action:
allow: {}
visibility_config:
sampled_requests_enabled: yes
cloud_watch_metrics_enabled: yes
metric_name: fsd
statement:
ip_set_reference_statement:
arn: "{{ IPSET.arn }}"
- name: zwei
priority: 2
action:
block: {}
visibility_config:
sampled_requests_enabled: yes
cloud_watch_metrics_enabled: yes
metric_name: ddos
statement:
or_statement:
statements:
- byte_match_statement:
search_string: ansible.com
positional_constraint: CONTAINS
field_to_match:
single_header:
name: host
text_transformations:
- type: LOWERCASE
priority: 0
- xss_match_statement:
field_to_match:
body: {}
text_transformations:
- type: NONE
priority: 0
cloudwatch_metrics: yes
tags:
A: B
C: D
register: out
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **arn** string | Always, as long as the web acl exists | Rule group arn **Sample:** arn:aws:wafv2:eu-central-1:11111111:regional/rulegroup/test02/6e90c01a-e4eb-43e5-b6aa-b1604cedf7d7 |
| **capacity** integer | Always, as long as the rule group exists | Current capacity of the rule group **Sample:** 500 |
| **description** string | Always, as long as the web acl exists | Description of the rule group **Sample:** Some rule group description |
| **name** string | Always, as long as the rule group exists | Rule group name **Sample:** test02 |
| **rules** list / elements=string | Always, as long as the rule group exists | Current rules of the rule group **Sample:** [{'action': {'allow': {}}, 'name': 'eins', 'priority': 1, 'statement': {'ip\_set\_reference\_statement': {'arn': 'arn:aws:wafv2:eu-central-1:11111111:regional/ipset/test02/b6978915-c67b-4d1c-8832-2b1bb452143a'}}, 'visibility\_config': {'cloud\_watch\_metrics\_enabled': True, 'metric\_name': 'fsd', 'sampled\_requests\_enabled': True}}] |
| **visibility\_config** dictionary | Always, as long as the rule group exists | Visibility config of the rule group **Sample:** {'cloud\_watch\_metrics\_enabled': True, 'metric\_name': 'blub', 'sampled\_requests\_enabled': False} |
### Authors
* Markus Bergholz (@markuman)
ansible community.aws.ec2_vpc_route_table – Manage route tables for AWS virtual private clouds community.aws.ec2\_vpc\_route\_table – Manage route tables for AWS virtual private clouds
=========================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.ec2_vpc_route_table`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage route tables for AWS virtual private clouds
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* boto
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **lookup** string | **Choices:*** **tag** ←
* id
| Look up route table by either tags or by route table ID. Non-unique tag lookup will fail. If no tags are specified then no lookup for an existing route table is performed and a new route table will be created. To change tags of a route table you must look up by id. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **propagating\_vgw\_ids** list / elements=string | | Enable route propagation from virtual gateways specified by ID. |
| **purge\_routes** boolean | **Choices:*** no
* **yes** ←
| Purge existing routes that are not found in routes. |
| **purge\_subnets** boolean | **Choices:*** no
* yes
**Default:**"true" | Purge existing subnets that are not found in subnets. Ignored unless the subnets option is supplied. |
| **purge\_tags** boolean | **Choices:*** **no** ←
* yes
| Purge existing tags that are not found in route table. |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **route\_table\_id** string | | The ID of the route table to update or delete. Required when *lookup=id*. |
| **routes** list / elements=dictionary | | List of routes in the route table. Routes are specified as dicts containing the keys 'dest' and one of 'gateway\_id', 'instance\_id', 'network\_interface\_id', or 'vpc\_peering\_connection\_id'. If 'gateway\_id' is specified, you can refer to the VPC's IGW by using the value 'igw'. Routes are required for present states. |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** **present** ←
* absent
| Create or destroy the VPC route table. |
| **subnets** list / elements=string | | An array of subnets to add to this route table. Subnets may be specified by either subnet ID, Name tag, or by a CIDR such as '10.0.0.0/24'. |
| **tags** dictionary | | A dictionary of resource tags of the form: `{ tag1: value1, tag2: value2 }`. Tags are used to uniquely identify route tables within a VPC when the route\_table\_id is not supplied.
aliases: resource\_tags |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
| **vpc\_id** string | | VPC ID of the VPC in which to create the route table. Required when *state=present* or *lookup=tag*. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Basic creation example:
- name: Set up public subnet route table
community.aws.ec2_vpc_route_table:
vpc_id: vpc-1245678
region: us-west-1
tags:
Name: Public
subnets:
- "{{ jumpbox_subnet.subnet.id }}"
- "{{ frontend_subnet.subnet.id }}"
- "{{ vpn_subnet.subnet_id }}"
routes:
- dest: 0.0.0.0/0
gateway_id: "{{ igw.gateway_id }}"
register: public_route_table
- name: Set up NAT-protected route table
community.aws.ec2_vpc_route_table:
vpc_id: vpc-1245678
region: us-west-1
tags:
Name: Internal
subnets:
- "{{ application_subnet.subnet.id }}"
- 'Database Subnet'
- '10.0.0.0/8'
routes:
- dest: 0.0.0.0/0
instance_id: "{{ nat.instance_id }}"
register: nat_route_table
- name: delete route table
community.aws.ec2_vpc_route_table:
vpc_id: vpc-1245678
region: us-west-1
route_table_id: "{{ route_table.id }}"
lookup: id
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **route\_table** complex | always | Route Table result |
| | **associations** complex | always | List of subnets associated with the route table |
| | | **main** boolean | always | Whether this is the main route table |
| | | **route\_table\_association\_id** string | always | ID of association between route table and subnet **Sample:** rtbassoc-ab47cfc3 |
| | | **route\_table\_id** string | always | ID of the route table **Sample:** rtb-bf779ed7 |
| | | **subnet\_id** string | always | ID of the subnet **Sample:** subnet-82055af9 |
| | **id** string | always | ID of the route table (same as route\_table\_id for backwards compatibility) **Sample:** rtb-bf779ed7 |
| | **propagating\_vgws** list / elements=string | always | List of Virtual Private Gateways propagating routes |
| | **route\_table\_id** string | always | ID of the route table **Sample:** rtb-bf779ed7 |
| | **routes** complex | always | List of routes in the route table |
| | | **destination\_cidr\_block** string | always | CIDR block of destination **Sample:** 10.228.228.0/22 |
| | | **gateway\_id** string | when gateway is local or internet gateway | ID of the gateway **Sample:** local |
| | | **instance\_id** string | when the route is via an EC2 instance | ID of a NAT instance **Sample:** i-abcd123456789 |
| | | **instance\_owner\_id** string | when the route is via an EC2 instance | AWS account owning the NAT instance **Sample:** 123456789012 |
| | | **nat\_gateway\_id** string | when the route is via a NAT gateway | ID of the NAT gateway **Sample:** local |
| | | **origin** string | always | mechanism through which the route is in the table **Sample:** CreateRouteTable |
| | | **state** string | always | state of the route **Sample:** active |
| | **tags** dictionary | always | Tags applied to the route table **Sample:** {'Name': 'Public route table', 'Public': 'true'} |
| | **vpc\_id** string | always | ID for the VPC in which the route lives **Sample:** vpc-6e2d2407 |
### Authors
* Robert Estelle (@erydo)
* Rob White (@wimnat)
* Will Thames (@willthames)
| programming_docs |
ansible community.aws.rds_snapshot_info – obtain information about one or more RDS snapshots community.aws.rds\_snapshot\_info – obtain information about one or more RDS snapshots
======================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.rds_snapshot_info`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Obtain information about one or more RDS snapshots. These can be for unclustered snapshots or snapshots of clustered DBs (Aurora).
* Aurora snapshot information may be obtained if no identifier parameters are passed or if one of the cluster parameters are passed.
* This module was called `rds_snapshot_facts` before Ansible 2.9. The usage did not change.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **db\_cluster\_identifier** string | | RDS cluster name for which to find snapshots. Mutually exclusive with *db\_snapshot\_identifier*, *db\_instance\_identifier*, *db\_cluster\_snapshot\_identifier*
|
| **db\_cluster\_snapshot\_identifier** string | | Name of an RDS cluster snapshot. Mutually exclusive with *db\_instance\_identifier*, *db\_snapshot\_identifier*, *db\_cluster\_identifier*
|
| **db\_instance\_identifier** string | | RDS instance name for which to find snapshots. Mutually exclusive with *db\_snapshot\_identifier*, *db\_cluster\_identifier*, *db\_cluster\_snapshot\_identifier*
|
| **db\_snapshot\_identifier** string | | Name of an RDS (unclustered) snapshot. Mutually exclusive with *db\_instance\_identifier*, *db\_cluster\_identifier*, *db\_cluster\_snapshot\_identifier*
aliases: snapshot\_name |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **snapshot\_type** string | **Choices:*** automated
* manual
* shared
* public
| Type of snapshot to find. By default both automated and manual snapshots will be returned. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- name: Get information about an snapshot
community.aws.rds_snapshot_info:
db_snapshot_identifier: snapshot_name
register: new_database_info
- name: Get all RDS snapshots for an RDS instance
community.aws.rds_snapshot_info:
db_instance_identifier: helloworld-rds-master
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **cluster\_snapshots** complex | always | List of cluster snapshots |
| | **allocated\_storage** integer | always | How many gigabytes of storage are allocated **Sample:** 1 |
| | **availability\_zones** list / elements=string | always | The availability zones of the database from which the snapshot was taken **Sample:** ['ca-central-1a', 'ca-central-1b'] |
| | **cluster\_create\_time** string | always | Date and time the cluster was created **Sample:** 2018-05-17T00:13:40.223000+00:00 |
| | **db\_cluster\_identifier** string | always | Database cluster identifier **Sample:** test-aurora-cluster |
| | **db\_cluster\_snapshot\_arn** string | always | ARN of the database snapshot **Sample:** arn:aws:rds:ca-central-1:111111111111:cluster-snapshot:test-aurora-snapshot |
| | **db\_cluster\_snapshot\_identifier** string | always | Snapshot identifier **Sample:** test-aurora-snapshot |
| | **engine** string | always | Database engine **Sample:** aurora |
| | **engine\_version** string | always | Database engine version **Sample:** 5.6.10a |
| | **iam\_database\_authentication\_enabled** boolean | always | Whether database authentication through IAM is enabled |
| | **kms\_key\_id** string | always | ID of the KMS Key encrypting the snapshot **Sample:** arn:aws:kms:ca-central-1:111111111111:key/abcd1234-abcd-1111-aaaa-0123456789ab |
| | **license\_model** string | always | License model **Sample:** aurora |
| | **master\_username** string | always | Database master username **Sample:** shertel |
| | **percent\_progress** integer | always | Percent progress of snapshot |
| | **port** integer | always | Database port |
| | **snapshot\_create\_time** string | always | Date and time when the snapshot was created **Sample:** 2018-05-17T00:23:23.731000+00:00 |
| | **snapshot\_type** string | always | Type of snapshot **Sample:** manual |
| | **status** string | always | Status of snapshot **Sample:** creating |
| | **storage\_encrypted** boolean | always | Whether the snapshot is encrypted **Sample:** True |
| | **tags** complex | when snapshot is not shared | Tags of the snapshot |
| | **vpc\_id** string | always | VPC of the database **Sample:** vpc-abcd1234 |
| **snapshots** complex | When cluster parameters are not passed | List of non-clustered snapshots |
| | **allocated\_storage** integer | always | How many gigabytes of storage are allocated **Sample:** 10 |
| | **availability\_zone** string | always | The availability zone of the database from which the snapshot was taken **Sample:** us-west-2b |
| | **db\_instance\_identifier** string | always | Database instance identifier **Sample:** hello-world-rds |
| | **db\_snapshot\_arn** string | always | Snapshot ARN **Sample:** arn:aws:rds:us-west-2:111111111111:snapshot:rds:hello-world-rds-us1-2018-05-16-04-03 |
| | **db\_snapshot\_identifier** string | always | Snapshot name **Sample:** rds:hello-world-rds-us1-2018-05-16-04-03 |
| | **encrypted** boolean | always | Whether the snapshot was encrypted **Sample:** True |
| | **engine** string | always | Database engine **Sample:** postgres |
| | **engine\_version** string | always | Database engine version **Sample:** 9.5.10 |
| | **iam\_database\_authentication\_enabled** boolean | always | Whether database authentication through IAM is enabled |
| | **instance\_create\_time** string | always | Time the Instance was created **Sample:** 2017-10-10T04:00:07.434000+00:00 |
| | **kms\_key\_id** string | always | ID of the KMS Key encrypting the snapshot **Sample:** arn:aws:kms:us-west-2:111111111111:key/abcd1234-1234-aaaa-0000-1234567890ab |
| | **license\_model** string | always | License model **Sample:** postgresql-license |
| | **master\_username** string | always | Database master username **Sample:** dbadmin |
| | **option\_group\_name** string | always | Database option group name **Sample:** default:postgres-9-5 |
| | **percent\_progress** integer | always | Percent progress of snapshot **Sample:** 100 |
| | **snapshot\_create\_time** string | always | Time snapshot was created **Sample:** 2018-05-16T04:03:33.871000+00:00 |
| | **snapshot\_type** string | always | Type of snapshot **Sample:** automated |
| | **status** string | always | Status of snapshot **Sample:** available |
| | **storage\_type** string | always | Storage type of underlying DB **Sample:** gp2 |
| | **tags** complex | when snapshot is not shared | Snapshot tags |
| | **vpc\_id** string | always | ID of VPC containing the DB **Sample:** vpc-abcd1234 |
### Authors
* Will Thames (@willthames)
ansible community.aws.ec2_instance – Create & manage EC2 instances community.aws.ec2\_instance – Create & manage EC2 instances
===========================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.ec2_instance`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create and manage AWS EC2 instances.
* Note: This module does not support creating [EC2 Spot instances](https://aws.amazon.com/ec2/spot/). The [amazon.aws.ec2](../../amazon/aws/ec2_module#ansible-collections-amazon-aws-ec2-module) module can create and manage spot instances.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **availability\_zone** string | | Specify an availability zone to use the default subnet it. Useful if not specifying the *vpc\_subnet\_id* parameter. If no subnet, ENI, or availability zone is provided, the default subnet in the default VPC will be used in the first AZ (alphabetically sorted). |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **cpu\_credit\_specification** string | **Choices:*** unlimited
* standard
| For T series instances, choose whether to allow increased charges to buy CPU credits if the default pool is depleted. Choose *unlimited* to enable buying additional CPU credits. |
| **cpu\_options** dictionary | | Reduce the number of vCPU exposed to the instance. Those parameters can only be set at instance launch. The two suboptions threads\_per\_core and core\_count are mandatory. See <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html> for combinations available. Requires botocore >= 1.10.16 |
| | **core\_count** integer / required | | Set the number of core to enable. |
| | **threads\_per\_core** integer / required | **Choices:*** 1
* 2
| Select the number of threads per core to enable. Disable or Enable Intel HT. |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **detailed\_monitoring** boolean | **Choices:*** no
* yes
| Whether to allow detailed cloudwatch metrics to be collected, enabling more detailed alerting. |
| **ebs\_optimized** boolean | **Choices:*** no
* yes
| Whether instance is should use optimized EBS volumes, see <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html>. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **filters** dictionary | | A dict of filters to apply when deciding whether existing instances match and should be altered. Each dict item consists of a filter key and a filter value. See <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html>. for possible filters. Filter names and values are case sensitive. By default, instances are filtered for counting by their "Name" tag, base AMI, state (running, by default), and subnet ID. Any queryable filter can be used. Good candidates are specific tags, SSH keys, or security groups. |
| **image** dictionary | | An image to use for the instance. The [amazon.aws.ec2\_ami\_info](../../amazon/aws/ec2_ami_info_module) module may be used to retrieve images. One of *image* or *image\_id* are required when instance is not already present. |
| | **id** string | | The AMI ID. |
| | **kernel** string | | a string AKI to override the AMI kernel. |
| | **ramdisk** string | | Overrides the AMI's default ramdisk ID. |
| **image\_id** string | |
*ami* ID to use for the instance. One of *image* or *image\_id* are required when instance is not already present. This is an alias for *image.id*. |
| **instance\_ids** list / elements=string | | If you specify one or more instance IDs, only instances that have the specified IDs are returned. |
| **instance\_initiated\_shutdown\_behavior** string | **Choices:*** stop
* terminate
| Whether to stop or terminate an instance upon shutdown. |
| **instance\_role** string | | The ARN or name of an EC2-enabled instance role to be used. If a name is not provided in arn format then the ListInstanceProfiles permission must also be granted. <https://docs.aws.amazon.com/IAM/latest/APIReference/API_ListInstanceProfiles.html> If no full ARN is provided, the role with a matching name will be used from the active AWS account. |
| **instance\_type** string | **Default:**"t2.micro" | Instance type to use for the instance, see <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html> Only required when instance is not already present. |
| **key\_name** string | | Name of the SSH access key to assign to the instance - must exist in the region the instance is created. |
| **launch\_template** dictionary | | The EC2 launch template to base instance configuration on. |
| | **id** string | | the ID of the launch template (optional if name is specified). |
| | **name** string | | the pretty name of the launch template (optional if id is specified). |
| | **version** string | | the specific version of the launch template to use. If unspecified, the template default is chosen. |
| **name** string | | The Name tag for the instance. |
| **network** dictionary | | Either a dictionary containing the key 'interfaces' corresponding to a list of network interface IDs or containing specifications for a single network interface. Use the [amazon.aws.ec2\_eni](../../amazon/aws/ec2_eni_module) module to create ENIs with special settings. |
| | **assign\_public\_ip** boolean | **Choices:*** no
* yes
| when true assigns a public IP address to the interface |
| | **delete\_on\_termination** boolean | **Choices:*** no
* yes
| Delete the interface when the instance it is attached to is terminated. |
| | **description** string | | a description for the network interface |
| | **device\_index** integer | | The index of the interface to modify |
| | **groups** list / elements=string | | a list of security group IDs to attach to the interface |
| | **interfaces** list / elements=string | | a list of ENI IDs (strings) or a list of objects containing the key *id*. |
| | **ipv6\_addresses** list / elements=string | | a list of IPv6 addresses to assign to the network interface |
| | **private\_ip\_address** string | | an IPv4 address to assign to the interface |
| | **private\_ip\_addresses** list / elements=string | | a list of IPv4 addresses to assign to the network interface |
| | **source\_dest\_check** boolean | **Choices:*** no
* yes
| controls whether source/destination checking is enabled on the interface |
| | **subnet\_id** string | | the subnet to connect the network interface to |
| **placement\_group** string | | The placement group that needs to be assigned to the instance |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **purge\_tags** boolean | **Choices:*** **no** ←
* yes
| Delete any tags not specified in the task that are on the instance. This means you have to specify all the desired tags on each task affecting an instance. |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_group** string | | A security group ID or name. Mutually exclusive with *security\_groups*. |
| **security\_groups** list / elements=string | | A list of security group IDs or names (strings). Mutually exclusive with *security\_group*. |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** **present** ←
* terminated
* running
* started
* stopped
* restarted
* rebooted
* absent
| Goal state for the instances. |
| **tags** dictionary | | A hash/dictionary of tags to add to the new instance or to add/remove from an existing one. |
| **tenancy** string | **Choices:*** dedicated
* default
| What type of tenancy to allow an instance to use. Default is shared tenancy. Dedicated tenancy will incur additional charges. |
| **termination\_protection** boolean | **Choices:*** no
* yes
| Whether to enable termination protection. This module will not terminate an instance with termination protection active, it must be turned off first. |
| **tower\_callback** dictionary | | Preconfigured user-data to enable an instance to perform a Tower callback (Linux only). Mutually exclusive with *user\_data*. For Windows instances, to enable remote access via Ansible set *tower\_callback.windows* to true, and optionally set an admin password. If using 'windows' and 'set\_password', callback to Tower will not be performed but the instance will be ready to receive winrm connections from Ansible. |
| | **host\_config\_key** string | | Host configuration secret key generated by the Tower job template. |
| | **job\_template\_id** string | | Either the integer ID of the Tower Job Template, or the name (name supported only for Tower 3.2+). |
| | **tower\_address** string | | IP address or DNS name of Tower server. Must be accessible via this address from the VPC that this instance will be launched in. |
| **user\_data** string | | Opaque blob of data which is made available to the ec2 instance |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
| **volumes** list / elements=dictionary | | A list of block device mappings, by default this will always use the AMI root device so the volumes option is primarily for adding more storage. A mapping contains the (optional) keys device\_name, virtual\_name, ebs.volume\_type, ebs.volume\_size, ebs.kms\_key\_id, ebs.iops, and ebs.delete\_on\_termination. For more information about each parameter, see <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_BlockDeviceMapping.html>. |
| **vpc\_subnet\_id** string | | The subnet ID in which to launch the instance (VPC) If none is provided, [community.aws.ec2\_instance](ec2_instance_module) will chose the default zone of the default VPC.
aliases: subnet\_id |
| **wait** boolean | **Choices:*** no
* **yes** ←
| Whether or not to wait for the desired state (use wait\_timeout to customize this). |
| **wait\_timeout** integer | **Default:**600 | How long to wait (in seconds) for the instance to finish booting/terminating. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
- name: Terminate every running instance in a region. Use with EXTREME caution.
community.aws.ec2_instance:
state: absent
filters:
instance-state-name: running
- name: restart a particular instance by its ID
community.aws.ec2_instance:
state: restarted
instance_ids:
- i-12345678
- name: start an instance with a public IP address
community.aws.ec2_instance:
name: "public-compute-instance"
key_name: "prod-ssh-key"
vpc_subnet_id: subnet-5ca1ab1e
instance_type: c5.large
security_group: default
network:
assign_public_ip: true
image_id: ami-123456
tags:
Environment: Testing
- name: start an instance and Add EBS
community.aws.ec2_instance:
name: "public-withebs-instance"
vpc_subnet_id: subnet-5ca1ab1e
instance_type: t2.micro
key_name: "prod-ssh-key"
security_group: default
volumes:
- device_name: /dev/sda1
ebs:
volume_size: 16
delete_on_termination: true
- name: start an instance with a cpu_options
community.aws.ec2_instance:
name: "public-cpuoption-instance"
vpc_subnet_id: subnet-5ca1ab1e
tags:
Environment: Testing
instance_type: c4.large
volumes:
- device_name: /dev/sda1
ebs:
delete_on_termination: true
cpu_options:
core_count: 1
threads_per_core: 1
- name: start an instance and have it begin a Tower callback on boot
community.aws.ec2_instance:
name: "tower-callback-test"
key_name: "prod-ssh-key"
vpc_subnet_id: subnet-5ca1ab1e
security_group: default
tower_callback:
# IP or hostname of tower server
tower_address: 1.2.3.4
job_template_id: 876
host_config_key: '[secret config key goes here]'
network:
assign_public_ip: true
image_id: ami-123456
cpu_credit_specification: unlimited
tags:
SomeThing: "A value"
- name: start an instance with ENI (An existing ENI ID is required)
community.aws.ec2_instance:
name: "public-eni-instance"
key_name: "prod-ssh-key"
vpc_subnet_id: subnet-5ca1ab1e
network:
interfaces:
- id: "eni-12345"
tags:
Env: "eni_on"
volumes:
- device_name: /dev/sda1
ebs:
delete_on_termination: true
instance_type: t2.micro
image_id: ami-123456
- name: add second ENI interface
community.aws.ec2_instance:
name: "public-eni-instance"
network:
interfaces:
- id: "eni-12345"
- id: "eni-67890"
image_id: ami-123456
tags:
Env: "eni_on"
instance_type: t2.micro
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **instances** complex | when wait == true | a list of ec2 instances |
| | **ami\_launch\_index** integer | always | The AMI launch index, which can be used to find this instance in the launch group. |
| | **architecture** string | always | The architecture of the image **Sample:** x86\_64 |
| | **block\_device\_mappings** complex | always | Any block device mapping entries for the instance. |
| | | **device\_name** string | always | The device name exposed to the instance (for example, /dev/sdh or xvdh). **Sample:** /dev/sdh |
| | | **ebs** complex | always | Parameters used to automatically set up EBS volumes when the instance is launched. |
| | | | **attach\_time** string | always | The time stamp when the attachment initiated. **Sample:** 2017-03-23T22:51:24+00:00 |
| | | | **delete\_on\_termination** boolean | always | Indicates whether the volume is deleted on instance termination. **Sample:** True |
| | | | **status** string | always | The attachment state. **Sample:** attached |
| | | | **volume\_id** string | always | The ID of the EBS volume **Sample:** vol-12345678 |
| | **client\_token** string | always | The idempotency token you provided when you launched the instance, if applicable. **Sample:** mytoken |
| | **ebs\_optimized** boolean | always | Indicates whether the instance is optimized for EBS I/O. |
| | **hypervisor** string | always | The hypervisor type of the instance. **Sample:** xen |
| | **iam\_instance\_profile** complex | always | The IAM instance profile associated with the instance, if applicable. |
| | | **arn** string | always | The Amazon Resource Name (ARN) of the instance profile. **Sample:** arn:aws:iam::000012345678:instance-profile/myprofile |
| | | **id** string | always | The ID of the instance profile **Sample:** JFJ397FDG400FG9FD1N |
| | **image\_id** string | always | The ID of the AMI used to launch the instance. **Sample:** ami-0011223344 |
| | **instance\_id** string | always | The ID of the instance. **Sample:** i-012345678 |
| | **instance\_type** string | always | The instance type size of the running instance. **Sample:** t2.micro |
| | **key\_name** string | always | The name of the key pair, if this instance was launched with an associated key pair. **Sample:** my-key |
| | **launch\_time** string | always | The time the instance was launched. **Sample:** 2017-03-23T22:51:24+00:00 |
| | **monitoring** complex | always | The monitoring for the instance. |
| | | **state** string | always | Indicates whether detailed monitoring is enabled. Otherwise, basic monitoring is enabled. **Sample:** disabled |
| | **network.source\_dest\_check** boolean | always | Indicates whether source/destination checking is enabled. **Sample:** True |
| | **network\_interfaces** complex | always | One or more network interfaces for the instance. |
| | | **association** complex | always | The association information for an Elastic IPv4 associated with the network interface. |
| | | | **ip\_owner\_id** string | always | The ID of the owner of the Elastic IP address. **Sample:** amazon |
| | | | **public\_dns\_name** string | always | The public DNS name. |
| | | | **public\_ip** string | always | The public IP address or Elastic IP address bound to the network interface. **Sample:** 1.2.3.4 |
| | | **attachment** complex | always | The network interface attachment. |
| | | | **attach\_time** string | always | The time stamp when the attachment initiated. **Sample:** 2017-03-23T22:51:24+00:00 |
| | | | **attachment\_id** string | always | The ID of the network interface attachment. **Sample:** eni-attach-3aff3f |
| | | | **delete\_on\_termination** boolean | always | Indicates whether the network interface is deleted when the instance is terminated. **Sample:** True |
| | | | **device\_index** integer | always | The index of the device on the instance for the network interface attachment. |
| | | | **status** string | always | The attachment state. **Sample:** attached |
| | | **description** string | always | The description. **Sample:** My interface |
| | | **groups** list / elements=dictionary | always | One or more security groups. |
| | | | **group\_id** string | always | The ID of the security group. **Sample:** sg-abcdef12 |
| | | | **group\_name** string | always | The name of the security group. **Sample:** mygroup |
| | | **ipv6\_addresses** list / elements=dictionary | always | One or more IPv6 addresses associated with the network interface. |
| | | | **ipv6\_address** string | always | The IPv6 address. **Sample:** 2001:0db8:85a3:0000:0000:8a2e:0370:7334 |
| | | **mac\_address** string | always | The MAC address. **Sample:** 00:11:22:33:44:55 |
| | | **network\_interface\_id** string | always | The ID of the network interface. **Sample:** eni-01234567 |
| | | **owner\_id** string | always | The AWS account ID of the owner of the network interface. **Sample:** 01234567890 |
| | | **private\_ip\_address** string | always | The IPv4 address of the network interface within the subnet. **Sample:** 10.0.0.1 |
| | | **private\_ip\_addresses** list / elements=dictionary | always | The private IPv4 addresses associated with the network interface. |
| | | | **association** complex | always | The association information for an Elastic IP address (IPv4) associated with the network interface. |
| | | | | **ip\_owner\_id** string | always | The ID of the owner of the Elastic IP address. **Sample:** amazon |
| | | | | **public\_dns\_name** string | always | The public DNS name. |
| | | | | **public\_ip** string | always | The public IP address or Elastic IP address bound to the network interface. **Sample:** 1.2.3.4 |
| | | | **primary** boolean | always | Indicates whether this IPv4 address is the primary private IP address of the network interface. **Sample:** True |
| | | | **private\_ip\_address** string | always | The private IPv4 address of the network interface. **Sample:** 10.0.0.1 |
| | | **source\_dest\_check** boolean | always | Indicates whether source/destination checking is enabled. **Sample:** True |
| | | **status** string | always | The status of the network interface. **Sample:** in-use |
| | | **subnet\_id** string | always | The ID of the subnet for the network interface. **Sample:** subnet-0123456 |
| | | **vpc\_id** string | always | The ID of the VPC for the network interface. **Sample:** vpc-0123456 |
| | **placement** complex | always | The location where the instance launched, if applicable. |
| | | **availability\_zone** string | always | The Availability Zone of the instance. **Sample:** ap-southeast-2a |
| | | **group\_name** string | always | The name of the placement group the instance is in (for cluster compute instances). |
| | | **tenancy** string | always | The tenancy of the instance (if the instance is running in a VPC). **Sample:** default |
| | **private\_dns\_name** string | always | The private DNS name. **Sample:** ip-10-0-0-1.ap-southeast-2.compute.internal |
| | **private\_ip\_address** string | always | The IPv4 address of the network interface within the subnet. **Sample:** 10.0.0.1 |
| | **product\_codes** list / elements=dictionary | always | One or more product codes. |
| | | **product\_code\_id** string | always | The product code. **Sample:** aw0evgkw8ef3n2498gndfgasdfsd5cce |
| | | **product\_code\_type** string | always | The type of product code. **Sample:** marketplace |
| | **public\_dns\_name** string | always | The public DNS name assigned to the instance. |
| | **public\_ip\_address** string | always | The public IPv4 address assigned to the instance **Sample:** 52.0.0.1 |
| | **root\_device\_name** string | always | The device name of the root device **Sample:** /dev/sda1 |
| | **root\_device\_type** string | always | The type of root device used by the AMI. **Sample:** ebs |
| | **security\_groups** list / elements=dictionary | always | One or more security groups for the instance. |
| | | **group\_id** string | always | The ID of the security group. **Sample:** sg-0123456 |
| | | **group\_name** string | always | The name of the security group. **Sample:** my-security-group |
| | **state** complex | always | The current state of the instance. |
| | | **code** integer | always | The low byte represents the state. **Sample:** 16 |
| | | **name** string | always | The name of the state. **Sample:** running |
| | **state\_transition\_reason** string | always | The reason for the most recent state transition. |
| | **subnet\_id** string | always | The ID of the subnet in which the instance is running. **Sample:** subnet-00abcdef |
| | **tags** dictionary | always | Any tags assigned to the instance. |
| | **virtualization\_type** string | always | The type of virtualization of the AMI. **Sample:** hvm |
| | **vpc\_id** dictionary | always | The ID of the VPC the instance is in. **Sample:** vpc-0011223344 |
### Authors
* Ryan Scott Brown (@ryansb)
| programming_docs |
ansible community.aws.iam_role_info – Gather information on IAM roles community.aws.iam\_role\_info – Gather information on IAM roles
===============================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.iam_role_info`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Gathers information about IAM roles.
* This module was called `iam_role_facts` before Ansible 2.9. The usage did not change.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **name** string | | Name of a role to search for. Mutually exclusive with *path\_prefix*.
aliases: role\_name |
| **path\_prefix** string | | Prefix of role to restrict IAM role search for. Mutually exclusive with *name*. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- name: find all existing IAM roles
community.aws.iam_role_info:
register: result
- name: describe a single role
community.aws.iam_role_info:
name: MyIAMRole
- name: describe all roles matching a path prefix
community.aws.iam_role_info:
path_prefix: /application/path
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **iam\_roles** complex | always | List of IAM roles |
| | **arn** string | always | Amazon Resource Name for IAM role. **Sample:** arn:aws:iam::123456789012:role/AnsibleTestRole |
| | **assume\_role\_policy\_document** string | always | Policy Document describing what can assume the role. |
| | **create\_date** string | always | Date IAM role was created. **Sample:** 2017-10-23T00:05:08+00:00 |
| | **inline\_policies** list / elements=string | always | List of names of inline policies. |
| | **instance\_profiles** complex | always | List of attached instance profiles. |
| | | **arn** string | always | Amazon Resource Name for the instance profile. **Sample:** arn:aws:iam::123456789012:instance-profile/AnsibleTestEC2Policy |
| | | **create\_date** string | always | Date instance profile was created. **Sample:** 2017-10-23T00:05:08+00:00 |
| | | **instance\_profile\_id** string | always | Amazon Identifier for the instance profile. **Sample:** AROAII7ABCD123456EFGH |
| | | **instance\_profile\_name** string | always | Name of instance profile. **Sample:** AnsibleTestEC2Policy |
| | | **path** string | always | Path of instance profile. **Sample:** / |
| | | **roles** list / elements=string | always | List of roles associated with this instance profile. |
| | **managed\_policies** complex | always | List of attached managed policies. |
| | | **policy\_arn** string | always | Amazon Resource Name for the policy. **Sample:** arn:aws:iam::123456789012:policy/AnsibleTestEC2Policy |
| | | **policy\_name** string | always | Name of managed policy. **Sample:** AnsibleTestEC2Policy |
| | **path** string | always | Path of role. **Sample:** / |
| | **role\_id** string | always | Amazon Identifier for the role. **Sample:** AROAII7ABCD123456EFGH |
| | **role\_name** string | always | Name of the role. **Sample:** AnsibleTestRole |
| | **tags** dictionary | always | Role tags. **Sample:** {"Env": "Prod"} |
### Authors
* Will Thames (@willthames)
ansible community.aws.aws_ses_identity_policy – Manages SES sending authorization policies community.aws.aws\_ses\_identity\_policy – Manages SES sending authorization policies
=====================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.aws_ses_identity_policy`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module allows the user to manage sending authorization policies associated with an SES identity (email or domain).
* SES authorization sending policies can be used to control what actors are able to send email on behalf of the validated identity and what conditions must be met by the sent emails.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **identity** string / required | | The SES identity to attach or remove a policy from. This can be either the full ARN or just the verified email or domain. |
| **policy** json | | A properly formatted JSON sending authorization policy. Required when *state=present*. |
| **policy\_name** string / required | | The name used to identify the policy within the scope of the identity it's attached to. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** **present** ←
* absent
| Whether to create(or update) or delete the authorization policy on the identity. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
- name: add sending authorization policy to domain identity
community.aws.aws_ses_identity_policy:
identity: example.com
policy_name: ExamplePolicy
policy: "{{ lookup('template', 'policy.json.j2') }}"
state: present
- name: add sending authorization policy to email identity
community.aws.aws_ses_identity_policy:
identity: [email protected]
policy_name: ExamplePolicy
policy: "{{ lookup('template', 'policy.json.j2') }}"
state: present
- name: add sending authorization policy to identity using ARN
community.aws.aws_ses_identity_policy:
identity: "arn:aws:ses:us-east-1:12345678:identity/example.com"
policy_name: ExamplePolicy
policy: "{{ lookup('template', 'policy.json.j2') }}"
state: present
- name: remove sending authorization policy
community.aws.aws_ses_identity_policy:
identity: example.com
policy_name: ExamplePolicy
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **policies** list / elements=string | success | A list of all policies present on the identity after the operation. **Sample:** ['ExamplePolicy'] |
### Authors
* Ed Costello (@orthanc)
ansible community.aws.redshift – create, delete, or modify an Amazon Redshift instance community.aws.redshift – create, delete, or modify an Amazon Redshift instance
==============================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.redshift`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Creates, deletes, or modifies Amazon Redshift cluster instances.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **allow\_version\_upgrade** boolean | **Choices:*** no
* **yes** ←
| When *allow\_version\_upgrade=true* the cluster may be automatically upgraded during the maintenance window.
aliases: version\_upgrade |
| **automated\_snapshot\_retention\_period** integer | | The number of days that automated snapshots are retained.
aliases: retention\_period |
| **availability\_zone** string | | Availability zone in which to launch cluster.
aliases: zone, aws\_zone |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **cluster\_parameter\_group\_name** string | | Name of the cluster parameter group.
aliases: param\_group\_name |
| **cluster\_security\_groups** list / elements=string | | In which security group the cluster belongs.
aliases: security\_groups |
| **cluster\_subnet\_group\_name** string | | Which subnet to place the cluster.
aliases: subnet |
| **cluster\_type** string | **Choices:*** multi-node
* **single-node** ←
| The type of cluster. |
| **cluster\_version** string | **Choices:*** 1.0
| Which version the cluster should have.
aliases: version |
| **command** string / required | **Choices:*** create
* facts
* delete
* modify
| Specifies the action to take. |
| **db\_name** string | | Name of the database. |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **elastic\_ip** string | | An Elastic IP to use for the cluster. |
| **encrypted** boolean | **Choices:*** **no** ←
* yes
| If the cluster is encrypted or not. |
| **enhanced\_vpc\_routing** boolean | **Choices:*** **no** ←
* yes
| Whether the cluster should have enhanced VPC routing enabled. |
| **final\_cluster\_snapshot\_identifier** string | | Identifier of the final snapshot to be created before deleting the cluster. If this parameter is provided, *skip\_final\_cluster\_snapshot* must be `false`. Used only when *command=delete*.
aliases: final\_snapshot\_id |
| **identifier** string / required | | Redshift cluster identifier. |
| **new\_cluster\_identifier** string | | Only used when command=modify.
aliases: new\_identifier |
| **node\_type** string | **Choices:*** ds1.xlarge
* ds1.8xlarge
* ds2.xlarge
* ds2.8xlarge
* dc1.large
* dc2.large
* dc1.8xlarge
* dw1.xlarge
* dw1.8xlarge
* dw2.large
* dw2.8xlarge
| The node type of the cluster. Require when *command=create*. |
| **number\_of\_nodes** integer | | Number of nodes. Only used when *cluster\_type=multi-node*. |
| **password** string | | Master database password. Used only when *command=create*. |
| **port** integer | | Which port the cluster is listening on. |
| **preferred\_maintenance\_window** string | | Maintenance window in format of `ddd:hh24:mi-ddd:hh24:mi`. (Example: `Mon:22:00-Mon:23:15`) Times are specified in UTC. If not specified then a random 30 minute maintenance window is assigned.
aliases: maintance\_window, maint\_window |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **publicly\_accessible** boolean | **Choices:*** **no** ←
* yes
| If the cluster is accessible publicly or not. |
| **purge\_tags** boolean added in 1.3.0 of community.aws | **Choices:*** no
* **yes** ←
| Purge existing tags that are not found in the cluster |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **skip\_final\_cluster\_snapshot** boolean | **Choices:*** **no** ←
* yes
| Skip a final snapshot before deleting the cluster. Used only when *command=delete*.
aliases: skip\_final\_snapshot |
| **tags** dictionary added in 1.3.0 of community.aws | | A dictionary of resource tags.
aliases: resource\_tags |
| **username** string | | Master database username. Used only when *command=create*. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
| **vpc\_security\_group\_ids** list / elements=string | | VPC security group
aliases: vpc\_security\_groups |
| **wait** boolean | **Choices:*** **no** ←
* yes
| When *command=create*, *command=modify* or *command=restore* then wait for the database to enter the 'available' state. When *command=delete* wait for the database to be terminated. |
| **wait\_timeout** integer | **Default:**300 | When *wait=true* defines how long in seconds before giving up. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- name: Basic cluster provisioning example
community.aws.redshift:
command: create
node_type: ds1.xlarge
identifier: new_cluster
username: cluster_admin
password: 1nsecure
- name: Cluster delete example
community.aws.redshift:
command: delete
identifier: new_cluster
skip_final_cluster_snapshot: true
wait: true
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **cluster** complex | success | dictionary containing all the cluster information |
| | **availability\_zone** string | success | Amazon availability zone where the cluster is located. "None" until cluster is available. **Sample:** us-east-1b |
| | **create\_time** float | success | Time of the cluster creation as timestamp. **Sample:** 1430158536.308 |
| | **db\_name** string | success | Name of the database. **Sample:** new\_db\_name |
| | **enhanced\_vpc\_routing** boolean | success | status of the enhanced vpc routing feature. |
| | **identifier** string | success | Id of the cluster. **Sample:** new\_redshift\_cluster |
| | **maintenance\_window** string | success | Time frame when maintenance/upgrade are done. **Sample:** sun:09:30-sun:10:00 |
| | **port** integer | success | Port of the cluster. "None" until cluster is available. **Sample:** 5439 |
| | **private\_ip\_address** string | success | Private IP address of the main node. **Sample:** 10.10.10.10 |
| | **public\_ip\_address** string | success | Public IP address of the main node. "None" when enhanced\_vpc\_routing is enabled. **Sample:** 0.0.0.0 |
| | **status** string | success | Status of the cluster. **Sample:** available |
| | **tags** dictionary | success | aws tags for cluster. |
| | **url** string | success | FQDN of the main cluster node. "None" until cluster is available. **Sample:** new-redshift\_cluster.jfkdjfdkj.us-east-1.redshift.amazonaws.com |
### Authors
* Jens Carl (@j-carl), Hothead Games Inc.
* Rafael Driutti (@rafaeldriutti)
| programming_docs |
ansible community.aws.execute_lambda – Execute an AWS Lambda function community.aws.execute\_lambda – Execute an AWS Lambda function
==============================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.execute_lambda`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module executes AWS Lambda functions, allowing synchronous and asynchronous invocation.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **dry\_run** boolean | **Choices:*** **no** ←
* yes
| Do not \*actually\* invoke the function. A `DryRun` call will check that the caller has permissions to call the function, especially for checking cross-account permissions. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **function\_arn** string | | The name of the function to be invoked |
| **name** string | | The name of the function to be invoked. This can only be used for invocations within the calling account. To invoke a function in another account, use *function\_arn* to specify the full ARN. |
| **payload** dictionary | **Default:**{} | A dictionary in any form to be provided as input to the Lambda function. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **tail\_log** boolean | **Choices:*** **no** ←
* yes
| If *tail\_log=yes*, the result of the task will include the last 4 KB of the CloudWatch log for the function execution. Log tailing only works if you use synchronous invocation *wait=yes*. This is usually used for development or testing Lambdas. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
| **version\_qualifier** string | | Which version/alias of the function to run. This defaults to the `LATEST` revision, but can be set to any existing version or alias. See <https://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html> for details. |
| **wait** boolean | **Choices:*** no
* **yes** ←
| Whether to wait for the function results or not. If *wait=no* the task will not return any results. To wait for the Lambda function to complete, set *wait=yes* and the result will be available in the *output* key. |
Notes
-----
Note
* Async invocation will always return an empty `output` key.
* Synchronous invocation may result in a function timeout, resulting in an empty `output` key.
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- community.aws.execute_lambda:
name: test-function
# the payload is automatically serialized and sent to the function
payload:
foo: bar
value: 8
register: response
# Test that you have sufficient permissions to execute a Lambda function in
# another account
- community.aws.execute_lambda:
function_arn: arn:aws:lambda:us-east-1:123456789012:function/some-function
dry_run: true
- community.aws.execute_lambda:
name: test-function
payload:
foo: bar
value: 8
wait: true
tail_log: true
register: response
# the response will have a `logs` key that will contain a log (up to 4KB) of the function execution in Lambda
# Pass the Lambda event payload as a json file.
- community.aws.execute_lambda:
name: test-function
payload: "{{ lookup('file','lambda_event.json') }}"
register: response
- community.aws.execute_lambda:
name: test-function
version_qualifier: PRODUCTION
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **logs** string | if *tail\_log* == true | The last 4KB of the function logs. Only provided if *tail\_log* is true |
| **output** dictionary | success | Function output if wait=true and the function returns a value **Sample:** { 'output': 'something' } |
| **status** integer | always |
`StatusCode` of API call exit (200 for synchronous invokes, 202 for async) **Sample:** 200 |
### Authors
* Ryan Scott Brown (@ryansb) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#c1b3b8a0afb2a3e7e2f2f6fae7e2f4f3fae7e2f5f9fab3a4a5a9a0b5e7e2f5f7faa2aeac)>
ansible community.aws.cloudfront_info – Obtain facts about an AWS CloudFront distribution community.aws.cloudfront\_info – Obtain facts about an AWS CloudFront distribution
==================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.cloudfront_info`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Gets information about an AWS CloudFront distribution.
* This module was called `cloudfront_facts` before Ansible 2.9, returning `ansible_facts`. Note that the [community.aws.cloudfront\_info](#ansible-collections-community-aws-cloudfront-info-module) module no longer returns `ansible_facts`!
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3 >= 1.0.0
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **all\_lists** boolean | **Choices:*** **no** ←
* yes
| Get all CloudFront lists that do not require parameters. |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **distribution** boolean | **Choices:*** **no** ←
* yes
| Get information about a distribution. Requires *distribution\_id* or *domain\_name\_alias* to be specified. |
| **distribution\_config** boolean | **Choices:*** **no** ←
* yes
| Get the configuration information about a distribution. Requires *distribution\_id* or *domain\_name\_alias* to be specified. |
| **distribution\_id** string | | The id of the CloudFront distribution. Used with *distribution*, *distribution\_config*, *invalidation*, *streaming\_distribution*, *streaming\_distribution\_config*, *list\_invalidations*. |
| **domain\_name\_alias** string | | Can be used instead of *distribution\_id* - uses the aliased CNAME for the CloudFront distribution to get the distribution id where required. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **invalidation** boolean | **Choices:*** **no** ←
* yes
| Get information about an invalidation. Requires *invalidation\_id* to be specified. |
| **invalidation\_id** string | | The id of the invalidation to get information about. Used with *invalidation*. |
| **list\_distributions** boolean | **Choices:*** **no** ←
* yes
| Get a list of CloudFront distributions. |
| **list\_distributions\_by\_web\_acl\_id** boolean | **Choices:*** **no** ←
* yes
| Get a list of distributions using web acl id as a filter. Requires *web\_acl\_id* to be set. |
| **list\_invalidations** boolean | **Choices:*** **no** ←
* yes
| Get a list of invalidations. Requires *distribution\_id* or *domain\_name\_alias* to be specified. |
| **list\_origin\_access\_identities** boolean | **Choices:*** **no** ←
* yes
| Get a list of CloudFront origin access identities. Requires *origin\_access\_identity\_id* to be set. |
| **list\_streaming\_distributions** boolean | **Choices:*** **no** ←
* yes
| Get a list of streaming distributions. |
| **origin\_access\_identity** boolean | **Choices:*** **no** ←
* yes
| Get information about an origin access identity. Requires *origin\_access\_identity\_id* to be specified. |
| **origin\_access\_identity\_config** boolean | **Choices:*** **no** ←
* yes
| Get the configuration information about an origin access identity. Requires *origin\_access\_identity\_id* to be specified. |
| **origin\_access\_identity\_id** string | | The id of the CloudFront origin access identity to get information about. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **streaming\_distribution** boolean | **Choices:*** **no** ←
* yes
| Get information about a specified RTMP distribution. Requires *distribution\_id* or *domain\_name\_alias* to be specified. |
| **streaming\_distribution\_config** boolean | **Choices:*** **no** ←
* yes
| Get the configuration information about a specified RTMP distribution. Requires *distribution\_id* or *domain\_name\_alias* to be specified. |
| **summary** boolean | **Choices:*** **no** ←
* yes
| Returns a summary of all distributions, streaming distributions and origin\_access\_identities. This is the default behaviour if no option is selected. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
- name: Get a summary of distributions
community.aws.cloudfront_info:
summary: true
register: result
- name: Get information about a distribution
community.aws.cloudfront_info:
distribution: true
distribution_id: my-cloudfront-distribution-id
register: result_did
- ansible.builtin.debug:
msg: "{{ result_did['cloudfront']['my-cloudfront-distribution-id'] }}"
- name: Get information about a distribution using the CNAME of the cloudfront distribution.
community.aws.cloudfront_info:
distribution: true
domain_name_alias: www.my-website.com
register: result_website
- ansible.builtin.debug:
msg: "{{ result_website['cloudfront']['www.my-website.com'] }}"
# When the module is called as cloudfront_facts, return values are published
# in ansible_facts['cloudfront'][<id>] and can be used as follows.
# Note that this is deprecated and will stop working in Ansible 2.13.
- name: Gather facts
community.aws.cloudfront_facts:
distribution: true
distribution_id: my-cloudfront-distribution-id
- ansible.builtin.debug:
msg: "{{ ansible_facts['cloudfront']['my-cloudfront-distribution-id'] }}"
- community.aws.cloudfront_facts:
distribution: true
domain_name_alias: www.my-website.com
- ansible.builtin.debug:
msg: "{{ ansible_facts['cloudfront']['www.my-website.com'] }}"
- name: Get all information about an invalidation for a distribution.
community.aws.cloudfront_info:
invalidation: true
distribution_id: my-cloudfront-distribution-id
invalidation_id: my-cloudfront-invalidation-id
- name: Get all information about a CloudFront origin access identity.
community.aws.cloudfront_info:
origin_access_identity: true
origin_access_identity_id: my-cloudfront-origin-access-identity-id
- name: Get all information about lists not requiring parameters (ie. list_origin_access_identities, list_distributions, list_streaming_distributions)
community.aws.cloudfront_info:
origin_access_identity: true
origin_access_identity_id: my-cloudfront-origin-access-identity-id
- name: Get all information about lists not requiring parameters (ie. list_origin_access_identities, list_distributions, list_streaming_distributions)
community.aws.cloudfront_info:
all_lists: true
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **distribution** dictionary | only if distribution is true | Facts about a CloudFront distribution. Requires *distribution\_id* or *domain\_name\_alias* to be specified. Requires *origin\_access\_identity\_id* to be set. |
| **distribution\_config** dictionary | only if *distribution\_config* is true | Facts about a CloudFront distribution's config. Requires *distribution\_id* or *domain\_name\_alias* to be specified. |
| **invalidation** dictionary | only if invalidation is true | Describes the invalidation information for the distribution. Requires *invalidation\_id* to be specified and either *distribution\_id* or *domain\_name\_alias.*
|
| **origin\_access\_identity** dictionary | only if *origin\_access\_identity* is true | Describes the origin access identity information. Requires *origin\_access\_identity\_id* to be set. |
| **origin\_access\_identity\_configuration** dictionary | only if *origin\_access\_identity\_configuration* is true | Describes the origin access identity information configuration information. Requires *origin\_access\_identity\_id* to be set. |
| **result** dictionary | always | Result dict not nested under the CloudFront ID to access results of module without the knowledge of that id as figuring out the DistributionId is usually the reason one uses this module in the first place. |
| **streaming\_distribution** dictionary | only if *streaming\_distribution* is true | Describes the streaming information for the distribution. Requires *distribution\_id* or *domain\_name\_alias* to be specified. |
| **streaming\_distribution\_config** dictionary | only if *streaming\_distribution\_config* is true | Describes the streaming configuration information for the distribution. Requires *distribution\_id* or *domain\_name\_alias* to be specified. |
| **summary** dictionary | as default or if summary is true | Gives a summary of distributions, streaming distributions and origin access identities. |
### Authors
* Willem van Ketwich (@wilvk)
| programming_docs |
ansible community.aws.elb_network_lb – Manage a Network Load Balancer community.aws.elb\_network\_lb – Manage a Network Load Balancer
===============================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.elb_network_lb`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage an AWS Network Elastic Load Balancer. See <https://aws.amazon.com/blogs/aws/new-network-load-balancer-effortless-scaling-to-millions-of-requests-per-second/> for details.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **cross\_zone\_load\_balancing** boolean | **Choices:*** no
* yes
| Indicates whether cross-zone load balancing is enabled. Defaults to `false`. |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **deletion\_protection** boolean | **Choices:*** no
* yes
| Indicates whether deletion protection for the ELB is enabled. Defaults to `false`. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **ip\_address\_type** string | **Choices:*** ipv4
* dualstack
| Sets the type of IP addresses used by the subnets of the specified Application Load Balancer. |
| **listeners** list / elements=dictionary | | A list of dicts containing listeners to attach to the ELB. See examples for detail of the dict required. Note that listener keys are CamelCased. |
| | **Certificates** list / elements=dictionary | | The SSL server certificate. |
| | | **CertificateArn** string | | The Amazon Resource Name (ARN) of the certificate. |
| | **DefaultActions** list / elements=dictionary / required | | The default actions for the listener. |
| | | **TargetGroupArn** string | | The Amazon Resource Name (ARN) of the target group. |
| | | **Type** string | | The type of action. |
| | **Port** integer / required | | The port on which the load balancer is listening. |
| | **Protocol** string / required | | The protocol for connections from clients to the load balancer. |
| | **SslPolicy** string | | The security policy that defines which ciphers and protocols are supported. |
| **name** string / required | | The name of the load balancer. This name must be unique within your AWS account, can have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, and must not begin or end with a hyphen. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **purge\_listeners** boolean | **Choices:*** no
* **yes** ←
| If *purge\_listeners=true*, existing listeners will be purged from the ELB to match exactly what is defined by *listeners* parameter. If the *listeners* parameter is not set then listeners will not be modified. |
| **purge\_tags** boolean | **Choices:*** no
* **yes** ←
| If *purge\_tags=true*, existing tags will be purged from the resource to match exactly what is defined by *tags* parameter. If the *tags* parameter is not set then tags will not be modified. |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **scheme** string | **Choices:*** **internet-facing** ←
* internal
| Internet-facing or internal load balancer. An ELB scheme can not be modified after creation. |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** present
* absent
| Create or destroy the load balancer. The current default is `absent`. However, this behavior is inconsistent with other modules and as such the default will change to `present` in 2.14. To maintain the existing behavior explicitly set *state=absent*. |
| **subnet\_mappings** list / elements=dictionary | | A list of dicts containing the IDs of the subnets to attach to the load balancer. You can also specify the allocation ID of an Elastic IP to attach to the load balancer. You can specify one Elastic IP address per subnet. This parameter is mutually exclusive with *subnets*. |
| **subnets** list / elements=string | | A list of the IDs of the subnets to attach to the load balancer. You can specify only one subnet per Availability Zone. You must specify subnets from at least two Availability Zones. Required when *state=present*. This parameter is mutually exclusive with *subnet\_mappings*. |
| **tags** dictionary | | A dictionary of one or more tags to assign to the load balancer. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
| **wait** boolean | **Choices:*** no
* yes
| Whether or not to wait for the network load balancer to reach the desired state. |
| **wait\_timeout** integer | | The duration in seconds to wait, used in conjunction with *wait*. |
Notes
-----
Note
* Listeners are matched based on port. If a listener’s port is changed then a new listener will be created.
* Listener rules are matched based on priority. If a rule’s priority is changed then a new rule will be created.
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
- name: Create an ELB and attach a listener
community.aws.elb_network_lb:
name: myelb
subnets:
- subnet-012345678
- subnet-abcdef000
listeners:
- Protocol: TCP # Required. The protocol for connections from clients to the load balancer (TCP, TLS, UDP or TCP_UDP) (case-sensitive).
Port: 80 # Required. The port on which the load balancer is listening.
DefaultActions:
- Type: forward # Required. Only 'forward' is accepted at this time
TargetGroupName: mytargetgroup # Required. The name of the target group
state: present
- name: Create an ELB with an attached Elastic IP address
community.aws.elb_network_lb:
name: myelb
subnet_mappings:
- SubnetId: subnet-012345678
AllocationId: eipalloc-aabbccdd
listeners:
- Protocol: TCP # Required. The protocol for connections from clients to the load balancer (TCP, TLS, UDP or TCP_UDP) (case-sensitive).
Port: 80 # Required. The port on which the load balancer is listening.
DefaultActions:
- Type: forward # Required. Only 'forward' is accepted at this time
TargetGroupName: mytargetgroup # Required. The name of the target group
state: present
- name: Remove an ELB
community.aws.elb_network_lb:
name: myelb
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **availability\_zones** list / elements=string | when state is present | The Availability Zones for the load balancer. **Sample:** [{'subnet\_id': 'subnet-aabbccddff', 'zone\_name': 'ap-southeast-2a', 'load\_balancer\_addresses': []}] |
| **canonical\_hosted\_zone\_id** string | when state is present | The ID of the Amazon Route 53 hosted zone associated with the load balancer. **Sample:** ABCDEF12345678 |
| **created\_time** string | when state is present | The date and time the load balancer was created. **Sample:** 2015-02-12T02:14:02+00:00 |
| **deletion\_protection\_enabled** string | when state is present | Indicates whether deletion protection is enabled. **Sample:** True |
| **dns\_name** string | when state is present | The public DNS name of the load balancer. **Sample:** internal-my-elb-123456789.ap-southeast-2.elb.amazonaws.com |
| **idle\_timeout\_timeout\_seconds** string | when state is present | The idle timeout value, in seconds. **Sample:** 60 |
| **ip\_address\_type** string | when state is present | The type of IP addresses used by the subnets for the load balancer. **Sample:** ipv4 |
| **listeners** complex | when state is present | Information about the listeners. |
| | **certificates** complex | when state is present | The SSL server certificate. |
| | | **certificate\_arn** string | when state is present | The Amazon Resource Name (ARN) of the certificate. |
| | **default\_actions** string | when state is present | The default actions for the listener. |
| | | **target\_group\_arn** string | when state is present | The Amazon Resource Name (ARN) of the target group. |
| | | **type** string | when state is present | The type of action. |
| | **listener\_arn** string | when state is present | The Amazon Resource Name (ARN) of the listener. |
| | **load\_balancer\_arn** string | when state is present | The Amazon Resource Name (ARN) of the load balancer. |
| | **port** integer | when state is present | The port on which the load balancer is listening. **Sample:** 80 |
| | **protocol** string | when state is present | The protocol for connections from clients to the load balancer. **Sample:** HTTPS |
| | **ssl\_policy** string | when state is present | The security policy that defines which ciphers and protocols are supported. |
| **load\_balancer\_arn** string | when state is present | The Amazon Resource Name (ARN) of the load balancer. **Sample:** arn:aws:elasticloadbalancing:ap-southeast-2:0123456789:loadbalancer/app/my-elb/001122334455 |
| **load\_balancer\_name** string | when state is present | The name of the load balancer. **Sample:** my-elb |
| **load\_balancing\_cross\_zone\_enabled** string | when state is present | Indicates whether cross-zone load balancing is enabled. **Sample:** True |
| **scheme** string | when state is present | Internet-facing or internal load balancer. **Sample:** internal |
| **state** dictionary | when state is present | The state of the load balancer. **Sample:** {'code': 'active'} |
| **tags** dictionary | when state is present | The tags attached to the load balancer. **Sample:** { 'Tag': 'Example' } |
| **type** string | when state is present | The type of load balancer. **Sample:** network |
| **vpc\_id** string | when state is present | The ID of the VPC for the load balancer. **Sample:** vpc-0011223344 |
### Authors
* Rob White (@wimnat)
ansible community.aws.dynamodb_table – Create, update or delete AWS Dynamo DB tables community.aws.dynamodb\_table – Create, update or delete AWS Dynamo DB tables
=============================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.dynamodb_table`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create or delete AWS Dynamo DB tables.
* Can update the provisioned throughput on existing tables.
* Returns the status of the specified table.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto >= 2.37.0
* boto3 >= 1.4.4 (for tagging)
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **hash\_key\_name** string | | Name of the hash key. Required when `state=present`. |
| **hash\_key\_type** string | **Choices:*** **STRING** ←
* NUMBER
* BINARY
| Type of the hash key. |
| **indexes** list / elements=dictionary | **Default:**[] | list of dictionaries describing indexes to add to the table. global indexes can be updated. local indexes don't support updates or have throughput. required options: ['name', 'type', 'hash\_key\_name'] other options: ['hash\_key\_type', 'range\_key\_name', 'range\_key\_type', 'includes', 'read\_capacity', 'write\_capacity'] |
| | **hash\_key\_name** string / required | | The name of the hash-based key. |
| | **hash\_key\_type** string | | The type of the hash-based key. |
| | **includes** list / elements=string | | A list of fields to include when using `global_include` or `include` indexes. |
| | **name** string / required | | The name of the index. |
| | **range\_key\_name** string | | The name of the range-based key. |
| | **range\_key\_type** string | | The type of the range-based key. |
| | **read\_capacity** integer | | Read throughput capacity (units) to provision for the index. |
| | **type** string / required | | The type of index. Valid types: `all`, `global_all`, `global_include`, `global_keys_only`, `include`, `keys_only`
|
| | **write\_capacity** integer | | Write throughput capacity (units) to provision for the index. |
| **name** string / required | | Name of the table. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **range\_key\_name** string | | Name of the range key. |
| **range\_key\_type** string | **Choices:*** **STRING** ←
* NUMBER
* BINARY
| Type of the range key. |
| **read\_capacity** integer | **Default:**1 | Read throughput capacity (units) to provision. |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** **present** ←
* absent
| Create or delete the table. |
| **tags** dictionary | | A hash/dictionary of tags to add to the new instance or for starting/stopping instance by tag. For example: `{"key":"value"}` and `{"key":"value","key2":"value2"}`
|
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
| **wait\_for\_active\_timeout** integer | **Default:**60 | how long before wait gives up, in seconds. only used when tags is set |
| **write\_capacity** integer | **Default:**1 | Write throughput capacity (units) to provision. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- name: Create dynamo table with hash and range primary key
community.aws.dynamodb_table:
name: my-table
region: us-east-1
hash_key_name: id
hash_key_type: STRING
range_key_name: create_time
range_key_type: NUMBER
read_capacity: 2
write_capacity: 2
tags:
tag_name: tag_value
- name: Update capacity on existing dynamo table
community.aws.dynamodb_table:
name: my-table
region: us-east-1
read_capacity: 10
write_capacity: 10
- name: set index on existing dynamo table
community.aws.dynamodb_table:
name: my-table
region: us-east-1
indexes:
- name: NamedIndex
type: global_include
hash_key_name: id
range_key_name: create_time
includes:
- other_field
- other_field2
read_capacity: 10
write_capacity: 10
- name: Delete dynamo table
community.aws.dynamodb_table:
name: my-table
region: us-east-1
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **table\_status** string | success | The current status of the table. **Sample:** ACTIVE |
### Authors
* Alan Loi (@loia)
| programming_docs |
ansible community.aws.aws_direct_connect_connection – Creates, deletes, modifies a DirectConnect connection community.aws.aws\_direct\_connect\_connection – Creates, deletes, modifies a DirectConnect connection
======================================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.aws_direct_connect_connection`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, update, or delete a Direct Connect connection between a network and a specific AWS Direct Connect location. Upon creation the connection may be added to a link aggregation group or established as a standalone connection. The connection may later be associated or disassociated with a link aggregation group.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **bandwidth** string | **Choices:*** 1Gbps
* 10Gbps
| The bandwidth of the Direct Connect connection. Required when *state=present*. |
| **connection\_id** string | | The ID of the Direct Connect connection. Modifying attributes of a connection with *forced\_update* will result in a new Direct Connect connection ID. One of *connection\_id* or *name* must be specified. |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **forced\_update** boolean | **Choices:*** **no** ←
* yes
| To modify *bandwidth* or *location* the connection needs to be deleted and recreated. By default this will not happen. This option must be explicitly set to `true` to change *bandwith* or *location*. |
| **link\_aggregation\_group** string | | The ID of the link aggregation group you want to associate with the connection. This is optional when a stand-alone connection is desired. |
| **location** string | | Where the Direct Connect connection is located. Required when *state=present*. |
| **name** string | | The name of the Direct Connect connection. This is required to create a new connection. One of *connection\_id* or *name* must be specified. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string / required | **Choices:*** present
* absent
| The state of the Direct Connect connection. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# create a Direct Connect connection
- community.aws.aws_direct_connect_connection:
name: ansible-test-connection
state: present
location: EqDC2
link_aggregation_group: dxlag-xxxxxxxx
bandwidth: 1Gbps
register: dc
# disassociate the LAG from the connection
- community.aws.aws_direct_connect_connection:
state: present
connection_id: dc.connection.connection_id
location: EqDC2
bandwidth: 1Gbps
# replace the connection with one with more bandwidth
- community.aws.aws_direct_connect_connection:
state: present
name: ansible-test-connection
location: EqDC2
bandwidth: 10Gbps
forced_update: true
# delete the connection
- community.aws.aws_direct_connect_connection:
state: absent
name: ansible-test-connection
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **connection** complex | *state=present* | The attributes of the direct connect connection. |
| | **aws\_device** string | when the requested state is no longer 'requested' | The endpoint which the physical connection terminates on. **Sample:** EqDC2-12pmo7hemtz1z |
| | **bandwidth** string | always | The bandwidth of the connection. **Sample:** 1Gbps |
| | **connection\_id** string | always | The ID of the connection. **Sample:** dxcon-ffy9ywed |
| | **connection\_name** string | always | The name of the connection. **Sample:** ansible-test-connection |
| | **connection\_state** string | always | The state of the connection. **Sample:** pending |
| | **loa\_issue\_time** string | when the LOA-CFA has been issued (the connection state will no longer be 'requested') | The issue time of the connection's Letter of Authorization - Connecting Facility Assignment. **Sample:** 2018-03-20T17:36:26-04:00 |
| | **location** string | always | The location of the connection. **Sample:** EqDC2 |
| | **owner\_account** string | always | The account that owns the direct connect connection. **Sample:** 123456789012 |
| | **region** string | always | The region in which the connection exists. **Sample:** us-east-1 |
### Authors
* Sloane Hertel (@s-hertel)
ansible community.aws.sns_topic – Manages AWS SNS topics and subscriptions community.aws.sns\_topic – Manages AWS SNS topics and subscriptions
===================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.sns_topic`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* The [community.aws.sns\_topic](#ansible-collections-community-aws-sns-topic-module) module allows you to create, delete, and manage subscriptions for AWS SNS topics.
* As of 2.6, this module can be use to subscribe and unsubscribe to topics outside of your AWS account.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **delivery\_policy** dictionary | | Delivery policy to apply to the SNS topic. |
| **display\_name** string | | Display name of the topic. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **name** string / required | | The name or ARN of the SNS topic to manage. |
| **policy** dictionary | | Policy to apply to the SNS topic. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **purge\_subscriptions** boolean | **Choices:*** no
* **yes** ←
| Whether to purge any subscriptions not listed here. NOTE: AWS does not allow you to purge any PendingConfirmation subscriptions, so if any exist and would be purged, they are silently skipped. This means that somebody could come back later and confirm the subscription. Sorry. Blame Amazon. |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** absent
* **present** ←
| Whether to create or destroy an SNS topic. |
| **subscriptions** list / elements=dictionary | **Default:**[] | List of subscriptions to apply to the topic. Note that AWS requires subscriptions to be confirmed, so you will need to confirm any new subscriptions. |
| | **endpoint** string / required | | Endpoint of subscription. |
| | **protocol** string / required | | Protocol of subscription. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- name: Create alarm SNS topic
community.aws.sns_topic:
name: "alarms"
state: present
display_name: "alarm SNS topic"
delivery_policy:
http:
defaultHealthyRetryPolicy:
minDelayTarget: 2
maxDelayTarget: 4
numRetries: 3
numMaxDelayRetries: 5
backoffFunction: "<linear|arithmetic|geometric|exponential>"
disableSubscriptionOverrides: True
defaultThrottlePolicy:
maxReceivesPerSecond: 10
subscriptions:
- endpoint: "[email protected]"
protocol: "email"
- endpoint: "my_mobile_number"
protocol: "sms"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **community.aws.sns\_topic** complex | always | Dict of sns topic details |
| | **attributes\_set** list / elements=string | always | list of attributes set during this run |
| | **check\_mode** boolean | always | whether check mode was on |
| | **delivery\_policy** string | when topic is owned by this AWS account | Delivery policy for the SNS topic **Sample:** {"http":{"defaultHealthyRetryPolicy":{"minDelayTarget":20,"maxDelayTarget":20,"numRetries":3,"numMaxDelayRetries":0, "numNoDelayRetries":0,"numMinDelayRetries":0,"backoffFunction":"linear"},"disableSubscriptionOverrides":false}} |
| | **display\_name** string | when topic is owned by this AWS account | Display name for SNS topic **Sample:** My topic name |
| | **name** string | always | Topic name **Sample:** ansible-test-dummy-topic |
| | **owner** string | when topic is owned by this AWS account | AWS account that owns the topic **Sample:** 111111111111 |
| | **policy** string | when topic is owned by this AWS account | Policy for the SNS topic **Sample:** {"Version":"2012-10-17","Id":"SomePolicyId","Statement":[{"Sid":"ANewSid","Effect":"Allow","Principal":{"AWS":"arn:aws:iam::111111111111:root"}, "Action":"sns:Subscribe","Resource":"arn:aws:sns:us-east-2:111111111111:ansible-test-dummy-topic","Condition":{"StringEquals":{"sns:Protocol":"email"}}}]} |
| | **state** string | always | whether the topic is present or absent **Sample:** present |
| | **subscriptions** list / elements=string | always | List of subscribers to the topic in this AWS account |
| | **subscriptions\_added** list / elements=string | always | List of subscribers added in this run |
| | **subscriptions\_confirmed** string | when topic is owned by this AWS account | Count of confirmed subscriptions **Sample:** 0 |
| | **subscriptions\_deleted** string | when topic is owned by this AWS account | Count of deleted subscriptions **Sample:** 0 |
| | **subscriptions\_existing** list / elements=string | always | List of existing subscriptions |
| | **subscriptions\_new** list / elements=string | always | List of new subscriptions |
| | **subscriptions\_pending** string | when topic is owned by this AWS account | Count of pending subscriptions **Sample:** 0 |
| | **subscriptions\_purge** boolean | always | Whether or not purge\_subscriptions was set **Sample:** True |
| | **topic\_arn** string | when topic is owned by this AWS account | ARN of the SNS topic (equivalent to sns\_arn) **Sample:** arn:aws:sns:us-east-2:111111111111:ansible-test-dummy-topic |
| | **topic\_created** boolean | always | Whether the topic was created |
| | **topic\_deleted** boolean | always | Whether the topic was deleted |
| **sns\_arn** string | always | The ARN of the topic you are modifying **Sample:** arn:aws:sns:us-east-2:111111111111:my\_topic\_name |
### Authors
* Joel Thompson (@joelthompson)
* Fernando Jose Pando (@nand0p)
* Will Thames (@willthames)
| programming_docs |
ansible community.aws.elb_application_lb – Manage an Application Load Balancer community.aws.elb\_application\_lb – Manage an Application Load Balancer
========================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.elb_application_lb`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage an AWS Application Elastic Load Balancer. See <https://aws.amazon.com/blogs/aws/new-aws-application-load-balancer/> for details.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **access\_logs\_enabled** boolean | **Choices:*** no
* yes
| Whether or not to enable access logs. When set, *access\_logs\_s3\_bucket* must also be set. |
| **access\_logs\_s3\_bucket** string | | The name of the S3 bucket for the access logs. The bucket must exist in the same region as the load balancer and have a bucket policy that grants Elastic Load Balancing permission to write to the bucket. Required if access logs in Amazon S3 are enabled. When set, *access\_logs\_enabled* must also be set. |
| **access\_logs\_s3\_prefix** string | | The prefix for the log location in the S3 bucket. If you don't specify a prefix, the access logs are stored in the root of the bucket. Cannot begin or end with a slash. |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **deletion\_protection** boolean | **Choices:*** no
* yes
| Indicates whether deletion protection for the ELB is enabled. Defaults to `false`. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **http2** boolean | **Choices:*** no
* yes
| Indicates whether to enable HTTP2 routing. Defaults to `false`. |
| **idle\_timeout** integer | | The number of seconds to wait before an idle connection is closed. |
| **ip\_address\_type** string | **Choices:*** ipv4
* dualstack
| Sets the type of IP addresses used by the subnets of the specified Application Load Balancer. |
| **listeners** list / elements=dictionary | | A list of dicts containing listeners to attach to the ELB. See examples for detail of the dict required. Note that listener keys are CamelCased. |
| | **Certificates** list / elements=dictionary | | The SSL server certificate. |
| | | **CertificateArn** string | | The Amazon Resource Name (ARN) of the certificate. |
| | **DefaultActions** list / elements=dictionary / required | | The default actions for the listener. |
| | | **TargetGroupArn** string | | The Amazon Resource Name (ARN) of the target group. |
| | | **Type** string | | The type of action. |
| | **Port** integer / required | | The port on which the load balancer is listening. |
| | **Protocol** string / required | | The protocol for connections from clients to the load balancer. |
| | **Rules** list / elements=dictionary | | A list of ALB Listener Rules. For the complete documentation of possible Conditions and Actions please see the boto3 documentation: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/elbv2.html#ElasticLoadBalancingv2.Client.create\_rule |
| | | **Actions** list / elements=string | | Actions to apply if all of the rule's conditions are met. |
| | | **Conditions** list / elements=string | | Conditions which must be met for the actions to be applied. |
| | | **Priority** integer | | The rule priority. |
| | **SslPolicy** string | | The security policy that defines which ciphers and protocols are supported. |
| **name** string / required | | The name of the load balancer. This name must be unique within your AWS account, can have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, and must not begin or end with a hyphen. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **purge\_listeners** boolean | **Choices:*** no
* **yes** ←
| If `yes`, existing listeners will be purged from the ELB to match exactly what is defined by *listeners* parameter. If the *listeners* parameter is not set then listeners will not be modified. |
| **purge\_rules** boolean | **Choices:*** no
* **yes** ←
| When set to `no`, keep the existing load balancer rules in place. Will modify and add, but will not delete. |
| **purge\_tags** boolean | **Choices:*** no
* **yes** ←
| If yes, existing tags will be purged from the resource to match exactly what is defined by *tags* parameter. If the *tags* parameter is not set then tags will not be modified. |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **scheme** string | **Choices:*** **internet-facing** ←
* internal
| Internet-facing or internal load balancer. An ELB scheme can not be modified after creation. |
| **security\_groups** list / elements=string | **Default:**[] | A list of the names or IDs of the security groups to assign to the load balancer. Required if *state=present*. |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** **present** ←
* absent
| Create or destroy the load balancer. |
| **subnets** list / elements=string | | A list of the IDs of the subnets to attach to the load balancer. You can specify only one subnet per Availability Zone. You must specify subnets from at least two Availability Zones. Required if *state=present*. |
| **tags** dictionary | | A dictionary of one or more tags to assign to the load balancer. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
| **wait** boolean | **Choices:*** **no** ←
* yes
| Wait for the load balancer to have a state of 'active' before completing. A status check is performed every 15 seconds until a successful state is reached. An error is returned after 40 failed checks. |
| **wait\_timeout** integer | | The time in seconds to use in conjunction with *wait*. |
Notes
-----
Note
* Listeners are matched based on port. If a listener’s port is changed then a new listener will be created.
* Listener rules are matched based on priority. If a rule’s priority is changed then a new rule will be created.
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Create an ELB and attach a listener
- community.aws.elb_application_lb:
name: myelb
security_groups:
- sg-12345678
- my-sec-group
subnets:
- subnet-012345678
- subnet-abcdef000
listeners:
- Protocol: HTTP # Required. The protocol for connections from clients to the load balancer (HTTP or HTTPS) (case-sensitive).
Port: 80 # Required. The port on which the load balancer is listening.
# The security policy that defines which ciphers and protocols are supported. The default is the current predefined security policy.
SslPolicy: ELBSecurityPolicy-2015-05
Certificates: # The ARN of the certificate (only one certficate ARN should be provided)
- CertificateArn: arn:aws:iam::12345678987:server-certificate/test.domain.com
DefaultActions:
- Type: forward # Required.
TargetGroupName: # Required. The name of the target group
state: present
# Create an ELB and attach a listener with logging enabled
- community.aws.elb_application_lb:
access_logs_enabled: yes
access_logs_s3_bucket: mybucket
access_logs_s3_prefix: "logs"
name: myelb
security_groups:
- sg-12345678
- my-sec-group
subnets:
- subnet-012345678
- subnet-abcdef000
listeners:
- Protocol: HTTP # Required. The protocol for connections from clients to the load balancer (HTTP or HTTPS) (case-sensitive).
Port: 80 # Required. The port on which the load balancer is listening.
# The security policy that defines which ciphers and protocols are supported. The default is the current predefined security policy.
SslPolicy: ELBSecurityPolicy-2015-05
Certificates: # The ARN of the certificate (only one certficate ARN should be provided)
- CertificateArn: arn:aws:iam::12345678987:server-certificate/test.domain.com
DefaultActions:
- Type: forward # Required.
TargetGroupName: # Required. The name of the target group
state: present
# Create an ALB with listeners and rules
- community.aws.elb_application_lb:
name: test-alb
subnets:
- subnet-12345678
- subnet-87654321
security_groups:
- sg-12345678
scheme: internal
listeners:
- Protocol: HTTPS
Port: 443
DefaultActions:
- Type: forward
TargetGroupName: test-target-group
Certificates:
- CertificateArn: arn:aws:iam::12345678987:server-certificate/test.domain.com
SslPolicy: ELBSecurityPolicy-2015-05
Rules:
- Conditions:
- Field: path-pattern
Values:
- '/test'
Priority: '1'
Actions:
- TargetGroupName: test-target-group
Type: forward
- Conditions:
- Field: path-pattern
Values:
- "/redirect-path/*"
Priority: '2'
Actions:
- Type: redirect
RedirectConfig:
Host: "#{host}"
Path: "/example/redir" # or /#{path}
Port: "#{port}"
Protocol: "#{protocol}"
Query: "#{query}"
StatusCode: "HTTP_302" # or HTTP_301
- Conditions:
- Field: path-pattern
Values:
- "/fixed-response-path/"
Priority: '3'
Actions:
- Type: fixed-response
FixedResponseConfig:
ContentType: "text/plain"
MessageBody: "This is the page you're looking for"
StatusCode: "200"
- Conditions:
- Field: host-header
Values:
- "hostname.domain.com"
- "alternate.domain.com"
Priority: '4'
Actions:
- TargetGroupName: test-target-group
Type: forward
state: present
# Remove an ELB
- community.aws.elb_application_lb:
name: myelb
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **access\_logs\_s3\_bucket** string | when state is present | The name of the S3 bucket for the access logs. **Sample:** mys3bucket |
| **access\_logs\_s3\_enabled** string | when state is present | Indicates whether access logs stored in Amazon S3 are enabled. **Sample:** True |
| **access\_logs\_s3\_prefix** string | when state is present | The prefix for the location in the S3 bucket. **Sample:** my/logs |
| **availability\_zones** list / elements=string | when state is present | The Availability Zones for the load balancer. **Sample:** [{'subnet\_id': 'subnet-aabbccddff', 'zone\_name': 'ap-southeast-2a'}] |
| **canonical\_hosted\_zone\_id** string | when state is present | The ID of the Amazon Route 53 hosted zone associated with the load balancer. **Sample:** ABCDEF12345678 |
| **created\_time** string | when state is present | The date and time the load balancer was created. **Sample:** 2015-02-12T02:14:02+00:00 |
| **deletion\_protection\_enabled** string | when state is present | Indicates whether deletion protection is enabled. **Sample:** True |
| **dns\_name** string | when state is present | The public DNS name of the load balancer. **Sample:** internal-my-elb-123456789.ap-southeast-2.elb.amazonaws.com |
| **idle\_timeout\_timeout\_seconds** integer | when state is present | The idle timeout value, in seconds. **Sample:** 60 |
| **ip\_address\_type** string | when state is present | The type of IP addresses used by the subnets for the load balancer. **Sample:** ipv4 |
| **listeners** complex | when state is present | Information about the listeners. |
| | **certificates** complex | when state is present | The SSL server certificate. |
| | | **certificate\_arn** string | when state is present | The Amazon Resource Name (ARN) of the certificate. |
| | **default\_actions** string | when state is present | The default actions for the listener. |
| | | **target\_group\_arn** string | when state is present | The Amazon Resource Name (ARN) of the target group. |
| | | **type** string | when state is present | The type of action. |
| | **listener\_arn** string | when state is present | The Amazon Resource Name (ARN) of the listener. |
| | **load\_balancer\_arn** string | when state is present | The Amazon Resource Name (ARN) of the load balancer. |
| | **port** integer | when state is present | The port on which the load balancer is listening. **Sample:** 80 |
| | **protocol** string | when state is present | The protocol for connections from clients to the load balancer. **Sample:** HTTPS |
| | **ssl\_policy** string | when state is present | The security policy that defines which ciphers and protocols are supported. |
| **load\_balancer\_arn** string | when state is present | The Amazon Resource Name (ARN) of the load balancer. **Sample:** arn:aws:elasticloadbalancing:ap-southeast-2:0123456789:loadbalancer/app/my-elb/001122334455 |
| **load\_balancer\_name** string | when state is present | The name of the load balancer. **Sample:** my-elb |
| **routing\_http2\_enabled** string | when state is present | Indicates whether HTTP/2 is enabled. **Sample:** True |
| **scheme** string | when state is present | Internet-facing or internal load balancer. **Sample:** internal |
| **security\_groups** list / elements=string | when state is present | The IDs of the security groups for the load balancer. **Sample:** ['sg-0011223344'] |
| **state** dictionary | when state is present | The state of the load balancer. **Sample:** {'code': 'active'} |
| **tags** dictionary | when state is present | The tags attached to the load balancer. **Sample:** { 'Tag': 'Example' } |
| **type** string | when state is present | The type of load balancer. **Sample:** application |
| **vpc\_id** string | when state is present | The ID of the VPC for the load balancer. **Sample:** vpc-0011223344 |
### Authors
* Rob White (@wimnat)
ansible community.aws.iam_cert – Manage server certificates for use on ELBs and CloudFront community.aws.iam\_cert – Manage server certificates for use on ELBs and CloudFront
===================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.iam_cert`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Allows for the management of server certificates.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **cert** string | | The path to, or content of the certificate body in PEM encoded format. As of 2.4 content is accepted. If the parameter is not a file, it is assumed to be content. |
| **cert\_chain** string | | The path to, or content of, the CA certificate chain in PEM encoded format. As of 2.4 content is accepted. If the parameter is not a file, it is assumed to be content. |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **dup\_ok** boolean | **Choices:*** no
* yes
| By default the module will not upload a certificate that is already uploaded into AWS. If *dup\_ok=True*, it will upload the certificate as long as the name is unique. Defaults to `false`. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **key** string | | The path to, or content of the private key in PEM encoded format. As of 2.4 content is accepted. If the parameter is not a file, it is assumed to be content. |
| **name** string / required | | Name of certificate to add, update or remove. |
| **new\_name** string | | When *state=present*, this will update the name of the cert. The *cert*, *key* and *cert\_chain* parameters will be ignored if this is defined. |
| **new\_path** string | | When *state=present*, this will update the path of the cert. The *cert*, *key* and *cert\_chain* parameters will be ignored if this is defined. |
| **path** string | **Default:**"/" | When creating or updating, specify the desired path of the certificate. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string / required | **Choices:*** present
* absent
| Whether to create (or update) or delete the certificate. If *new\_path* or *new\_name* is defined, specifying present will attempt to make an update these. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- name: Basic server certificate upload from local file
community.aws.iam_cert:
name: very_ssl
state: present
cert: "{{ lookup('file', 'path/to/cert') }}"
key: "{{ lookup('file', 'path/to/key') }}"
cert_chain: "{{ lookup('file', 'path/to/certchain') }}"
- name: Basic server certificate upload
community.aws.iam_cert:
name: very_ssl
state: present
cert: path/to/cert
key: path/to/key
cert_chain: path/to/certchain
- name: Server certificate upload using key string
community.aws.iam_cert:
name: very_ssl
state: present
path: "/a/cert/path/"
cert: body_of_somecert
key: vault_body_of_privcertkey
cert_chain: body_of_myverytrustedchain
- name: Basic rename of existing certificate
community.aws.iam_cert:
name: very_ssl
new_name: new_very_ssl
state: present
```
### Authors
* Jonathan I. Davila (@defionscode)
| programming_docs |
ansible community.aws.wafv2_resources – wafv2_web_acl community.aws.wafv2\_resources – wafv2\_web\_acl
================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.wafv2_resources`.
New in version 1.5.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Apply or remove wafv2 to other aws resources.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **arn** string / required | | AWS resources (ALB, API Gateway or AppSync GraphQL API) ARN |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **name** string | | The name of the web acl. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **scope** string | **Choices:*** CLOUDFRONT
* REGIONAL
| Scope of waf |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string / required | **Choices:*** present
* absent
| Whether the rule is present or absent. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- name: add test alb to waf string03
community.aws.wafv2_resources:
name: string03
scope: REGIONAL
state: present
arn: "arn:aws:elasticloadbalancing:eu-central-1:111111111:loadbalancer/app/test03/dd83ea041ba6f933"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **resource\_arns** list / elements=string | Always, as long as the wafv2 exists | Current resources where the wafv2 is applied on **Sample:** ['arn:aws:elasticloadbalancing:eu-central-1:111111111:loadbalancer/app/test03/dd83ea041ba6f933'] |
### Authors
* Markus Bergholz (@markuman)
ansible community.aws.wafv2_rule_group_info – wafv2_web_acl_info community.aws.wafv2\_rule\_group\_info – wafv2\_web\_acl\_info
==============================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.wafv2_rule_group_info`.
New in version 1.5.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Get informations about existing wafv2 rule groups.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **name** string / required | | The name of the rule group. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **scope** string / required | **Choices:*** CLOUDFRONT
* REGIONAL
| Scope of wafv2 rule group. |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string / required | **Choices:*** present
* absent
| Whether the rule is present or absent. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- name: rule group info
community.aws.wafv2_rule_group_info:
name: test02
state: present
scope: REGIONAL
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **arn** string | Always, as long as the web acl exists | Rule group arn **Sample:** arn:aws:wafv2:eu-central-1:11111111:regional/rulegroup/test02/6e90c01a-e4eb-43e5-b6aa-b1604cedf7d7 |
| **capacity** integer | Always, as long as the rule group exists | Current capacity of the rule group **Sample:** 500 |
| **description** string | Always, as long as the web acl exists | Description of the rule group **Sample:** Some rule group description |
| **name** string | Always, as long as the rule group exists | Rule group name **Sample:** test02 |
| **rules** list / elements=string | Always, as long as the rule group exists | Current rules of the rule group **Sample:** [{'action': {'allow': {}}, 'name': 'eins', 'priority': 1, 'statement': {'ip\_set\_reference\_statement': {'arn': 'arn:aws:wafv2:eu-central-1:111111111:regional/ipset/test02/b6978915-c67b-4d1c-8832-2b1bb452143a'}}, 'visibility\_config': {'cloud\_watch\_metrics\_enabled': True, 'metric\_name': 'fsd', 'sampled\_requests\_enabled': True}}] |
| **visibility\_config** dictionary | Always, as long as the rule group exists | Visibility config of the rule group **Sample:** {'cloud\_watch\_metrics\_enabled': True, 'metric\_name': 'blub', 'sampled\_requests\_enabled': False} |
### Authors
* Markus Bergholz (@markuman)
ansible community.aws.cloudtrail – manage CloudTrail create, delete, update community.aws.cloudtrail – manage CloudTrail create, delete, update
===================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.cloudtrail`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Creates, deletes, or updates CloudTrail configuration. Ensures logging is also enabled.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **cloudwatch\_logs\_log\_group\_arn** string | | A full ARN specifying a valid CloudWatch log group to which CloudTrail logs will be delivered. The log group should already exist. See <https://docs.aws.amazon.com/awscloudtrail/latest/userguide/send-cloudtrail-events-to-cloudwatch-logs.html>. Required when `cloudwatch_logs_role_arn`. |
| **cloudwatch\_logs\_role\_arn** string | | Specifies a full ARN for an IAM role that assigns the proper permissions for CloudTrail to create and write to the log group. See <https://docs.aws.amazon.com/awscloudtrail/latest/userguide/send-cloudtrail-events-to-cloudwatch-logs.html>. Required when `cloudwatch_logs_log_group_arn`. |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **enable\_log\_file\_validation** boolean | **Choices:*** no
* yes
| Specifies whether log file integrity validation is enabled. CloudTrail will create a hash for every log file delivered and produce a signed digest file that can be used to ensure log files have not been tampered.
aliases: log\_file\_validation\_enabled |
| **enable\_logging** boolean | **Choices:*** no
* **yes** ←
| Start or stop the CloudTrail logging. If stopped the trail will be paused and will not record events or deliver log files. |
| **include\_global\_events** boolean | **Choices:*** no
* **yes** ←
| Record API calls from global services such as IAM and STS.
aliases: include\_global\_service\_events |
| **is\_multi\_region\_trail** boolean | **Choices:*** **no** ←
* yes
| Specify whether the trail belongs only to one region or exists in all regions. |
| **kms\_key\_id** string | | Specifies the KMS key ID to use to encrypt the logs delivered by CloudTrail. This also has the effect of enabling log file encryption. The value can be an alias name prefixed by "alias/", a fully specified ARN to an alias, a fully specified ARN to a key, or a globally unique identifier. See <https://docs.aws.amazon.com/awscloudtrail/latest/userguide/encrypting-cloudtrail-log-files-with-aws-kms.html>. |
| **name** string | **Default:**"default" | Name for the CloudTrail. Names are unique per-region unless the CloudTrail is a multi-region trail, in which case it is unique per-account. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **s3\_bucket\_name** string | | An existing S3 bucket where CloudTrail will deliver log files. This bucket should exist and have the proper policy. See <https://docs.aws.amazon.com/awscloudtrail/latest/userguide/aggregating_logs_regions_bucket_policy.html>. Required when *state=present*. |
| **s3\_key\_prefix** string | | S3 Key prefix for delivered log files. A trailing slash is not necessary and will be removed. |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **sns\_topic\_name** string | | SNS Topic name to send notifications to when a log file is delivered. |
| **state** string | **Choices:*** **present** ←
* absent
* enabled
* disabled
| Add or remove CloudTrail configuration. The following states have been preserved for backwards compatibility: *state=enabled* and *state=disabled*.
*state=enabled* is equivalet to *state=present*.
*state=disabled* is equivalet to *state=absent*. |
| **tags** dictionary | **Default:**{} | A hash/dictionary of tags to be applied to the CloudTrail resource. Remove completely or specify an empty dictionary to remove all tags. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- name: create single region cloudtrail
community.aws.cloudtrail:
state: present
name: default
s3_bucket_name: mylogbucket
s3_key_prefix: cloudtrail
region: us-east-1
- name: create multi-region trail with validation and tags
community.aws.cloudtrail:
state: present
name: default
s3_bucket_name: mylogbucket
region: us-east-1
is_multi_region_trail: true
enable_log_file_validation: true
cloudwatch_logs_role_arn: "arn:aws:iam::123456789012:role/CloudTrail_CloudWatchLogs_Role"
cloudwatch_logs_log_group_arn: "arn:aws:logs:us-east-1:123456789012:log-group:CloudTrail/DefaultLogGroup:*"
kms_key_id: "alias/MyAliasName"
tags:
environment: dev
Name: default
- name: show another valid kms_key_id
community.aws.cloudtrail:
state: present
name: default
s3_bucket_name: mylogbucket
kms_key_id: "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012"
# simply "12345678-1234-1234-1234-123456789012" would be valid too.
- name: pause logging the trail we just created
community.aws.cloudtrail:
state: present
name: default
enable_logging: false
s3_bucket_name: mylogbucket
region: us-east-1
is_multi_region_trail: true
enable_log_file_validation: true
tags:
environment: dev
Name: default
- name: delete a trail
community.aws.cloudtrail:
state: absent
name: default
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **exists** boolean | always | whether the resource exists **Sample:** True |
| **trail** complex | always | CloudTrail resource details **Sample:** hash/dictionary of values |
| | **cloud\_watch\_logs\_log\_group\_arn** string | success when present | Full ARN of the CloudWatch Logs log group where events are delivered. **Sample:** arn:aws:logs:us-east-1:123456789012:log-group:CloudTrail/DefaultLogGroup:\* |
| | **cloud\_watch\_logs\_role\_arn** string | success when present | Full ARN of the IAM role that CloudTrail assumes to deliver events. **Sample:** arn:aws:iam::123456789012:role/CloudTrail\_CloudWatchLogs\_Role |
| | **has\_custom\_event\_selectors** boolean | success | Whether any custom event selectors are used for this trail. |
| | **home\_region** string | success | The home region where the trail was originally created and must be edited. **Sample:** us-east-1 |
| | **include\_global\_service\_events** boolean | success | Whether global services (IAM, STS) are logged with this trail **Sample:** True |
| | **is\_logging** boolean | success | Whether logging is turned on or paused for the Trail **Sample:** True |
| | **is\_multi\_region\_trail** boolean | success | Whether the trail applies to all regions or just one **Sample:** True |
| | **kms\_key\_id** string | success when present | Full ARN of the KMS Key used to encrypt log files. **Sample:** arn:aws:kms::123456789012:key/12345678-1234-1234-1234-123456789012 |
| | **log\_file\_validation\_enabled** boolean | success | Whether log file validation is enabled on the trail **Sample:** True |
| | **name** string | success | Name of the CloudTrail resource **Sample:** default |
| | **s3\_bucket\_name** string | success | S3 bucket name where log files are delivered **Sample:** myBucket |
| | **s3\_key\_prefix** string | success when present | Key prefix in bucket where log files are delivered (if any) **Sample:** myKeyPrefix |
| | **sns\_topic\_arn** string | success when present | Full ARN of the SNS topic where log delivery notifications are sent. **Sample:** arn:aws:sns:us-east-1:123456789012:topic/myTopic |
| | **sns\_topic\_name** string | success when present | The SNS topic name where log delivery notifications are sent. **Sample:** myTopic |
| | **tags** dictionary | success | hash/dictionary of tags applied to this resource **Sample:** {'Name': 'default', 'environment': 'dev'} |
| | **trail\_arn** string | success | Full ARN of the CloudTrail resource **Sample:** arn:aws:cloudtrail:us-east-1:123456789012:trail/default |
### Authors
* Ansible Core Team
* Ted Timmons (@tedder)
* Daniel Shepherd (@shepdelacreme)
| programming_docs |
ansible community.aws.aws_waf_rule – Create and delete WAF Rules community.aws.aws\_waf\_rule – Create and delete WAF Rules
==========================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.aws_waf_rule`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Read the AWS documentation for WAF <https://aws.amazon.com/documentation/waf/>.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* boto
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **conditions** list / elements=dictionary | | List of conditions used in the rule. [community.aws.aws\_waf\_condition](aws_waf_condition_module) can be used to create new conditions. |
| | **condition** string / required | | The name of the condition. The condition must already exist. |
| | **negated** boolean / required | **Choices:*** no
* yes
| Whether the condition should be negated. |
| | **type** string / required | **Choices:*** byte
* geo
* ip
* size
* sql
* xss
| The type of rule to match. |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **metric\_name** string | | A friendly name or description for the metrics for the rule. The name can contain only alphanumeric characters (A-Z, a-z, 0-9); the name can't contain whitespace. You can't change *metric\_name* after you create the rule. Defaults to the same as *name* with disallowed characters removed. |
| **name** string / required | | Name of the Web Application Firewall rule. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **purge\_conditions** boolean | **Choices:*** **no** ←
* yes
| Whether or not to remove conditions that are not passed when updating `conditions`. |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** **present** ←
* absent
| Whether the rule should be present or absent. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
| **waf\_regional** boolean | **Choices:*** **no** ←
* yes
| Whether to use waf-regional module. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- name: create WAF rule
community.aws.aws_waf_rule:
name: my_waf_rule
conditions:
- name: my_regex_condition
type: regex
negated: no
- name: my_geo_condition
type: geo
negated: no
- name: my_byte_condition
type: byte
negated: yes
- name: remove WAF rule
community.aws.aws_waf_rule:
name: "my_waf_rule"
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **rule** complex | always | WAF rule contents |
| | **metric\_name** string | always | Metric name for the rule. **Sample:** ansibletest1234rule |
| | **name** string | always | Friendly name for the rule. **Sample:** ansible-test-1234\_rule |
| | **predicates** complex | always | List of conditions used in the rule. |
| | | **data\_id** string | always | ID of the condition. **Sample:** 8251acdb-526c-42a8-92bc-d3d13e584166 |
| | | **negated** boolean | always | Whether the sense of the condition is negated. |
| | | **type** string | always | type of the condition. **Sample:** ByteMatch |
| | **rule\_id** string | always | ID of the WAF rule. **Sample:** 15de0cbc-9204-4e1f-90e6-69b2f415c261 |
### Authors
* Mike Mochan (@mmochan)
* Will Thames (@willthames)
ansible community.aws.aws_waf_web_acl – Create and delete WAF Web ACLs. community.aws.aws\_waf\_web\_acl – Create and delete WAF Web ACLs.
==================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.aws_waf_web_acl`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Read the AWS documentation for WAF <https://aws.amazon.com/documentation/waf/>.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* boto
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **default\_action** string | **Choices:*** block
* allow
* count
| The action that you want AWS WAF to take when a request doesn't match the criteria specified in any of the Rule objects that are associated with the WebACL. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **metric\_name** string | | A friendly name or description for the metrics for this WebACL. The name can contain only alphanumeric characters (A-Z, a-z, 0-9); the name can't contain whitespace. You can't change *metric\_name* after you create the WebACL. Metric name will default to *name* with disallowed characters stripped out. |
| **name** string / required | | Name of the Web Application Firewall ACL to manage. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **purge\_rules** boolean | **Choices:*** **no** ←
* yes
| Whether to remove rules that aren't passed with *rules*. |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **rules** list / elements=dictionary | | A list of rules that the Web ACL will enforce. |
| | **action** string / required | | The action to perform. |
| | **name** string / required | | Name of the rule. |
| | **priority** integer / required | | The priority of the action. Priorities must be unique. Lower numbered priorities are evaluated first. |
| | **type** string | **Choices:*** rate\_based
* regular
| The type of rule. |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** **present** ←
* absent
| Whether the Web ACL should be present or absent. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
| **waf\_regional** boolean | **Choices:*** **no** ←
* yes
| Whether to use waf-regional module. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- name: create web ACL
community.aws.aws_waf_web_acl:
name: my_web_acl
rules:
- name: my_rule
priority: 1
action: block
default_action: block
purge_rules: yes
state: present
- name: delete the web acl
community.aws.aws_waf_web_acl:
name: my_web_acl
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **web\_acl** complex | always | contents of the Web ACL. |
| | **default\_action** dictionary | always | Default action taken by the Web ACL if no rules match. **Sample:** {'type': 'BLOCK'} |
| | **metric\_name** string | always | Metric name used as an identifier. **Sample:** mywebacl |
| | **name** string | always | Friendly name of the Web ACL. **Sample:** my web acl |
| | **rules** complex | always | List of rules. |
| | | **action** complex | always | Action taken by the WAF when the rule matches. **Sample:** {'type': 'ALLOW'} |
| | | **priority** integer | always | priority number of the rule (lower numbers are run first). **Sample:** 2 |
| | | **rule\_id** string | always | Rule ID. **Sample:** a6fc7ab5-287b-479f-8004-7fd0399daf75 |
| | | **type** string | always | Type of rule (either REGULAR or RATE\_BASED). **Sample:** REGULAR |
| | **web\_acl\_id** string | always | Unique identifier of Web ACL. **Sample:** 10fff965-4b6b-46e2-9d78-24f6d2e2d21c |
### Authors
* Mike Mochan (@mmochan)
* Will Thames (@willthames)
ansible community.aws.rds_subnet_group – manage RDS database subnet groups community.aws.rds\_subnet\_group – manage RDS database subnet groups
====================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.rds_subnet_group`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Creates, modifies, and deletes RDS database subnet groups. This module has a dependency on python-boto >= 2.5.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* boto
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **description** string | | Database subnet group description. Required when *state=present*. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **name** string / required | | Database subnet group identifier. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string / required | **Choices:*** present
* absent
| Specifies whether the subnet should be present or absent. |
| **subnets** list / elements=string | | List of subnet IDs that make up the database subnet group. Required when *state=present*. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- name: Add or change a subnet group
community.aws.rds_subnet_group:
state: present
name: norwegian-blue
description: My Fancy Ex Parrot Subnet Group
subnets:
- subnet-aaaaaaaa
- subnet-bbbbbbbb
- name: Remove a subnet group
community.aws.rds_subnet_group:
state: absent
name: norwegian-blue
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **subnet\_group** complex | *state=present* | Dictionary of DB subnet group values |
| | **db\_subnet\_group\_arn** string | *state=present* | The ARN of the DB subnet group |
| | **db\_subnet\_group\_description** string | *state=present* | The description of the DB subnet group |
| | **db\_subnet\_group\_name** string | *state=present* | The name of the DB subnet group |
| | **description** string | *state=present* | The description of the DB subnet group (maintained for backward compatibility) |
| | **name** string | *state=present* | The name of the DB subnet group (maintained for backward compatibility) |
| | **status** string | *state=present* | The status of the DB subnet group (maintained for backward compatibility) |
| | **subnet\_group\_status** string | *state=present* | The status of the DB subnet group |
| | **subnet\_ids** list / elements=string | *state=present* | Contains a list of Subnet IDs |
| | **subnets** list / elements=string | *state=present* | Contains a list of Subnet elements (@see https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/rds.html#RDS.Client.describe\_db\_subnet\_groups) |
| | **vpc\_id** string | *state=present* | The VpcId of the DB subnet group |
### Authors
* Scott Anderson (@tastychutney)
| programming_docs |
ansible community.aws.lambda_info – Gathers AWS Lambda function details community.aws.lambda\_info – Gathers AWS Lambda function details
================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.lambda_info`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Gathers various details related to Lambda functions, including aliases, versions and event source mappings.
* Use module [community.aws.lambda](lambda_module#ansible-collections-community-aws-lambda-module) to manage the lambda function itself, [community.aws.lambda\_alias](lambda_alias_module#ansible-collections-community-aws-lambda-alias-module) to manage function aliases and [community.aws.lambda\_event](lambda_event_module#ansible-collections-community-aws-lambda-event-module) to manage lambda event source mappings.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **event\_source\_arn** string | | When *query=mappings*, this is the Amazon Resource Name (ARN) of the Amazon Kinesis or DynamoDB stream. |
| **function\_name** string | | The name of the lambda function for which information is requested.
aliases: function, name |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **query** string | **Choices:*** aliases
* **all** ←
* config
* mappings
* policy
* versions
| Specifies the resource type for which to gather information. Leave blank to retrieve all information. |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
---
# Simple example of listing all info for a function
- name: List all for a specific function
community.aws.lambda_info:
query: all
function_name: myFunction
register: my_function_details
# List all versions of a function
- name: List function versions
community.aws.lambda_info:
query: versions
function_name: myFunction
register: my_function_versions
# List all lambda function versions
- name: List all function
community.aws.lambda_info:
query: all
max_items: 20
register: output
- name: show Lambda information
ansible.builtin.debug:
msg: "{{ output['function'] }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **function** dictionary | success | lambda function list |
| **function.TheName** dictionary | success | lambda function information, including event, mapping, and version information |
### Authors
* Pierre Jodouin (@pjodouin)
ansible community.aws.s3_lifecycle – Manage S3 bucket lifecycle rules in AWS community.aws.s3\_lifecycle – Manage S3 bucket lifecycle rules in AWS
=====================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.s3_lifecycle`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Manage S3 bucket lifecycle rules in AWS.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* boto
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **expiration\_date** string | | Indicates the lifetime of the objects that are subject to the rule by the date they will expire. The value must be ISO-8601 format, the time must be midnight and a GMT timezone must be specified. |
| **expiration\_days** integer | | Indicates the lifetime, in days, of the objects that are subject to the rule. The value must be a non-zero positive integer. |
| **name** string / required | | Name of the S3 bucket. |
| **noncurrent\_version\_expiration\_days** integer | | The number of days after which non-current versions should be deleted. |
| **noncurrent\_version\_storage\_class** string | **Choices:*** **glacier** ←
* onezone\_ia
* standard\_ia
* intelligent\_tiering
* deep\_archive
| The storage class to which non-current versions are transitioned. |
| **noncurrent\_version\_transition\_days** integer | | The number of days after which non-current versions will be transitioned to the storage class specified in *noncurrent\_version\_storage\_class*. |
| **noncurrent\_version\_transitions** list / elements=dictionary | | A list of transition behaviors to be applied to noncurrent versions for the rule. Each storage class may be used only once. Each transition behavior contains these elements *transition\_days* *storage\_class*
|
| **prefix** string | | Prefix identifying one or more objects to which the rule applies. If no prefix is specified, the rule will apply to the whole bucket. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **purge\_transitions** boolean | **Choices:*** no
* **yes** ←
| Whether to replace all the current transition(s) with the new transition(s). When `false`, the provided transition(s) will be added, replacing transitions with the same storage\_class. When true, existing transitions will be removed and replaced with the new transition(s) |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **requester\_pays** boolean | **Choices:*** no
* yes
| The *requester\_pays* option does nothing and will be removed after 2022-06-01 |
| **rule\_id** string | | Unique identifier for the rule. The value cannot be longer than 255 characters. A unique value for the rule will be generated if no value is provided. |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** **present** ←
* absent
| Create or remove the lifecycle rule. |
| **status** string | **Choices:*** **enabled** ←
* disabled
| If `enabled`, the rule is currently being applied. If `disabled`, the rule is not currently being applied. |
| **storage\_class** string | **Choices:*** **glacier** ←
* onezone\_ia
* standard\_ia
* intelligent\_tiering
* deep\_archive
| The storage class to transition to. |
| **transition\_date** string | | Indicates the lifetime of the objects that are subject to the rule by the date they will transition to a different storage class. The value must be ISO-8601 format, the time must be midnight and a GMT timezone must be specified. If (transition\_days) is not specified, this parameter is required. |
| **transition\_days** integer | | Indicates when, in days, an object transitions to a different storage class. If *transition\_date* is not specified, this parameter is required. |
| **transitions** list / elements=dictionary | | A list of transition behaviors to be applied to the rule. Each storage class may be used only once. Each transition behavior may contain these elements *transition\_days* *transition\_date* *storage\_class*
|
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
| **wait** boolean added in 1.5.0 of community.aws | **Choices:*** **no** ←
* yes
| Wait for the configuration to complete before returning. |
Notes
-----
Note
* If specifying expiration time as days then transition time must also be specified in days.
* If specifying expiration time as a date then transition time must also be specified as a date.
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
- name: Configure a lifecycle rule on a bucket to expire (delete) items with a prefix of /logs/ after 30 days
community.aws.s3_lifecycle:
name: mybucket
expiration_days: 30
prefix: logs/
status: enabled
state: present
- name: Configure a lifecycle rule to transition all items with a prefix of /logs/ to glacier after 7 days and then delete after 90 days
community.aws.s3_lifecycle:
name: mybucket
transition_days: 7
expiration_days: 90
prefix: logs/
status: enabled
state: present
# Note that midnight GMT must be specified.
# Be sure to quote your date strings
- name: Configure a lifecycle rule to transition all items with a prefix of /logs/ to glacier on 31 Dec 2020 and then delete on 31 Dec 2030.
community.aws.s3_lifecycle:
name: mybucket
transition_date: "2020-12-30T00:00:00.000Z"
expiration_date: "2030-12-30T00:00:00.000Z"
prefix: logs/
status: enabled
state: present
- name: Disable the rule created above
community.aws.s3_lifecycle:
name: mybucket
prefix: logs/
status: disabled
state: present
- name: Delete the lifecycle rule created above
community.aws.s3_lifecycle:
name: mybucket
prefix: logs/
state: absent
- name: Configure a lifecycle rule to transition all backup files older than 31 days in /backups/ to standard infrequent access class.
community.aws.s3_lifecycle:
name: mybucket
prefix: backups/
storage_class: standard_ia
transition_days: 31
state: present
status: enabled
- name: Configure a lifecycle rule to transition files to infrequent access after 30 days and glacier after 90
community.aws.s3_lifecycle:
name: mybucket
prefix: logs/
state: present
status: enabled
transitions:
- transition_days: 30
storage_class: standard_ia
- transition_days: 90
storage_class: glacier
```
### Authors
* Rob White (@wimnat)
ansible community.aws.s3_website – Configure an s3 bucket as a website community.aws.s3\_website – Configure an s3 bucket as a website
===============================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.s3_website`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Configure an s3 bucket as a website
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **error\_key** string | | The object key name to use when a 4XX class error occurs. To remove an error key, set to None. |
| **name** string / required | | Name of the s3 bucket |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **redirect\_all\_requests** string | | Describes the redirect behavior for every request to this s3 bucket website endpoint |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string / required | **Choices:*** present
* absent
| Add or remove s3 website configuration |
| **suffix** string | **Default:**"index.html" | Suffix that is appended to a request that is for a directory on the website endpoint (e.g. if the suffix is index.html and you make a request to samplebucket/images/ the data that is returned will be for the object with the key name images/index.html). The suffix must not include a slash character. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
- name: Configure an s3 bucket to redirect all requests to example.com
community.aws.s3_website:
name: mybucket.com
redirect_all_requests: example.com
state: present
- name: Remove website configuration from an s3 bucket
community.aws.s3_website:
name: mybucket.com
state: absent
- name: Configure an s3 bucket as a website with index and error pages
community.aws.s3_website:
name: mybucket.com
suffix: home.htm
error_key: errors/404.htm
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **error\_document** complex | always | error document |
| | **key** string | when error\_document parameter set | object key name to use when a 4XX class error occurs **Sample:** error.html |
| **index\_document** complex | always | index document |
| | **suffix** string | success | suffix that is appended to a request that is for a directory on the website endpoint **Sample:** index.html |
| **redirect\_all\_requests\_to** complex | always | where to redirect requests |
| | **host\_name** string | when redirect all requests parameter set | name of the host where requests will be redirected. **Sample:** ansible.com |
| | **protocol** string | when redirect all requests parameter set | protocol to use when redirecting requests. **Sample:** https |
| **routing\_rules** list / elements=string | always | routing rules |
| | **condition** complex | success | A container for describing a condition that must be met for the specified redirect to apply. |
| | | **http\_error\_code\_returned\_equals** string | always | The HTTP error code when the redirect is applied. |
| | | **key\_prefix\_equals** string | when routing rule present | object key name prefix when the redirect is applied. For example, to redirect requests for ExamplePage.html, the key prefix will be ExamplePage.html **Sample:** docs/ |
| | **redirect** complex | always | Container for redirect information. |
| | | **host\_name** string | when host name set as part of redirect rule | name of the host where requests will be redirected. **Sample:** ansible.com |
| | | **http\_redirect\_code** string | when routing rule present | The HTTP redirect code to use on the response. |
| | | **protocol** string | when routing rule present | Protocol to use when redirecting requests. **Sample:** http |
| | | **replace\_key\_prefix\_with** string | when routing rule present | object key prefix to use in the redirect request **Sample:** documents/ |
| | | **replace\_key\_with** string | when routing rule present | object key prefix to use in the redirect request **Sample:** documents/ |
### Authors
* Rob White (@wimnat)
| programming_docs |
ansible community.aws.ecs_service – Create, terminate, start or stop a service in ECS community.aws.ecs\_service – Create, terminate, start or stop a service in ECS
==============================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.ecs_service`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Returned Facts](#returned-facts)
* [Return Values](#return-values)
Synopsis
--------
* Creates or terminates ECS. services.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* json
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **client\_token** string | | Unique, case-sensitive identifier you provide to ensure the idempotency of the request. Up to 32 ASCII characters are allowed. |
| **cluster** string | | The name of the cluster in which the service exists. |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **delay** integer | **Default:**10 | The time to wait before checking that the service is available. |
| **deployment\_configuration** dictionary | | Optional parameters that control the deployment\_configuration. Format is '{"maximum\_percent":<integer>, "minimum\_healthy\_percent":<integer>} |
| | **maximum\_percent** integer | | Upper limit on the number of tasks in a service that are allowed in the RUNNING or PENDING state during a deployment. |
| | **minimum\_healthy\_percent** integer | | A lower limit on the number of tasks in a service that must remain in the RUNNING state during a deployment. |
| **desired\_count** integer | | The count of how many instances of the service. This parameter is required when *state=present*. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **force\_new\_deployment** boolean | **Choices:*** **no** ←
* yes
| Force deployment of service even if there are no changes. |
| **health\_check\_grace\_period\_seconds** integer | | Seconds to wait before health checking the freshly added/updated services. This option requires botocore >= 1.8.20. |
| **launch\_type** string | **Choices:*** EC2
* FARGATE
| The launch type on which to run your service. |
| **load\_balancers** list / elements=dictionary | | The list of ELBs defined for this service. |
| **name** string / required | | The name of the service. |
| **network\_configuration** dictionary | | Network configuration of the service. Only applicable for task definitions created with *network\_mode=awsvpc*.
*assign\_public\_ip* requires botocore >= 1.8.4 |
| | **assign\_public\_ip** boolean | **Choices:*** no
* yes
| Whether the task's elastic network interface receives a public IP address. This option requires botocore >= 1.8.4. |
| | **security\_groups** list / elements=string | | A list of security group names or group IDs to associate with the task. |
| | **subnets** list / elements=string | | A list of subnet IDs to associate with the task. |
| **placement\_constraints** list / elements=dictionary | | The placement constraints for the tasks in the service. See <https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_PlacementConstraint.html> for more details. |
| | **expression** string | | A cluster query language expression to apply to the constraint. |
| | **type** string | | The type of constraint. |
| **placement\_strategy** list / elements=dictionary | | The placement strategy objects to use for tasks in your service. You can specify a maximum of 5 strategy rules per service. |
| | **field** string | | The field to apply the placement strategy against. |
| | **type** string | | The type of placement strategy. |
| **platform\_version** string added in 1.5.0 of community.aws | | Numeric part of platform version or LATEST See <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html> for more details. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **repeat** integer | **Default:**10 | The number of times to check that the service is available. |
| **role** string | | The name or full Amazon Resource Name (ARN) of the IAM role that allows your Amazon ECS container agent to make calls to your load balancer on your behalf. This parameter is only required if you are using a load balancer with your service in a network mode other than `awsvpc`. |
| **scheduling\_strategy** string | **Choices:*** DAEMON
* REPLICA
| The scheduling strategy. Defaults to `REPLICA` if not given to preserve previous behavior. |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **service\_registries** list / elements=dictionary | | Describes service discovery registries this service will register with. |
| | **arn** string | | Service discovery registry ARN. |
| | **container\_name** string | | Container name for service discovery registration. |
| | **container\_port** integer | | Container port for service discovery registration. |
| **state** string / required | **Choices:*** present
* absent
* deleting
| The desired state of the service. |
| **task\_definition** string | | The task definition the service will run. This parameter is required when *state=present*. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* The service role specified must be assumable. (i.e. have a trust relationship for the ecs service, ecs.amazonaws.com)
* For details of the parameters and returns see <https://boto3.readthedocs.io/en/latest/reference/services/ecs.html>.
* An IAM role must have been previously created.
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Basic provisioning example
- community.aws.ecs_service:
state: present
name: console-test-service
cluster: new_cluster
task_definition: 'new_cluster-task:1'
desired_count: 0
- name: create ECS service on VPC network
community.aws.ecs_service:
state: present
name: console-test-service
cluster: new_cluster
task_definition: 'new_cluster-task:1'
desired_count: 0
network_configuration:
subnets:
- subnet-abcd1234
security_groups:
- sg-aaaa1111
- my_security_group
# Simple example to delete
- community.aws.ecs_service:
name: default
state: absent
cluster: new_cluster
# With custom deployment configuration (added in version 2.3), placement constraints and strategy (added in version 2.4)
- community.aws.ecs_service:
state: present
name: test-service
cluster: test-cluster
task_definition: test-task-definition
desired_count: 3
deployment_configuration:
minimum_healthy_percent: 75
maximum_percent: 150
placement_constraints:
- type: memberOf
expression: 'attribute:flavor==test'
placement_strategy:
- type: binpack
field: memory
```
Returned Facts
--------------
Facts returned by this module are added/updated in the `hostvars` host facts and can be referenced by name just like any other host fact. They do not need to be registered in order to use them.
| Fact | Returned | Description |
| --- | --- | --- |
| **service** complex / elements=string | when service existed and was deleted | Details of deleted service. |
| | **clusterArn** string / elements=string | always | The Amazon Resource Name (ARN) of the of the cluster that hosts the service. |
| | **deploymentConfiguration** complex / elements=string | always | dictionary of deploymentConfiguration |
| | | **maximumPercent** integer / elements=string | always | maximumPercent param |
| | | **minimumHealthyPercent** integer / elements=string | always | minimumHealthyPercent param |
| | **deployments** list / elements=dictionary | always | list of service deployments |
| | **desiredCount** integer / elements=string | always | The desired number of instantiations of the task definition to keep running on the service. |
| | **events** list / elements=dictionary | always | list of service events |
| | **loadBalancers** complex / elements=string | always | A list of load balancer objects |
| | | **containerName** string / elements=string | always | The name of the container to associate with the load balancer. |
| | | **containerPort** integer / elements=string | always | The port on the container to associate with the load balancer. |
| | | **loadBalancerName** string / elements=string | always | the name |
| | **pendingCount** integer / elements=string | always | The number of tasks in the cluster that are in the PENDING state. |
| | **placementConstraints** list / elements=dictionary | always | List of placement constraints objects |
| | | **expression** string / elements=string | always | A cluster query language expression to apply to the constraint. Note you cannot specify an expression if the constraint type is distinctInstance. |
| | | **type** string / elements=string | always | The type of constraint. Valid values are distinctInstance and memberOf. |
| | **placementStrategy** list / elements=dictionary | always | List of placement strategy objects |
| | | **field** string / elements=string | always | The field to apply the placement strategy against. For the spread placement strategy, valid values are instanceId (or host, which has the same effect), or any platform or custom attribute that is applied to a container instance, such as attribute:ecs.availability-zone. For the binpack placement strategy, valid values are CPU and MEMORY. |
| | | **type** string / elements=string | always | The type of placement strategy. Valid values are random, spread and binpack. |
| | **runningCount** integer / elements=string | always | The number of tasks in the cluster that are in the RUNNING state. |
| | **serviceArn** string / elements=string | always | The Amazon Resource Name (ARN) that identifies the service. The ARN contains the arn:aws:ecs namespace, followed by the region of the service, the AWS account ID of the service owner, the service namespace, and then the service name. For example, arn:aws:ecs:region :012345678910 :service/my-service . |
| | **serviceName** string / elements=string | always | A user-generated string used to identify the service |
| | **status** string / elements=string | always | The valid values are ACTIVE, DRAINING, or INACTIVE. |
| | **taskDefinition** string / elements=string | always | The ARN of a task definition to use for tasks in the service. |
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **service** complex | when creating a service | Details of created service. |
| | **clusterArn** string | always | The Amazon Resource Name (ARN) of the of the cluster that hosts the service. |
| | **deploymentConfiguration** complex | always | dictionary of deploymentConfiguration |
| | | **maximumPercent** integer | always | maximumPercent param |
| | | **minimumHealthyPercent** integer | always | minimumHealthyPercent param |
| | **deployments** list / elements=dictionary | always | list of service deployments |
| | **desiredCount** integer | always | The desired number of instantiations of the task definition to keep running on the service. |
| | **events** list / elements=dictionary | always | list of service events |
| | **loadBalancers** complex | always | A list of load balancer objects |
| | | **containerName** string | always | The name of the container to associate with the load balancer. |
| | | **containerPort** integer | always | The port on the container to associate with the load balancer. |
| | | **loadBalancerName** string | always | the name |
| | **pendingCount** integer | always | The number of tasks in the cluster that are in the PENDING state. |
| | **placementConstraints** list / elements=dictionary | always | List of placement constraints objects |
| | | **expression** string | always | A cluster query language expression to apply to the constraint. Note you cannot specify an expression if the constraint type is distinctInstance. |
| | | **type** string | always | The type of constraint. Valid values are distinctInstance and memberOf. |
| | **placementStrategy** list / elements=dictionary | always | List of placement strategy objects |
| | | **field** string | always | The field to apply the placement strategy against. For the spread placement strategy, valid values are instanceId (or host, which has the same effect), or any platform or custom attribute that is applied to a container instance, such as attribute:ecs.availability-zone. For the binpack placement strategy, valid values are CPU and MEMORY. |
| | | **type** string | always | The type of placement strategy. Valid values are random, spread and binpack. |
| | **runningCount** integer | always | The number of tasks in the cluster that are in the RUNNING state. |
| | **serviceArn** string | always | The Amazon Resource Name (ARN) that identifies the service. The ARN contains the arn:aws:ecs namespace, followed by the region of the service, the AWS account ID of the service owner, the service namespace, and then the service name. For example, arn:aws:ecs:region :012345678910 :service/my-service . |
| | **serviceName** string | always | A user-generated string used to identify the service |
| | **status** string | always | The valid values are ACTIVE, DRAINING, or INACTIVE. |
| | **taskDefinition** string | always | The ARN of a task definition to use for tasks in the service. |
### Authors
* Mark Chance (@Java1Guy)
* Darek Kaczynski (@kaczynskid)
* Stephane Maarek (@simplesteph)
* Zac Blazic (@zacblazic)
ansible community.aws.ec2_asg_info – Gather information about ec2 Auto Scaling Groups (ASGs) in AWS community.aws.ec2\_asg\_info – Gather information about ec2 Auto Scaling Groups (ASGs) in AWS
=============================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.ec2_asg_info`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Gather information about ec2 Auto Scaling Groups (ASGs) in AWS
* This module was called `ec2_asg_facts` before Ansible 2.9. The usage did not change.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **name** string | | The prefix or name of the auto scaling group(s) you are searching for. Note: This is a regular expression match with implicit '^' (beginning of string). Append '$' for a complete name match. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **tags** dictionary | | A dictionary/hash of tags in the format { tag1\_name: 'tag1\_value', tag2\_name: 'tag2\_value' } to match against the auto scaling group(s) you are searching for. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
- name: Find all groups
community.aws.ec2_asg_info:
register: asgs
- name: Find a group with matching name/prefix
community.aws.ec2_asg_info:
name: public-webserver-asg
register: asgs
- name: Find a group with matching tags
community.aws.ec2_asg_info:
tags:
project: webapp
env: production
register: asgs
- name: Find a group with matching name/prefix and tags
community.aws.ec2_asg_info:
name: myproject
tags:
env: production
register: asgs
- name: Fail if no groups are found
community.aws.ec2_asg_info:
name: public-webserver-asg
register: asgs
failed_when: "{{ asgs.results | length == 0 }}"
- name: Fail if more than 1 group is found
community.aws.ec2_asg_info:
name: public-webserver-asg
register: asgs
failed_when: "{{ asgs.results | length > 1 }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **auto\_scaling\_group\_arn** string | success | The Amazon Resource Name of the ASG **Sample:** arn:aws:autoscaling:us-west-2:1234567890:autoScalingGroup:10787c52-0bcb-427d-82ba-c8e4b008ed2e:autoScalingGroupName/public-webapp-production-1 |
| **auto\_scaling\_group\_name** string | success | Name of autoscaling group **Sample:** public-webapp-production-1 |
| **availability\_zones** list / elements=string | success | List of Availability Zones that are enabled for this ASG. **Sample:** ['us-west-2a', 'us-west-2b', 'us-west-2a'] |
| **created\_time** string | success | The date and time this ASG was created, in ISO 8601 format. **Sample:** 2015-11-25T00:05:36.309Z |
| **default\_cooldown** integer | success | The default cooldown time in seconds. **Sample:** 300 |
| **desired\_capacity** integer | success | The number of EC2 instances that should be running in this group. **Sample:** 3 |
| **health\_check\_period** integer | success | Length of time in seconds after a new EC2 instance comes into service that Auto Scaling starts checking its health. **Sample:** 30 |
| **health\_check\_type** string | success | The service you want the health status from, one of "EC2" or "ELB". **Sample:** ELB |
| **instances** list / elements=string | success | List of EC2 instances and their status as it relates to the ASG. **Sample:** [{'availability\_zone': 'us-west-2a', 'health\_status': 'Healthy', 'instance\_id': 'i-es22ad25', 'launch\_configuration\_name': 'public-webapp-production-1', 'lifecycle\_state': 'InService', 'protected\_from\_scale\_in': 'false'}] |
| **launch\_config\_name** string | success | Name of launch configuration associated with the ASG. Same as launch\_configuration\_name, provided for compatibility with ec2\_asg module. **Sample:** public-webapp-production-1 |
| **launch\_configuration\_name** string | success | Name of launch configuration associated with the ASG. **Sample:** public-webapp-production-1 |
| **lifecycle\_hooks** list / elements=string | success | List of lifecycle hooks for the ASG. **Sample:** [{'AutoScalingGroupName': 'public-webapp-production-1', 'DefaultResult': 'ABANDON', 'GlobalTimeout': 172800, 'HeartbeatTimeout': 3600, 'LifecycleHookName': 'instance-launch', 'LifecycleTransition': 'autoscaling:EC2\_INSTANCE\_LAUNCHING'}, {'AutoScalingGroupName': 'public-webapp-production-1', 'DefaultResult': 'ABANDON', 'GlobalTimeout': 172800, 'HeartbeatTimeout': 3600, 'LifecycleHookName': 'instance-terminate', 'LifecycleTransition': 'autoscaling:EC2\_INSTANCE\_TERMINATING'}] |
| **load\_balancer\_names** list / elements=string | success | List of load balancers names attached to the ASG. **Sample:** ['elb-webapp-prod'] |
| **max\_size** integer | success | Maximum size of group **Sample:** 3 |
| **min\_size** integer | success | Minimum size of group **Sample:** 1 |
| **new\_instances\_protected\_from\_scale\_in** boolean | success | Whether or not new instances a protected from automatic scaling in. **Sample:** false |
| **placement\_group** string | success | Placement group into which instances are launched, if any. **Sample:** None |
| **status** string | success | The current state of the group when DeleteAutoScalingGroup is in progress. **Sample:** None |
| **tags** list / elements=string | success | List of tags for the ASG, and whether or not each tag propagates to instances at launch. **Sample:** [{'key': 'Name', 'propagate\_at\_launch': 'true', 'resource\_id': 'public-webapp-production-1', 'resource\_type': 'auto-scaling-group', 'value': 'public-webapp-production-1'}, {'key': 'env', 'propagate\_at\_launch': 'true', 'resource\_id': 'public-webapp-production-1', 'resource\_type': 'auto-scaling-group', 'value': 'production'}] |
| **target\_group\_arns** list / elements=string | success | List of ARNs of the target groups that the ASG populates **Sample:** ['arn:aws:elasticloadbalancing:ap-southeast-2:123456789012:targetgroup/target-group-host-hello/1a2b3c4d5e6f1a2b', 'arn:aws:elasticloadbalancing:ap-southeast-2:123456789012:targetgroup/target-group-path-world/abcd1234abcd1234'] |
| **target\_group\_names** list / elements=string | success | List of names of the target groups that the ASG populates **Sample:** ['target-group-host-hello', 'target-group-path-world'] |
| **termination\_policies** string | success | A list of termination policies for the group. **Sample:** ['Default'] |
### Authors
* Rob White (@wimnat)
| programming_docs |
ansible community.aws.redshift_subnet_group – manage Redshift cluster subnet groups community.aws.redshift\_subnet\_group – manage Redshift cluster subnet groups
=============================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.redshift_subnet_group`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, modifies, and deletes Redshift cluster subnet groups.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **group\_description** string | | Database subnet group description.
aliases: description |
| **group\_name** string / required | | Cluster subnet group name.
aliases: name |
| **group\_subnets** list / elements=string | | List of subnet IDs that make up the cluster subnet group.
aliases: subnets |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string / required | **Choices:*** present
* absent
| Specifies whether the subnet should be present or absent. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- name: Create a Redshift subnet group
community.aws.redshift_subnet_group:
state: present
group_name: redshift-subnet
group_description: Redshift subnet
group_subnets:
- 'subnet-aaaaa'
- 'subnet-bbbbb'
- name: Remove subnet group
community.aws.redshift_subnet_group:
state: absent
group_name: redshift-subnet
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **group** complex | success | dictionary containing all Redshift subnet group information |
| | **name** string | success | name of the Redshift subnet group **Sample:** redshift\_subnet\_group\_name |
| | **vpc\_id** string | success | Id of the VPC where the subnet is located **Sample:** vpc-aabb1122 |
### Authors
* Jens Carl (@j-carl), Hothead Games Inc.
ansible community.aws.aws_step_functions_state_machine – Manage AWS Step Functions state machines community.aws.aws\_step\_functions\_state\_machine – Manage AWS Step Functions state machines
=============================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.aws_step_functions_state_machine`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, update and delete state machines in AWS Step Functions.
* Calling the module in `state=present` for an existing AWS Step Functions state machine will attempt to update the state machine definition, IAM Role, or tags with the provided data.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* boto
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **definition** json | | The Amazon States Language definition of the state machine. See <https://docs.aws.amazon.com/step-functions/latest/dg/concepts-amazon-states-language.html> for more information on the Amazon States Language. This parameter is required when `state=present`. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **name** string / required | | Name of the state machine |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **purge\_tags** boolean | **Choices:*** no
* **yes** ←
| If yes, existing tags will be purged from the resource to match exactly what is defined by *tags* parameter. If the *tags* parameter is not set then tags will not be modified. |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **role\_arn** string | | The ARN of the IAM Role that will be used by the state machine for its executions. This parameter is required when `state=present`. |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** **present** ←
* absent
| Desired state for the state machine |
| **tags** dictionary | | A hash/dictionary of tags to add to the new state machine or to add/remove from an existing one. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Create a new AWS Step Functions state machine
- name: Setup HelloWorld state machine
community.aws.aws_step_functions_state_machine:
name: "HelloWorldStateMachine"
definition: "{{ lookup('file','state_machine.json') }}"
role_arn: arn:aws:iam::987654321012:role/service-role/invokeLambdaStepFunctionsRole
tags:
project: helloWorld
# Update an existing state machine
- name: Change IAM Role and tags of HelloWorld state machine
community.aws.aws_step_functions_state_machine:
name: HelloWorldStateMachine
definition: "{{ lookup('file','state_machine.json') }}"
role_arn: arn:aws:iam::987654321012:role/service-role/anotherStepFunctionsRole
tags:
otherTag: aDifferentTag
# Remove the AWS Step Functions state machine
- name: Delete HelloWorld state machine
community.aws.aws_step_functions_state_machine:
name: HelloWorldStateMachine
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **state\_machine\_arn** string | always | ARN of the AWS Step Functions state machine |
### Authors
* Tom De Keyser (@tdekeyser)
ansible community.aws.ec2_placement_group_info – List EC2 Placement Group(s) details community.aws.ec2\_placement\_group\_info – List EC2 Placement Group(s) details
===============================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.ec2_placement_group_info`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* List details of EC2 Placement Group(s).
* This module was called `ec2_placement_group_facts` before Ansible 2.9. The usage did not change.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* boto
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **names** list / elements=string | **Default:**[] | A list of names to filter on. If a listed group does not exist, there will be no corresponding entry in the result; no error will be raised. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details or the AWS region,
# see the AWS Guide for details.
- name: List all placement groups.
community.aws.ec2_placement_group_info:
register: all_ec2_placement_groups
- name: List two placement groups.
community.aws.ec2_placement_group_info:
names:
- my-cluster
- my-other-cluster
register: specific_ec2_placement_groups
- ansible.builtin.debug:
msg: "{{ specific_ec2_placement_groups | json_query(\"[?name=='my-cluster']\") }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **placement\_groups** complex | always | Placement group attributes |
| | **name** string | success | PG name **Sample:** my-cluster |
| | **state** string | success | PG state **Sample:** available |
| | **strategy** string | success | PG strategy **Sample:** cluster |
### Authors
* Brad Macpherson (@iiibrad)
| programming_docs |
ansible community.aws.lambda_event – Creates, updates or deletes AWS Lambda function event mappings community.aws.lambda\_event – Creates, updates or deletes AWS Lambda function event mappings
============================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.lambda_event`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module allows the management of AWS Lambda function event source mappings such as DynamoDB and Kinesis stream events via the Ansible framework. These event source mappings are relevant only in the AWS Lambda pull model, where AWS Lambda invokes the function. It is idempotent and supports “Check” mode. Use module [community.aws.lambda](lambda_module#ansible-collections-community-aws-lambda-module) to manage the lambda function itself and [community.aws.lambda\_alias](lambda_alias_module#ansible-collections-community-aws-lambda-alias-module) to manage function aliases.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **alias** string | | Name of the function alias. Mutually exclusive with *version*. |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **event\_source** string | **Choices:*** **stream** ←
* sqs
| Source of the event that triggers the lambda function. For DynamoDB and Kinesis events, select `stream`
For SQS queues, select `sqs`
|
| **lambda\_function\_arn** string / required | | The name or ARN of the lambda function.
aliases: function\_name, function\_arn |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **source\_params** dictionary / required | | Sub-parameters required for event source. |
| | **batch\_size** integer | **Default:**100 | The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function. |
| | **enabled** boolean | **Choices:*** no
* yes
**Default:**"true." | Indicates whether AWS Lambda should begin polling or readin from the event source. |
| | **source\_arn** string / required | | The Amazon Resource Name (ARN) of the SQS queue, Kinesis stream or DynamoDB stream that is the event source. |
| | **starting\_position** string | **Choices:*** TRIM\_HORIZON
* LATEST
| The position in the stream where AWS Lambda should start reading. Required when *event\_source=stream*. |
| **state** string | **Choices:*** **present** ←
* absent
| Describes the desired state. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
| **version** integer | | Version of the Lambda function. Mutually exclusive with *alias*. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Example that creates a lambda event notification for a DynamoDB stream
- name: DynamoDB stream event mapping
community.aws.lambda_event:
state: present
event_source: stream
function_name: "{{ function_name }}"
alias: Dev
source_params:
source_arn: arn:aws:dynamodb:us-east-1:123456789012:table/tableName/stream/2016-03-19T19:51:37.457
enabled: True
batch_size: 100
starting_position: TRIM_HORIZON
register: event
- name: Show source event
ansible.builtin.debug:
var: event.lambda_stream_events
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **lambda\_stream\_events** list / elements=string | success | list of dictionaries returned by the API describing stream event mappings |
### Authors
* Pierre Jodouin (@pjodouin), Ryan Brown (@ryansb)
ansible community.aws.aws_acm_info – Retrieve certificate information from AWS Certificate Manager service community.aws.aws\_acm\_info – Retrieve certificate information from AWS Certificate Manager service
====================================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.aws_acm_info`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Retrieve information for ACM certificates
* This module was called `aws_acm_facts` before Ansible 2.9. The usage did not change.
* Note that this will not return information about uploaded keys of size 4096 bits, due to a limitation of the ACM API.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **certificate\_arn** string | | If provided, the results will be filtered to show only the certificate with this ARN. If no certificate with this ARN exists, this task will fail. If a certificate with this ARN exists in a different region, this task will fail
aliases: arn |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **domain\_name** string | | The domain name of an ACM certificate to limit the search to
aliases: name |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **statuses** list / elements=string | **Choices:*** PENDING\_VALIDATION
* ISSUED
* INACTIVE
* EXPIRED
* VALIDATION\_TIMED\_OUT
* REVOKED
* FAILED
| Status to filter the certificate results |
| **tags** dictionary | | Filter results to show only certificates with tags that match all the tags specified here. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- name: obtain all ACM certificates
community.aws.aws_acm_info:
- name: obtain all information for a single ACM certificate
community.aws.aws_acm_info:
domain_name: "*.example_com"
- name: obtain all certificates pending validation
community.aws.aws_acm_info:
statuses:
- PENDING_VALIDATION
- name: obtain all certificates with tag Name=foo and myTag=bar
community.aws.aws_acm_info:
tags:
Name: foo
myTag: bar
# The output is still a list of certificates, just one item long.
- name: obtain information about a certificate with a particular ARN
community.aws.aws_acm_info:
certificate_arn: "arn:aws:acm:ap-southeast-2:123456789876:certificate/abcdeabc-abcd-1234-4321-abcdeabcde12"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **certificates** complex | always | A list of certificates |
| | **certificate** string | when certificate creation is complete | The ACM Certificate body **Sample:** -----BEGIN CERTIFICATE-----\\nMII.....-----END CERTIFICATE-----\\n |
| | **certificate\_arn** string | always | Certificate ARN **Sample:** arn:aws:acm:ap-southeast-2:123456789012:certificate/abcd1234-abcd-1234-abcd-123456789abc |
| | **certificate\_chain** string | when certificate creation is complete | Full certificate chain for the certificate **Sample:** -----BEGIN CERTIFICATE-----\\nMII...\\n-----END CERTIFICATE-----\\n-----BEGIN CERTIFICATE-----\\n... |
| | **created\_at** string | always | Date certificate was created **Sample:** 2017-08-15T10:31:19+10:00 |
| | **domain\_name** string | always | Domain name for the certificate **Sample:** \*.example.com |
| | **domain\_validation\_options** complex | when certificate type is AMAZON\_ISSUED | Options used by ACM to validate the certificate |
| | | **domain\_name** string | always | Fully qualified domain name of the certificate **Sample:** example.com |
| | | **validation\_domain** string | always | The domain name ACM used to send validation emails **Sample:** example.com |
| | | **validation\_emails** list / elements=string | always | A list of email addresses that ACM used to send domain validation emails **Sample:** ['[email protected]', '[email protected]'] |
| | | **validation\_status** string | always | Validation status of the domain **Sample:** SUCCESS |
| | **failure\_reason** string | only when certificate issuing failed | Reason certificate request failed **Sample:** NO\_AVAILABLE\_CONTACTS |
| | **in\_use\_by** list / elements=string | always | A list of ARNs for the AWS resources that are using the certificate. |
| | **issued\_at** string | always | Date certificate was issued **Sample:** 2017-01-01T00:00:00+10:00 |
| | **issuer** string | always | Issuer of the certificate **Sample:** Amazon |
| | **key\_algorithm** string | always | Algorithm used to generate the certificate **Sample:** RSA-2048 |
| | **not\_after** string | always | Date after which the certificate is not valid **Sample:** 2019-01-01T00:00:00+10:00 |
| | **not\_before** string | always | Date before which the certificate is not valid **Sample:** 2017-01-01T00:00:00+10:00 |
| | **renewal\_summary** complex | when certificate is issued by Amazon and a renewal has been started | Information about managed renewal process |
| | | **domain\_validation\_options** complex | when certificate type is AMAZON\_ISSUED | Options used by ACM to validate the certificate |
| | | | **domain\_name** string | always | Fully qualified domain name of the certificate **Sample:** example.com |
| | | | **validation\_domain** string | always | The domain name ACM used to send validation emails **Sample:** example.com |
| | | | **validation\_emails** list / elements=string | always | A list of email addresses that ACM used to send domain validation emails **Sample:** ['[email protected]', '[email protected]'] |
| | | | **validation\_status** string | always | Validation status of the domain **Sample:** SUCCESS |
| | | **renewal\_status** string | always | Status of the domain renewal **Sample:** PENDING\_AUTO\_RENEWAL |
| | **revocation\_reason** string | when the certificate has been revoked | Reason for certificate revocation **Sample:** SUPERCEDED |
| | **revoked\_at** string | when the certificate has been revoked | Date certificate was revoked **Sample:** 2017-09-01T10:00:00+10:00 |
| | **serial** string | always | The serial number of the certificate **Sample:** 00:01:02:03:04:05:06:07:08:09:0a:0b:0c:0d:0e:0f |
| | **signature\_algorithm** string | always | Algorithm used to sign the certificate **Sample:** SHA256WITHRSA |
| | **status** string | always | Status of the certificate in ACM **Sample:** ISSUED |
| | **subject** string | always | The name of the entity that is associated with the public key contained in the certificate **Sample:** CN=\*.example.com |
| | **subject\_alternative\_names** list / elements=string | always | Subject Alternative Names for the certificate **Sample:** ['\*.example.com'] |
| | **tags** dictionary | always | Tags associated with the certificate **Sample:** {'Application': 'helloworld', 'Environment': 'test'} |
| | **type** string | always | The source of the certificate **Sample:** AMAZON\_ISSUED |
### Authors
* Will Thames (@willthames)
| programming_docs |
ansible community.aws.ec2_vpc_igw – Manage an AWS VPC Internet gateway community.aws.ec2\_vpc\_igw – Manage an AWS VPC Internet gateway
================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.ec2_vpc_igw`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage an AWS VPC Internet gateway
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **purge\_tags** boolean added in 1.3.0 of community.aws | **Choices:*** no
* **yes** ←
| Remove tags not listed in *tags*. |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** **present** ←
* absent
| Create or terminate the IGW |
| **tags** dictionary | | A dict of tags to apply to the internet gateway. To remove all tags set *tags={}* and *purge\_tags=true*.
aliases: resource\_tags |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
| **vpc\_id** string / required | | The VPC ID for the VPC in which to manage the Internet Gateway. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Ensure that the VPC has an Internet Gateway.
# The Internet Gateway ID is can be accessed via {{igw.gateway_id}} for use in setting up NATs etc.
- name: Create Internet gateway
community.aws.ec2_vpc_igw:
vpc_id: vpc-abcdefgh
state: present
register: igw
- name: Create Internet gateway with tags
community.aws.ec2_vpc_igw:
vpc_id: vpc-abcdefgh
state: present
tags:
Tag1: tag1
Tag2: tag2
register: igw
- name: Delete Internet gateway
community.aws.ec2_vpc_igw:
state: absent
vpc_id: vpc-abcdefgh
register: vpc_igw_delete
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **changed** boolean | always | If any changes have been made to the Internet Gateway. **Sample:** {'changed': False} |
| **gateway\_id** string | *state=present* | The unique identifier for the Internet Gateway. **Sample:** {'gateway\_id': 'igw-XXXXXXXX'} |
| **tags** dictionary | *state=present* | The tags associated the Internet Gateway. **Sample:** {'tags': {'Ansible': 'Test'}} |
| **vpc\_id** string | *state=present* | The VPC ID associated with the Internet Gateway. **Sample:** {'vpc\_id': 'vpc-XXXXXXXX'} |
### Authors
* Robert Estelle (@erydo)
ansible community.aws.redshift_cross_region_snapshots – Manage Redshift Cross Region Snapshots community.aws.redshift\_cross\_region\_snapshots – Manage Redshift Cross Region Snapshots
=========================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.redshift_cross_region_snapshots`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Manage Redshift Cross Region Snapshots. Supports KMS-Encrypted Snapshots.
* For more information, see <https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-snapshots.html#cross-region-snapshot-copy>
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **cluster\_name** string / required | | The name of the cluster to configure cross-region snapshots for.
aliases: cluster |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **destination\_region** string / required | | The region to copy snapshots to.
aliases: destination |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string / required | | The cluster's region.
aliases: source |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **snapshot\_copy\_grant** string | | A grant for Amazon Redshift to use a master key in the *destination\_region*. See <http://boto3.readthedocs.io/en/latest/reference/services/redshift.html#Redshift.Client.create_snapshot_copy_grant>
aliases: copy\_grant |
| **snapshot\_retention\_period** integer / required | | The number of days to keep cross-region snapshots for.
aliases: retention\_period |
| **state** string | **Choices:*** **present** ←
* absent
| Create or remove the cross-region snapshot configuration. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- name: configure cross-region snapshot on cluster `johniscool`
community.aws.redshift_cross_region_snapshots:
cluster_name: johniscool
state: present
region: us-east-1
destination_region: us-west-2
retention_period: 1
- name: configure cross-region snapshot on kms-encrypted cluster
community.aws.redshift_cross_region_snapshots:
cluster_name: whatever
state: present
region: us-east-1
destination: us-west-2
copy_grant: 'my-grant-in-destination'
retention_period: 10
- name: disable cross-region snapshots, necessary before most cluster modifications (rename, resize)
community.aws.redshift_cross_region_snapshots:
cluster_name: whatever
state: absent
region: us-east-1
destination_region: us-west-2
```
### Authors
* JR Kerkstra (@captainkerk)
ansible community.aws.cloudwatchlogs_log_group_metric_filter – Manage CloudWatch log group metric filter community.aws.cloudwatchlogs\_log\_group\_metric\_filter – Manage CloudWatch log group metric filter
====================================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.cloudwatchlogs_log_group_metric_filter`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, modify and delete CloudWatch log group metric filter.
* CloudWatch log group metric filter can be use with [community.aws.ec2\_metric\_alarm](ec2_metric_alarm_module#ansible-collections-community-aws-ec2-metric-alarm-module).
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **filter\_name** string / required | | A name for the metric filter you create. |
| **filter\_pattern** string | | A filter pattern for extracting metric data out of ingested log events. Required when *state=present*. |
| **log\_group\_name** string / required | | The name of the log group where the metric filter is applied on. |
| **metric\_transformation** dictionary | | A collection of information that defines how metric data gets emitted. Required when *state=present*. |
| | **default\_value** float | | The value to emit when a filter pattern does not match a log event. |
| | **metric\_name** string | | The name of the cloudWatch metric. |
| | **metric\_namespace** string | | The namespace of the cloudWatch metric. |
| | **metric\_value** string | | The value to publish to the cloudWatch metric when a filter pattern matches a log event. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string / required | **Choices:*** present
* absent
| Whether the rule is present or absent. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- name: set metric filter on log group /fluentd/testcase
community.aws.cloudwatchlogs_log_group_metric_filter:
log_group_name: /fluentd/testcase
filter_name: BoxFreeStorage
filter_pattern: '{($.value = *) && ($.hostname = "box")}'
state: present
metric_transformation:
metric_name: box_free_space
metric_namespace: fluentd_metrics
metric_value: "$.value"
- name: delete metric filter on log group /fluentd/testcase
community.aws.cloudwatchlogs_log_group_metric_filter:
log_group_name: /fluentd/testcase
filter_name: BoxFreeStorage
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **metric\_filters** list / elements=string | success | Return the origin response value **Sample:** [{'default\_value': 3.1415, 'metric\_name': 'box\_free\_space', 'metric\_namespace': 'made\_with\_ansible', 'metric\_value': '$.value'}] |
### Authors
* Markus Bergholz (@markuman)
| programming_docs |
ansible community.aws.aws_region_info – Gather information about AWS regions. community.aws.aws\_region\_info – Gather information about AWS regions.
=======================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.aws_region_info`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Gather information about AWS regions.
* This module was called `aws_region_facts` before Ansible 2.9. The usage did not change.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **filters** dictionary | **Default:**{} | A dict of filters to apply. Each dict item consists of a filter key and a filter value. See <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeRegions.html> for possible filters. Filter names and values are case sensitive. You can use underscores instead of dashes (-) in the filter keys. Filter keys with underscores will take precedence in case of conflict. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Gather information about all regions
- community.aws.aws_region_info:
# Gather information about a single region
- community.aws.aws_region_info:
filters:
region-name: eu-west-1
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **regions** list / elements=string | on success | Regions that match the provided filters. Each element consists of a dict with all the information related to that region. **Sample:** [{ 'endpoint': 'ec2.us-west-1.amazonaws.com', 'region\_name': 'us-west-1' }] |
### Authors
* Henrique Rodrigues (@Sodki)
ansible community.aws.elb_classic_lb_info – Gather information about EC2 Elastic Load Balancers in AWS community.aws.elb\_classic\_lb\_info – Gather information about EC2 Elastic Load Balancers in AWS
=================================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.elb_classic_lb_info`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Gather information about EC2 Elastic Load Balancers in AWS
* This module was called `elb_classic_lb_facts` before Ansible 2.9. The usage did not change.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **names** list / elements=string | | List of ELB names to gather information about. Pass this option to gather information about a set of ELBs, otherwise, all ELBs are returned. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Output format tries to match amazon.aws.ec2_elb_lb module input parameters
# Gather information about all ELBs
- community.aws.elb_classic_lb_info:
register: elb_info
- ansible.builtin.debug:
msg: "{{ item.dns_name }}"
loop: "{{ elb_info.elbs }}"
# Gather information about a particular ELB
- community.aws.elb_classic_lb_info:
names: frontend-prod-elb
register: elb_info
- ansible.builtin.debug:
msg: "{{ elb_info.elbs.0.dns_name }}"
# Gather information about a set of ELBs
- community.aws.elb_classic_lb_info:
names:
- frontend-prod-elb
- backend-prod-elb
register: elb_info
- ansible.builtin.debug:
msg: "{{ item.dns_name }}"
loop: "{{ elb_info.elbs }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **elbs** list / elements=string | always | a list of load balancers **Sample:** {'elbs': [{'attributes': {'access\_log': {'enabled': False}, 'connection\_draining': {'enabled': True, 'timeout': 300}, 'connection\_settings': {'idle\_timeout': 60}, 'cross\_zone\_load\_balancing': {'enabled': True}}, 'availability\_zones': ['us-east-1a', 'us-east-1b', 'us-east-1c', 'us-east-1d', 'us-east-1e'], 'backend\_server\_description': [], 'canonical\_hosted\_zone\_name': 'test-lb-XXXXXXXXXXXX.us-east-1.elb.amazonaws.com', 'canonical\_hosted\_zone\_name\_id': 'XXXXXXXXXXXXXX', 'created\_time': '2017-08-23T18:25:03.280000+00:00', 'dns\_name': 'test-lb-XXXXXXXXXXXX.us-east-1.elb.amazonaws.com', 'health\_check': {'healthy\_threshold': 10, 'interval': 30, 'target': 'HTTP:80/index.html', 'timeout': 5, 'unhealthy\_threshold': 2}, 'instances': [], 'instances\_inservice': [], 'instances\_inservice\_count': 0, 'instances\_outofservice': [], 'instances\_outofservice\_count': 0, 'instances\_unknownservice': [], 'instances\_unknownservice\_count': 0, 'listener\_descriptions': [{'listener': {'instance\_port': 80, 'instance\_protocol': 'HTTP', 'load\_balancer\_port': 80, 'protocol': 'HTTP'}, 'policy\_names': []}], 'load\_balancer\_name': 'test-lb', 'policies': {'app\_cookie\_stickiness\_policies': [], 'lb\_cookie\_stickiness\_policies': [], 'other\_policies': []}, 'scheme': 'internet-facing', 'security\_groups': ['sg-29d13055'], 'source\_security\_group': {'group\_name': 'default', 'owner\_alias': 'XXXXXXXXXXXX'}, 'subnets': ['subnet-XXXXXXXX', 'subnet-XXXXXXXX'], 'tags': {}, 'vpc\_id': 'vpc-c248fda4'}]} |
### Authors
* Michael Schultz (@mjschultz)
* Fernando Jose Pando (@nand0p)
ansible community.aws.data_pipeline – Create and manage AWS Datapipelines community.aws.data\_pipeline – Create and manage AWS Datapipelines
==================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.data_pipeline`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create and manage AWS Datapipelines. Creation is not idempotent in AWS, so the `uniqueId` is created by hashing the options (minus objects) given to the datapipeline.
* The pipeline definition must be in the format given here <https://docs.aws.amazon.com/datapipeline/latest/APIReference/API_PutPipelineDefinition.html#API_PutPipelineDefinition_RequestSyntax>.
* Operations will wait for a configurable amount of time to ensure the pipeline is in the requested state.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **description** string | **Default:**"" | An optional description for the pipeline being created. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **name** string / required | | The name of the Datapipeline to create/modify/delete. |
| **objects** list / elements=dictionary | | A list of pipeline object definitions, each of which is a dict that takes the keys *id*, *name* and *fields*. |
| | **fields** list / elements=dictionary | | Key-value pairs that define the properties of the object. The value is specified as a reference to another object *refValue* or as a string value *stringValue* but not as both. |
| | | **key** string | | The field identifier. |
| | | **refValue** string | | The field value, expressed as the identifier of another object. Exactly one of *stringValue* and *refValue* may be specified. |
| | | **stringValue** string | | The field value. Exactly one of *stringValue* and *refValue* may be specified. |
| | **id** string | | The ID of the object. |
| | **name** string | | The name of the object. |
| **parameters** list / elements=dictionary | | A list of parameter objects (dicts) in the pipeline definition. |
| | **attributes** list / elements=dictionary | | A list of attributes (dicts) of the parameter object. |
| | | **key** string | | The field identifier. |
| | | **stringValue** string | | The field value. |
| | **id** string | | The ID of the parameter object. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** **present** ←
* absent
* active
* inactive
| The requested state of the pipeline. |
| **tags** dictionary | | A dict of key:value pair(s) to add to the pipeline. |
| **timeout** integer | **Default:**300 | Time in seconds to wait for the pipeline to transition to the requested state, fail otherwise. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
| **values** list / elements=dictionary | | A list of parameter values (dicts) in the pipeline definition. |
| | **id** string | | The ID of the parameter value |
| | **stringValue** string | | The field value |
| **version** string | | The version option has never had any effect and will be removed after 2022-06-01. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Create pipeline
- community.aws.data_pipeline:
name: test-dp
region: us-west-2
objects: "{{pipelineObjects}}"
parameters: "{{pipelineParameters}}"
values: "{{pipelineValues}}"
tags:
key1: val1
key2: val2
state: present
# Example populating and activating a pipeline that demonstrates two ways of providing pipeline objects
- community.aws.data_pipeline:
name: test-dp
objects:
- "id": "DefaultSchedule"
"name": "Every 1 day"
"fields":
- "key": "period"
"stringValue": "1 days"
- "key": "type"
"stringValue": "Schedule"
- "key": "startAt"
"stringValue": "FIRST_ACTIVATION_DATE_TIME"
- "id": "Default"
"name": "Default"
"fields": [ { "key": "resourceRole", "stringValue": "my_resource_role" },
{ "key": "role", "stringValue": "DataPipelineDefaultRole" },
{ "key": "pipelineLogUri", "stringValue": "s3://my_s3_log.txt" },
{ "key": "scheduleType", "stringValue": "cron" },
{ "key": "schedule", "refValue": "DefaultSchedule" },
{ "key": "failureAndRerunMode", "stringValue": "CASCADE" } ]
state: active
# Activate pipeline
- community.aws.data_pipeline:
name: test-dp
region: us-west-2
state: active
# Delete pipeline
- community.aws.data_pipeline:
name: test-dp
region: us-west-2
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **changed** boolean | always | whether the data pipeline has been modified **Sample:** {'changed': True} |
| **result** dictionary | always | Contains the data pipeline data (data\_pipeline) and a return message (msg). If the data pipeline exists data\_pipeline will contain the keys description, name, pipeline\_id, state, tags, and unique\_id. If the data pipeline does not exist then data\_pipeline will be an empty dict. The msg describes the status of the operation. |
### Authors
* Raghu Udiyar (@raags) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#bbc9dadcd3cec8d2dfdfdac9cfd39d98888c809d988e89809d988f8380dcd6dad2d79d988f8d80d8d4d6)>
* Sloane Hertel (@s-hertel) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#c4b7aca1b6b0a1a8e2e7f7f3ffe2e7f1f6ffe2e7f0fcffb6a1a0aca5b0e2e7f0f2ffa7aba9)>
| programming_docs |
ansible community.aws.aws_application_scaling_policy – Manage Application Auto Scaling Scaling Policies community.aws.aws\_application\_scaling\_policy – Manage Application Auto Scaling Scaling Policies
==================================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.aws_application_scaling_policy`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Creates, updates or removes a Scaling Policy.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* json
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **maximum\_tasks** integer | | The maximum value to scale to in response to a scale out event. This parameter is required if you are creating a first new policy for the specified service. |
| **minimum\_tasks** integer | | The minimum value to scale to in response to a scale in event. This parameter is required if you are creating a first new policy for the specified service. |
| **override\_task\_capacity** boolean | **Choices:*** no
* yes
| Whether or not to override values of minimum and/or maximum tasks if it's already set. Defaults to `false`. |
| **policy\_name** string / required | | The name of the scaling policy. |
| **policy\_type** string / required | **Choices:*** StepScaling
* TargetTrackingScaling
| The policy type. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **resource\_id** string / required | | The identifier of the resource associated with the scalable target. |
| **scalable\_dimension** string / required | **Choices:*** ecs:service:DesiredCount
* ec2:spot-fleet-request:TargetCapacity
* elasticmapreduce:instancegroup:InstanceCount
* appstream:fleet:DesiredCapacity
* dynamodb:table:ReadCapacityUnits
* dynamodb:table:WriteCapacityUnits
* dynamodb:index:ReadCapacityUnits
* dynamodb:index:WriteCapacityUnits
| The scalable dimension associated with the scalable target. |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **service\_namespace** string / required | **Choices:*** ecs
* elasticmapreduce
* ec2
* appstream
* dynamodb
| The namespace of the AWS service. |
| **state** string / required | **Choices:*** absent
* present
| Whether a policy should be `present` or `absent`. |
| **step\_scaling\_policy\_configuration** dictionary | | A step scaling policy. This parameter is required if you are creating a policy and *policy\_type=StepScaling*. |
| **target\_tracking\_scaling\_policy\_configuration** dictionary | | A target tracking policy. This parameter is required if you are creating a new policy and *policy\_type=TargetTrackingScaling*. Full documentation of the suboptions can be found in the API documentation: <https://docs.aws.amazon.com/autoscaling/application/APIReference/API_TargetTrackingScalingPolicyConfiguration.html> |
| | **CustomizedMetricSpecification** dictionary | | The metric to use if using a customized metric. |
| | **DisableScaleIn** boolean | **Choices:*** no
* yes
| Whether scaling-in should be disabled. |
| | **PredefinedMetricSpecification** dictionary | | The metric to use if using a predefined metric. |
| | **ScaleInCooldown** integer | | The time (in seconds) to wait after scaling-in before another scaling action can occur. |
| | **ScaleOutCooldown** integer | | The time (in seconds) to wait after scaling-out before another scaling action can occur. |
| | **TargetValue** float | | The target value for the metric. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* for details of the parameters and returns see <http://boto3.readthedocs.io/en/latest/reference/services/application-autoscaling.html#ApplicationAutoScaling.Client.put_scaling_policy>
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Create step scaling policy for ECS Service
- name: scaling_policy
community.aws.aws_application_scaling_policy:
state: present
policy_name: test_policy
service_namespace: ecs
resource_id: service/poc-pricing/test-as
scalable_dimension: ecs:service:DesiredCount
policy_type: StepScaling
minimum_tasks: 1
maximum_tasks: 6
step_scaling_policy_configuration:
AdjustmentType: ChangeInCapacity
StepAdjustments:
- MetricIntervalUpperBound: 123
ScalingAdjustment: 2
- MetricIntervalLowerBound: 123
ScalingAdjustment: -2
Cooldown: 123
MetricAggregationType: Average
# Create target tracking scaling policy for ECS Service
- name: scaling_policy
community.aws.aws_application_scaling_policy:
state: present
policy_name: test_policy
service_namespace: ecs
resource_id: service/poc-pricing/test-as
scalable_dimension: ecs:service:DesiredCount
policy_type: TargetTrackingScaling
minimum_tasks: 1
maximum_tasks: 6
target_tracking_scaling_policy_configuration:
TargetValue: 60
PredefinedMetricSpecification:
PredefinedMetricType: ECSServiceAverageCPUUtilization
ScaleOutCooldown: 60
ScaleInCooldown: 60
# Remove scalable target for ECS Service
- name: scaling_policy
community.aws.aws_application_scaling_policy:
state: absent
policy_name: test_policy
policy_type: StepScaling
service_namespace: ecs
resource_id: service/cluster-name/service-name
scalable_dimension: ecs:service:DesiredCount
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **alarms** complex | when state present | List of the CloudWatch alarms associated with the scaling policy |
| | **alarm\_arn** string | when state present | The Amazon Resource Name (ARN) of the alarm |
| | **alarm\_name** string | when state present | The name of the alarm |
| **creation\_time** string | when state present | The Unix timestamp for when the scalable target was created. **Sample:** 2017-09-28T08:22:51.881000-03:00 |
| **max\_capacity** integer | when state present | The maximum value to scale to in response to a scale out event. Required if *state* is `present`. **Sample:** 2 |
| **min\_capacity** integer | when state present | The minimum value to scale to in response to a scale in event. Required if *state* is `present`. **Sample:** 1 |
| **policy\_arn** string | when state present | The Amazon Resource Name (ARN) of the scaling policy.. |
| **policy\_name** string | when state present | The name of the scaling policy. |
| **policy\_type** string | when state present | The policy type. |
| **resource\_id** string | when state present | The identifier of the resource associated with the scalable target. **Sample:** service/cluster-name/service-name |
| **role\_arn** string | when state present | The ARN of an IAM role that allows Application Auto Scaling to modify the scalable target on your behalf. Required if *state* is `present`. **Sample:** arn:aws:iam::123456789123:role/roleName |
| **scalable\_dimension** string | when state present | The scalable dimension associated with the scalable target. **Sample:** ecs:service:DesiredCount |
| **service\_namespace** string | when state present | The namespace of the AWS service. **Sample:** ecs |
| **step\_scaling\_policy\_configuration** complex | when state present and the policy type is StepScaling | The step scaling policy. |
| | **adjustment\_type** string | when state present and the policy type is StepScaling | The adjustment type **Sample:** ChangeInCapacity, PercentChangeInCapacity, ExactCapacity |
| | **cooldown** integer | when state present and the policy type is StepScaling | The amount of time, in seconds, after a scaling activity completes where previous trigger-related scaling activities can influence future scaling events **Sample:** 60 |
| | **metric\_aggregation\_type** string | when state present and the policy type is StepScaling | The aggregation type for the CloudWatch metrics **Sample:** Average, Minimum, Maximum |
| | **step\_adjustments** list / elements=dictionary | when state present and the policy type is StepScaling | A set of adjustments that enable you to scale based on the size of the alarm breach |
| **target\_tracking\_scaling\_policy\_configuration** complex | when state present and the policy type is TargetTrackingScaling | The target tracking policy. |
| | **predefined\_metric\_specification** complex | when state present and the policy type is TargetTrackingScaling | A predefined metric |
| | | **predefined\_metric\_type** string | when state present and the policy type is TargetTrackingScaling | The metric type **Sample:** ECSServiceAverageCPUUtilization, ECSServiceAverageMemoryUtilization |
| | | **resource\_label** string | when metric type is ALBRequestCountPerTarget | Identifies the resource associated with the metric type |
| | **scale\_in\_cooldown** integer | when state present and the policy type is TargetTrackingScaling | The amount of time, in seconds, after a scale in activity completes before another scale in activity can start **Sample:** 60 |
| | **scale\_out\_cooldown** integer | when state present and the policy type is TargetTrackingScaling | The amount of time, in seconds, after a scale out activity completes before another scale out activity can start **Sample:** 60 |
| | **target\_value** integer | when state present and the policy type is TargetTrackingScaling | The target value for the metric **Sample:** 70 |
### Authors
* Gustavo Maia (@gurumaia)
* Chen Leibovich (@chenl87)
ansible community.aws.ec2_vpc_egress_igw – Manage an AWS VPC Egress Only Internet gateway community.aws.ec2\_vpc\_egress\_igw – Manage an AWS VPC Egress Only Internet gateway
====================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.ec2_vpc_egress_igw`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage an AWS VPC Egress Only Internet gateway
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* boto
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** **present** ←
* absent
| Create or delete the EIGW. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
| **vpc\_id** string / required | | The VPC ID for the VPC that this Egress Only Internet Gateway should be attached. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Ensure that the VPC has an Internet Gateway.
# The Internet Gateway ID is can be accessed via {{eigw.gateway_id}} for use in setting up NATs etc.
- community.aws.ec2_vpc_egress_igw:
vpc_id: vpc-abcdefgh
state: present
register: eigw
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **gateway\_id** string | always | The ID of the Egress Only Internet Gateway or Null. **Sample:** eigw-0e00cf111ba5bc11e |
| **vpc\_id** string | always | The ID of the VPC to attach or detach gateway from. **Sample:** vpc-012345678 |
### Authors
* Daniel Shepherd (@shepdelacreme)
| programming_docs |
ansible community.aws.ec2_eip – manages EC2 elastic IP (EIP) addresses. community.aws.ec2\_eip – manages EC2 elastic IP (EIP) addresses.
================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.ec2_eip`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can allocate or release an EIP.
* This module can associate/disassociate an EIP with instances or network interfaces.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* boto
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **allow\_reassociation** boolean | **Choices:*** **no** ←
* yes
| Specify this option to allow an Elastic IP address that is already associated with another network interface or instance to be re-associated with the specified instance or interface. |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **device\_id** string | | The id of the device for the EIP. Can be an EC2 Instance id or Elastic Network Interface (ENI) id. The *instance\_id* alias has been deprecated and will be removed after 2022-12-01.
aliases: instance\_id |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **in\_vpc** boolean | **Choices:*** **no** ←
* yes
| Allocate an EIP inside a VPC or not. Required if specifying an ENI with *device\_id*. |
| **private\_ip\_address** string | | The primary or secondary private IP address to associate with the Elastic IP address. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **public\_ip** string | | The IP address of a previously allocated EIP. When *public\_ip=present* and device is specified, the EIP is associated with the device. When *public\_ip=absent* and device is specified, the EIP is disassociated from the device.
aliases: ip |
| **public\_ipv4\_pool** string | | Allocates the new Elastic IP from the provided public IPv4 pool (BYOIP) only applies to newly allocated Elastic IPs, isn't validated when *reuse\_existing\_ip\_allowed=true*. |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **release\_on\_disassociation** boolean | **Choices:*** **no** ←
* yes
| Whether or not to automatically release the EIP when it is disassociated. |
| **reuse\_existing\_ip\_allowed** boolean | **Choices:*** **no** ←
* yes
| Reuse an EIP that is not associated to a device (when available), instead of allocating a new one. |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** **present** ←
* absent
| When `state=present`, allocate an EIP or associate an existing EIP with a device. When `state=absent`, disassociate the EIP from the device and optionally release it. |
| **tag\_name** string | | When *reuse\_existing\_ip\_allowed=true*, supplement with this option to only reuse an Elastic IP if it is tagged with *tag\_name*. |
| **tag\_value** string | | Supplements *tag\_name* but also checks that the value of the tag provided in *tag\_name* matches *tag\_value*. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
| **wait\_timeout** integer | | The *wait\_timeout* option does nothing and will be removed after 2022-06-01 |
Notes
-----
Note
* There may be a delay between the time the EIP is assigned and when the cloud instance is reachable via the new address. Use wait\_for and pause to delay further playbook execution until the instance is reachable, if necessary.
* This module returns multiple changed statuses on disassociation or release. It returns an overall status based on any changes occurring. It also returns individual changed statuses for disassociation and release.
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
- name: associate an elastic IP with an instance
community.aws.ec2_eip:
device_id: i-1212f003
ip: 93.184.216.119
- name: associate an elastic IP with a device
community.aws.ec2_eip:
device_id: eni-c8ad70f3
ip: 93.184.216.119
- name: associate an elastic IP with a device and allow reassociation
community.aws.ec2_eip:
device_id: eni-c8ad70f3
public_ip: 93.184.216.119
allow_reassociation: true
- name: disassociate an elastic IP from an instance
community.aws.ec2_eip:
device_id: i-1212f003
ip: 93.184.216.119
state: absent
- name: disassociate an elastic IP with a device
community.aws.ec2_eip:
device_id: eni-c8ad70f3
ip: 93.184.216.119
state: absent
- name: allocate a new elastic IP and associate it with an instance
community.aws.ec2_eip:
device_id: i-1212f003
- name: allocate a new elastic IP without associating it to anything
community.aws.ec2_eip:
state: present
register: eip
- name: output the IP
ansible.builtin.debug:
msg: "Allocated IP is {{ eip.public_ip }}"
- name: provision new instances with ec2
amazon.aws.ec2:
keypair: mykey
instance_type: c1.medium
image: ami-40603AD1
wait: true
group: webserver
count: 3
register: ec2
- name: associate new elastic IPs with each of the instances
community.aws.ec2_eip:
device_id: "{{ item }}"
loop: "{{ ec2.instance_ids }}"
- name: allocate a new elastic IP inside a VPC in us-west-2
community.aws.ec2_eip:
region: us-west-2
in_vpc: true
register: eip
- name: output the IP
ansible.builtin.debug:
msg: "Allocated IP inside a VPC is {{ eip.public_ip }}"
- name: allocate eip - reuse unallocated ips (if found) with FREE tag
community.aws.ec2_eip:
region: us-east-1
in_vpc: true
reuse_existing_ip_allowed: true
tag_name: FREE
- name: allocate eip - reuse unallocated ips if tag reserved is nope
community.aws.ec2_eip:
region: us-east-1
in_vpc: true
reuse_existing_ip_allowed: true
tag_name: reserved
tag_value: nope
- name: allocate new eip - from servers given ipv4 pool
community.aws.ec2_eip:
region: us-east-1
in_vpc: true
public_ipv4_pool: ipv4pool-ec2-0588c9b75a25d1a02
- name: allocate eip - from a given pool (if no free addresses where dev-servers tag is dynamic)
community.aws.ec2_eip:
region: us-east-1
in_vpc: true
reuse_existing_ip_allowed: true
tag_name: dev-servers
public_ipv4_pool: ipv4pool-ec2-0588c9b75a25d1a02
- name: allocate eip from pool - check if tag reserved_for exists and value is our hostname
community.aws.ec2_eip:
region: us-east-1
in_vpc: true
reuse_existing_ip_allowed: true
tag_name: reserved_for
tag_value: "{{ inventory_hostname }}"
public_ipv4_pool: ipv4pool-ec2-0588c9b75a25d1a02
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **allocation\_id** string | on success | allocation\_id of the elastic ip **Sample:** eipalloc-51aa3a6c |
| **public\_ip** string | on success | an elastic ip address **Sample:** 52.88.159.209 |
### Authors
* Rick Mendes (@rickmendes) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#3a48575f545e5f491c19090d011c190f08011c190e02015356564f5753545b1c190e0c01595557)>
ansible community.aws.iam_server_certificate_info – Retrieve the information of a server certificate community.aws.iam\_server\_certificate\_info – Retrieve the information of a server certificate
===============================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.iam_server_certificate_info`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Retrieve the attributes of a server certificate.
* This module was called `iam_server_certificate_facts` before Ansible 2.9. The usage did not change.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **name** string | | The name of the server certificate you are retrieving attributes for. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- name: Retrieve server certificate
community.aws.iam_server_certificate_info:
name: production-cert
register: server_cert
- name: Fail if the server certificate name was not found
community.aws.iam_server_certificate_info:
name: production-cert
register: server_cert
failed_when: "{{ server_cert.results | length == 0 }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **arn** string | success | The Amazon resource name of the server certificate **Sample:** arn:aws:iam::911277865346:server-certificate/server-cert-name |
| **certificate\_body** string | success | The asn1der encoded PEM string **Sample:** -----BEGIN CERTIFICATE----- bunch of random data -----END CERTIFICATE----- |
| **expiration** string | success | The date and time this server certificate will expire, in ISO 8601 format. **Sample:** 2017-06-15T12:00:00+00:00 |
| **path** string | success | The path of the server certificate **Sample:** / |
| **server\_certificate\_id** string | success | The 21 character certificate id **Sample:** ADWAJXWTZAXIPIMQHMJPO |
| **server\_certificate\_name** string | success | The name of the server certificate **Sample:** server-cert-name |
| **upload\_date** string | success | The date and time this server certificate was uploaded, in ISO 8601 format. **Sample:** 2015-04-25T00:36:40+00:00 |
### Authors
* Allen Sanabria (@linuxdynasty)
ansible community.aws.rds_instance – Manage RDS instances community.aws.rds\_instance – Manage RDS instances
==================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.rds_instance`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, modify, and delete RDS instances.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3 >= 1.5.0
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **allocated\_storage** integer | | The amount of storage (in gibibytes) to allocate for the DB instance. |
| **allow\_major\_version\_upgrade** boolean | **Choices:*** no
* yes
| Whether to allow major version upgrades. |
| **apply\_immediately** boolean | **Choices:*** **no** ←
* yes
| A value that specifies whether modifying a cluster with *new\_db\_instance\_identifier* and *master\_user\_password* should be applied as soon as possible, regardless of the *preferred\_maintenance\_window* setting. If false, changes are applied during the next maintenance window. |
| **auto\_minor\_version\_upgrade** boolean | **Choices:*** no
* yes
| Whether minor version upgrades are applied automatically to the DB instance during the maintenance window. |
| **availability\_zone** string | | A list of EC2 Availability Zones that instances in the DB cluster can be created in. May be used when creating a cluster or when restoring from S3 or a snapshot. Mutually exclusive with *multi\_az*.
aliases: az, zone |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **backup\_retention\_period** integer | | The number of days for which automated backups are retained. When set to `0`, automated backups will be disabled. (Not applicable if the DB instance is a source to read replicas) May be used when creating a new cluster, when restoring from S3, or when modifying a cluster. |
| **ca\_certificate\_identifier** string | | The identifier of the CA certificate for the DB instance. |
| **character\_set\_name** string | | The character set to associate with the DB cluster. |
| **copy\_tags\_to\_snapshot** boolean | **Choices:*** no
* yes
| Whether or not to copy all tags from the DB instance to snapshots of the instance. When initially creating a DB instance the RDS API defaults this to false if unspecified. |
| **creation\_source** string | **Choices:*** snapshot
* s3
* instance
| Which source to use if restoring from a template (an existing instance, S3 bucket, or snapshot). |
| **db\_cluster\_identifier** string | | The DB cluster (lowercase) identifier to add the aurora DB instance to. The identifier must contain from 1 to 63 letters, numbers, or hyphens and the first character must be a letter and may not end in a hyphen or contain consecutive hyphens.
aliases: cluster\_id |
| **db\_instance\_class** string | | The compute and memory capacity of the DB instance, for example db.t2.micro.
aliases: class, instance\_type |
| **db\_instance\_identifier** string / required | | The DB instance (lowercase) identifier. The identifier must contain from 1 to 63 letters, numbers, or hyphens and the first character must be a letter and may not end in a hyphen or contain consecutive hyphens.
aliases: instance\_id, id |
| **db\_name** string | | The name for your database. If a name is not provided Amazon RDS will not create a database. |
| **db\_parameter\_group\_name** string | | The name of the DB parameter group to associate with this DB instance. When creating the DB instance if this argument is omitted the default DBParameterGroup for the specified engine is used. |
| **db\_security\_groups** list / elements=string | | (EC2-Classic platform) A list of DB security groups to associate with this DB instance. |
| **db\_snapshot\_identifier** string | | The identifier for the DB snapshot to restore from if using *creation\_source=snapshot*. |
| **db\_subnet\_group\_name** string | | The DB subnet group name to use for the DB instance.
aliases: subnet\_group |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **domain** string | | The Active Directory Domain to restore the instance in. |
| **domain\_iam\_role\_name** string | | The name of the IAM role to be used when making API calls to the Directory Service. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **enable\_cloudwatch\_logs\_exports** list / elements=string | | A list of log types that need to be enabled for exporting to CloudWatch Logs.
aliases: cloudwatch\_log\_exports |
| **enable\_iam\_database\_authentication** boolean | **Choices:*** no
* yes
| Enable mapping of AWS Identity and Access Management (IAM) accounts to database accounts. If this option is omitted when creating the cluster, Amazon RDS sets this to False. |
| **enable\_performance\_insights** boolean | **Choices:*** no
* yes
| Whether to enable Performance Insights for the DB instance. |
| **engine** string | | The name of the database engine to be used for this DB instance. This is required to create an instance. Valid choices are aurora | aurora-mysql | aurora-postgresql | mariadb | mysql | oracle-ee | oracle-se | oracle-se1 | oracle-se2 | postgres | sqlserver-ee | sqlserver-ex | sqlserver-se | sqlserver-web |
| **engine\_version** string | | The version number of the database engine to use. For Aurora MySQL that could be 5.6.10a , 5.7.12. Aurora PostgreSQL example, 9.6.3 |
| **final\_db\_snapshot\_identifier** string | | The DB instance snapshot identifier of the new DB instance snapshot created when *skip\_final\_snapshot* is false.
aliases: final\_snapshot\_identifier |
| **force\_failover** boolean | **Choices:*** no
* yes
| Set to true to conduct the reboot through a MultiAZ failover. |
| **force\_update\_password** boolean | **Choices:*** **no** ←
* yes
| Set to True to update your cluster password with *master\_user\_password*. Since comparing passwords to determine if it needs to be updated is not possible this is set to False by default to allow idempotence. |
| **iops** integer | | The Provisioned IOPS (I/O operations per second) value. Is only set when using *storage\_type* is set to io1. |
| **kms\_key\_id** string | | The ARN of the AWS KMS key identifier for an encrypted DB instance. If you are creating a DB instance with the same AWS account that owns the KMS encryption key used to encrypt the new DB instance, then you can use the KMS key alias instead of the ARN for the KM encryption key. If *storage\_encrypted* is true and and this option is not provided, the default encryption key is used. |
| **license\_model** string | | The license model for the DB instance. Several options are license-included, bring-your-own-license, and general-public-license. This option can also be omitted to default to an accepted value. |
| **master\_user\_password** string | | An 8-41 character password for the master database user. The password can contain any printable ASCII character except "/", """, or "@". To modify the password use *force\_password\_update*. Use *apply immediately* to change the password immediately, otherwise it is updated during the next maintenance window.
aliases: password |
| **master\_username** string | | The name of the master user for the DB cluster. Must be 1-16 letters or numbers and begin with a letter.
aliases: username |
| **max\_allocated\_storage** integer | | The upper limit to which Amazon RDS can automatically scale the storage of the DB instance. |
| **monitoring\_interval** integer | | The interval, in seconds, when Enhanced Monitoring metrics are collected for the DB instance. To disable collecting metrics, specify 0. Amazon RDS defaults this to 0 if omitted when initially creating a DB instance. |
| **monitoring\_role\_arn** string | | The ARN for the IAM role that permits RDS to send enhanced monitoring metrics to Amazon CloudWatch Logs. |
| **multi\_az** boolean | **Choices:*** no
* yes
| Specifies if the DB instance is a Multi-AZ deployment. Mutually exclusive with *availability\_zone*. |
| **new\_db\_instance\_identifier** string | | The new DB cluster (lowercase) identifier for the DB cluster when renaming a DB instance. The identifier must contain from 1 to 63 letters, numbers, or hyphens and the first character must be a letter and may not end in a hyphen or contain consecutive hyphens. Use *apply\_immediately* to rename immediately, otherwise it is updated during the next maintenance window.
aliases: new\_instance\_id, new\_id |
| **option\_group\_name** string | | The option group to associate with the DB instance. |
| **performance\_insights\_kms\_key\_id** string | | The AWS KMS key identifier (ARN, name, or alias) for encryption of Performance Insights data. |
| **performance\_insights\_retention\_period** integer | | The amount of time, in days, to retain Performance Insights data. Valid values are 7 or 731. |
| **port** integer | | The port number on which the instances accept connections. |
| **preferred\_backup\_window** string | | The daily time range (in UTC) of at least 30 minutes, during which automated backups are created if automated backups are enabled using *backup\_retention\_period*. The option must be in the format of "hh24:mi-hh24:mi" and not conflict with *preferred\_maintenance\_window*.
aliases: backup\_window |
| **preferred\_maintenance\_window** string | | The weekly time range (in UTC) of at least 30 minutes, during which system maintenance can occur. The option must be in the format "ddd:hh24:mi-ddd:hh24:mi" where ddd is one of Mon, Tue, Wed, Thu, Fri, Sat, Sun.
aliases: maintenance\_window |
| **processor\_features** dictionary | | A dictionary of Name, Value pairs to indicate the number of CPU cores and the number of threads per core for the DB instance class of the DB instance. Names are threadsPerCore and coreCount. Set this option to an empty dictionary to use the default processor features. |
| | **coreCount** string | | The number of CPU cores |
| | **threadsPerCore** string | | The number of threads per core |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **promotion\_tier** string | | An integer that specifies the order in which an Aurora Replica is promoted to the primary instance after a failure of the existing primary instance. |
| **publicly\_accessible** boolean | **Choices:*** no
* yes
| Specifies the accessibility options for the DB instance. A value of true specifies an Internet-facing instance with a publicly resolvable DNS name, which resolves to a public IP address. A value of false specifies an internal instance with a DNS name that resolves to a private IP address. |
| **purge\_cloudwatch\_logs\_exports** boolean | **Choices:*** no
* **yes** ←
| Set to False to retain any enabled cloudwatch logs that aren't specified in the task and are associated with the instance. |
| **purge\_security\_groups** boolean added in 1.5.0 of community.aws | **Choices:*** no
* **yes** ←
| Set to False to retain any enabled security groups that aren't specified in the task and are associated with the instance. Can be applied to *vpc\_security\_group\_ids* and *db\_security\_groups*
|
| **purge\_tags** boolean | **Choices:*** no
* **yes** ←
| Set to False to retain any tags that aren't specified in task and are associated with the instance. |
| **read\_replica** boolean | **Choices:*** no
* yes
| Set to False to promote a read replica cluster or true to create one. When creating a read replica `creation_source` should be set to 'instance' or not provided. `source_db_instance_identifier` must be provided with this option. |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **restore\_time** string | | If using *creation\_source=instance* this indicates the UTC date and time to restore from the source instance. For example, "2009-09-07T23:45:00Z". May alternatively set *use\_latest\_restore\_time=True*. Only one of *use\_latest\_restorable\_time* and *restore\_time* may be provided. |
| **s3\_bucket\_name** string | | The name of the Amazon S3 bucket that contains the data used to create the Amazon DB instance. |
| **s3\_ingestion\_role\_arn** string | | The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that authorizes Amazon RDS to access the Amazon S3 bucket on your behalf. |
| **s3\_prefix** string | | The prefix for all of the file names that contain the data used to create the Amazon DB instance. If you do not specify a SourceS3Prefix value, then the Amazon DB instance is created by using all of the files in the Amazon S3 bucket. |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **skip\_final\_snapshot** boolean | **Choices:*** **no** ←
* yes
| Whether a final DB cluster snapshot is created before the DB cluster is deleted. If this is false *final\_db\_snapshot\_identifier* must be provided. |
| **snapshot\_identifier** string | | The ARN of the DB snapshot to restore from when using *creation\_source=snapshot*. |
| **source\_db\_instance\_identifier** string | | The identifier or ARN of the source DB instance from which to restore when creating a read replica or spinning up a point-in-time DB instance using *creation\_source=instance*. If the source DB is not in the same region this should be an ARN. |
| **source\_engine** string | **Choices:*** mysql
| The identifier for the database engine that was backed up to create the files stored in the Amazon S3 bucket. |
| **source\_engine\_version** string | | The version of the database that the backup files were created from. |
| **source\_region** string | | The region of the DB instance from which the replica is created. |
| **state** string | **Choices:*** **present** ←
* absent
* terminated
* running
* started
* stopped
* rebooted
* restarted
| Whether the snapshot should exist or not. *rebooted* is not idempotent and will leave the DB instance in a running state and start it prior to rebooting if it was stopped. *present* will leave the DB instance in the current running/stopped state, (running if creating the DB instance).
*state=running* and *state=started* are synonyms, as are *state=rebooted* and *state=restarted*. Note - rebooting the instance is not idempotent. |
| **storage\_encrypted** boolean | **Choices:*** no
* yes
| Whether the DB instance is encrypted. |
| **storage\_type** string | **Choices:*** standard
* gp2
* io1
| The storage type to be associated with the DB instance. *storage\_type* does not apply to Aurora DB instances. |
| **tags** dictionary | | A dictionary of key value pairs to assign the DB cluster. |
| **tde\_credential\_arn** string | | The ARN from the key store with which to associate the instance for Transparent Data Encryption. This is supported by Oracle or SQL Server DB instances and may be used in conjunction with `storage_encrypted` though it might slightly affect the performance of your database.
aliases: transparent\_data\_encryption\_arn |
| **tde\_credential\_password** string | | The password for the given ARN from the key store in order to access the device.
aliases: transparent\_data\_encryption\_password |
| **timezone** string | | The time zone of the DB instance. |
| **use\_latest\_restorable\_time** boolean | **Choices:*** no
* yes
| Whether to restore the DB instance to the latest restorable backup time. Only one of *use\_latest\_restorable\_time* and *restore\_time* may be provided.
aliases: restore\_from\_latest |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
| **vpc\_security\_group\_ids** list / elements=string | | A list of EC2 VPC security groups to associate with the DB cluster. |
| **wait** boolean | **Choices:*** no
* **yes** ←
| Whether to wait for the cluster to be available, stopped, or deleted. At a later time a wait\_timeout option may be added. Following each API call to create/modify/delete the instance a waiter is used with a 60 second delay 30 times until the instance reaches the expected state (available/stopped/deleted). The total task time may also be influenced by AWSRetry which helps stabilize if the instance is in an invalid state to operate on to begin with (such as if you try to stop it when it is in the process of rebooting). If setting this to False task retries and delays may make your playbook execution better handle timeouts for major modifications. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
- name: create minimal aurora instance in default VPC and default subnet group
community.aws.rds_instance:
engine: aurora
db_instance_identifier: ansible-test-aurora-db-instance
instance_type: db.t2.small
password: "{{ password }}"
username: "{{ username }}"
cluster_id: ansible-test-cluster # This cluster must exist - see rds_cluster to manage it
- name: Create a DB instance using the default AWS KMS encryption key
community.aws.rds_instance:
id: test-encrypted-db
state: present
engine: mariadb
storage_encrypted: True
db_instance_class: db.t2.medium
username: "{{ username }}"
password: "{{ password }}"
allocated_storage: "{{ allocated_storage }}"
- name: remove the DB instance without a final snapshot
community.aws.rds_instance:
id: "{{ instance_id }}"
state: absent
skip_final_snapshot: True
- name: remove the DB instance with a final snapshot
community.aws.rds_instance:
id: "{{ instance_id }}"
state: absent
final_snapshot_identifier: "{{ snapshot_id }}"
- name: Add a new security group without purge
community.aws.rds_instance:
id: "{{ instance_id }}"
state: present
vpc_security_group_ids:
- sg-0be17ba10c9286b0b
purge_security_groups: false
register: result
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **allocated\_storage** integer | always | The allocated storage size in gibibytes. This is always 1 for aurora database engines. **Sample:** 20 |
| **auto\_minor\_version\_upgrade** boolean | always | Whether minor engine upgrades are applied automatically to the DB instance during the maintenance window. **Sample:** True |
| **availability\_zone** string | always | The availability zone for the DB instance. **Sample:** us-east-1f |
| **backup\_retention\_period** integer | always | The number of days for which automated backups are retained. **Sample:** 1 |
| **ca\_certificate\_identifier** string | always | The identifier of the CA certificate for the DB instance. **Sample:** rds-ca-2015 |
| **copy\_tags\_to\_snapshot** boolean | always | Whether tags are copied from the DB instance to snapshots of the DB instance. |
| **db\_instance\_arn** string | always | The Amazon Resource Name (ARN) for the DB instance. **Sample:** arn:aws:rds:us-east-1:123456789012:db:ansible-test |
| **db\_instance\_class** string | always | The name of the compute and memory capacity class of the DB instance. **Sample:** db.m4.large |
| **db\_instance\_identifier** string | always | The identifier of the DB instance **Sample:** ansible-test |
| **db\_instance\_port** integer | always | The port that the DB instance listens on. |
| **db\_instance\_status** string | always | The current state of this database. **Sample:** stopped |
| **db\_parameter\_groups** complex | always | The list of DB parameter groups applied to this DB instance. |
| | **db\_parameter\_group\_name** string | always | The name of the DP parameter group. **Sample:** default.mariadb10.0 |
| | **parameter\_apply\_status** string | always | The status of parameter updates. **Sample:** in-sync |
| **db\_security\_groups** list / elements=string | always | A list of DB security groups associated with this DB instance. |
| **db\_subnet\_group** complex | always | The subnet group associated with the DB instance. |
| | **db\_subnet\_group\_description** string | always | The description of the DB subnet group. **Sample:** default |
| | **db\_subnet\_group\_name** string | always | The name of the DB subnet group. **Sample:** default |
| | **subnet\_group\_status** string | always | The status of the DB subnet group. **Sample:** Complete |
| | **subnets** complex | always | A list of Subnet elements. |
| | | **subnet\_availability\_zone** complex | always | The availability zone of the subnet. |
| | | | **name** string | always | The name of the Availability Zone. **Sample:** us-east-1c |
| | | **subnet\_identifier** string | always | The ID of the subnet. **Sample:** subnet-12345678 |
| | | **subnet\_status** string | always | The status of the subnet. **Sample:** Active |
| | **vpc\_id** string | always | The VpcId of the DB subnet group. **Sample:** vpc-12345678 |
| **dbi\_resource\_id** string | always | The AWS Region-unique, immutable identifier for the DB instance. **Sample:** db-UHV3QRNWX4KB6GALCIGRML6QFA |
| **domain\_memberships** list / elements=string | always | The Active Directory Domain membership records associated with the DB instance. |
| **endpoint** complex | always | The connection endpoint. |
| | **address** string | always | The DNS address of the DB instance. **Sample:** ansible-test.cvlrtwiennww.us-east-1.rds.amazonaws.com |
| | **hosted\_zone\_id** string | always | The ID that Amazon Route 53 assigns when you create a hosted zone. **Sample:** ZTR2ITUGPA61AM |
| | **port** integer | always | The port that the database engine is listening on. **Sample:** 3306 |
| **engine** string | always | The database engine version. **Sample:** mariadb |
| **engine\_version** string | always | The database engine version. **Sample:** 10.0.35 |
| **iam\_database\_authentication\_enabled** boolean | always | Whether mapping of AWS Identity and Access Management (IAM) accounts to database accounts is enabled. |
| **instance\_create\_time** string | always | The date and time the DB instance was created. **Sample:** 2018-07-04T16:48:35.332000+00:00 |
| **kms\_key\_id** string | When storage\_encrypted is true | The AWS KMS key identifier for the encrypted DB instance when storage\_encrypted is true. **Sample:** arn:aws:kms:us-east-1:123456789012:key/70c45553-ad2e-4a85-9f14-cfeb47555c33 |
| **latest\_restorable\_time** string | always | The latest time to which a database can be restored with point-in-time restore. **Sample:** 2018-07-04T16:50:50.642000+00:00 |
| **license\_model** string | always | The License model information for this DB instance. **Sample:** general-public-license |
| **master\_username** string | always | The master username for the DB instance. **Sample:** test |
| **max\_allocated\_storage** integer | When max allocated storage is present. | The upper limit to which Amazon RDS can automatically scale the storage of the DB instance. **Sample:** 100 |
| **monitoring\_interval** integer | always | The interval, in seconds, between points when Enhanced Monitoring metrics are collected for the DB instance. 0 means collecting Enhanced Monitoring metrics is disabled. |
| **multi\_az** boolean | always | Whether the DB instance is a Multi-AZ deployment. |
| **option\_group\_memberships** complex | always | The list of option group memberships for this DB instance. |
| | **option\_group\_name** string | always | The name of the option group that the instance belongs to. **Sample:** default:mariadb-10-0 |
| | **status** string | always | The status of the DB instance's option group membership. **Sample:** in-sync |
| **pending\_modified\_values** complex | always | The changes to the DB instance that are pending. |
| **performance\_insights\_enabled** boolean | always | True if Performance Insights is enabled for the DB instance, and otherwise false. |
| **preferred\_backup\_window** string | always | The daily time range during which automated backups are created if automated backups are enabled. **Sample:** 07:01-07:31 |
| **preferred\_maintenance\_window** string | always | The weekly time range (in UTC) during which system maintenance can occur. **Sample:** sun:09:31-sun:10:01 |
| **publicly\_accessible** boolean | always | True for an Internet-facing instance with a publicly resolvable DNS name, False to indicate an internal instance with a DNS name that resolves to a private IP address. **Sample:** True |
| **read\_replica\_db\_instance\_identifiers** list / elements=string | always | Identifiers of the Read Replicas associated with this DB instance. |
| **storage\_encrypted** boolean | always | Whether the DB instance is encrypted. |
| **storage\_type** string | always | The storage type to be associated with the DB instance. **Sample:** standard |
| **tags** complex | always | A dictionary of tags associated with the DB instance. |
| **vpc\_security\_groups** complex | always | A list of VPC security group elements that the DB instance belongs to. |
| | **status** string | always | The status of the VPC security group. **Sample:** active |
| | **vpc\_security\_group\_id** string | always | The name of the VPC security group. **Sample:** sg-12345678 |
### Authors
* Sloane Hertel (@s-hertel)
| programming_docs |
ansible community.aws.iam_role – Manage AWS IAM roles community.aws.iam\_role – Manage AWS IAM roles
==============================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.iam_role`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage AWS IAM roles.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **assume\_role\_policy\_document** json | | The trust relationship policy document that grants an entity permission to assume the role. This parameter is required when *state=present*. |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **boundary** string | | The ARN of an IAM managed policy to use to restrict the permissions this role can pass on to IAM roles/users that it creates. Boundaries cannot be set on Instance Profiles, as such if this option is specified then *create\_instance\_profile* must be `false`. This is intended for roles/users that have permissions to create new IAM objects. For more information on boundaries, see <https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html>. Requires botocore 1.10.57 or above.
aliases: boundary\_policy\_arn |
| **create\_instance\_profile** boolean | **Choices:*** no
* **yes** ←
| Creates an IAM instance profile along with the role. |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **delete\_instance\_profile** boolean | **Choices:*** **no** ←
* yes
| When *delete\_instance\_profile=true* and *state=absent* deleting a role will also delete the instance profile created with the same *name* as the role. Only applies when *state=absent*. |
| **description** string | | Provides a description of the role. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **managed\_policies** list / elements=string | | A list of managed policy ARNs or, since Ansible 2.4, a list of either managed policy ARNs or friendly names. To remove all policies set *purge\_polices=true* and *managed\_policies=[None]*. To embed an inline policy, use [community.aws.iam\_policy](iam_policy_module).
aliases: managed\_policy |
| **max\_session\_duration** integer | | The maximum duration (in seconds) of a session when assuming the role. Valid values are between 1 and 12 hours (3600 and 43200 seconds). |
| **name** string / required | | The name of the role to create. |
| **path** string | **Default:**"/" | The path to the role. For more information about paths, see <https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html>. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **purge\_policies** boolean | **Choices:*** no
* yes
| When *purge\_policies=true* any managed policies not listed in *managed\_policies* will be detatched. By default *purge\_policies=true*. In Ansible 2.14 this will be changed to *purge\_policies=false*.
aliases: purge\_policy, purge\_managed\_policies |
| **purge\_tags** boolean | **Choices:*** no
* **yes** ←
| Remove tags not listed in *tags* when tags is specified. |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** **present** ←
* absent
| Create or remove the IAM role. |
| **tags** dictionary | | Tag dict to apply to the queue. Requires botocore 1.12.46 or above. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
- name: Create a role with description and tags
community.aws.iam_role:
name: mynewrole
assume_role_policy_document: "{{ lookup('file','policy.json') }}"
description: This is My New Role
tags:
env: dev
- name: "Create a role and attach a managed policy called 'PowerUserAccess'"
community.aws.iam_role:
name: mynewrole
assume_role_policy_document: "{{ lookup('file','policy.json') }}"
managed_policies:
- arn:aws:iam::aws:policy/PowerUserAccess
- name: Keep the role created above but remove all managed policies
community.aws.iam_role:
name: mynewrole
assume_role_policy_document: "{{ lookup('file','policy.json') }}"
managed_policies: []
- name: Delete the role
community.aws.iam_role:
name: mynewrole
assume_role_policy_document: "{{ lookup('file', 'policy.json') }}"
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **iam\_role** complex | success | dictionary containing the IAM Role data |
| | **arn** string | always | the Amazon Resource Name (ARN) specifying the role **Sample:** arn:aws:iam::1234567890:role/mynewrole |
| | **assume\_role\_policy\_document** string | always | the policy that grants an entity permission to assume the role **Sample:** {'statement': [{'action': 'sts:AssumeRole', 'effect': 'Allow', 'principal': {'service': 'ec2.amazonaws.com'}, 'sid': ''}], 'version': '2012-10-17'} |
| | **attached\_policies** list / elements=string | always | a list of dicts containing the name and ARN of the managed IAM policies attached to the role **Sample:** [{'policy\_arn': 'arn:aws:iam::aws:policy/PowerUserAccess', 'policy\_name': 'PowerUserAccess'}] |
| | **create\_date** string | always | the date and time, in ISO 8601 date-time format, when the role was created **Sample:** 2016-08-14T04:36:28+00:00 |
| | **path** string | always | the path to the role **Sample:** / |
| | **role\_id** string | always | the stable and unique string identifying the role **Sample:** ABCDEFF4EZ4ABCDEFV4ZC |
| | **role\_name** string | always | the friendly name that identifies the role **Sample:** myrole |
| | **tags** dictionary | always | role tags **Sample:** {"Env": "Prod"} |
### Authors
* Rob White (@wimnat)
ansible community.aws.route53_zone – add or delete Route53 zones community.aws.route53\_zone – add or delete Route53 zones
=========================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.route53_zone`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Creates and deletes Route53 private and public zones.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **comment** string | **Default:**"" | Comment associated with the zone. |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **delegation\_set\_id** string | | The reusable delegation set ID to be associated with the zone. Note that you can't associate a reusable delegation set with a private hosted zone. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **hosted\_zone\_id** string | | The unique zone identifier you want to delete or "all" if there are many zones with the same domain name. Required if there are multiple zones identified with the above options. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** **present** ←
* absent
| Whether or not the zone should exist or not. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
| **vpc\_id** string | | The VPC ID the zone should be a part of (if this is going to be a private zone). |
| **vpc\_region** string | | The VPC Region the zone should be a part of (if this is going to be a private zone). |
| **zone** string / required | | The DNS zone record (eg: foo.com.) |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- name: create a public zone
community.aws.route53_zone:
zone: example.com
comment: this is an example
- name: delete a public zone
community.aws.route53_zone:
zone: example.com
state: absent
- name: create a private zone
community.aws.route53_zone:
zone: devel.example.com
vpc_id: '{{ myvpc_id }}'
vpc_region: us-west-2
comment: developer domain
- name: create a public zone associated with a specific reusable delegation set
community.aws.route53_zone:
zone: example.com
comment: reusable delegation set example
delegation_set_id: A1BCDEF2GHIJKL
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **comment** string | when hosted zone exists | optional hosted zone comment **Sample:** Private zone |
| **delegation\_set\_id** string | for public hosted zones, if they have been associated with a reusable delegation set | id of the associated reusable delegation set **Sample:** A1BCDEF2GHIJKL |
| **name** string | when hosted zone exists | hosted zone name **Sample:** private.local. |
| **private\_zone** boolean | when hosted zone exists | whether hosted zone is private or public **Sample:** True |
| **vpc\_id** string | for private hosted zone | id of vpc attached to private hosted zone **Sample:** vpc-1d36c84f |
| **vpc\_region** string | for private hosted zone | region of vpc attached to private hosted zone **Sample:** eu-west-1 |
| **zone\_id** string | when hosted zone exists | hosted zone id **Sample:** Z6JQG9820BEFMW |
### Authors
* Christopher Troup (@minichate)
ansible community.aws.ecs_taskdefinition_info – Describe a task definition in ECS community.aws.ecs\_taskdefinition\_info – Describe a task definition in ECS
===========================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.ecs_taskdefinition_info`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Describes a task definition in ECS.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* json
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **task\_definition** string / required | | The name of the task definition to get details for |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* For details of the parameters and returns see <http://boto3.readthedocs.io/en/latest/reference/services/ecs.html#ECS.Client.describe_task_definition>
* This module was called `ecs_taskdefinition_facts` before Ansible 2.9. The usage did not change.
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
- community.aws.ecs_taskdefinition_info:
task_definition: test-td
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **container\_definitions** complex | success | Returns a list of complex objects representing the containers |
| | **command** string | when present | The command that is passed to the container. |
| | **cpu** integer | always | The number of cpu units reserved for the container. |
| | **disableNetworking** boolean | when present | When this parameter is true, networking is disabled within the container. |
| | **dnsSearchDomains** string | when present | A list of DNS search domains that are presented to the container. |
| | **dnsServers** string | when present | A list of DNS servers that are presented to the container. |
| | **dockerLabels** string | when present | A key/value map of labels to add to the container. |
| | **dockerSecurityOptions** string | when present | A list of strings to provide custom labels for SELinux and AppArmor multi-level security systems. |
| | **entryPoint** string | when present | The entry point that is passed to the container. |
| | **environment** complex | always | The environment variables to pass to a container. |
| | | **name** string | when present | The name of the environment variable. |
| | | **value** string | when present | The value of the environment variable. |
| | **essential** boolean | always | Whether this is an essential container or not. |
| | **extraHosts** complex | when present | A list of hostnames and IP address mappings to append to the /etc/hosts file on the container. |
| | | **hostname** string | when present | The hostname to use in the /etc/hosts entry. |
| | | **ipAddress** string | when present | The IP address to use in the /etc/hosts entry. |
| | **hostname** string | when present | The hostname to use for your container. |
| | **image** string | always | The image used to start a container. |
| | **links** string | when present | Links to other containers. |
| | **logConfiguration** string | when present | The log configuration specification for the container. |
| | **memoryReservation** integer | when present | The soft limit (in MiB) of memory to reserve for the container. |
| | **mountPoints** complex | always | The mount points for data volumes in your container. |
| | | **containerPath** string | when present | The path on the container to mount the host volume at. |
| | | **readOnly** boolean | when present | If this value is true , the container has read-only access to the volume. If this value is false , then the container can write to the volume. |
| | | **sourceVolume** string | when present | The name of the volume to mount. |
| | **name** string | always | The name of a container. |
| | **options** string | when present | The configuration options to send to the log driver. |
| | **portMappings** complex | always | The list of port mappings for the container. |
| | | **containerPort** integer | when present | The port number on the container. |
| | | **hostPort** integer | when present | The port number on the container instance to reserve for your container. |
| | | **protocol** string | when present | The protocol used for the port mapping. |
| | **privileged** boolean | when present | When this parameter is true, the container is given elevated privileges on the host container instance (similar to the root user). |
| | **readonlyRootFilesystem** boolean | when present | When this parameter is true, the container is given read-only access to its root file system. |
| | **ulimits** complex | when present | A list of ulimits to set in the container. |
| | | **hardLimit** integer | when present | The hard limit for the ulimit type. |
| | | **name** string | when present | The type of the ulimit . |
| | | **softLimit** integer | when present | The soft limit for the ulimit type. |
| | **user** string | when present | The user name to use inside the container. |
| | **volumesFrom** complex | always | Data volumes to mount from another container. |
| | | **readOnly** boolean | when present | If this value is true , the container has read-only access to the volume. If this value is false , then the container can write to the volume. |
| | | **sourceContainer** string | when present | The name of another container within the same task definition to mount volumes from. |
| | **workingDirectory** string | when present | The working directory in which to run commands inside the container. |
| **family** string | always | The family of your task definition, used as the definition name |
| **network\_mode** string | always | Network mode for the containers |
| **placement\_constraints** complex | always | A list of placement constraint objects to use for tasks |
| | **expression** string | when present | A cluster query language expression to apply to the constraint. |
| | **type** string | when present | The type of constraint. |
| **requires\_attributes** complex | when present | The container instance attributes required by your task |
| | **name** string | when present | The name of the attribute. |
| | **targetId** string | when present | The ID of the target. |
| | **targetType** string | when present | The type of the target with which to attach the attribute. |
| | **value** string | when present | The value of the attribute. |
| **revision** integer | always | Revision number that was queried |
| **status** string | always | The status of the task definition |
| **task\_definition\_arn** string | always | ARN of the task definition |
| **task\_role\_arn** string | when role is set | The ARN of the IAM role that containers in this task can assume |
| **volumes** complex | always | The list of volumes in a task |
| | **host** boolean | when present | The contents of the host parameter determine whether your data volume persists on the host container instance and where it is stored. |
| | **name** string | when present | The name of the volume. |
| | **source\_path** string | when present | The path on the host container instance that is presented to the container. |
### Authors
* Gustavo Maia (@gurumaia)
* Mark Chance (@Java1Guy)
* Darek Kaczynski (@kaczynskid)
| programming_docs |
ansible community.aws.aws_codecommit – Manage repositories in AWS CodeCommit community.aws.aws\_codecommit – Manage repositories in AWS CodeCommit
=====================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.aws_codecommit`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Supports creation and deletion of CodeCommit repositories.
* See <https://aws.amazon.com/codecommit/> for more information about CodeCommit.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **description** string | | description or comment of repository.
aliases: comment |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **name** string / required | | name of repository. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string / required | **Choices:*** present
* absent
| Specifies the state of repository. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Create a new repository
- community.aws.aws_codecommit:
name: repo
state: present
# Delete a repository
- community.aws.aws_codecommit:
name: repo
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **repository\_metadata** complex | always | Information about the repository. |
| | **account\_id** string | when state is present | The ID of the AWS account associated with the repository. **Sample:** 268342293637 |
| | **arn** string | when state is present | The Amazon Resource Name (ARN) of the repository. **Sample:** arn:aws:codecommit:ap-northeast-1:268342293637:username |
| | **clone\_url\_http** string | when state is present | The URL to use for cloning the repository over HTTPS. **Sample:** https://git-codecommit.ap-northeast-1.amazonaws.com/v1/repos/reponame |
| | **clone\_url\_ssh** string | when state is present | The URL to use for cloning the repository over SSH. **Sample:** ssh://git-codecommit.ap-northeast-1.amazonaws.com/v1/repos/reponame |
| | **creation\_date** string | when state is present | The date and time the repository was created, in timestamp format. **Sample:** 2018-10-16T13:21:41.261000+09:00 |
| | **last\_modified\_date** string | when state is present | The date and time the repository was last modified, in timestamp format. **Sample:** 2018-10-16T13:21:41.261000+09:00 |
| | **repository\_description** string | when state is present | A comment or description about the repository. **Sample:** test from ptux |
| | **repository\_id** string | always | The ID of the repository that was created or deleted **Sample:** e62a5c54-i879-497b-b62f-9f99e4ebfk8e |
| | **repository\_name** string | when state is present | The repository's name. **Sample:** reponame |
| **response\_metadata** complex | always | Information about the response. |
| | **http\_headers** dictionary | always | http headers of http response |
| | **http\_status\_code** string | always | http status code of http response **Sample:** 200 |
| | **request\_id** string | always | http request id **Sample:** fb49cfca-d0fa-11e8-85cb-b3cc4b5045ef |
| | **retry\_attempts** string | always | numbers of retry attempts **Sample:** 0 |
### Authors
* Shuang Wang (@ptux)
ansible community.aws.iam_mfa_device_info – List the MFA (Multi-Factor Authentication) devices registered for a user community.aws.iam\_mfa\_device\_info – List the MFA (Multi-Factor Authentication) devices registered for a user
===============================================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.iam_mfa_device_info`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* List the MFA (Multi-Factor Authentication) devices registered for a user
* This module was called `iam_mfa_device_facts` before Ansible 2.9. The usage did not change.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **user\_name** string | | The name of the user whose MFA devices will be listed |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
# more details: https://docs.aws.amazon.com/IAM/latest/APIReference/API_ListMFADevices.html
- name: List MFA devices
community.aws.iam_mfa_device_info:
register: mfa_devices
# more details: https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html
- name: Assume an existing role
community.aws.sts_assume_role:
mfa_serial_number: "{{ mfa_devices.mfa_devices[0].serial_number }}"
role_arn: "arn:aws:iam::123456789012:role/someRole"
role_session_name: "someRoleSession"
register: assumed_role
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **mfa\_devices** list / elements=string | always | The MFA devices registered for the given user **Sample:** [{'enable\_date': '2016-03-11T23:25:36+00:00', 'serial\_number': 'arn:aws:iam::085120003701:mfa/pwnall', 'user\_name': 'pwnall'}, {'enable\_date': '2016-03-11T23:25:37+00:00', 'serial\_number': 'arn:aws:iam::085120003702:mfa/pwnall', 'user\_name': 'pwnall'}] |
### Authors
* Victor Costan (@pwnall)
ansible community.aws.aws_sgw_info – Fetch AWS Storage Gateway information community.aws.aws\_sgw\_info – Fetch AWS Storage Gateway information
====================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.aws_sgw_info`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Fetch AWS Storage Gateway information
* This module was called `aws_sgw_facts` before Ansible 2.9. The usage did not change.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **gather\_file\_shares** boolean | **Choices:*** no
* **yes** ←
| Gather file share information for storage gateways in s3 mode. |
| **gather\_local\_disks** boolean | **Choices:*** no
* **yes** ←
| Gather local disks attached to the storage gateway. |
| **gather\_tapes** boolean | **Choices:*** no
* **yes** ←
| Gather tape information for storage gateways in tape mode. |
| **gather\_volumes** boolean | **Choices:*** no
* **yes** ←
| Gather volume information for storage gateways in iSCSI (cached & stored) modes. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: These examples do not set authentication details, see the AWS Guide for details.
- name: "Get AWS storage gateway information"
community.aws.aws_sgw_info:
- name: "Get AWS storage gateway information for region eu-west-3"
community.aws.aws_sgw_info:
region: eu-west-3
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **gateways** complex | always | list of gateway objects |
| | **file\_shares** complex | when gateway\_type == "FILE\_S3" | Storage gateway file shares |
| | | **file\_share\_arn** string | always | File share ARN **Sample:** arn:aws:storagegateway:eu-west-1:399805793479:share/share-AF999C88 |
| | | **file\_share\_id** string | always | File share ID **Sample:** share-AF999C88 |
| | | **file\_share\_status** string | always | File share status **Sample:** AVAILABLE |
| | **gateway\_arn** string | always | Storage Gateway ARN **Sample:** arn:aws:storagegateway:eu-west-1:367709993819:gateway/sgw-9999F888 |
| | **gateway\_id** string | always | Storage Gateway ID **Sample:** sgw-9999F888 |
| | **gateway\_name** string | always | Storage Gateway friendly name **Sample:** my-sgw-01 |
| | **gateway\_operational\_state** string | always | Storage Gateway operational state **Sample:** ACTIVE |
| | **gateway\_type** string | always | Storage Gateway type **Sample:** FILE\_S3 |
| | **local\_disks** complex | always | Storage gateway local disks |
| | | **disk\_allocation\_type** string | always | Disk allocation type **Sample:** CACHE STORAGE |
| | | **disk\_id** string | always | Disk ID on the system **Sample:** pci-0000:00:1f.0 |
| | | **disk\_node** string | always | Disk parent block device **Sample:** /dev/sdb |
| | | **disk\_path** string | always | Disk path used for the cache **Sample:** /dev/nvme1n1 |
| | | **disk\_size\_in\_bytes** integer | always | Disk size in bytes **Sample:** 107374182400 |
| | | **disk\_status** string | always | Disk status **Sample:** present |
| | **tapes** complex | when gateway\_type == "VTL" | Storage Gateway tapes |
| | | **tape\_arn** string | always | Tape ARN **Sample:** arn:aws:storagegateway:eu-west-1:399805793479:tape/tape-AF999C88 |
| | | **tape\_barcode** string | always | Tape ARN **Sample:** tape-AF999C88 |
| | | **tape\_size\_in\_bytes** integer | always | Tape ARN **Sample:** 555887569 |
| | | **tape\_status** string | always | Tape ARN **Sample:** AVAILABLE |
### Authors
* Loic Blot (@nerzhul) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#74181b1d17525740424f16181b00525747434f525741464f5257404c4f011a1d0c59110c0411061d111a1711525740424f1206)>
| programming_docs |
ansible community.aws.aws_config_delivery_channel – Manage AWS Config delivery channels community.aws.aws\_config\_delivery\_channel – Manage AWS Config delivery channels
==================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.aws_config_delivery_channel`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module manages AWS Config delivery locations for rule checks and configuration info.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **delivery\_frequency** string | **Choices:*** One\_Hour
* Three\_Hours
* Six\_Hours
* Twelve\_Hours
* TwentyFour\_Hours
| The frequency with which AWS Config delivers configuration snapshots. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **name** string / required | | The name of the AWS Config resource. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **s3\_bucket** string / required | | The name of the Amazon S3 bucket to which AWS Config delivers configuration snapshots and configuration history files. |
| **s3\_prefix** string | | The prefix for the specified Amazon S3 bucket. |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **sns\_topic\_arn** string | | The Amazon Resource Name (ARN) of the Amazon SNS topic to which AWS Config sends notifications about configuration changes. |
| **state** string | **Choices:*** **present** ←
* absent
| Whether the Config rule should be present or absent. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- name: Create Delivery Channel for AWS Config
community.aws.aws_config_delivery_channel:
name: test_delivery_channel
state: present
s3_bucket: 'test_aws_config_bucket'
sns_topic_arn: 'arn:aws:sns:us-east-1:123456789012:aws_config_topic:1234ab56-cdef-7g89-01hi-2jk34l5m67no'
delivery_frequency: 'Twelve_Hours'
```
### Authors
* Aaron Smith (@slapula)
ansible community.aws.elasticache_snapshot – Manage cache snapshots in Amazon ElastiCache community.aws.elasticache\_snapshot – Manage cache snapshots in Amazon ElastiCache
==================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.elasticache_snapshot`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage cache snapshots in Amazon ElastiCache.
* Returns information about the specified snapshot.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **bucket** string | | The s3 bucket to which the snapshot is exported. |
| **cluster\_id** string | | The name of an existing cache cluster in the replication group to make the snapshot. |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **name** string / required | | The name of the snapshot we want to create, copy, delete. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **replication\_id** string | | The name of the existing replication group to make the snapshot. |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string / required | **Choices:*** present
* absent
* copy
| Actions that will create, destroy, or copy a snapshot. |
| **target** string | | The name of a snapshot copy. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: None of these examples set aws_access_key, aws_secret_key, or region.
# It is assumed that their matching environment variables are set.
- name: 'Create a snapshot'
community.aws.elasticache_snapshot:
name: 'test-snapshot'
state: 'present'
cluster_id: '{{ cluster }}'
replication_id: '{{ replication }}'
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **changed** boolean | always | if a snapshot has been created, deleted, or copied **Sample:** {'changed': True} |
| **response\_metadata** dictionary | always | response metadata about the snapshot **Sample:** {'http\_headers': {'content-length': 1490, 'content-type': 'text/xml', 'date': 'Tue, 07 Feb 2017 16:43:04 GMT', 'x-amzn-requestid': '7f436dea-ed54-11e6-a04c-ab2372a1f14d'}, 'http\_status\_code': 200, 'request\_id': '7f436dea-ed54-11e6-a04c-ab2372a1f14d', 'retry\_attempts': 0} |
| **snapshot** dictionary | always | snapshot data **Sample:** {'auto\_minor\_version\_upgrade': True, 'cache\_cluster\_create\_time': '2017-02-01T17:43:58.261000+00:00', 'cache\_cluster\_id': 'test-please-delete', 'cache\_node\_type': 'cache.m1.small', 'cache\_parameter\_group\_name': 'default.redis3.2', 'cache\_subnet\_group\_name': 'default', 'engine': 'redis', 'engine\_version': '3.2.4', 'node\_snapshots': {'cache\_node\_create\_time': '2017-02-01T17:43:58.261000+00:00', 'cache\_node\_id': 1, 'cache\_size': None}, 'num\_cache\_nodes': 1, 'port': 11211, 'preferred\_availability\_zone': 'us-east-1d', 'preferred\_maintenance\_window': 'wed:03:00-wed:04:00', 'snapshot\_name': 'deletesnapshot', 'snapshot\_retention\_limit': 0, 'snapshot\_source': 'manual', 'snapshot\_status': 'creating', 'snapshot\_window': '10:00-11:00', 'vpc\_id': 'vpc-c248fda4'} |
### Authors
* Sloane Hertel (@s-hertel)
ansible community.aws.elasticache_parameter_group – Manage cache parameter groups in Amazon ElastiCache. community.aws.elasticache\_parameter\_group – Manage cache parameter groups in Amazon ElastiCache.
==================================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.elasticache_parameter_group`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage cache security groups in Amazon ElastiCache.
* Returns information about the specified cache cluster.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **description** string | | A user-specified description for the cache parameter group. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **group\_family** string | **Choices:*** memcached1.4
* memcached1.5
* redis2.6
* redis2.8
* redis3.2
* redis4.0
* redis5.0
| The name of the cache parameter group family that the cache parameter group can be used with. Required when creating a cache parameter group. |
| **name** string / required | | A user-specified name for the cache parameter group. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string / required | **Choices:*** present
* absent
* reset
| Idempotent actions that will create/modify, destroy, or reset a cache parameter group as needed. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
| **values** dictionary | | A user-specified dictionary of parameters to reset or modify for the cache parameter group. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: None of these examples set aws_access_key, aws_secret_key, or region.
# It is assumed that their matching environment variables are set.
---
- hosts: localhost
connection: local
tasks:
- name: 'Create a test parameter group'
community.aws.elasticache_parameter_group:
name: 'test-param-group'
group_family: 'redis3.2'
description: 'This is a cache parameter group'
state: 'present'
- name: 'Modify a test parameter group'
community.aws.elasticache_parameter_group:
name: 'test-param-group'
values:
activerehashing: yes
client-output-buffer-limit-normal-hard-limit: 4
state: 'present'
- name: 'Reset all modifiable parameters for the test parameter group'
community.aws.elasticache_parameter_group:
name: 'test-param-group'
state: reset
- name: 'Delete a test parameter group'
community.aws.elasticache_parameter_group:
name: 'test-param-group'
state: 'absent'
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **changed** boolean | always | if the cache parameter group has changed **Sample:** {'changed': True} |
| **elasticache** dictionary | always | cache parameter group information and response metadata **Sample:** {'cache\_parameter\_group': {'cache\_parameter\_group\_family': 'redis3.2', 'cache\_parameter\_group\_name': 'test-please-delete', 'description': 'initial description'}, 'response\_metadata': {'http\_headers': {'content-length': '562', 'content-type': 'text/xml', 'date': 'Mon, 06 Feb 2017 22:14:08 GMT', 'x-amzn-requestid': '947291f9-ecb9-11e6-85bd-3baa4eca2cc1'}, 'http\_status\_code': 200, 'request\_id': '947291f9-ecb9-11e6-85bd-3baa4eca2cc1', 'retry\_attempts': 0}} |
### Authors
* Sloane Hertel (@s-hertel)
| programming_docs |
ansible community.aws.cloudfront_distribution – Create, update and delete AWS CloudFront distributions. community.aws.cloudfront\_distribution – Create, update and delete AWS CloudFront distributions.
================================================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.cloudfront_distribution`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Allows for easy creation, updating and deletion of CloudFront distributions.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3 >= 1.0.0
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **alias** string | | The name of an alias (CNAME) that is used in a distribution. This is used to effectively reference a distribution by its alias as an alias can only be used by one distribution per AWS account. This variable avoids having to provide the *distribution\_id* as well as the *e\_tag*, or *caller\_reference* of an existing distribution. |
| **aliases** list / elements=string | | A list of domain name aliases (CNAMEs) as strings to be used for the distribution. Each alias must be unique across all distribution for the AWS account. |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **cache\_behaviors** list / elements=dictionary | | A list of dictionaries describing the cache behaviors for the distribution. The order of the list is preserved across runs unless *purge\_cache\_behaviors* is enabled. |
| | **forwarded\_values** dictionary | | A dict that specifies how CloudFront handles query strings and cookies. |
| | | **allowed\_methods** dictionary | | A dict that controls which HTTP methods CloudFront processes and forwards. |
| | | | **cached\_methods** list / elements=string | | A list of HTTP methods that you want CloudFront to apply caching to. This can either be `[GET,HEAD]`, or `[GET,HEAD,OPTIONS]`. |
| | | | **items** list / elements=string | | A list of HTTP methods that you want CloudFront to process and forward. |
| | | **compress** boolean | **Choices:*** no
* yes
| Whether you want CloudFront to automatically compress files. |
| | | **cookies** dictionary | | A dict that specifies whether you want CloudFront to forward cookies to the origin and, if so, which ones. |
| | | | **forward** string | | Specifies which cookies to forward to the origin for this cache behavior. Valid values are `all`, `none`, or `whitelist`. |
| | | | **whitelisted\_names** list / elements=string | | A list of cookies to forward to the origin for this cache behavior. |
| | | **default\_ttl** integer | | The default amount of time that you want objects to stay in CloudFront caches. |
| | | **field\_level\_encryption\_id** string | | The field-level encryption configuration that you want CloudFront to use for encrypting specific fields of data. |
| | | **headers** list / elements=string | | A list of headers to forward to the origin for this cache behavior. To forward all headers use a list containing a single element '\*' (`['*']`) |
| | | **lambda\_function\_associations** list / elements=dictionary | | A list of Lambda function associations to use for this cache behavior. |
| | | | **event\_type** string | | Specifies the event type that triggers a Lambda function invocation. This can be `viewer-request`, `origin-request`, `origin-response` or `viewer-response`. |
| | | | **lambda\_function\_arn** string | | The ARN of the Lambda function. |
| | | **max\_ttl** integer | | The maximum amount of time that you want objects to stay in CloudFront caches. |
| | | **min\_ttl** integer | | The minimum amount of time that you want objects to stay in CloudFront caches. |
| | | **query\_string** boolean | **Choices:*** no
* yes
| Indicates whether you want CloudFront to forward query strings to the origin that is associated with this cache behavior. |
| | | **query\_string\_cache\_keys** list / elements=string | | A list that contains the query string parameters you want CloudFront to use as a basis for caching for a cache behavior. |
| | | **smooth\_streaming** boolean | **Choices:*** no
* yes
| Whether you want to distribute media files in the Microsoft Smooth Streaming format. |
| | | **trusted\_signers** dictionary | | A dict that specifies the AWS accounts that you want to allow to create signed URLs for private content. |
| | | | **enabled** boolean | **Choices:*** no
* yes
| Whether you want to require viewers to use signed URLs to access the files specified by *path\_pattern* and *target\_origin\_id*
|
| | | | **items** list / elements=string | | A list of trusted signers for this cache behavior. |
| | | **viewer\_protocol\_policy** string | | The protocol that viewers can use to access the files in the origin specified by *target\_origin\_id* when a request matches *path\_pattern*. Valid values are `allow-all`, `redirect-to-https` and `https-only`. |
| | **path\_pattern** string | | The pattern that specifies which requests to apply the behavior to. |
| | **target\_origin\_id** string | | The ID of the origin that you want CloudFront to route requests to by default. |
| **caller\_reference** string | | A unique identifier for creating and updating CloudFront distributions. Each caller reference must be unique across all distributions. e.g. a caller reference used in a web distribution cannot be reused in a streaming distribution. This parameter can be used instead of *distribution\_id* to reference an existing distribution. If not specified, this defaults to a datetime stamp of the format `YYYY-MM-DDTHH:MM:SS.ffffff`. |
| **comment** string | | A comment that describes the CloudFront distribution. If not specified, it defaults to a generic message that it has been created with Ansible, and a datetime stamp. |
| **custom\_error\_responses** list / elements=dictionary | | A config element that is a *list[]* of complex custom error responses to be specified for the distribution. This attribute configures custom http error messages returned to the user. |
| | **error\_caching\_min\_ttl** integer | | The length of time (in seconds) that CloudFront will cache status codes for. |
| | **error\_code** integer | | The error code the custom error page is for. |
| | **response\_code** integer | | The HTTP status code that CloudFront should return to a user when the origin returns the HTTP status code specified by *error\_code*. |
| | **response\_page\_path** string | | The path to the custom error page that you want CloudFront to return to a viewer when your origin returns the HTTP status code specified by *error\_code*. |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **default\_cache\_behavior** dictionary | | A dict specifying the default cache behavior of the distribution. If not specified, the *target\_origin\_id* is defined as the *target\_origin\_id* of the first valid cache\_behavior in *cache\_behaviors* with defaults. |
| | **forwarded\_values** dictionary | | A dict that specifies how CloudFront handles query strings and cookies. |
| | | **allowed\_methods** dictionary | | A dict that controls which HTTP methods CloudFront processes and forwards. |
| | | | **cached\_methods** list / elements=string | | A list of HTTP methods that you want CloudFront to apply caching to. This can either be `[GET,HEAD]`, or `[GET,HEAD,OPTIONS]`. |
| | | | **items** list / elements=string | | A list of HTTP methods that you want CloudFront to process and forward. |
| | | **compress** boolean | **Choices:*** no
* yes
| Whether you want CloudFront to automatically compress files. |
| | | **cookies** dictionary | | A dict that specifies whether you want CloudFront to forward cookies to the origin and, if so, which ones. |
| | | | **forward** string | | Specifies which cookies to forward to the origin for this cache behavior. Valid values are `all`, `none`, or `whitelist`. |
| | | | **whitelisted\_names** list / elements=string | | A list of cookies to forward to the origin for this cache behavior. |
| | | **default\_ttl** integer | | The default amount of time that you want objects to stay in CloudFront caches. |
| | | **field\_level\_encryption\_id** string | | The field-level encryption configuration that you want CloudFront to use for encrypting specific fields of data. |
| | | **headers** list / elements=string | | A list of headers to forward to the origin for this cache behavior. To forward all headers use a list containing a single element '\*' (`['*']`) |
| | | **lambda\_function\_associations** list / elements=dictionary | | A list of Lambda function associations to use for this cache behavior. |
| | | | **event\_type** string | | Specifies the event type that triggers a Lambda function invocation. This can be `viewer-request`, `origin-request`, `origin-response` or `viewer-response`. |
| | | | **lambda\_function\_arn** string | | The ARN of the Lambda function. |
| | | **max\_ttl** integer | | The maximum amount of time that you want objects to stay in CloudFront caches. |
| | | **min\_ttl** integer | | The minimum amount of time that you want objects to stay in CloudFront caches. |
| | | **query\_string** boolean | **Choices:*** no
* yes
| Indicates whether you want CloudFront to forward query strings to the origin that is associated with this cache behavior. |
| | | **query\_string\_cache\_keys** list / elements=string | | A list that contains the query string parameters you want CloudFront to use as a basis for caching for a cache behavior. |
| | | **smooth\_streaming** boolean | **Choices:*** no
* yes
| Whether you want to distribute media files in the Microsoft Smooth Streaming format. |
| | | **trusted\_signers** dictionary | | A dict that specifies the AWS accounts that you want to allow to create signed URLs for private content. |
| | | | **enabled** boolean | **Choices:*** no
* yes
| Whether you want to require viewers to use signed URLs to access the files specified by *target\_origin\_id*
|
| | | | **items** list / elements=string | | A list of trusted signers for this cache behavior. |
| | | **viewer\_protocol\_policy** string | | The protocol that viewers can use to access the files in the origin specified by *target\_origin\_id*. Valid values are `allow-all`, `redirect-to-https` and `https-only`. |
| | **target\_origin\_id** string | | The ID of the origin that you want CloudFront to route requests to by default. |
| **default\_origin\_domain\_name** string | | The domain name to use for an origin if no *origins* have been specified. Should only be used on a first run of generating a distribution and not on subsequent runs. Should not be used in conjunction with *distribution\_id*, *caller\_reference* or *alias*. |
| **default\_origin\_path** string | | The default origin path to specify for an origin if no *origins* have been specified. Defaults to empty if not specified. |
| **default\_root\_object** string | | A config element that specifies the path to request when the user requests the origin. e.g. if specified as 'index.html', this maps to www.example.com/index.html when www.example.com is called by the user. This prevents the entire distribution origin from being exposed at the root. |
| **distribution\_id** string | | The ID of the CloudFront distribution. This parameter can be exchanged with *alias* or *caller\_reference* and is used in conjunction with *e\_tag*. |
| **e\_tag** string | | A unique identifier of a modified or existing distribution. Used in conjunction with *distribution\_id*. Is determined automatically if not specified. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **enabled** boolean | **Choices:*** no
* yes
| A boolean value that specifies whether the distribution is enabled or disabled. Defaults to `false`. |
| **http\_version** string | | The version of the http protocol to use for the distribution. AWS defaults this to `http2`. Valid values are `http1.1` and `http2`. |
| **ipv6\_enabled** boolean | **Choices:*** no
* yes
| Determines whether IPv6 support is enabled or not. Defaults to `false`. |
| **logging** dictionary | | A config element that is a complex object that defines logging for the distribution. |
| | **bucket** string | | The S3 bucket to store the log in. |
| | **enabled** boolean | **Choices:*** no
* yes
| When *enabled=true* CloudFront will log access to an S3 bucket. |
| | **include\_cookies** boolean | **Choices:*** no
* yes
| When *include\_cookies=true* CloudFront will include cookies in the logs. |
| | **prefix** string | | A prefix to include in the S3 object names. |
| **origins** list / elements=dictionary | | A config element that is a list of complex origin objects to be specified for the distribution. Used for creating and updating distributions. |
| | **custom\_headers** list / elements=dictionary | | Custom headers you wish to add to the request before passing it to the origin. For more information see the CloudFront documentation at <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/forward-custom-headers.html>. |
| | | **header\_name** string | | The name of a header that you want CloudFront to forward to your origin. |
| | | **header\_value** string | | The value for the header that you specified in the *header\_name* field. |
| | **custom\_origin\_config** dictionary | | Connection information about the origin. |
| | | **http\_port** integer | | The HTTP port the custom origin listens on. |
| | | **https\_port** integer | | The HTTPS port the custom origin listens on. |
| | | **origin\_keepalive\_timeout** integer | | A keep-alive timeout (in seconds). |
| | | **origin\_protocol\_policy** string | | The origin protocol policy to apply to your origin. |
| | | **origin\_read\_timeout** integer | | A timeout (in seconds) when reading from your origin. |
| | | **origin\_ssl\_protocols** list / elements=string | | A list of SSL/TLS protocols that you want CloudFront to use when communicating to the origin over HTTPS. |
| | **domain\_name** string | | The domain name which CloudFront will query as the origin. For more information see the CloudFront documentation at <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesDomainName>
|
| | **id** string | | A unique identifier for the origin or origin group. *id* must be unique within the distribution. |
| | **origin\_path** string | | Tells CloudFront to request your content from a directory in your Amazon S3 bucket or your custom origin. |
| | **s3\_origin\_access\_identity\_enabled** boolean | **Choices:*** no
* yes
| Use an origin access identity to configure the origin so that viewers can only access objects in an Amazon S3 bucket through CloudFront. Will automatically create an Identity for you. See also <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html>. |
| **price\_class** string | | A string that specifies the pricing class of the distribution. As per <https://aws.amazon.com/cloudfront/pricing/>
*price\_class=PriceClass\_100* consists of the areas United States, Canada and Europe.
*price\_class=PriceClass\_200* consists of the areas United States, Canada, Europe, Japan, India, Hong Kong, Philippines, S. Korea, Singapore & Taiwan.
*price\_class=PriceClass\_All* consists of the areas United States, Canada, Europe, Japan, India, South America, Australia, Hong Kong, Philippines, S. Korea, Singapore & Taiwan. AWS defaults this to `PriceClass_All`. Valid values are `PriceClass_100`, `PriceClass_200` and `PriceClass_All`
|
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **purge\_aliases** boolean | **Choices:*** **no** ←
* yes
| Specifies whether existing aliases will be removed before adding new aliases. When *purge\_aliases=yes*, existing aliases are removed and *aliases* are added. |
| **purge\_cache\_behaviors** boolean | **Choices:*** **no** ←
* yes
| Whether to remove any cache behaviors that aren't listed in *cache\_behaviors*. This switch also allows the reordering of *cache\_behaviors*. |
| **purge\_custom\_error\_responses** boolean | **Choices:*** **no** ←
* yes
| Whether to remove any custom error responses that aren't listed in *custom\_error\_responses*. |
| **purge\_origins** boolean | **Choices:*** **no** ←
* yes
| Whether to remove any origins that aren't listed in *origins*. |
| **purge\_tags** boolean | **Choices:*** **no** ←
* yes
| Specifies whether existing tags will be removed before adding new tags. When *purge\_tags=yes*, existing tags are removed and *tags* are added, if specified. If no tags are specified, it removes all existing tags for the distribution. When *purge\_tags=no*, existing tags are kept and *tags* are added, if specified. |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **restrictions** dictionary | | A config element that is a complex object that describes how a distribution should restrict it's content. |
| | **geo\_restriction** dictionary | | Apply a restriction based on the location of the requester. |
| | | **items** list / elements=string | | A list of ISO 3166-1 two letter (Alpha 2) country codes that the restriction should apply to. See the ISO website for a full list of codes <https://www.iso.org/obp/ui/#search/code/>. |
| | | **restriction\_type** string | | The method that you want to use to restrict distribution of your content by country. Valid values are `none`, `whitelist`, `blacklist`. |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** **present** ←
* absent
| The desired state of the distribution.
*state=present* creates a new distribution or updates an existing distribution.
*state=absent* deletes an existing distribution. |
| **tags** dictionary | | Should be input as a dict of key-value pairs. Note that numeric keys or values must be wrapped in quotes. e.g. `Priority: '1'`
|
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
| **viewer\_certificate** dictionary | | A dict that specifies the encryption details of the distribution. |
| | **acm\_certificate\_arn** string | | The ID of a certificate stored in ACM to use for HTTPS connections. If *acm\_certificate\_id* is set then you must also specify *ssl\_support\_method*. |
| | **cloudfront\_default\_certificate** boolean | **Choices:*** no
* yes
| If you're using the CloudFront domain name for your distribution, such as `123456789abcde.cloudfront.net` you should set *cloudfront\_default\_certificate=true*. If *cloudfront\_default\_certificate=true* do not set *ssl\_support\_method*. |
| | **iam\_certificate\_id** string | | The ID of a certificate stored in IAM to use for HTTPS connections. If *iam\_certificate\_id* is set then you must also specify *ssl\_support\_method*. |
| | **minimum\_protocol\_version** string | | The security policy that you want CloudFront to use for HTTPS connections. See <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/secure-connections-supported-viewer-protocols-ciphers.html> for supported security policies. |
| | **ssl\_support\_method** string | | How CloudFront should serve SSL certificates. Valid values are `sni-only` for SNI, and `vip` if CloudFront is configured to use a dedicated IP for your content. |
| **wait** boolean | **Choices:*** **no** ←
* yes
| Specifies whether the module waits until the distribution has completed processing the creation or update. |
| **wait\_timeout** integer | **Default:**1800 | Specifies the duration in seconds to wait for a timeout of a cloudfront create or update. |
| **web\_acl\_id** string | | The ID of a Web Application Firewall (WAF) Access Control List (ACL). |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- name: create a basic distribution with defaults and tags
community.aws.cloudfront_distribution:
state: present
default_origin_domain_name: www.my-cloudfront-origin.com
tags:
Name: example distribution
Project: example project
Priority: '1'
- name: update a distribution comment by distribution_id
community.aws.cloudfront_distribution:
state: present
distribution_id: E1RP5A2MJ8073O
comment: modified by ansible cloudfront.py
- name: update a distribution comment by caller_reference
community.aws.cloudfront_distribution:
state: present
caller_reference: my cloudfront distribution 001
comment: modified by ansible cloudfront.py
- name: update a distribution's aliases and comment using the distribution_id as a reference
community.aws.cloudfront_distribution:
state: present
distribution_id: E1RP5A2MJ8073O
comment: modified by cloudfront.py again
aliases: [ 'www.my-distribution-source.com', 'zzz.aaa.io' ]
- name: update a distribution's aliases and comment using an alias as a reference
community.aws.cloudfront_distribution:
state: present
caller_reference: my test distribution
comment: modified by cloudfront.py again
aliases:
- www.my-distribution-source.com
- zzz.aaa.io
- name: update a distribution's comment and aliases and tags and remove existing tags
community.aws.cloudfront_distribution:
state: present
distribution_id: E15BU8SDCGSG57
comment: modified by cloudfront.py again
aliases:
- tested.com
tags:
Project: distribution 1.2
purge_tags: yes
- name: create a distribution with an origin, logging and default cache behavior
community.aws.cloudfront_distribution:
state: present
caller_reference: unique test distribution ID
origins:
- id: 'my test origin-000111'
domain_name: www.example.com
origin_path: /production
custom_headers:
- header_name: MyCustomHeaderName
header_value: MyCustomHeaderValue
default_cache_behavior:
target_origin_id: 'my test origin-000111'
forwarded_values:
query_string: true
cookies:
forward: all
headers:
- '*'
viewer_protocol_policy: allow-all
smooth_streaming: true
compress: true
allowed_methods:
items:
- GET
- HEAD
cached_methods:
- GET
- HEAD
logging:
enabled: true
include_cookies: false
bucket: mylogbucket.s3.amazonaws.com
prefix: myprefix/
enabled: false
comment: this is a CloudFront distribution with logging
- name: delete a distribution
community.aws.cloudfront_distribution:
state: absent
caller_reference: replaceable distribution
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **active\_trusted\_signers** complex | always | Key pair IDs that CloudFront is aware of for each trusted signer. |
| | **enabled** boolean | always | Whether trusted signers are in use. |
| | **items** list / elements=string | when there are trusted signers | Number of trusted signers. **Sample:** ['key\_pair\_id'] |
| | **quantity** integer | always | Number of trusted signers. **Sample:** 1 |
| **aliases** complex | always | Aliases that refer to the distribution. |
| | **items** list / elements=string | always | List of aliases. **Sample:** ['test.example.com'] |
| | **quantity** integer | always | Number of aliases. **Sample:** 1 |
| **arn** string | always | Amazon Resource Name of the distribution. **Sample:** arn:aws:cloudfront::123456789012:distribution/E1234ABCDEFGHI |
| **cache\_behaviors** complex | always | CloudFront cache behaviors. |
| | **items** complex | always | List of cache behaviors. |
| | | **allowed\_methods** complex | always | Methods allowed by the cache behavior. |
| | | | **cached\_methods** complex | always | Methods cached by the cache behavior. |
| | | | | **items** list / elements=string | always | List of cached methods. **Sample:** ['HEAD', 'GET'] |
| | | | | **quantity** integer | always | Count of cached methods. **Sample:** 2 |
| | | | **items** list / elements=string | always | List of methods allowed by the cache behavior. **Sample:** ['HEAD', 'GET'] |
| | | | **quantity** integer | always | Count of methods allowed by the cache behavior. **Sample:** 2 |
| | | **compress** boolean | always | Whether compression is turned on for the cache behavior. |
| | | **default\_ttl** integer | always | Default Time to Live of the cache behavior. **Sample:** 86400 |
| | | **forwarded\_values** complex | always | Values forwarded to the origin for this cache behavior. |
| | | | **cookies** complex | always | Cookies to forward to the origin. |
| | | | | **forward** string | always | Which cookies to forward to the origin for this cache behavior. **Sample:** none |
| | | | | **whitelisted\_names** complex | when *forward=whitelist* | The names of the cookies to forward to the origin for this cache behavior. |
| | | | | | **items** list / elements=string | when list is not empty | List of cookies to forward. **Sample:** my\_cookie |
| | | | | | **quantity** integer | always | Count of cookies to forward. **Sample:** 1 |
| | | | **headers** complex | always | Which headers are used to vary on cache retrievals. |
| | | | | **items** list / elements=string | when list is not empty | List of headers to vary on. **Sample:** ['Host'] |
| | | | | **quantity** integer | always | Count of headers to vary on. **Sample:** 1 |
| | | | **query\_string** boolean | always | Whether the query string is used in cache lookups. |
| | | | **query\_string\_cache\_keys** complex | always | Which query string keys to use in cache lookups. |
| | | | | **items** list / elements=string | when list is not empty | List of query string cache keys to use in cache lookups. |
| | | | | **quantity** integer | always | Count of query string cache keys to use in cache lookups. **Sample:** 1 |
| | | **lambda\_function\_associations** complex | always | Lambda function associations for a cache behavior. |
| | | | **items** list / elements=string | when list is not empty | List of lambda function associations. **Sample:** [{'event\_type': 'viewer-response', 'lambda\_function\_arn': 'arn:aws:lambda:123456789012:us-east-1/lambda/lambda-function'}] |
| | | | **quantity** integer | always | Count of lambda function associations. **Sample:** 1 |
| | | **max\_ttl** integer | always | Maximum Time to Live. **Sample:** 31536000 |
| | | **min\_ttl** integer | always | Minimum Time to Live. |
| | | **path\_pattern** string | always | Path pattern that determines this cache behavior. **Sample:** /path/to/files/\* |
| | | **smooth\_streaming** boolean | always | Whether smooth streaming is enabled. |
| | | **target\_origin\_id** string | always | ID of origin reference by this cache behavior. **Sample:** origin\_abcd |
| | | **trusted\_signers** complex | always | Trusted signers. |
| | | | **enabled** boolean | always | Whether trusted signers are enabled for this cache behavior. |
| | | | **quantity** integer | always | Count of trusted signers. **Sample:** 1 |
| | | **viewer\_protocol\_policy** string | always | Policy of how to handle http/https. **Sample:** redirect-to-https |
| | **quantity** integer | always | Count of cache behaviors. **Sample:** 1 |
| **caller\_reference** string | always | Idempotency reference given when creating CloudFront distribution. **Sample:** 1484796016700 |
| **comment** string | always | Any comments you want to include about the distribution. **Sample:** my first CloudFront distribution |
| **custom\_error\_responses** complex | always | Custom error responses to use for error handling. |
| | **items** complex | always | List of custom error responses. |
| | | **error\_caching\_min\_ttl** integer | always | Minimum time to cache this error response. **Sample:** 300 |
| | | **error\_code** integer | always | Origin response code that triggers this error response. **Sample:** 500 |
| | | **response\_code** string | always | Response code to return to the requester. **Sample:** 500 |
| | | **response\_page\_path** string | always | Path that contains the error page to display. **Sample:** /errors/5xx.html |
| | **quantity** integer | always | Count of custom error response items **Sample:** 1 |
| **default\_cache\_behavior** complex | always | Default cache behavior. |
| | **allowed\_methods** complex | always | Methods allowed by the cache behavior. |
| | | **cached\_methods** complex | always | Methods cached by the cache behavior. |
| | | | **items** list / elements=string | always | List of cached methods. **Sample:** ['HEAD', 'GET'] |
| | | | **quantity** integer | always | Count of cached methods. **Sample:** 2 |
| | | **items** list / elements=string | always | List of methods allowed by the cache behavior. **Sample:** ['HEAD', 'GET'] |
| | | **quantity** integer | always | Count of methods allowed by the cache behavior. **Sample:** 2 |
| | **compress** boolean | always | Whether compression is turned on for the cache behavior. |
| | **default\_ttl** integer | always | Default Time to Live of the cache behavior. **Sample:** 86400 |
| | **forwarded\_values** complex | always | Values forwarded to the origin for this cache behavior. |
| | | **cookies** complex | always | Cookies to forward to the origin. |
| | | | **forward** string | always | Which cookies to forward to the origin for this cache behavior. **Sample:** none |
| | | | **whitelisted\_names** complex | when *forward=whitelist* | The names of the cookies to forward to the origin for this cache behavior. |
| | | | | **items** list / elements=string | when list is not empty | List of cookies to forward. **Sample:** my\_cookie |
| | | | | **quantity** integer | always | Count of cookies to forward. **Sample:** 1 |
| | | **headers** complex | always | Which headers are used to vary on cache retrievals. |
| | | | **items** list / elements=string | when list is not empty | List of headers to vary on. **Sample:** ['Host'] |
| | | | **quantity** integer | always | Count of headers to vary on. **Sample:** 1 |
| | | **query\_string** boolean | always | Whether the query string is used in cache lookups. |
| | | **query\_string\_cache\_keys** complex | always | Which query string keys to use in cache lookups. |
| | | | **items** list / elements=string | when list is not empty | List of query string cache keys to use in cache lookups. |
| | | | **quantity** integer | always | Count of query string cache keys to use in cache lookups. **Sample:** 1 |
| | **lambda\_function\_associations** complex | always | Lambda function associations for a cache behavior. |
| | | **items** list / elements=string | when list is not empty | List of lambda function associations. **Sample:** [{'event\_type': 'viewer-response', 'lambda\_function\_arn': 'arn:aws:lambda:123456789012:us-east-1/lambda/lambda-function'}] |
| | | **quantity** integer | always | Count of lambda function associations. **Sample:** 1 |
| | **max\_ttl** integer | always | Maximum Time to Live. **Sample:** 31536000 |
| | **min\_ttl** integer | always | Minimum Time to Live. |
| | **path\_pattern** string | always | Path pattern that determines this cache behavior. **Sample:** /path/to/files/\* |
| | **smooth\_streaming** boolean | always | Whether smooth streaming is enabled. |
| | **target\_origin\_id** string | always | ID of origin reference by this cache behavior. **Sample:** origin\_abcd |
| | **trusted\_signers** complex | always | Trusted signers. |
| | | **enabled** boolean | always | Whether trusted signers are enabled for this cache behavior. |
| | | **quantity** integer | always | Count of trusted signers. **Sample:** 1 |
| | **viewer\_protocol\_policy** string | always | Policy of how to handle http/https. **Sample:** redirect-to-https |
| **default\_root\_object** string | always | The object that you want CloudFront to request from your origin (for example, index.html) when a viewer requests the root URL for your distribution. |
| **diff** dictionary | always | Difference between previous configuration and new configuration. |
| **domain\_name** string | always | Domain name of CloudFront distribution. **Sample:** d1vz8pzgurxosf.cloudfront.net |
| **enabled** boolean | always | Whether the CloudFront distribution is enabled or not. **Sample:** True |
| **http\_version** string | always | Version of HTTP supported by the distribution. **Sample:** http2 |
| **id** string | always | CloudFront distribution ID. **Sample:** E123456ABCDEFG |
| **in\_progress\_invalidation\_batches** integer | always | The number of invalidation batches currently in progress. |
| **is\_ipv6\_enabled** boolean | always | Whether IPv6 is enabled. **Sample:** True |
| **last\_modified\_time** string | always | Date and time distribution was last modified. **Sample:** 2017-10-13T01:51:12.656000+00:00 |
| **logging** complex | always | Logging information. |
| | **bucket** string | always | S3 bucket logging destination. **Sample:** logs-example-com.s3.amazonaws.com |
| | **enabled** boolean | always | Whether logging is enabled. **Sample:** True |
| | **include\_cookies** boolean | always | Whether to log cookies. |
| | **prefix** string | always | Prefix added to logging object names. **Sample:** cloudfront/test |
| **origins** complex | always | Origins in the CloudFront distribution. |
| | **items** complex | always | List of origins. |
| | | **custom\_headers** complex | always | Custom headers passed to the origin. |
| | | | **quantity** integer | always | Count of headers. **Sample:** 1 |
| | | **custom\_origin\_config** complex | always | Configuration of the origin. |
| | | | **http\_port** integer | always | Port on which HTTP is listening. **Sample:** 80 |
| | | | **https\_port** integer | always | Port on which HTTPS is listening. **Sample:** 443 |
| | | | **origin\_keepalive\_timeout** integer | always | Keep-alive timeout. **Sample:** 5 |
| | | | **origin\_protocol\_policy** string | always | Policy of which protocols are supported. **Sample:** https-only |
| | | | **origin\_read\_timeout** integer | always | Timeout for reads to the origin. **Sample:** 30 |
| | | | **origin\_ssl\_protocols** complex | always | SSL protocols allowed by the origin. |
| | | | | **items** list / elements=string | always | List of SSL protocols. **Sample:** ['TLSv1', 'TLSv1.1', 'TLSv1.2'] |
| | | | | **quantity** integer | always | Count of SSL protocols. **Sample:** 3 |
| | | **domain\_name** string | always | Domain name of the origin. **Sample:** test-origin.example.com |
| | | **id** string | always | ID of the origin. **Sample:** test-origin.example.com |
| | | **origin\_path** string | always | Subdirectory to prefix the request from the S3 or HTTP origin. |
| | **quantity** integer | always | Count of origins. **Sample:** 1 |
| **price\_class** string | always | Price class of CloudFront distribution. **Sample:** PriceClass\_All |
| **restrictions** complex | always | Restrictions in use by CloudFront. |
| | **geo\_restriction** complex | always | Controls the countries in which your content is distributed. |
| | | **items** list / elements=string | always | List of country codes allowed or disallowed. **Sample:** xy |
| | | **quantity** integer | always | Count of restrictions. **Sample:** 1 |
| | | **restriction\_type** string | always | Type of restriction. **Sample:** blacklist |
| **status** string | always | Status of the CloudFront distribution. **Sample:** InProgress |
| **tags** dictionary | always | Distribution tags. **Sample:** {'Hello': 'World'} |
| **viewer\_certificate** complex | always | Certificate used by CloudFront distribution. |
| | **acm\_certificate\_arn** string | when certificate comes from ACM | ARN of ACM certificate. **Sample:** arn:aws:acm:us-east-1:123456789012:certificate/abcd1234-1234-1234-abcd-123456abcdef |
| | **certificate** string | always | Reference to certificate. **Sample:** arn:aws:acm:us-east-1:123456789012:certificate/abcd1234-1234-1234-abcd-123456abcdef |
| | **certificate\_source** string | always | Where certificate comes from. **Sample:** acm |
| | **minimum\_protocol\_version** string | always | Minimum SSL/TLS protocol supported by this distribution. **Sample:** TLSv1 |
| | **ssl\_support\_method** string | always | Support for pre-SNI browsers or not. **Sample:** sni-only |
| **web\_acl\_id** string | always | ID of Web Access Control List (from WAF service). **Sample:** abcd1234-1234-abcd-abcd-abcd12345678 |
### Authors
* Willem van Ketwich (@wilvk)
* Will Thames (@willthames)
| programming_docs |
ansible community.aws.aws_batch_job_queue – Manage AWS Batch Job Queues community.aws.aws\_batch\_job\_queue – Manage AWS Batch Job Queues
==================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.aws_batch_job_queue`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module allows the management of AWS Batch Job Queues.
* It is idempotent and supports “Check” mode.
* Use module [community.aws.aws\_batch\_compute\_environment](aws_batch_compute_environment_module#ansible-collections-community-aws-aws-batch-compute-environment-module) to manage the compute environment, [community.aws.aws\_batch\_job\_queue](#ansible-collections-community-aws-aws-batch-job-queue-module) to manage job queues, [community.aws.aws\_batch\_job\_definition](aws_batch_job_definition_module#ansible-collections-community-aws-aws-batch-job-definition-module) to manage job definitions.
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **compute\_environment\_order** list / elements=dictionary / required | | The set of compute environments mapped to a job queue and their order relative to each other. The job scheduler uses this parameter to determine which compute environment should execute a given job. Compute environments must be in the VALID state before you can associate them with a job queue. You can associate up to 3 compute environments with a job queue. |
| | **compute\_environment** string | | The name of the compute environment. |
| | **order** integer | | The relative priority of the environment. |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **job\_queue\_name** string / required | | The name for the job queue |
| **job\_queue\_state** string | **Choices:*** **ENABLED** ←
* DISABLED
| The state of the job queue. If the job queue state is ENABLED, it is able to accept jobs. |
| **priority** integer / required | | The priority of the job queue. Job queues with a higher priority (or a lower integer value for the priority parameter) are evaluated first when associated with same compute environment. Priority is determined in ascending order, for example, a job queue with a priority value of 1 is given scheduling preference over a job queue with a priority value of 10. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** **present** ←
* absent
| Describes the desired state. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
- name: My Batch Job Queue
community.aws.aws_batch_job_queue:
job_queue_name: jobQueueName
state: present
region: us-east-1
job_queue_state: ENABLED
priority: 1
compute_environment_order:
- order: 1
compute_environment: my_compute_env1
- order: 2
compute_environment: my_compute_env2
register: batch_job_queue_action
- name: show results
ansible.builtin.debug:
var: batch_job_queue_action
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **output** dictionary | always | returns what action was taken, whether something was changed, invocation and response **Sample:** {'batch\_job\_queue\_action': 'updated', 'changed': False, 'response': {'job\_queue\_arn': 'arn:aws:batch:....', 'job\_queue\_name': '<name>', 'priority': 1, 'state': 'DISABLED', 'status': 'UPDATING', 'status\_reason': 'JobQueue Healthy'}} |
### Authors
* Jon Meran (@jonmer85)
ansible community.aws.aws_ses_rule_set – Manages SES inbound receipt rule sets community.aws.aws\_ses\_rule\_set – Manages SES inbound receipt rule sets
=========================================================================
Note
This plugin is part of the [community.aws collection](https://galaxy.ansible.com/community/aws) (version 1.5.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.aws`.
To use it in a playbook, specify: `community.aws.aws_ses_rule_set`.
New in version 1.0.0: of community.aws
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* The [community.aws.aws\_ses\_rule\_set](#ansible-collections-community-aws-aws-ses-rule-set-module) module allows you to create, delete, and manage SES receipt rule sets
Requirements
------------
The below requirements are needed on the host that executes this module.
* boto
* boto3
* botocore
* python >= 2.6
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **active** boolean | **Choices:*** no
* yes
| Whether or not this rule set should be the active rule set. Only has an impact if *state* is `present`. If omitted, the active rule set will not be changed. If `True` then this rule set will be made active and all others inactive. if `False` then this rule set will be deactivated. Be careful with this as you can end up with no active rule set. |
| **aws\_access\_key** string | | AWS access key. If not set then the value of the AWS\_ACCESS\_KEY\_ID, AWS\_ACCESS\_KEY or EC2\_ACCESS\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_access\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_access\_key, access\_key |
| **aws\_ca\_bundle** path | | The location of a CA Bundle to use when validating SSL certificates. Only used for boto3 based modules. Note: The CA Bundle is read 'module' side and may need to be explicitly copied from the controller if not run locally. |
| **aws\_config** dictionary | | A dictionary to modify the botocore configuration. Parameters can be found at <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>. Only the 'user\_agent' key is used for boto modules. See <http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto> for more boto configuration. |
| **aws\_secret\_key** string | | AWS secret key. If not set then the value of the AWS\_SECRET\_ACCESS\_KEY, AWS\_SECRET\_KEY, or EC2\_SECRET\_KEY environment variable is used. If *profile* is set this parameter is ignored. Passing the *aws\_secret\_key* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: ec2\_secret\_key, secret\_key |
| **debug\_botocore\_endpoint\_logs** boolean | **Choices:*** **no** ←
* yes
| Use a botocore.endpoint logger to parse the unique (rather than total) "resource:action" API calls made during a task, outputing the set to the resource\_actions key in the task results. Use the aws\_resource\_action callback to output to total list made during a playbook. The ANSIBLE\_DEBUG\_BOTOCORE\_LOGS environment variable may also be used. |
| **ec2\_url** string | | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2\_URL environment variable, if any, is used.
aliases: aws\_endpoint\_url, endpoint\_url |
| **force** boolean | **Choices:*** **no** ←
* yes
| When deleting a rule set, deactivate it first (AWS prevents deletion of the active rule set). |
| **name** string / required | | The name of the receipt rule set. |
| **profile** string | | Uses a boto profile. Only works with boto >= 2.24.0. Using *profile* will override *aws\_access\_key*, *aws\_secret\_key* and *security\_token* and support for passing them at the same time as *profile* has been deprecated.
*aws\_access\_key*, *aws\_secret\_key* and *security\_token* will be made mutually exclusive with *profile* after 2022-06-01.
aliases: aws\_profile |
| **region** string | | The AWS region to use. If not specified then the value of the AWS\_REGION or EC2\_REGION environment variable, if any, is used. See <http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region>
aliases: aws\_region, ec2\_region |
| **security\_token** string | | AWS STS security token. If not set then the value of the AWS\_SECURITY\_TOKEN or EC2\_SECURITY\_TOKEN environment variable is used. If *profile* is set this parameter is ignored. Passing the *security\_token* and *profile* options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.
aliases: aws\_security\_token, access\_token |
| **state** string | **Choices:*** absent
* **present** ←
| Whether to create (or update) or destroy the receipt rule set. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
Notes
-----
Note
* If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence `AWS_URL` or `EC2_URL`, `AWS_PROFILE` or `AWS_DEFAULT_PROFILE`, `AWS_ACCESS_KEY_ID` or `AWS_ACCESS_KEY` or `EC2_ACCESS_KEY`, `AWS_SECRET_ACCESS_KEY` or `AWS_SECRET_KEY` or `EC2_SECRET_KEY`, `AWS_SECURITY_TOKEN` or `EC2_SECURITY_TOKEN`, `AWS_REGION` or `EC2_REGION`, `AWS_CA_BUNDLE`
* Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See <https://boto.readthedocs.io/en/latest/boto_config_tut.html>
* `AWS_REGION` or `EC2_REGION` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
Examples
--------
```
# Note: None of these examples set aws_access_key, aws_secret_key, or region.
# It is assumed that their matching environment variables are set.
---
- name: Create default rule set and activate it if not already
community.aws.aws_ses_rule_set:
name: default-rule-set
state: present
active: yes
- name: Create some arbitrary rule set but do not activate it
community.aws.aws_ses_rule_set:
name: arbitrary-rule-set
state: present
- name: Explicitly deactivate the default rule set leaving no active rule set
community.aws.aws_ses_rule_set:
name: default-rule-set
state: present
active: no
- name: Remove an arbitrary inactive rule set
community.aws.aws_ses_rule_set:
name: arbitrary-rule-set
state: absent
- name: Remove an ruleset even if we have to first deactivate it to remove it
community.aws.aws_ses_rule_set:
name: default-rule-set
state: absent
force: yes
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **active** boolean | success if *state* is `present` | if the SES rule set is active **Sample:** True |
| **rule\_sets** list / elements=string | success | The list of SES receipt rule sets that exist after any changes. **Sample:** [{'created\_timestamp': '2018-02-25T01:20:32.690000+00:00', 'name': 'default-rule-set'}] |
### Authors
* Ben Tomasik (@tomislacker)
* Ed Costello (@orthanc)
ansible Community.Skydive Community.Skydive
=================
Collection version 1.0.0
Plugin Index
------------
These are the plugins in the community.skydive collection
### Lookup Plugins
* [skydive](skydive_lookup#ansible-collections-community-skydive-skydive-lookup) – Query Skydive objects
### Modules
* [skydive\_capture](skydive_capture_module#ansible-collections-community-skydive-skydive-capture-module) – Module which manages flow capture on interfaces
* [skydive\_edge](skydive_edge_module#ansible-collections-community-skydive-skydive-edge-module) – Module to add edges to Skydive topology
* [skydive\_node](skydive_node_module#ansible-collections-community-skydive-skydive-node-module) – Module which add nodes to Skydive topology
See also
List of [collections](../../index#list-of-collections) with docs hosted here.
ansible community.skydive.skydive_node – Module which add nodes to Skydive topology community.skydive.skydive\_node – Module which add nodes to Skydive topology
============================================================================
Note
This plugin is part of the [community.skydive collection](https://galaxy.ansible.com/community/skydive) (version 1.0.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.skydive`.
To use it in a playbook, specify: `community.skydive.skydive_node`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module handles adding node to the Skydive topology.
Requirements
------------
The below requirements are needed on the host that executes this module.
* skydive-client
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **host** string | | To define host for the node. |
| **metadata** string | | To define metadata for the node. |
| **name** string / required | | To define name for the node. |
| **node\_type** string / required | | To define type for the node. |
| **provider** string | | A dict object containing connection details. |
| | **endpoint** string / required | | Specifies the hostname/address along with the port as `localhost:8082`for connecting to the remote instance of SKYDIVE client over the REST API. |
| | **insecure** boolean | **Choices:*** **no** ←
* yes
| Ignore SSL certification verification. |
| | **password** string | | Specifies the password to use to authenticate the connection to the remote instance of SKYDIVE client. |
| | **ssl** boolean | **Choices:*** **no** ←
* yes
| Specifies the ssl parameter that decides if the connection type shall be http or https. |
| | **user** string | | Configures the username to use to authenticate the connection to the remote instance of SKYDIVE client. |
| **seed** string | **Default:**"" | used to generate the UUID of the node |
| **state** string | **Choices:*** **present** ←
* update
* absent
| State of the Skydive Node. If value is *present* new node will be created else if it is *absent* it will be deleted. |
Notes
-----
Note
* This module must be run locally, which can be achieved by specifying `connection: local`.
Examples
--------
```
- name: create tor node
community.skydive.skydive_node:
name: TOR
node_type: fabric
seed: TOR1
metadata:
Model: Cisco 5300
state: present
provider:
endpoint: localhost:8082
username: admin
password: admin
- name: update tor node
community.skydive.skydive_node:
name: TOR
node_type: host
seed: TOR1
metadata:
Model: Cisco 3400
state: update
provider:
endpoint: localhost:8082
username: admin
password: admin
- name: Delete the tor node
community.skydive.skydive_node:
name: TOR
node_type: host
seed: TOR1
metadata:
Model: Cisco 3400
state: absent
provider:
endpoint: localhost:8082
username: admin
password: admin
```
### Authors
* Sumit Jaiswal (@sjaiswal)
| programming_docs |
ansible community.skydive.skydive – Query Skydive objects community.skydive.skydive – Query Skydive objects
=================================================
Note
This plugin is part of the [community.skydive collection](https://galaxy.ansible.com/community/skydive) (version 1.0.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.skydive`.
To use it in a playbook, specify: `community.skydive.skydive`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Uses the Skydive python REST client to return the queried object from Skydive network analyzer.
Requirements
------------
The below requirements are needed on the local controller node that executes this lookup.
* skydive-client
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **filter** string | | | a dict object that is used to filter the return objects |
| **provider** string | | | A dict object containing connection details. |
| | **endpoint** string / required | | | Specifies the hostname/address along with the port as `localhost:8082`for connecting to the remote instance of SKYDIVE client over the REST API. |
| | **insecure** boolean | **Choices:*** **no** ←
* yes
| | Ignore SSL certification verification. |
| | **password** string | | | Specifies the password to use to authenticate the connection to the remote instance of SKYDIVE client. |
| | **ssl** boolean | **Choices:*** **no** ←
* yes
| | Specifies the ssl parameter that decides if the connection type shall be http or https. |
| | **user** string | | | Configures the username to use to authenticate the connection to the remote instance of SKYDIVE client. |
Notes
-----
Note
* This module must be run locally, which can be achieved by specifying `connection: local`.
Examples
--------
```
- name: return skydive metdata if present based on Name
set_fact:
skydive_meta: >-
{{ lookup('community.skydive.skydive', filter={'query': "G.V().Has('Name', 'sumit-VirtualBox')"}) }}
- name: return all the skydive metdata having parameter Name
set_fact:
skydive: >-
{{ lookup('community.skydive.skydive', filter={'query': "G.V().Has('Name')"},
provider={'endpoint': 'localhost:8082', 'username': 'admin', 'password': 'password'}) }}
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_list** list / elements=string | always | The list of queried object metadata |
ansible community.skydive.skydive_edge – Module to add edges to Skydive topology community.skydive.skydive\_edge – Module to add edges to Skydive topology
=========================================================================
Note
This plugin is part of the [community.skydive collection](https://galaxy.ansible.com/community/skydive) (version 1.0.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.skydive`.
To use it in a playbook, specify: `community.skydive.skydive_edge`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module handles setting up edges between two nodes based on the relationship type to the Skydive topology.
Requirements
------------
The below requirements are needed on the host that executes this module.
* skydive-client
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **child\_node** string / required | | To defined the second node of the link, it can be either an ID or a gremlin expression |
| **host** string | **Default:**"" | To define the host of the node. |
| **metadata** string | | To define metadata for the edge. |
| **parent\_node** string / required | | To defined the first node of the link, it can be either an ID or a gremlin expression |
| **provider** string | | A dict object containing connection details. |
| | **endpoint** string / required | | Specifies the hostname/address along with the port as `localhost:8082`for connecting to the remote instance of SKYDIVE client over the REST API. |
| | **insecure** boolean | **Choices:*** **no** ←
* yes
| Ignore SSL certification verification. |
| | **password** string | | Specifies the password to use to authenticate the connection to the remote instance of SKYDIVE client. |
| | **ssl** boolean | **Choices:*** **no** ←
* yes
| Specifies the ssl parameter that decides if the connection type shall be http or https. |
| | **user** string | | Configures the username to use to authenticate the connection to the remote instance of SKYDIVE client. |
| **relation\_type** string / required | | To define relation type of the node *ownership, layer2, layer3*. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the Skydive Edge. If value is *present* new edge will be created else if it is *absent* it will be deleted. |
Notes
-----
Note
* This module must be run locally, which can be achieved by specifying `connection: local`.
Examples
--------
```
- name: create tor
community.skydive.skydive_node:
name: 'TOR'
node_type: "fabric"
seed: TOR
metadata:
Model: Cisco xxxx
provider:
endpoint: localhost:8082
username: admin
password: admin
register: tor_result
- name: create port 1
community.skydive.skydive_node:
name: 'PORT1'
node_type: 'fabric'
seed: PORT1
provider:
endpoint: localhost:8082
username: admin
password: admin
register: port1_result
- name: create port 2
community.skydive.skydive_node:
name: 'PORT2'
node_type: 'fabric'
seed: PORT2
provider:
endpoint: localhost:8082
username: admin
password: admin
register: port2_result
- name: link node tor and port 1
community.skydive.skydive_edge:
parent_node: "{{ tor_result.UUID }}"
child_node: "{{ port1_result.UUID }}"
relation_type: ownership
state: present
provider:
endpoint: localhost:8082
username: admin
password: admin
- name: link node tor and port 2
community.skydive.skydive_edge:
parent_node: "{{ tor_result.UUID }}"
child_node: "{{ port2_result.UUID }}"
relation_type: ownership
state: present
provider:
endpoint: localhost:8082
username: admin
password: admin
- name: update link node tor and port 1 relation
community.skydive.skydive_edge:
parent_node: "{{ tor_result.UUID }}"
child_node: "{{ port2_result.UUID }}"
relation_type: layer2
state: upadte
provider:
endpoint: localhost:8082
username: admin
password: admin
- name: Unlink tor and port 2
community.skydive.skydive_edge:
parent_node: "{{ tor_result.UUID }}"
child_node: "{{ port2_result.UUID }}"
relation_type: ownership
state: absent
provider:
endpoint: localhost:8082
username: admin
password: admin
- name: link tor and port 2 via Gremlin expression
community.skydive.skydive_edge:
parent_node: G.V().Has('Name', 'TOR')
child_node: G.V().Has('Name', 'PORT2')
relation_type: ownership
state: present
provider:
endpoint: localhost:8082
username: admin
password: admin
- name: Unlink tor and port 2 via Gremlin expression
community.skydive.skydive_edge:
parent_node: G.V().Has('Name', 'TOR')
child_node: G.V().Has('Name', 'PORT2')
relation_type: ownership
state: absent
provider:
endpoint: localhost:8082
username: admin
password: admin
```
### Authors
* Sumit Jaiswal (@sjaiswal)
ansible community.skydive.skydive_capture – Module which manages flow capture on interfaces community.skydive.skydive\_capture – Module which manages flow capture on interfaces
====================================================================================
Note
This plugin is part of the [community.skydive collection](https://galaxy.ansible.com/community/skydive) (version 1.0.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.skydive`.
To use it in a playbook, specify: `community.skydive.skydive_capture`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module manages flow capture on interfaces. The Gremlin expression is continuously evaluated which means that it is possible to define a capture on nodes that do not exist yet.
* It is useful when you want to start a capture on all OpenvSwitch whatever the number of Skydive agents you will start.
* While starting the capture, user can specify the capture name, capture description and capture type optionally.
Requirements
------------
The below requirements are needed on the host that executes this module.
* skydive-client
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **capture\_name** string | **Default:**"" | To define flow capture name. |
| **description** string | **Default:**"" | Configures a text string to be associated with the instance of this object. |
| **extra\_tcp\_metric** boolean | **Choices:*** **no** ←
* yes
| To define flow capture ExtraTCPMetric. |
| **interface\_name** string | | To define flow capture interface name. |
| **ip\_defrag** boolean | **Choices:*** **no** ←
* yes
| To define flow capture IPDefrag. |
| **layer\_key\_mode** string | **Default:**"L2" | To define flow capture Layer KeyMode. |
| **provider** string | | A dict object containing connection details. |
| | **endpoint** string / required | | Specifies the hostname/address along with the port as `localhost:8082`for connecting to the remote instance of SKYDIVE client over the REST API. |
| | **insecure** boolean | **Choices:*** **no** ←
* yes
| Ignore SSL certification verification. |
| | **password** string | | Specifies the password to use to authenticate the connection to the remote instance of SKYDIVE client. |
| | **ssl** boolean | **Choices:*** **no** ←
* yes
| Specifies the ssl parameter that decides if the connection type shall be http or https. |
| | **user** string | | Configures the username to use to authenticate the connection to the remote instance of SKYDIVE client. |
| **query** string | | It's the complete gremlin query which the users can input, *G.V(*.Has('Name', 'eth0', 'Type', 'device')), to create the capture. And, if the user directly inputs the gremlin query then user is not required to input any other module parameter as gremlin query takes care of creating the flow capture. |
| **reassemble\_tcp** boolean | **Choices:*** **no** ←
* yes
| To define flow capture ReassembleTCP. |
| **state** string | **Choices:*** **present** ←
* absent
| State of the flow capture. If value is *present* flow capture will be created else if it is *absent* it will be deleted. |
| **type** string | | To define flow capture interface type. |
Notes
-----
Note
* This module must be run locally, which can be achieved by specifying `connection: local`.
Examples
--------
```
- name: start a new flow capture directly from gremlin query
community.skydive.skydive_capture:
query: G.V().Has('Name', 'eth0', 'Type', 'device')
state: present
provider:
endpoint: localhost:8082
username: admin
password: admin
- name: stop the flow capture directly from gremlin query
community.skydive.skydive_capture:
query: G.V().Has('Name', 'eth0', 'Type', 'device')
state: absent
provider:
endpoint: localhost:8082
username: admin
password: admin
- name: start a new flow capture from user's input
community.skydive.skydive_capture:
interface_name: Node1
type: myhost
capture_name: test_capture
description: test description
extra_tcp_metric: true
ip_defrag: true
reassemble_tcp: true
state: present
provider:
endpoint: localhost:8082
username: admin
password: admin
- name: stop the flow capture
community.skydive.skydive_capture:
interface_name: Node1
type: myhost
capture_name: test_capture
description: test description
extra_tcp_metric: true
ip_defrag: true
reassemble_tcp: true
state: absent
provider:
endpoint: localhost:8082
username: admin
password: admin
```
### Authors
* Sumit Jaiswal (@sjaiswal)
ansible community.windows.win_scheduled_task – Manage scheduled tasks community.windows.win\_scheduled\_task – Manage scheduled tasks
===============================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_scheduled_task`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Creates/modifies or removes Windows scheduled tasks.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **actions** list / elements=string | | A list of action to configure for the task. See suboptions for details on how to construct each list entry. When creating a task there MUST be at least one action but when deleting a task this can be a null or an empty list. The ordering of this list is important, the module will ensure the order is kept when modifying the task. This module only supports the `ExecAction` type but can still delete the older legacy types. |
| | **arguments** string | | An argument string to supply for the executable. |
| | **path** string / required | | The path to the executable for the ExecAction. |
| | **working\_directory** string | | The working directory to run the executable from. |
| **allow\_demand\_start** boolean | **Choices:*** no
* yes
| Whether the task can be started by using either the Run command or the Context menu. |
| **allow\_hard\_terminate** boolean | **Choices:*** no
* yes
| Whether the task can be terminated by using TerminateProcess. |
| **author** string | | The author of the task. |
| **compatibility** integer | **Choices:*** 0
* 1
* 2
* 3
* 4
| The integer value with indicates which version of Task Scheduler a task is compatible with.
`0` means the task is compatible with the AT command.
`1` means the task is compatible with Task Scheduler 1.0(Windows Vista, Windows Server 2008 and older).
`2` means the task is compatible with Task Scheduler 2.0(Windows Vista, Windows Server 2008).
`3` means the task is compatible with Task Scheduler 2.0(Windows 7, Windows Server 2008 R2).
`4` means the task is compatible with Task Scheduler 2.0(Windows 10, Windows Server 2016, Windows Server 2019). |
| **date** string | | The date when the task was registered. |
| **delete\_expired\_task\_after** string | | The amount of time that the Task Scheduler will wait before deleting the task after it expires. A task expires after the end\_boundary has been exceeded for all triggers associated with the task. This is in the ISO 8601 Duration format `P[n]Y[n]M[n]DT[n]H[n]M[n]S`. |
| **description** string | | The description of the task. |
| **disallow\_start\_if\_on\_batteries** boolean | **Choices:*** no
* yes
| Whether the task will not be started if the computer is running on battery power. |
| **display\_name** string | | The name of the user/group that is displayed in the Task Scheduler UI. |
| **enabled** boolean | **Choices:*** no
* yes
| Whether the task is enabled, the task can only run when `yes`. |
| **execution\_time\_limit** string | | The amount of time allowed to complete the task. When set to `PT0S`, the time limit is infinite. When omitted, the default time limit is 72 hours. This is in the ISO 8601 Duration format `P[n]Y[n]M[n]DT[n]H[n]M[n]S`. |
| **group** string | | The group that will run the task.
`group` and `username` are exclusive to each other and cannot be set at the same time.
`logon_type` can either be not set or equal `group`. |
| **hidden** boolean | **Choices:*** no
* yes
| Whether the task will be hidden in the UI. |
| **logon\_type** string | **Choices:*** none
* password
* s4u
* interactive\_token
* group
* service\_account
* token\_or\_password
| The logon method that the task will run with.
`password` means the password will be stored and the task has access to network resources.
`s4u` means the existing token will be used to run the task and no password will be stored with the task. Means no network or encrypted files access.
`interactive_token` means the user must already be logged on interactively and will run in an existing interactive session.
`group` means that the task will run as a group.
`service_account` means that a service account like System, Local Service or Network Service will run the task. |
| **multiple\_instances** integer | **Choices:*** 0
* 1
* 2
* 3
| An integer that indicates the behaviour when starting a task that is already running.
`0` will start a new instance in parallel with existing instances of that task.
`1` will wait until other instances of that task to finish running before starting itself.
`2` will not start a new instance if another is running.
`3` will stop other instances of the task and start the new one. |
| **name** string / required | | The name of the scheduled task without the path. |
| **password** string | | The password for the user account to run the scheduled task as. This is required when running a task without the user being logged in, excluding the builtin service accounts and Group Managed Service Accounts (gMSA). If set, will always result in a change unless `update_password` is set to `no` and no other changes are required for the service. |
| **path** string | **Default:**"\\" | Task folder in which this task will be stored. Will create the folder when `state=present` and the folder does not already exist. Will remove the folder when `state=absent` and there are no tasks left in the folder. |
| **priority** integer | | The priority level (0-10) of the task. When creating a new task the default is `7`. See <https://msdn.microsoft.com/en-us/library/windows/desktop/aa383512.aspx> for details on the priority levels. |
| **restart\_count** integer | | The number of times that the Task Scheduler will attempt to restart the task. |
| **restart\_interval** string | | How long the Task Scheduler will attempt to restart the task. If this is set then `restart_count` must also be set. The maximum allowed time is 31 days. The minimum allowed time is 1 minute. This is in the ISO 8601 Duration format `P[n]Y[n]M[n]DT[n]H[n]M[n]S`. |
| **run\_level** string | **Choices:*** limited
* highest
| The level of user rights used to run the task. If not specified the task will be created with limited rights.
aliases: runlevel |
| **run\_only\_if\_idle** boolean | **Choices:*** no
* yes
| Whether the task will run the task only if the computer is in an idle state. |
| **run\_only\_if\_network\_available** boolean | **Choices:*** no
* yes
| Whether the task will run only when a network is available. |
| **source** string | | The source of the task. |
| **start\_when\_available** boolean | **Choices:*** no
* yes
| Whether the task can start at any time after its scheduled time has passed. |
| **state** string | **Choices:*** absent
* **present** ←
| When `state=present` will ensure the task exists. When `state=absent` will ensure the task does not exist. |
| **stop\_if\_going\_on\_batteries** boolean | **Choices:*** no
* yes
| Whether the task will be stopped if the computer begins to run on battery power. |
| **triggers** list / elements=string | | A list of triggers to configure for the task. See suboptions for details on how to construct each list entry. The ordering of this list is important, the module will ensure the order is kept when modifying the task. There are multiple types of triggers, see <https://msdn.microsoft.com/en-us/library/windows/desktop/aa383868.aspx> for a list of trigger types and their options. The suboption options listed below are not required for all trigger types, read the description for more details. |
| | **days\_of\_month** string | | The days of the month from 1 to 31 for the triggers. If you wish to set the trigger for the last day of any month use `run_on_last_day_of_month`. Can be a list or comma separated string of day numbers. Required when `type=monthly`. |
| | **days\_of\_week** string | | The days of the week for the trigger. Can be a list or comma separated string of full day names e.g. monday instead of mon. Required when `type` is `weekly`. Optional when `type=monthlydow`. |
| | **delay** string | | The time to delay the task from running once the trigger has been fired. Optional when `type` is `boot`, `event`, `logon`, `registration`, `session_state_change`. Is in the ISO 8601 Duration format `P[n]Y[n]M[n]DT[n]H[n]M[n]S`. |
| | **enabled** boolean | **Choices:*** no
* yes
| Whether to set the trigger to enabled or disabled Used in all trigger types. |
| | **end\_boundary** string | | The end time for when the trigger is deactivated. This is in ISO 8601 DateTime format `YYYY-MM-DDThh:mm:ss`. |
| | **execution\_time\_limit** string | | The maximum amount of time that the task is allowed to run for. Optional for all the trigger types. Is in the ISO 8601 Duration format `P[n]Y[n]M[n]DT[n]H[n]M[n]S`. |
| | **months\_of\_year** string | | The months of the year for the trigger. Can be a list or comma separated string of full month names e.g. march instead of mar. Optional when `type` is `monthlydow`, `monthly`. |
| | **random\_delay** string | | The delay time that is randomly added to the start time of the trigger. Optional when `type` is `daily`, `monthlydow`, `monthly`, `time`, `weekly`. Is in the ISO 8601 Duration format `P[n]Y[n]M[n]DT[n]H[n]M[n]S`. |
| | **repetition** string | | Allows you to define the repetition action of the trigger that defines how often the task is run and how long the repetition pattern is repeated after the task is started. It takes in the following keys, `duration`, `interval`, `stop_at_duration_end`
|
| | | **duration** string | | Defines how long the pattern is repeated. The value is in the ISO 8601 Duration format `P[n]Y[n]M[n]DT[n]H[n]M[n]S`. By default this is not set which means it will repeat indefinitely. |
| | | **interval** string | | The amount of time between each restart of the task. The value is written in the ISO 8601 Duration format `P[n]Y[n]M[n]DT[n]H[n]M[n]S`. |
| | | **stop\_at\_duration\_end** boolean | **Choices:*** no
* yes
| Whether a running instance of the task is stopped at the end of the repetition pattern. |
| | **run\_on\_last\_day\_of\_month** boolean | **Choices:*** no
* yes
| Boolean value that sets whether the task runs on the last day of the month. Optional when `type` is `monthly`. |
| | **run\_on\_last\_week\_of\_month** boolean | **Choices:*** no
* yes
| Boolean value that sets whether the task runs on the last week of the month. Optional when `type` is `monthlydow`. |
| | **start\_boundary** string | | The start time for the task, even if the trigger meets the other start criteria, it won't start until this time is met. If you wish to run a task at 9am on a day you still need to specify the date on which the trigger is activated, you can set any date even ones in the past. Required when `type` is `daily`, `monthlydow`, `monthly`, `time`, `weekly`. Optional for the rest of the trigger types. This is in ISO 8601 DateTime format `YYYY-MM-DDThh:mm:ss`. |
| | **state\_change** string added in 1.6.0 of community.windows | **Choices:*** console\_connect
* console\_disconnect
* remote\_connect
* remote\_disconnect
* session\_lock
* session\_unlock
| Allows you to define the kind of Terminal Server session change that triggers a task. Optional when `type=session_state_change`
|
| | **subscription** string | | Only used and is required for `type=event`. The XML query string that identifies the event that fires the trigger. |
| | **type** string / required | **Choices:*** boot
* daily
* event
* idle
* logon
* monthlydow
* monthly
* registration
* time
* weekly
* session\_state\_change
| The trigger type, this value controls what below options are required. |
| | **user\_id** string | | The username that the trigger will target. Optional when `type` is `logon`, `session_state_change`. Can be the username or SID of a user. When `type=logon` and you want the trigger to fire when a user in a group logs on, leave this as null and set `group` to the group you wish to trigger. |
| | **weeks\_interval** integer | | The interval of weeks to run on, e.g. `1` means every week while `2` means every other week. Optional when `type=weekly`. |
| | **weeks\_of\_month** string | | The weeks of the month for the trigger. Can be a list or comma separated string of the numbers 1 to 4 representing the first to 4th week of the month. Optional when `type=monthlydow`. |
| **update\_password** boolean | **Choices:*** no
* **yes** ←
| Whether to update the password even when not other changes have occurred. When `yes` will always result in a change when executing the module. |
| **username** string | | The user to run the scheduled task as. Will default to the current user under an interactive token if not specified during creation. The user account specified must have the `SeBatchLogonRight` logon right which can be added with [ansible.windows.win\_user\_right](../../ansible/windows/win_user_right_module).
aliases: user |
| **version** string | | The version number of the task. |
| **wake\_to\_run** boolean | **Choices:*** no
* yes
| Whether the task will wake the computer when it is time to run the task. |
Notes
-----
Note
* The option names and structure for actions and triggers of a service follow the `RegisteredTask` naming standard and requirements, it would be useful to read up on this guide if coming across any issues <https://msdn.microsoft.com/en-us/library/windows/desktop/aa382542.aspx>.
* A Group Managed Service Account (gMSA) can be used by setting `logon_type` to `password` and omitting the password parameter. For more information on gMSAs, see <https://techcommunity.microsoft.com/t5/Core-Infrastructure-and-Security/Windows-Server-2012-Group-Managed-Service-Accounts/ba-p/255910>
See Also
--------
See also
[community.windows.win\_scheduled\_task\_stat](win_scheduled_task_stat_module#ansible-collections-community-windows-win-scheduled-task-stat-module)
The official documentation on the **community.windows.win\_scheduled\_task\_stat** module.
[ansible.windows.win\_user\_right](../../ansible/windows/win_user_right_module#ansible-collections-ansible-windows-win-user-right-module)
The official documentation on the **ansible.windows.win\_user\_right** module.
Examples
--------
```
- name: Create a task to open 2 command prompts as SYSTEM
community.windows.win_scheduled_task:
name: TaskName
description: open command prompt
actions:
- path: cmd.exe
arguments: /c hostname
- path: cmd.exe
arguments: /c whoami
triggers:
- type: daily
start_boundary: '2017-10-09T09:00:00'
username: SYSTEM
state: present
enabled: yes
- name: Create task to run a PS script as NETWORK service on boot
community.windows.win_scheduled_task:
name: TaskName2
description: Run a PowerShell script
actions:
- path: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
arguments: -ExecutionPolicy Unrestricted -NonInteractive -File C:\TestDir\Test.ps1
triggers:
- type: boot
username: NETWORK SERVICE
run_level: highest
state: present
- name: Update Local Security Policy to allow users to run scheduled tasks
ansible.windows.win_user_right:
name: SeBatchLogonRight
users:
- LocalUser
- DOMAIN\NetworkUser
action: add
- name: Change above task to run under a domain user account, storing the passwords
community.windows.win_scheduled_task:
name: TaskName2
username: DOMAIN\User
password: Password
logon_type: password
- name: Change the above task again, choosing not to store the password
community.windows.win_scheduled_task:
name: TaskName2
username: DOMAIN\User
logon_type: s4u
- name: Change above task to use a gMSA, where the password is managed automatically
community.windows.win_scheduled_task:
name: TaskName2
username: DOMAIN\gMsaSvcAcct$
logon_type: password
- name: Create task with multiple triggers
community.windows.win_scheduled_task:
name: TriggerTask
path: \Custom
actions:
- path: cmd.exe
triggers:
- type: daily
- type: monthlydow
username: SYSTEM
- name: Set logon type to password but don't force update the password
community.windows.win_scheduled_task:
name: TriggerTask
path: \Custom
actions:
- path: cmd.exe
username: Administrator
password: password
update_password: no
- name: Disable a task that already exists
community.windows.win_scheduled_task:
name: TaskToDisable
enabled: no
- name: Create a task that will be repeated every minute for five minutes
community.windows.win_scheduled_task:
name: RepeatedTask
description: open command prompt
actions:
- path: cmd.exe
arguments: /c hostname
triggers:
- type: registration
repetition:
interval: PT1M
duration: PT5M
stop_at_duration_end: yes
- name: Create task to run a PS script in Windows 10 compatibility on boot with a delay of 1min
community.windows.win_scheduled_task:
name: TriggerTask
path: \Custom
actions:
- path: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
arguments: -ExecutionPolicy Unrestricted -NonInteractive -File C:\TestDir\Test.ps1
triggers:
- type: boot
delay: PT1M
username: SYSTEM
compatibility: 4
```
### Authors
* Peter Mounce (@petemounce)
* Jordan Borean (@jborean93)
| programming_docs |
ansible community.windows.win_pester – Run Pester tests on Windows hosts community.windows.win\_pester – Run Pester tests on Windows hosts
=================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_pester`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Run Pester tests on Windows hosts.
* Test files have to be available on the remote host.
Requirements
------------
The below requirements are needed on the host that executes this module.
* Pester
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **output\_file** string | | Generates an output test report. |
| **output\_format** string | **Default:**"NunitXML" | Format of the test report to be generated. This parameter is to be used with output\_file option. |
| **path** string / required | | Path to a pester test file or a folder where tests can be found. If the path is a folder, the module will consider all ps1 files as Pester tests. |
| **tags** list / elements=string | | Runs only tests in Describe blocks with specified Tags values. Accepts multiple comma separated tags. |
| **test\_parameters** dictionary | | Allows to specify parameters to the test script. |
| **version** string | | Minimum version of the pester module that has to be available on the remote host.
aliases: minimum\_version |
Examples
--------
```
- name: Get facts
ansible.windows.setup:
- name: Add Pester module
action:
module_name: "{{ 'community.windows.win_psmodule' if ansible_powershell_version >= 5 else 'chocolatey.chocolatey.win_chocolatey' }}"
name: Pester
state: present
- name: Run the pester test provided in the path parameter.
community.windows.win_pester:
path: C:\Pester
- name: Run the pester tests only for the tags specified.
community.windows.win_pester:
path: C:\Pester\TestScript.tests
tags: CI,UnitTests
# Run pesters tests files that are present in the specified folder
# ensure that the pester module version available is greater or equal to the version parameter.
- name: Run the pester test present in a folder and check the Pester module version.
community.windows.win_pester:
path: C:\Pester\test01.test.ps1
version: 4.1.0
- name: Run the pester test present in a folder with given script parameters.
community.windows.win_pester:
path: C:\Pester\test04.test.ps1
test_parameters:
Process: lsass
Service: bits
- name: Run the pester test present in a folder and generate NunitXML test result..
community.windows.win_pester:
path: C:\Pester\test04.test.ps1
output_file: c:\Pester\resullt\testresult.xml
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **output** list / elements=string | success | Results of the Pester tests. |
| **pester\_version** string | always | Version of the pester module found on the remote host. **Sample:** 4.3.1 |
### Authors
* Erwan Quelin (@equelin)
* Prasoon Karunan V (@prasoonkarunan)
ansible community.windows.win_rds_settings – Manage main settings of a Remote Desktop Gateway server community.windows.win\_rds\_settings – Manage main settings of a Remote Desktop Gateway server
==============================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_rds_settings`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Configure general settings of a Remote Desktop Gateway server.
Requirements
------------
The below requirements are needed on the host that executes this module.
* Windows Server 2008R2 (6.1) or higher.
* The Windows Feature “RDS-Gateway” must be enabled.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **certificate\_hash** string | | Certificate hash (thumbprint) for the Remote Desktop Gateway server. The certificate hash is the unique identifier for the certificate. |
| **enable\_only\_messaging\_capable\_clients** boolean | **Choices:*** no
* yes
| If enabled, only clients that support logon messages and administrator messages can connect. |
| **max\_connections** integer | | The maximum number of connections allowed. If set to `0`, no new connections are allowed. If set to `-1`, the number of connections is unlimited. |
| **ssl\_bridging** string | **Choices:*** https\_http
* https\_https
* none
| Specifies whether to use SSL Bridging.
`none`: no SSL bridging.
`https_http`: HTTPS-HTTP bridging.
`https_https`: HTTPS-HTTPS bridging. |
See Also
--------
See also
[community.windows.win\_rds\_cap](win_rds_cap_module#ansible-collections-community-windows-win-rds-cap-module)
The official documentation on the **community.windows.win\_rds\_cap** module.
[community.windows.win\_rds\_rap](win_rds_rap_module#ansible-collections-community-windows-win-rds-rap-module)
The official documentation on the **community.windows.win\_rds\_rap** module.
[community.windows.win\_rds\_settings](#ansible-collections-community-windows-win-rds-settings-module)
The official documentation on the **community.windows.win\_rds\_settings** module.
Examples
--------
```
- name: Configure the Remote Desktop Gateway
community.windows.win_rds_settings:
certificate_hash: B0D0FA8408FC67B230338FCA584D03792DA73F4C
max_connections: 50
notify:
- Restart TSGateway service
```
### Authors
* Kevin Subileau (@ksubileau)
ansible community.windows.win_dns_record – Manage Windows Server DNS records community.windows.win\_dns\_record – Manage Windows Server DNS records
======================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_dns_record`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* Manage DNS records within an existing Windows Server DNS zone.
Requirements
------------
The below requirements are needed on the host that executes this module.
* This module requires Windows 8, Server 2012, or newer.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **computer\_name** string | | Specifies a DNS server. You can specify an IP address or any value that resolves to an IP address, such as a fully qualified domain name (FQDN), host name, or NETBIOS name. |
| **name** string / required | | The name of the record. |
| **port** integer added in 1.0.0 of community.windows | | The port number of the record. Required when `type=SRV`. Supported only for `type=SRV`. |
| **priority** integer added in 1.0.0 of community.windows | | The priority number for each service in SRV record. Required when `type=SRV`. Supported only for `type=SRV`. |
| **state** string | **Choices:*** absent
* **present** ←
| Whether the record should exist or not. |
| **ttl** integer | **Default:**3600 | The "time to live" of the record, in seconds. Ignored when `state=absent`. Valid range is 1 - 31557600. Note that an Active Directory forest can specify a minimum TTL, and will dynamically "round up" other values to that minimum. |
| **type** string / required | **Choices:*** A
* AAAA
* CNAME
* NS
* PTR
* SRV
* TXT
| The type of DNS record to manage.
`SRV` was added in the 1.0.0 release of this collection.
`NS` was added in the 1.1.0 release of this collection.
`TXT` was added in the 1.6.0 release of this collection. |
| **value** list / elements=string | | The value(s) to specify. Required when `state=present`. When `type=PTR` only the partial part of the IP should be given. Multiple values can be passed when `type=NS`
aliases: values |
| **weight** integer added in 1.0.0 of community.windows | | Weightage given to each service record in SRV record. Required when `type=SRV`. Supported only for `type=SRV`. |
| **zone** string / required | | The name of the zone to manage (eg `example.com`). The zone must already exist. |
Examples
--------
```
# Demonstrate creating a matching A and PTR record.
- name: Create database server record
community.windows.win_dns_record:
name: "cgyl1404p.amer.example.com"
type: "A"
value: "10.1.1.1"
zone: "amer.example.com"
- name: Create matching PTR record
community.windows.win_dns_record:
name: "1.1.1"
type: "PTR"
value: "db1"
zone: "10.in-addr.arpa"
# Demonstrate replacing an A record with a CNAME
- name: Remove static record
community.windows.win_dns_record:
name: "db1"
type: "A"
state: absent
zone: "amer.example.com"
- name: Create database server alias
community.windows.win_dns_record:
name: "db1"
type: "CNAME"
value: "cgyl1404p.amer.example.com"
zone: "amer.example.com"
# Demonstrate creating multiple A records for the same name
- name: Create multiple A record values for www
community.windows.win_dns_record:
name: "www"
type: "A"
values:
- 10.0.42.5
- 10.0.42.6
- 10.0.42.7
zone: "example.com"
# Demonstrates a partial update (replace some existing values with new ones)
# for a pre-existing name
- name: Update www host with new addresses
community.windows.win_dns_record:
name: "www"
type: "A"
values:
- 10.0.42.5 # this old value was kept (others removed)
- 10.0.42.12 # this new value was added
zone: "example.com"
# Demonstrate creating a SRV record
- name: Creating a SRV record with port number and priority
community.windows.win_dns_record:
name: "test"
priority: 5
port: 995
state: present
type: "SRV"
weight: 2
value: "amer.example.com"
zone: "example.com"
# Demonstrate creating a NS record with multiple values
- name: Creating NS record
community.windows.win_dns_record:
name: "ansible.prog"
state: present
type: "NS"
values:
- 10.0.0.1
- 10.0.0.2
- 10.0.0.3
- 10.0.0.4
zone: "example.com"
# Demonstrate creating a TXT record
- name: Creating a TXT record with descriptive Text
community.windows.win_dns_record:
name: "test"
state: present
type: "TXT"
value: "justavalue"
zone: "example.com"
```
### Authors
* Sebastian Gruber (@sgruber94)
* John Nelson (@johnboy2)
ansible community.windows.win_dns_zone – Manage Windows Server DNS Zones community.windows.win\_dns\_zone – Manage Windows Server DNS Zones
==================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_dns_zone`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage Windows Server DNS Zones
* Adds, Removes and Modifies DNS Zones - Primary, Secondary, Forwarder & Stub
* Task should be delegated to a Windows DNS Server
Requirements
------------
The below requirements are needed on the host that executes this module.
* This module requires Windows Server 2012R2 or Newer
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **dns\_servers** list / elements=string | | Specifies an list of IP addresses of the primary servers of the zone. DNS queries for a forwarded zone are sent to primary servers. Required if l(type=secondary), l(type=forwarder) or l(type=stub), otherwise ignored. At least one server is required. |
| **dynamic\_update** string | **Choices:*** secure
* none
* nonsecureandsecure
| Specifies how a zone handles dynamic updates. Secure DNS updates are available only for Active Directory-integrated zones. When not specified during new zone creation, Windows will default this to l(none). |
| **forwarder\_timeout** integer | | Specifies a length of time, in seconds, that a DNS server waits for a remote DNS server to resolve a query. Accepts integer values between 0 and 15. If the provided value is not valid, it will be omitted and a warning will be issued. |
| **name** string / required | | Fully qualified name of the DNS zone. |
| **replication** string | **Choices:*** forest
* domain
* legacy
* none
| Specifies the replication scope for the DNS zone. l(replication=forest) will replicate the DNS zone to all domain controllers in the Active Directory forest. l(replication=domain) will replicate the DNS zone to all domain controllers in the Active Directory domain. l(replication=none) disables Active Directory integration and creates a local file with the name of the zone. This is the equivalent of selecting l(store the zone in Active Directory) in the GUI. |
| **state** string | **Choices:*** **present** ←
* absent
| Specifies the desired state of the DNS zone. When l(state=present) the module will attempt to create the specified DNS zone if it does not already exist. When l(state=absent), the module will remove the specified DNS zone and all subsequent DNS records. |
| **type** string | **Choices:*** primary
* secondary
* stub
* forwarder
| Specifies the type of DNS zone. When l(type=secondary), the DNS server will immediately attempt to perform a zone transfer from the servers in this list. If this initial transfer fails, then the zone will be left in an unworkable state. This module does not verify the initial transfer. |
Examples
--------
```
- name: Ensure primary zone is present
community.windows.win_dns_zone:
name: wpinner.euc.vmware.com
replication: domain
type: primary
state: present
- name: Ensure DNS zone is absent
community.windows.win_dns_zone:
name: jamals.euc.vmware.com
state: absent
- name: Ensure forwarder has specific DNS servers
community.windows.win_dns_zone:
name: jamals.euc.vmware.com
type: forwarder
dns_servers:
- 10.245.51.100
- 10.245.51.101
- 10.245.51.102
- name: Ensure stub zone has specific DNS servers
community.windows.win_dns_zone:
name: virajp.euc.vmware.com
type: stub
dns_servers:
- 10.58.2.100
- 10.58.2.101
- name: Ensure stub zone is converted to a secondary zone
community.windows.win_dns_zone:
name: virajp.euc.vmware.com
type: secondary
- name: Ensure secondary zone is present with no replication
community.windows.win_dns_zone:
name: dgemzer.euc.vmware.com
type: secondary
replication: none
dns_servers:
- 10.19.20.1
- name: Ensure secondary zone is converted to a primary zone
community.windows.win_dns_zone:
name: dgemzer.euc.vmware.com
type: primary
replication: none
dns_servers:
- 10.19.20.1
- name: Ensure primary DNS zone is present without replication
community.windows.win_dns_zone:
name: basavaraju.euc.vmware.com
replication: none
type: primary
- name: Ensure primary DNS zone has nonsecureandsecure dynamic updates enabled
community.windows.win_dns_zone:
name: basavaraju.euc.vmware.com
replication: none
dynamic_update: nonsecureandsecure
type: primary
- name: Ensure DNS zone is absent
community.windows.win_dns_zone:
name: marshallb.euc.vmware.com
state: absent
- name: Ensure DNS zones are absent
community.windows.win_dns_zone:
name: "{{ item }}"
state: absent
loop:
- jamals.euc.vmware.com
- dgemzer.euc.vmware.com
- wpinner.euc.vmware.com
- marshallb.euc.vmware.com
- basavaraju.euc.vmware.com
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **zone** dictionary | When l(state=present) | New/Updated DNS zone parameters **Sample:** {'dns\_servers': None, 'dynamic\_update': None, 'forwarder\_timeout': None, 'name': None, 'paused': None, 'replication': None, 'reverse\_lookup': None, 'shutdown': None, 'type': None, 'zone\_file': None} |
### Authors
* Joe Zollo (@joezollo)
ansible community.windows.win_http_proxy – Manages proxy settings for WinHTTP community.windows.win\_http\_proxy – Manages proxy settings for WinHTTP
=======================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_http_proxy`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Used to set, remove, or import proxy settings for Windows HTTP Services `WinHTTP`.
* WinHTTP is a framework used by applications or services, typically .NET applications or non-interactive services, to make web requests.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **bypass** list / elements=string | | A list of hosts that will bypass the set proxy when being accessed. Use `<local>` to match hostnames that are not fully qualified domain names. This is useful when needing to connect to intranet sites using just the hostname. Omit, set to null or an empty string/list to remove the bypass list. If this is set then *proxy* must also be set. |
| **proxy** raw | | A string or dict that specifies the proxy to be set. If setting a string, should be in the form `hostname`, `hostname:port`, or `protocol=hostname:port`. If the port is undefined, the default port for the protocol in use is used. If setting a dict, the keys should be the protocol and the values should be the hostname and/or port for that protocol. Valid protocols are `http`, `https`, `ftp`, and `socks`. Omit, set to null or an empty string to remove the proxy settings. |
| **source** string | **Choices:*** ie
| Instead of manually specifying the *proxy* and/or *bypass*, set this to import the proxy from a set source like Internet Explorer. Using `ie` will import the Internet Explorer proxy settings for the current active network connection of the current user. Only IE's proxy URL and bypass list will be imported into WinHTTP. This is like running `netsh winhttp import proxy source=ie`. The value is imported when the module runs and will not automatically be updated if the IE configuration changes in the future. The module will have to be run again to sync the latest changes. |
Notes
-----
Note
* This is not the same as the proxy settings set in Internet Explorer, also known as `WinINet`; use the [community.windows.win\_inet\_proxy](win_inet_proxy_module#ansible-collections-community-windows-win-inet-proxy-module) module to manage that instead.
* These settings are set system wide and not per user, it will require Administrative privileges to run.
See Also
--------
See also
[community.windows.win\_inet\_proxy](win_inet_proxy_module#ansible-collections-community-windows-win-inet-proxy-module)
The official documentation on the **community.windows.win\_inet\_proxy** module.
Examples
--------
```
- name: Set a proxy to use for all protocols
community.windows.win_http_proxy:
proxy: hostname
- name: Set a proxy with a specific port with a bypass list
community.windows.win_http_proxy:
proxy: hostname:8080
bypass:
- server1
- server2
- <local>
- name: Set the proxy based on the IE proxy settings
community.windows.win_http_proxy:
source: ie
- name: Set a proxy for specific protocols
community.windows.win_http_proxy:
proxy:
http: hostname:8080
https: hostname:8443
- name: Set a proxy for specific protocols using a string
community.windows.win_http_proxy:
proxy: http=hostname:8080;https=hostname:8443
bypass: server1,server2,<local>
- name: Remove any proxy settings
community.windows.win_http_proxy:
proxy: ''
bypass: ''
```
### Authors
* Jordan Borean (@jborean93)
| programming_docs |
ansible community.windows.win_webpicmd – Installs packages using Web Platform Installer command-line community.windows.win\_webpicmd – Installs packages using Web Platform Installer command-line
=============================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_webpicmd`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Installs packages using Web Platform Installer command-line (<http://www.iis.net/learn/install/web-platform-installer/web-platform-installer-v4-command-line-webpicmdexe-rtw-release>).
* Must be installed and present in PATH (see [chocolatey.chocolatey.win\_chocolatey](../../chocolatey/chocolatey/win_chocolatey_module#ansible-collections-chocolatey-chocolatey-win-chocolatey-module) module; ‘webpicmd’ is the package name, and you must install ‘lessmsi’ first too)?
* Install IIS first (see [ansible.windows.win\_feature](../../ansible/windows/win_feature_module#ansible-collections-ansible-windows-win-feature-module) module).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **name** string / required | | Name of the package to be installed. |
Notes
-----
Note
* Accepts EULAs and suppresses reboot - you will need to check manage reboots yourself (see [ansible.windows.win\_reboot](../../ansible/windows/win_reboot_module#ansible-collections-ansible-windows-win-reboot-module) module)
See Also
--------
See also
[ansible.windows.win\_package](../../ansible/windows/win_package_module#ansible-collections-ansible-windows-win-package-module)
The official documentation on the **ansible.windows.win\_package** module.
Examples
--------
```
- name: Install URLRewrite2.
community.windows.win_webpicmd:
name: URLRewrite2
```
### Authors
* Peter Mounce (@petemounce)
ansible community.windows.win_disk_image – Manage ISO/VHD/VHDX mounts on Windows hosts community.windows.win\_disk\_image – Manage ISO/VHD/VHDX mounts on Windows hosts
================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_disk_image`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manages mount behavior for a specified ISO, VHD, or VHDX image on a Windows host. When `state` is `present`, the image will be mounted under a system-assigned drive letter, which will be returned in the `mount_path` value of the module result.
* Requires Windows 8+ or Windows Server 2012+.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **image\_path** string / required | | Path to an ISO, VHD, or VHDX image on the target Windows host (the file cannot reside on a network share) |
| **state** string | **Choices:*** absent
* **present** ←
| Whether the image should be present as a drive-letter mount or not. |
Examples
--------
```
# Run installer from mounted ISO, then unmount
- name: Ensure an ISO is mounted
community.windows.win_disk_image:
image_path: C:\install.iso
state: present
register: disk_image_out
- name: Run installer from mounted ISO
ansible.windows.win_package:
path: '{{ disk_image_out.mount_paths[0] }}setup\setup.exe'
product_id: 35a4e767-0161-46b0-979f-e61f282fee21
state: present
- name: Unmount ISO
community.windows.win_disk_image:
image_path: C:\install.iso
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **mount\_paths** list / elements=string | when `state` is `present` | A list of filesystem paths mounted from the target image. **Sample:** ['E:\\', 'F:\\'] |
### Authors
* Matt Davis (@nitzmahone)
ansible community.windows.win_route – Add or remove a static route community.windows.win\_route – Add or remove a static route
===========================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_route`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Add or remove a static route.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **destination** string / required | | Destination IP address in CIDR format (ip address/prefix length). |
| **gateway** string | | The gateway used by the static route. If `gateway` is not provided it will be set to `0.0.0.0`. |
| **metric** integer | **Default:**1 | Metric used by the static route. |
| **state** string | **Choices:*** absent
* **present** ←
| If `absent`, it removes a network static route. If `present`, it adds a network static route. |
Notes
-----
Note
* Works only with Windows 2012 R2 and newer.
Examples
--------
```
---
- name: Add a network static route
community.windows.win_route:
destination: 192.168.2.10/32
gateway: 192.168.1.1
metric: 1
state: present
- name: Remove a network static route
community.windows.win_route:
destination: 192.168.2.10/32
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **output** string | always | A message describing the task result. **Sample:** Route added |
### Authors
* Daniele Lazzari (@dlazz)
ansible community.windows.win_credential – Manages Windows Credentials in the Credential Manager community.windows.win\_credential – Manages Windows Credentials in the Credential Manager
=========================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_credential`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Used to create and remove Windows Credentials in the Credential Manager.
* This module can manage both standard username/password credentials as well as certificate credentials.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **alias** string | | Adds an alias for the credential. Typically this is the NetBIOS name of a host if *name* is set to the DNS name. |
| **attributes** list / elements=dictionary | | A list of dicts that set application specific attributes for a credential. When set, existing attributes will be compared to the list as a whole, any differences means all attributes will be replaced. |
| | **data** string | | The value for the attribute. |
| | **data\_format** string | **Choices:*** base64
* **text** ←
| Controls the input type for *data*. If `text`, *data* is a text string that is UTF-16LE encoded to bytes. If `base64`, *data* is a base64 string that is base64 decoded to bytes. |
| | **name** string / required | | The key for the attribute. This is not a unique identifier as multiple attributes can have the same key. |
| **comment** string | | A user defined comment for the credential. |
| **name** string / required | | The target that identifies the server or servers that the credential is to be used for. If the value can be a NetBIOS name, DNS server name, DNS host name suffix with a wildcard character (`*`), a NetBIOS of DNS domain name that contains a wildcard character sequence, or an asterisk. See `TargetName` in <https://docs.microsoft.com/en-us/windows/desktop/api/wincred/ns-wincred-_credentiala> for more details on what this value can be. This is used with *type* to produce a unique credential. |
| **persistence** string | **Choices:*** enterprise
* **local** ←
| Defines the persistence of the credential. If `local`, the credential will persist for all logons of the same user on the same host.
`enterprise` is the same as `local` but the credential is visible to the same domain user when running on other hosts and not just localhost. |
| **secret** string | | The secret for the credential. When omitted, then no secret is used for the credential if a new credentials is created. When *type* is a password type, this is the password for *username*. When *type* is a certificate type, this is the pin for the certificate. |
| **secret\_format** string | **Choices:*** base64
* **text** ←
| Controls the input type for *secret*. If `text`, *secret* is a text string that is UTF-16LE encoded to bytes. If `base64`, *secret* is a base64 string that is base64 decoded to bytes. |
| **state** string | **Choices:*** absent
* **present** ←
| When `absent`, the credential specified by *name* and *type* is removed. When `present`, the credential specified by *name* and *type* is removed. |
| **type** string / required | **Choices:*** domain\_certificate
* domain\_password
* generic\_certificate
* generic\_password
| The type of credential to store. This is used with *name* to produce a unique credential. When the type is a `domain` type, the credential is used by Microsoft authentication packages like Negotiate. When the type is a `generic` type, the credential is not used by any particular authentication package. It is recommended to use a `domain` type as only authentication providers can access the secret. |
| **update\_secret** string | **Choices:*** **always** ←
* on\_create
| When `always`, the secret will always be updated if they differ. When `on_create`, the secret will only be checked/updated when it is first created. If the secret cannot be retrieved and this is set to `always`, the module will always result in a change. |
| **username** string | | When *type* is a password type, then this is the username to store for the credential. When *type* is a credential type, then this is the thumbprint as a hex string of the certificate to use. When `type=domain_password`, this should be in the form of a Netlogon (DOMAIN\Username) or a UPN (username@DOMAIN). If using a certificate thumbprint, the certificate must exist in the `CurrentUser\My` certificate store for the executing user. |
Notes
-----
Note
* This module requires to be run with `become` so it can access the user’s credential store.
* There can only be one credential per host and type. if a second credential is defined that uses the same host and type, then the original credential is overwritten.
See Also
--------
See also
[ansible.windows.win\_user\_right](../../ansible/windows/win_user_right_module#ansible-collections-ansible-windows-win-user-right-module)
The official documentation on the **ansible.windows.win\_user\_right** module.
[ansible.windows.win\_whoami](../../ansible/windows/win_whoami_module#ansible-collections-ansible-windows-win-whoami-module)
The official documentation on the **ansible.windows.win\_whoami** module.
Examples
--------
```
- name: Create a local only credential
community.windows.win_credential:
name: server.domain.com
type: domain_password
username: DOMAIN\username
secret: Password01
state: present
- name: Remove a credential
community.windows.win_credential:
name: server.domain.com
type: domain_password
state: absent
- name: Create a credential with full values
community.windows.win_credential:
name: server.domain.com
type: domain_password
alias: server
username: [email protected]
secret: Password01
comment: Credential for server.domain.com
persistence: enterprise
attributes:
- name: Source
data: Ansible
- name: Unique Identifier
data: Y3VzdG9tIGF0dHJpYnV0ZQ==
data_format: base64
- name: Create a certificate credential
community.windows.win_credential:
name: '*.domain.com'
type: domain_certificate
username: 0074CC4F200D27DC3877C24A92BA8EA21E6C7AF4
state: present
- name: Create a generic credential
community.windows.win_credential:
name: smbhost
type: generic_password
username: smbuser
secret: smbuser
state: present
- name: Remove a generic credential
community.windows.win_credential:
name: smbhost
type: generic_password
state: absent
```
### Authors
* Jordan Borean (@jborean93)
ansible community.windows.win_psscript_info – Gather information about installed PowerShell Scripts community.windows.win\_psscript\_info – Gather information about installed PowerShell Scripts
=============================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_psscript_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Gather information about PowerShell Scripts installed via PowerShellGet.
Requirements
------------
The below requirements are needed on the host that executes this module.
* `PowerShellGet` module
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **name** string | **Default:**"\*" | The name of the script. Supports any wildcard pattern supported by `Get-InstalledScript`. If omitted then all scripts will returned. |
| **repository** string | | The name of the PSRepository the scripts were installed from. This acts as a filter against the scripts that would be returned based on the *name* option. Only scripts installed from a registered repository will be returned. If the repository was re-registered after script installation with a new `SourceLocation`, this will not match. |
See Also
--------
See also
[community.windows.win\_psrepository\_info](win_psrepository_info_module#ansible-collections-community-windows-win-psrepository-info-module)
The official documentation on the **community.windows.win\_psrepository\_info** module.
[community.windows.win\_psmodule\_info](win_psmodule_info_module#ansible-collections-community-windows-win-psmodule-info-module)
The official documentation on the **community.windows.win\_psmodule\_info** module.
Examples
--------
```
- name: Get info about all script on the system
community.windows.win_psscript_info:
- name: Get info about the Test-RPC script
community.windows.win_psscript_info:
name: Test-RPC
- name: Get info about test scripts
community.windows.win_psscript_info:
name: Test*
- name: Get info about all scripts installed from the PSGallery repository
community.windows.win_psscript_info:
repository: PSGallery
register: gallery_scripts
- name: Update all scripts retrieved from above example
community.windows.win_psscript:
name: "{{ item }}"
state: latest
loop: "{{ gallery_scripts.scripts | map(attribute=name) }}"
- name: Get info about all scripts on the system
community.windows.win_psscript_info:
register: all_scripts
- name: Find scripts installed from a repository that isn't registered now
set_fact:
missing_repository_scripts: "{{
all_scripts
| json_query('scripts[?repository!=null && repository==repository_source_location].{name: name, version: version, repository: repository}')
| list
}}"
- debug:
var: missing_repository_scripts
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **scripts** list / elements=dictionary | always | A list of installed scripts (or an empty list is there are none). |
| | **additional\_metadata** dictionary | success | Additional metadata included with the script or during publishing of the script. Many of the fields here are surfaced at the top level with some standardization. The values here may differ slightly as a result. The field names here vary widely in case, and are not normalized or converted to snake\_case. |
| | **author** string | success | The author of the script. **Sample:** Ryan Ries |
| | **company\_name** string | success | The company name of the script. **Sample:** Microsoft Corporation |
| | **copyright** string | success | The copyright of the script. **Sample:** Jordan Borean 2017 |
| | **dependencies** list / elements=string | success | The script's dependencies. |
| | **description** string | success | The description of the script. **Sample:** This scripts tests network connectivity. |
| | **icon\_uri** string | success | The address of the icon of the script. **Sample:** https://raw.githubusercontent.com/scripter/script/main/logo.png |
| | **installed\_date** string | success | The date the script was installed. **Sample:** 2018-02-14T17:55:34.9620740-05:00 |
| | **installed\_location** string | success | The path where the script is installed. **Sample:** C:\Program Files\WindowsPowerShell\Scripts |
| | **license\_uri** string | success | The address of the license for the script. **Sample:** https://raw.githubusercontent.com/scripter/script/main/LICENSE |
| | **name** string | success | The name of the script. **Sample:** Test-RPC |
| | **package\_management\_provider** string | success | This is the PowerShellGet package management provider used to install the script. **Sample:** NuGet |
| | **power\_shell\_get\_format\_version** string | success | The version of the PowerShellGet specification format. **Sample:** 2.0 |
| | **project\_uri** string | success | The address of the script's project. **Sample:** https://github.com/scripter/script |
| | **published\_date** string | success | The date the script was published. **Sample:** 2017-03-15T04:18:09.0000000 |
| | **release\_notes** string | success | The script's release notes. This is a free text field and no specific format should be assumed. **Sample:** ## 1.5.5 - Add optional param for detailed info ## 1.4.7 - Bug fix for deadlock when getting parameters in an event ## 1.1.4 - Bug fix when installing package from private feeds |
| | **repository** string | success | The PSRepository where the script was installed from. This value is not historical. It depends on the PSRepositories that are registered now for the current user. The `repository_source_location` must match the current source location of a registered repository to get a repository name. If there is no match, then this value will match `repository_source_location`. **Sample:** PSGallery |
| | **repository\_source\_location** string | success | The source location of the repository where the script was installed from. **Sample:** https://www.powershellgallery.com/api/v2 |
| | **tags** list / elements=string | success | The tags defined in the script's `AdditionalMetadata`. **Sample:** ['networking', 'serialization', 'git', 'dsc'] |
| | **updated\_date** string | success | The date the script was last updated. **Sample:** 2019-12-31T09:20:02.0000000 |
| | **version** string | success | The script version. **Sample:** 1.2.3 |
### Authors
* Brian Scholer (@briantist)
| programming_docs |
ansible community.windows.win_file_compression – Alters the compression of files and directories on NTFS partitions. community.windows.win\_file\_compression – Alters the compression of files and directories on NTFS partitions.
==============================================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_file_compression`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module sets the compressed attribute for files and directories on a filesystem that supports it like NTFS.
* NTFS compression can be used to save disk space.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **force** boolean | **Choices:*** no
* **yes** ←
| This option only has an effect when *recurse* is `true`
If `true`, will check the compressed state of all subdirectories and files and make a change if any are different from *compressed*. If `false`, will only make a change if the compressed state of *path* is different from *compressed*. If the folder structure is complex or contains a lot of files, it is recommended to set this option to `false` so that not every file has to be checked. |
| **path** path / required | | The full path of the file or directory to modify. The path must exist on file system that supports compression like NTFS. |
| **recurse** boolean | **Choices:*** **no** ←
* yes
| Whether to recursively apply changes to all subdirectories and files. This option only has an effect when *path* is a directory. When set to `false`, only applies changes to *path*. When set to `true`, applies changes to *path* and all subdirectories and files. |
| **state** string | **Choices:*** absent
* **present** ←
| Set to `present` to ensure the *path* is compressed. Set to `absent` to ensure the *path* is not compressed. |
Notes
-----
Note
* [community.windows.win\_file\_compression](#ansible-collections-community-windows-win-file-compression-module) sets the file system’s compression state, it does not create a zip archive file.
* For more about NTFS Compression, see <http://www.ntfs.com/ntfs-compressed.htm>
Examples
--------
```
- name: Compress log files directory
community.windows.win_file_compression:
path: C:\Logs
state: present
- name: Decompress log files directory
community.windows.win_file_compression:
path: C:\Logs
state: absent
- name: Compress reports directory and all subdirectories
community.windows.win_file_compression:
path: C:\business\reports
state: present
recurse: yes
# This will only check C:\business\reports for the compressed state
# If C:\business\reports is compressed, it will not make a change
# even if one of the child items is uncompressed
- name: Compress reports directory and all subdirectories (quick)
community.windows.win_file_compression:
path: C:\business\reports
compressed: yes
recurse: yes
force: no
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **rc** integer | always | The return code of the compress/uncompress operation. If no changes are made or the operation is successful, rc is 0. |
### Authors
* Micah Hunsberger (@mhunsber)
ansible community.windows.win_wait_for_process – Waits for a process to exist or not exist before continuing. community.windows.win\_wait\_for\_process – Waits for a process to exist or not exist before continuing.
========================================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_wait_for_process`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Waiting for a process to start or stop.
* This is useful when Windows services behave poorly and do not enumerate external dependencies in their manifest.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **owner** string | | The owner of the process. Requires PowerShell version 4.0 or newer. |
| **pid** integer | | The PID of the process. |
| **post\_wait\_delay** integer | **Default:**0 | Seconds to wait after checking for processes. |
| **pre\_wait\_delay** integer | **Default:**0 | Seconds to wait before checking processes. |
| **process\_min\_count** integer | **Default:**1 | Minimum number of process matching the supplied pattern to satisfy `present` condition. Only applies to `present`. |
| **process\_name\_exact** list / elements=string | | The name of the process(es) for which to wait. The name of the process(es) should not include the file extension suffix. |
| **process\_name\_pattern** string | | RegEx pattern matching desired process(es). |
| **sleep** integer | **Default:**1 | Number of seconds to sleep between checks. Only applies when waiting for a process to start. Waiting for a process to start does not have a native non-polling mechanism. Waiting for a stop uses native PowerShell and does not require polling. |
| **state** string | **Choices:*** absent
* **present** ←
| When checking for a running process `present` will block execution until the process exists, or until the timeout has been reached. `absent` will block execution until the process no longer exists, or until the timeout has been reached. When waiting for `present`, the module will return changed only if the process was not present on the initial check but became present on subsequent checks. If, while waiting for `absent`, new processes matching the supplied pattern are started, these new processes will not be included in the action. |
| **timeout** integer | **Default:**300 | The maximum number of seconds to wait for a for a process to start or stop before erroring out. |
See Also
--------
See also
[ansible.builtin.wait\_for](../../ansible/builtin/wait_for_module#ansible-collections-ansible-builtin-wait-for-module)
The official documentation on the **ansible.builtin.wait\_for** module.
[ansible.windows.win\_wait\_for](../../ansible/windows/win_wait_for_module#ansible-collections-ansible-windows-win-wait-for-module)
The official documentation on the **ansible.windows.win\_wait\_for** module.
Examples
--------
```
- name: Wait 300 seconds for all Oracle VirtualBox processes to stop. (VBoxHeadless, VirtualBox, VBoxSVC)
community.windows.win_wait_for_process:
process_name_pattern: 'v(irtual)?box(headless|svc)?'
state: absent
timeout: 500
- name: Wait 300 seconds for 3 instances of cmd to start, waiting 5 seconds between each check
community.windows.win_wait_for_process:
process_name_exact: cmd
state: present
timeout: 500
sleep: 5
process_min_count: 3
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **elapsed** float | always | The elapsed seconds between the start of poll and the end of the module. **Sample:** 3.14159265 |
| **matched\_processes** complex | always | List of matched processes (either stopped or started). |
| | **name** string | always | The name of the matched process. **Sample:** svchost |
| | **owner** string | when supported by PowerShell | The owner of the matched process. **Sample:** NT AUTHORITY\SYSTEM |
| | **pid** integer | always | The PID of the matched process. **Sample:** 7908 |
### Authors
* Charles Crossan (@crossan007)
ansible community.windows.win_rabbitmq_plugin – Manage RabbitMQ plugins community.windows.win\_rabbitmq\_plugin – Manage RabbitMQ plugins
=================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_rabbitmq_plugin`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage RabbitMQ plugins.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **names** string / required | | Comma-separated list of plugin names.
aliases: name |
| **new\_only** boolean | **Choices:*** **no** ←
* yes
| Only enable missing plugins. Does not disable plugins that are not in the names list. |
| **prefix** string | | Specify a custom install prefix to a Rabbit. |
| **state** string | **Choices:*** disabled
* **enabled** ←
| Specify if plugins are to be enabled or disabled. |
Examples
--------
```
- name: Enables the rabbitmq_management plugin
community.windows.win_rabbitmq_plugin:
names: rabbitmq_management
state: enabled
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **disabled** list / elements=string | always | List of plugins disabled during task run. **Sample:** ['rabbitmq\_management'] |
| **enabled** list / elements=string | always | List of plugins enabled during task run. **Sample:** ['rabbitmq\_management'] |
### Authors
* Artem Zinenko (@ar7z1)
ansible community.windows.win_iis_webapplication – Configures IIS web applications community.windows.win\_iis\_webapplication – Configures IIS web applications
============================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_iis_webapplication`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Creates, removes, and configures IIS web applications.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **application\_pool** string | | The application pool in which the new site executes. If not specified, the application pool of the current website will be used. |
| **connect\_as** string | **Choices:*** pass\_through
* specific\_user
| The type of authentication to use for this application. Either `pass_through` or `specific_user`
If `pass_through`, IIS will use the identity of the user or application pool identity to access the file system or network. If `specific_user`, IIS will use the credentials provided in *username* and *password* to access the file system or network. |
| **name** string / required | | Name of the web application. |
| **password** string | | The password associated with *username*. Required when *connect\_as* is set to `specific_user`. |
| **physical\_path** string | | The physical path on the remote host to use for the new application. The specified folder must already exist. |
| **site** string / required | | Name of the site on which the application is created. |
| **state** string | **Choices:*** absent
* **present** ←
| State of the web application. |
| **username** string | | Specifies the user name of an account that can access configuration files and content for this application. Required when *connect\_as* is set to `specific_user`. |
See Also
--------
See also
[community.windows.win\_iis\_virtualdirectory](win_iis_virtualdirectory_module#ansible-collections-community-windows-win-iis-virtualdirectory-module)
The official documentation on the **community.windows.win\_iis\_virtualdirectory** module.
[community.windows.win\_iis\_webapppool](win_iis_webapppool_module#ansible-collections-community-windows-win-iis-webapppool-module)
The official documentation on the **community.windows.win\_iis\_webapppool** module.
[community.windows.win\_iis\_webbinding](win_iis_webbinding_module#ansible-collections-community-windows-win-iis-webbinding-module)
The official documentation on the **community.windows.win\_iis\_webbinding** module.
[community.windows.win\_iis\_website](win_iis_website_module#ansible-collections-community-windows-win-iis-website-module)
The official documentation on the **community.windows.win\_iis\_website** module.
Examples
--------
```
- name: Add ACME webapplication on IIS.
community.windows.win_iis_webapplication:
name: api
site: acme
state: present
physical_path: C:\apps\acme\api
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **application\_pool** string | success | The used/implemented application\_pool value. **Sample:** DefaultAppPool |
| **connect\_as** string | when the application exists | How IIS will try to authenticate to the physical\_path. **Sample:** specific\_user |
| **physical\_path** string | success | The used/implemented physical\_path value. **Sample:** C:\apps\acme\api |
### Authors
* Henrik Wallström (@henrikwallstrom)
ansible community.windows.win_scoop – Manage packages using Scoop community.windows.win\_scoop – Manage packages using Scoop
==========================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_scoop`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Manage packages using Scoop.
* If Scoop is missing from the system, the module will install it.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **architecture** string | **Choices:*** 32bit
* 64bit
| Force Scoop to install the package of a specific process architecture.
aliases: arch |
| **global** boolean | **Choices:*** **no** ←
* yes
| Install the app globally |
| **independent** boolean | **Choices:*** **no** ←
* yes
| Don't install dependencies automatically |
| **name** list / elements=string / required | | Name of the package(s) to be installed. |
| **no\_cache** boolean | **Choices:*** **no** ←
* yes
| Don't use the download cache |
| **purge** boolean | **Choices:*** **no** ←
* yes
| Remove all persistent data |
| **skip\_checksum** boolean | **Choices:*** **no** ←
* yes
| Skip hash validation |
| **state** string | **Choices:*** absent
* **present** ←
| State of the package on the system. When `absent`, will ensure the package is not installed. When `present`, will ensure the package is installed. |
See Also
--------
See also
[chocolatey.chocolatey.win\_chocolatey](../../chocolatey/chocolatey/win_chocolatey_module#ansible-collections-chocolatey-chocolatey-win-chocolatey-module)
The official documentation on the **chocolatey.chocolatey.win\_chocolatey** module.
[Scoop website](https://scoop.sh)
More information about Scoop
[Scoop installer repository](https://github.com/lukesampson/scoop)
GitHub repository for the Scoop installer
[Scoop main bucket](https://github.com/ScoopInstaller/Main)
GitHub repository for the main bucket
Examples
--------
```
- name: Install jq.
community.windows.win_scoop:
name: jq
```
### Authors
* Jamie Magee (@JamieMagee)
ansible community.windows.win_unzip – Unzips compressed files and archives on the Windows node community.windows.win\_unzip – Unzips compressed files and archives on the Windows node
=======================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_unzip`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Unzips compressed files and archives.
* Supports .zip files natively.
* Supports other formats supported by the Powershell Community Extensions (PSCX) module (basically everything 7zip supports).
* For non-Windows targets, use the [ansible.builtin.unarchive](../../ansible/builtin/unarchive_module#ansible-collections-ansible-builtin-unarchive-module) module instead.
Requirements
------------
The below requirements are needed on the host that executes this module.
* PSCX
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **creates** path | | If this file or directory exists the specified src will not be extracted. |
| **delete\_archive** boolean | **Choices:*** **no** ←
* yes
| Remove the zip file, after unzipping.
aliases: rm |
| **dest** path / required | | Destination of zip file (provide absolute path of directory). If it does not exist, the directory will be created. |
| **password** string | | If a zip file is encrypted with password. Passing a value to a password parameter requires the PSCX module to be installed. |
| **recurse** boolean | **Choices:*** **no** ←
* yes
| Recursively expand zipped files within the src file. Setting to a value of `yes` requires the PSCX module to be installed. |
| **src** path / required | | File to be unzipped (provide absolute path). |
Notes
-----
Note
* This module is not really idempotent, it will extract the archive every time, and report a change.
* For extracting any compression types other than .zip, the PowerShellCommunityExtensions (PSCX) Module is required. This module (in conjunction with PSCX) has the ability to recursively unzip files within the src zip file provided and also functionality for many other compression types. If the destination directory does not exist, it will be created before unzipping the file. Specifying rm parameter will force removal of the src file after extraction.
See Also
--------
See also
[ansible.builtin.unarchive](../../ansible/builtin/unarchive_module#ansible-collections-ansible-builtin-unarchive-module)
The official documentation on the **ansible.builtin.unarchive** module.
Examples
--------
```
# This unzips a library that was downloaded with win_get_url, and removes the file after extraction
# $ ansible -i hosts -m win_unzip -a "src=C:\LibraryToUnzip.zip dest=C:\Lib remove=yes" all
- name: Unzip a bz2 (BZip) file
community.windows.win_unzip:
src: C:\Users\Phil\Logs.bz2
dest: C:\Users\Phil\OldLogs
creates: C:\Users\Phil\OldLogs
- name: Unzip gz log
community.windows.win_unzip:
src: C:\Logs\application-error-logs.gz
dest: C:\ExtractedLogs\application-error-logs
# Unzip .zip file, recursively decompresses the contained .gz files and removes all unneeded compressed files after completion.
- name: Recursively decompress GZ files in ApplicationLogs.zip
community.windows.win_unzip:
src: C:\Downloads\ApplicationLogs.zip
dest: C:\Application\Logs
recurse: yes
delete_archive: yes
- name: Install PSCX
community.windows.win_psmodule:
name: Pscx
state: present
- name: Unzip .7z file which is password encrypted
community.windows.win_unzip:
src: C:\Downloads\ApplicationLogs.7z
dest: C:\Application\Logs
password: abcd
delete_archive: yes
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **dest** string | always | The provided destination path **Sample:** C:\ExtractedLogs\application-error-logs |
| **removed** boolean | always | Whether the module did remove any files during task run **Sample:** True |
| **src** string | always | The provided source path **Sample:** C:\Logs\application-error-logs.gz |
### Authors
* Phil Schwartz (@schwartzmx)
| programming_docs |
ansible community.windows.win_audit_rule – Adds an audit rule to files, folders, or registry keys community.windows.win\_audit\_rule – Adds an audit rule to files, folders, or registry keys
===========================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_audit_rule`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Used to apply audit rules to files, folders or registry keys.
* Once applied, it will begin recording the user who performed the operation defined into the Security Log in the Event viewer.
* The behavior is designed to ignore inherited rules since those cannot be adjusted without first disabling the inheritance behavior. It will still print inherited rules in the output though for debugging purposes.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **audit\_flags** list / elements=string / required | **Choices:*** Failure
* Success
| Defines whether to log on failure, success, or both. To log both define as comma separated list "Success, Failure". |
| **inheritance\_flags** list / elements=string | **Choices:*** ContainerInherit
* ObjectInherit
**Default:**"ContainerInherit,ObjectInherit" | Defines what objects inside of a folder or registry key will inherit the settings. If you are setting a rule on a file, this value has to be changed to `none`. For more information on the choices see MSDN PropagationFlags enumeration at <https://msdn.microsoft.com/en-us/library/system.security.accesscontrol.inheritanceflags.aspx>. |
| **path** path / required | | Path to the file, folder, or registry key. Registry paths should be in Powershell format, beginning with an abbreviation for the root such as, `HKLM:\Software`.
aliases: dest, destination |
| **propagation\_flags** string | **Choices:*** **None** ←
* InherityOnly
* NoPropagateInherit
| Propagation flag on the audit rules. This value is ignored when the path type is a file. For more information on the choices see MSDN PropagationFlags enumeration at <https://msdn.microsoft.com/en-us/library/system.security.accesscontrol.propagationflags.aspx>. |
| **rights** list / elements=string / required | | Comma separated list of the rights desired. Only required for adding a rule. If *path* is a file or directory, rights can be any right under MSDN FileSystemRights <https://msdn.microsoft.com/en-us/library/system.security.accesscontrol.filesystemrights.aspx>. If *path* is a registry key, rights can be any right under MSDN RegistryRights <https://msdn.microsoft.com/en-us/library/system.security.accesscontrol.registryrights.aspx>. |
| **state** string | **Choices:*** absent
* **present** ←
| Whether the rule should be `present` or `absent`. For absent, only *path*, *user*, and *state* are required. Specifying `absent` will remove all rules matching the defined *user*. |
| **user** string / required | | The user or group to adjust rules for. |
See Also
--------
See also
[community.windows.win\_audit\_policy\_system](win_audit_policy_system_module#ansible-collections-community-windows-win-audit-policy-system-module)
The official documentation on the **community.windows.win\_audit\_policy\_system** module.
Examples
--------
```
- name: Add filesystem audit rule for a folder
community.windows.win_audit_rule:
path: C:\inetpub\wwwroot\website
user: BUILTIN\Users
rights: write,delete,changepermissions
audit_flags: success,failure
inheritance_flags: ContainerInherit,ObjectInherit
- name: Add filesystem audit rule for a file
community.windows.win_audit_rule:
path: C:\inetpub\wwwroot\website\web.config
user: BUILTIN\Users
rights: write,delete,changepermissions
audit_flags: success,failure
inheritance_flags: None
- name: Add registry audit rule
community.windows.win_audit_rule:
path: HKLM:\software
user: BUILTIN\Users
rights: delete
audit_flags: 'success'
- name: Remove filesystem audit rule
community.windows.win_audit_rule:
path: C:\inetpub\wwwroot\website
user: BUILTIN\Users
state: absent
- name: Remove registry audit rule
community.windows.win_audit_rule:
path: HKLM:\software
user: BUILTIN\Users
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **current\_audit\_rules** dictionary | always | The current rules on the defined *path*
Will return "No audit rules defined on *path*" **Sample:** { "audit\_flags": "Success", "user": "Everyone", "inheritance\_flags": "False", "is\_inherited": "False", "propagation\_flags": "None", "rights": "Delete" } |
| **path\_type** string | always | The type of *path* being targetted. Will be one of file, directory, registry. |
### Authors
* Noah Sparks (@nwsparks)
ansible community.windows.win_certificate_info – Get information on certificates from a Windows Certificate Store community.windows.win\_certificate\_info – Get information on certificates from a Windows Certificate Store
===========================================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_certificate_info`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Returns information about certificates in a Windows Certificate Store.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **store\_location** string | **Choices:*** CurrentUser
* **LocalMachine** ←
| The location of the store to search. |
| **store\_name** string | **Default:**"My" | The name of the store to search. See <https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.x509certificates.storename> for a list of built-in store names. |
| **thumbprint** string | | The thumbprint as a hex string of a certificate to find. When specified, filters the *certificates* return value to a single certificate See the examples for how to format the thumbprint. |
See Also
--------
See also
[ansible.windows.win\_certificate\_store](../../ansible/windows/win_certificate_store_module#ansible-collections-ansible-windows-win-certificate-store-module)
The official documentation on the **ansible.windows.win\_certificate\_store** module.
Examples
--------
```
- name: Obtain information about a particular certificate in the computer's personal store
community.windows.win_certificate_info:
thumbprint: BD7AF104CF1872BDB518D95C9534EA941665FD27
register: mycert
# thumbprint can also be lower case
- name: Obtain information about a particular certificate in the computer's personal store
community.windows.win_certificate_info:
thumbprint: bd7af104cf1872bdb518d95c9534ea941665fd27
register: mycert
- name: Obtain information about all certificates in the root store
community.windows.win_certificate_info:
store_name: Root
register: ca
# Import a pfx and then get information on the certificates
- name: Import pfx certificate that is password protected
ansible.windows.win_certificate_store:
path: C:\Temp\cert.pfx
state: present
password: VeryStrongPasswordHere!
become: yes
become_method: runas
register: mycert
- name: Obtain information on each certificate that was touched
community.windows.win_certificate_info:
thumbprint: "{{ item }}"
register: mycert_stats
loop: "{{ mycert.thumbprints }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **certificates** list / elements=dictionary | success | A list of information about certificates found in the store, sorted by thumbprint. |
| | **archived** boolean | success | Indicates that the certificate is archived. |
| | **cert\_data** string | success | The base64 encoded data of the entire certificate. |
| | **dns\_names** list / elements=string | success | Lists the registered dns names for the certificate. **Sample:** ['\*.m.wikiquote.org', '\*.wikipedia.org'] |
| | **extensions** list / elements=dictionary | success | The collection of the certificates extensions. **Sample:** [{'critical': False, 'field': 'Subject Key Identifier', 'value': '88 27 17 09 a9 b6 18 60 8b ec eb ba f6 47 59 c5 52 54 a3 b7'}, {'critical': True, 'field': 'Basic Constraints', 'value': 'Subject Type=CA, Path Length Constraint=None'}, {'critical': False, 'field': 'Authority Key Identifier', 'value': 'KeyID=2b d0 69 47 94 76 09 fe f4 6b 8d 2e 40 a6 f7 47 4d 7f 08 5e'}, {'critical': False, 'field': 'CRL Distribution Points', 'value': '[1]CRL Distribution Point: Distribution Point Name:Full Name:URL=http://crl.apple.com/root.crl'}, {'critical': True, 'field': 'Key Usage', 'value': 'Digital Signature, Certificate Signing, Off-line CRL Signing, CRL Signing (86)'}, {'critical': False, 'field': None, 'value': '05 00'}] |
| | **friendly\_name** string | success | The associated alias for the certificate. **Sample:** Microsoft Root Authority |
| | **has\_private\_key** boolean | success | Indicates that the certificate contains a private key. |
| | **intended\_purposes** list / elements=string | enhanced key usages extension exists. | lists the intended applications for the certificate. **Sample:** ['Server Authentication'] |
| | **is\_ca** boolean | basic constraints extension exists. | Indicates that the certificate is a certificate authority (CA) certificate. **Sample:** True |
| | **issued\_by** string | success | The certificate issuer's common name. **Sample:** Apple Root CA |
| | **issued\_to** string | success | The certificate's common name. **Sample:** Apple Worldwide Developer Relations Certification Authority |
| | **issuer** string | success | The certificate issuer's distinguished name. **Sample:** CN=Apple Root CA, OU=Apple Certification Authority, O=Apple Inc., C=US |
| | **key\_usages** list / elements=string | key usages extension exists. | Defines how the certificate key can be used. If this value is not defined, the key can be used for any purpose. **Sample:** ['CrlSign', 'KeyCertSign', 'DigitalSignature'] |
| | **path\_length\_constraint** integer | basic constraints extension exists | The number of levels allowed in a certificates path. If this value is 0, the certificate does not have a restriction. |
| | **public\_key** string | success | The base64 encoded public key of the certificate. |
| | **serial\_number** string | success | The serial number of the certificate represented as a hexadecimal string **Sample:** 01DEBCC4396DA010 |
| | **signature\_algorithm** string | success | The algorithm used to create the certificate's signature **Sample:** sha1RSA |
| | **ski** string | subject key identifier extension exists. | The certificate's subject key identifier **Sample:** 88271709A9B618608BECEBBAF64759C55254A3B7 |
| | **subject** string | success | The certificate's distinguished name. **Sample:** CN=Apple Worldwide Developer Relations Certification Authority, OU=Apple Worldwide Developer Relations, O=Apple Inc., C=US |
| | **thumbprint** string | success | The thumbprint as a hex string of the certificate. The return format will always be upper case. **Sample:** FF6797793A3CD798DC5B2ABEF56F73EDC9F83A64 |
| | **valid\_from** float | success | The start date of the certificate represented in seconds since epoch. **Sample:** 1360255727 |
| | **valid\_from\_iso8601** string | success | The start date of the certificate represented as an iso8601 formatted date. **Sample:** 2017-12-15T08:39:32Z |
| | **valid\_to** float | success | The expiry date of the certificate represented in seconds since epoch. **Sample:** 1675788527 |
| | **valid\_to\_iso8601** string | success | The expiry date of the certificate represented as an iso8601 formatted date. **Sample:** 2086-01-02T08:39:32Z |
| | **version** integer | success | The x509 format version of the certificate **Sample:** 3 |
| **exists** boolean | success | Whether any certificates were found in the store. When *thumbprint* is specified, returns true only if the certificate mathing the thumbprint exists. **Sample:** True |
### Authors
* Micah Hunsberger (@mhunsber)
ansible community.windows.win_hotfix – Install and uninstalls Windows hotfixes community.windows.win\_hotfix – Install and uninstalls Windows hotfixes
=======================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_hotfix`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Install, uninstall a Windows hotfix.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **hotfix\_identifier** string | | The name of the hotfix as shown in DISM, see examples for details. This or `hotfix_kb` MUST be set when `state=absent`. If `state=present` then the hotfix at `source` will be validated against this value, if it does not match an error will occur. You can get the identifier by running 'Get-WindowsPackage -Online -PackagePath path-to-cab-in-msu' after expanding the msu file. |
| **hotfix\_kb** string | | The name of the KB the hotfix relates to, see examples for details. This or `hotfix_identifier` MUST be set when `state=absent`. If `state=present` then the hotfix at `source` will be validated against this value, if it does not match an error will occur. Because DISM uses the identifier as a key and doesn't refer to a KB in all cases it is recommended to use `hotfix_identifier` instead. |
| **source** path | | The path to the downloaded hotfix .msu file. This MUST be set if `state=present` and MUST be a .msu hotfix file. |
| **state** string | **Choices:*** absent
* **present** ←
| Whether to install or uninstall the hotfix. When `present`, `source` MUST be set. When `absent`, `hotfix_identifier` or `hotfix_kb` MUST be set. |
Notes
-----
Note
* This must be run on a host that has the DISM powershell module installed and a Powershell version >= 4.
* This module is installed by default on Windows 8 and Server 2012 and newer.
* You can manually install this module on Windows 7 and Server 2008 R2 by installing the Windows ADK <https://developer.microsoft.com/en-us/windows/hardware/windows-assessment-deployment-kit>, see examples to see how to do it with chocolatey.
* You can download hotfixes from <https://www.catalog.update.microsoft.com/Home.aspx>.
See Also
--------
See also
[ansible.windows.win\_package](../../ansible/windows/win_package_module#ansible-collections-ansible-windows-win-package-module)
The official documentation on the **ansible.windows.win\_package** module.
[ansible.windows.win\_updates](../../ansible/windows/win_updates_module#ansible-collections-ansible-windows-win-updates-module)
The official documentation on the **ansible.windows.win\_updates** module.
Examples
--------
```
- name: Install Windows ADK with DISM for Server 2008 R2
chocolatey.chocolatey.win_chocolatey:
name: windows-adk
version: 8.100.26866.0
state: present
install_args: /features OptionId.DeploymentTools
- name: Install hotfix without validating the KB and Identifier
community.windows.win_hotfix:
source: C:\temp\windows8.1-kb3172729-x64_e8003822a7ef4705cbb65623b72fd3cec73fe222.msu
state: present
register: hotfix_install
- ansible.windows.win_reboot:
when: hotfix_install.reboot_required
- name: Install hotfix validating KB
community.windows.win_hotfix:
hotfix_kb: KB3172729
source: C:\temp\windows8.1-kb3172729-x64_e8003822a7ef4705cbb65623b72fd3cec73fe222.msu
state: present
register: hotfix_install
- ansible.windows.win_reboot:
when: hotfix_install.reboot_required
- name: Install hotfix validating Identifier
community.windows.win_hotfix:
hotfix_identifier: Package_for_KB3172729~31bf3856ad364e35~amd64~~6.3.1.0
source: C:\temp\windows8.1-kb3172729-x64_e8003822a7ef4705cbb65623b72fd3cec73fe222.msu
state: present
register: hotfix_install
- ansible.windows.win_reboot:
when: hotfix_install.reboot_required
- name: Uninstall hotfix with Identifier
community.windows.win_hotfix:
hotfix_identifier: Package_for_KB3172729~31bf3856ad364e35~amd64~~6.3.1.0
state: absent
register: hotfix_uninstall
- ansible.windows.win_reboot:
when: hotfix_uninstall.reboot_required
- name: Uninstall hotfix with KB (not recommended)
community.windows.win_hotfix:
hotfix_kb: KB3172729
state: absent
register: hotfix_uninstall
- ansible.windows.win_reboot:
when: hotfix_uninstall.reboot_required
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **identifier** string | success | The DISM identifier for the hotfix. **Sample:** Package\_for\_KB3172729~31bf3856ad364e35~amd64~~6.3.1.0 |
| **kb** string | success | The KB the hotfix relates to. **Sample:** KB3172729 |
| **reboot\_required** string | success | Whether a reboot is required for the install or uninstall to finalise. **Sample:** True |
### Authors
* Jordan Borean (@jborean93)
ansible community.windows.win_eventlog – Manage Windows event logs community.windows.win\_eventlog – Manage Windows event logs
===========================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_eventlog`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Allows the addition, clearing and removal of local Windows event logs, and the creation and removal of sources from a given event log. Also allows the specification of settings per log and source.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **category\_file** path | | For one or more sources specified, the path to a custom category resource file. |
| **maximum\_size** string | | The maximum size of the event log. Value must be between 64KB and 4GB, and divisible by 64KB. Size can be specified in KB, MB or GB (e.g. 128KB, 16MB, 2.5GB). |
| **message\_file** path | | For one or more sources specified, the path to a custom event message resource file. |
| **name** string / required | | Name of the event log to manage. |
| **overflow\_action** string | **Choices:*** DoNotOverwrite
* OverwriteAsNeeded
* OverwriteOlder
| The action for the log to take once it reaches its maximum size. For `DoNotOverwrite`, all existing entries are kept and new entries are not retained. For `OverwriteAsNeeded`, each new entry overwrites the oldest entry. For `OverwriteOlder`, new log entries overwrite those older than the `retention_days` value. |
| **parameter\_file** path | | For one or more sources specified, the path to a custom parameter resource file. |
| **retention\_days** integer | | The minimum number of days event entries must remain in the log. This option is only used when `overflow_action` is `OverwriteOlder`. |
| **sources** list / elements=string | | A list of one or more sources to ensure are present/absent in the log. When `category_file`, `message_file` and/or `parameter_file` are specified, these values are applied across all sources. |
| **state** string | **Choices:*** absent
* clear
* **present** ←
| Desired state of the log and/or sources. When `sources` is populated, state is checked for sources. When `sources` is not populated, state is checked for the specified log itself. If `state` is `clear`, event log entries are cleared for the target log. |
See Also
--------
See also
[community.windows.win\_eventlog\_entry](win_eventlog_entry_module#ansible-collections-community-windows-win-eventlog-entry-module)
The official documentation on the **community.windows.win\_eventlog\_entry** module.
Examples
--------
```
- name: Add a new event log with two custom sources
community.windows.win_eventlog:
name: MyNewLog
sources:
- NewLogSource1
- NewLogSource2
state: present
- name: Change the category and message resource files used for NewLogSource1
community.windows.win_eventlog:
name: MyNewLog
sources:
- NewLogSource1
category_file: C:\NewApp\CustomCategories.dll
message_file: C:\NewApp\CustomMessages.dll
state: present
- name: Change the maximum size and overflow action for MyNewLog
community.windows.win_eventlog:
name: MyNewLog
maximum_size: 16MB
overflow_action: DoNotOverwrite
state: present
- name: Clear event entries for MyNewLog
community.windows.win_eventlog:
name: MyNewLog
state: clear
- name: Remove NewLogSource2 from MyNewLog
community.windows.win_eventlog:
name: MyNewLog
sources:
- NewLogSource2
state: absent
- name: Remove MyNewLog and all remaining sources
community.windows.win_eventlog:
name: MyNewLog
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **entries** integer | success | The count of entries present in the event log. **Sample:** 50 |
| **exists** boolean | success | Whether the event log exists or not. **Sample:** True |
| **maximum\_size\_kb** integer | success | Maximum size of the log in KB. **Sample:** 512 |
| **name** string | always | The name of the event log. **Sample:** MyNewLog |
| **overflow\_action** string | success | The action the log takes once it reaches its maximum size. **Sample:** OverwriteOlder |
| **retention\_days** integer | success | The minimum number of days entries are retained in the log. **Sample:** 7 |
| **sources** list / elements=string | success | A list of the current sources for the log. **Sample:** ['MyNewLog', 'NewLogSource1', 'NewLogSource2'] |
| **sources\_changed** list / elements=string | always | A list of sources changed (e.g. re/created, removed) for the log; this is empty if no sources are changed. **Sample:** ['NewLogSource2'] |
### Authors
* Andrew Saraceni (@andrewsaraceni)
| programming_docs |
ansible community.windows.win_iis_virtualdirectory – Configures a virtual directory in IIS community.windows.win\_iis\_virtualdirectory – Configures a virtual directory in IIS
====================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_iis_virtualdirectory`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Creates, Removes and configures a virtual directory in IIS.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **application** string | | The application under which the virtual directory is created or exists. |
| **name** string / required | | The name of the virtual directory to create or remove. |
| **physical\_path** string | | The physical path to the folder in which the new virtual directory is created. The specified folder must already exist. |
| **site** string / required | | The site name under which the virtual directory is created or exists. |
| **state** string | **Choices:*** absent
* **present** ←
| Whether to add or remove the specified virtual directory. Removing will remove the virtual directory and all under it (Recursively). |
See Also
--------
See also
[community.windows.win\_iis\_webapplication](win_iis_webapplication_module#ansible-collections-community-windows-win-iis-webapplication-module)
The official documentation on the **community.windows.win\_iis\_webapplication** module.
[community.windows.win\_iis\_webapppool](win_iis_webapppool_module#ansible-collections-community-windows-win-iis-webapppool-module)
The official documentation on the **community.windows.win\_iis\_webapppool** module.
[community.windows.win\_iis\_webbinding](win_iis_webbinding_module#ansible-collections-community-windows-win-iis-webbinding-module)
The official documentation on the **community.windows.win\_iis\_webbinding** module.
[community.windows.win\_iis\_website](win_iis_website_module#ansible-collections-community-windows-win-iis-website-module)
The official documentation on the **community.windows.win\_iis\_website** module.
Examples
--------
```
- name: Create a virtual directory if it does not exist
community.windows.win_iis_virtualdirectory:
name: somedirectory
site: somesite
state: present
physical_path: C:\virtualdirectory\some
- name: Remove a virtual directory if it exists
community.windows.win_iis_virtualdirectory:
name: somedirectory
site: somesite
state: absent
- name: Create a virtual directory on an application if it does not exist
community.windows.win_iis_virtualdirectory:
name: somedirectory
site: somesite
application: someapp
state: present
physical_path: C:\virtualdirectory\some
```
### Authors
* Henrik Wallström (@henrikwallstrom)
ansible community.windows.win_xml – Manages XML file content on Windows hosts community.windows.win\_xml – Manages XML file content on Windows hosts
======================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_xml`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manages XML nodes, attributes and text, using xpath to select which xml nodes need to be managed.
* XML fragments, formatted as strings, are used to specify the desired state of a part or parts of XML files on remote Windows servers.
* For non-Windows targets, use the [community.general.xml](../general/xml_module#ansible-collections-community-general-xml-module) module instead.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **attribute** string | | The attribute name if the type is 'attribute'. Required if `type=attribute`. |
| **backup** boolean | **Choices:*** **no** ←
* yes
| Determine whether a backup should be created. When set to `yes`, create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly. |
| **count** boolean | **Choices:*** **no** ←
* yes
| When set to `yes`, return the number of nodes matched by *xpath*. |
| **fragment** string | | The string representation of the XML fragment expected at xpath. Since ansible 2.9 not required when *state=absent*, or when *count=yes*.
aliases: xmlstring |
| **path** path / required | | Path to the file to operate on.
aliases: dest, file |
| **state** string | **Choices:*** **present** ←
* absent
| Set or remove the nodes (or attributes) matched by *xpath*. |
| **type** string / required | **Choices:*** attribute
* **element** ←
* text
| The type of XML node you are working with. |
| **xpath** string / required | | Xpath to select the node or nodes to operate on. |
Notes
-----
Note
* Only supports operating on xml elements, attributes and text.
* Namespace, processing-instruction, command and document node types cannot be modified with this module.
See Also
--------
See also
[community.general.xml](../general/xml_module#ansible-collections-community-general-xml-module)
XML manipulation for Posix hosts.
[w3shools XPath tutorial](https://www.w3schools.com/xml/xpath_intro.asp)
A useful tutorial on XPath
Examples
--------
```
- name: Apply our filter to Tomcat web.xml
community.windows.win_xml:
path: C:\apache-tomcat\webapps\myapp\WEB-INF\web.xml
fragment: '<filter><filter-name>MyFilter</filter-name><filter-class>com.example.MyFilter</filter-class></filter>'
xpath: '/*'
- name: Apply sslEnabledProtocols to Tomcat's server.xml
community.windows.win_xml:
path: C:\Tomcat\conf\server.xml
xpath: '//Server/Service[@name="Catalina"]/Connector[@port="9443"]'
attribute: 'sslEnabledProtocols'
fragment: 'TLSv1,TLSv1.1,TLSv1.2'
type: attribute
- name: remove debug configuration nodes from nlog.conf
community.windows.win_xml:
path: C:\IISApplication\nlog.conf
xpath: /nlog/rules/logger[@name="debug"]/descendant::*
state: absent
- name: count configured connectors in Tomcat's server.xml
community.windows.win_xml:
path: C:\Tomcat\conf\server.xml
xpath: //Server/Service/Connector
count: yes
register: connector_count
- name: show connector count
debug:
msg="Connector count is {{connector_count.count}}"
- name: ensure all lang=en attributes to lang=nl
community.windows.win_xml:
path: C:\Data\Books.xml
xpath: //@[lang="en"]
attribute: lang
fragment: nl
type: attribute
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **backup\_file** string | if backup=yes | Name of the backup file that was created. **Sample:** C:\Path\To\File.txt.11540.20150212-220915.bak |
| **count** integer | if count=yes | Number of nodes matched by xpath. **Sample:** 33 |
| **err** list / elements=string | always, for type element and -vvv or more | XML comparison exceptions. **Sample:** attribute mismatch for actual=string |
| **msg** string | always | What was done. **Sample:** xml added |
### Authors
* Richard Levenberg (@richardcs)
* Jon Hawkesworth (@jhawkesworth)
ansible Community.Windows Community.Windows
=================
Collection version 1.7.0
Plugin Index
------------
These are the plugins in the community.windows collection
### Lookup Plugins
* [laps\_password](laps_password_lookup#ansible-collections-community-windows-laps-password-lookup) – Retrieves the LAPS password for a server.
### Modules
* [psexec](psexec_module#ansible-collections-community-windows-psexec-module) – Runs commands on a remote Windows host based on the PsExec model
* [win\_audit\_policy\_system](win_audit_policy_system_module#ansible-collections-community-windows-win-audit-policy-system-module) – Used to make changes to the system wide Audit Policy
* [win\_audit\_rule](win_audit_rule_module#ansible-collections-community-windows-win-audit-rule-module) – Adds an audit rule to files, folders, or registry keys
* [win\_auto\_logon](win_auto_logon_module#ansible-collections-community-windows-win-auto-logon-module) – Adds or Sets auto logon registry keys.
* [win\_certificate\_info](win_certificate_info_module#ansible-collections-community-windows-win-certificate-info-module) – Get information on certificates from a Windows Certificate Store
* [win\_computer\_description](win_computer_description_module#ansible-collections-community-windows-win-computer-description-module) – Set windows description, owner and organization
* [win\_credential](win_credential_module#ansible-collections-community-windows-win-credential-module) – Manages Windows Credentials in the Credential Manager
* [win\_data\_deduplication](win_data_deduplication_module#ansible-collections-community-windows-win-data-deduplication-module) – Module to enable Data Deduplication on a volume.
* [win\_defrag](win_defrag_module#ansible-collections-community-windows-win-defrag-module) – Consolidate fragmented files on local volumes
* [win\_dhcp\_lease](win_dhcp_lease_module#ansible-collections-community-windows-win-dhcp-lease-module) – Manage Windows Server DHCP Leases
* [win\_disk\_facts](win_disk_facts_module#ansible-collections-community-windows-win-disk-facts-module) – Show the attached disks and disk information of the target host
* [win\_disk\_image](win_disk_image_module#ansible-collections-community-windows-win-disk-image-module) – Manage ISO/VHD/VHDX mounts on Windows hosts
* [win\_dns\_record](win_dns_record_module#ansible-collections-community-windows-win-dns-record-module) – Manage Windows Server DNS records
* [win\_dns\_zone](win_dns_zone_module#ansible-collections-community-windows-win-dns-zone-module) – Manage Windows Server DNS Zones
* [win\_domain\_computer](win_domain_computer_module#ansible-collections-community-windows-win-domain-computer-module) – Manage computers in Active Directory
* [win\_domain\_group](win_domain_group_module#ansible-collections-community-windows-win-domain-group-module) – Creates, modifies or removes domain groups
* [win\_domain\_group\_membership](win_domain_group_membership_module#ansible-collections-community-windows-win-domain-group-membership-module) – Manage Windows domain group membership
* [win\_domain\_object\_info](win_domain_object_info_module#ansible-collections-community-windows-win-domain-object-info-module) – Gather information an Active Directory object
* [win\_domain\_user](win_domain_user_module#ansible-collections-community-windows-win-domain-user-module) – Manages Windows Active Directory user accounts
* [win\_dotnet\_ngen](win_dotnet_ngen_module#ansible-collections-community-windows-win-dotnet-ngen-module) – Runs ngen to recompile DLLs after .NET updates
* [win\_eventlog](win_eventlog_module#ansible-collections-community-windows-win-eventlog-module) – Manage Windows event logs
* [win\_eventlog\_entry](win_eventlog_entry_module#ansible-collections-community-windows-win-eventlog-entry-module) – Write entries to Windows event logs
* [win\_feature\_info](win_feature_info_module#ansible-collections-community-windows-win-feature-info-module) – Gather information about Windows features
* [win\_file\_compression](win_file_compression_module#ansible-collections-community-windows-win-file-compression-module) – Alters the compression of files and directories on NTFS partitions.
* [win\_file\_version](win_file_version_module#ansible-collections-community-windows-win-file-version-module) – Get DLL or EXE file build version
* [win\_firewall](win_firewall_module#ansible-collections-community-windows-win-firewall-module) – Enable or disable the Windows Firewall
* [win\_firewall\_rule](win_firewall_rule_module#ansible-collections-community-windows-win-firewall-rule-module) – Windows firewall automation
* [win\_format](win_format_module#ansible-collections-community-windows-win-format-module) – Formats an existing volume or a new volume on an existing partition on Windows
* [win\_hosts](win_hosts_module#ansible-collections-community-windows-win-hosts-module) – Manages hosts file entries on Windows.
* [win\_hotfix](win_hotfix_module#ansible-collections-community-windows-win-hotfix-module) – Install and uninstalls Windows hotfixes
* [win\_http\_proxy](win_http_proxy_module#ansible-collections-community-windows-win-http-proxy-module) – Manages proxy settings for WinHTTP
* [win\_iis\_virtualdirectory](win_iis_virtualdirectory_module#ansible-collections-community-windows-win-iis-virtualdirectory-module) – Configures a virtual directory in IIS
* [win\_iis\_webapplication](win_iis_webapplication_module#ansible-collections-community-windows-win-iis-webapplication-module) – Configures IIS web applications
* [win\_iis\_webapppool](win_iis_webapppool_module#ansible-collections-community-windows-win-iis-webapppool-module) – Configure IIS Web Application Pools
* [win\_iis\_webbinding](win_iis_webbinding_module#ansible-collections-community-windows-win-iis-webbinding-module) – Configures a IIS Web site binding
* [win\_iis\_website](win_iis_website_module#ansible-collections-community-windows-win-iis-website-module) – Configures a IIS Web site
* [win\_inet\_proxy](win_inet_proxy_module#ansible-collections-community-windows-win-inet-proxy-module) – Manages proxy settings for WinINet and Internet Explorer
* [win\_initialize\_disk](win_initialize_disk_module#ansible-collections-community-windows-win-initialize-disk-module) – Initializes disks on Windows Server
* [win\_lineinfile](win_lineinfile_module#ansible-collections-community-windows-win-lineinfile-module) – Ensure a particular line is in a file, or replace an existing line using a back-referenced regular expression
* [win\_mapped\_drive](win_mapped_drive_module#ansible-collections-community-windows-win-mapped-drive-module) – Map network drives for users
* [win\_msg](win_msg_module#ansible-collections-community-windows-win-msg-module) – Sends a message to logged in users on Windows hosts
* [win\_net\_adapter\_feature](win_net_adapter_feature_module#ansible-collections-community-windows-win-net-adapter-feature-module) – Enable or disable certain network adapters.
* [win\_netbios](win_netbios_module#ansible-collections-community-windows-win-netbios-module) – Manage NetBIOS over TCP/IP settings on Windows.
* [win\_nssm](win_nssm_module#ansible-collections-community-windows-win-nssm-module) – Install a service using NSSM
* [win\_pagefile](win_pagefile_module#ansible-collections-community-windows-win-pagefile-module) – Query or change pagefile configuration
* [win\_partition](win_partition_module#ansible-collections-community-windows-win-partition-module) – Creates, changes and removes partitions on Windows Server
* [win\_pester](win_pester_module#ansible-collections-community-windows-win-pester-module) – Run Pester tests on Windows hosts
* [win\_power\_plan](win_power_plan_module#ansible-collections-community-windows-win-power-plan-module) – Changes the power plan of a Windows system
* [win\_product\_facts](win_product_facts_module#ansible-collections-community-windows-win-product-facts-module) – Provides Windows product and license information
* [win\_psexec](win_psexec_module#ansible-collections-community-windows-win-psexec-module) – Runs commands (remotely) as another (privileged) user
* [win\_psmodule](win_psmodule_module#ansible-collections-community-windows-win-psmodule-module) – Adds or removes a Windows PowerShell module
* [win\_psmodule\_info](win_psmodule_info_module#ansible-collections-community-windows-win-psmodule-info-module) – Gather information about PowerShell Modules
* [win\_psrepository](win_psrepository_module#ansible-collections-community-windows-win-psrepository-module) – Adds, removes or updates a Windows PowerShell repository.
* [win\_psrepository\_copy](win_psrepository_copy_module#ansible-collections-community-windows-win-psrepository-copy-module) – Copies registered PSRepositories to other user profiles
* [win\_psrepository\_info](win_psrepository_info_module#ansible-collections-community-windows-win-psrepository-info-module) – Gather information about PSRepositories
* [win\_psscript](win_psscript_module#ansible-collections-community-windows-win-psscript-module) – Install and manage PowerShell scripts from a PSRepository
* [win\_psscript\_info](win_psscript_info_module#ansible-collections-community-windows-win-psscript-info-module) – Gather information about installed PowerShell Scripts
* [win\_pssession\_configuration](win_pssession_configuration_module#ansible-collections-community-windows-win-pssession-configuration-module) – Manage PSSession Configurations
* [win\_rabbitmq\_plugin](win_rabbitmq_plugin_module#ansible-collections-community-windows-win-rabbitmq-plugin-module) – Manage RabbitMQ plugins
* [win\_rds\_cap](win_rds_cap_module#ansible-collections-community-windows-win-rds-cap-module) – Manage Connection Authorization Policies (CAP) on a Remote Desktop Gateway server
* [win\_rds\_rap](win_rds_rap_module#ansible-collections-community-windows-win-rds-rap-module) – Manage Resource Authorization Policies (RAP) on a Remote Desktop Gateway server
* [win\_rds\_settings](win_rds_settings_module#ansible-collections-community-windows-win-rds-settings-module) – Manage main settings of a Remote Desktop Gateway server
* [win\_region](win_region_module#ansible-collections-community-windows-win-region-module) – Set the region and format settings
* [win\_regmerge](win_regmerge_module#ansible-collections-community-windows-win-regmerge-module) – Merges the contents of a registry file into the Windows registry
* [win\_robocopy](win_robocopy_module#ansible-collections-community-windows-win-robocopy-module) – Synchronizes the contents of two directories using Robocopy
* [win\_route](win_route_module#ansible-collections-community-windows-win-route-module) – Add or remove a static route
* [win\_say](win_say_module#ansible-collections-community-windows-win-say-module) – Text to speech module for Windows to speak messages and optionally play sounds
* [win\_scheduled\_task](win_scheduled_task_module#ansible-collections-community-windows-win-scheduled-task-module) – Manage scheduled tasks
* [win\_scheduled\_task\_stat](win_scheduled_task_stat_module#ansible-collections-community-windows-win-scheduled-task-stat-module) – Get information about Windows Scheduled Tasks
* [win\_scoop](win_scoop_module#ansible-collections-community-windows-win-scoop-module) – Manage packages using Scoop
* [win\_scoop\_bucket](win_scoop_bucket_module#ansible-collections-community-windows-win-scoop-bucket-module) – Manage Scoop buckets
* [win\_security\_policy](win_security_policy_module#ansible-collections-community-windows-win-security-policy-module) – Change local security policy settings
* [win\_shortcut](win_shortcut_module#ansible-collections-community-windows-win-shortcut-module) – Manage shortcuts on Windows
* [win\_snmp](win_snmp_module#ansible-collections-community-windows-win-snmp-module) – Configures the Windows SNMP service
* [win\_timezone](win_timezone_module#ansible-collections-community-windows-win-timezone-module) – Sets Windows machine timezone
* [win\_toast](win_toast_module#ansible-collections-community-windows-win-toast-module) – Sends Toast windows notification to logged in users on Windows 10 or later hosts
* [win\_unzip](win_unzip_module#ansible-collections-community-windows-win-unzip-module) – Unzips compressed files and archives on the Windows node
* [win\_user\_profile](win_user_profile_module#ansible-collections-community-windows-win-user-profile-module) – Manages the Windows user profiles.
* [win\_wait\_for\_process](win_wait_for_process_module#ansible-collections-community-windows-win-wait-for-process-module) – Waits for a process to exist or not exist before continuing.
* [win\_wakeonlan](win_wakeonlan_module#ansible-collections-community-windows-win-wakeonlan-module) – Send a magic Wake-on-LAN (WoL) broadcast packet
* [win\_webpicmd](win_webpicmd_module#ansible-collections-community-windows-win-webpicmd-module) – Installs packages using Web Platform Installer command-line
* [win\_xml](win_xml_module#ansible-collections-community-windows-win-xml-module) – Manages XML file content on Windows hosts
* [win\_zip](win_zip_module#ansible-collections-community-windows-win-zip-module) – Compress file or directory as zip archive on the Windows node
See also
List of [collections](../../index#list-of-collections) with docs hosted here.
| programming_docs |
ansible community.windows.win_pagefile – Query or change pagefile configuration community.windows.win\_pagefile – Query or change pagefile configuration
========================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_pagefile`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Query current pagefile configuration.
* Enable/Disable AutomaticManagedPagefile.
* Create new or override pagefile configuration.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **automatic** boolean | **Choices:*** no
* yes
| Configures AutomaticManagedPagefile for the entire system. |
| **drive** string | | The drive of the pagefile. |
| **initial\_size** integer | | The initial size of the pagefile in megabytes. |
| **maximum\_size** integer | | The maximum size of the pagefile in megabytes. |
| **override** boolean | **Choices:*** no
* **yes** ←
| Override the current pagefile on the drive. |
| **remove\_all** boolean | **Choices:*** **no** ←
* yes
| Remove all pagefiles in the system, not including automatic managed. |
| **state** string | **Choices:*** absent
* present
* **query** ←
| State of the pagefile. |
| **system\_managed** boolean | **Choices:*** **no** ←
* yes
| Configures current pagefile to be managed by the system. |
| **test\_path** boolean | **Choices:*** no
* **yes** ←
| Use Test-Path on the drive to make sure the drive is accessible before creating the pagefile. |
Notes
-----
Note
* There is difference between automatic managed pagefiles that configured once for the entire system and system managed pagefile that configured per pagefile.
* InitialSize 0 and MaximumSize 0 means the pagefile is managed by the system.
* Value out of range exception may be caused by several different issues, two common problems - No such drive, Pagefile size is too small.
* Setting a pagefile when AutomaticManagedPagefile is on will disable the AutomaticManagedPagefile.
Examples
--------
```
- name: Query pagefiles configuration
community.windows.win_pagefile:
- name: Query C pagefile
community.windows.win_pagefile:
drive: C
- name: Set C pagefile, don't override if exists
community.windows.win_pagefile:
drive: C
initial_size: 1024
maximum_size: 1024
override: no
state: present
- name: Set C pagefile, override if exists
community.windows.win_pagefile:
drive: C
initial_size: 1024
maximum_size: 1024
state: present
- name: Remove C pagefile
community.windows.win_pagefile:
drive: C
state: absent
- name: Remove all current pagefiles, enable AutomaticManagedPagefile and query at the end
community.windows.win_pagefile:
remove_all: yes
automatic: yes
- name: Remove all pagefiles disable AutomaticManagedPagefile and set C pagefile
community.windows.win_pagefile:
drive: C
initial_size: 2048
maximum_size: 2048
remove_all: yes
automatic: no
state: present
- name: Set D pagefile, override if exists
community.windows.win_pagefile:
drive: d
initial_size: 1024
maximum_size: 1024
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **automatic\_managed\_pagefiles** boolean | When state is query. | Whether the pagefiles is automatically managed. **Sample:** True |
| **pagefiles** list / elements=string | When state is query. | Contains caption, description, initial\_size, maximum\_size and name for each pagefile in the system. **Sample:** [{'caption': "c:\\ 'pagefile.sys'", 'description': "'pagefile.sys' @ c:\\", 'initial\_size': 2048, 'maximum\_size': 2048, 'name': 'c:\\pagefile.sys'}, {'caption': "d:\\ 'pagefile.sys'", 'description': "'pagefile.sys' @ d:\\", 'initial\_size': 1024, 'maximum\_size': 1024, 'name': 'd:\\pagefile.sys'}] |
### Authors
* Liran Nisanov (@LiranNis)
ansible community.windows.win_scoop_bucket – Manage Scoop buckets community.windows.win\_scoop\_bucket – Manage Scoop buckets
===========================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_scoop_bucket`.
New in version 1.0.0: of community.windows
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Manage Scoop buckets
Requirements
------------
The below requirements are needed on the host that executes this module.
* git
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **name** string / required | | Name of the Scoop bucket. |
| **repo** string | | Git repository that contains the scoop bucket |
| **state** string | **Choices:*** absent
* **present** ←
| State of the Scoop bucket. When `absent`, will ensure the package is not installed. When `present`, will ensure the package is installed. |
See Also
--------
See also
[community.windows.win\_scoop](win_scoop_module#ansible-collections-community-windows-win-scoop-module)
The official documentation on the **community.windows.win\_scoop** module.
[Scoop website](https://scoop.sh)
More information about Scoop
[Scoop directory](https://rasa.github.io/scoop-directory/)
A directory of buckets for the scoop package manager for Windows
Examples
--------
```
- name: Add the extras bucket
community.windows.win_scoop_bucket:
name: extras
- name: Remove the versions bucket
community.windows.win_scoop_bucket:
name: versions
state: absent
- name: Add a custom bucket
community.windows.win_scoop_bucket:
name: my-bucket
repo: https://github.com/example/my-bucket
```
### Authors
* Jamie Magee (@JamieMagee)
ansible community.windows.win_net_adapter_feature – Enable or disable certain network adapters. community.windows.win\_net\_adapter\_feature – Enable or disable certain network adapters.
==========================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_net_adapter_feature`.
New in version 1.2.0: of community.windows
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* Enable or disable some network components of a certain network adapter or all the network adapters.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **component\_id** list / elements=string / required | | Specify the below component\_id of network adapters. component\_id (DisplayName)
`ms_implat` (Microsoft Network Adapter Multiplexor Protocol)
`ms_lltdio` (Link-Layer Topology Discovery Mapper I/O Driver)
`ms_tcpip6` (Internet Protocol Version 6 (TCP/IPv6))
`ms_tcpip` (Internet Protocol Version 4 (TCP/IPv4))
`ms_lldp` (Microsoft LLDP Protocol Driver)
`ms_rspndr` (Link-Layer Topology Discovery Responder)
`ms_msclient` (Client for Microsoft Networks)
`ms_pacer` (QoS Packet Scheduler) If you'd like to set custom adapters like 'Juniper Network Service', get the *component\_id* by running the `Get-NetAdapterBinding` cmdlet. |
| **interface** list / elements=string / required | | Name of Network Adapter Interface. For example, `Ethernet0` or `*`. |
| **state** string | **Choices:*** **enabled** ←
* disabled
| Specify the state of ms\_tcpip6 of interfaces. |
Examples
--------
```
- name: enable multiple interfaces of multiple interfaces
community.windows.win_net_adapter_feature:
interface:
- 'Ethernet0'
- 'Ethernet1'
state: enabled
component_id:
- ms_tcpip6
- ms_server
- name: Enable ms_tcpip6 of all the Interface
community.windows.win_net_adapter_feature:
interface: '*'
state: enabled
component_id:
- ms_tcpip6
```
### Authors
* ライトウェルの人 (@jirolin)
ansible community.windows.win_pssession_configuration – Manage PSSession Configurations community.windows.win\_pssession\_configuration – Manage PSSession Configurations
=================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_pssession_configuration`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Register, unregister, and modify PSSession Configurations for PowerShell remoting.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **access\_mode** string | **Choices:*** disabled
* local
* remote
| Controls whether the session configuration allows connection from the `local` machine only, both local and `remote`, or none (`disabled`). |
| **alias\_definitions** dictionary | | A dict that defines aliases for each session. |
| **assemblies\_to\_load** list / elements=string | | The assemblies that should be loaded into each session. |
| **async\_poll** integer | **Default:**1 | Sets a delay in seconds between each check of the asynchronous execution status. Replicates the functionality of the `poll` keyword. Has no effect in check mode.
*async\_poll=0* is not supported. |
| **async\_timeout** integer | **Default:**300 | Sets a timeout for how long in seconds to wait for asynchronous module execution and waiting for the connection to recover. Replicates the functionality of the `async` keyword. Has no effect in check mode. |
| **author** string | | The author of the session configuration. This value is metadata and does not affect the functionality of the session configuration. If not set, a value may be generated automatically. See also *lenient\_config\_fields*. |
| **company\_name** string | | The company that authored the session configuration. This value is metadata and does not affect the functionality of the session configuration. If not set, a value may be generated automatically. See also *lenient\_config\_fields*. |
| **copyright** string | | The copyright statement of the session configuration. This value is metadata and does not affect the functionality of the session configuration. If not set, a value may be generated automatically. See also *lenient\_config\_fields*. |
| **description** string | | The description of the session configuration. This value is metadata and does not affect the functionality of the session configuration. See also *lenient\_config\_fields*. |
| **environment\_variables** dictionary | | A dict that defines environment variables for each session. |
| **execution\_policy** string | **Choices:*** default
* remote\_signed
* restricted
* undefined
* unrestricted
| The execution policy controlling script execution in the PowerShell session. |
| **formats\_to\_process** list / elements=path | | Paths to format definition files to process for each session. |
| **function\_definitions** dictionary | | A dict that defines functions for each session. |
| **group\_managed\_service\_account** string | | If the session will run as a group managed service account (gMSA) then this is the name. Do not use *run\_as\_credential\_username* and *run\_as\_credential\_password* to specify a gMSA. |
| **guid** raw | | The GUID (UUID) of the session configuration file. This value is metadata, so it only matters if you use it externally. If not set, a value will be generated automatically. Acceptable GUID formats are flexible. Any string of 32 hexadecimal digits will be accepted, with all hyphens `-` and opening/closing `{}` ignored. See also *lenient\_config\_fields*. |
| **language\_mode** string | **Choices:*** no\_language
* restricted\_language
* constrained\_language
* full\_language
| Determines the language mode of the PowerShell session. |
| **lenient\_config\_fields** list / elements=string | **Default:**["guid", "author", "company\_name", "copyright", "description"] | Some fields used in the session configuration do not affect its function, and are sometimes auto-generated when not specified. To avoid unnecessarily changing the configuration on each run, the values of these options will only be enforced when they are explicitly specified. |
| **maximum\_received\_data\_size\_per\_command\_mb** raw | | Sets the maximum received data size per command in MB. Must fit into a double precision floating point value. |
| **maximum\_received\_object\_size\_mb** raw | | Sets the maximum object size in MB. Must fit into a double precision floating point value. |
| **modules\_to\_import** list / elements=raw | | A list of modules that should be imported into the session. Any valid PowerShell module spec can be used here, so simple str names or dicts can be used. If a dict is used, no snake\_case conversion is done, so the original PowerShell names must be used. |
| **mount\_user\_drive** boolean | **Choices:*** no
* yes
| If `yes` the session creates and mounts a user-specific PSDrive for use with file transfers. |
| **name** string / required | | The name of the session configuration to manage. |
| **powershell\_version** raw | | The minimum required PowerShell version for this session. Must be a valid .Net System.Version string. |
| **processor\_architecure** string | **Choices:*** amd64
* x86
| The processor architecture of the session (32 bit vs. 64 bit). |
| **required\_groups** dictionary | | For JEA sessions, defines conditional access rules about which groups a connecting user must belong to. For more information see <https://docs.microsoft.com/en-us/powershell/scripting/learn/remoting/jea/session-configurations#conditional-access-rules>. |
| **role\_definitions** dictionary | | A dict defining the roles for JEA sessions. For more information see <https://docs.microsoft.com/en-us/powershell/scripting/learn/remoting/jea/session-configurations#role-definitions>. |
| **run\_as\_credential\_password** string | | The password for *run\_as\_credential\_username*. |
| **run\_as\_credential\_username** string | | Used to set a RunAs account for the session. All commands executed in the session will be run as this user. To use a gMSA, see *group\_managed\_service\_account*. To use a virtual account, see *run\_as\_virtual\_account* and *run\_as\_virtual\_account\_groups*. Status will always be `changed` when a RunAs credential is set because the password cannot be retrieved for comparison. |
| **run\_as\_virtual\_account** boolean | **Choices:*** no
* yes
| If `yes` the session runs as a virtual account. Do not use *run\_as\_credential\_username* and *run\_as\_credential\_password* to specify a virtual account. |
| **run\_as\_virtual\_account\_groups** list / elements=string | | If *run\_as\_virtual\_account=yes* this is a list of groups to add the virtual account to. |
| **schema\_version** raw | | The schema version of the session configuration file. If not set, a value will be generated automatically. Must be a valid .Net System.Version string. |
| **scripts\_to\_process** list / elements=string | | A list of paths to script files ending in `.ps1` that should be applied to the session. |
| **security\_descriptor\_sddl** string | | An SDDL string that controls which users and groups can connect to the session. If *role\_definitions* is specified the security descriptor will be set based on that. If this option is not specified the default security descriptor will be applied. |
| **session\_type** string | **Choices:*** default
* empty
* restricted\_remote\_server
| Controls what type of session this is. |
| **startup\_script** path | | A script that gets run on session startup. |
| **state** string | **Choices:*** **present** ←
* absent
| The desired state of the configuration. |
| **thread\_apartment\_state** string | **Choices:*** mta
* sta
| The apartment state for the PowerShell session. |
| **thread\_options** string | **Choices:*** default
* reuse\_thread
* use\_current\_thread
* use\_new\_thread
| Sets thread options for the session. |
| **transcript\_directory** path | | Automatic session transcripts will be written to this directory. |
| **types\_to\_process** list / elements=path | | Paths to type definition files to process for each session. |
| **use\_shared\_process** boolean | **Choices:*** no
* yes
| If `yes` then the session shares a process for each session. |
| **user\_drive\_maximum\_size** raw | | The maximum size of the user drive in bytes. Must fit into an Int64. |
| **variable\_definitions** list / elements=dictionary | | A list of dicts where each elements defines a variable for each session. |
| **visible\_aliases** list / elements=string | | The aliases that can be used in the session. For more information see <https://docs.microsoft.com/en-us/powershell/scripting/learn/remoting/jea/role-capabilities>. |
| **visible\_cmdlets** list / elements=raw | | The cmdlets that can be used in the session. The elements can be simple names or complex command specifications. For more information see <https://docs.microsoft.com/en-us/powershell/scripting/learn/remoting/jea/role-capabilities>. |
| **visible\_external\_commands** list / elements=string | | The external commands and scripts that can be used in the session. For more information see <https://docs.microsoft.com/en-us/powershell/scripting/learn/remoting/jea/role-capabilities>. |
| **visible\_functions** list / elements=raw | | The functions that can be used in the session. The elements can be simple names or complex command specifications. For more information see <https://docs.microsoft.com/en-us/powershell/scripting/learn/remoting/jea/role-capabilities>. |
Notes
-----
Note
* This module will restart the WinRM service on any change. This will terminate all WinRM connections including those by other Ansible runs.
* Internally this module uses `async` when not in check mode to ensure things go smoothly when restarting the WinRM service.
* The standard `async` and `poll` keywords cannot be used; instead use the *async\_timeout* and *async\_poll* options to control asynchronous execution.
* Options that don’t list a default value here will use the defaults of `New-PSSessionConfigurationFile` and `Register-PSSessionConfiguration`.
* If a value can be specified in both a session config file and directly in the session options, this module will prefer the setting be in the config file.
See Also
--------
See also
[C(New-PSSessionConfigurationFile) Reference](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/new-pssessionconfigurationfile)
Details and defaults for options that end up in the session configuration file.
[C(Register-PSSessionConfiguration) Reference](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/register-pssessionconfiguration)
Details and defaults for options that are not specified in the session config file.
[PowerShell Just Enough Administration (JEA)](https://docs.microsoft.com/en-us/powershell/scripting/learn/remoting/jea/overview)
Refer to the JEA documentation for advanced usage of some options
[About Session Configurations](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_session_configurations)
General information about session configurations.
[About Session Configuration Files](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_session_configuration_files)
General information about session configuration files.
Examples
--------
```
- name: Register a session configuration that loads modules automatically
community.windows.win_pssession_configuration:
name: WebAdmin
modules_to_import:
- WebAdministration
- IISAdministration
description: This endpoint has IIS modules pre-loaded
- name: Set up an admin endpoint with a restricted execution policy
community.windows.win_pssession_configuration:
name: GloboCorp.Admin
company_name: Globo Corp
description: Admin Endpoint
execution_policy: restricted
- name: Create a complex JEA endpoint
community.windows.win_pssession_configuration:
name: RBAC.Endpoint
session_type: restricted_remote_server
run_as_virtual_account: True
transcript_directory: '\\server\share\Transcripts'
language_mode: no_language
execution_policy: restricted
role_definitions:
'CORP\IT Support':
RoleCapabilities:
- PasswordResetter
- EmployeeOffboarder
'CORP\Webhosts':
RoleCapabilities: IISAdmin
visible_functions:
- tabexpansion2
- help
visible_cmdlets:
- Get-Help
- Name: Get-Service
Parameters:
- Name: DependentServices
- Name: RequiredServices
- Name: Name
ValidateSet:
- WinRM
- W3SVC
- WAS
visible_aliases:
- gsv
state: present
- name: Remove a session configuration
community.windows.win_pssession_configuration:
name: UnusedEndpoint
state: absent
- name: Set a sessions configuration with tweaked async values
community.windows.win_pssession_configuration:
name: MySession
description: A sample session
async_timeout: 500
async_poll: 5
```
### Authors
* Brian Scholer (@briantist)
| programming_docs |
ansible community.windows.win_dhcp_lease – Manage Windows Server DHCP Leases community.windows.win\_dhcp\_lease – Manage Windows Server DHCP Leases
======================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_dhcp_lease`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage Windows Server DHCP Leases (IPv4 Only)
* Adds, Removes and Modifies DHCP Leases and Reservations
* Task should be delegated to a Windows DHCP Server
Requirements
------------
The below requirements are needed on the host that executes this module.
* This module requires Windows Server 2012 or Newer
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **description** string | | Specifies the description for reservation being created. Only applicable to l(type=reservation). |
| **dns\_hostname** string | | Specifies the DNS hostname of the client for which the IP address lease is to be added. |
| **dns\_regtype** string | **Choices:*** **aptr** ←
* a
* noreg
| Indicates the type of DNS record to be registered by the DHCP. server service for this lease. l(a) results in an A record being registered. l(aptr) results in both A and PTR records to be registered. l(noreg) results in no DNS records being registered. |
| **duration** integer | | Specifies the duration of the DHCP lease in days. The duration value only applies to l(type=lease). Defaults to the duration specified by the DHCP server configuration. Only applicable to l(type=lease). |
| **ip** string | | The IPv4 address of the client server/computer. This is a required parameter, if l(mac) is not set. Can be used to identify an existing lease/reservation, instead of l(mac). |
| **mac** string | | Specifies the client identifier to be set on the IPv4 address. This is a required parameter, if l(ip) is not set. Windows clients use the MAC address as the client ID. Linux and other operating systems can use other types of identifiers. Can be used to identify an existing lease/reservation, instead of l(ip). |
| **reservation\_name** string | | Specifies the name of the reservation being created. Only applicable to l(type=reservation). |
| **scope\_id** string | | Specifies the scope identifier as defined by the DHCP server. This is a required parameter, if l(state=present) and the reservation or lease doesn't already exist. Not required if updating an existing lease or reservation. |
| **state** string | **Choices:*** **present** ←
* absent
| Specifies the desired state of the DHCP lease or reservation. |
| **type** string | **Choices:*** **reservation** ←
* lease
| The type of DHCP address. Leases expire as defined by l(duration). When l(duration) is not specified, the server default is used. Reservations are permanent. |
Examples
--------
```
- name: Ensure DHCP reservation exists
community.windows.win_dhcp_lease:
type: reservation
ip: 192.168.100.205
scope_id: 192.168.100.0
mac: 00:B1:8A:D1:5A:1F
dns_hostname: "{{ ansible_inventory }}"
description: Testing Server
- name: Ensure DHCP lease or reservation does not exist
community.windows.win_dhcp_lease:
mac: 00:B1:8A:D1:5A:1F
state: absent
- name: Ensure DHCP lease or reservation does not exist
community.windows.win_dhcp_lease:
ip: 192.168.100.205
state: absent
- name: Convert DHCP lease to reservation & update description
community.windows.win_dhcp_lease:
type: reservation
ip: 192.168.100.205
description: Testing Server
- name: Convert DHCP reservation to lease
community.windows.win_dhcp_lease:
type: lease
ip: 192.168.100.205
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **lease** dictionary | When l(state=present) | New/Updated DHCP object parameters **Sample:** {'address\_state': 'InactiveReservation', 'client\_id': '0a-0b-0c-04-05-aa', 'description': 'Really Fancy', 'ip\_address': '172.16.98.230', 'name': None, 'scope\_id': '172.16.98.0'} |
### Authors
* Joe Zollo (@joezollo)
ansible community.windows.win_zip – Compress file or directory as zip archive on the Windows node community.windows.win\_zip – Compress file or directory as zip archive on the Windows node
==========================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_zip`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Compress file or directory as zip archive.
* For non-Windows targets, use the ansible.builtin.archive module instead.
Requirements
------------
The below requirements are needed on the host that executes this module.
* .NET Framework 4.5 or later
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **dest** path / required | | Destination path of zip file (provide absolute path of zip file on the target node). |
| **src** string / required | | File or directory path to be zipped (provide absolute path on the target node). When a directory path the directory is zipped as the root entry in the archive. Specify `\*` to the end of *src* to zip the contents of the directory and not the directory itself. |
Notes
-----
Note
* The filenames in the zip are encoded using UTF-8.
See Also
--------
See also
ansible.builtin.archive
The official documentation on the **ansible.builtin.archive** module.
Examples
--------
```
- name: Compress a file
community.windows.win_zip:
src: C:\Users\hiyoko\log.txt
dest: C:\Users\hiyoko\log.zip
- name: Compress a directory as the root of the archive
community.windows.win_zip:
src: C:\Users\hiyoko\log
dest: C:\Users\hiyoko\log.zip
- name: Compress the directories contents
community.windows.win_zip:
src: C:\Users\hiyoko\log\*
dest: C:\Users\hiyoko\log.zip
```
### Authors
* Kento Yagisawa (@hiyoko\_taisa)
ansible community.windows.win_nssm – Install a service using NSSM community.windows.win\_nssm – Install a service using NSSM
==========================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_nssm`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Install a Windows service using the NSSM wrapper.
* NSSM is a service helper which doesn’t suck. See <https://nssm.cc/> for more information.
Requirements
------------
The below requirements are needed on the host that executes this module.
* nssm >= 2.24.0 # (install via [chocolatey.chocolatey.win\_chocolatey](../../chocolatey/chocolatey/win_chocolatey_module#ansible-collections-chocolatey-chocolatey-win-chocolatey-module)) `win_chocolatey: name=nssm`
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **app\_environment** dictionary added in 1.2.0 of community.windows | | Key/Value pairs which will be added to the environment of the service application. |
| **app\_parameters** string | | A string representing a dictionary of parameters to be passed to the application when it starts. DEPRECATED since v2.8, please use *arguments* instead. This is mutually exclusive with *arguments*. |
| **app\_rotate\_bytes** integer | **Default:**104858 | NSSM will not rotate any file which is smaller than the configured number of bytes. |
| **app\_rotate\_online** integer | **Choices:*** 0
* 1
**Default:**0 | If set to 1, nssm can rotate files which grow to the configured file size limit while the service is running. |
| **app\_stop\_method\_console** integer | | Time to wait after sending Control-C. |
| **app\_stop\_method\_skip** integer | **Choices:*** 1
* 2
* 3
* 4
* 5
* 6
* 7
* 8
* 9
* 10
* 11
* 12
* 13
* 14
* 15
| To disable service shutdown methods, set to the sum of one or more of the numbers 1 - Don't send Control-C to the console. 2 - Don't send WM\_CLOSE to windows. 4 - Don't send WM\_QUIT to threads. 8 - Don't call TerminateProcess(). |
| **application** path | | The application binary to run as a service Required when *state* is `present`, `started`, `stopped`, or `restarted`. |
| **arguments** string | | Parameters to be passed to the application when it starts. This can be either a simple string or a list. This is mutually exclusive with *app\_parameters*.
aliases: app\_parameters\_free\_form |
| **dependencies** list / elements=string | | Service dependencies that has to be started to trigger startup, separated by comma. DEPRECATED, will be removed in a major release after `2021-07-01`, please use the [ansible.windows.win\_service](../../ansible/windows/win_service_module) module instead. |
| **description** string | | The description to set for the service. |
| **display\_name** string | | The display name to set for the service. |
| **executable** path | **Default:**"nssm.exe" | The location of the NSSM utility (in case it is not located in your PATH). |
| **name** string / required | | Name of the service to operate on. |
| **password** string | | Password to be used for service startup. DEPRECATED, will be removed in a major release after `2021-07-01`, please use the [ansible.windows.win\_service](../../ansible/windows/win_service_module) module instead. |
| **start\_mode** string | **Choices:*** **auto** ←
* delayed
* disabled
* manual
| If `auto` is selected, the service will start at bootup.
`delayed` causes a delayed but automatic start after boot.
`manual` means that the service will start only when another service needs it.
`disabled` means that the service will stay off, regardless if it is needed or not. DEPRECATED, will be removed in a major release after `2021-07-01`, please use the [ansible.windows.win\_service](../../ansible/windows/win_service_module) module instead. |
| **state** string | **Choices:*** absent
* **present** ←
* started
* stopped
* restarted
| State of the service on the system. Values `started`, `stopped`, and `restarted` are deprecated and will be removed on a major release after `2021-07-01`. Please use the [ansible.windows.win\_service](../../ansible/windows/win_service_module) module instead to start, stop or restart the service. |
| **stderr\_file** path | | Path to receive error output. |
| **stdout\_file** path | | Path to receive output. |
| **user** string | | User to be used for service startup. DEPRECATED, will be removed in a major release after `2021-07-01`, please use the [ansible.windows.win\_service](../../ansible/windows/win_service_module) module instead. |
| **working\_directory** path | | The working directory to run the service executable from (defaults to the directory containing the application binary)
aliases: app\_directory, chdir |
Notes
-----
Note
* The service will NOT be started after its creation when `state=present`.
* Once the service is created, you can use the M(ansible.windowswin\_service) module to start it or configure some additionals properties, such as its startup type, dependencies, service account, and so on.
See Also
--------
See also
[ansible.windows.win\_service](../../ansible/windows/win_service_module#ansible-collections-ansible-windows-win-service-module)
The official documentation on the **ansible.windows.win\_service** module.
Examples
--------
```
- name: Install the foo service
community.windows.win_nssm:
name: foo
application: C:\windows\foo.exe
# This will yield the following command: C:\windows\foo.exe bar "true"
- name: Install the Consul service with a list of parameters
community.windows.win_nssm:
name: Consul
application: C:\consul\consul.exe
arguments:
- agent
- -config-dir=C:\consul\config
# This is strictly equivalent to the previous example
- name: Install the Consul service with an arbitrary string of parameters
community.windows.win_nssm:
name: Consul
application: C:\consul\consul.exe
arguments: agent -config-dir=C:\consul\config
# Install the foo service, and then configure and start it with win_service
- name: Install the foo service, redirecting stdout and stderr to the same file
community.windows.win_nssm:
name: foo
application: C:\windows\foo.exe
stdout_file: C:\windows\foo.log
stderr_file: C:\windows\foo.log
- name: Configure and start the foo service using win_service
ansible.windows.win_service:
name: foo
dependencies: [ adf, tcpip ]
username: foouser
password: secret
start_mode: manual
state: started
- name: Install a script based service and define custom environment variables
community.windows.win_nssm:
name: <ServiceName>
application: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
arguments:
- <path-to-script>
- <script arg>
app_environment:
AUTH_TOKEN: <token value>
SERVER_URL: https://example.com
PATH: "<path-prepends>;{{ ansible_env.PATH }};<path-appends>"
- name: Remove the foo service
community.windows.win_nssm:
name: foo
state: absent
```
### Authors
* Adam Keech (@smadam813)
* George Frank (@georgefrank)
* Hans-Joachim Kliemeck (@h0nIg)
* Michael Wild (@themiwi)
* Kevin Subileau (@ksubileau)
* Shachaf Goldstein (@Shachaf92)
ansible community.windows.win_user_profile – Manages the Windows user profiles. community.windows.win\_user\_profile – Manages the Windows user profiles.
=========================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_user_profile`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Used to create or remove user profiles on a Windows host.
* This can be used to create a profile before a user logs on or delete a profile when removing a user account.
* A profile can be created for both a local or domain account.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **name** string | | Specifies the base name for the profile path. When *state* is `present` this is used to create the profile for *username* at a specific path within the profile directory. This cannot be used to specify a path outside of the profile directory but rather it specifies a folder(s) within this directory. If a profile for another user already exists at the same path, then a 3 digit incremental number is appended by Windows automatically. When *state* is `absent` and *username* is not set, then the module will remove all profiles that point to the profile path derived by this value. This is useful if the account no longer exists but the profile still remains. |
| **remove\_multiple** boolean | **Choices:*** **no** ←
* yes
| When *state* is `absent` and the value for *name* matches multiple profiles the module will fail. Set this value to `yes` to force the module to delete all the profiles found. |
| **state** string | **Choices:*** absent
* **present** ←
| Will ensure the profile exists when set to `present`. When creating a profile the *username* option must be set to a valid account. Will remove the profile(s) when set to `absent`. When removing a profile either *username* must be set to a valid account, or *name* is set to the profile's base name. |
| **username** sid | | The account name of security identifier (SID) for the profile. This must be set when *state* is `present` and must be a valid account or the SID of a valid account. When *state* is `absent` then this must still be a valid account number but the SID can be a deleted user's SID. |
See Also
--------
See also
[ansible.windows.win\_user](../../ansible/windows/win_user_module#ansible-collections-ansible-windows-win-user-module)
The official documentation on the **ansible.windows.win\_user** module.
[community.windows.win\_domain\_user](win_domain_user_module#ansible-collections-community-windows-win-domain-user-module)
The official documentation on the **community.windows.win\_domain\_user** module.
Examples
--------
```
- name: Create a profile for an account
community.windows.win_user_profile:
username: ansible-account
state: present
- name: Create a profile for an account at C:\Users\ansible
community.windows.win_user_profile:
username: ansible-account
name: ansible
state: present
- name: Remove a profile for a still valid account
community.windows.win_user_profile:
username: ansible-account
state: absent
- name: Remove a profile for a deleted account
community.windows.win_user_profile:
name: ansible
state: absent
- name: Remove a profile for a deleted account based on the SID
community.windows.win_user_profile:
username: S-1-5-21-3233007181-2234767541-1895602582-1305
state: absent
- name: Remove multiple profiles that exist at the basename path
community.windows.win_user_profile:
name: ansible
state: absent
remove_multiple: yes
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **path** string | always | The full path to the profile for the account. This will be null if `state=absent` and no profile was deleted. **Sample:** C:\Users\ansible |
### Authors
* Jordan Borean (@jborean93)
ansible community.windows.win_domain_object_info – Gather information an Active Directory object community.windows.win\_domain\_object\_info – Gather information an Active Directory object
===========================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_domain_object_info`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Gather information about multiple Active Directory object(s).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **domain\_password** string | | The password for `domain_username`. |
| **domain\_server** string | | Specified the Active Directory Domain Services instance to connect to. Can be in the form of an FQDN or NetBIOS name. If not specified then the value is based on the default domain of the computer running PowerShell. |
| **domain\_username** string | | The username to use when interacting with AD. If this is not set then the user that is used for authentication will be the connection user. Ansible will be unable to use the connection user unless auth is Kerberos with credential delegation or CredSSP, or become is used on the task. |
| **filter** string | | Specifies a query string using the PowerShell Expression Language syntax. This follows the same rules and formatting as the `-Filter` parameter for the PowerShell AD cmdlets exception there is no variable substitutions. This is mutually exclusive with *identity* and *ldap\_filter*. |
| **identity** string | | Specifies a single Active Directory object by its distinguished name or its object GUID. This is mutually exclusive with *filter* and *ldap\_filter*. This cannot be used with either the *search\_base* or *search\_scope* options. |
| **include\_deleted** boolean | **Choices:*** **no** ←
* yes
| Also search for deleted Active Directory objects. |
| **ldap\_filter** string | | Like *filter* but this is a tradiitional LDAP query string to filter the objects to return. This is mutually exclusive with *filter* and *identity*. |
| **properties** list / elements=string | | A list of properties to return. If a property is `*`, all properties that have a set value on the AD object will be returned. If a property is valid on the object but not set, it is only returned if defined explicitly in this option list. The properties `DistinguishedName`, `Name`, `ObjectClass`, and `ObjectGUID` are always returned. Specifying multiple properties can have a performance impact, it is best to only return what is needed. If an invalid property is specified then the module will display a warning for each object it is invalid on. |
| **search\_base** string | | Specify the Active Directory path to search for objects in. This cannot be set with *identity*. By default the search base is the default naming context of the target AD instance which is the DN returned by "(Get-ADRootDSE).defaultNamingContext". |
| **search\_scope** string | **Choices:*** base
* one\_level
* subtree
| Specify the scope of when searching for an object in the `search_base`.
`base` will limit the search to the base object so the maximum number of objects returned is always one. This will not search any objects inside a container..
`one_level` will search the current path and any immediate objects in that path.
`subtree` will search the current path and all objects of that path recursively. This cannot be set with *identity*. |
Notes
-----
Note
* The `sAMAccountType_AnsibleFlags` and `userAccountControl_AnsibleFlags` return property is something set by the module itself as an easy way to view what those flags represent. These properties cannot be used as part of the *filter* or *ldap\_filter* and are automatically added if those properties were requested.
Examples
--------
```
- name: Get all properties for the specified account using its DistinguishedName
community.windows.win_domain_object_info:
identity: CN=Username,CN=Users,DC=domain,DC=com
properties: '*'
- name: Get the SID for all user accounts as a filter
community.windows.win_domain_object_info:
filter: ObjectClass -eq 'user' -and objectCategory -eq 'Person'
properties:
- objectSid
- name: Get the SID for all user accounts as a LDAP filter
community.windows.win_domain_object_info:
ldap_filter: (&(objectClass=user)(objectCategory=Person))
properties:
- objectSid
- name: Search all computer accounts in a specific path that were added after February 1st
community.windows.win_domain_object_info:
filter: objectClass -eq 'computer' -and whenCreated -gt '20200201000000.0Z'
properties: '*'
search_scope: one_level
search_base: CN=Computers,DC=domain,DC=com
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **objects** list / elements=dictionary | always | A list of dictionaries that are the Active Directory objects found and the properties requested. The dict's keys are the property name and the value is the value for the property. All date properties are return in the ISO 8601 format in the UTC timezone. All SID properties are returned as a dict with the keys `Sid` as the SID string and `Name` as the translated SID account name. All byte properties are returned as a base64 string. All security descriptor properties are returned as the SDDL string of that descriptor. The properties `DistinguishedName`, `Name`, `ObjectClass`, and `ObjectGUID` are always returned. **Sample:** [{ "accountExpires": 0, "adminCount": 1, "CanonicalName": "domain.com/Users/Administrator", "CN": "Administrator", "Created": "2020-01-13T09:03:22.0000000Z", "Description": "Built-in account for administering computer/domain", "DisplayName": null, "DistinguishedName": "CN=Administrator,CN=Users,DC=domain,DC=com", "memberOf": [ "CN=Group Policy Creator Owners,CN=Users,DC=domain,DC=com", "CN=Domain Admins",CN=Users,DC=domain,DC=com" ], "Name": "Administrator", "nTSecurityDescriptor": "O:DAG:DAD:PAI(A;;LCRPLORC;;;AU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;SY)(A;;CCDCLCSWRPWPLOCRSDRCWDWO;;;BA)", "ObjectCategory": "CN=Person,CN=Schema,CN=Configuration,DC=domain,DC=com", "ObjectClass": "user", "ObjectGUID": "c8c6569e-4688-4f3c-8462-afc4ff60817b", "objectSid": { "Sid": "S-1-5-21-2959096244-3298113601-420842770-500", "Name": "DOMAIN\Administrator" }, "sAMAccountName": "Administrator", }] |
### Authors
* Jordan Borean (@jborean93)
| programming_docs |
ansible community.windows.win_toast – Sends Toast windows notification to logged in users on Windows 10 or later hosts community.windows.win\_toast – Sends Toast windows notification to logged in users on Windows 10 or later hosts
===============================================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_toast`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Sends alerts which appear in the Action Center area of the windows desktop.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **expire** integer | **Default:**45 | How long in seconds before the notification expires. |
| **group** string | **Default:**"Powershell" | Which notification group to add the notification to. |
| **msg** string | **Default:**"Hello, World!" | The message to appear inside the notification. May include \n to format the message to appear within the Action Center. |
| **popup** boolean | **Choices:*** no
* **yes** ←
| If `no`, the notification will not pop up and will only appear in the Action Center. |
| **tag** string | **Default:**"Ansible" | The tag to add to the notification. |
| **title** string | **Default:**"Notification HH:mm" | The notification title, which appears in the pop up.. |
Notes
-----
Note
* This module must run on a windows 10 or Server 2016 host, so ensure your play targets windows hosts, or delegates to a windows host.
* The module does not fail if there are no logged in users to notify.
* Messages are only sent to the local host where the module is run.
* You must run this module with async, otherwise it will hang until the expire period has passed.
See Also
--------
See also
[community.windows.win\_msg](win_msg_module#ansible-collections-community-windows-win-msg-module)
The official documentation on the **community.windows.win\_msg** module.
[community.windows.win\_say](win_say_module#ansible-collections-community-windows-win-say-module)
The official documentation on the **community.windows.win\_say** module.
Examples
--------
```
- name: Warn logged in users of impending upgrade (note use of async to stop the module from waiting until notification expires).
community.windows.win_toast:
expire: 60
title: System Upgrade Notification
msg: Automated upgrade about to start. Please save your work and log off before {{ deployment_start_time }}
async: 60
poll: 0
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **expire\_at\_utc** string | always | Calculated utc date time when the notification expires. **Sample:** 07 July 2017 04:50:54 |
| **no\_toast\_sent\_reason** string | when no logged in users are detected | Text containing the reason why a notification was not sent. **Sample:** No logged in users to notify |
| **sent\_localtime** string | always | local date time when the notification was sent. **Sample:** 07 July 2017 05:45:54 |
| **time\_taken** float | always | How long the module took to run on the remote windows host in seconds. **Sample:** 0.3706631999999997 |
| **toast\_sent** boolean | always | Whether the module was able to send a toast notification or not. |
### Authors
* Jon Hawkesworth (@jhawkesworth)
ansible community.windows.win_inet_proxy – Manages proxy settings for WinINet and Internet Explorer community.windows.win\_inet\_proxy – Manages proxy settings for WinINet and Internet Explorer
=============================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_inet_proxy`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Used to set or remove proxy settings for Windows INet which includes Internet Explorer.
* WinINet is a framework used by interactive applications to submit web requests through.
* The proxy settings can also be used by other applications like Firefox, Chrome, and others but there is no definitive list.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **auto\_config\_url** string | | The URL of a proxy configuration script. Proxy configuration scripts are typically JavaScript files with the `.pac` extension that implement the `FindProxyForURL(url, host` function. Omit, set to null or an empty string to remove the auto config URL. This corresponds to the checkbox *Use automatic configuration script* in the connection settings window. |
| **auto\_detect** boolean | **Choices:*** no
* **yes** ←
| Whether to configure WinINet to automatically detect proxy settings through Web Proxy Auto-Detection `WPAD`. This corresponds to the checkbox *Automatically detect settings* in the connection settings window. |
| **bypass** list / elements=string | | A list of hosts that will bypass the set proxy when being accessed. Use `<local>` to match hostnames that are not fully qualified domain names. This is useful when needing to connect to intranet sites using just the hostname. If defined, this should be the last entry in the bypass list. Use `<-loopback>` to stop automatically bypassing the proxy when connecting through any loopback address like `127.0.0.1`, `localhost`, or the local hostname. Omit, set to null or an empty string/list to remove the bypass list. If this is set then *proxy* must also be set. |
| **connection** string | | The name of the IE connection to set the proxy settings for. These are the connections under the *Dial-up and Virtual Private Network* header in the IE settings. When omitted, the default LAN connection is used. |
| **proxy** raw | | A string or dict that specifies the proxy to be set. If setting a string, should be in the form `hostname`, `hostname:port`, or `protocol=hostname:port`. If the port is undefined, the default port for the protocol in use is used. If setting a dict, the keys should be the protocol and the values should be the hostname and/or port for that protocol. Valid protocols are `http`, `https`, `ftp`, and `socks`. Omit, set to null or an empty string to remove the proxy settings. |
Notes
-----
Note
* This is not the same as the proxy settings set in WinHTTP through the `netsh` command. Use the [community.windows.win\_http\_proxy](win_http_proxy_module#ansible-collections-community-windows-win-http-proxy-module) module to manage that instead.
* These settings are by default set per user and not system wide. A registry property must be set independently from this module if you wish to apply the proxy for all users. See examples for more detail.
* If per user proxy settings are desired, use *become* to become any local user on the host. No password is needed to be set for this to work.
* If the proxy requires authentication, set the credentials using the [community.windows.win\_credential](win_credential_module#ansible-collections-community-windows-win-credential-module) module. This requires *become* to be used so the credential store can be accessed.
See Also
--------
See also
[community.windows.win\_http\_proxy](win_http_proxy_module#ansible-collections-community-windows-win-http-proxy-module)
The official documentation on the **community.windows.win\_http\_proxy** module.
[community.windows.win\_credential](win_credential_module#ansible-collections-community-windows-win-credential-module)
The official documentation on the **community.windows.win\_credential** module.
Examples
--------
```
# This should be set before running the win_inet_proxy module
- name: Configure IE proxy settings to apply to all users
ansible.windows.win_regedit:
path: HKLM:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings
name: ProxySettingsPerUser
data: 0
type: dword
state: present
# This should be set before running the win_inet_proxy module
- name: Configure IE proxy settings to apply per user
ansible.windows.win_regedit:
path: HKLM:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings
name: ProxySettingsPerUser
data: 1
type: dword
state: present
- name: Configure IE proxy to use auto detected settings without an explicit proxy
win_inet_proxy:
auto_detect: yes
- name: Configure IE proxy to use auto detected settings with a configuration script
win_inet_proxy:
auto_detect: yes
auto_config_url: http://proxy.ansible.com/proxy.pac
- name: Configure IE to use explicit proxy host
win_inet_proxy:
auto_detect: yes
proxy: ansible.proxy
- name: Configure IE to use explicit proxy host with port and without auto detection
win_inet_proxy:
auto_detect: no
proxy: ansible.proxy:8080
- name: Configure IE to use a specific proxy per protocol
win_inet_proxy:
proxy:
http: ansible.proxy:8080
https: ansible.proxy:8443
- name: Configure IE to use a specific proxy per protocol using a string
win_inet_proxy:
proxy: http=ansible.proxy:8080;https=ansible.proxy:8443
- name: Set a proxy with a bypass list
win_inet_proxy:
proxy: ansible.proxy
bypass:
- server1
- server2
- <-loopback>
- <local>
- name: Remove any explicit proxies that are set
win_inet_proxy:
proxy: ''
bypass: ''
# This should be done after setting the IE proxy with win_inet_proxy
- name: Import IE proxy configuration to WinHTTP
win_http_proxy:
source: ie
# Explicit credentials can only be set per user and require become to work
- name: Set credential to use for proxy auth
win_credential:
name: ansible.proxy # The name should be the FQDN of the proxy host
type: generic_password
username: proxyuser
secret: proxypass
state: present
become: yes
become_user: '{{ ansible_user }}'
become_method: runas
```
### Authors
* Jordan Borean (@jborean93)
ansible community.windows.win_psmodule – Adds or removes a Windows PowerShell module community.windows.win\_psmodule – Adds or removes a Windows PowerShell module
=============================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_psmodule`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module helps to install Windows PowerShell modules and register custom modules repository on Windows-based systems.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **allow\_clobber** boolean | **Choices:*** **no** ←
* yes
| If `yes` allows install modules that contains commands those have the same names as commands that already exists. |
| **allow\_prerelease** boolean | **Choices:*** **no** ←
* yes
| If `yes` installs modules marked as prereleases. It doesn't work with the parameters `minimum_version` and/or `maximum_version`. It doesn't work with the `state` set to absent. |
| **maximum\_version** string | | The maximum version of the PowerShell module that has to be installed. |
| **minimum\_version** string | | The minimum version of the PowerShell module that has to be installed. |
| **name** string / required | | Name of the Windows PowerShell module that has to be installed. |
| **repository** string | | Name of the custom repository to use. |
| **required\_version** string | | The exact version of the PowerShell module that has to be installed. |
| **skip\_publisher\_check** boolean | **Choices:*** **no** ←
* yes
| If `yes`, allows you to install a different version of a module that already exists on your computer in the case when a different one is not digitally signed by a trusted publisher and the newest existing module is digitally signed by a trusted publisher. |
| **state** string | **Choices:*** absent
* latest
* **present** ←
| If `present` a new module is installed. If `absent` a module is removed. If `latest` a module is updated to the newest version. |
| **url** string | | URL of the custom repository to register. DEPRECATED, will be removed in a major release after `2021-07-01`, please use the [community.windows.win\_psrepository](win_psrepository_module) module instead. |
Notes
-----
Note
* PowerShell modules needed - PowerShellGet >= 1.6.0 - PackageManagement >= 1.1.7
* PowerShell package provider needed - NuGet >= 2.8.5.201
* On PowerShell 5.x required modules and a package provider will be updated under the first run of the win\_psmodule module.
* On PowerShell 3.x and 4.x you have to install them before using the win\_psmodule.
See Also
--------
See also
[community.windows.win\_psrepository](win_psrepository_module#ansible-collections-community-windows-win-psrepository-module)
The official documentation on the **community.windows.win\_psrepository** module.
Examples
--------
```
---
- name: Add a PowerShell module
community.windows.win_psmodule:
name: PowerShellModule
state: present
- name: Add an exact version of PowerShell module
community.windows.win_psmodule:
name: PowerShellModule
required_version: "4.0.2"
state: present
- name: Install or update an existing PowerShell module to the newest version
community.windows.win_psmodule:
name: PowerShellModule
state: latest
- name: Install newer version of built-in Windows module
community.windows.win_psmodule:
name: Pester
skip_publisher_check: yes
state: present
- name: Add a PowerShell module and register a repository
community.windows.win_psmodule:
name: MyCustomModule
repository: MyRepository
state: present
- name: Add a PowerShell module from a specific repository
community.windows.win_psmodule:
name: PowerShellModule
repository: MyRepository
state: present
- name: Remove a PowerShell module
community.windows.win_psmodule:
name: PowerShellModule
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **nuget\_changed** boolean | always | True when Nuget package provider is installed. **Sample:** True |
| **output** string | always | A message describing the task result. **Sample:** Module PowerShellCookbook installed |
| **repository\_changed** boolean | always | True when a custom repository is installed or removed. **Sample:** True |
### Authors
* Wojciech Sciesinski (@it-praktyk)
* Daniele Lazzari (@dlazz)
ansible community.windows.win_lineinfile – Ensure a particular line is in a file, or replace an existing line using a back-referenced regular expression community.windows.win\_lineinfile – Ensure a particular line is in a file, or replace an existing line using a back-referenced regular expression
=================================================================================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_lineinfile`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module will search a file for a line, and ensure that it is present or absent.
* This is primarily useful when you want to change a single line in a file only.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **backrefs** boolean | **Choices:*** **no** ←
* yes
| Used with `state=present`. If set, line can contain backreferences (both positional and named) that will get populated if the `regexp` matches. This flag changes the operation of the module slightly; `insertbefore` and `insertafter` will be ignored, and if the `regexp` doesn't match anywhere in the file, the file will be left unchanged. If the `regexp` does match, the last matching line will be replaced by the expanded line parameter. |
| **backup** boolean | **Choices:*** **no** ←
* yes
| Determine whether a backup should be created. When set to `yes`, create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly. |
| **create** boolean | **Choices:*** **no** ←
* yes
| Used with `state=present`. If specified, the file will be created if it does not already exist. By default it will fail if the file is missing. |
| **encoding** string | **Default:**"auto" | Specifies the encoding of the source text file to operate on (and thus what the output encoding will be). The default of `auto` will cause the module to auto-detect the encoding of the source file and ensure that the modified file is written with the same encoding. An explicit encoding can be passed as a string that is a valid value to pass to the .NET framework System.Text.Encoding.GetEncoding() method - see <https://msdn.microsoft.com/en-us/library/system.text.encoding%28v=vs.110%29.aspx>. This is mostly useful with `create=yes` if you want to create a new file with a specific encoding. If `create=yes` is specified without a specific encoding, the default encoding (UTF-8, no BOM) will be used. |
| **insertafter** string | **Choices:*** **EOF** ←
* \*regex\*
| Used with `state=present`. If specified, the line will be inserted after the last match of specified regular expression. A special value is available; `EOF` for inserting the line at the end of the file. If specified regular expression has no matches, EOF will be used instead. May not be used with `backrefs`. |
| **insertbefore** string | **Choices:*** BOF
* \*regex\*
| Used with `state=present`. If specified, the line will be inserted before the last match of specified regular expression. A value is available; `BOF` for inserting the line at the beginning of the file. If specified regular expression has no matches, the line will be inserted at the end of the file. May not be used with `backrefs`. |
| **line** string | | Required for `state=present`. The line to insert/replace into the file. If `backrefs` is set, may contain backreferences that will get expanded with the `regexp` capture groups if the regexp matches. Be aware that the line is processed first on the controller and thus is dependent on yaml quoting rules. Any double quoted line will have control characters, such as '\r\n', expanded. To print such characters literally, use single or no quotes. |
| **newline** string | **Choices:*** unix
* **windows** ←
| Specifies the line separator style to use for the modified file. This defaults to the windows line separator (`\r\n`). Note that the indicated line separator will be used for file output regardless of the original line separator that appears in the input file. |
| **path** path / required | | The path of the file to modify. Note that the Windows path delimiter `\` must be escaped as `\\` when the line is double quoted.
aliases: dest, destfile, name |
| **regex** string | | The regular expression to look for in every line of the file. For `state=present`, the pattern to replace if found; only the last line found will be replaced. For `state=absent`, the pattern of the line to remove. Uses .NET compatible regular expressions; see <https://msdn.microsoft.com/en-us/library/hs600312%28v=vs.110%29.aspx>.
aliases: regexp |
| **state** string | **Choices:*** absent
* **present** ←
| Whether the line should be there or not. |
| **validate** string | | Validation to run before copying into place. Use %s in the command to indicate the current file to validate. The command is passed securely so shell features like expansion and pipes won't work. |
See Also
--------
See also
[ansible.builtin.assemble](../../ansible/builtin/assemble_module#ansible-collections-ansible-builtin-assemble-module)
The official documentation on the **ansible.builtin.assemble** module.
[ansible.builtin.lineinfile](../../ansible/builtin/lineinfile_module#ansible-collections-ansible-builtin-lineinfile-module)
The official documentation on the **ansible.builtin.lineinfile** module.
Examples
--------
```
- name: Insert path without converting \r\n
community.windows.win_lineinfile:
path: c:\file.txt
line: c:\return\new
- community.windows.win_lineinfile:
path: C:\Temp\example.conf
regex: '^name='
line: 'name=JohnDoe'
- community.windows.win_lineinfile:
path: C:\Temp\example.conf
regex: '^name='
state: absent
- community.windows.win_lineinfile:
path: C:\Temp\example.conf
regex: '^127\.0\.0\.1'
line: '127.0.0.1 localhost'
- community.windows.win_lineinfile:
path: C:\Temp\httpd.conf
regex: '^Listen '
insertafter: '^#Listen '
line: Listen 8080
- community.windows.win_lineinfile:
path: C:\Temp\services
regex: '^# port for http'
insertbefore: '^www.*80/tcp'
line: '# port for http by default'
- name: Create file if it doesn't exist with a specific encoding
community.windows.win_lineinfile:
path: C:\Temp\utf16.txt
create: yes
encoding: utf-16
line: This is a utf-16 encoded file
- name: Add a line to a file and ensure the resulting file uses unix line separators
community.windows.win_lineinfile:
path: C:\Temp\testfile.txt
line: Line added to file
newline: unix
- name: Update a line using backrefs
community.windows.win_lineinfile:
path: C:\Temp\example.conf
backrefs: yes
regex: '(^name=)'
line: '$1JohnDoe'
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **backup** string | if backup=yes | Name of the backup file that was created. This is now deprecated, use `backup_file` instead. **Sample:** C:\Path\To\File.txt.11540.20150212-220915.bak |
| **backup\_file** string | if backup=yes | Name of the backup file that was created. **Sample:** C:\Path\To\File.txt.11540.20150212-220915.bak |
### Authors
* Brian Lloyd (@brianlloyd)
| programming_docs |
ansible community.windows.win_psscript – Install and manage PowerShell scripts from a PSRepository community.windows.win\_psscript – Install and manage PowerShell scripts from a PSRepository
===========================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_psscript`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Add or remove PowerShell scripts from registered PSRepositories.
Requirements
------------
The below requirements are needed on the host that executes this module.
* `PowerShellGet` module v1.6.0+
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **allow\_prerelease** boolean | **Choices:*** **no** ←
* yes
| If `yes` installs scripts flagged as prereleases. |
| **maximum\_version** string | | The maximum version of the script to install. Cannot be used when *state=latest*. |
| **minimum\_version** string | | The minimum version of the script to install. Cannot be used when *state=latest*. |
| **name** string / required | | The name of the script you want to install or remove. |
| **repository** string | | The registered name of the repository you want to install from. Cannot be used when *state=absent*. If ommitted, all repositories will be searched. To register a repository, use [community.windows.win\_psrepository](win_psrepository_module). |
| **required\_version** string | | The exact version of the script to install. Cannot be used with *minimum\_version* or *maximum\_version*. Cannot be used when *state=latest*. |
| **scope** string | **Choices:*** current\_user
* **all\_users** ←
| Determines whether the script is installed for only the `current_user` or for `all_users`. |
| **source\_password** string | | The password portion of the credential required to access the repository. Must be used together with *source\_username*. |
| **source\_username** string | | The username portion of the credential required to access the repository. Must be used together with *source\_password*. |
| **state** string | **Choices:*** **present** ←
* absent
* latest
| The desired state of the script. `absent` removes the script.
`latest` will ensure the most recent version available is installed.
`present` only installs if the script is missing. |
Notes
-----
Note
* Unlike PowerShell modules, scripts do not support side-by-side installations of multiple versions. Installing a new version will replace the existing one.
See Also
--------
See also
[community.windows.win\_psrepository](win_psrepository_module#ansible-collections-community-windows-win-psrepository-module)
The official documentation on the **community.windows.win\_psrepository** module.
[community.windows.win\_psrepository\_info](win_psrepository_info_module#ansible-collections-community-windows-win-psrepository-info-module)
The official documentation on the **community.windows.win\_psrepository\_info** module.
[community.windows.win\_psmodule](win_psmodule_module#ansible-collections-community-windows-win-psmodule-module)
The official documentation on the **community.windows.win\_psmodule** module.
Examples
--------
```
- name: Install a script from PSGallery
community.windows.win_psscript:
name: Test-RPC
repository: PSGallery
- name: Find and install the latest version of a script from any repository
community.windows.win_psscript:
name: Get-WindowsAutoPilotInfo
state: latest
- name: Remove a script that isn't needed
community.windows.win_psscript:
name: Defrag-Partition
state: absent
- name: Install a specific version of a script for the current user
community.windows.win_psscript:
name: CleanOldFiles
scope: current_user
required_version: 3.10.2
- name: Install a script below a certain version
community.windows.win_psscript:
name: New-FeatureEnable
maximum_version: 2.99.99
- name: Ensure a minimum version of a script is present
community.windows.win_psscript:
name: OldStandby
minimum_version: 3.0.0
- name: Install any available version that fits a specific range
community.windows.win_psscript:
name: FinickyScript
minimum_version: 2.5.1
maximum_version: 2.6.19
```
### Authors
* Brian Scholer (@briantist)
ansible community.windows.win_initialize_disk – Initializes disks on Windows Server community.windows.win\_initialize\_disk – Initializes disks on Windows Server
=============================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_initialize_disk`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* The [community.windows.win\_initialize\_disk](#ansible-collections-community-windows-win-initialize-disk-module) module initializes disks
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **disk\_number** integer | | Used to specify the disk number of the disk to be initialized. |
| **force** boolean | **Choices:*** **no** ←
* yes
| Specify if initializing should be forced for disks that are already initialized. |
| **online** boolean | **Choices:*** no
* **yes** ←
| If the disk is offline and/or readonly update the disk to be online and not readonly. |
| **path** string | | Used to specify the path to the disk to be initialized. |
| **style** string | **Choices:*** **gpt** ←
* mbr
| The partition style to use for the disk. Valid options are mbr or gpt. |
| **uniqueid** string | | Used to specify the uniqueid of the disk to be initialized. |
Notes
-----
Note
* One of three parameters (*disk\_number*, *uniqueid*, and *path*) are mandatory to identify the target disk, but more than one cannot be specified at the same time.
* A minimum Operating System Version of Server 2012 or Windows 8 is required to use this module.
* This module is idempotent if *force* is not specified.
See Also
--------
See also
[community.windows.win\_disk\_facts](win_disk_facts_module#ansible-collections-community-windows-win-disk-facts-module)
The official documentation on the **community.windows.win\_disk\_facts** module.
[community.windows.win\_partition](win_partition_module#ansible-collections-community-windows-win-partition-module)
The official documentation on the **community.windows.win\_partition** module.
[community.windows.win\_format](win_format_module#ansible-collections-community-windows-win-format-module)
The official documentation on the **community.windows.win\_format** module.
Examples
--------
```
- name: Initialize a disk
community.windows.win_initialize_disk:
disk_number: 1
- name: Initialize a disk with an MBR partition style
community.windows.win_initialize_disk:
disk_number: 1
style: mbr
- name: Forcefully initiallize a disk
community.windows.win_initialize_disk:
disk_number: 2
force: yes
```
### Authors
* Brant Evans (@branic)
ansible community.windows.win_iis_webbinding – Configures a IIS Web site binding community.windows.win\_iis\_webbinding – Configures a IIS Web site binding
==========================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_iis_webbinding`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Creates, removes and configures a binding to an existing IIS Web site.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **certificate\_hash** string | | Certificate hash (thumbprint) for the SSL binding. The certificate hash is the unique identifier for the certificate. |
| **certificate\_store\_name** string | **Default:**"my" | Name of the certificate store where the certificate for the binding is located. |
| **host\_header** string | | The host header to bind to / use for the new site. If you are creating/removing a catch-all binding, omit this parameter rather than defining it as '\*'. |
| **ip** string | **Default:**"\*" | The IP address to bind to / use for the new site. |
| **name** string / required | | Names of web site.
aliases: website |
| **port** string | **Default:**80 | The port to bind to / use for the new site. |
| **protocol** string | **Default:**"http" | The protocol to be used for the Web binding (usually HTTP, HTTPS, or FTP). |
| **ssl\_flags** string | | This parameter is only valid on Server 2012 and newer. Primarily used for enabling and disabling server name indication (SNI). Set to `0` to disable SNI. Set to `1` to enable SNI. |
| **state** string | **Choices:*** absent
* **present** ←
| State of the binding. |
See Also
--------
See also
[community.windows.win\_iis\_virtualdirectory](win_iis_virtualdirectory_module#ansible-collections-community-windows-win-iis-virtualdirectory-module)
The official documentation on the **community.windows.win\_iis\_virtualdirectory** module.
[community.windows.win\_iis\_webapplication](win_iis_webapplication_module#ansible-collections-community-windows-win-iis-webapplication-module)
The official documentation on the **community.windows.win\_iis\_webapplication** module.
[community.windows.win\_iis\_webapppool](win_iis_webapppool_module#ansible-collections-community-windows-win-iis-webapppool-module)
The official documentation on the **community.windows.win\_iis\_webapppool** module.
[community.windows.win\_iis\_website](win_iis_website_module#ansible-collections-community-windows-win-iis-website-module)
The official documentation on the **community.windows.win\_iis\_website** module.
Examples
--------
```
- name: Add a HTTP binding on port 9090
community.windows.win_iis_webbinding:
name: Default Web Site
port: 9090
state: present
- name: Remove the HTTP binding on port 9090
community.windows.win_iis_webbinding:
name: Default Web Site
port: 9090
state: absent
- name: Remove the default http binding
community.windows.win_iis_webbinding:
name: Default Web Site
port: 80
ip: '*'
state: absent
- name: Add a HTTPS binding
community.windows.win_iis_webbinding:
name: Default Web Site
protocol: https
port: 443
ip: 127.0.0.1
certificate_hash: B0D0FA8408FC67B230338FCA584D03792DA73F4C
state: present
- name: Add a HTTPS binding with host header and SNI enabled
community.windows.win_iis_webbinding:
name: Default Web Site
protocol: https
port: 443
host_header: test.com
ssl_flags: 1
certificate_hash: D1A3AF8988FD32D1A3AF8988FD323792DA73F4C
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **binding\_info** dictionary | on success | Information on the binding being manipulated **Sample:** "binding\_info": { "bindingInformation": "127.0.0.1:443:", "certificateHash": "FF3910CE089397F1B5A77EB7BAFDD8F44CDE77DD", "certificateStoreName": "MY", "hostheader": "", "ip": "127.0.0.1", "port": 443, "protocol": "https", "sslFlags": "not supported" } |
| **operation\_type** string | on success | The type of operation performed Can be removed, updated, matched, or added **Sample:** removed |
| **website\_state** string | always | The state of the website being targetted Can be helpful in case you accidentally cause a binding collision which can result in the targetted site being stopped **Sample:** Started |
### Authors
* Noah Sparks (@nwsparks)
* Henrik Wallström (@henrikwallstrom)
ansible community.windows.win_feature_info – Gather information about Windows features community.windows.win\_feature\_info – Gather information about Windows features
================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_feature_info`.
New in version 1.4.0: of community.windows
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Gather information about all or a specific installed Windows feature(s).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **name** string | **Default:**"\*" | If specified, this is used to match the `name` of the Windows feature to get the info for. Can be a wildcard to match multiple features but the wildcard will only be matched on the `name` of the feature. If omitted then all features will returned. |
See Also
--------
See also
[ansible.windows.win\_feature](../../ansible/windows/win_feature_module#ansible-collections-ansible-windows-win-feature-module)
The official documentation on the **ansible.windows.win\_feature** module.
Examples
--------
```
- name: Get info for all installed features
community.windows.win_feature_info:
register: feature_info
- name: Get info for a single feature
community.windows.win_feature_info:
name: DNS
register: feature_info
- name: Find all features that start with 'FS'
ansible.windows.win_feature_info:
name: FS*
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **exists** boolean | always | Whether any features were found based on the criteria specified. **Sample:** True |
| **features** list / elements=dictionary | always | A list of feature(s) that were found based on the criteria. Will be an empty list if no features were found. |
| | **additional\_info** dictionary | success | A list of privileges that the feature requires and will run with |
| | | **install\_name** string | success | The action to perform once triggered, can be `start_feature` or `stop_feature`. **Sample:** ADCertificateServicesRole |
| | | **major\_version** integer | success | Major Version of feature `name`. **Sample:** 8 |
| | | **minor\_version** integer | success | Minor Version of feature `name`. |
| | | **number\_id\_version** integer | success | Numberic Id of feature `name`. **Sample:** 16 |
| | **best\_practices\_model\_id** string | success | BestPracticesModelId for feature `name`. **Sample:** Microsoft/Windows/UpdateServices |
| | **depends\_on** list / elements=string | success | The command line that will be run when a `run_command` failure action is fired. **Sample:** ['Web-Static-Content', 'Web-Default-Doc'] |
| | **depth** integer | success | Depth of `name` feature. **Sample:** 1 |
| | **description** string | success | The description of the feature. **Sample:** Example description of the Windows feature. |
| | **display\_name** string | success | The Display name of feature found. **Sample:** Active Directory Certificate Services |
| | **event\_query** string | success | The EventQuery for feature `name`. This will be `null` if None Present **Sample:** IPAMServer.Events.xml |
| | **feature\_type** string | success | The Feature Type of `name`. Values will be one of `Role`, `Role Service`, `Feature`. **Sample:** Feature |
| | **install\_state** string | success | The Install State of `name`. Values will be one of `Available`, `Removed`, `Installed`. **Sample:** Installed |
| | **installed** boolean | success | Whether the feature by `name` is installed. |
| | **name** string | success | Name of feature found. **Sample:** AD-Certificate |
| | **parent** string | success | The parent of feature `name` if present. **Sample:** PowerShellRoot |
| | **path** string | success | The Path of `name` feature. **Sample:** WoW64 Support |
| | **post\_configuration\_needed** boolean | success | Tells if Post Configuration is needed for feature `name`. |
| | **server\_component\_descriptor** string | success | Descriptor of `name` feature. **Sample:** ServerComponent\_AD\_Certificate |
| | **sub\_features** list / elements=string | success | List of sub features names of feature `name`. **Sample:** ['WAS-Process-Model', 'WAS-NET-Environment', 'WAS-Config-APIs'] |
| | **system\_service** list / elements=string | success | The name of the service installed by feature `name`. **Sample:** ['iisadmin', 'w3svc'] |
### Authors
* Larry Lane (@gamethis)
ansible community.windows.win_domain_computer – Manage computers in Active Directory community.windows.win\_domain\_computer – Manage computers in Active Directory
==============================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_domain_computer`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create, read, update and delete computers in Active Directory using a windows bridge computer to launch New-ADComputer, Get-ADComputer, Set-ADComputer, Remove-ADComputer and Move-ADObject powershell commands.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **description** string | **Default:**"" | Specifies a description of the object. This parameter sets the value of the Description property for the object. The LDAP display name (ldapDisplayName) for this property is description. |
| **dns\_hostname** string | | Specifies the fully qualified domain name (FQDN) of the computer. This parameter sets the DNSHostName property for a computer object. The LDAP display name for this property is dNSHostName. Required when *state=present*. |
| **domain\_password** string | | The password for *username*. |
| **domain\_server** string | | Specifies the Active Directory Domain Services instance to connect to. Can be in the form of an FQDN or NetBIOS name. If not specified then the value is based on the domain of the computer running PowerShell. |
| **domain\_username** string | | The username to use when interacting with AD. If this is not set then the user Ansible used to log in with will be used instead when using CredSSP or Kerberos with credential delegation. |
| **enabled** boolean | **Choices:*** no
* **yes** ←
| Specifies if an account is enabled. An enabled account requires a password. This parameter sets the Enabled property for an account object. This parameter also sets the ADS\_UF\_ACCOUNTDISABLE flag of the Active Directory User Account Control (UAC) attribute. |
| **managed\_by** string added in 1.3.0 of community.windows | | The value to be assigned to the LDAP `managedBy` attribute. This value can be in the forms `Distinguished Name`, `objectGUID`, `objectSid` or `sAMAccountName`, see examples for more details. |
| **name** string / required | | Specifies the name of the object. This parameter sets the Name property of the Active Directory object. The LDAP display name (ldapDisplayName) of this property is name. |
| **odj\_blob\_path** string | | The path to the file where the BLOB will be saved. If omitted, a temporary file will be used. If *offline\_domain\_join=output* the file will be deleted after its contents are returned. The parent directory for the BLOB file must exist; intermediate directories will not be created. |
| **offline\_domain\_join** string | **Choices:*** **none** ←
* output
* path
| Provisions a computer in the directory and provides a BLOB file that can be used on the target computer/image to join it to the domain while offline. The `none` value doesn't do any offline join operations.
`output` returns the BLOB in output. The BLOB should be treated as secret (it contains the machine password) so use `no_log` when using this option.
`path` preserves the offline domain join BLOB file on the target machine for later use. The path will be returned. If the computer already exists, no BLOB will be created/returned, and the module will operate as it would have without offline domain join. |
| **ou** string | | Specifies the X.500 path of the Organizational Unit (OU) or container where the new object is created. Required when *state=present*. Special characters must be escaped, see [Distinguished Names](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ldap/distinguished-names) for details. |
| **sam\_account\_name** string | | Specifies the Security Account Manager (SAM) account name of the computer. It maximum is 256 characters, 15 is advised for older operating systems compatibility. The LDAP display name (ldapDisplayName) for this property is sAMAccountName. If ommitted the value is the same as `name`. Note that all computer SAMAccountNames need to end with a `$`. If `$` is omitted, it will be added to the end. |
| **state** string | **Choices:*** absent
* **present** ←
| Specified whether the computer should be `present` or `absent` in Active Directory. |
Notes
-----
Note
* For more information on Offline Domain Join see [the step-by-step guide](https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/dd392267%28v=ws.10%29).
* When using the ODJ BLOB to join a computer to the domain, it must be written out to a file.
* The file must be UTF-16 encoded (in PowerShell this encoding is called `Unicode`), and it must end in a null character. See examples.
* The `djoin.exe` part of the offline domain join process will not use *domain\_server*, *domain\_username*, or *domain\_password*.
See Also
--------
See also
[ansible.windows.win\_domain](../../ansible/windows/win_domain_module#ansible-collections-ansible-windows-win-domain-module)
The official documentation on the **ansible.windows.win\_domain** module.
[ansible.windows.win\_domain\_controller](../../ansible/windows/win_domain_controller_module#ansible-collections-ansible-windows-win-domain-controller-module)
The official documentation on the **ansible.windows.win\_domain\_controller** module.
[community.windows.win\_domain\_group](win_domain_group_module#ansible-collections-community-windows-win-domain-group-module)
The official documentation on the **community.windows.win\_domain\_group** module.
[ansible.windows.win\_domain\_membership](../../ansible/windows/win_domain_membership_module#ansible-collections-ansible-windows-win-domain-membership-module)
The official documentation on the **ansible.windows.win\_domain\_membership** module.
[community.windows.win\_domain\_user](win_domain_user_module#ansible-collections-community-windows-win-domain-user-module)
The official documentation on the **community.windows.win\_domain\_user** module.
Examples
--------
```
- name: Add linux computer to Active Directory OU using a windows machine
community.windows.win_domain_computer:
name: one_linux_server
sam_account_name: linux_server$
dns_hostname: one_linux_server.my_org.local
ou: "OU=servers,DC=my_org,DC=local"
description: Example of linux server
enabled: yes
state: present
delegate_to: my_windows_bridge.my_org.local
- name: Remove linux computer from Active Directory using a windows machine
community.windows.win_domain_computer:
name: one_linux_server
state: absent
delegate_to: my_windows_bridge.my_org.local
- name: Provision a computer for offline domain join
community.windows.win_domain_computer:
name: newhost
dns_hostname: newhost.ansible.local
ou: 'OU=A great\, big organizational unit name,DC=ansible,DC=local'
state: present
offline_domain_join: yes
odj_return_blob: yes
register: computer_status
delegate_to: windc.ansible.local
- name: Join a workgroup computer to the domain
vars:
target_blob_file: 'C:\ODJ\blob.txt'
ansible.windows.win_shell: |
$blob = [Convert]::FromBase64String('{{ computer_status.odj_blob }}')
[IO.File]::WriteAllBytes('{{ target_blob_file }}', $blob)
& djoin.exe --% /RequestODJ /LoadFile '{{ target_blob_file }}' /LocalOS /WindowsPath "%SystemRoot%"
- name: Restart to complete domain join
ansible.windows.win_restart:
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **djoin** dictionary | when offline\_domain\_join is True and the computer didn't exist | Information about the invocation of djoin.exe. |
| | **invocation** string | always | The full command line used to call djoin.exe **Sample:** djoin.exe /PROVISION /MACHINE compname /MACHINEOU OU=Hosts,DC=ansible,DC=local /DOMAIN ansible.local /SAVEFILE blobfile.txt |
| | **rc** integer | when not check mode | The return code from djoin.exe **Sample:** 87 |
| | **stderr** string | when not check mode | The stderr from djoin.exe **Sample:** Invalid input parameter combination. |
| | **stdout** string | when not check mode | The stdout from djoin.exe **Sample:** Computer provisioning completed successfully. |
| **odj\_blob** string | when offline\_domain\_join is not 'none' and the computer didn't exist | The offline domain join BLOB. This is an empty string when in check mode or when offline\_domain\_join is 'path'. This field contains the base64 encoded raw bytes of the offline domain join BLOB file. **Sample:** <a long base64 string> |
| **odj\_blob\_file** string | when offline\_domain\_join is 'path' and the computer didn't exist | The path to the offline domain join BLOB file on the target host. If odj\_blob\_path was specified, this will match that path. **Sample:** C:\Users\admin\AppData\Local\Temp\e4vxonty.rkb |
### Authors
* Daniel Sánchez Fábregas (@Daniel-Sanchez-Fabregas)
* Brian Scholer (@briantist)
| programming_docs |
ansible community.windows.win_computer_description – Set windows description, owner and organization community.windows.win\_computer\_description – Set windows description, owner and organization
==============================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_computer_description`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* This module sets Windows description that is shown under My Computer properties. Module also sets Windows license owner and organization. License information can be viewed by running winver commad.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **description** string | | String value to apply to Windows descripton. Specify value of "" to clear the value. |
| **organization** string | | String value of organization that the Windows is licensed to. Specify value of "" to clear the value. |
| **owner** string | | String value of the persona that the Windows is licensed to. Specify value of "" to clear the value. |
Examples
--------
```
- name: Set Windows description, owner and organization
community.windows.win_computer_description:
description: Best Box
owner: RusoSova
organization: MyOrg
register: result
- name: Set Windows description only
community.windows.win_computer_description:
description: This is my Windows machine
register: result
- name: Set organization and clear owner field
community.windows.win_computer_description:
owner: ''
organization: Black Mesa
- name: Clear organization, description and owner
community.windows.win_computer_description:
organization: ""
owner: ""
description: ""
register: result
```
### Authors
* RusoSova (@RusoSova)
ansible community.windows.win_psexec – Runs commands (remotely) as another (privileged) user community.windows.win\_psexec – Runs commands (remotely) as another (privileged) user
=====================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_psexec`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Run commands (remotely) through the PsExec service.
* Run commands as another (domain) user (with elevated privileges).
Requirements
------------
The below requirements are needed on the host that executes this module.
* Microsoft PsExec
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **chdir** path | | Run the command from this (remote) directory. |
| **command** string / required | | The command line to run through PsExec (limited to 260 characters). |
| **elevated** boolean | **Choices:*** **no** ←
* yes
| Run the command with elevated privileges. |
| **executable** path | **Default:**"psexec.exe" | The location of the PsExec utility (in case it is not located in your PATH). |
| **hostnames** list / elements=string | | The hostnames to run the command. If not provided, the command is run locally. |
| **interactive** boolean | **Choices:*** **no** ←
* yes
| Run the program so that it interacts with the desktop on the remote system. |
| **limited** boolean | **Choices:*** **no** ←
* yes
| Run the command as limited user (strips the Administrators group and allows only privileges assigned to the Users group). |
| **nobanner** boolean | **Choices:*** **no** ←
* yes
| Do not display the startup banner and copyright message. This only works for specific versions of the PsExec binary. |
| **noprofile** boolean | **Choices:*** **no** ←
* yes
| Run the command without loading the account's profile. |
| **password** string | | The password for the (remote) user to run the command as. This is mandatory in order authenticate yourself. |
| **priority** string | **Choices:*** abovenormal
* background
* belownormal
* high
* low
* realtime
| Used to run the command at a different priority. |
| **session** integer | | Specifies the session ID to use. This parameter works in conjunction with *interactive*. It has no effect when *interactive* is set to `no`. |
| **system** boolean | **Choices:*** **no** ←
* yes
| Run the remote command in the System account. |
| **timeout** integer | | The connection timeout in seconds |
| **username** string | | The (remote) user to run the command as. If not provided, the current user is used. |
| **wait** boolean | **Choices:*** no
* **yes** ←
| Wait for the application to terminate. Only use for non-interactive applications. |
Notes
-----
Note
* More information related to Microsoft PsExec is available from <https://technet.microsoft.com/en-us/sysinternals/bb897553.aspx>
See Also
--------
See also
[community.windows.psexec](psexec_module#ansible-collections-community-windows-psexec-module)
The official documentation on the **community.windows.psexec** module.
[ansible.builtin.raw](../../ansible/builtin/raw_module#ansible-collections-ansible-builtin-raw-module)
The official documentation on the **ansible.builtin.raw** module.
[ansible.windows.win\_command](../../ansible/windows/win_command_module#ansible-collections-ansible-windows-win-command-module)
The official documentation on the **ansible.windows.win\_command** module.
[ansible.windows.win\_shell](../../ansible/windows/win_shell_module#ansible-collections-ansible-windows-win-shell-module)
The official documentation on the **ansible.windows.win\_shell** module.
Examples
--------
```
- name: Test the PsExec connection to the local system (target node) with your user
community.windows.win_psexec:
command: whoami.exe
- name: Run regedit.exe locally (on target node) as SYSTEM and interactively
community.windows.win_psexec:
command: regedit.exe
interactive: yes
system: yes
- name: Run the setup.exe installer on multiple servers using the Domain Administrator
community.windows.win_psexec:
command: E:\setup.exe /i /IACCEPTEULA
hostnames:
- remote_server1
- remote_server2
username: DOMAIN\Administrator
password: some_password
priority: high
- name: Run PsExec from custom location C:\Program Files\sysinternals\
community.windows.win_psexec:
command: netsh advfirewall set allprofiles state off
executable: C:\Program Files\sysinternals\psexec.exe
hostnames: [ remote_server ]
password: some_password
priority: low
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **cmd** string | always | The complete command line used by the module, including PsExec call and additional options. **Sample:** psexec.exe -nobanner \\remote\_server -u "DOMAIN\Administrator" -p "some\_password" -accepteula E:\setup.exe |
| **pid** integer | when `wait=False` | The PID of the async process created by PsExec. **Sample:** 1532 |
| **rc** integer | always | The return code for the command. |
| **stderr** string | always | The error output from the command. **Sample:** Error 15 running E:\setup.exe |
| **stdout** string | always | The standard output from the command. **Sample:** Success. |
### Authors
* Dag Wieers (@dagwieers)
ansible community.windows.win_partition – Creates, changes and removes partitions on Windows Server community.windows.win\_partition – Creates, changes and removes partitions on Windows Server
============================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_partition`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* The [community.windows.win\_partition](#ansible-collections-community-windows-win-partition-module) module can create, modify or delete a partition on a disk
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **active** boolean | **Choices:*** no
* yes
| Specifies if the partition is active and can be used to start the system. This property is only valid when the disk's partition style is MBR. |
| **disk\_number** integer | | Disk number is mandatory for creating new partitions. A combination of *disk\_number* and *partition\_number* can be used to specify the partition instead of *drive\_letter* if required. |
| **drive\_letter** string | | Used for accessing partitions if *disk\_number* and *partition\_number* are not provided. Use `auto` for automatically assigning a drive letter, or a letter A-Z for manually assigning a drive letter to a new partition. If not specified, no drive letter is assigned when creating a new partition. |
| **gpt\_type** string | **Choices:*** system\_partition
* microsoft\_reserved
* basic\_data
* microsoft\_recovery
| Specify the partition's GPT type if the disk's partition style is GPT. This only applies to new partitions. This does not relate to the partitions file system formatting. |
| **hidden** boolean | **Choices:*** no
* yes
| Hides the target partition, making it undetectable by the mount manager. |
| **mbr\_type** string | **Choices:*** fat12
* fat16
* extended
* huge
* ifs
* fat32
| Specify the partition's MBR type if the disk's partition style is MBR. This only applies to new partitions. This does not relate to the partitions file system formatting. |
| **offline** boolean | **Choices:*** no
* yes
| Sets the partition offline. Adding a mount point (such as a drive letter) will cause the partition to go online again. |
| **partition\_number** integer | | Used in conjunction with *disk\_number* to uniquely identify a partition. |
| **partition\_size** string | | Specify size of the partition in B, KB, KiB, MB, MiB, GB, GiB, TB or TiB. Use -1 to specify maximum supported size. Partition size is mandatory for creating a new partition but not for updating or deleting a partition. The decimal SI prefixes kilo, mega, giga, tera, etc., are powers of 10^3 = 1000. The binary prefixes kibi, mebi, gibi, tebi, etc. respectively refer to the corresponding power of 2^10 = 1024. Thus, a gigabyte (GB) is 1000000000 (1000^3) bytes while 1 gibibyte (GiB) is 1073741824 (1024^3) bytes. |
| **read\_only** boolean | **Choices:*** no
* yes
| Make the partition read only, restricting changes from being made to the partition. |
| **state** string | **Choices:*** absent
* **present** ←
| Used to specify the state of the partition. Use `absent` to specify if a partition should be removed and `present` to specify if the partition should be created or updated. |
Notes
-----
Note
* A minimum Operating System Version of 6.2 is required to use this module. To check if your OS is compatible, see <https://docs.microsoft.com/en-us/windows/desktop/sysinfo/operating-system-version>.
* This module cannot be used for removing the drive letter associated with a partition, initializing a disk or, file system formatting.
* Idempotence works only if you’re specifying a drive letter or other unique attributes such as a combination of disk number and partition number.
* For more information, see <https://msdn.microsoft.com/en-us/library/windows/desktop/hh830524.aspx>.
Examples
--------
```
- name: Create a partition with drive letter D and size 5 GiB
community.windows.win_partition:
drive_letter: D
partition_size: 5 GiB
disk_number: 1
- name: Resize previously created partition to it's maximum size and change it's drive letter to E
community.windows.win_partition:
drive_letter: E
partition_size: -1
partition_number: 1
disk_number: 1
- name: Delete partition
community.windows.win_partition:
disk_number: 1
partition_number: 1
state: absent
```
### Authors
* Varun Chopra (@chopraaa) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#ea9cccc9d9ddd1ccc9dfd8d1ccc9ded2d18982859a988b8b8bccc9dedcd1898587)>
ansible community.windows.win_psmodule_info – Gather information about PowerShell Modules community.windows.win\_psmodule\_info – Gather information about PowerShell Modules
===================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_psmodule_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Gather information about PowerShell Modules including information from PowerShellGet.
Requirements
------------
The below requirements are needed on the host that executes this module.
* `PowerShellGet` module
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **name** string | **Default:**"\*" | The name of the module to retrieve. Supports any wildcard pattern supported by `Get-Module`. If omitted then all modules will returned. |
| **repository** string | | The name of the PSRepository the modules were installed from. This acts as a filter against the modules that would be returned based on the *name* option. Modules that were not installed from a repository will not be returned if this option is set. Only modules installed from a registered repository will be returned. If the repository was re-registered after module installation with a new `SourceLocation`, this will not match. |
See Also
--------
See also
[community.windows.win\_psrepository\_info](win_psrepository_info_module#ansible-collections-community-windows-win-psrepository-info-module)
The official documentation on the **community.windows.win\_psrepository\_info** module.
[community.windows.win\_psscript\_info](win_psscript_info_module#ansible-collections-community-windows-win-psscript-info-module)
The official documentation on the **community.windows.win\_psscript\_info** module.
Examples
--------
```
- name: Get info about all modules on the system
community.windows.win_psmodule_info:
- name: Get info about the ScheduledTasks module
community.windows.win_psmodule_info:
name: ScheduledTasks
- name: Get info about networking modules
community.windows.win_psmodule_info:
name: Net*
- name: Get info about all modules installed from the PSGallery repository
community.windows.win_psmodule_info:
repository: PSGallery
register: gallery_modules
- name: Update all modules retrieved from above example
community.windows.win_psmodule:
name: "{{ item }}"
state: latest
loop: "{{ gallery_modules.modules | map(attribute=name) }}"
- name: Get info about all modules on the system
community.windows.win_psmodule_info:
register: all_modules
- name: Find modules installed from a repository that isn't registered now
set_fact:
missing_repository_modules: "{{
all_modules
| json_query('modules[?repository!=null && repository==repository_source_location].{name: name, version: version, repository: repository}')
| list
}}"
- debug:
var: missing_repository_modules
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **modules** list / elements=dictionary | always | A list of modules (or an empty list is there are none). |
| | **access\_mode** string | success | The module's access mode. See <https://docs.microsoft.com/en-us/dotnet/api/system.management.automation.moduleaccessmode>
**Sample:** ReadWrite |
| | **author** string | success | The author of the module. **Sample:** Warren Frame |
| | **clr\_version** string | success | The CLR version of the module. **Sample:** 4.0 |
| | **company\_name** string | success | The company name of the module. **Sample:** Microsoft Corporation |
| | **compatible\_ps\_editions** list / elements=string | success | The PS Editions the module is compatible with. **Sample:** ['Desktop'] |
| | **copyright** string | success | The copyright of the module. **Sample:** (c) 2016 Warren F. All rights reserved. |
| | **dependencies** list / elements=string | success | The modules required by this module. |
| | **description** string | success | The description of the module. **Sample:** Provides cmdlets to work with local users and local groups |
| | **dot\_net\_framework\_version** string | success | The .Net Framework version of the module. **Sample:** 4.6.1 |
| | **exported\_aliases** list / elements=string | success | The aliases exported from the module. **Sample:** ['glu', 'slu'] |
| | **exported\_cmdlets** list / elements=string | success | The cmdlets exported from the module. **Sample:** ['Get-Certificate', 'Get-PfxData'] |
| | **exported\_commands** list / elements=string | success | All of the commands exported from the module. Includes functions, cmdlets, and aliases. **Sample:** ['glu', 'Get-LocalUser'] |
| | **exported\_dsc\_resources** list / elements=string | success | The DSC resources exported from the module. **Sample:** ['xWebAppPool', 'xWebSite'] |
| | **exported\_format\_files** list / elements=path | success | The format files exported from the module. **Sample:** ['C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\DnsClient\\DnsCmdlets.Format.ps1xml', 'C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\DnsClient\\DnsConfig.Format.ps1xml', 'C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\DnsClient\\DnsClientPSProvider.Format.ps1xml'] |
| | **exported\_functions** list / elements=string | success | The functions exported from the module. **Sample:** ['New-VirtualDisk', 'New-Volume'] |
| | **exported\_type\_files** list / elements=path | success | The type files exported from the module. **Sample:** ['C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\DnsClient\\DnsCmdlets.Types.ps1xml', 'C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\DnsClient\\DnsConfig.Types.ps1xml', 'C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\DnsClient\\DnsClientPSProvider.Types.ps1xml'] |
| | **exported\_variables** list / elements=string | success | The variables exported from the module. **Sample:** ['GitPromptScriptBlock'] |
| | **exported\_workflows** list / elements=string | success | The workflows exported from the module. |
| | **file\_list** list / elements=path | success | The files included in the module. **Sample:** ['C:\\Program Files\\WindowsPowerShell\\Modules\\PowerShellGet\\1.6.0\\PSModule.psm1', 'C:\\Program Files\\WindowsPowerShell\\Modules\\PowerShellGet\\1.6.0\\PSGet.Format.ps1xml', 'C:\\Program Files\\WindowsPowerShell\\Modules\\PowerShellGet\\1.6.0\\PSGet.Resource.psd1'] |
| | **guid** string | success | The GUID of the module. **Sample:** 74c9fd30-734b-4c89-a8ae-7727ad21d1d5 |
| | **help\_info\_uri** string | success | The help info address of the module. **Sample:** https://go.microsoft.com/fwlink/?linkid=390823 |
| | **icon\_uri** string | success | The address of the icon of the module. **Sample:** https://raw.githubusercontent.com/powershell/psscriptanalyzer/master/logo.png |
| | **installed\_date** string | success | The date the module was installed. **Sample:** 2018-02-14T17:55:34.9620740-05:00 |
| | **installed\_location** string | success | The path where the module is installed. This should have the same value as `module_base` but only has a value when the module was installed via PowerShellGet. **Sample:** C:\Program Files\WindowsPowerShell\Modules\posh-git\0.7.1 |
| | **license\_uri** string | success | The address of the license for the module. **Sample:** https://github.com/PowerShell/xPendingReboot/blob/master/LICENSE |
| | **log\_pipeline\_execution\_details** boolean | success | Determines whether pipeline execution detail events should be logged. |
| | **module\_base** string | success | The path that contains the module's files. **Sample:** C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\PKI |
| | **module\_list** list / elements=dictionary | success | A list of modules packaged with this module. This value is not often returned and the modules are not automatically processed. |
| | | **guid** string | success | The GUID of the module. **Sample:** 82fdb72c-ecc5-4dfd-b9d5-83cf6eb9067f |
| | | **maximum\_version** string | success | The maximum version of the module. **Sample:** 2.9 |
| | | **name** string | success | The name of the module. This may also be a path to the module file. **Sample:** .\WindowsUpdateLog.psm1 |
| | | **required\_version** string | success | The exact version of the module required. **Sample:** 3.1.4 |
| | | **version** string | success | The minimum version of the module. **Sample:** 2.0 |
| | **module\_type** string | success | The module's type. See <https://docs.microsoft.com/en-us/dotnet/api/system.management.automation.moduletype>
**Sample:** Script |
| | **name** string | success | The name of the module. **Sample:** PSReadLine |
| | **nested\_modules** list / elements=dictionary | success | A list of modules nested with and loaded into the scope of this module. This list contains full module objects, so each item can have all of the properties listed here, including `nested_modules`. |
| | **package\_management\_provider** string | success | If the module was installed from PowerShellGet, this is the package management provider used. **Sample:** NuGet |
| | **path** string | success | The path to the module. **Sample:** C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\PKI\PKI.psd1 |
| | **power\_shell\_host\_name** string | success | The name of the PowerShell host that the module requires. **Sample:** Windows PowerShell ISE Host |
| | **power\_shell\_host\_version** string | success | The version of the PowerShell host that the module requires. **Sample:** 1.1 |
| | **power\_shell\_version** string | success | The minimum version of PowerShell that the module requires. **Sample:** 5.1 |
| | **prefix** string | success | The default prefix applied to `Verb-Noun` commands exported from the module, resulting in `Verb-PrefixNoun` names. |
| | **private\_data** dictionary | success | Arbitrary private data used by the module. This is typically defined in the module manifest. This module limits the depth of the data returned for module types other than `Script` and `Manifest`. The `PSData` is commonly supplied and provides metadata for PowerShellGet but those fields are surfaced in top-level properties as well. **Sample:** {'PSData': {'LicenseUri': 'https://example.com/module/LICENSE', 'ProjectUri': 'https://example.com/module/', 'ReleaseNotes': 'v2 - Fixed some bugs\nv1 - First release\n', 'Tags': ['networking', 'serialization']}} |
| | **procoessor\_architecture** string | success | The module's processor architecture. See <https://docs.microsoft.com/en-us/dotnet/api/system.reflection.processorarchitecture>
**Sample:** Amd64 |
| | **project\_uri** string | success | The address of the module's project. **Sample:** https://github.com/psake/psake |
| | **published\_date** string | success | The date the module was published. **Sample:** 2017-03-15T04:18:09.0000000 |
| | **release\_notes** string | success | The module's release notes. This is a free text field and no specific format should be assumed. **Sample:** ## 1.4.6 - Update `HelpInfoUri` to point to the latest content ## 1.4.5 - Bug fix for deadlock when getting parameters in an event ## 1.4.4 - Bug fix when installing modules from private feeds |
| | **repository** string | success | The PSRepository where the module was installed from. This value is not historical. It depends on the PSRepositories that are registered now for the current user. The `repository_source_location` must match the current source location of a registered repository to get a repository name. If there is no match, then this value will match `repository_source_location`. **Sample:** PSGallery |
| | **repository\_source\_location** string | success | The source location of the repository where the module was installed from. **Sample:** https://www.powershellgallery.com/api/v2 |
| | **required\_assemblies** string | success | A list of assemblies that the module requires. The values may be a simple name or a full path. **Sample:** ['Microsoft.Management.Infrastructure.CimCmdlets.dll', 'Microsoft.Management.Infrastructure.Dll'] |
| | **required\_modules** list / elements=dictionary | success | A list of modules required by this module. This list contains full module objects, so each item can have all of the properties listed here, including `required_modules`. These module objects may not contain full information however, so you may see different results than if you had directly queried the module. |
| | **root\_module** string | success | The root module as defined in the manifest. This may be a module name, filename, or full path. **Sample:** WindowsErrorReporting.psm1 |
| | **scripts** list / elements=string | success | A list of scripts (`.ps1` files) that run in the caller's session state when the module is imported. This value comes from the `ScriptsToProcess` field in the module's manifest. **Sample:** ['PrepareEnvironment.ps1', 'InitializeData.ps1'] |
| | **tags** list / elements=string | success | The tags defined in the module's `PSData` metadata. **Sample:** ['networking', 'serialization', 'git', 'dsc'] |
| | **updated\_date** string | success | The date the module was last updated. **Sample:** 2019-12-31T09:20:02.0000000 |
| | **version** string | success | The module version. **Sample:** 1.2.3 |
### Authors
* Brian Scholer (@briantist)
| programming_docs |
ansible community.windows.win_format – Formats an existing volume or a new volume on an existing partition on Windows community.windows.win\_format – Formats an existing volume or a new volume on an existing partition on Windows
==============================================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_format`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* The [community.windows.win\_format](#ansible-collections-community-windows-win-format-module) module formats an existing volume or a new volume on an existing partition on Windows
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **allocation\_unit\_size** integer | | Specifies the cluster size to use when formatting the volume. If no cluster size is specified when you format a partition, defaults are selected based on the size of the partition. This value must be a multiple of the physical sector size of the disk. |
| **compress** boolean | **Choices:*** no
* yes
| Enable compression on the resulting NTFS volume. NTFS compression is not supported where *allocation\_unit\_size* is more than 4096. |
| **drive\_letter** string | | Used to specify the drive letter of the volume to be formatted. |
| **file\_system** string | **Choices:*** ntfs
* refs
* exfat
* fat32
* fat
| Used to specify the file system to be used when formatting the target volume. |
| **force** boolean | **Choices:*** **no** ←
* yes
| Specify if formatting should be forced for volumes that are not created from new partitions or if the source and target file system are different. |
| **full** boolean | **Choices:*** **no** ←
* yes
| A full format writes to every sector of the disk, takes much longer to perform than the default (quick) format, and is not recommended on storage that is thinly provisioned. Specify `true` for full format. |
| **integrity\_streams** boolean | **Choices:*** no
* yes
| Enable integrity streams on the resulting ReFS volume. |
| **label** string | | Used to specify the label of the volume to be formatted. |
| **large\_frs** boolean | **Choices:*** no
* yes
| Specifies that large File Record System (FRS) should be used. |
| **new\_label** string | | Used to specify the new file system label of the formatted volume. |
| **path** string | | Used to specify the path to the volume to be formatted. |
Notes
-----
Note
* Microsoft Windows Server 2012 or Microsoft Windows 8 or newer is required to use this module. To check if your system is compatible, see <https://docs.microsoft.com/en-us/windows/desktop/sysinfo/operating-system-version>.
* One of three parameters (*drive\_letter*, *path* and *label*) are mandatory to identify the target volume but more than one cannot be specified at the same time.
* This module is idempotent if *force* is not specified and file system labels remain preserved.
* For more information, see <https://docs.microsoft.com/en-us/previous-versions/windows/desktop/stormgmt/format-msft-volume>
See Also
--------
See also
[community.windows.win\_disk\_facts](win_disk_facts_module#ansible-collections-community-windows-win-disk-facts-module)
The official documentation on the **community.windows.win\_disk\_facts** module.
[community.windows.win\_partition](win_partition_module#ansible-collections-community-windows-win-partition-module)
The official documentation on the **community.windows.win\_partition** module.
Examples
--------
```
- name: Create a partition with drive letter D and size 5 GiB
community.windows.win_partition:
drive_letter: D
partition_size: 5 GiB
disk_number: 1
- name: Full format the newly created partition as NTFS and label it
community.windows.win_format:
drive_letter: D
file_system: NTFS
new_label: Formatted
full: True
```
### Authors
* Varun Chopra (@chopraaa) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#ff89d9dcccc8c4d9dccacdc4d9dccbc7c49c97908f8d9e9e9ed9dccbc9c49c9092)>
ansible community.windows.win_iis_website – Configures a IIS Web site community.windows.win\_iis\_website – Configures a IIS Web site
===============================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_iis_website`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Creates, Removes and configures a IIS Web site.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **application\_pool** string | | The application pool in which the new site executes. |
| **hostname** string | | The host header to bind to / use for the new site. |
| **ip** string | | The IP address to bind to / use for the new site. |
| **name** string / required | | Names of web site. |
| **parameters** string | | Custom site Parameters from string where properties are separated by a pipe and property name/values by colon Ex. "foo:1|bar:2" Some custom parameters that you can use are listed below, this isn't a definitive list but some common parameters.
`logfile.directory` - Physical path to store Logs, e.g. `D:\IIS-LOGs\`.
`logfile.period` - Log file rollover scheduled accepting these values, how frequently the log file should be rolled-over, e.g. `Hourly, Daily, Weekly, Monthly`.
`logfile.LogFormat` - Log file format, by default IIS uses `W3C`.
`logfile.truncateSize` - The size at which the log file contents will be trunsted, expressed in bytes. |
| **physical\_path** string | | The physical path on the remote host to use for the new site. The specified folder must already exist. |
| **port** integer | | The port to bind to / use for the new site. |
| **site\_id** string | | Explicitly set the IIS numeric ID for a site. Note that this value cannot be changed after the website has been created. |
| **state** string | **Choices:*** absent
* started
* stopped
* restarted
| State of the web site |
See Also
--------
See also
[community.windows.win\_iis\_virtualdirectory](win_iis_virtualdirectory_module#ansible-collections-community-windows-win-iis-virtualdirectory-module)
The official documentation on the **community.windows.win\_iis\_virtualdirectory** module.
[community.windows.win\_iis\_webapplication](win_iis_webapplication_module#ansible-collections-community-windows-win-iis-webapplication-module)
The official documentation on the **community.windows.win\_iis\_webapplication** module.
[community.windows.win\_iis\_webapppool](win_iis_webapppool_module#ansible-collections-community-windows-win-iis-webapppool-module)
The official documentation on the **community.windows.win\_iis\_webapppool** module.
[community.windows.win\_iis\_webbinding](win_iis_webbinding_module#ansible-collections-community-windows-win-iis-webbinding-module)
The official documentation on the **community.windows.win\_iis\_webbinding** module.
Examples
--------
```
# Start a website
- name: Acme IIS site
community.windows.win_iis_website:
name: Acme
state: started
port: 80
ip: 127.0.0.1
hostname: acme.local
application_pool: acme
physical_path: C:\sites\acme
parameters: logfile.directory:C:\sites\logs
register: website
# Remove Default Web Site and the standard port 80 binding
- name: Remove Default Web Site
community.windows.win_iis_website:
name: "Default Web Site"
state: absent
# Create a WebSite with custom Logging configuration (Logs Location, Format and Rolling Over).
- name: Creating WebSite with Custom Log location, Format 3WC and rolling over every hour.
community.windows.win_iis_website:
name: MyCustom_Web_Shop_Site
state: started
port: 80
ip: '*'
hostname: '*'
physical_path: D:\wwwroot\websites\my-shop-site
parameters: logfile.directory:D:\IIS-LOGS\websites\my-shop-site|logfile.period:Hourly|logFile.logFormat:W3C
application_pool: my-shop-site
# Some commandline examples:
# This return information about an existing host
# $ ansible -i vagrant-inventory -m community.windows.win_iis_website -a "name='Default Web Site'" window
# host | success >> {
# "changed": false,
# "site": {
# "ApplicationPool": "DefaultAppPool",
# "Bindings": [
# "*:80:"
# ],
# "ID": 1,
# "Name": "Default Web Site",
# "PhysicalPath": "%SystemDrive%\\inetpub\\wwwroot",
# "State": "Stopped"
# }
# }
# This stops an existing site.
# $ ansible -i hosts -m community.windows.win_iis_website -a "name='Default Web Site' state=stopped" host
# This creates a new site.
# $ ansible -i hosts -m community.windows.win_iis_website -a "name=acme physical_path=C:\\sites\\acme" host
# Change logfile.
# $ ansible -i hosts -m community.windows.win_iis_website -a "name=acme physical_path=C:\\sites\\acme" host
```
### Authors
* Henrik Wallström (@henrikwallstrom)
ansible community.windows.win_domain_group_membership – Manage Windows domain group membership community.windows.win\_domain\_group\_membership – Manage Windows domain group membership
=========================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_domain_group_membership`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Allows the addition and removal of domain users and domain groups from/to a domain group.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **domain\_password** string | | The password for *username*. |
| **domain\_server** string | | Specifies the Active Directory Domain Services instance to connect to. Can be in the form of an FQDN or NetBIOS name. If not specified then the value is based on the domain of the computer running PowerShell. |
| **domain\_username** string | | The username to use when interacting with AD. If this is not set then the user Ansible used to log in with will be used instead when using CredSSP or Kerberos with credential delegation. |
| **members** list / elements=string / required | | A list of members to ensure are present/absent from the group. The given names must be a SamAccountName of a user, group, service account, or computer. For computers, you must add "$" after the name; for example, to add "Mycomputer" to a group, use "Mycomputer$" as the member. If the member object is part of another domain in a multi-domain forest, you must add the domain and "\" in front of the name. |
| **name** string / required | | Name of the domain group to manage membership on. |
| **state** string | **Choices:*** absent
* **present** ←
* pure
| Desired state of the members in the group. When `state` is `pure`, only the members specified will exist, and all other existing members not specified are removed. |
Notes
-----
Note
* This must be run on a host that has the ActiveDirectory powershell module installed.
See Also
--------
See also
[community.windows.win\_domain\_user](win_domain_user_module#ansible-collections-community-windows-win-domain-user-module)
The official documentation on the **community.windows.win\_domain\_user** module.
[community.windows.win\_domain\_group](win_domain_group_module#ansible-collections-community-windows-win-domain-group-module)
The official documentation on the **community.windows.win\_domain\_group** module.
Examples
--------
```
- name: Add a domain user/group to a domain group
community.windows.win_domain_group_membership:
name: Foo
members:
- Bar
state: present
- name: Remove a domain user/group from a domain group
community.windows.win_domain_group_membership:
name: Foo
members:
- Bar
state: absent
- name: Ensure only a domain user/group exists in a domain group
community.windows.win_domain_group_membership:
name: Foo
members:
- Bar
state: pure
- name: Add a computer to a domain group
community.windows.win_domain_group_membership:
name: Foo
members:
- DESKTOP$
state: present
- name: Add a domain user/group from another Domain in the multi-domain forest to a domain group
community.windows.win_domain_group_membership:
domain_server: DomainAAA.cloud
name: GroupinDomainAAA
members:
- DomainBBB.cloud\UserInDomainBBB
state: Present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **added** list / elements=string | success and `state` is `present` or `pure` | A list of members added when `state` is `present` or `pure`; this is empty if no members are added. **Sample:** ['UserName', 'GroupName'] |
| **members** list / elements=string | success | A list of all domain group members at completion; this is empty if the group contains no members. **Sample:** ['UserName', 'GroupName'] |
| **name** string | always | The name of the target domain group. **Sample:** Domain-Admins |
| **removed** list / elements=string | success and `state` is `absent` or `pure` | A list of members removed when `state` is `absent` or `pure`; this is empty if no members are removed. **Sample:** ['UserName', 'GroupName'] |
### Authors
* Marius Rieder (@jiuka)
ansible community.windows.win_firewall – Enable or disable the Windows Firewall community.windows.win\_firewall – Enable or disable the Windows Firewall
========================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_firewall`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Enable or Disable Windows Firewall profiles.
Requirements
------------
The below requirements are needed on the host that executes this module.
* This module requires Windows Management Framework 5 or later.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **inbound\_action** string added in 1.1.0 of community.windows | **Choices:*** allow
* block
* not\_configured
| Set to `allow` or `block` inbound network traffic in the profile.
`not_configured` is valid when configuring a GPO. |
| **outbound\_action** string added in 1.1.0 of community.windows | **Choices:*** allow
* block
* not\_configured
| Set to `allow` or `block` inbound network traffic in the profile.
`not_configured` is valid when configuring a GPO. |
| **profiles** list / elements=string | **Choices:*** **Domain** ←
* **Private** ←
* **Public** ←
**Default:**["Domain", "Private", "Public"] | Specify one or more profiles to change. |
| **state** string | **Choices:*** disabled
* enabled
| Set state of firewall for given profile. |
See Also
--------
See also
[community.windows.win\_firewall\_rule](win_firewall_rule_module#ansible-collections-community-windows-win-firewall-rule-module)
The official documentation on the **community.windows.win\_firewall\_rule** module.
Examples
--------
```
- name: Enable firewall for Domain, Public and Private profiles
community.windows.win_firewall:
state: enabled
profiles:
- Domain
- Private
- Public
tags: enable_firewall
- name: Disable Domain firewall
community.windows.win_firewall:
state: disabled
profiles:
- Domain
tags: disable_firewall
- name: Enable firewall for Domain profile and block outbound connections
community.windows.win_firewall:
profiles: Domain
state: enabled
outbound_action: block
tags: block_connection
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **enabled** boolean | always | Current firewall status for chosen profile (after any potential change). **Sample:** True |
| **profiles** string | always | Chosen profile. **Sample:** Domain |
| **state** list / elements=string | always | Desired state of the given firewall profile(s). **Sample:** enabled |
### Authors
* Michael Eaton (@michaeldeaton)
ansible community.windows.win_netbios – Manage NetBIOS over TCP/IP settings on Windows. community.windows.win\_netbios – Manage NetBIOS over TCP/IP settings on Windows.
================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_netbios`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Enables or disables NetBIOS on Windows network adapters.
* Can be used to protect a system against NBT-NS poisoning and avoid NBNS broadcast storms.
* Settings can be applied system wide or per adapter.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **adapter\_names** list / elements=string | | List of adapter names for which to manage NetBIOS settings. If this option is omitted then configuration is applied to all adapters on the system. The adapter name used is the connection caption in the Network Control Panel or via `Get-NetAdapter`, eg `Ethernet 2`. |
| **state** string / required | **Choices:*** enabled
* disabled
* default
| Whether NetBIOS should be enabled, disabled, or default (use setting from DHCP server or if static IP address is assigned enable NetBIOS). |
Notes
-----
Note
* Changing NetBIOS settings does not usually require a reboot and will take effect immediately.
* UDP port 137/138/139 will no longer be listening once NetBIOS is disabled.
Examples
--------
```
- name: Disable NetBIOS system wide
community.windows.win_netbios:
state: disabled
- name: Disable NetBIOS on Ethernet2
community.windows.win_netbios:
state: disabled
adapter_names:
- Ethernet2
- name: Enable NetBIOS on Public and Backup adapters
community.windows.win_netbios:
state: enabled
adapter_names:
- Public
- Backup
- name: Set NetBIOS to system default on all adapters
community.windows.win_netbios:
state: default
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **reboot\_required** boolean | always | Boolean value stating whether a system reboot is required. **Sample:** True |
### Authors
* Thomas Moore (@tmmruk)
| programming_docs |
ansible community.windows.win_say – Text to speech module for Windows to speak messages and optionally play sounds community.windows.win\_say – Text to speech module for Windows to speak messages and optionally play sounds
===========================================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_say`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Uses .NET libraries to convert text to speech and optionally play .wav sounds. Audio Service needs to be running and some kind of speakers or headphones need to be attached to the windows target(s) for the speech to be audible.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **end\_sound\_path** path | | Full path to a `.wav` file containing a sound to play after the text has been spoken. Useful on conference calls to alert other speakers that ansible has finished speaking. |
| **msg** string | | The text to be spoken. Use either `msg` or `msg_file`. Optional so that you can use this module just to play sounds. |
| **msg\_file** path | | Full path to a windows format text file containing the text to be spoken. Use either `msg` or `msg_file`. Optional so that you can use this module just to play sounds. |
| **speech\_speed** integer | **Default:**0 | How fast or slow to speak the text. Must be an integer value in the range -10 to 10. -10 is slowest, 10 is fastest. |
| **start\_sound\_path** path | | Full path to a `.wav` file containing a sound to play before the text is spoken. Useful on conference calls to alert other speakers that ansible has something to say. |
| **voice** string | | Which voice to use. See notes for how to discover installed voices. If the requested voice is not available the default voice will be used. Example voice names from Windows 10 are `Microsoft Zira Desktop` and `Microsoft Hazel Desktop`. |
Notes
-----
Note
* Needs speakers or headphones to do anything useful.
* To find which voices are installed, run the following Powershell commands.
Add-Type -AssemblyName System.Speech $speech = New-Object -TypeName System.Speech.Synthesis.SpeechSynthesizer $speech.GetInstalledVoices() | ForEach-Object { $\_.VoiceInfo } $speech.Dispose()
* Speech can be surprisingly slow, so it’s best to keep message text short.
See Also
--------
See also
[community.windows.win\_msg](win_msg_module#ansible-collections-community-windows-win-msg-module)
The official documentation on the **community.windows.win\_msg** module.
[community.windows.win\_toast](win_toast_module#ansible-collections-community-windows-win-toast-module)
The official documentation on the **community.windows.win\_toast** module.
Examples
--------
```
- name: Warn of impending deployment
community.windows.win_say:
msg: Warning, deployment commencing in 5 minutes, please log out.
- name: Using a different voice and a start sound
community.windows.win_say:
start_sound_path: C:\Windows\Media\ding.wav
msg: Warning, deployment commencing in 5 minutes, please log out.
voice: Microsoft Hazel Desktop
- name: With start and end sound
community.windows.win_say:
start_sound_path: C:\Windows\Media\Windows Balloon.wav
msg: New software installed
end_sound_path: C:\Windows\Media\chimes.wav
- name: Text from file example
community.windows.win_say:
start_sound_path: C:\Windows\Media\Windows Balloon.wav
msg_file: AppData\Local\Temp\morning_report.txt
end_sound_path: C:\Windows\Media\chimes.wav
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **message\_text** string | success | The text that the module attempted to speak. **Sample:** Warning, deployment commencing in 5 minutes. |
| **voice** string | success | The voice used to speak the text. **Sample:** Microsoft Hazel Desktop |
| **voice\_info** string | when requested voice could not be loaded | The voice used to speak the text. **Sample:** Could not load voice TestVoice, using system default voice |
### Authors
* Jon Hawkesworth (@jhawkesworth)
ansible community.windows.win_rds_rap – Manage Resource Authorization Policies (RAP) on a Remote Desktop Gateway server community.windows.win\_rds\_rap – Manage Resource Authorization Policies (RAP) on a Remote Desktop Gateway server
=================================================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_rds_rap`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Creates, removes and configures a Remote Desktop resource authorization policy (RD RAP).
* A RD RAP allows you to specify the network resources (computers) that users can connect to remotely through a Remote Desktop Gateway server.
Requirements
------------
The below requirements are needed on the host that executes this module.
* Windows Server 2008R2 (6.1) or higher.
* The Windows Feature “RDS-Gateway” must be enabled.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **allowed\_ports** list / elements=string | | List of port numbers through which connections are allowed for this policy. To allow connections through any port, specify 'any'. |
| **computer\_group** string | | The computer group name that is associated with this resource authorization policy (RAP). This is required when *computer\_group\_type* is `rdg_group` or `ad_network_resource_group`. |
| **computer\_group\_type** string | **Choices:*** rdg\_group
* ad\_network\_resource\_group
* allow\_any
| The computer group type:
`rdg_group`: RD Gateway-managed group
`ad_network_resource_group`: Active Directory Domain Services network resource group
`allow_any`: Allow users to connect to any network resource. |
| **description** string | | Optional description of the resource authorization policy. |
| **name** string / required | | Name of the resource authorization policy. |
| **state** string | **Choices:*** absent
* disabled
* enabled
* **present** ←
| The state of resource authorization policy. If `absent` will ensure the policy is removed. If `present` will ensure the policy is configured and exists. If `enabled` will ensure the policy is configured, exists and enabled. If `disabled` will ensure the policy is configured, exists, but disabled. |
| **user\_groups** list / elements=string | | List of user groups that are associated with this resource authorization policy (RAP). A user must belong to one of these groups to access the RD Gateway server. Required when a new RAP is created. |
See Also
--------
See also
[community.windows.win\_rds\_cap](win_rds_cap_module#ansible-collections-community-windows-win-rds-cap-module)
The official documentation on the **community.windows.win\_rds\_cap** module.
[community.windows.win\_rds\_rap](#ansible-collections-community-windows-win-rds-rap-module)
The official documentation on the **community.windows.win\_rds\_rap** module.
[community.windows.win\_rds\_settings](win_rds_settings_module#ansible-collections-community-windows-win-rds-settings-module)
The official documentation on the **community.windows.win\_rds\_settings** module.
Examples
--------
```
- name: Create a new RDS RAP
community.windows.win_rds_rap:
name: My RAP
description: Allow all users to connect to any resource through ports 3389 and 3390
user_groups:
- BUILTIN\users
computer_group_type: allow_any
allowed_ports:
- 3389
- 3390
state: enabled
```
### Authors
* Kevin Subileau (@ksubileau)
ansible community.windows.win_data_deduplication – Module to enable Data Deduplication on a volume. community.windows.win\_data\_deduplication – Module to enable Data Deduplication on a volume.
=============================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_data_deduplication`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* This module can be used to enable Data Deduplication on a Windows volume.
* The module will install the FS-Data-Deduplication feature (a reboot will be necessary).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **drive\_letter** string / required | | Windows drive letter on which to enable data deduplication. |
| **settings** dictionary | | Dictionary of settings to pass to the Set-DedupVolume powershell command. |
| | **minimum\_file\_age\_days** integer | **Default:**2 | Minimum file age you want to target for deduplication. |
| | **minimum\_file\_size** integer | **Default:**32768 | Minimum file size you want to target for deduplication. It will default to 32768 if not defined or if the value is less than 32768. |
| | **no\_compress** boolean | **Choices:*** **no** ←
* yes
| Wether you want to enabled filesystem compression or not. |
| | **optimize\_in\_use\_files** boolean | **Choices:*** **no** ←
* yes
| Indicates that the server attempts to optimize currently open files. |
| | **verify** boolean | **Choices:*** **no** ←
* yes
| Indicates whether the deduplication engine performs a byte-for-byte verification for each duplicate chunk that optimization creates, rather than relying on a cryptographically strong hash. This option is not recommend. Setting this parameter to True can degrade optimization performance. |
| **state** string | **Choices:*** **present** ←
* absent
| Wether to enable or disable data deduplication on the selected volume. |
Examples
--------
```
- name: Enable Data Deduplication on D
community.windows.win_data_deduplication:
drive_letter: 'D'
state: present
- name: Enable Data Deduplication on D
community.windows.win_data_deduplication:
drive_letter: 'D'
state: present
settings:
no_compress: true
minimum_file_age_days: 1
minimum_file_size: 0
```
### Authors
* rnsc (@rnsc)
ansible community.windows.win_psrepository_info – Gather information about PSRepositories community.windows.win\_psrepository\_info – Gather information about PSRepositories
===================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_psrepository_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Gather information about all or a specific PSRepository.
Requirements
------------
The below requirements are needed on the host that executes this module.
* `PowerShellGet` module
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **name** string | **Default:**"\*" | The name of the repository to retrieve. Supports any wildcard pattern supported by `Get-PSRepository`. If omitted then all repositories will returned. |
See Also
--------
See also
[community.windows.win\_psrepository](win_psrepository_module#ansible-collections-community-windows-win-psrepository-module)
The official documentation on the **community.windows.win\_psrepository** module.
Examples
--------
```
- name: Get info for a single repository
community.windows.win_psrepository_info:
name: PSGallery
register: repo_info
- name: Find all repositories that start with 'MyCompany'
community.windows.win_psrepository_info:
name: MyCompany*
- name: Get info for all repositories
community.windows.win_psrepository_info:
register: repo_info
- name: Remove all repositories that don't have a publish_location set
community.windows.win_psrepository:
name: "{{ item }}"
state: absent
loop: "{{ repo_info.repositories | rejectattr('publish_location', 'none') | list }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **repositories** list / elements=dictionary | always | A list of repositories (or an empty list is there are none). |
| | **installation\_policy** string | success | The installation policy of the repository. The sample values are the only possible values. **Sample:** ['Trusted', 'Untrusted'] |
| | **name** string | success | The name of the repository. **Sample:** PSGallery |
| | **package\_management\_provider** string | success | The name of the package management provider for this repository. **Sample:** NuGet |
| | **provider\_options** dictionary | success | Provider-specific options for this repository. |
| | **publish\_location** string | success | The location used to publish modules. **Sample:** https://www.powershellgallery.com/api/v2/package/ |
| | **registered** boolean | success | Whether the module is registered. Should always be `True`
|
| | **script\_publish\_location** string | success | The location used to publish scripts. **Sample:** https://www.powershellgallery.com/api/v2/package/ |
| | **script\_source\_location** string | success | The location used to find and retrieve scripts. **Sample:** https://www.powershellgallery.com/api/v2/items/psscript |
| | **source\_location** string | success | The location used to find and retrieve modules. This should always have a value. **Sample:** https://www.powershellgallery.com/api/v2 |
| | **trusted** boolean | success | A boolean flag reflecting the value of `installation_policy` as to whether the repository is trusted. |
### Authors
* Brian Scholer (@briantist)
ansible community.windows.win_shortcut – Manage shortcuts on Windows community.windows.win\_shortcut – Manage shortcuts on Windows
=============================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_shortcut`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Create, manage and delete Windows shortcuts
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **arguments** string | | Additional arguments for the executable defined in `src`.
aliases: args |
| **description** string | | Description for the shortcut. This is usually shown when hoovering the icon. |
| **dest** path / required | | Destination file for the shortcuting file. File name should have a `.lnk` or `.url` extension. |
| **directory** path | | Working directory for executable defined in `src`. |
| **hotkey** string | | Key combination for the shortcut. This is a combination of one or more modifiers and a key. Possible modifiers are Alt, Ctrl, Shift, Ext. Possible keys are [A-Z] and [0-9]. |
| **icon** path | | Icon used for the shortcut. File name should have a `.ico` extension. The file name is followed by a comma and the number in the library file (.dll) or use 0 for an image file. |
| **run\_as\_admin** boolean | **Choices:*** **no** ←
* yes
| When `src` is an executable, this can control whether the shortcut will be opened as an administrator or not. |
| **src** string | | Executable or URL the shortcut points to. The executable needs to be in your PATH, or has to be an absolute path to the executable. |
| **state** string | **Choices:*** absent
* **present** ←
| When `absent`, removes the shortcut if it exists. When `present`, creates or updates the shortcut. |
| **windowstyle** string | **Choices:*** maximized
* minimized
* normal
| Influences how the application is displayed when it is launched. |
Notes
-----
Note
* The following options can include Windows environment variables: `dest`, `args`, `description`, `dest`, `directory`, `icon` `src`
* Windows has two types of shortcuts: Application and URL shortcuts. URL shortcuts only consists of `dest` and `src`
See Also
--------
See also
[ansible.windows.win\_file](../../ansible/windows/win_file_module#ansible-collections-ansible-windows-win-file-module)
The official documentation on the **ansible.windows.win\_file** module.
Examples
--------
```
- name: Create an application shortcut on the desktop
community.windows.win_shortcut:
src: C:\Program Files\Mozilla Firefox\Firefox.exe
dest: C:\Users\Public\Desktop\Mozilla Firefox.lnk
icon: C:\Program Files\Mozilla Firefox\Firefox.exe,0
- name: Create the same shortcut using environment variables
community.windows.win_shortcut:
description: The Mozilla Firefox web browser
src: '%ProgramFiles%\Mozilla Firefox\Firefox.exe'
dest: '%Public%\Desktop\Mozilla Firefox.lnk'
icon: '%ProgramFiles\Mozilla Firefox\Firefox.exe,0'
directory: '%ProgramFiles%\Mozilla Firefox'
hotkey: Ctrl+Alt+F
- name: Create an application shortcut for an executable in PATH to your desktop
community.windows.win_shortcut:
src: cmd.exe
dest: Desktop\Command prompt.lnk
- name: Create an application shortcut for the Ansible website
community.windows.win_shortcut:
src: '%ProgramFiles%\Google\Chrome\Application\chrome.exe'
dest: '%UserProfile%\Desktop\Ansible website.lnk'
arguments: --new-window https://ansible.com/
directory: '%ProgramFiles%\Google\Chrome\Application'
icon: '%ProgramFiles%\Google\Chrome\Application\chrome.exe,0'
hotkey: Ctrl+Alt+A
- name: Create a URL shortcut for the Ansible website
community.windows.win_shortcut:
src: https://ansible.com/
dest: '%Public%\Desktop\Ansible website.url'
```
### Authors
* Dag Wieers (@dagwieers)
| programming_docs |
ansible community.windows.win_rds_cap – Manage Connection Authorization Policies (CAP) on a Remote Desktop Gateway server community.windows.win\_rds\_cap – Manage Connection Authorization Policies (CAP) on a Remote Desktop Gateway server
===================================================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_rds_cap`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Creates, removes and configures a Remote Desktop connection authorization policy (RD CAP).
* A RD CAP allows you to specify the users who can connect to a Remote Desktop Gateway server.
Requirements
------------
The below requirements are needed on the host that executes this module.
* Windows Server 2008R2 (6.1) or higher.
* The Windows Feature “RDS-Gateway” must be enabled.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **allow\_only\_sdrts\_servers** boolean | **Choices:*** no
* yes
| Specifies whether connections are allowed only to Remote Desktop Session Host servers that enforce Remote Desktop Gateway redirection policy. |
| **auth\_method** string | **Choices:*** both
* none
* password
* smartcard
| Specifies how the RD Gateway server authenticates users. When a new CAP is created, the default value is `password`. |
| **computer\_groups** list / elements=string | | A list of computer groups that is allowed to connect to the Remote Gateway server. |
| **idle\_timeout** integer | | Specifies the time interval, in minutes, after which an idle session is disconnected. A value of zero disables idle timeout. |
| **name** string / required | | Name of the connection authorization policy. |
| **order** integer | | Evaluation order of the policy. The CAP in which *order* is set to a value of '1' is evaluated first. By default, a newly created CAP will take the first position. If the given value exceed the total number of existing policies, the policy will take the last position but the evaluation order will be capped to this number. |
| **redirect\_clipboard** boolean | **Choices:*** no
* yes
| Allow clipboard redirection. |
| **redirect\_drives** boolean | **Choices:*** no
* yes
| Allow disk drive redirection. |
| **redirect\_pnp** boolean | **Choices:*** no
* yes
| Allow Plug and Play devices redirection. |
| **redirect\_printers** boolean | **Choices:*** no
* yes
| Allow printers redirection. |
| **redirect\_serial** boolean | **Choices:*** no
* yes
| Allow serial port redirection. |
| **session\_timeout** integer | | The maximum time, in minutes, that a session can be idle. A value of zero disables session timeout. |
| **session\_timeout\_action** string | **Choices:*** **disconnect** ←
* reauth
| The action the server takes when a session times out.
`disconnect`: disconnect the session.
`reauth`: silently reauthenticate and reauthorize the session. |
| **state** string | **Choices:*** absent
* enabled
* disabled
* **present** ←
| The state of connection authorization policy. If `absent` will ensure the policy is removed. If `present` will ensure the policy is configured and exists. If `enabled` will ensure the policy is configured, exists and enabled. If `disabled` will ensure the policy is configured, exists, but disabled. |
| **user\_groups** list / elements=string | | A list of user groups that is allowed to connect to the Remote Gateway server. Required when a new CAP is created. |
See Also
--------
See also
[community.windows.win\_rds\_cap](#ansible-collections-community-windows-win-rds-cap-module)
The official documentation on the **community.windows.win\_rds\_cap** module.
[community.windows.win\_rds\_rap](win_rds_rap_module#ansible-collections-community-windows-win-rds-rap-module)
The official documentation on the **community.windows.win\_rds\_rap** module.
[community.windows.win\_rds\_settings](win_rds_settings_module#ansible-collections-community-windows-win-rds-settings-module)
The official documentation on the **community.windows.win\_rds\_settings** module.
Examples
--------
```
- name: Create a new RDS CAP with a 30 minutes timeout and clipboard redirection enabled
community.windows.win_rds_cap:
name: My CAP
user_groups:
- BUILTIN\users
session_timeout: 30
session_timeout_action: disconnect
allow_only_sdrts_servers: yes
redirect_clipboard: yes
redirect_drives: no
redirect_printers: no
redirect_serial: no
redirect_pnp: no
state: enabled
```
### Authors
* Kevin Subileau (@ksubileau)
ansible community.windows.win_domain_group – Creates, modifies or removes domain groups community.windows.win\_domain\_group – Creates, modifies or removes domain groups
=================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_domain_group`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Creates, modifies or removes groups in Active Directory.
* For local groups, use the [ansible.windows.win\_group](../../ansible/windows/win_group_module#ansible-collections-ansible-windows-win-group-module) module instead.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **attributes** dictionary | | A dict of custom LDAP attributes to set on the group. This can be used to set custom attributes that are not exposed as module parameters, e.g. `mail`. See the examples on how to format this parameter. |
| **category** string | **Choices:*** distribution
* security
| The category of the group, this is the value to assign to the LDAP `groupType` attribute. If a new group is created then `security` will be used by default. |
| **description** string | | The value to be assigned to the LDAP `description` attribute. |
| **display\_name** string | | The value to assign to the LDAP `displayName` attribute. |
| **domain\_password** string | | The password for `username`. |
| **domain\_server** string | | Specifies the Active Directory Domain Services instance to connect to. Can be in the form of an FQDN or NetBIOS name. If not specified then the value is based on the domain of the computer running PowerShell. |
| **domain\_username** string | | The username to use when interacting with AD. If this is not set then the user Ansible used to log in with will be used instead. |
| **ignore\_protection** boolean | **Choices:*** **no** ←
* yes
| Will ignore the `ProtectedFromAccidentalDeletion` flag when deleting or moving a group. The module will fail if one of these actions need to occur and this value is set to `no`. |
| **managed\_by** string | | The value to be assigned to the LDAP `managedBy` attribute. This value can be in the forms `Distinguished Name`, `objectGUID`, `objectSid` or `sAMAccountName`, see examples for more details. |
| **name** string / required | | The name of the group to create, modify or remove. This value can be in the forms `Distinguished Name`, `objectGUID`, `objectSid` or `sAMAccountName`, see examples for more details. |
| **organizational\_unit** string | | The full LDAP path to create or move the group to. This should be the path to the parent object to create or move the group to. See examples for details of how this path is formed.
aliases: ou, path |
| **protect** boolean | **Choices:*** no
* yes
| Will set the `ProtectedFromAccidentalDeletion` flag based on this value. This flag stops a user from deleting or moving a group to a different path. |
| **scope** string | **Choices:*** domainlocal
* global
* universal
| The scope of the group. If `state=present` and the group doesn't exist then this must be set. |
| **state** string | **Choices:*** absent
* **present** ←
| If `state=present` this module will ensure the group is created and is configured accordingly. If `state=absent` this module will delete the group if it exists |
Notes
-----
Note
* This must be run on a host that has the ActiveDirectory powershell module installed.
See Also
--------
See also
[ansible.windows.win\_domain](../../ansible/windows/win_domain_module#ansible-collections-ansible-windows-win-domain-module)
The official documentation on the **ansible.windows.win\_domain** module.
[ansible.windows.win\_domain\_controller](../../ansible/windows/win_domain_controller_module#ansible-collections-ansible-windows-win-domain-controller-module)
The official documentation on the **ansible.windows.win\_domain\_controller** module.
[community.windows.win\_domain\_computer](win_domain_computer_module#ansible-collections-community-windows-win-domain-computer-module)
The official documentation on the **community.windows.win\_domain\_computer** module.
[ansible.windows.win\_domain\_membership](../../ansible/windows/win_domain_membership_module#ansible-collections-ansible-windows-win-domain-membership-module)
The official documentation on the **ansible.windows.win\_domain\_membership** module.
[community.windows.win\_domain\_user](win_domain_user_module#ansible-collections-community-windows-win-domain-user-module)
The official documentation on the **community.windows.win\_domain\_user** module.
[ansible.windows.win\_group](../../ansible/windows/win_group_module#ansible-collections-ansible-windows-win-group-module)
The official documentation on the **ansible.windows.win\_group** module.
[ansible.windows.win\_group\_membership](../../ansible/windows/win_group_membership_module#ansible-collections-ansible-windows-win-group-membership-module)
The official documentation on the **ansible.windows.win\_group\_membership** module.
Examples
--------
```
- name: Ensure the group Cow exists using sAMAccountName
community.windows.win_domain_group:
name: Cow
scope: global
path: OU=groups,DC=ansible,DC=local
- name: Ensure the group Cow doesn't exist using the Distinguished Name
community.windows.win_domain_group:
name: CN=Cow,OU=groups,DC=ansible,DC=local
state: absent
- name: Delete group ignoring the protection flag
community.windows.win_domain_group:
name: Cow
state: absent
ignore_protection: yes
- name: Create group with delete protection enabled and custom attributes
community.windows.win_domain_group:
name: Ansible Users
scope: domainlocal
category: security
attributes:
mail: [email protected]
wWWHomePage: www.ansible.com
ignore_protection: yes
- name: Change the OU of a group using the SID and ignore the protection flag
community.windows.win_domain_group:
name: S-1-5-21-2171456218-3732823212-122182344-1189
scope: global
organizational_unit: OU=groups,DC=ansible,DC=local
ignore_protection: yes
- name: Add managed_by user
community.windows.win_domain_group:
name: Group Name Here
managed_by: Domain Admins
- name: Add group and specify the AD domain services to use for the create
community.windows.win_domain_group:
name: Test Group
domain_username: [email protected]
domain_password: Password01!
domain_server: corp-DC12.corp.ansible.com
scope: domainlocal
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **attributes** dictionary | group exists and attributes are set on the module invocation | Custom attributes that were set by the module. This does not show all the custom attributes rather just the ones that were set by the module. **Sample:** {'mail': '[email protected]', 'wWWHomePage': 'www.ansible.com'} |
| **canonical\_name** string | group exists | The canonical name of the group. **Sample:** ansible.local/groups/Cow |
| **category** string | group exists | The Group type value of the group, i.e. Security or Distribution. **Sample:** Security |
| **created** boolean | always | Whether a group was created **Sample:** True |
| **description** string | group exists | The Description of the group. **Sample:** Group Description |
| **display\_name** string | group exists | The Display name of the group. **Sample:** Users who connect through RDP |
| **distinguished\_name** string | group exists | The full Distinguished Name of the group. **Sample:** CN=Cow,OU=groups,DC=ansible,DC=local |
| **group\_scope** string | group exists | The Group scope value of the group. **Sample:** Universal |
| **guid** string | group exists | The guid of the group. **Sample:** 512a9adb-3fc0-4a26-9df0-e6ea1740cf45 |
| **managed\_by** string | group exists | The full Distinguished Name of the AD object that is set on the managedBy attribute. **Sample:** CN=Domain Admins,CN=Users,DC=ansible,DC=local |
| **name** string | group exists | The name of the group. **Sample:** Cow |
| **protected\_from\_accidental\_deletion** boolean | group exists | Whether the group is protected from accidental deletion. **Sample:** True |
| **sid** string | group exists | The Security ID of the group. **Sample:** S-1-5-21-2171456218-3732823212-122182344-1189 |
### Authors
* Jordan Borean (@jborean93)
ansible community.windows.win_regmerge – Merges the contents of a registry file into the Windows registry community.windows.win\_regmerge – Merges the contents of a registry file into the Windows registry
==================================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_regmerge`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Wraps the reg.exe command to import the contents of a registry file.
* Suitable for use with registry files created using [ansible.windows.win\_template](../../ansible/windows/win_template_module#ansible-collections-ansible-windows-win-template-module).
* Windows registry files have a specific format and must be constructed correctly with carriage return and line feed line endings otherwise they will not be merged.
* Exported registry files often start with a Byte Order Mark which must be removed if the file is to templated using [ansible.windows.win\_template](../../ansible/windows/win_template_module#ansible-collections-ansible-windows-win-template-module).
* Registry file format is described at <https://support.microsoft.com/en-us/kb/310516>
* See also [ansible.windows.win\_template](../../ansible/windows/win_template_module#ansible-collections-ansible-windows-win-template-module), [ansible.windows.win\_regedit](../../ansible/windows/win_regedit_module#ansible-collections-ansible-windows-win-regedit-module)
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **compare\_key** string | | The parent key to use when comparing the contents of the registry to the contents of the file. Needs to be in HKLM or HKCU part of registry. Use a PS-Drive style path for example HKLM:\SOFTWARE not HKEY\_LOCAL\_MACHINE\SOFTWARE If not supplied, or the registry key is not found, no comparison will be made, and the module will report changed. |
| **path** path / required | | The full path including file name to the registry file on the remote machine to be merged |
Notes
-----
Note
* Organise your registry files so that they contain a single root registry key if you want to use the compare\_to functionality.
* This module does not force registry settings to be in the state described in the file. If registry settings have been modified externally the module will merge the contents of the file but continue to report differences on subsequent runs.
* To force registry change, use [ansible.windows.win\_regedit](../../ansible/windows/win_regedit_module#ansible-collections-ansible-windows-win-regedit-module) with `state=absent` before using `community.windows.win_regmerge`.
See Also
--------
See also
[ansible.windows.win\_reg\_stat](../../ansible/windows/win_reg_stat_module#ansible-collections-ansible-windows-win-reg-stat-module)
The official documentation on the **ansible.windows.win\_reg\_stat** module.
[ansible.windows.win\_regedit](../../ansible/windows/win_regedit_module#ansible-collections-ansible-windows-win-regedit-module)
The official documentation on the **ansible.windows.win\_regedit** module.
Examples
--------
```
- name: Merge in a registry file without comparing to current registry
community.windows.win_regmerge:
path: C:\autodeploy\myCompany-settings.reg
- name: Compare and merge registry file
community.windows.win_regmerge:
path: C:\autodeploy\myCompany-settings.reg
compare_to: HKLM:\SOFTWARE\myCompany
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **compare\_to\_key\_found** boolean | when comparison key not found in registry | whether the parent registry key has been found for comparison |
| **compared** boolean | when a comparison key has been supplied and comparison has been attempted | whether a comparison has taken place between the registry and the file **Sample:** True |
| **difference\_count** integer | changed | number of differences between the registry and the file **Sample:** 1 |
### Authors
* Jon Hawkesworth (@jhawkesworth)
ansible community.windows.win_audit_policy_system – Used to make changes to the system wide Audit Policy community.windows.win\_audit\_policy\_system – Used to make changes to the system wide Audit Policy
===================================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_audit_policy_system`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Used to make changes to the system wide Audit Policy.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **audit\_type** list / elements=string / required | **Choices:*** failure
* none
* success
| The type of event you would like to audit for. Accepts a list. See examples. |
| **category** string | | Single string value for the category you would like to adjust the policy on. Cannot be used with *subcategory*. You must define one or the other. Changing this setting causes all subcategories to be adjusted to the defined *audit\_type*. |
| **subcategory** string | | Single string value for the subcategory you would like to adjust the policy on. Cannot be used with *category*. You must define one or the other. |
Notes
-----
Note
* It is recommended to take a backup of the policies before adjusting them for the first time.
* See this page for in depth information <https://technet.microsoft.com/en-us/library/cc766468.aspx>.
See Also
--------
See also
[community.windows.win\_audit\_rule](win_audit_rule_module#ansible-collections-community-windows-win-audit-rule-module)
The official documentation on the **community.windows.win\_audit\_rule** module.
Examples
--------
```
- name: Enable failure auditing for the subcategory "File System"
community.windows.win_audit_policy_system:
subcategory: File System
audit_type: failure
- name: Enable all auditing types for the category "Account logon events"
community.windows.win_audit_policy_system:
category: Account logon events
audit_type: success, failure
- name: Disable auditing for the subcategory "File System"
community.windows.win_audit_policy_system:
subcategory: File System
audit_type: none
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **current\_audit\_policy** dictionary | always | details on the policy being targetted **Sample:** { "File Share":"failure" } |
### Authors
* Noah Sparks (@nwsparks)
| programming_docs |
ansible community.windows.win_psrepository_copy – Copies registered PSRepositories to other user profiles community.windows.win\_psrepository\_copy – Copies registered PSRepositories to other user profiles
===================================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_psrepository_copy`.
New in version 1.3.0: of community.windows
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Copies specified registered PSRepositories to other user profiles on the system.
* Can include the `Default` profile so that new users start with the selected repositories.
* Can include special service accounts like the local SYSTEM user, LocalService, NetworkService.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **exclude** list / elements=string | | The names of repositories to exclude. Names are interpreted as wildcards. If a name matches both an include (*name*) and *exclude*, it will be excluded. |
| **exclude\_profiles** list / elements=string | **Default:**["systemprofile", "LocalService", "NetworkService"] | The names of user profiles to exclude. If a profile matches both an include (*profiles*) and *exclude\_profiles*, it will be excluded. By default, the service account profiles are excluded. To explcitly exclude nothing, set *exclude\_profiles=[]*. |
| **name** list / elements=string | **Default:**["\*"] | The names of repositories to copy. Names are interpreted as wildcards. |
| **profiles** list / elements=string | **Default:**["\*"] | The names of user profiles to populate with repositories. Names are interpreted as wildcards. The `Default` profile can also be matched. The `Public` and `All Users` profiles cannot be targeted, as PSRepositories are not loaded from them. |
| **source** path | **Default:**"%LOCALAPPDATA%\\Microsoft\\Windows\\PowerShell\\PowerShellGet\\PSRepositories.xml" | The full path to the source repositories XML file. Defaults to the repositories registered to the current user. |
Notes
-----
Note
* Does not require the `PowerShellGet` module or any other external dependencies.
* User profiles are loaded from the registry. If a given path does not exist (like if the profile directory was deleted), it is silently skipped.
* If setting service account profiles, you may need `become=yes`. See examples.
* When PowerShellGet first sets up a repositories file, it always adds `PSGallery`, however if this module creates a new repos file and your selected repositories don’t include `PSGallery`, it won’t be in your destination.
* The values searched in *profiles* (and *exclude\_profiles*) are profile names, not necessarily user names. This can happen when the profile path is deliberately changed or when domain user names conflict with users from the local computer or another domain. In this case the second+ user may have the domain name or local computer name appended, like `JoeUser.Contoso` vs. `JoeUser`. If you intend to filter user profiles, ensure your filters catch the right names.
* In the case of the service accounts, the specific profiles are `systemprofile` (for the `SYSTEM` user), and `LocalService` or `NetworkService` for those accounts respectively.
* Repositories with credentials (requiring authentication) or proxy information will copy, but the credentials and proxy details will not as that information is not stored with repository.
See Also
--------
See also
[community.windows.win\_psrepository](win_psrepository_module#ansible-collections-community-windows-win-psrepository-module)
The official documentation on the **community.windows.win\_psrepository** module.
[community.windows.win\_psrepository\_info](win_psrepository_info_module#ansible-collections-community-windows-win-psrepository-info-module)
The official documentation on the **community.windows.win\_psrepository\_info** module.
Examples
--------
```
- name: Copy the current user's PSRepositories to all non-service account profiles and Default profile
community.windows.win_psrepository_copy:
- name: Copy the current user's PSRepositories to all profiles and Default profile
community.windows.win_psrepository_copy:
exclude_profiles: []
- name: Copy the current user's PSRepositories to all profiles beginning with A, B, or C
community.windows.win_psrepository_copy:
profiles:
- 'A*'
- 'B*'
- 'C*'
- name: Copy the current user's PSRepositories to all profiles beginning B except Brian and Brianna
community.windows.win_psrepository_copy:
profiles: 'B*'
exclude_profiles:
- Brian
- Brianna
- name: Copy a specific set of repositories to profiles beginning with 'svc' with exceptions
community.windows.win_psrepository_copy:
name:
- CompanyRepo1
- CompanyRepo2
- PSGallery
profiles: 'svc*'
exclude_profiles: 'svc-restricted'
- name: Copy repos matching a pattern with exceptions
community.windows.win_psrepository_copy:
name: 'CompanyRepo*'
exclude: 'CompanyRepo*-Beta'
- name: Copy repositories from a custom XML file on the target host
community.windows.win_psrepository_copy:
source: 'C:\data\CustomRepostories.xml'
### A sample workflow of seeding a system with a custom repository
# A playbook that does initial host setup or builds system images
- name: Register custom respository
community.windows.win_psrepository:
name: PrivateRepo
source_location: https://example.com/nuget/feed/etc
installation_policy: trusted
- name: Ensure all current and new users have this repository registered
community.windows.win_psrepository_copy:
name: PrivateRepo
# In another playbook, run by other users (who may have been created later)
- name: Install a module
community.windows.win_psmodule:
name: CompanyModule
repository: PrivateRepo
state: present
```
### Authors
* Brian Scholer (@briantist)
ansible community.windows.win_mapped_drive – Map network drives for users community.windows.win\_mapped\_drive – Map network drives for users
===================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_mapped_drive`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Allows you to modify mapped network drives for individual users.
* Also support WebDAV endpoints in the UNC form.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **letter** string / required | | The letter of the network path to map to. This letter must not already be in use with Windows. |
| **password** string | | The password for `username` that is used when testing the initial connection. This is never saved with a mapped drive, use the [community.windows.win\_credential](win_credential_module) module to persist a username and password for a host. |
| **path** path | | The UNC path to map the drive to. If pointing to a WebDAV location this must still be in a UNC path in the format `\\hostname\path` and not a URL, see examples for more details. To specify a `https` WebDAV path, add `@SSL` after the hostname. To specify a custom WebDAV port add `@<port num>` after the `@SSL` or hostname portion of the UNC path, e.g. `\\server@SSL@1234` or `\\server@1234`. This is required if `state=present`. If `state=absent` and *path* is not set, the module will delete the mapped drive regardless of the target. If `state=absent` and the *path* is set, the module will throw an error if path does not match the target of the mapped drive. |
| **state** string | **Choices:*** absent
* **present** ←
| If `present` will ensure the mapped drive exists. If `absent` will ensure the mapped drive does not exist. |
| **username** string | | The username that is used when testing the initial connection. This is never saved with a mapped drive, the [community.windows.win\_credential](win_credential_module) module to persist a username and password for a host. This is required if the mapped drive requires authentication with custom credentials and become, or CredSSP cannot be used. If become or CredSSP is used, any credentials saved with [community.windows.win\_credential](win_credential_module) will automatically be used instead. |
Notes
-----
Note
* You cannot use this module to access a mapped drive in another Ansible task, drives mapped with this module are only accessible when logging in interactively with the user through the console or RDP.
* It is recommend to run this module with become or CredSSP when the remote path requires authentication.
* When using become or CredSSP, the task will have access to any local credentials stored in the user’s vault.
* If become or CredSSP is not available, the *username* and *password* options can be used for the initial authentication but these are not persisted.
* WebDAV paths must have the WebDAV client feature installed for this module to map those paths. This is installed by default on desktop Windows editions but Windows Server hosts need to install the `WebDAV-Redirector` feature using [ansible.windows.win\_feature](../../ansible/windows/win_feature_module#ansible-collections-ansible-windows-win-feature-module).
See Also
--------
See also
[community.windows.win\_credential](win_credential_module#ansible-collections-community-windows-win-credential-module)
The official documentation on the **community.windows.win\_credential** module.
Examples
--------
```
- name: Create a mapped drive under Z
community.windows.win_mapped_drive:
letter: Z
path: \\domain\appdata\accounting
- name: Delete any mapped drives under Z
community.windows.win_mapped_drive:
letter: Z
state: absent
- name: Only delete the mapped drive Z if the paths match (error is thrown otherwise)
community.windows.win_mapped_drive:
letter: Z
path: \\domain\appdata\accounting
state: absent
- name: Create mapped drive with credentials and save the username and password
block:
- name: Save the network credentials required for the mapped drive
community.windows.win_credential:
name: server
type: domain_password
username: username@DOMAIN
secret: Password01
state: present
- name: Create a mapped drive that requires authentication
community.windows.win_mapped_drive:
letter: M
path: \\SERVER\C$
state: present
vars:
# become is required to save and retrieve the credentials in the tasks
ansible_become: yes
ansible_become_method: runas
ansible_become_user: '{{ ansible_user }}'
ansible_become_pass: '{{ ansible_password }}'
- name: Create mapped drive with credentials that do not persist on the next logon
community.windows.win_mapped_drive:
letter: M
path: \\SERVER\C$
state: present
username: '{{ ansible_user }}'
password: '{{ ansible_password }}'
# This should only be required for Windows Server OS'
- name: Ensure WebDAV client feature is installed
ansible.windows.win_feature:
name: WebDAV-Redirector
state: present
register: webdav_feature
- name: Reboot after installing WebDAV client feature
ansible.windows.win_reboot:
when: webdav_feature.reboot_required
- name: Map the HTTPS WebDAV location
community.windows.win_mapped_drive:
letter: W
path: \\live.sysinternals.com@SSL\tools # https://live.sysinternals.com/tools
state: present
```
### Authors
* Jordan Borean (@jborean93)
ansible community.windows.win_wakeonlan – Send a magic Wake-on-LAN (WoL) broadcast packet community.windows.win\_wakeonlan – Send a magic Wake-on-LAN (WoL) broadcast packet
==================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_wakeonlan`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* The `win_wakeonlan` module sends magic Wake-on-LAN (WoL) broadcast packets.
* For non-Windows targets, use the [community.general.wakeonlan](../general/wakeonlan_module#ansible-collections-community-general-wakeonlan-module) module instead.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **broadcast** string | **Default:**"255.255.255.255" | Network broadcast address to use for broadcasting magic Wake-on-LAN packet. |
| **mac** string / required | | MAC address to send Wake-on-LAN broadcast packet for. |
| **port** integer | **Default:**7 | UDP port to use for magic Wake-on-LAN packet. |
Notes
-----
Note
* This module sends a magic packet, without knowing whether it worked. It always report a change.
* Only works if the target system was properly configured for Wake-on-LAN (in the BIOS and/or the OS).
* Some BIOSes have a different (configurable) Wake-on-LAN boot order (i.e. PXE first).
See Also
--------
See also
[community.general.wakeonlan](../general/wakeonlan_module#ansible-collections-community-general-wakeonlan-module)
The official documentation on the **community.general.wakeonlan** module.
Examples
--------
```
- name: Send a magic Wake-on-LAN packet to 00:00:5E:00:53:66
community.windows.win_wakeonlan:
mac: 00:00:5E:00:53:66
broadcast: 192.0.2.23
- name: Send a magic Wake-On-LAN packet on port 9 to 00-00-5E-00-53-66
community.windows.win_wakeonlan:
mac: 00-00-5E-00-53-66
port: 9
delegate_to: remote_system
```
### Authors
* Dag Wieers (@dagwieers)
ansible community.windows.win_dotnet_ngen – Runs ngen to recompile DLLs after .NET updates community.windows.win\_dotnet\_ngen – Runs ngen to recompile DLLs after .NET updates
====================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_dotnet_ngen`.
* [Synopsis](#synopsis)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* After .NET framework is installed/updated, Windows will probably want to recompile things to optimise for the host.
* This happens via scheduled task, usually at some inopportune time.
* This module allows you to run this task on your own schedule, so you incur the CPU hit at some more convenient and controlled time.
* <https://docs.microsoft.com/en-us/dotnet/framework/tools/ngen-exe-native-image-generator#native-image-service>
* <http://blogs.msdn.com/b/dotnet/archive/2013/08/06/wondering-why-mscorsvw-exe-has-high-cpu-usage-you-can-speed-it-up.aspx>
Notes
-----
Note
* There are in fact two scheduled tasks for ngen but they have no triggers so aren’t a problem.
* There’s no way to test if they’ve been completed.
* The stdout is quite likely to be several megabytes.
Examples
--------
```
- name: Run ngen tasks
community.windows.win_dotnet_ngen:
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **dotnet\_ngen64\_eqi\_exit\_code** integer | 64-bit ngen executable exists | The exit code after running the 64-bit ngen.exe executeQueuedItems command. |
| **dotnet\_ngen64\_eqi\_output** string | 64-bit ngen executable exists | The stdout after running the 64-bit ngen.exe executeQueuedItems command. **Sample:** sample output |
| **dotnet\_ngen64\_update\_exit\_code** integer | 64-bit ngen executable exists | The exit code after running the 64-bit ngen.exe update /force command. |
| **dotnet\_ngen64\_update\_output** string | 64-bit ngen executable exists | The stdout after running the 64-bit ngen.exe update /force command. **Sample:** sample output |
| **dotnet\_ngen\_eqi\_exit\_code** integer | 32-bit ngen executable exists | The exit code after running the 32-bit ngen.exe executeQueuedItems command. |
| **dotnet\_ngen\_eqi\_output** string | 32-bit ngen executable exists | The stdout after running the 32-bit ngen.exe executeQueuedItems command. **Sample:** sample output |
| **dotnet\_ngen\_update\_exit\_code** integer | 32-bit ngen executable exists | The exit code after running the 32-bit ngen.exe update /force command. |
| **dotnet\_ngen\_update\_output** string | 32-bit ngen executable exists | The stdout after running the 32-bit ngen.exe update /force command. **Sample:** sample output |
### Authors
* Peter Mounce (@petemounce)
ansible community.windows.win_security_policy – Change local security policy settings community.windows.win\_security\_policy – Change local security policy settings
===============================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_security_policy`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Allows you to set the local security policies that are configured by SecEdit.exe.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **key** string / required | | The ini key of the section or policy name to modify. The module will return an error if this key is invalid. |
| **section** string / required | | The ini section the key exists in. If the section does not exist then the module will return an error. Example sections to use are 'Account Policies', 'Local Policies', 'Event Log', 'Restricted Groups', 'System Services', 'Registry' and 'File System' If wanting to edit the `Privilege Rights` section, use the [ansible.windows.win\_user\_right](../../ansible/windows/win_user_right_module) module instead. |
| **value** string / required | | The value for the ini key or policy name. If the key takes in a boolean value then 0 = False and 1 = True. |
Notes
-----
Note
* This module uses the SecEdit.exe tool to configure the values, more details of the areas and keys that can be configured can be found here <https://msdn.microsoft.com/en-us/library/bb742512.aspx>.
* If you are in a domain environment these policies may be set by a GPO policy, this module can temporarily change these values but the GPO will override it if the value differs.
* You can also run `SecEdit.exe /export /cfg C:\temp\output.ini` to view the current policies set on your system.
* When assigning user rights, use the [ansible.windows.win\_user\_right](../../ansible/windows/win_user_right_module#ansible-collections-ansible-windows-win-user-right-module) module instead.
See Also
--------
See also
[ansible.windows.win\_user\_right](../../ansible/windows/win_user_right_module#ansible-collections-ansible-windows-win-user-right-module)
The official documentation on the **ansible.windows.win\_user\_right** module.
Examples
--------
```
- name: Change the guest account name
community.windows.win_security_policy:
section: System Access
key: NewGuestName
value: Guest Account
- name: Set the maximum password age
community.windows.win_security_policy:
section: System Access
key: MaximumPasswordAge
value: 15
- name: Do not store passwords using reversible encryption
community.windows.win_security_policy:
section: System Access
key: ClearTextPassword
value: 0
- name: Enable system events
community.windows.win_security_policy:
section: Event Audit
key: AuditSystemEvents
value: 1
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **import\_log** string | secedit.exe /import run and change occurred | The log of the SecEdit.exe /configure job that configured the local policies. This is used for debugging purposes on failures. **Sample:** Completed 6 percent (0/15) \tProcess Privilege Rights area. |
| **key** string | success | The key in the section passed to the module to modify. **Sample:** NewGuestName |
| **rc** integer | failure with secedit calls | The return code after a failure when running SecEdit.exe. **Sample:** -1 |
| **section** string | success | The section passed to the module to modify. **Sample:** System Access |
| **stderr** string | failure with secedit calls | The output of the STDERR buffer after a failure when running SecEdit.exe. **Sample:** failed to import security policy |
| **stdout** string | failure with secedit calls | The output of the STDOUT buffer after a failure when running SecEdit.exe. **Sample:** check log for error details |
| **value** string | success | The value passed to the module to modify to. **Sample:** Guest Account |
### Authors
* Jordan Borean (@jborean93)
| programming_docs |
ansible community.windows.win_defrag – Consolidate fragmented files on local volumes community.windows.win\_defrag – Consolidate fragmented files on local volumes
=============================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_defrag`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Locates and consolidates fragmented files on local volumes to improve system performance.
* More information regarding `win_defrag` is available from: <https://technet.microsoft.com/en-us/library/cc731650(v=ws.11.aspx>)
Requirements
------------
The below requirements are needed on the host that executes this module.
* defrag.exe
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **exclude\_volumes** list / elements=string | | A list of drive letters or mount point paths to exclude from defragmentation. |
| **freespace\_consolidation** boolean | **Choices:*** **no** ←
* yes
| Perform free space consolidation on the specified volumes. |
| **include\_volumes** list / elements=string | | A list of drive letters or mount point paths of the volumes to be defragmented. If this parameter is omitted, all volumes (not excluded) will be fragmented. |
| **parallel** boolean | **Choices:*** **no** ←
* yes
| Run the operation on each volume in parallel in the background. |
| **priority** string | **Choices:*** **low** ←
* normal
| Run the operation at low or normal priority. |
Examples
--------
```
- name: Defragment all local volumes (in parallel)
community.windows.win_defrag:
parallel: yes
- name: 'Defragment all local volumes, except C: and D:'
community.windows.win_defrag:
exclude_volumes: [ C, D ]
- name: 'Defragment volume D: with normal priority'
community.windows.win_defrag:
include_volumes: D
priority: normal
- name: Consolidate free space (useful when reducing volumes)
community.windows.win_defrag:
freespace_consolidation: yes
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **changed** boolean | always | Whether or not any changes were made. **Sample:** True |
| **cmd** string | always | The complete command line used by the module. **Sample:** defrag.exe /C /V |
| **msg** string | failed | Possible error message on failure. **Sample:** Command 'defrag.exe' not found in $env:PATH. |
| **rc** integer | always | The return code for the command. |
| **stderr** string | always | The error output from the command. |
| **stdout** string | always | The standard output from the command. **Sample:** Success. |
### Authors
* Dag Wieers (@dagwieers)
ansible community.windows.win_scheduled_task_stat – Get information about Windows Scheduled Tasks community.windows.win\_scheduled\_task\_stat – Get information about Windows Scheduled Tasks
============================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_scheduled_task_stat`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Will return whether the folder and task exists.
* Returns the names of tasks in the folder specified.
* Use [community.windows.win\_scheduled\_task](win_scheduled_task_module#ansible-collections-community-windows-win-scheduled-task-module) to configure a scheduled task.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **name** string | | The name of the scheduled task to get information for. If `name` is set and exists, will return information on the task itself. |
| **path** string | **Default:**"\\" | The folder path where the task lives. |
See Also
--------
See also
[community.windows.win\_scheduled\_task](win_scheduled_task_module#ansible-collections-community-windows-win-scheduled-task-module)
The official documentation on the **community.windows.win\_scheduled\_task** module.
Examples
--------
```
- name: Get information about a folder
community.windows.win_scheduled_task_stat:
path: \folder name
register: task_folder_stat
- name: Get information about a task in the root folder
community.windows.win_scheduled_task_stat:
name: task name
register: task_stat
- name: Get information about a task in a custom folder
community.windows.win_scheduled_task_stat:
path: \folder name
name: task name
register: task_stat
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **actions** list / elements=string | name is specified and task exists | A list of actions. **Sample:** [{'Arguments': '/c echo hi', 'Id': None, 'Path': 'cmd.exe', 'Type': 'TASK\_ACTION\_EXEC', 'WorkingDirectory': None}] |
| **folder\_exists** boolean | always | Whether the folder set at path exists. **Sample:** True |
| **folder\_task\_count** integer | always | The number of tasks that exist in the folder. **Sample:** 2 |
| **folder\_task\_names** list / elements=string | always | A list of tasks that exist in the folder. **Sample:** ['Task 1', 'Task 2'] |
| **principal** complex | name is specified and task exists | Details on the principal configured to run the task. |
| | **display\_name** string | | The name of the user/group that is displayed in the Task Scheduler UI. **Sample:** Administrator |
| | **group\_id** string | | The group that will run the task. **Sample:** BUILTIN\Administrators |
| | **id** string | | The ID for the principal. **Sample:** Author |
| | **logon\_type** string | | The logon method that the task will run with. **Sample:** TASK\_LOGON\_INTERACTIVE\_TOKEN |
| | **run\_level** string | | The level of user rights used to run the task. **Sample:** TASK\_RUNLEVEL\_LUA |
| | **user\_id** string | | The user that will run the task. **Sample:** SERVER\Administrator |
| **registration\_info** complex | name is specified and task exists | Details on the task registration info. |
| | **author** string | | The author os the task. **Sample:** SERVER\Administrator |
| | **date** string | | The date when the task was register. **Sample:** 2017-01-01T10:00:00 |
| | **description** string | | The description of the task. **Sample:** task description |
| | **documentation** string | | The documentation of the task. **Sample:** task documentation |
| | **security\_descriptor** string | | The security descriptor of the task. **Sample:** security descriptor |
| | **source** string | | The source of the task. **Sample:** source |
| | **uri** string | | The URI/path of the task. **Sample:** \task\task name |
| | **version** string | | The version of the task. **Sample:** 1.0 |
| **settings** complex | name is specified and task exists | Details on the task settings. |
| | **allow\_demand\_start** boolean | | Whether the task can be started by using either the Run command of the Context menu. **Sample:** True |
| | **allow\_hard\_terminate** boolean | | Whether the task can terminated by using TerminateProcess. **Sample:** True |
| | **compatibility** integer | | The compatibility level of the task **Sample:** 2 |
| | **delete\_expired\_task\_after** string | | The amount of time the Task Scheduler will wait before deleting the task after it expires. **Sample:** PT10M |
| | **disallow\_start\_if\_on\_batteries** boolean | | Whether the task will not be started if the computer is running on battery power. |
| | **disallow\_start\_on\_remote\_app\_session** boolean | | Whether the task will not be started when in a remote app session. **Sample:** True |
| | **enabled** boolean | | Whether the task is enabled. **Sample:** True |
| | **execution\_time\_limit** string | | The amount of time allowed to complete the task. **Sample:** PT72H |
| | **hidden** boolean | | Whether the task is hidden in the UI. |
| | **idle\_settings** dictionary | | The idle settings of the task. **Sample:** {'idle\_duration': 'PT10M', 'restart\_on\_idle': False, 'stop\_on\_idle\_end': True, 'wait\_timeout': 'PT1H'} |
| | **maintenance\_settings** string | | The maintenance settings of the task. |
| | **mulitple\_instances** integer | | Indicates the behaviour when starting a task that is already running. **Sample:** 2 |
| | **network\_settings** dictionary | | The network settings of the task. **Sample:** {'id': None, 'name': None} |
| | **priority** integer | | The priority level of the task. **Sample:** 7 |
| | **restart\_count** integer | | The number of times that the task will attempt to restart on failures. |
| | **restart\_interval** string | | How long the Task Scheduler will attempt to restart the task. **Sample:** PT15M |
| | **run\_only\_id\_idle** boolean | | Whether the task will run if the computer is in an idle state. **Sample:** True |
| | **run\_only\_if\_network\_available** boolean | | Whether the task will run only when a network is available. |
| | **start\_when\_available** boolean | | Whether the task can start at any time after its scheduled time has passed. |
| | **stop\_if\_going\_on\_batteries** boolean | | Whether the task will be stopped if the computer begins to run on battery power. **Sample:** True |
| | **use\_unified\_scheduling\_engine** boolean | | Whether the task will use the unified scheduling engine. |
| | **volatile** boolean | | Whether the task is volatile. |
| | **wake\_to\_run** boolean | | Whether the task will wake the computer when it is time to run the task. |
| **state** complex | name is specified and task exists | Details on the state of the task |
| | **last\_run\_time** string | | The time the registered task was last run. **Sample:** 2017-09-20T20:50:00 |
| | **last\_task\_result** integer | | The results that were returned the last time the task was run. **Sample:** 267009 |
| | **next\_run\_time** string | | The time when the task is next scheduled to run. **Sample:** 2017-09-20T22:50:00 |
| | **number\_of\_missed\_runs** integer | | The number of times a task has missed a scheduled run. **Sample:** 1 |
| | **status** string | | The status of the task, whether it is running, stopped, etc. **Sample:** TASK\_STATE\_RUNNING |
| **task\_exists** boolean | name is specified | Whether the task at the folder exists. **Sample:** True |
| **triggers** list / elements=string | name is specified and task exists | A list of triggers. **Sample:** [{'delay': 'PT15M', 'enabled': True, 'end\_boundary': None, 'execution\_time\_limit': None, 'id': None, 'repetition': {'duration': None, 'interval': None, 'stop\_at\_duration\_end': False}, 'start\_boundary': None, 'type': 'TASK\_TRIGGER\_BOOT'}, {'days\_of\_month': '5,15,30', 'enabled': True, 'end\_boundary': None, 'execution\_time\_limit': None, 'id': None, 'months\_of\_year': 'june,december', 'random\_delay': None, 'repetition': {'duration': None, 'interval': None, 'stop\_at\_duration\_end': False}, 'run\_on\_last\_day\_of\_month': True, 'start\_boundary': '2017-09-20T03:44:38', 'type': 'TASK\_TRIGGER\_MONTHLY'}] |
### Authors
* Jordan Borean (@jborean93)
ansible community.windows.laps_password – Retrieves the LAPS password for a server. community.windows.laps\_password – Retrieves the LAPS password for a server.
============================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.laps_password`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This lookup returns the LAPS password set for a server from the Active Directory database.
* See <https://github.com/jborean93/ansible-lookup-laps_password> for more information around installing pre-requisites and testing.
Requirements
------------
The below requirements are needed on the local controller node that executes this lookup.
* python-ldap
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **\_terms** string / required | | | The host name to retrieve the LAPS password for. This is the `Common Name (CN`) of the host. |
| **allow\_plaintext** boolean | **Choices:*** **no** ←
* yes
| | When set to `yes`, will allow traffic to be sent unencrypted. It is highly recommended to not touch this to avoid any credentials being exposed over the network. Use `scheme=ldaps`, `auth=gssapi`, or `start_tls=yes` to ensure the traffic is encrypted. |
| **auth** string | **Choices:*** simple
* **gssapi** ←
| | The type of authentication to use when connecting to the Active Directory server When using `simple`, the *username* and *password* options must be set. If not using `scheme=ldaps` or `start_tls=True` then these credentials are exposed in plaintext in the network traffic. It is recommended ot use `gssapi` as it will encrypt the traffic automatically. When using `gssapi`, run `kinit` before running Ansible to get a valid Kerberos ticket. You cannot use `gssapi` when either `scheme=ldaps` or `start_tls=True` is set. |
| **ca\_cert** string | | | The path to a CA certificate PEM file to use for certificate validation. Certificate validation is used when `scheme=ldaps` or `start_tls=yes`. This may fail on hosts with an older OpenLDAP install like MacOS, this will have to be updated before reinstalling python-ldap to get working again.
aliases: cacert\_file |
| **domain** string / required | | | The domain to search in to retrieve the LAPS password. This could either be a Windows domain name visible to the Ansible controller from DNS or a specific domain controller FQDN. Supports either just the domain/host name or an explicit LDAP URI with the domain/host already filled in. If the URI is set, *port* and *scheme* are ignored. |
| **password** string | | | The password for `username`. Required when `username` is set. |
| **port** integer | | | The LDAP port to communicate over. If *kdc* is already an LDAP URI then this is ignored. |
| **scheme** string | **Choices:*** **ldap** ←
* ldaps
| | The LDAP scheme to use. When using `ldap`, it is recommended to set `auth=gssapi`, or `start_tls=yes`, otherwise traffic will be in plaintext. The Active Directory host must be configured for `ldaps` with a certificate before it can be used. If *kdc* is already an LDAP URI then this is ignored. |
| **search\_base** string | | | Changes the search base used when searching for the host in Active Directory. Will default to search in the `defaultNamingContext` of the Active Directory server. If multiple matches are found then a more explicit search\_base is required so only 1 host is found. If searching a larger Active Directory database, it is recommended to narrow the search\_base for performance reasons. |
| **start\_tls** boolean | **Choices:*** **no** ←
* yes
| | When `scheme=ldap`, will use the StartTLS extension to encrypt traffic sent over the wire. This requires the Active Directory to be set up with a certificate that supports StartTLS. This is ignored when `scheme=ldaps` as the traffic is already encrypted. |
| **username** string | | | Required when using `auth=simple`. The username to authenticate with. Recommended to use the username in the UPN format, e.g. `[email protected]`. This is required when `auth=simple` and is not supported when `auth=gssapi`. Call `kinit` outside of Ansible if `auth=gssapi` is required. |
| **validate\_certs** string | **Choices:*** never
* allow
* try
* **demand** ←
| | When using `scheme=ldaps` or `start_tls=yes`, this controls the certificate validation behaviour.
`demand` will fail if no certificate or an invalid certificate is provided.
`try` will fail for invalid certificates but will continue if no certificate is provided.
`allow` will request and check a certificate but will continue even if it is invalid.
`never` will not request a certificate from the server so no validation occurs. |
Notes
-----
Note
* If a host was found but had no LAPS password attribute `ms-Mcs-AdmPwd`, the lookup will fail.
* Due to the sensitive nature of the data travelling across the network, it is highly recommended to run with either `auth=gssapi`, `scheme=ldaps`, or `start_tls=yes`.
* Failing to run with one of the above settings will result in the account credentials as well as the LAPS password to be sent in plaintext.
* Some scenarios may not work when running on a host with an older OpenLDAP install like MacOS. It is recommended to install the latest OpenLDAP version and build python-ldap against this, see <https://keathmilligan.net/python-ldap-and-macos> for more information.
Examples
--------
```
# This isn't mandatory but it is a way to call kinit from within Ansible before calling the lookup
- name: call kinit to retrieve Kerberos token
expect:
command: kinit [email protected]
responses:
(?i)password: SecretPass1
no_log: True
- name: Get the LAPS password using Kerberos auth, relies on kinit already being called
set_fact:
ansible_password: "{{ lookup('community.windows.laps_password', 'SERVER', domain='dc01.ansible.com') }}"
- name: Specific the domain host using an explicit LDAP URI
set_fact:
ansible_password: "{{ lookup('community.windows.laps_password', 'SERVER', domain='ldap://ansible.com:389') }}"
- name: Use Simple auth over LDAPS
set_fact:
ansible_password: "{{ lookup('community.windows.laps_password', 'server',
domain='dc01.ansible.com',
auth='simple',
scheme='ldaps',
username='[email protected]',
password='SuperSecret123') }}"
- name: Use Simple auth with LDAP and StartTLS
set_fact:
ansible_password: "{{ lookup('community.windows.laps_password', 'app01',
domain='dc01.ansible.com',
auth='simple',
start_tls=True,
username='[email protected]',
password='SuperSecret123') }}"
- name: Narrow down the search base to a an OU
set_fact:
ansible_password: "{{ lookup('community.windows.laps_password', 'sql10',
domain='dc01.ansible.com',
search_base='OU=Databases,DC=ansible,DC=com') }}"
- name: Set certificate file to use when validating the TLS certificate
set_fact:
ansible_password: "{{ lookup('community.windows.laps_password', 'windows-pc',
domain='dc01.ansible.com',
start_tls=True,
ca_cert='/usr/local/share/certs/ad.pem') }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_raw** string | success | The LAPS password(s) for the host(s) requested. |
### Authors
* Jordan Borean (@jborean93)
| programming_docs |
ansible community.windows.win_file_version – Get DLL or EXE file build version community.windows.win\_file\_version – Get DLL or EXE file build version
========================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_file_version`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Get DLL or EXE file build version.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **path** path / required | | File to get version. Always provide absolute path. |
Notes
-----
Note
* This module will always return no change.
See Also
--------
See also
[ansible.windows.win\_file](../../ansible/windows/win_file_module#ansible-collections-ansible-windows-win-file-module)
The official documentation on the **ansible.windows.win\_file** module.
Examples
--------
```
- name: Get acm instance version
community.windows.win_file_version:
path: C:\Windows\System32\cmd.exe
register: exe_file_version
- debug:
msg: '{{ exe_file_version }}'
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **file\_build\_part** string | no error | build number of the file. |
| **file\_major\_part** string | no error | the major part of the version number. |
| **file\_minor\_part** string | no error | the minor part of the version number of the file. |
| **file\_private\_part** string | no error | file private part number. |
| **file\_version** string | no error | File version number.. |
| **path** string | always | file path |
| **product\_version** string | no error | The version of the product this file is distributed with. |
### Authors
* Sam Liu (@SamLiu79)
ansible community.windows.psexec – Runs commands on a remote Windows host based on the PsExec model community.windows.psexec – Runs commands on a remote Windows host based on the PsExec model
===========================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.psexec`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Runs a remote command from a Linux host to a Windows host without WinRM being set up.
* Can be run on the Ansible controller to bootstrap Windows hosts to get them ready for WinRM.
Requirements
------------
The below requirements are needed on the host that executes this module.
* pypsexec
* smbprotocol[kerberos] for optional Kerberos authentication
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **arguments** string | | Any arguments as a single string to use when running the executable. |
| **asynchronous** boolean | **Choices:*** **no** ←
* yes
| Will run the command as a detached process and the module returns immediately after starting the process while the process continues to run in the background. The *stdout* and *stderr* return values will be null when this is set to `yes`. The *stdin* option does not work with this type of process. The *rc* return value is not set when this is `yes`
|
| **connection\_password** string | | The password for *connection\_user*. Required if the Kerberos requirements are not installed or the username is a local account to the Windows host. Can be omitted to use a Kerberos principal ticket for the principal set by *connection\_user* if the Kerberos library is installed and the ticket has already been retrieved with the `kinit` command before. |
| **connection\_timeout** integer | **Default:**60 | The timeout in seconds to wait when receiving the initial SMB negotiate response from the server. |
| **connection\_username** string | | The username to use when connecting to the remote Windows host. This user must be a member of the `Administrators` group of the Windows host. Required if the Kerberos requirements are not installed or the username is a local account to the Windows host. Can be omitted to use the default Kerberos principal ticket in the local credential cache if the Kerberos library is installed. If *process\_username* is not specified, then the remote process will run under a Network Logon under this account. |
| **encrypt** boolean | **Choices:*** no
* **yes** ←
| Will use SMB encryption to encrypt the SMB messages sent to and from the host. This requires the SMB 3 protocol which is only supported from Windows Server 2012 or Windows 8, older versions like Windows 7 or Windows Server 2008 (R2) must set this to `no` and use no encryption. When setting to `no`, the packets are in plaintext and can be seen by anyone sniffing the network, any process options are included in this. |
| **executable** string / required | | The executable to run on the Windows host. |
| **hostname** string / required | | The remote Windows host to connect to, can be either an IP address or a hostname. |
| **integrity\_level** string | **Choices:*** limited
* **default** ←
* elevated
| The integrity level of the process when *process\_username* is defined and is not equal to `System`. When `default`, the default integrity level based on the system setup. When `elevated`, the command will be run with Administrative rights. When `limited`, the command will be forced to run with non-Administrative rights. |
| **interactive** boolean | **Choices:*** **no** ←
* yes
| Will run the process as an interactive process that shows a process Window of the Windows session specified by *interactive\_session*. The *stdout* and *stderr* return values will be null when this is set to `yes`. The *stdin* option does not work with this type of process. |
| **interactive\_session** integer | **Default:**0 | The Windows session ID to use when displaying the interactive process on the remote Windows host. This is only valid when *interactive* is `yes`. The default is `0` which is the console session of the Windows host. |
| **load\_profile** boolean | **Choices:*** no
* **yes** ←
| Runs the remote command with the user's profile loaded. |
| **port** integer | **Default:**445 | The port that the remote SMB service is listening on. |
| **priority** string | **Choices:*** above\_normal
* below\_normal
* high
* idle
* **normal** ←
* realtime
| Set the command's priority on the Windows host. See <https://msdn.microsoft.com/en-us/library/windows/desktop/ms683211.aspx> for more details. |
| **process\_password** string | | The password for *process\_username*. Required if *process\_username* is defined and not `System`. |
| **process\_timeout** integer | **Default:**0 | The timeout in seconds that is placed upon the running process. A value of `0` means no timeout. |
| **process\_username** string | | The user to run the process as. This can be set to run the process under an Interactive logon of the specified account which bypasses limitations of a Network logon used when this isn't specified. If omitted then the process is run under the same account as *connection\_username* with a Network logon. Set to `System` to run as the builtin SYSTEM account, no password is required with this account. If *encrypt* is `no`, the username and password are sent as a simple XOR scrambled byte string that is not encrypted. No special tools are required to get the username and password just knowledge of the protocol. |
| **show\_ui\_on\_logon\_screen** boolean | **Choices:*** **no** ←
* yes
| Shows the process UI on the Winlogon secure desktop when *process\_username* is `System`. |
| **stdin** string | | Data to send on the stdin pipe once the process has started. This option has no effect when *interactive* or *asynchronous* is `yes`. |
| **working\_directory** string | **Default:**"C:\\Windows\\System32" | Changes the working directory set when starting the process. |
Notes
-----
Note
* This module requires the Windows host to have SMB configured and enabled, and port 445 opened on the firewall.
* This module will wait until the process is finished unless *asynchronous* is `yes`, ensure the process is run as a non-interactive command to avoid infinite hangs waiting for input.
* The *connection\_username* must be a member of the local Administrator group of the Windows host. For non-domain joined hosts, the `LocalAccountTokenFilterPolicy` should be set to `1` to ensure this works, see <https://support.microsoft.com/en-us/help/951016/description-of-user-account-control-and-remote-restrictions-in-windows>.
* For more information on this module and the various host requirements, see <https://github.com/jborean93/pypsexec>.
See Also
--------
See also
[ansible.builtin.raw](../../ansible/builtin/raw_module#ansible-collections-ansible-builtin-raw-module)
The official documentation on the **ansible.builtin.raw** module.
[ansible.windows.win\_command](../../ansible/windows/win_command_module#ansible-collections-ansible-windows-win-command-module)
The official documentation on the **ansible.windows.win\_command** module.
[community.windows.win\_psexec](win_psexec_module#ansible-collections-community-windows-win-psexec-module)
The official documentation on the **community.windows.win\_psexec** module.
[ansible.windows.win\_shell](../../ansible/windows/win_shell_module#ansible-collections-ansible-windows-win-shell-module)
The official documentation on the **ansible.windows.win\_shell** module.
Examples
--------
```
- name: Run a cmd.exe command
community.windows.psexec:
hostname: server
connection_username: username
connection_password: password
executable: cmd.exe
arguments: /c echo Hello World
- name: Run a PowerShell command
community.windows.psexec:
hostname: server.domain.local
connection_username: [email protected]
connection_password: password
executable: powershell.exe
arguments: Write-Host Hello World
- name: Send data through stdin
community.windows.psexec:
hostname: 192.168.1.2
connection_username: username
connection_password: password
executable: powershell.exe
arguments: '-'
stdin: |
Write-Host Hello World
Write-Error Error Message
exit 0
- name: Run the process as a different user
community.windows.psexec:
hostname: server
connection_user: username
connection_password: password
executable: whoami.exe
arguments: /all
process_username: anotheruser
process_password: anotherpassword
- name: Run the process asynchronously
community.windows.psexec:
hostname: server
connection_username: username
connection_password: password
executable: cmd.exe
arguments: /c rmdir C:\temp
asynchronous: yes
- name: Use Kerberos authentication for the connection (requires smbprotocol[kerberos])
community.windows.psexec:
hostname: host.domain.local
connection_username: [email protected]
executable: C:\some\path\to\executable.exe
arguments: /s
- name: Disable encryption to work with WIndows 7/Server 2008 (R2)
community.windows.psexec:
hostanme: windows-pc
connection_username: Administrator
connection_password: Password01
encrypt: no
integrity_level: elevated
process_username: Administrator
process_password: Password01
executable: powershell.exe
arguments: (New-Object -ComObject Microsoft.Update.Session).CreateUpdateInstaller().IsBusy
- name: Download and run ConfigureRemotingForAnsible.ps1 to setup WinRM
community.windows.psexec:
hostname: '{{ hostvars[inventory_hostname]["ansible_host"] | default(inventory_hostname) }}'
connection_username: '{{ ansible_user }}'
connection_password: '{{ ansible_password }}'
encrypt: yes
executable: powershell.exe
arguments: '-'
stdin: |
$ErrorActionPreference = "Stop"
$sec_protocols = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::SystemDefault
$sec_protocols = $sec_protocols -bor [Net.SecurityProtocolType]::Tls12
[Net.ServicePointManager]::SecurityProtocol = $sec_protocols
$url = "https://github.com/ansible/ansible/raw/devel/examples/scripts/ConfigureRemotingForAnsible.ps1"
Invoke-Expression ((New-Object Net.WebClient).DownloadString($url))
exit
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | module failed | Any exception details when trying to run the process **Sample:** Received exception from remote PAExec service: Failed to start "invalid.exe". The system cannot find the file specified. [Err=0x2, 2] |
| **pid** integer | success and asynchronous is 'yes' | The process ID of the asynchronous process that was created **Sample:** 719 |
| **rc** integer | success and asynchronous is 'no' | The return code of the remote process |
| **stderr** string | success and interactive or asynchronous is 'no' | The stderr from the remote process **Sample:** Error [10] running process |
| **stdout** string | success and interactive or asynchronous is 'no' | The stdout from the remote process **Sample:** Hello World |
### Authors
* Jordan Borean (@jborean93)
ansible community.windows.win_domain_user – Manages Windows Active Directory user accounts community.windows.win\_domain\_user – Manages Windows Active Directory user accounts
====================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_domain_user`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manages Windows Active Directory user accounts.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **account\_locked** string | **Choices:*** False
|
`no` will unlock the user account if locked. Note that there is not a way to lock an account as an administrator. Accounts are locked due to user actions; as an admin, you may only unlock a locked account. If you wish to administratively disable an account, set *enabled* to `no`. |
| **attributes** string | | A dict of custom LDAP attributes to set on the user. This can be used to set custom attributes that are not exposed as module parameters, e.g. `telephoneNumber`. See the examples on how to format this parameter. |
| **city** string | | Configures the user's city. |
| **company** string | | Configures the user's company name. |
| **country** string | | Configures the user's country code. Note that this is a two-character ISO 3166 code. |
| **description** string | | Description of the user |
| **domain\_password** string | | The password for *username*. |
| **domain\_server** string | | Specifies the Active Directory Domain Services instance to connect to. Can be in the form of an FQDN or NetBIOS name. If not specified then the value is based on the domain of the computer running PowerShell. |
| **domain\_username** string | | The username to use when interacting with AD. If this is not set then the user Ansible used to log in with will be used instead when using CredSSP or Kerberos with credential delegation. |
| **email** string | | Configures the user's email address. This is a record in AD and does not do anything to configure any email servers or systems. |
| **enabled** boolean | **Choices:*** no
* **yes** ←
|
`yes` will enable the user account.
`no` will disable the account. |
| **firstname** string | | Configures the user's first name (given name). |
| **groups** list / elements=string | | Adds or removes the user from this list of groups, depending on the value of *groups\_action*. To remove all but the Principal Group, set `groups=<principal group name>` and *groups\_action=replace*. Note that users cannot be removed from their principal group (for example, "Domain Users"). |
| **groups\_action** string | **Choices:*** add
* remove
* **replace** ←
| If `add`, the user is added to each group in *groups* where not already a member. If `remove`, the user is removed from each group in *groups*. If `replace`, the user is added as a member of each group in *groups* and removed from any other groups. |
| **identity** string | | Identity parameter used to find the User in the Active Directory. This value can be in the forms `Distinguished Name`, `objectGUID`, `objectSid` or `sAMAccountName`. Default to `name` if not set. |
| **name** string / required | | Name of the user to create, remove or modify. |
| **password** string | | Optionally set the user's password to this (plain text) value. To enable an account - *enabled* - a password must already be configured on the account, or you must provide a password here. |
| **password\_expired** boolean | **Choices:*** no
* yes
|
`yes` will require the user to change their password at next login.
`no` will clear the expired password flag. This is mutually exclusive with *password\_never\_expires*. |
| **password\_never\_expires** boolean | **Choices:*** no
* yes
|
`yes` will set the password to never expire.
`no` will allow the password to expire. This is mutually exclusive with *password\_expired*. |
| **path** string | | Container or OU for the new user; if you do not specify this, the user will be placed in the default container for users in the domain. Setting the path is only available when a new user is created; if you specify a path on an existing user, the user's path will not be updated - you must delete (e.g., `state=absent`) the user and then re-add the user with the appropriate path. |
| **postal\_code** string | | Configures the user's postal code / zip code. |
| **sam\_account\_name** string added in 1.7.0 of community.windows | | Configures the SAM Account Name (`sAMAccountName`) for the account. This is allowed to a maximum of 20 characters due to pre-Windows 2000 restrictions. Default to the `<username>` specified in `upn` or `name` if not set. |
| **state** string | **Choices:*** absent
* **present** ←
* query
| When `present`, creates or updates the user account. When `absent`, removes the user account if it exists. When `query`, retrieves the user account details without making any changes. |
| **state\_province** string | | Configures the user's state or province. |
| **street** string | | Configures the user's street address. |
| **surname** string | | Configures the user's last name (surname). |
| **update\_password** string | **Choices:*** **always** ←
* on\_create
* when\_changed
|
`always` will always update passwords.
`on_create` will only set the password for newly created users.
`when_changed` will only set the password when changed. |
| **upn** string | | Configures the User Principal Name (UPN) for the account. This is not required, but is best practice to configure for modern versions of Active Directory. The format is `<username>@<domain>`. |
| **user\_cannot\_change\_password** boolean | **Choices:*** no
* yes
|
`yes` will prevent the user from changing their password.
`no` will allow the user to change their password. |
Notes
-----
Note
* Works with Windows 2012R2 and newer.
* If running on a server that is not a Domain Controller, credential delegation through CredSSP or Kerberos with delegation must be used or the *domain\_username*, *domain\_password* must be set.
* Note that some individuals have confirmed successful operation on Windows 2008R2 servers with AD and AD Web Services enabled, but this has not received the same degree of testing as Windows 2012R2.
See Also
--------
See also
[ansible.windows.win\_domain](../../ansible/windows/win_domain_module#ansible-collections-ansible-windows-win-domain-module)
The official documentation on the **ansible.windows.win\_domain** module.
[ansible.windows.win\_domain\_controller](../../ansible/windows/win_domain_controller_module#ansible-collections-ansible-windows-win-domain-controller-module)
The official documentation on the **ansible.windows.win\_domain\_controller** module.
[community.windows.win\_domain\_computer](win_domain_computer_module#ansible-collections-community-windows-win-domain-computer-module)
The official documentation on the **community.windows.win\_domain\_computer** module.
[community.windows.win\_domain\_group](win_domain_group_module#ansible-collections-community-windows-win-domain-group-module)
The official documentation on the **community.windows.win\_domain\_group** module.
[ansible.windows.win\_domain\_membership](../../ansible/windows/win_domain_membership_module#ansible-collections-ansible-windows-win-domain-membership-module)
The official documentation on the **ansible.windows.win\_domain\_membership** module.
[ansible.windows.win\_user](../../ansible/windows/win_user_module#ansible-collections-ansible-windows-win-user-module)
The official documentation on the **ansible.windows.win\_user** module.
[community.windows.win\_user\_profile](win_user_profile_module#ansible-collections-community-windows-win-user-profile-module)
The official documentation on the **community.windows.win\_user\_profile** module.
Examples
--------
```
- name: Ensure user bob is present with address information
community.windows.win_domain_user:
name: bob
firstname: Bob
surname: Smith
company: BobCo
password: B0bP4ssw0rd
state: present
groups:
- Domain Admins
street: 123 4th St.
city: Sometown
state_province: IN
postal_code: 12345
country: US
attributes:
telephoneNumber: 555-123456
- name: Ensure user bob is created and use custom credentials to create the user
community.windows.win_domain_user:
name: bob
firstname: Bob
surname: Smith
password: B0bP4ssw0rd
state: present
domain_username: DOMAIN\admin-account
domain_password: SomePas2w0rd
domain_server: [email protected]
- name: Ensure user bob is present in OU ou=test,dc=domain,dc=local
community.windows.win_domain_user:
name: bob
password: B0bP4ssw0rd
state: present
path: ou=test,dc=domain,dc=local
groups:
- Domain Admins
- name: Ensure user bob is absent
community.windows.win_domain_user:
name: bob
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **account\_locked** boolean | always | true if the account is locked |
| **changed** boolean | always | true if the account changed during execution |
| **city** string | always | The user city **Sample:** Indianapolis |
| **company** string | always | The user company **Sample:** RedHat |
| **country** string | always | The user country **Sample:** US |
| **created** boolean | always | Whether a user was created **Sample:** True |
| **description** string | always | A description of the account **Sample:** Server Administrator |
| **distinguished\_name** string | always | DN of the user account **Sample:** CN=nick,OU=test,DC=domain,DC=local |
| **email** string | always | The user email address **Sample:** [email protected] |
| **enabled** string | always | true if the account is enabled and false if disabled **Sample:** True |
| **firstname** string | always | The user first name **Sample:** Nick |
| **groups** list / elements=string | always | AD Groups to which the account belongs **Sample:** ['Domain Admins', 'Domain Users'] |
| **msg** string | always | Summary message of whether the user is present or absent **Sample:** User nick is present |
| **name** string | always | The username on the account **Sample:** nick |
| **password\_expired** boolean | always | true if the account password has expired |
| **password\_updated** boolean | always | true if the password changed during this execution **Sample:** True |
| **postal\_code** string | always | The user postal code **Sample:** 46033 |
| **sam\_account\_name** string added in 1.7.0 of community.windows | always | The SAM Account Name of the account **Sample:** nick |
| **sid** string | always | The SID of the account **Sample:** S-1-5-21-2752426336-228313920-2202711348-1175 |
| **state** string | always | The state of the user account **Sample:** present |
| **state\_province** string | always | The user state or province **Sample:** IN |
| **street** string | always | The user street address **Sample:** 123 4th St. |
| **surname** string | always | The user last name **Sample:** Doe |
| **upn** string | always | The User Principal Name of the account **Sample:** [email protected] |
| **user\_cannot\_change\_password** string | always | true if the user is not allowed to change password |
### Authors
* Nick Chandler (@nwchandler)
| programming_docs |
ansible community.windows.win_auto_logon – Adds or Sets auto logon registry keys. community.windows.win\_auto\_logon – Adds or Sets auto logon registry keys.
===========================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_auto_logon`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* Used to apply auto logon registry setting.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **logon\_count** integer | | The number of times to do an automatic logon. This count is deremented by Windows everytime an automatic logon is performed. Once the count reaches `0` then the automatic logon process is disabled. |
| **password** string | | Password to be used for automatic login. Must be set when `state=present`. Value of this input will be used as password for *username*. While this value is encrypted by LSA it is decryptable to any user who is an Administrator on the remote host. |
| **state** string | **Choices:*** absent
* **present** ←
| Whether the registry key should be `present` or `absent`. |
| **username** string | | Username to login automatically. Must be set when `state=present`. This can be the Netlogon or UPN of a domain account and is automatically parsed to the `DefaultUserName` and `DefaultDomainName` registry properties. |
Examples
--------
```
- name: Set autologon for user1
community.windows.win_auto_logon:
username: User1
password: str0ngp@ssword
- name: Set autologon for abc.com\user1
community.windows.win_auto_logon:
username: abc.com\User1
password: str0ngp@ssword
- name: Remove autologon for user1
community.windows.win_auto_logon:
state: absent
- name: Set autologon for user1 with a limited logon count
community.windows.win_auto_logon:
username: User1
password: str0ngp@ssword
logon_count: 5
```
### Authors
* Prasoon Karunan V (@prasoonkarunan)
ansible community.windows.win_disk_facts – Show the attached disks and disk information of the target host community.windows.win\_disk\_facts – Show the attached disks and disk information of the target host
====================================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_disk_facts`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Notes](#notes)
* [Examples](#examples)
* [Returned Facts](#returned-facts)
Synopsis
--------
* With the module you can retrieve and output detailed information about the attached disks of the target and its volumes and partitions if existent.
Requirements
------------
The below requirements are needed on the host that executes this module.
* Windows 8.1 / Windows 2012 (NT 6.2)
Notes
-----
Note
* In order to understand all the returned properties and values please visit the following site and open the respective MSFT class <https://msdn.microsoft.com/en-us/library/windows/desktop/hh830612.aspx>
Examples
--------
```
- name: Get disk facts
community.windows.win_disk_facts:
- name: Output first disk size
debug:
var: ansible_facts.disks[0].size
- name: Convert first system disk into various formats
debug:
msg: '{{ disksize_gib }} vs {{ disksize_gib_human }}'
vars:
# Get first system disk
disk: '{{ ansible_facts.disks|selectattr("system_disk")|first }}'
# Show disk size in Gibibytes
disksize_gib_human: '{{ disk.size|filesizeformat(true) }}' # returns "223.6 GiB" (human readable)
disksize_gib: '{{ (disk.size/1024|pow(3))|round|int }} GiB' # returns "224 GiB" (value in GiB)
# Show disk size in Gigabytes
disksize_gb_human: '{{ disk.size|filesizeformat }}' # returns "240.1 GB" (human readable)
disksize_gb: '{{ (disk.size/1000|pow(3))|round|int }} GB' # returns "240 GB" (value in GB)
- name: Output second disk serial number
debug:
var: ansible_facts.disks[1].serial_number
```
Returned Facts
--------------
Facts returned by this module are added/updated in the `hostvars` host facts and can be referenced by name just like any other host fact. They do not need to be registered in order to use them.
| Fact | Returned | Description |
| --- | --- | --- |
| **ansible\_disks** list / elements=string | if disks were found | Detailed information about one particular disk. |
| | **bootable** boolean / elements=string | always | Information whether the particular disk is a bootable disk. |
| | **bus\_type** string / elements=string | always | Bus type of the particular disk. **Sample:** SCSI |
| | **clustered** boolean / elements=string | always | Information whether the particular disk is clustered (part of a failover cluster). |
| | **firmware\_version** string / elements=string | always | Firmware version of the particular disk. **Sample:** 0001 |
| | **friendly\_name** string / elements=string | always | Friendly name of the particular disk. **Sample:** Red Hat VirtIO SCSI Disk Device |
| | **guid** string / elements=string | if existent | GUID of the particular disk on the target. **Sample:** {efa5f928-57b9-47fc-ae3e-902e85fbe77f} |
| | **location** string / elements=string | always | Location of the particular disk on the target. **Sample:** PCIROOT(0)#PCI(0400)#SCSI(P00T00L00) |
| | **manufacturer** string / elements=string | always | Manufacturer of the particular disk. **Sample:** Red Hat |
| | **model** string / elements=string | always | Model specification of the particular disk. **Sample:** VirtIO |
| | **number** integer / elements=string | always | Disk number of the particular disk. |
| | **operational\_status** string / elements=string | always | Operational status of the particular disk. **Sample:** Online |
| | **partition\_count** integer / elements=string | always | Number of partitions on the particular disk. **Sample:** 4 |
| | **partition\_style** string / elements=string | always | Partition style of the particular disk. **Sample:** MBR |
| | **partitions** list / elements=string | if existent | Detailed information about one particular partition on the specified disk. |
| | | **access\_paths** string / elements=string | if existent | Access paths of the particular partition. **Sample:** \\?\Volume{85bdc4a8-f8eb-11e6-80fa-806e6f6e6963}\ |
| | | **active** boolean / elements=string | if partition\_style property of the particular disk has value "MBR" | Information whether the particular partition is an active partition or not. **Sample:** True |
| | | **drive\_letter** string / elements=string | if existent | Drive letter of the particular partition. **Sample:** C |
| | | **gpt\_type** string / elements=string | if partition\_style property of the particular disk has value "GPT" | gpt type of the particular partition. **Sample:** {e3c9e316-0b5c-4db8-817d-f92df00215ae} |
| | | **guid** string / elements=string | if existent | GUID of the particular partition. **Sample:** {302e475c-6e64-4674-a8e2-2f1c7018bf97} |
| | | **hidden** boolean / elements=string | always | Information whether the particular partition is hidden or not. **Sample:** True |
| | | **mbr\_type** integer / elements=string | if partition\_style property of the particular disk has value "MBR" | mbr type of the particular partition. **Sample:** 7 |
| | | **no\_default\_driveletter** boolean / elements=string | if partition\_style property of the particular disk has value "GPT" | Information whether the particular partition has a default drive letter or not. **Sample:** True |
| | | **number** integer / elements=string | always | Number of the particular partition. **Sample:** 1 |
| | | **offset** integer / elements=string | always | Offset of the particular partition. **Sample:** 368050176 |
| | | **shadow\_copy** boolean / elements=string | always | Information whether the particular partition is a shadow copy of another partition. |
| | | **size** integer / elements=string | always | Size in bytes of the particular partition. **Sample:** 838860800 |
| | | **transition\_state** integer / elements=string | always | Transition state of the particular partition. **Sample:** 1 |
| | | **type** string / elements=string | always | Type of the particular partition. **Sample:** IFS |
| | | **volumes** list / elements=string | if existent | Detailed information about one particular volume on the specified partition. |
| | | | **allocation\_unit\_size** integer / elements=string | always | Allocation unit size in bytes of the particular volume. **Sample:** 4096 |
| | | | **drive\_type** string / elements=string | always | Drive type of the particular volume. **Sample:** Fixed |
| | | | **health\_status** string / elements=string | always | Health status of the particular volume. **Sample:** Healthy |
| | | | **label** string / elements=string | always | File system label of the particular volume. **Sample:** System Reserved |
| | | | **object\_id** string / elements=string | always | Object ID of the particular volume. **Sample:** \\?\Volume{85bdc4a9-f8eb-11e6-80fa-806e6f6e6963}\ |
| | | | **path** string / elements=string | always | Path of the particular volume. **Sample:** \\?\Volume{85bdc4a9-f8eb-11e6-80fa-806e6f6e6963}\ |
| | | | **size** integer / elements=string | always | Size in bytes of the particular volume. **Sample:** 838856704 |
| | | | **size\_remaining** integer / elements=string | always | Remaining size in bytes of the particular volume. **Sample:** 395620352 |
| | | | **type** string / elements=string | always | File system type of the particular volume. **Sample:** NTFS |
| | **path** string / elements=string | always | Path of the particular disk on the target. **Sample:** \\?\scsi#disk&ven\_red\_hat&prod\_virtio#4&23208fd0&1&000000#{<id>} |
| | **physical\_disk** complex / elements=string | if existent | Detailed information about physical disk properties of the particular disk. |
| | | **allocated\_size** integer / elements=string | always | Allocated size in bytes of the particular physical disk. **Sample:** 240057409536 |
| | | **bus\_type** string / elements=string | always | Bus type of the particular physical disk. **Sample:** SCSI |
| | | **can\_pool** boolean / elements=string | always | Information whether the particular physical disk can be added to a storage pool. |
| | | **cannot\_pool\_reason** string / elements=string | if can\_pool property has value false | Information why the particular physical disk can not be added to a storage pool. **Sample:** Insufficient Capacity |
| | | **device\_id** string / elements=string | always | Device ID of the particular physical disk. **Sample:** 0 |
| | | **friendly\_name** string / elements=string | always | Friendly name of the particular physical disk. **Sample:** PhysicalDisk0 |
| | | **health\_status** string / elements=string | always | Health status of the particular physical disk. **Sample:** Healthy |
| | | **indication\_enabled** boolean / elements=string | always | Information whether indication is enabled for the particular physical disk. **Sample:** True |
| | | **manufacturer** string / elements=string | always | Manufacturer of the particular physical disk. **Sample:** SUSE |
| | | **media\_type** string / elements=string | always | Media type of the particular physical disk. **Sample:** UnSpecified |
| | | **model** string / elements=string | always | Model of the particular physical disk. **Sample:** Xen Block |
| | | **object\_id** string / elements=string | always | Object ID of the particular physical disk. **Sample:** {1}\\\\HOST\\root/Microsoft/Windows/Storage/Providers\_v2\\SPACES\_PhysicalDisk.ObjectId=\"{<object\_id>}:PD:{<pd>}\" |
| | | **operational\_status** string / elements=string | always | Operational status of the particular physical disk. **Sample:** OK |
| | | **partial** boolean / elements=string | always | Information whether the particular physical disk is partial. |
| | | **physical\_location** string / elements=string | always | Physical location of the particular physical disk. **Sample:** Integrated : Adapter 3 : Port 0 : Target 0 : LUN 0 |
| | | **serial\_number** string / elements=string | always | Serial number of the particular physical disk. **Sample:** b62beac80c3645e5877f |
| | | **size** integer / elements=string | always | Size in bytes of the particular physical disk. **Sample:** 240057409536 |
| | | **spindle\_speed** integer / elements=string | always | Spindle speed in rpm of the particular physical disk. **Sample:** 4294967295 |
| | | **supported\_usages** complex / elements=string | always | Supported usage types of the particular physical disk. |
| | | | **Count** integer / elements=string | always | Count of supported usage types. **Sample:** 5 |
| | | | **value** string / elements=string | always | List of supported usage types. **Sample:** Auto-Select, Hot Spare |
| | | **unique\_id** string / elements=string | always | Unique ID of the particular physical disk. **Sample:** 3141463431303031 |
| | | **usage\_type** string / elements=string | always | Usage type of the particular physical disk. **Sample:** Auto-Select |
| | **read\_only** boolean / elements=string | always | Read only status of the particular disk. **Sample:** True |
| | **sector\_size** integer / elements=string | always | Sector size in bytes of the particular disk. **Sample:** 4096 |
| | **serial\_number** string / elements=string | always | Serial number of the particular disk on the target. **Sample:** b62beac80c3645e5877f |
| | **size** integer / elements=string | always | Size in bytes of the particular disk. **Sample:** 227727638528 |
| | **system\_disk** boolean / elements=string | always | Information whether the particular disk is a system disk. **Sample:** True |
| | **unique\_id** string / elements=string | always | Unique ID of the particular disk on the target. **Sample:** 3141463431303031 |
| | **virtual\_disk** complex / elements=string | if existent | Detailed information about virtual disk properties of the particular disk. |
| | | **access** string / elements=string | always | Access of the particular virtual disk. **Sample:** Read/Write |
| | | **allocated\_size** integer / elements=string | always | Allocated size in bytes of the particular virtual disk. **Sample:** 240057409536 |
| | | **allocation\_unit\_size** integer / elements=string | always | Allocation unit size in bytes of the particular virtual disk. **Sample:** 4096 |
| | | **available\_copies** integer / elements=string | if existent | Number of the available copies of the particular virtual disk. **Sample:** 1 |
| | | **columns** integer / elements=string | always | Number of the columns of the particular virtual disk. **Sample:** 2 |
| | | **deduplication\_enabled** boolean / elements=string | always | Information whether deduplication is enabled for the particular virtual disk. **Sample:** True |
| | | **detached\_reason** string / elements=string | always | Detached reason of the particular virtual disk. **Sample:** None |
| | | **enclosure\_aware** boolean / elements=string | always | Information whether the particular virtual disk is enclosure aware. |
| | | **fault\_domain\_awareness** string / elements=string | always | Fault domain awareness of the particular virtual disk. **Sample:** PhysicalDisk |
| | | **footprint\_on\_pool** integer / elements=string | always | Footprint on pool in bytes of the particular virtual disk. **Sample:** 240057409536 |
| | | **friendly\_name** string / elements=string | always | Friendly name of the particular virtual disk. **Sample:** Prod2 Virtual Disk |
| | | **groups** integer / elements=string | always | Number of the groups of the particular virtual disk. **Sample:** 1 |
| | | **health\_status** string / elements=string | always | Health status of the particular virtual disk. **Sample:** Healthy |
| | | **inter\_leave** integer / elements=string | always | Inter leave in bytes of the particular virtual disk. **Sample:** 102400 |
| | | **logical\_sector\_size** integer / elements=string | always | Logical sector size in byte of the particular virtual disk. **Sample:** 512 |
| | | **manual\_attach** boolean / elements=string | always | Information whether the particular virtual disk is manual attached. **Sample:** True |
| | | **media\_type** string / elements=string | always | Media type of the particular virtual disk. **Sample:** Unspecified |
| | | **name** string / elements=string | always | Name of the particular virtual disk. **Sample:** vDisk1 |
| | | **object\_id** string / elements=string | always | Object ID of the particular virtual disk. **Sample:** {1}\\\\HOST\\root/Microsoft/Windows/Storage/Providers\_v2\\SPACES\_VirtualDisk.ObjectId=\"{<object\_id>}:VD:{<vd>}\" |
| | | **operational\_status** string / elements=string | always | Operational status of the particular virtual disk. **Sample:** OK |
| | | **parity\_layout** integer / elements=string | if existent | Parity layout of the particular virtual disk. **Sample:** 1 |
| | | **physical\_disk\_redundancy** integer / elements=string | always | Type of the physical disk redundancy of the particular virtual disk. **Sample:** 1 |
| | | **physical\_sector\_size** integer / elements=string | always | Physical sector size in bytes of the particular virtual disk. **Sample:** 4096 |
| | | **provisioning\_type** string / elements=string | always | Provisioning type of the particular virtual disk. **Sample:** Thin |
| | | **read\_cache\_size** integer / elements=string | always | Read cache size in byte of the particular virtual disk. |
| | | **request\_no\_spof** boolean / elements=string | always | Information whether the particular virtual disk requests no single point of failure. **Sample:** True |
| | | **resiliency\_setting\_name** integer / elements=string | always | Type of the physical disk redundancy of the particular virtual disk. **Sample:** 1 |
| | | **size** integer / elements=string | always | Size in bytes of the particular virtual disk. **Sample:** 240057409536 |
| | | **snapshot** boolean / elements=string | always | Information whether the particular virtual disk is a snapshot. |
| | | **tiered** boolean / elements=string | always | Information whether the particular virtual disk is tiered. **Sample:** True |
| | | **unique\_id** string / elements=string | always | Unique ID of the particular virtual disk. **Sample:** 260542E4C6B01D47A8FA7630FD90FFDE |
| | | **unique\_id\_format** string / elements=string | always | Unique ID format of the particular virtual disk. **Sample:** Vendor Specific |
| | | **write\_cache\_size** integer / elements=string | always | Write cache size in byte of the particular virtual disk. **Sample:** 100 |
| | **win32\_disk\_drive** complex / elements=string | if existent | Representation of the Win32\_DiskDrive class. |
| | | **availability** integer / elements=string | always | Availability and status of the device. |
| | | **bytes\_per\_sector** integer / elements=string | always | Number of bytes in each sector for the physical disk drive. **Sample:** 512 |
| | | **capabilities** list / elements=string | always | Array of capabilities of the media access device. For example, the device may support random access (3), removable media (7), and automatic cleaning (9). **Sample:** [3, 4] |
| | | **capability\_descriptions** list / elements=string | always | List of more detailed explanations for any of the access device features indicated in the Capabilities array. Note, each entry of this array is related to the entry in the Capabilities array that is located at the same index. **Sample:** ['Random Access', 'Supports Writing'] |
| | | **caption** string / elements=string | always | Short description of the object. **Sample:** VMware Virtual disk SCSI Disk Device |
| | | **compression\_method** string / elements=string | always | Algorithm or tool used by the device to support compression. **Sample:** Compressed |
| | | **config\_manager\_error\_code** integer / elements=string | always | Windows Configuration Manager error code. |
| | | **config\_manager\_user\_config** boolean / elements=string | always | If True, the device is using a user-defined configuration. **Sample:** True |
| | | **creation\_class\_name** string / elements=string | always | Name of the first concrete class to appear in the inheritance chain used in the creation of an instance. When used with the other key properties of the class, the property allows all instances of this class and its subclasses to be uniquely identified. **Sample:** Win32\_DiskDrive |
| | | **default\_block\_size** integer / elements=string | always | Default block size, in bytes, for this device. **Sample:** 512 |
| | | **description** string / elements=string | always | Description of the object. **Sample:** Disk drive |
| | | **device\_id** string / elements=string | always | Unique identifier of the disk drive with other devices on the system. **Sample:** \\.\PHYSICALDRIVE0 |
| | | **error\_cleared** boolean / elements=string | always | If True, the error reported in LastErrorCode is now cleared. **Sample:** True |
| | | **error\_description** string / elements=string | always | More information about the error recorded in LastErrorCode, and information on any corrective actions that may be taken. |
| | | **error\_methodology** string / elements=string | always | Type of error detection and correction supported by this device. |
| | | **firmware\_revision** string / elements=string | always | Revision for the disk drive firmware that is assigned by the manufacturer. **Sample:** 1.0 |
| | | **index** integer / elements=string | always | Physical drive number of the given drive. This property is filled by the STORAGE\_DEVICE\_NUMBER structure returned from the IOCTL\_STORAGE\_GET\_DEVICE\_NUMBER control code A value of 0xffffffff indicates that the given drive does not map to a physical drive. |
| | | **install\_date** string / elements=string | always | Date and time the object was installed. This property does not need a value to indicate that the object is installed. |
| | | **interface\_type** string / elements=string | always | Interface type of physical disk drive. **Sample:** SCSI |
| | | **last\_error\_code** integer / elements=string | always | Last error code reported by the logical device. |
| | | **manufacturer** string / elements=string | always | Name of the disk drive manufacturer. **Sample:** Seagate |
| | | **max\_block\_size** integer / elements=string | always | Maximum block size, in bytes, for media accessed by this device. |
| | | **max\_media\_size** integer / elements=string | always | Maximum media size, in kilobytes, of media supported by this device. |
| | | **media\_loaded** boolean / elements=string | always | If True, the media for a disk drive is loaded, which means that the device has a readable file system and is accessible. For fixed disk drives, this property will always be TRUE. **Sample:** True |
| | | **media\_type** string / elements=string | always | Type of media used or accessed by this device. **Sample:** Fixed hard disk media |
| | | **min\_block\_size** integer / elements=string | always | Minimum block size, in bytes, for media accessed by this device. |
| | | **model** string / elements=string | always | Manufacturer's model number of the disk drive. **Sample:** ST32171W |
| | | **name** string / elements=string | always | Label by which the object is known. When subclassed, the property can be overridden to be a key property. **Sample:** \\\\.\\PHYSICALDRIVE0 |
| | | **needs\_cleaning** boolean / elements=string | always | If True, the media access device needs cleaning. Whether manual or automatic cleaning is possible is indicated in the Capabilities property. |
| | | **number\_of\_media\_supported** integer / elements=string | always | Maximum number of media which can be supported or inserted (when the media access device supports multiple individual media). |
| | | **partitions** integer / elements=string | always | Number of partitions on this physical disk drive that are recognized by the operating system. **Sample:** 3 |
| | | **pnp\_device\_id** string / elements=string | always | Windows Plug and Play device identifier of the logical device. **Sample:** SCSI\DISK&VEN\_VMWARE&PROD\_VIRTUAL\_DISK\5&1982005&0&000000 |
| | | **power\_management\_capabilities** list / elements=string | always | Array of the specific power-related capabilities of a logical device. |
| | | **power\_management\_supported** boolean / elements=string | always | If True, the device can be power-managed (can be put into suspend mode, and so on). The property does not indicate that power management features are currently enabled, only that the logical device is capable of power management. |
| | | **scsi\_bus** integer / elements=string | always | SCSI bus number of the disk drive. |
| | | **scsi\_logical\_unit** integer / elements=string | always | SCSI logical unit number (LUN) of the disk drive. |
| | | **scsi\_port** integer / elements=string | always | SCSI port number of the disk drive. |
| | | **scsi\_target\_id** integer / elements=string | always | SCSI identifier number of the disk drive. |
| | | **sectors\_per\_track** integer / elements=string | always | Number of sectors in each track for this physical disk drive. **Sample:** 63 |
| | | **serial\_number** string / elements=string | always | Number allocated by the manufacturer to identify the physical media. **Sample:** 6000c298f34101b38cb2b2508926b9de |
| | | **signature** integer / elements=string | always | Disk identification. This property can be used to identify a shared resource. |
| | | **size** integer / elements=string | always | Size of the disk drive. It is calculated by multiplying the total number of cylinders, tracks in each cylinder, sectors in each track, and bytes in each sector. **Sample:** 53686402560 |
| | | **status** string / elements=string | always | Current status of the object. Various operational and nonoperational statuses can be defined. Operational statuses include: "OK", "Degraded", and "Pred Fail" (an element, such as a SMART-enabled hard disk drive, may be functioning properly but predicting a failure in the near future). Nonoperational statuses include: "Error", "Starting", "Stopping", and "Service". "Service", could apply during mirror-resilvering of a disk, reload of a user permissions list, or other administrative work. Not all such work is online, yet the managed element is neither "OK" nor in one of the other states. **Sample:** OK |
| | | **status\_info** integer / elements=string | always | State of the logical device. If this property does not apply to the logical device, the value 5 (Not Applicable) should be used. |
| | | **system\_creation\_class\_name** string / elements=string | always | Value of the scoping computer's CreationClassName property. **Sample:** Win32\_ComputerSystem |
| | | **system\_name** string / elements=string | always | Name of the scoping system. **Sample:** WILMAR-TEST-123 |
| | | **total\_cylinders** integer / elements=string | always | Total number of cylinders on the physical disk drive. Note: the value for this property is obtained through extended functions of BIOS interrupt 13h. The value may be inaccurate if the drive uses a translation scheme to support high-capacity disk sizes. Consult the manufacturer for accurate drive specifications. **Sample:** 6527 |
| | | **total\_heads** integer / elements=string | always | Total number of heads on the disk drive. Note: the value for this property is obtained through extended functions of BIOS interrupt 13h. The value may be inaccurate if the drive uses a translation scheme to support high-capacity disk sizes. Consult the manufacturer for accurate drive specifications. **Sample:** 255 |
| | | **total\_sectors** integer / elements=string | always | Total number of sectors on the physical disk drive. Note: the value for this property is obtained through extended functions of BIOS interrupt 13h. The value may be inaccurate if the drive uses a translation scheme to support high-capacity disk sizes. Consult the manufacturer for accurate drive specifications. **Sample:** 104856255 |
| | | **total\_tracks** integer / elements=string | always | Total number of tracks on the physical disk drive. Note: the value for this property is obtained through extended functions of BIOS interrupt 13h. The value may be inaccurate if the drive uses a translation scheme to support high-capacity disk sizes. Consult the manufacturer for accurate drive specifications. **Sample:** 1664385 |
| | | **tracks\_per\_cylinder** integer / elements=string | always | Number of tracks in each cylinder on the physical disk drive. Note: the value for this property is obtained through extended functions of BIOS interrupt 13h. The value may be inaccurate if the drive uses a translation scheme to support high-capacity disk sizes. Consult the manufacturer for accurate drive specifications. **Sample:** 255 |
### Authors
* Marc Tschapek (@marqelme)
| programming_docs |
ansible community.windows.win_hosts – Manages hosts file entries on Windows. community.windows.win\_hosts – Manages hosts file entries on Windows.
=====================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_hosts`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Manages hosts file entries on Windows.
* Maps IPv4 or IPv6 addresses to canonical names.
* Adds, removes, or sets cname records for ip and hostname pairs.
* Modifies %windir%\system32\drivers\etc\hosts.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **action** string | **Choices:*** add
* remove
* **set** ←
| Controls the behavior of *aliases*. Only applicable when `state=present`. If `add`, each alias in *aliases* will be added to the host entry. If `set`, each alias in *aliases* will be added to the host entry, and other aliases will be removed from the entry. |
| **aliases** list / elements=string | | A list of additional names (cname records) for the host entry. Only applicable when `state=present`. |
| **canonical\_name** string | | A canonical name for the host entry. required for `state=present`. |
| **ip\_address** string | | The ip address for the host entry. Can be either IPv4 (A record) or IPv6 (AAAA record). Required for `state=present`. |
| **state** string | **Choices:*** absent
* **present** ←
| Whether the entry should be present or absent. If only *canonical\_name* is provided when `state=absent`, then all hosts entries with the canonical name of *canonical\_name* will be removed. If only *ip\_address* is provided when `state=absent`, then all hosts entries with the ip address of *ip\_address* will be removed. If *ip\_address* and *canonical\_name* are both omitted when `state=absent`, then all hosts entries will be removed. |
Notes
-----
Note
* Each canonical name can only be mapped to one IPv4 and one IPv6 address. If *canonical\_name* is provided with `state=present` and is found to be mapped to another IP address that is the same type as, but unique from *ip\_address*, then *canonical\_name* and all *aliases* will be removed from the entry and added to an entry with the provided IP address.
* Each alias can only be mapped to one canonical name. If *aliases* is provided with `state=present` and an alias is found to be mapped to another canonical name, then the alias will be removed from the entry and either added to or removed from (depending on *action*) an entry with the provided canonical name.
See Also
--------
See also
[ansible.windows.win\_template](../../ansible/windows/win_template_module#ansible-collections-ansible-windows-win-template-module)
The official documentation on the **ansible.windows.win\_template** module.
[ansible.windows.win\_file](../../ansible/windows/win_file_module#ansible-collections-ansible-windows-win-file-module)
The official documentation on the **ansible.windows.win\_file** module.
[ansible.windows.win\_copy](../../ansible/windows/win_copy_module#ansible-collections-ansible-windows-win-copy-module)
The official documentation on the **ansible.windows.win\_copy** module.
Examples
--------
```
- name: Add 127.0.0.1 as an A record for localhost
community.windows.win_hosts:
state: present
canonical_name: localhost
ip_address: 127.0.0.1
- name: Add ::1 as an AAAA record for localhost
community.windows.win_hosts:
state: present
canonical_name: localhost
ip_address: '::1'
- name: Remove 'bar' and 'zed' from the list of aliases for foo (192.168.1.100)
community.windows.win_hosts:
state: present
canonical_name: foo
ip_address: 192.168.1.100
action: remove
aliases:
- bar
- zed
- name: Remove hosts entries with canonical name 'bar'
community.windows.win_hosts:
state: absent
canonical_name: bar
- name: Remove 10.2.0.1 from the list of hosts
community.windows.win_hosts:
state: absent
ip_address: 10.2.0.1
- name: Ensure all name resolution is handled by DNS
community.windows.win_hosts:
state: absent
```
### Authors
* Micah Hunsberger (@mhunsber)
ansible community.windows.win_timezone – Sets Windows machine timezone community.windows.win\_timezone – Sets Windows machine timezone
===============================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_timezone`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Sets machine time to the specified timezone.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **timezone** string / required | | Timezone to set to. Example: Central Standard Time To disable Daylight Saving time, add the suffix `_dstoff` on timezones that support this. |
Notes
-----
Note
* The module will check if the provided timezone is supported on the machine.
* A list of possible timezones is available from `tzutil.exe /l` and from <https://msdn.microsoft.com/en-us/library/ms912391.aspx>
* If running on Server 2008 the hotfix <https://support.microsoft.com/en-us/help/2556308/tzutil-command-line-tool-is-added-to-windows-vista-and-to-windows-server-2008> needs to be installed to be able to run this module.
See Also
--------
See also
[community.windows.win\_region](win_region_module#ansible-collections-community-windows-win-region-module)
The official documentation on the **community.windows.win\_region** module.
Examples
--------
```
- name: Set timezone to 'Romance Standard Time' (GMT+01:00)
community.windows.win_timezone:
timezone: Romance Standard Time
- name: Set timezone to 'GMT Standard Time' (GMT)
community.windows.win_timezone:
timezone: GMT Standard Time
- name: Set timezone to 'Central Standard Time' (GMT-06:00)
community.windows.win_timezone:
timezone: Central Standard Time
- name: Set timezime to Pacific Standard time and disable Daylight Saving time adjustments
community.windows.win_timezone:
timezone: Pacific Standard Time_dstoff
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **previous\_timezone** string | success | The previous timezone if it was changed, otherwise the existing timezone. **Sample:** Central Standard Time |
| **timezone** string | success | The current timezone (possibly changed). **Sample:** Central Standard Time |
### Authors
* Phil Schwartz (@schwartzmx)
ansible community.windows.win_snmp – Configures the Windows SNMP service community.windows.win\_snmp – Configures the Windows SNMP service
=================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_snmp`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module configures the Windows SNMP service.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **action** string | **Choices:*** add
* **set** ←
* remove
|
`add` will add new SNMP community strings and/or SNMP managers
`set` will replace SNMP community strings and/or SNMP managers. An empty list for either `community_strings` or `permitted_managers` will result in the respective lists being removed entirely.
`remove` will remove SNMP community strings and/or SNMP managers |
| **community\_strings** list / elements=string | | The list of read-only SNMP community strings. |
| **permitted\_managers** list / elements=string | | The list of permitted SNMP managers. |
Examples
--------
```
- name: Replace SNMP communities and managers
community.windows.win_snmp:
community_strings:
- public
permitted_managers:
- 192.168.1.2
action: set
- name: Replace SNMP communities and clear managers
community.windows.win_snmp:
community_strings:
- public
permitted_managers: []
action: set
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **community\_strings** list / elements=string | always | The list of community strings for this machine. **Sample:** ['public', 'snmp-ro'] |
| **permitted\_managers** list / elements=string | always | The list of permitted managers for this machine. **Sample:** ['192.168.1.1', '192.168.1.2'] |
### Authors
* Michael Cassaniti (@mcassaniti)
ansible community.windows.win_iis_webapppool – Configure IIS Web Application Pools community.windows.win\_iis\_webapppool – Configure IIS Web Application Pools
============================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_iis_webapppool`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Creates, removes and configures an IIS Web Application Pool.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **attributes** string | | This field is a free form dictionary value for the application pool attributes. These attributes are based on the naming standard at <https://www.iis.net/configreference/system.applicationhost/applicationpools/add#005>, see the examples section for more details on how to set this. You can also set the attributes of child elements like cpu and processModel, see the examples to see how it is done. While you can use the numeric values for enums it is recommended to use the enum name itself, e.g. use SpecificUser instead of 3 for processModel.identityType. managedPipelineMode may be either "Integrated" or "Classic". startMode may be either "OnDemand" or "AlwaysRunning". Use `state` module parameter to modify the state of the app pool. When trying to set 'processModel.password' and you receive a 'Value does fall within the expected range' error, you have a corrupted keystore. Please follow <http://structuredsight.com/2014/10/26/im-out-of-range-youre-out-of-range/> to help fix your host. |
| **name** string / required | | Name of the application pool. |
| **state** string | **Choices:*** absent
* **present** ←
* restarted
* started
* stopped
| The state of the application pool. If `absent` will ensure the app pool is removed. If `present` will ensure the app pool is configured and exists. If `restarted` will ensure the app pool exists and will restart, this is never idempotent. If `started` will ensure the app pool exists and is started. If `stopped` will ensure the app pool exists and is stopped. |
See Also
--------
See also
[community.windows.win\_iis\_virtualdirectory](win_iis_virtualdirectory_module#ansible-collections-community-windows-win-iis-virtualdirectory-module)
The official documentation on the **community.windows.win\_iis\_virtualdirectory** module.
[community.windows.win\_iis\_webapplication](win_iis_webapplication_module#ansible-collections-community-windows-win-iis-webapplication-module)
The official documentation on the **community.windows.win\_iis\_webapplication** module.
[community.windows.win\_iis\_webbinding](win_iis_webbinding_module#ansible-collections-community-windows-win-iis-webbinding-module)
The official documentation on the **community.windows.win\_iis\_webbinding** module.
[community.windows.win\_iis\_website](win_iis_website_module#ansible-collections-community-windows-win-iis-website-module)
The official documentation on the **community.windows.win\_iis\_website** module.
Examples
--------
```
- name: Return information about an existing application pool
community.windows.win_iis_webapppool:
name: DefaultAppPool
state: present
- name: Create a new application pool in 'Started' state
community.windows.win_iis_webapppool:
name: AppPool
state: started
- name: Stop an application pool
community.windows.win_iis_webapppool:
name: AppPool
state: stopped
- name: Restart an application pool (non-idempotent)
community.windows.win_iis_webapppool:
name: AppPool
state: restarted
- name: Change application pool attributes using new dict style
community.windows.win_iis_webapppool:
name: AppPool
attributes:
managedRuntimeVersion: v4.0
autoStart: no
- name: Creates an application pool, sets attributes and starts it
community.windows.win_iis_webapppool:
name: AnotherAppPool
state: started
attributes:
managedRuntimeVersion: v4.0
autoStart: no
# In the below example we are setting attributes in child element processModel
# https://www.iis.net/configreference/system.applicationhost/applicationpools/add/processmodel
- name: Manage child element and set identity of application pool
community.windows.win_iis_webapppool:
name: IdentitiyAppPool
state: started
attributes:
managedPipelineMode: Classic
processModel.identityType: SpecificUser
processModel.userName: '{{ansible_user}}'
processModel.password: '{{ansible_password}}'
processModel.loadUserProfile: true
- name: Manage a timespan attribute
community.windows.win_iis_webapppool:
name: TimespanAppPool
state: started
attributes:
# Timespan with full string "day:hour:minute:second.millisecond"
recycling.periodicRestart.time: "00:00:05:00.000000"
recycling.periodicRestart.schedule: ["00:10:00", "05:30:00"]
# Shortened timespan "hour:minute:second"
processModel.pingResponseTime: "00:03:00"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **attributes** dictionary | success | Application Pool attributes that were set and processed by this module invocation. **Sample:** {'enable32BitAppOnWin64': 'true', 'managedPipelineMode': 'Classic', 'managedRuntimeVersion': 'v4.0'} |
| **info** complex | success | Information on current state of the Application Pool. See https://www.iis.net/configreference/system.applicationhost/applicationpools/add#005 for the full list of return attributes based on your IIS version. |
| | **attributes** dictionary | success | Key value pairs showing the current Application Pool attributes. **Sample:** {'CLRConfigFile': '', 'applicationPoolSid': 'S-1-5-82-1352790163-598702362-1775843902-1923651883-1762956711', 'autoStart': True, 'enable32BitAppOnWin64': True, 'enableConfigurationOverride': True, 'managedPipelineMode': 'Classic', 'managedRuntimeLoader': 'webengine4.dll', 'managedRuntimeVersion': 'v4.0', 'name': 'DefaultAppPool', 'passAnonymousToken': True, 'queueLength': 1000, 'startMode': 'OnDemand', 'state': 'Started'} |
| | **cpu** dictionary | success | Key value pairs showing the current Application Pool cpu attributes. **Sample:** {'action': 'NoAction', 'limit': 0, 'resetInterval': {'Days': 0, 'Hours': 0}} |
| | **failure** dictionary | success | Key value pairs showing the current Application Pool failure attributes. **Sample:** {'autoShutdownExe': '', 'orphanActionExe': '', 'rapidFailProtextionInterval': {'Days': 0, 'Hours': 0}} |
| | **name** string | success | Name of Application Pool that was processed by this module invocation. **Sample:** DefaultAppPool |
| | **processModel** dictionary | success | Key value pairs showing the current Application Pool processModel attributes. **Sample:** {'identityType': 'ApplicationPoolIdentity', 'logonType': 'LogonBatch', 'pingInterval': {'Days': 0, 'Hours': 0}} |
| | **recycling** dictionary | success | Key value pairs showing the current Application Pool recycling attributes. **Sample:** {'disallowOverlappingRotation': False, 'disallowRotationOnConfigChange': False, 'logEventOnRecycle': 'Time,Requests,Schedule,Memory,IsapiUnhealthy,OnDemand,ConfigChange,PrivateMemory'} |
| | **state** string | success | Current runtime state of the pool as the module completed. **Sample:** Started |
### Authors
* Henrik Wallström (@henrikwallstrom)
* Jordan Borean (@jborean93)
ansible community.windows.win_msg – Sends a message to logged in users on Windows hosts community.windows.win\_msg – Sends a message to logged in users on Windows hosts
================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_msg`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Wraps the msg.exe command in order to send messages to Windows hosts.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **display\_seconds** integer | **Default:**10 | How long to wait for receiver to acknowledge message, in seconds. |
| **msg** string | **Default:**"Hello world!" | The text of the message to be displayed. The message must be less than 256 characters. |
| **to** string | **Default:**"\*" | Who to send the message to. Can be a username, sessionname or sessionid. |
| **wait** boolean | **Choices:*** **no** ←
* yes
| Whether to wait for users to respond. Module will only wait for the number of seconds specified in display\_seconds or 10 seconds if not specified. However, if *wait* is `yes`, the message is sent to each logged on user in turn, waiting for the user to either press 'ok' or for the timeout to elapse before moving on to the next user. |
Notes
-----
Note
* This module must run on a windows host, so ensure your play targets windows hosts, or delegates to a windows host.
* Messages are only sent to the local host where the module is run.
* The module does not support sending to users listed in a file.
* Setting wait to `yes` can result in long run times on systems with many logged in users.
See Also
--------
See also
[community.windows.win\_say](win_say_module#ansible-collections-community-windows-win-say-module)
The official documentation on the **community.windows.win\_say** module.
[community.windows.win\_toast](win_toast_module#ansible-collections-community-windows-win-toast-module)
The official documentation on the **community.windows.win\_toast** module.
Examples
--------
```
- name: Warn logged in users of impending upgrade
community.windows.win_msg:
display_seconds: 60
msg: Automated upgrade about to start. Please save your work and log off before {{ deployment_start_time }}
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **display\_seconds** string | success | Value of display\_seconds module parameter. **Sample:** 10 |
| **msg** string | changed | Test of the message that was sent. **Sample:** Automated upgrade about to start. Please save your work and log off before 22 July 2016 18:00:00 |
| **rc** integer | always | The return code of the API call. |
| **runtime\_seconds** string | success | How long the module took to run on the remote windows host. **Sample:** 22 July 2016 17:45:51 |
| **sent\_localtime** string | success | local time from windows host when the message was sent. **Sample:** 22 July 2016 17:45:51 |
| **wait** boolean | success | Value of wait module parameter. |
### Authors
* Jon Hawkesworth (@jhawkesworth)
| programming_docs |
ansible community.windows.win_region – Set the region and format settings community.windows.win\_region – Set the region and format settings
==================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_region`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Set the location settings of a Windows Server.
* Set the format settings of a Windows Server.
* Set the unicode language settings of a Windows Server.
* Copy across these settings to the default profile.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **copy\_settings** boolean | **Choices:*** **no** ←
* yes
| This will copy the current format and location values to new user profiles and the welcome screen. This will only run if `location`, `format` or `unicode_language` has resulted in a change. If this process runs then it will always result in a change. |
| **format** string | | The language format to set for the current user, see <https://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx> for a list of culture names to use. This needs to be set if `location` or `unicode_language` is not set. |
| **location** string | | The location to set for the current user, see <https://msdn.microsoft.com/en-us/library/dd374073.aspx> for a list of GeoIDs you can use and what location it relates to. This needs to be set if `format` or `unicode_language` is not set. |
| **unicode\_language** string | | The unicode language format to set for all users, see <https://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx> for a list of culture names to use. This needs to be set if `location` or `format` is not set. After setting this value a reboot is required for it to take effect. |
See Also
--------
See also
[community.windows.win\_timezone](win_timezone_module#ansible-collections-community-windows-win-timezone-module)
The official documentation on the **community.windows.win\_timezone** module.
Examples
--------
```
- name: Set the region format to English United States
community.windows.win_region:
format: en-US
- name: Set the region format to English Australia and copy settings to new profiles
community.windows.win_region:
format: en-AU
copy_settings: yes
- name: Set the location to United States
community.windows.win_region:
location: 244
# Reboot when region settings change
- name: Set the unicode language to English Great Britain, reboot if required
community.windows.win_region:
unicode_language: en-GB
register: result
- ansible.windows.win_reboot:
when: result.restart_required
# Reboot when format, location or unicode has changed
- name: Set format, location and unicode to English Australia and copy settings, reboot if required
community.windows.win_region:
location: 12
format: en-AU
unicode_language: en-AU
register: result
- ansible.windows.win_reboot:
when: result.restart_required
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **restart\_required** boolean | success | Whether a reboot is required for the change to take effect. **Sample:** True |
### Authors
* Jordan Borean (@jborean93)
ansible community.windows.win_psrepository – Adds, removes or updates a Windows PowerShell repository. community.windows.win\_psrepository – Adds, removes or updates a Windows PowerShell repository.
===============================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_psrepository`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* This module helps to add, remove and update Windows PowerShell repository on Windows-based systems.
Requirements
------------
The below requirements are needed on the host that executes this module.
* PowerShell Module [PowerShellGet >= 1.6.0](https://www.powershellgallery.com/packages/PowerShellGet/)
* PowerShell Module [PackageManagement >= 1.1.7](https://www.powershellgallery.com/packages/PackageManagement/)
* PowerShell Package Provider `NuGet` >= 2.8.5.201
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **force** boolean | **Choices:*** **no** ←
* yes
| If `True`, any differences from the desired state will result in the repository being unregistered, and then re-registered.
*force* has no effect when *state=absent*. See notes for additional context. |
| **installation\_policy** string | **Choices:*** trusted
* untrusted
| Sets the `InstallationPolicy` of a repository. Will default to `trusted` when creating a new repository or used with *force=True*. |
| **name** string / required | | Name of the repository to work with. |
| **proxy** string added in 1.1.0 of community.windows | | Proxy to use for repository. |
| **publish\_location** string | | Specifies the URI for publishing modules to this repository. |
| **script\_publish\_location** string | | Specifies the URI for publishing scripts to this repository. |
| **script\_source\_location** string | | Specifies the URI for discovering and installing scripts from this repository. |
| **source\_location** string | | Specifies the URI for discovering and installing modules from this repository. A URI can be a NuGet server feed (most common situation), HTTP, HTTPS, FTP or file location. Required when registering a new repository or using *force=True*.
aliases: source |
| **state** string | **Choices:*** absent
* **present** ←
| If `present` a new repository is added or updated. If `absent` a repository is removed. |
Notes
-----
Note
* See the examples on how to update the NuGet package provider.
* You can not use `win_psrepository` to re-register (add) removed PSGallery, use the command `Register-PSRepository -Default` instead.
* When registering or setting *source\_location*, PowerShellGet will transform the location according to internal rules, such as following HTTP/S redirects.
* This can result in a `CHANGED` status on each run as the values will never match and will be “reset” each time.
* To work around that, find the true destination value with [community.windows.win\_psrepository\_info](win_psrepository_info_module#ansible-collections-community-windows-win-psrepository-info-module) or `Get-PSRepository` and update the playbook to match.
* When updating an existing repository, all options except *name* are optional. Only supplied options will be updated. Use *force=True* to exactly match.
* *script\_location*, *publish\_location*, and *script\_publish\_location* are optional but once set can only be cleared with *force=True*.
* Using *force=True* will unregister and re-register the repository if there are any changes, so that it exactly matches the options specified.
See Also
--------
See also
[community.windows.win\_psrepository\_info](win_psrepository_info_module#ansible-collections-community-windows-win-psrepository-info-module)
The official documentation on the **community.windows.win\_psrepository\_info** module.
[community.windows.win\_psmodule](win_psmodule_module#ansible-collections-community-windows-win-psmodule-module)
The official documentation on the **community.windows.win\_psmodule** module.
Examples
--------
```
---
- name: Ensure the required NuGet package provider version is installed
ansible.windows.win_shell: Find-PackageProvider -Name Nuget -ForceBootstrap -IncludeDependencies -Force
- name: Register a PowerShell repository
community.windows.win_psrepository:
name: MyRepository
source_location: https://myrepo.com
state: present
- name: Remove a PowerShell repository
community.windows.win_psrepository:
name: MyRepository
state: absent
- name: Add an untrusted repository
community.windows.win_psrepository:
name: MyRepository
installation_policy: untrusted
- name: Add a repository with different locations
community.windows.win_psrepository:
name: NewRepo
source_location: https://myrepo.example/module/feed
script_source_location: https://myrepo.example/script/feed
publish_location: https://myrepo.example/api/module/publish
script_publish_location: https://myrepo.example/api/script/publish
- name: Update only two properties on the above repository
community.windows.win_psrepository:
name: NewRepo
installation_policy: untrusted
script_publish_location: https://scriptprocessor.example/publish
- name: Clear script locations from the above repository by re-registering it
community.windows.win_psrepository:
name: NewRepo
installation_policy: untrusted
source_location: https://myrepo.example/module/feed
publish_location: https://myrepo.example/api/module/publish
force: True
```
### Authors
* Wojciech Sciesinski (@it-praktyk)
* Brian Scholer (@briantist)
ansible community.windows.win_robocopy – Synchronizes the contents of two directories using Robocopy community.windows.win\_robocopy – Synchronizes the contents of two directories using Robocopy
=============================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_robocopy`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Synchronizes the contents of files/directories from a source to destination.
* Under the hood this just calls out to RoboCopy, since that should be available on most modern Windows systems.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **dest** path / required | | Destination file/directory to sync (Will receive contents of src). |
| **flags** string | | Directly supply Robocopy flags. If set, `purge` and `recurse` will be ignored. |
| **purge** boolean | **Choices:*** **no** ←
* yes
| Deletes any files/directories found in the destination that do not exist in the source. Toggles the `/purge` flag to RoboCopy. If `flags` is set, this will be ignored. |
| **recurse** boolean | **Choices:*** **no** ←
* yes
| Includes all subdirectories (Toggles the `/e` flag to RoboCopy). If `flags` is set, this will be ignored. |
| **src** path / required | | Source file/directory to sync. |
Notes
-----
Note
* This is not a complete port of the [ansible.posix.synchronize](../../ansible/posix/synchronize_module#ansible-collections-ansible-posix-synchronize-module) module. Unlike the [ansible.posix.synchronize](../../ansible/posix/synchronize_module#ansible-collections-ansible-posix-synchronize-module) module this only performs the sync/copy on the remote machine, not from the Ansible controller to the remote machine.
* This module does not currently support all Robocopy flags.
See Also
--------
See also
[ansible.posix.synchronize](../../ansible/posix/synchronize_module#ansible-collections-ansible-posix-synchronize-module)
The official documentation on the **ansible.posix.synchronize** module.
[ansible.windows.win\_copy](../../ansible/windows/win_copy_module#ansible-collections-ansible-windows-win-copy-module)
The official documentation on the **ansible.windows.win\_copy** module.
Examples
--------
```
- name: Sync the contents of one directory to another
community.windows.win_robocopy:
src: C:\DirectoryOne
dest: C:\DirectoryTwo
- name: Sync the contents of one directory to another, including subdirectories
community.windows.win_robocopy:
src: C:\DirectoryOne
dest: C:\DirectoryTwo
recurse: yes
- name: Sync the contents of one directory to another, and remove any files/directories found in destination that do not exist in the source
community.windows.win_robocopy:
src: C:\DirectoryOne
dest: C:\DirectoryTwo
purge: yes
- name: Sync content in recursive mode, removing any files/directories found in destination that do not exist in the source
community.windows.win_robocopy:
src: C:\DirectoryOne
dest: C:\DirectoryTwo
recurse: yes
purge: yes
- name: Sync two directories in recursive and purging mode, specifying additional special flags
community.windows.win_robocopy:
src: C:\DirectoryOne
dest: C:\DirectoryTwo
flags: /E /PURGE /XD SOME_DIR /XF SOME_FILE /MT:32
- name: Sync one file from a remote UNC path in recursive and purging mode, specifying additional special flags
community.windows.win_robocopy:
src: \\Server1\Directory One
dest: C:\DirectoryTwo
flags: file.zip /E /PURGE /XD SOME_DIR /XF SOME_FILE /MT:32
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **cmd** string | always | The used command line. **Sample:** robocopy C:\DirectoryOne C:\DirectoryTwo /e /purge |
| **dest** string | always | The Destination file/directory of the sync. **Sample:** C:\Some\Path |
| **flags** string | always | Any flags passed in by the user. **Sample:** /e /purge |
| **msg** string | always | Output interpreted into a concise message. **Sample:** No files copied! |
| **output** string | success | The output of running the robocopy command. **Sample:** ------------------------------------\n ROBOCOPY :: Robust File Copy for Windows \n------------------------------------\n |
| **purge** boolean | always | Whether or not the purge flag was toggled. |
| **rc** integer | success | The return code returned by robocopy. **Sample:** 1 |
| **recurse** boolean | always | Whether or not the recurse flag was toggled. |
| **src** string | always | The Source file/directory of the sync. **Sample:** C:\Some\Path |
### Authors
* Corwin Brown (@blakfeld)
ansible community.windows.win_firewall_rule – Windows firewall automation community.windows.win\_firewall\_rule – Windows firewall automation
===================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_firewall_rule`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Allows you to create/remove/update firewall rules.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **action** string | **Choices:*** allow
* block
| What to do with the items this rule is for. Defaults to `allow` when creating a new rule. |
| **description** string | | Description for the firewall rule. |
| **direction** string | **Choices:*** in
* out
| Whether this rule is for inbound or outbound traffic. Defaults to `in` when creating a new rule. |
| **enabled** boolean | **Choices:*** no
* yes
| Whether this firewall rule is enabled or disabled. Defaults to `true` when creating a new rule.
aliases: enable |
| **group** string | | The group name for the rule. If *name* is not specified then the module will set the firewall options for all the rules in this group. |
| **icmp\_type\_code** list / elements=string | | The ICMP types and codes for the rule. This is only valid when *protocol* is `icmpv4` or `icmpv6`. Each entry follows the format `type:code` where `type` is the type number and `code` is the code number for that type or `*` for all codes. Set the value to just `*` to apply the rule for all ICMP type codes. See <https://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml> for a list of ICMP types and the codes that apply to them. |
| **localip** string | | The local ip address this rule applies to. Set to `any` to apply to all local ip addresses. Defaults to `any` when creating a new rule. |
| **localport** string | | The local port this rule applies to. Set to `any` to apply to all local ports. Defaults to `any` when creating a new rule. Must have *protocol* set |
| **name** string | | The rule's display name. This is required unless *group* is specified. |
| **profiles** list / elements=string | | The profile this rule applies to. Defaults to `domain,private,public` when creating a new rule.
aliases: profile |
| **program** string | | The program this rule applies to. Set to `any` to apply to all programs. Defaults to `any` when creating a new rule. |
| **protocol** string | | The protocol this rule applies to. Set to `any` to apply to all services. Defaults to `any` when creating a new rule. |
| **remoteip** string | | The remote ip address/range this rule applies to. Set to `any` to apply to all remote ip addresses. Defaults to `any` when creating a new rule. |
| **remoteport** string | | The remote port this rule applies to. Set to `any` to apply to all remote ports. Defaults to `any` when creating a new rule. Must have *protocol* set |
| **service** string | | The service this rule applies to. Set to `any` to apply to all services. Defaults to `any` when creating a new rule. |
| **state** string | **Choices:*** absent
* **present** ←
| Should this rule be added or removed. |
Notes
-----
Note
* Multiple firewall rules can share the same *name*, if there are multiple matches then the module will set the user defined options for each matching rule.
See Also
--------
See also
[community.windows.win\_firewall](win_firewall_module#ansible-collections-community-windows-win-firewall-module)
The official documentation on the **community.windows.win\_firewall** module.
Examples
--------
```
- name: Firewall rule to allow SMTP on TCP port 25
community.windows.win_firewall_rule:
name: SMTP
localport: 25
action: allow
direction: in
protocol: tcp
state: present
enabled: yes
- name: Firewall rule to allow RDP on TCP port 3389
community.windows.win_firewall_rule:
name: Remote Desktop
localport: 3389
action: allow
direction: in
protocol: tcp
profiles: private
state: present
enabled: yes
- name: Firewall rule to be created for application group
community.windows.win_firewall_rule:
name: SMTP
group: application
localport: 25
action: allow
direction: in
protocol: tcp
state: present
enabled: yes
- name: Enable all the Firewall rules in application group
win_firewall_rule:
group: application
enabled: yes
- name: Firewall rule to allow port range
community.windows.win_firewall_rule:
name: Sample port range
localport: 5000-5010
action: allow
direction: in
protocol: tcp
state: present
enabled: yes
- name: Firewall rule to allow ICMP v4 echo (ping)
community.windows.win_firewall_rule:
name: ICMP Allow incoming V4 echo request
enabled: yes
state: present
profiles: private
action: allow
direction: in
protocol: icmpv4
icmp_type_code:
- '8:*'
- name: Firewall rule to alloc ICMP v4 on all type codes
community.windows.win_firewall_rule:
name: ICMP Allow incoming V4 echo request
enabled: yes
state: present
profiles: private
action: allow
direction: in
protocol: icmpv4
icmp_type_code: '*'
```
### Authors
* Artem Zinenko (@ar7z1)
* Timothy Vandenbrande (@TimothyVandenbrande)
| programming_docs |
ansible community.windows.win_eventlog_entry – Write entries to Windows event logs community.windows.win\_eventlog\_entry – Write entries to Windows event logs
============================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_eventlog_entry`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Write log entries to a given event log from a specified source.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **category** integer | | A numeric task category associated with the category message file for the log source. |
| **entry\_type** string | **Choices:*** Error
* FailureAudit
* Information
* SuccessAudit
* Warning
| Indicates the entry being written to the log is of a specific type. |
| **event\_id** integer / required | | The numeric event identifier for the entry. Value must be between 0 and 65535. |
| **log** string / required | | Name of the event log to write an entry to. |
| **message** string / required | | The message for the given log entry. |
| **raw\_data** string | | Binary data associated with the log entry. Value must be a comma-separated array of 8-bit unsigned integers (0 to 255). |
| **source** string / required | | Name of the log source to indicate where the entry is from. |
Notes
-----
Note
* This module will always report a change when writing an event entry.
See Also
--------
See also
[community.windows.win\_eventlog](win_eventlog_module#ansible-collections-community-windows-win-eventlog-module)
The official documentation on the **community.windows.win\_eventlog** module.
Examples
--------
```
- name: Write an entry to a Windows event log
community.windows.win_eventlog_entry:
log: MyNewLog
source: NewLogSource1
event_id: 1234
message: This is a test log entry.
- name: Write another entry to a different Windows event log
community.windows.win_eventlog_entry:
log: AnotherLog
source: MyAppSource
event_id: 5000
message: An error has occurred.
entry_type: Error
category: 5
raw_data: 10,20
```
### Authors
* Andrew Saraceni (@andrewsaraceni)
ansible community.windows.win_power_plan – Changes the power plan of a Windows system community.windows.win\_power\_plan – Changes the power plan of a Windows system
===============================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_power_plan`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module will change the power plan of a Windows system to the defined string.
* Windows defaults to `balanced` which will cause CPU throttling. In some cases it can be preferable to change the mode to `high performance` to increase CPU performance.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **name** string / required | | String value that indicates the desired power plan. The power plan must already be present on the system. Commonly there will be options for `balanced` and `high performance`. |
Examples
--------
```
- name: Change power plan to high performance
community.windows.win_power_plan:
name: high performance
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **all\_available\_plans** dictionary | always | The name and enabled state of all power plans. **Sample:** { "High performance": false, "Balanced": true, "Power saver": false } |
| **power\_plan\_enabled** boolean | success | State of the intended power plan. **Sample:** True |
| **power\_plan\_name** string | always | Value of the intended power plan. **Sample:** balanced |
### Authors
* Noah Sparks (@nwsparks)
ansible community.windows.win_product_facts – Provides Windows product and license information community.windows.win\_product\_facts – Provides Windows product and license information
========================================================================================
Note
This plugin is part of the [community.windows collection](https://galaxy.ansible.com/community/windows) (version 1.7.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.windows`.
To use it in a playbook, specify: `community.windows.win_product_facts`.
* [Synopsis](#synopsis)
* [Examples](#examples)
* [Returned Facts](#returned-facts)
Synopsis
--------
* Provides Windows product and license information.
Examples
--------
```
- name: Get product id and product key
community.windows.win_product_facts:
- name: Display Windows edition
debug:
var: ansible_os_license_edition
- name: Display Windows license status
debug:
var: ansible_os_license_status
```
Returned Facts
--------------
Facts returned by this module are added/updated in the `hostvars` host facts and can be referenced by name just like any other host fact. They do not need to be registered in order to use them.
| Fact | Returned | Description |
| --- | --- | --- |
| **ansible\_os\_license\_channel** string / elements=string | always | The Windows license channel. **Sample:** Volume:MAK |
| **ansible\_os\_license\_edition** string / elements=string | always | The Windows license edition. **Sample:** Windows(R) ServerStandard edition |
| **ansible\_os\_license\_status** string / elements=string | always | The Windows license status. **Sample:** Licensed |
| **ansible\_os\_product\_id** string / elements=string | always | The Windows product ID. **Sample:** 00326-10000-00000-AA698 |
| **ansible\_os\_product\_key** string / elements=string | always | The Windows product key. **Sample:** T49TD-6VFBW-VV7HY-B2PXY-MY47H |
### Authors
* Dag Wieers (@dagwieers)
ansible community.sops.sops_encrypt – Encrypt data with sops community.sops.sops\_encrypt – Encrypt data with sops
=====================================================
Note
This plugin is part of the [community.sops collection](https://galaxy.ansible.com/community/sops) (version 1.1.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.sops`.
To use it in a playbook, specify: `community.sops.sops_encrypt`.
New in version 0.1.0: of community.sops
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [See Also](#see-also)
* [Examples](#examples)
Synopsis
--------
* Allows to encrypt binary data (Base64 encoded), text data, JSON or YAML data with sops.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **attributes** string added in 2.3 of ansible.builtin | | The attributes the resulting file or directory should have. To get supported flags look at the man page for *chattr* on the target system. This string should contain the attributes in the same order as the one displayed by *lsattr*. The `=` operator is assumed as default, otherwise `+` or `-` operators need to be included in the string.
aliases: attr |
| **aws\_access\_key\_id** string added in 1.0.0 of community.sops | | The AWS access key ID to use for requests to AWS. Sets the environment variable `AWS_ACCESS_KEY_ID` for the sops call. |
| **aws\_profile** string added in 1.0.0 of community.sops | | The AWS profile to use for requests to AWS. This corresponds to the sops `--aws-profile` option. |
| **aws\_secret\_access\_key** string added in 1.0.0 of community.sops | | The AWS secret access key to use for requests to AWS. Sets the environment variable `AWS_SECRET_ACCESS_KEY` for the sops call. |
| **aws\_session\_token** string added in 1.0.0 of community.sops | | The AWS session token to use for requests to AWS. Sets the environment variable `AWS_SESSION_TOKEN` for the sops call. |
| **azure\_kv** list / elements=string added in 1.0.0 of community.sops | | Azure Key Vault URLs to use. This corresponds to the sops `--azure-kv` option. |
| **config\_path** path added in 1.0.0 of community.sops | | Path to the sops configuration file. If not set, sops will recursively search for the config file starting at the file that is encrypted or decrypted. This corresponds to the sops `--config` option. |
| **content\_binary** string | | The data to encrypt. Must be [Base64 encoded](https://en.wikipedia.org/wiki/Base64) binary data. Please note that the module might not be idempotent if the data can be parsed as JSON or YAML. Exactly one of *content\_text*, *content\_binary*, *content\_json* and *content\_yaml* must be specified. |
| **content\_json** dictionary | | The data to encrypt. Must be a JSON dictionary. Exactly one of *content\_text*, *content\_binary*, *content\_json* and *content\_yaml* must be specified. |
| **content\_text** string | | The data to encrypt. Must be a Unicode text. Please note that the module might not be idempotent if the text can be parsed as JSON or YAML. Exactly one of *content\_text*, *content\_binary*, *content\_json* and *content\_yaml* must be specified. |
| **content\_yaml** dictionary | | The data to encrypt. Must be a YAML dictionary. Please note that Ansible only allows to pass data that can be represented as a JSON dictionary. Exactly one of *content\_text*, *content\_binary*, *content\_json* and *content\_yaml* must be specified. |
| **enable\_local\_keyservice** boolean added in 1.0.0 of community.sops | **Choices:*** **no** ←
* yes
| Tell sops to use local key service. This corresponds to the sops `--enable-local-keyservice` option. |
| **encrypted\_regex** string added in 1.0.0 of community.sops | | Set the encrypted key suffix. When specified, only keys matching the regular expression will be encrypted. This corresponds to the sops `--encrypted-regex` option. |
| **encrypted\_suffix** string added in 1.0.0 of community.sops | | Override the encrypted key suffix. When set to an empty string, all keys will be encrypted that are not explicitly marked by *unencrypted\_suffix*. This corresponds to the sops `--encrypted-suffix` option. |
| **encryption\_context** list / elements=string added in 1.0.0 of community.sops | | List of KMS encryption context pairs of format `key:value`. This corresponds to the sops `--encryption-context` option. |
| **force** boolean | **Choices:*** **no** ←
* yes
| Force rewriting the encrypted file. |
| **gcp\_kms** list / elements=string added in 1.0.0 of community.sops | | GCP KMS resource IDs to use. This corresponds to the sops `--gcp-kms` option. |
| **group** string | | Name of the group that should own the file/directory, as would be fed to *chown*. |
| **hc\_vault\_transit** list / elements=string added in 1.0.0 of community.sops | | HashiCorp Vault key URIs to use. For example, `https://vault.example.org:8200/v1/transit/keys/dev`. This corresponds to the sops `--hc-vault-transit` option. |
| **keyservice** list / elements=string added in 1.0.0 of community.sops | | Specify key services to use next to the local one. A key service must be specified in the form `protocol://address`, for example `tcp://myserver.com:5000`. This corresponds to the sops `--keyservice` option. |
| **kms** list / elements=string added in 1.0.0 of community.sops | | List of KMS ARNs to use. This corresponds to the sops `--kms` option. |
| **mode** raw | | The permissions the resulting file or directory should have. For those used to */usr/bin/chmod* remember that modes are actually octal numbers. You must either add a leading zero so that Ansible's YAML parser knows it is an octal number (like `0644` or `01777`) or quote it (like `'644'` or `'1777'`) so Ansible receives a string and can do its own conversion from string into number. Giving Ansible a number without following one of these rules will end up with a decimal number which will have unexpected results. As of Ansible 1.8, the mode may be specified as a symbolic mode (for example, `u+rwx` or `u=rw,g=r,o=r`). If `mode` is not specified and the destination file **does not** exist, the default `umask` on the system will be used when setting the mode for the newly created file. If `mode` is not specified and the destination file **does** exist, the mode of the existing file will be used. Specifying `mode` is the best way to ensure files are created with the correct permissions. See CVE-2020-1736 for further details. |
| **owner** string | | Name of the user that should own the file/directory, as would be fed to *chown*. |
| **path** path / required | | The sops encrypt file. |
| **pgp** list / elements=string added in 1.0.0 of community.sops | | PGP fingerprints to use. This corresponds to the sops `--pgp` option. |
| **selevel** string | | The level part of the SELinux file context. This is the MLS/MCS attribute, sometimes known as the `range`. When set to `_default`, it will use the `level` portion of the policy if available. |
| **serole** string | | The role part of the SELinux file context. When set to `_default`, it will use the `role` portion of the policy if available. |
| **setype** string | | The type part of the SELinux file context. When set to `_default`, it will use the `type` portion of the policy if available. |
| **seuser** string | | The user part of the SELinux file context. By default it uses the `system` policy, where applicable. When set to `_default`, it will use the `user` portion of the policy if available. |
| **shamir\_secret\_sharing\_threshold** integer added in 1.0.0 of community.sops | | The number of distinct keys required to retrieve the data key with [Shamir's Secret Sharing](https://en.wikipedia.org/wiki/Shamir%27s_Secret_Sharing). If not set here and in the sops config file, will default to `0`. This corresponds to the sops `--shamir-secret-sharing-threshold` option. |
| **sops\_binary** path added in 1.0.0 of community.sops | | Path to the sops binary. By default uses `sops`. |
| **unencrypted\_regex** string added in 1.0.0 of community.sops | | Set the unencrypted key suffix. When specified, only keys matching the regular expression will be left unencrypted. This corresponds to the sops `--unencrypted-regex` option. |
| **unencrypted\_suffix** string added in 1.0.0 of community.sops | | Override the unencrypted key suffix. This corresponds to the sops `--unencrypted-suffix` option. |
| **unsafe\_writes** boolean added in 2.2 of ansible.builtin | **Choices:*** **no** ←
* yes
| Influence when to use atomic operation to prevent data corruption or inconsistent reads from the target file. By default this module uses atomic operations to prevent data corruption or inconsistent reads from the target files, but sometimes systems are configured or just broken in ways that prevent this. One example is docker mounted files, which cannot be updated atomically from inside the container and can only be written in an unsafe manner. This option allows Ansible to fall back to unsafe methods of updating files when atomic operations fail (however, it doesn't force Ansible to perform unsafe writes). IMPORTANT! Unsafe writes are subject to race conditions and can lead to data corruption. |
Notes
-----
Note
* Supports `check_mode`.
See Also
--------
See also
[community.sops.sops lookup](sops_lookup#ansible-collections-community-sops-sops-lookup)
The sops lookup can be used decrypt sops-encrypted files.
Examples
--------
```
- name: Encrypt a secret text
community.sops.sops_encrypt:
path: text-data.sops
content_text: This is a secret text.
- name: Encrypt the contents of a file
community.sops.sops_encrypt:
path: binary-data.sops
content_binary: "{{ lookup('ansible.builtin.file', '/path/to/file', rstrip=false) | b64encode }}"
- name: Encrypt some datastructure as YAML
community.sops.sops_encrypt:
path: stuff.sops.yaml
content_yaml: "{{ result }}"
```
### Authors
* Felix Fontein (@felixfontein)
ansible Community.Sops Community.Sops
==============
Collection version 1.1.0
Scenario Guide
--------------
* [Protecting Ansible secrets with Mozilla SOPS](docsite/guide)
Plugin Index
------------
These are the plugins in the community.sops collection
### Lookup Plugins
* [sops](sops_lookup#ansible-collections-community-sops-sops-lookup) – Read sops encrypted file contents
### Modules
* [load\_vars](load_vars_module#ansible-collections-community-sops-load-vars-module) – Load sops-encrypted variables from files, dynamically within a task
* [sops\_encrypt](sops_encrypt_module#ansible-collections-community-sops-sops-encrypt-module) – Encrypt data with sops
### Vars Plugins
* [sops](sops_vars#ansible-collections-community-sops-sops-vars) – Loading sops-encrypted vars files
See also
List of [collections](../../index#list-of-collections) with docs hosted here.
ansible community.sops.sops – Read sops encrypted file contents community.sops.sops – Read sops encrypted file contents
=======================================================
Note
This plugin is part of the [community.sops collection](https://galaxy.ansible.com/community/sops) (version 1.1.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.sops`.
To use it in a playbook, specify: `community.sops.sops`.
New in version 0.1.0: of community.sops
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This lookup returns the contents from a file on the Ansible controller’s file system.
* This lookup requires the `sops` executable to be available in the controller PATH.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **\_terms** string / required | | | Path(s) of files to read. |
| **aws\_access\_key\_id** string added in 1.0.0 of community.sops | | var: sops\_aws\_access\_key\_id | The AWS access key ID to use for requests to AWS. Sets the environment variable `AWS_ACCESS_KEY_ID` for the sops call. |
| **aws\_profile** string added in 1.0.0 of community.sops | | var: sops\_aws\_profile | The AWS profile to use for requests to AWS. This corresponds to the sops `--aws-profile` option. |
| **aws\_secret\_access\_key** string added in 1.0.0 of community.sops | | var: sops\_aws\_secret\_access\_key | The AWS secret access key to use for requests to AWS. Sets the environment variable `AWS_SECRET_ACCESS_KEY` for the sops call. |
| **aws\_session\_token** string added in 1.0.0 of community.sops | | var: sops\_session\_token | The AWS session token to use for requests to AWS. Sets the environment variable `AWS_SESSION_TOKEN` for the sops call. |
| **base64** boolean | **Choices:*** **no** ←
* yes
| | Base64-encodes the parsed result. Use this if you want to store binary data in Ansible variables. |
| **config\_path** path added in 1.0.0 of community.sops | | var: sops\_config\_path | Path to the sops configuration file. If not set, sops will recursively search for the config file starting at the file that is encrypted or decrypted. This corresponds to the sops `--config` option. |
| **empty\_on\_not\_exist** boolean | **Choices:*** **no** ←
* yes
| | When set to `true`, will not raise an error when a file cannot be found, but return an empty string instead. |
| **enable\_local\_keyservice** boolean added in 1.0.0 of community.sops | **Choices:*** **no** ←
* yes
| var: sops\_enable\_local\_keyservice | Tell sops to use local key service. This corresponds to the sops `--enable-local-keyservice` option. |
| **input\_type** string | **Choices:*** binary
* json
* yaml
* dotenv
| | Tell sops how to interpret the encrypted file. By default, sops will chose the input type from the file extension. If it detects the wrong type for a file, this could result in decryption failing. |
| **keyservice** list / elements=string added in 1.0.0 of community.sops | | var: sops\_keyservice | Specify key services to use next to the local one. A key service must be specified in the form `protocol://address`, for example `tcp://myserver.com:5000`. This corresponds to the sops `--keyservice` option. |
| **output\_type** string | **Choices:*** binary
* json
* yaml
* dotenv
| | Tell sops how to interpret the decrypted file. By default, sops will chose the output type from the file extension. If it detects the wrong type for a file, this could result in decryption failing. |
| **rstrip** boolean | **Choices:*** no
* **yes** ←
| | Whether to remove trailing newlines and spaces. |
| **sops\_binary** path added in 1.0.0 of community.sops | | var: sops\_binary | Path to the sops binary. By default uses `sops`. |
Notes
-----
Note
* This lookup does not understand ‘globbing’ - use the fileglob lookup instead.
Examples
--------
```
- name: Output secrets to screen (BAD IDEA!)
ansible.builtin.debug:
msg: "Content: {{ lookup('community.sops.sops', item) }}"
loop:
- sops-encrypted-file.enc.yaml
- name: Add SSH private key
ansible.builtin.copy:
# Note that rstrip=false is necessary for some SSH versions to be able to use the key
content: "{{ lookup('community.sops.sops', user + '-id_rsa', rstrip=false) }}"
dest: /home/{{ user }}/.ssh/id_rsa
owner: "{{ user }}"
group: "{{ user }}"
mode: 0600
no_log: true # avoid content to be written to log
- name: The file file.json is a YAML file, which contains the encryption of binary data
ansible.builtin.debug:
msg: "Content: {{ lookup('community.sops.sops', 'file.json', input_type='yaml', output_type='binary') }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_raw** list / elements=string | success | Decrypted file content. |
### Authors
* Edoardo Tenani (@endorama) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#bfda999c8b8984cbdad1ded1d6999c8c8884999c8a8d84999c8b8784decddbcad6d1d0999c8b8984dcdc)>
| programming_docs |
ansible community.sops.load_vars – Load sops-encrypted variables from files, dynamically within a task community.sops.load\_vars – Load sops-encrypted variables from files, dynamically within a task
===============================================================================================
Note
This plugin is part of the [community.sops collection](https://galaxy.ansible.com/community/sops) (version 1.1.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.sops`.
To use it in a playbook, specify: `community.sops.load_vars`.
New in version 0.1.0: of community.sops
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [See Also](#see-also)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Loads sops-encrypted YAML/JSON variables dynamically from a file during task runtime.
* To assign included variables to a different host than `inventory_hostname`, use `delegate_to` and set `delegate_facts=yes`.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **aws\_access\_key\_id** string added in 1.0.0 of community.sops | | The AWS access key ID to use for requests to AWS. Sets the environment variable `AWS_ACCESS_KEY_ID` for the sops call. |
| **aws\_profile** string added in 1.0.0 of community.sops | | The AWS profile to use for requests to AWS. This corresponds to the sops `--aws-profile` option. |
| **aws\_secret\_access\_key** string added in 1.0.0 of community.sops | | The AWS secret access key to use for requests to AWS. Sets the environment variable `AWS_SECRET_ACCESS_KEY` for the sops call. |
| **aws\_session\_token** string added in 1.0.0 of community.sops | | The AWS session token to use for requests to AWS. Sets the environment variable `AWS_SESSION_TOKEN` for the sops call. |
| **config\_path** path added in 1.0.0 of community.sops | | Path to the sops configuration file. If not set, sops will recursively search for the config file starting at the file that is encrypted or decrypted. This corresponds to the sops `--config` option. |
| **enable\_local\_keyservice** boolean added in 1.0.0 of community.sops | **Choices:*** **no** ←
* yes
| Tell sops to use local key service. This corresponds to the sops `--enable-local-keyservice` option. |
| **expressions** string | **Choices:*** **ignore** ←
* evaluate-on-load
| This option controls how Jinja2 expressions in values in the loaded file are handled. If set to `ignore`, expressions will not be evaluated, but treated as regular strings. If set to `evaluate-on-load`, expressions will be evaluated on execution of this module, in other words, when the file is loaded. Unfortunately, there is no way for non-core modules to handle expressions "unsafe", in other words, evaluate them only on use. This can only achieved by [ansible.builtin.include\_vars](../../ansible/builtin/include_vars_module), which unfortunately cannot handle sops-encrypted files. |
| **file** path | | The file name from which variables should be loaded. If the path is relative, it will look for the file in `vars/` subdirectory of a role or relative to playbook. |
| **keyservice** list / elements=string added in 1.0.0 of community.sops | | Specify key services to use next to the local one. A key service must be specified in the form `protocol://address`, for example `tcp://myserver.com:5000`. This corresponds to the sops `--keyservice` option. |
| **name** string | | The name of a variable into which assign the included vars. If omitted (`null`) they will be made top level vars. |
| **sops\_binary** path added in 1.0.0 of community.sops | | Path to the sops binary. By default uses `sops`. |
See Also
--------
See also
[ansible.builtin.set\_fact](../../ansible/builtin/set_fact_module#ansible-collections-ansible-builtin-set-fact-module)
The official documentation on the **ansible.builtin.set\_fact** module.
[ansible.builtin.include\_vars](../../ansible/builtin/include_vars_module#ansible-collections-ansible-builtin-include-vars-module)
The official documentation on the **ansible.builtin.include\_vars** module.
[Controlling where tasks run: delegation and local actions](../../../user_guide/playbooks_delegation#playbooks-delegation)
More information related to task delegation.
Examples
--------
```
- name: Include variables of stuff.sops.yaml into the 'stuff' variable
community.sops.load_vars:
file: stuff.sops.yaml
name: stuff
expressions: evaluate-on-load # interpret Jinja2 expressions in stuf.sops.yaml on load-time!
- name: Conditionally decide to load in variables into 'plans' when x is 0, otherwise do not
community.sops.load_vars:
file: contingency_plan.sops.yaml
name: plans
expressions: ignore # do not interpret possible Jinja2 expressions
when: x == 0
- name: Load variables into the global namespace
community.sops.load_vars:
file: contingency_plan.sops.yaml
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **ansible\_included\_var\_files** list / elements=string | success | A list of files that were successfully included **Sample:** ['/path/to/file.sops.yaml'] |
### Authors
* Felix Fontein (@felixfontein)
ansible community.sops.sops – Loading sops-encrypted vars files community.sops.sops – Loading sops-encrypted vars files
=======================================================
Note
This plugin is part of the [community.sops collection](https://galaxy.ansible.com/community/sops) (version 1.1.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.sops`.
To use it in a playbook, specify: `community.sops.sops`.
New in version 0.1.0: of community.sops
* [Synopsis](#synopsis)
* [Parameters](#parameters)
Synopsis
--------
* Load encrypted YAML files into corresponding groups/hosts in group\_vars/ and host\_vars/ directories.
* Files are encrypted prior to reading, making this plugin an effective companion to host\_group\_vars plugin.
* Files are restricted to .sops.yaml, .sops.yml, .sops.json extensions.
* Hidden files are ignored.
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **\_valid\_extensions** list / elements=string | **Default:**[".sops.yml", ".sops.yaml", ".sops.json"] | | Check all of these extensions when looking for 'variable' files which should be YAML or JSON or vaulted versions of these. This affects vars\_files, include\_vars, inventory and vars plugins among others. |
| **aws\_access\_key\_id** string added in 1.0.0 of community.sops | | | The AWS access key ID to use for requests to AWS. Sets the environment variable `AWS_ACCESS_KEY_ID` for the sops call. |
| **aws\_profile** string added in 1.0.0 of community.sops | | | The AWS profile to use for requests to AWS. This corresponds to the sops `--aws-profile` option. |
| **aws\_secret\_access\_key** string added in 1.0.0 of community.sops | | | The AWS secret access key to use for requests to AWS. Sets the environment variable `AWS_SECRET_ACCESS_KEY` for the sops call. |
| **aws\_session\_token** string added in 1.0.0 of community.sops | | | The AWS session token to use for requests to AWS. Sets the environment variable `AWS_SESSION_TOKEN` for the sops call. |
| **cache** boolean added in 0.2.0 of community.sops | **Choices:*** no
* **yes** ←
| ini entries: [community.sops]vars\_cache = yes env:ANSIBLE\_VARS\_SOPS\_PLUGIN\_CACHE | Whether to cache decrypted files or not. If the cache is disabled, the files will be decrypted for almost every task. This is very slow! Only disable caching if you modify the variable files during a playbook run and want the updated result to be available from the next task on. Note that setting *stage* to `inventory` has the same effect as setting *cache* to `true`: the variables will be loaded only once (during inventory loading) and the vars plugin will not be called for every task. |
| **config\_path** path added in 1.0.0 of community.sops | | | Path to the sops configuration file. If not set, sops will recursively search for the config file starting at the file that is encrypted or decrypted. This corresponds to the sops `--config` option. |
| **enable\_local\_keyservice** boolean added in 1.0.0 of community.sops | **Choices:*** **no** ←
* yes
| | Tell sops to use local key service. This corresponds to the sops `--enable-local-keyservice` option. |
| **keyservice** list / elements=string added in 1.0.0 of community.sops | | | Specify key services to use next to the local one. A key service must be specified in the form `protocol://address`, for example `tcp://myserver.com:5000`. This corresponds to the sops `--keyservice` option. |
| **sops\_binary** path added in 1.0.0 of community.sops | | | Path to the sops binary. By default uses `sops`. |
| **stage** string added in 0.2.0 of community.sops | **Choices:*** all
* task
* inventory
| ini entries: [community.sops]vars\_stage = None env:ANSIBLE\_VARS\_SOPS\_PLUGIN\_STAGE | Control when this vars plugin may be executed. Setting this option to `all` will run the vars plugin after importing inventory and whenever it is demanded by a task. Setting this option to `task` will only run the vars plugin whenever it is demanded by a task. Setting this option to `inventory` will only run the vars plugin after parsing inventory. If this option is omitted, the global *RUN\_VARS\_PLUGINS* configuration is used to determine when to execute the vars plugin. |
### Authors
* Edoardo Tenani (@endorama) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#1f7a393c2b29246b7a717e7176393c2c2824393c2a2d24393c2b27247e6d7b6a767170393c2b29247c7c)>
ansible community.zabbix.zabbix_valuemap – Create/update/delete Zabbix value maps community.zabbix.zabbix\_valuemap – Create/update/delete Zabbix value maps
==========================================================================
Note
This plugin is part of the [community.zabbix collection](https://galaxy.ansible.com/community/zabbix) (version 1.5.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.zabbix`.
To use it in a playbook, specify: `community.zabbix.zabbix_valuemap`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module allows you to create, modify and delete Zabbix value maps.
Requirements
------------
The below requirements are needed on the host that executes this module.
* zabbix-api >= 0.5.4
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **http\_login\_password** string | | Basic Auth password |
| **http\_login\_user** string | | Basic Auth login |
| **login\_password** string / required | | Zabbix user password. If not set the environment variable `ZABBIX_PASSWORD` will be used. |
| **login\_user** string / required | | Zabbix user name. If not set the environment variable `ZABBIX_USERNAME` will be used. |
| **mappings** list / elements=dictionary | | List of value mappings for the value map. Required when *state=present*. |
| | **map\_to** string / required | | Value to which the original value is mapped to. |
| | **value** string / required | | Original value. |
| **name** string / required | | Name of the value map. |
| **server\_url** string / required | | URL of Zabbix server, with protocol (http or https). `url` is an alias for `server_url`. If not set the environment variable `ZABBIX_SERVER` will be used.
aliases: url |
| **state** string | **Choices:*** **present** ←
* absent
| State of the value map. On `present`, it will create a value map if it does not exist or update the value map if the associated data is different. On `absent`, it will remove the value map if it exists. |
| **timeout** integer | **Default:**10 | The timeout of API request (seconds). |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. If not set the environment variable `ZABBIX_VALIDATE_CERTS` will be used. |
Notes
-----
Note
* If you use *login\_password=zabbix*, the word “zabbix” is replaced by “**\*\*\*\***” in all module output, because *login\_password* uses `no_log`. See [this FAQ](../../../network/user_guide/faq#why-is-my-output-sometimes-replaced-with) for more information.
Examples
--------
```
- name: Create a value map
local_action:
module: community.zabbix.zabbix_valuemap
server_url: http://zabbix.example.com
login_user: username
login_password: password
name: Numbers
mappings:
- value: 1
map_to: one
- value: 2
map_to: two
state: present
```
### Authors
* Ruben Tsirunyan (@rubentsirunyan)
ansible community.zabbix.zabbix_hostmacro – Create/update/delete Zabbix host macros community.zabbix.zabbix\_hostmacro – Create/update/delete Zabbix host macros
============================================================================
Note
This plugin is part of the [community.zabbix collection](https://galaxy.ansible.com/community/zabbix) (version 1.5.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.zabbix`.
To use it in a playbook, specify: `community.zabbix.zabbix_hostmacro`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* manages Zabbix host macros, it can create, update or delete them.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* zabbix-api >= 0.5.4
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **force** boolean | **Choices:*** no
* **yes** ←
| Only updates an existing macro if set to `yes`. |
| **host\_name** string / required | | Name of the host. |
| **http\_login\_password** string | | Basic Auth password |
| **http\_login\_user** string | | Basic Auth login |
| **login\_password** string / required | | Zabbix user password. If not set the environment variable `ZABBIX_PASSWORD` will be used. |
| **login\_user** string / required | | Zabbix user name. If not set the environment variable `ZABBIX_USERNAME` will be used. |
| **macro\_name** string / required | | Name of the host macro in zabbix native format `{$MACRO}` or simple format `MACRO`. |
| **macro\_type** string | **Choices:*** **text** ←
* secret
* vault
| Type of the host macro. text (default) secret (Works only with Zabbix >= 5.0) vault (Works only with Zabbix >= 5.2) |
| **macro\_value** string | | Value of the host macro. Required if *state=present*. |
| **server\_url** string / required | | URL of Zabbix server, with protocol (http or https). `url` is an alias for `server_url`. If not set the environment variable `ZABBIX_SERVER` will be used.
aliases: url |
| **state** string | **Choices:*** **present** ←
* absent
| State of the macro. On `present`, it will create if macro does not exist or update the macro if the associated data is different. On `absent` will remove a macro if it exists. |
| **timeout** integer | **Default:**10 | The timeout of API request (seconds). |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. If not set the environment variable `ZABBIX_VALIDATE_CERTS` will be used. |
Notes
-----
Note
* If you use *login\_password=zabbix*, the word “zabbix” is replaced by “**\*\*\*\***” in all module output, because *login\_password* uses `no_log`. See [this FAQ](../../../network/user_guide/faq#why-is-my-output-sometimes-replaced-with) for more information.
Examples
--------
```
- name: Create new host macro or update an existing macro's value
local_action:
module: community.zabbix.zabbix_hostmacro
server_url: http://monitor.example.com
login_user: username
login_password: password
host_name: ExampleHost
macro_name: EXAMPLE.MACRO
macro_value: Example value
state: present
# Values with curly brackets need to be quoted otherwise they will be interpreted as a dictionary
- name: Create new host macro in Zabbix native format
local_action:
module: community.zabbix.zabbix_hostmacro
server_url: http://monitor.example.com
login_user: username
login_password: password
host_name: ExampleHost
macro_name: "{$EXAMPLE.MACRO}"
macro_value: Example value
state: present
- name: Delete existing host macro
local_action:
module: community.zabbix.zabbix_hostmacro
server_url: http://monitor.example.com
login_user: username
login_password: password
host_name: ExampleHost
macro_name: "{$EXAMPLE.MACRO}"
state: absent
```
### Authors
* Cove (@cove)
* Dean Hailin Song (!UNKNOWN)
ansible community.zabbix.zabbix_user_info – Gather information about Zabbix user community.zabbix.zabbix\_user\_info – Gather information about Zabbix user
==========================================================================
Note
This plugin is part of the [community.zabbix collection](https://galaxy.ansible.com/community/zabbix) (version 1.5.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.zabbix`.
To use it in a playbook, specify: `community.zabbix.zabbix_user_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module allows you to search for Zabbix user entries.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* zabbix-api >= 0.5.4
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **alias** string / required | | Name of the user alias in Zabbix. |
| **http\_login\_password** string | | Basic Auth password |
| **http\_login\_user** string | | Basic Auth login |
| **login\_password** string / required | | Zabbix user password. If not set the environment variable `ZABBIX_PASSWORD` will be used. |
| **login\_user** string / required | | Zabbix user name. If not set the environment variable `ZABBIX_USERNAME` will be used. |
| **server\_url** string / required | | URL of Zabbix server, with protocol (http or https). `url` is an alias for `server_url`. If not set the environment variable `ZABBIX_SERVER` will be used.
aliases: url |
| **timeout** integer | **Default:**10 | The timeout of API request (seconds). |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. If not set the environment variable `ZABBIX_VALIDATE_CERTS` will be used. |
Notes
-----
Note
* If you use *login\_password=zabbix*, the word “zabbix” is replaced by “**\*\*\*\***” in all module output, because *login\_password* uses `no_log`. See [this FAQ](../../../network/user_guide/faq#why-is-my-output-sometimes-replaced-with) for more information.
Examples
--------
```
- name: Get zabbix user info
community.zabbix.zabbix_user_info:
server_url: "http://zabbix.example.com/zabbix/"
login_user: admin
login_password: secret
alias: example
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **zabbix\_user** dictionary | always | example **Sample:** {'alias': 'example', 'attempt\_clock': '0', 'attempt\_failed': '0', 'attempt\_ip': '', 'autologin': '0', 'autologout': '0', 'debug\_mode': '0', 'gui\_access': '0', 'lang': 'en\_GB', 'medias': [{'active': '0', 'mediaid': '668', 'mediatypeid': '1', 'period': '1-7,00:00-24:00', 'sendto': '[email protected]', 'severity': '63', 'userid': '660'}], 'name': 'user', 'refresh': '30s', 'rows\_per\_page': '50', 'surname': 'example', 'theme': 'default', 'type': '1', 'url': '', 'userid': '660', 'users\_status': '0', 'usrgrps': [{'debug\_mode': '0', 'gui\_access': '0', 'name': 'Guests', 'users\_status': '0', 'usrgrpid': '8'}]} |
### Authors
* sky-joker (@sky-joker)
| programming_docs |
ansible community.zabbix.zabbix_host – Create/update/delete Zabbix hosts community.zabbix.zabbix\_host – Create/update/delete Zabbix hosts
=================================================================
Note
This plugin is part of the [community.zabbix collection](https://galaxy.ansible.com/community/zabbix) (version 1.5.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.zabbix`.
To use it in a playbook, specify: `community.zabbix.zabbix_host`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module allows you to create, modify and delete Zabbix host entries and associated group and template data.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* zabbix-api >= 0.5.4
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **ca\_cert** string | | Required certificate issuer. Works only with >= Zabbix 3.0
aliases: tls\_issuer |
| **description** string | | Description of the host in Zabbix. |
| **force** boolean | **Choices:*** no
* **yes** ←
| Overwrite the host configuration, even if already present. |
| **host\_groups** list / elements=string | | List of host groups the host is part of. |
| **host\_name** string / required | | Name of the host in Zabbix.
*host\_name* is the unique identifier used and cannot be updated using this module. |
| **http\_login\_password** string | | Basic Auth password |
| **http\_login\_user** string | | Basic Auth login |
| **interfaces** list / elements=dictionary | **Default:**[] | List of interfaces to be created for the host (see example below). For more information, review host interface documentation at <https://www.zabbix.com/documentation/4.0/manual/api/reference/hostinterface/object> |
| | **bulk** integer | **Choices:*** 0
* 1
**Default:**1 | Whether to use bulk SNMP requests. Only valid when interface *type='snmp'*. 0 (don't use bulk requests), 1 (use bulk requests) Works only with Zabbix <= 4.4 and is silently ignored in higher versions. Use *details* with Zabbix >= 5.0. |
| | **details** dictionary | **Default:**{} | Additional details for SNMP host interfaces. Required when *type='snmp'*. Works only with Zabbix >= 5.0. |
| | | **authpassphrase** string | **Default:**"" | SNMPv3 authentication passphrase. Used when *securitylevel=1*(authNoPriv) or *securitylevel=2*(AuthPriv). |
| | | **authprotocol** integer | **Choices:*** 0
* 1
**Default:**0 | SNMPv3 authentication protocol. Used when *securitylevel=1*(authNoPriv) or *securitylevel=2*(AuthPriv). 0 (MD5), 1 (SHA) |
| | | **bulk** integer | **Choices:*** 0
* 1
**Default:**1 | Whether to use bulk SNMP requests. 0 (don't use bulk requests), 1 (use bulk requests) |
| | | **community** string | | SNMPv1 and SNMPv2 community string. Required when *version=1* or *version=2*. |
| | | **contextname** string | **Default:**"" | SNMPv3 context name. |
| | | **privpassphrase** string | **Default:**"" | SNMPv3 privacy passphrase. Used when *securitylevel=2*(AuthPriv). |
| | | **privprotocol** integer | **Choices:*** 0
* 1
**Default:**0 | SNMPv3 privacy protocol. Used when *securitylevel=2*(authPriv). 0 (DES), 1 (AES) |
| | | **securitylevel** integer | **Choices:*** 0
* 1
* 2
**Default:**0 | SNMPv3 security level. 0 (noAuthNoPriv), 1 (authNoPriv), 2 (authPriv). |
| | | **securityname** string | **Default:**"" | SNMPv3 security name. |
| | | **version** integer | **Choices:*** 1
* 2
* 3
**Default:**2 | SNMP version. 1 (SNMPv1), 2 (SNMPv2c), 3 (SNMPv3) |
| | **dns** string | **Default:**"" | DNS name of the host interface. Required if *useip=0*. |
| | **ip** string | **Default:**"" | IP address used by host interface. Required if *useip=1*. |
| | **main** integer | **Choices:*** 0
* 1
**Default:**0 | Whether the interface is used as default. If multiple interfaces with the same type are provided, only one can be default. 0 (not default), 1 (default) |
| | **port** string | | Port used by host interface. If not specified, default port for each type of interface is used 10050 if *type='agent'*
161 if *type='snmp'*
623 if *type='ipmi'*
12345 if *type='jmx'*
|
| | **type** string / required | **Choices:*** agent
* 1
* snmp
* 2
* ipmi
* 3
* jmx
* 4
| Interface type to add Numerical values are also accepted for interface type 1 = agent 2 = snmp 3 = ipmi 4 = jmx |
| | **useip** integer | **Choices:*** 0
* 1
**Default:**0 | Connect to host interface with IP address instead of DNS name. 0 (don't use ip), 1 (use ip) |
| **inventory\_mode** string | **Choices:*** automatic
* manual
* disabled
| Configure the inventory mode. |
| **inventory\_zabbix** dictionary | | Add Facts for a zabbix inventory (e.g. Tag) (see example below). Please review the interface documentation for more information on the supported properties <https://www.zabbix.com/documentation/3.2/manual/api/reference/host/object#host_inventory> |
| **ipmi\_authtype** integer | | IPMI authentication algorithm. Please review the Host object documentation for more information on the supported properties https://www.zabbix.com/documentation/3.4/manual/api/reference/host/object Possible values are, `0` (none), `1` (MD2), `2` (MD5), `4` (straight), `5` (OEM), `6` (RMCP+), with -1 being the API default. Please note that the Zabbix API will treat absent settings as default when updating any of the *ipmi\_*-options; this means that if you attempt to set any of the four options individually, the rest will be reset to default values. |
| **ipmi\_password** string | | IPMI password. also see the last note in the *ipmi\_authtype* documentation |
| **ipmi\_privilege** integer | | IPMI privilege level. Please review the Host object documentation for more information on the supported properties https://www.zabbix.com/documentation/3.4/manual/api/reference/host/object Possible values are `1` (callback), `2` (user), `3` (operator), `4` (admin), `5` (OEM), with `2` being the API default. also see the last note in the *ipmi\_authtype* documentation |
| **ipmi\_username** string | | IPMI username. also see the last note in the *ipmi\_authtype* documentation |
| **link\_templates** list / elements=string | | List of templates linked to the host. |
| **login\_password** string / required | | Zabbix user password. If not set the environment variable `ZABBIX_PASSWORD` will be used. |
| **login\_user** string / required | | Zabbix user name. If not set the environment variable `ZABBIX_USERNAME` will be used. |
| **macros** list / elements=dictionary | | List of user macros to assign to the zabbix host. Providing *macros=[]* with *force=yes* will clean all of the existing user macros from the host.
aliases: user\_macros |
| | **description** string | **Default:**"" | Description of the user macro. Works only with >= Zabbix 4.4. |
| | **macro** string / required | | Name of the user macro. Can be in zabbix native format "{$MACRO}" or short format "MACRO". |
| | **type** string | **Choices:*** **text** ←
* secret
| Type of the macro. Works only with >= Zabbix 5.0. Since value is not returned by API for secret macros, there is no reliable way to detect changes in the content of secret macro value. To update secret macro value, please update description alongside it so it passes the check. |
| | **value** string / required | | Value of the user macro. |
| **proxy** string | | The name of the Zabbix proxy to be used. |
| **server\_url** string / required | | URL of Zabbix server, with protocol (http or https). `url` is an alias for `server_url`. If not set the environment variable `ZABBIX_SERVER` will be used.
aliases: url |
| **state** string | **Choices:*** **present** ←
* absent
| State of the host. On `present`, it will create if host does not exist or update the host if the associated data is different. On `absent` will remove a host if it exists. |
| **status** string | **Choices:*** **enabled** ←
* disabled
| Monitoring status of the host. |
| **tags** list / elements=dictionary | | List of host tags to assign to the zabbix host. Works only with >= Zabbix 4.2. Providing *tags=[]* with *force=yes* will clean all of the tags from the host.
aliases: host\_tags |
| | **tag** string / required | | Name of the host tag. |
| | **value** string | **Default:**"" | Value of the host tag. |
| **timeout** integer | **Default:**10 | The timeout of API request (seconds). |
| **tls\_accept** integer | **Default:**1 | Specifies what types of connections are allowed for incoming connections. The tls\_accept parameter accepts values of 1 to 7 Possible values, 1 (no encryption), 2 (PSK), 4 (certificate). Values can be combined. Works only with >= Zabbix 3.0 |
| **tls\_connect** integer | **Default:**1 | Specifies what encryption to use for outgoing connections. Possible values, 1 (no encryption), 2 (PSK), 4 (certificate). Works only with >= Zabbix 3.0 |
| **tls\_psk** string | | PSK value is a hard to guess string of hexadecimal digits. The preshared key, at least 32 hex digits. Required if either *tls\_connect* or *tls\_accept* has PSK enabled. Works only with >= Zabbix 3.0 |
| **tls\_psk\_identity** string | | It is a unique name by which this specific PSK is referred to by Zabbix components Do not put sensitive information in the PSK identity string, it is transmitted over the network unencrypted. Works only with >= Zabbix 3.0 |
| **tls\_subject** string | | Required certificate subject. Works only with >= Zabbix 3.0 |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. If not set the environment variable `ZABBIX_VALIDATE_CERTS` will be used. |
| **visible\_name** string | | Visible name of the host in Zabbix. |
Notes
-----
Note
* If you use *login\_password=zabbix*, the word “zabbix” is replaced by “**\*\*\*\***” in all module output, because *login\_password* uses `no_log`. See [this FAQ](../../../network/user_guide/faq#why-is-my-output-sometimes-replaced-with) for more information.
Examples
--------
```
- name: Create a new host or update an existing host's info
local_action:
module: community.zabbix.zabbix_host
server_url: http://monitor.example.com
login_user: username
login_password: password
host_name: ExampleHost
visible_name: ExampleName
description: My ExampleHost Description
host_groups:
- Example group1
- Example group2
link_templates:
- Example template1
- Example template2
status: enabled
state: present
inventory_mode: manual
inventory_zabbix:
tag: "{{ your_tag }}"
alias: "{{ your_alias }}"
notes: "Special Informations: {{ your_informations | default('None') }}"
location: "{{ your_location }}"
site_rack: "{{ your_site_rack }}"
os: "{{ your_os }}"
hardware: "{{ your_hardware }}"
ipmi_authtype: 2
ipmi_privilege: 4
ipmi_username: username
ipmi_password: password
interfaces:
- type: 1
main: 1
useip: 1
ip: 10.xx.xx.xx
dns: ""
port: "10050"
- type: 4
main: 1
useip: 1
ip: 10.xx.xx.xx
dns: ""
port: "12345"
proxy: a.zabbix.proxy
macros:
- macro: '{$EXAMPLEMACRO}'
value: ExampleMacroValue
- macro: EXAMPLEMACRO2
value: ExampleMacroValue2
description: Example desc that work only with Zabbix 4.4 and higher
tags:
- tag: ExampleHostsTag
- tag: ExampleHostsTag2
value: ExampleTagValue
- name: Update an existing host's TLS settings
local_action:
module: community.zabbix.zabbix_host
server_url: http://monitor.example.com
login_user: username
login_password: password
host_name: ExampleHost
visible_name: ExampleName
host_groups:
- Example group1
tls_psk_identity: test
tls_connect: 2
tls_psk: 123456789abcdef123456789abcdef12
```
### Authors
* Cove (@cove)
* Tony Minfei Ding (!UNKNOWN)
* Harrison Gu (@harrisongu)
* Werner Dijkerman (@dj-wasabi)
* Eike Frost (@eikef)
ansible Community.Zabbix Community.Zabbix
================
Collection version 1.5.0
Plugin Index
------------
These are the plugins in the community.zabbix collection
### Inventory Plugins
* [zabbix\_inventory](zabbix_inventory_inventory#ansible-collections-community-zabbix-zabbix-inventory-inventory) – Zabbix Inventory Plugin
### Modules
* [zabbix\_action](zabbix_action_module#ansible-collections-community-zabbix-zabbix-action-module) – Create/Delete/Update Zabbix actions
* [zabbix\_discovery\_rule](zabbix_discovery_rule_module#ansible-collections-community-zabbix-zabbix-discovery-rule-module) – Create/delete/update Zabbix discovery rules
* [zabbix\_globalmacro](zabbix_globalmacro_module#ansible-collections-community-zabbix-zabbix-globalmacro-module) – Create/update/delete Zabbix Global macros
* [zabbix\_group](zabbix_group_module#ansible-collections-community-zabbix-zabbix-group-module) – Create/delete Zabbix host groups
* [zabbix\_group\_info](zabbix_group_info_module#ansible-collections-community-zabbix-zabbix-group-info-module) – Gather information about Zabbix hostgroup
* [zabbix\_host](zabbix_host_module#ansible-collections-community-zabbix-zabbix-host-module) – Create/update/delete Zabbix hosts
* [zabbix\_host\_events\_info](zabbix_host_events_info_module#ansible-collections-community-zabbix-zabbix-host-events-info-module) – Get all triggers about a Zabbix host
* [zabbix\_host\_info](zabbix_host_info_module#ansible-collections-community-zabbix-zabbix-host-info-module) – Gather information about Zabbix host
* [zabbix\_hostmacro](zabbix_hostmacro_module#ansible-collections-community-zabbix-zabbix-hostmacro-module) – Create/update/delete Zabbix host macros
* [zabbix\_maintenance](zabbix_maintenance_module#ansible-collections-community-zabbix-zabbix-maintenance-module) – Create Zabbix maintenance windows
* [zabbix\_map](zabbix_map_module#ansible-collections-community-zabbix-zabbix-map-module) – Create/update/delete Zabbix maps
* [zabbix\_mediatype](zabbix_mediatype_module#ansible-collections-community-zabbix-zabbix-mediatype-module) – Create/Update/Delete Zabbix media types
* [zabbix\_proxy](zabbix_proxy_module#ansible-collections-community-zabbix-zabbix-proxy-module) – Create/delete/get/update Zabbix proxies
* [zabbix\_proxy\_info](zabbix_proxy_info_module#ansible-collections-community-zabbix-zabbix-proxy-info-module) – Gather information about Zabbix proxy
* [zabbix\_screen](zabbix_screen_module#ansible-collections-community-zabbix-zabbix-screen-module) – Create/update/delete Zabbix screens
* [zabbix\_service](zabbix_service_module#ansible-collections-community-zabbix-zabbix-service-module) – Create/update/delete Zabbix service
* [zabbix\_template](zabbix_template_module#ansible-collections-community-zabbix-zabbix-template-module) – Create/update/delete/dump Zabbix template
* [zabbix\_template\_info](zabbix_template_info_module#ansible-collections-community-zabbix-zabbix-template-info-module) – Gather information about Zabbix template
* [zabbix\_user](zabbix_user_module#ansible-collections-community-zabbix-zabbix-user-module) – Create/update/delete Zabbix users
* [zabbix\_user\_info](zabbix_user_info_module#ansible-collections-community-zabbix-zabbix-user-info-module) – Gather information about Zabbix user
* [zabbix\_usergroup](zabbix_usergroup_module#ansible-collections-community-zabbix-zabbix-usergroup-module) – Create/delete/update Zabbix user groups
* [zabbix\_valuemap](zabbix_valuemap_module#ansible-collections-community-zabbix-zabbix-valuemap-module) – Create/update/delete Zabbix value maps
See also
List of [collections](../../index#list-of-collections) with docs hosted here.
ansible community.zabbix.zabbix_globalmacro – Create/update/delete Zabbix Global macros community.zabbix.zabbix\_globalmacro – Create/update/delete Zabbix Global macros
================================================================================
Note
This plugin is part of the [community.zabbix collection](https://galaxy.ansible.com/community/zabbix) (version 1.5.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.zabbix`.
To use it in a playbook, specify: `community.zabbix.zabbix_globalmacro`.
New in version 1.4.0: of community.zabbix
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* manages Zabbix Global macros, it can create, update or delete them.
* For macro\_type Secret the value field cannot be validated and will always be overwritten due to the secret nature of the Text.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* zabbix-api >= 0.5.4
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **force** boolean | **Choices:*** no
* **yes** ←
| Only updates an existing macro if set to `yes`. |
| **http\_login\_password** string | | Basic Auth password |
| **http\_login\_user** string | | Basic Auth login |
| **login\_password** string / required | | Zabbix user password. If not set the environment variable `ZABBIX_PASSWORD` will be used. |
| **login\_user** string / required | | Zabbix user name. If not set the environment variable `ZABBIX_USERNAME` will be used. |
| **macro\_description** string | | Text Description of the global macro. Works only with Zabbix >= 4.4 and is silently ignored in lower versions |
| **macro\_name** string / required | | Name of the global macro in zabbix native format `{$MACRO}` or simple format `MACRO`. |
| **macro\_type** string | **Choices:*** **text** ←
* secret
* vault
| Type of the global macro Text or Secret Text. Required if *state=present*. text secret - Secret Text Works only with Zabbix >= 5.0 and will default to Text in lower versions vault - Vault Secret Works only with Zabbix >= 5.2 and will default to Text in lower versions |
| **macro\_value** string | | Value of the global macro. Required if *state=present*. |
| **server\_url** string / required | | URL of Zabbix server, with protocol (http or https). `url` is an alias for `server_url`. If not set the environment variable `ZABBIX_SERVER` will be used.
aliases: url |
| **state** string | **Choices:*** **present** ←
* absent
| State of the macro. On `present`, it will create if macro does not exist or update the macro if the associated data is different. On `absent` will remove a macro if it exists. |
| **timeout** integer | **Default:**10 | The timeout of API request (seconds). |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. If not set the environment variable `ZABBIX_VALIDATE_CERTS` will be used. |
Notes
-----
Note
* If you use *login\_password=zabbix*, the word “zabbix” is replaced by “**\*\*\*\***” in all module output, because *login\_password* uses `no_log`. See [this FAQ](../../../network/user_guide/faq#why-is-my-output-sometimes-replaced-with) for more information.
Examples
--------
```
- name: Create new global macro or update an existing macro's value
local_action:
module: community.zabbix.zabbix_globalmacro
server_url: http://monitor.example.com
login_user: username
login_password: password
macro_name: EXAMPLE.MACRO
macro_value: Example value
macro_type: 0
macro_description: Example description
state: present
# Values with curly brackets need to be quoted otherwise they will be interpreted as a dictionary
- name: Create new global macro in Zabbix native format with Secret Type
local_action:
module: community.zabbix.zabbix_globalmacro
server_url: http://monitor.example.com
login_user: username
login_password: password
macro_name: "{$EXAMPLE.MACRO}"
macro_value: Example value
macro_type: 1
macro_description: Example description
state: present
- name: Delete existing global macro
local_action:
module: community.zabbix.zabbix_globalmacro
server_url: http://monitor.example.com
login_user: username
login_password: password
macro_name: "{$EXAMPLE.MACRO}"
state: absent
```
### Authors
* Cove (@cove)
* Dean Hailin Song (!UNKNOWN)
* Timothy Test (@ttestscripting)
| programming_docs |
ansible community.zabbix.zabbix_screen – Create/update/delete Zabbix screens community.zabbix.zabbix\_screen – Create/update/delete Zabbix screens
=====================================================================
Note
This plugin is part of the [community.zabbix collection](https://galaxy.ansible.com/community/zabbix) (version 1.5.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.zabbix`.
To use it in a playbook, specify: `community.zabbix.zabbix_screen`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module allows you to create, modify and delete Zabbix screens and associated graph data.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* zabbix-api >= 0.5.4
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **http\_login\_password** string | | Basic Auth password |
| **http\_login\_user** string | | Basic Auth login |
| **login\_password** string / required | | Zabbix user password. If not set the environment variable `ZABBIX_PASSWORD` will be used. |
| **login\_user** string / required | | Zabbix user name. If not set the environment variable `ZABBIX_USERNAME` will be used. |
| **screens** list / elements=dictionary / required | | List of screens to be created/updated/deleted (see example). |
| | **graph\_height** integer | | Graph height will be set in graph settings. |
| | **graph\_names** list / elements=string | | Graph names will be added to a screen. Case insensitive. Required if *state=present*. |
| | **graph\_width** integer | | Graph width will be set in graph settings. |
| | **graphs\_in\_row** integer | **Default:**3 | Limit columns of a screen and make multiple rows. |
| | **host\_group** list / elements=string | | Host group(s) will be used for searching hosts. Required if *state=present*.
aliases: host\_groups |
| | **screen\_name** string / required | | Screen name will be used. If a screen has already been added, the screen name won't be updated. |
| | **sort** boolean | **Choices:*** **no** ←
* yes
| Sort hosts alphabetically. If there are numbers in hostnames, leading zero should be used. |
| | **state** string | **Choices:*** absent
* **present** ←
|
*present* - Create a screen if it doesn't exist. If the screen already exists, the screen will be updated as needed.
*absent* - If a screen exists, the screen will be deleted. |
| **server\_url** string / required | | URL of Zabbix server, with protocol (http or https). `url` is an alias for `server_url`. If not set the environment variable `ZABBIX_SERVER` will be used.
aliases: url |
| **timeout** integer | **Default:**10 | The timeout of API request (seconds). |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. If not set the environment variable `ZABBIX_VALIDATE_CERTS` will be used. |
Notes
-----
Note
* Too many concurrent updates to the same screen may cause Zabbix to return errors, see examples for a workaround if needed.
* If you use *login\_password=zabbix*, the word “zabbix” is replaced by “**\*\*\*\***” in all module output, because *login\_password* uses `no_log`. See [this FAQ](../../../network/user_guide/faq#why-is-my-output-sometimes-replaced-with) for more information.
Examples
--------
```
# Create/update a screen.
- name: Create a new screen or update an existing screen's items 5 in a row
local_action:
module: community.zabbix.zabbix_screen
server_url: http://monitor.example.com
login_user: username
login_password: password
screens:
- screen_name: ExampleScreen1
host_group: Example group1
state: present
graph_names:
- Example graph1
- Example graph2
graph_width: 200
graph_height: 100
graphs_in_row: 5
# Create/update multi-screen
- name: Create two of new screens or update the existing screens' items
local_action:
module: community.zabbix.zabbix_screen
server_url: http://monitor.example.com
login_user: username
login_password: password
screens:
- screen_name: ExampleScreen1
host_group: Example group1
state: present
graph_names:
- Example graph1
- Example graph2
graph_width: 200
graph_height: 100
- screen_name: ExampleScreen2
host_group: Example group2
state: present
graph_names:
- Example graph1
- Example graph2
graph_width: 200
graph_height: 100
# Limit the Zabbix screen creations to one host since Zabbix can return an error when doing concurrent updates
- name: Create a new screen or update an existing screen's items
local_action:
module: community.zabbix.zabbix_screen
server_url: http://monitor.example.com
login_user: username
login_password: password
state: present
screens:
- screen_name: ExampleScreen
host_group: Example group
state: present
graph_names:
- Example graph1
- Example graph2
graph_width: 200
graph_height: 100
when: inventory_hostname==groups['group_name'][0]
# Create/update using multiple hosts_groups. Hosts NOT present in all listed host_groups will be skipped.
- name: Create new screen or update the existing screen's items for hosts in both given groups
local_action:
module: community.zabbix.zabbix_screen
server_url: http://monitor.example.com
login_user: username
login_password: password
screens:
- screen_name: ExampleScreen1
host_group:
- Example group1
- Example group2
state: present
graph_names:
- Example graph1
- Example graph2
graph_width: 200
graph_height: 100
```
### Authors
* Cove (@cove)
* Tony Minfei Ding (!UNKNOWN)
* Harrison Gu (@harrisongu)
ansible community.zabbix.zabbix_inventory – Zabbix Inventory Plugin community.zabbix.zabbix\_inventory – Zabbix Inventory Plugin
============================================================
Note
This plugin is part of the [community.zabbix collection](https://galaxy.ansible.com/community/zabbix) (version 1.5.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.zabbix`.
To use it in a playbook, specify: `community.zabbix.zabbix_inventory`.
New in version 1.4.0: of community.zabbix
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* Zabbix Inventory plugin
* All vars from zabbix are prefixed with [zbx\_](#id5)
Requirements
------------
The below requirements are needed on the local controller node that executes this inventory.
* python >= 2.6
* zabbix-api >= 0.5.4
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **add\_zabbix\_groups** boolean | **Choices:*** **no** ←
* yes
| | If set to True, hosts will be added to groups based on their zabbix groups |
| **cache** boolean | **Choices:*** **no** ←
* yes
| ini entries: [inventory]cache = no env:ANSIBLE\_INVENTORY\_CACHE | Toggle to enable/disable the caching of the inventory's source data, requires a cache plugin setup to work. |
| **cache\_connection** string | | ini entries: [defaults]fact\_caching\_connection = None [inventory]cache\_connection = None env:ANSIBLE\_CACHE\_PLUGIN\_CONNECTION env:ANSIBLE\_INVENTORY\_CACHE\_CONNECTION | Cache connection data or path, read cache plugin documentation for specifics. |
| **cache\_plugin** string | **Default:**"memory" | ini entries: [defaults]fact\_caching = memory [inventory]cache\_plugin = memory env:ANSIBLE\_CACHE\_PLUGIN env:ANSIBLE\_INVENTORY\_CACHE\_PLUGIN | Cache plugin to use for the inventory's source data. |
| **cache\_prefix** string | **Default:**"ansible\_inventory\_" | ini entries: [default]fact\_caching\_prefix = ansible\_inventory\_ [inventory]cache\_prefix = ansible\_inventory\_ env:ANSIBLE\_CACHE\_PLUGIN\_PREFIX env:ANSIBLE\_INVENTORY\_CACHE\_PLUGIN\_PREFIX | Prefix to use for cache plugin files/tables |
| **cache\_timeout** integer | **Default:**3600 | ini entries: [defaults]fact\_caching\_timeout = 3600 [inventory]cache\_timeout = 3600 env:ANSIBLE\_CACHE\_PLUGIN\_TIMEOUT env:ANSIBLE\_INVENTORY\_CACHE\_TIMEOUT | Cache duration in seconds |
| **compose** dictionary | **Default:**{} | | Create vars from jinja2 expressions. |
| **groups** dictionary | **Default:**{} | | Add hosts to group based on Jinja2 conditionals. |
| **host\_zapi\_query** dictionary | **Default:**{} | | API query for hosts - see zabbix documentation for more details <https://www.zabbix.com/documentation/current/manual/api/reference/host/get>
|
| | **selectApplications** string | | | query Return an applications property with host applications. To return all values specify 'extend' Can be limited to different fields for example setting the vaule to ['name'] will only return the name Additional fields can be specified by comma seperated value ['name', 'field2'] Please see <https://www.zabbix.com/documentation/current/manual/api/reference/application/object> for more details on field names |
| | **selectDashboards** string | | | query Return a dashboards property. To return all values specify 'extend' Can be limited to different fields for example setting the vaule to ['name'] will only return the name Additional fields can be specified by comma seperated value ['name', 'field2'] Please see <https://www.zabbix.com/documentation/current/manual/api/reference/templatedashboard/object> for more details on field names |
| | **selectDiscoveries** string | | | query Return a discoveries property with host low-level discovery rules. To return all values specify 'extend' Can be limited to different fields for example setting the vaule to ['name'] will only return the name Additional fields can be specified by comma seperated value ['name', 'field2'] Please see <https://www.zabbix.com/documentation/current/manual/api/reference/discoveryrule/object> for more details on field names |
| | **selectDiscoveryRule** string | | | query Return a discoveryRule property with the low-level discovery rule that created the host (from host prototype in VMware monitoring). To return all values specify 'extend' Can be limited to different fields for example setting the vaule to ['name'] will only return the name Additional fields can be specified by comma seperated value ['name', 'field2'] please see <https://www.zabbix.com/documentation/current/manual/api/reference/discoveryrule/object> for more details on field names |
| | **selectGraphs** string | | | query Return a discoveries property with host low-level discovery rules. To return all values specify 'extend' Can be limited to different fields for example setting the vaule to ['name'] will only return the name Additional fields can be specified by comma seperated value ['name', 'field2'] Please see <https://www.zabbix.com/documentation/current/manual/api/reference/graph/object> for more details on field names |
| | **selectGroups** string | | | query Return a groups property with host groups data that the host belongs to. To return all values specify 'extend' Can be limited to different fields for example setting the vaule to ['name'] will only return the name Additional fields can be specified by comma seperated value ['name', 'field2'] Please see <https://www.zabbix.com/documentation/current/manual/api/reference/hostgroup/object> for more details on field names |
| | **selectHostDiscovery** string | | | query Return a hostDiscovery property with host discovery object data. To return all values specify 'extend' Can be limited to different fields for example setting the vaule to ['name'] will only return the name Additional fields can be specified by comma seperated value ['name', 'field2'] Please see <https://www.zabbix.com/documentation/current/manual/api/reference/host/get> for more details on field names |
| | **selectHttpTests** string | | | query Return an httpTests property with host web scenarios. To return all values specify 'extend' Can be limited to different fields for example setting the vaule to ['name'] will only return the name Additional fields can be specified by comma seperated value ['name', 'field2'] Please see <https://www.zabbix.com/documentation/current/manual/api/reference/httptest/object> for more details on field names |
| | **selectInheritedTags** string | | | query Return an inheritedTags property with tags that are on all templates which are linked to host. To return all values specify 'extend' Can be limited to different fields for example setting the vaule to ['name'] will only return the name Additional fields can be specified by comma seperated value ['name', 'field2'] Please see <https://www.zabbix.com/documentation/current/manual/api/reference/host/object#host_tag> for more details on field names |
| | **selectInterfaces** string | | | query Return an interfaces property with host interfaces. To return all values specify 'extend' Can be limited to different fields for example setting the vaule to ['name'] will only return the name Additional fields can be specified by comma seperated value ['name', 'field2'] Please see <https://www.zabbix.com/documentation/current/manual/api/reference/hostinterface/object> for more details on field names |
| | **selectInventory** string | | | query Return an inventory property with host inventory data. To return all values specify 'extend' Can be limited to different fields for example setting the vaule to ['name'] will only return the name Additional fields can be specified by comma seperated value ['name', 'field2'] Please see <https://www.zabbix.com/documentation/current/manual/api/reference/host/object#host_inventory> for more details on field names |
| | **selectItems** string | | | query Return an items property with host items. To return all values specify 'extend' Can be limited to different fields for example setting the vaule to ['name'] will only return the name Additional fields can be specified by comma seperated value ['name', 'field2'] Please see <https://www.zabbix.com/documentation/current/manual/api/reference/item/object> for more details on field names |
| | **selectMacros** string | | | query Return a macros property with host macros. To return all values specify 'extend' Can be limited to different fields for example setting the vaule to ['name'] will only return the name Additional fields can be specified by comma seperated value ['name', 'field2'] Please see <https://www.zabbix.com/documentation/current/manual/api/reference/usermacro/object> for more details on field names |
| | **selectParentTemplates** string | | | query Return a parentTemplates property with templates that the host is linked to To return all values specify 'extend' Can be limited to different fields for example setting the vaule to ['name'] will only return the name Additional fields can be specified by comma seperated value ['name', 'field2'] Please see <https://www.zabbix.com/documentation/current/manual/api/reference/template/object> for more details on field names |
| | **selectTags** string | | | query Return a tags property with host tags. To return all values specify 'extend' Can be limited to different fields for example setting the vaule to ['name'] will only return the name Additional fields can be specified by comma seperated value ['name', 'field2'] Please see <https://www.zabbix.com/documentation/current/manual/api/reference/host/object#host_tag> for more details on field names |
| | **selectTriggers** string | | | query Return a triggers property with host triggers. To return all values specify 'extend' Can be limited to different fields for example setting the vaule to ['name'] will only return the name Additional fields can be specified by comma seperated value ['name', 'field2'] Please see <https://www.zabbix.com/documentation/current/manual/api/reference/host/object#host_tag> for more details on field names |
| **http\_login\_password** string | | | Basic Auth password |
| **http\_login\_user** string | | | Basic Auth login |
| **keyed\_groups** list / elements=string | **Default:**[] | | Add hosts to group based on the values of a variable. |
| **leading\_separator** boolean added in 2.11 of ansible.builtin | **Choices:*** no
* **yes** ←
| | 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. |
| **login\_password** string / required | | env:ZABBIX\_PASSWORD | Zabbix user password. |
| **login\_user** string / required | | env:ZABBIX\_USERNAME | Zabbix user name. |
| **proxy** string | **Default:**"" | | Proxy server to use for reaching zabbix API |
| **server\_url** string / required | | env:ZABBIX\_SERVER | URL of Zabbix server, with protocol (http or https). `url` is an alias for `server_url`.
aliases: url |
| **strict** boolean | **Choices:*** **no** ←
* yes
| | If `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. |
| **timeout** integer | **Default:**10 | | The timeout of API request (seconds). |
| **use\_extra\_vars** boolean added in 2.11 of ansible.builtin | **Choices:*** **no** ←
* yes
| ini entries: [inventory\_plugins]use\_extra\_vars = no env:ANSIBLE\_INVENTORY\_USE\_EXTRA\_VARS | Merge extra vars into the available variables for composition (highest precedence). |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| env:ZABBIX\_VALIDATE\_CERTS | If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. |
Examples
--------
```
# Simple Inventory Plugin example
# This will create an inventory with details from zabbix such as applications name, applicaitonids, Parent Template Name, and group membership name
#It will also create 2 ansible inventory groups for enabled and disabled hosts in zabbix based on the status field.
plugin: community.zabbix.zabbix_inventory
server_url: https://zabbix.com
login_user: Admin
login_password: password
host_zapi_query:
selectApplications: ['name', 'applicationid']
selectParentTemplates: ['name']
selectGroups: ['name']
validate_certs: false
groups:
enabled: zbx_status == "0"
disabled: zbx_status == "1"
#Using Keyed Groups
plugin: community.zabbix.zabbix_inventory
server_url: https://zabbix.com
login_user: Admin
login_password: password
validate_certs: false
keyed_groups:
- key: zbx_status | lower
prefix: 'env'
- key: zbx_description | lower
prefix: 'test'
separator: ''
#Using proxy format of proxy is 'http://<user>:<pass>@<proxy>:<port>' or 'http://<proxy>:<port>'
plugin: community.zabbix.zabbix_inventory
server_url: https://zabbix.com
proxy: http://someproxy:8080
login_user: Admin
login_password: password
validate_certs: false
#Organize inventory groups based on zabbix host groups
plugin: community.zabbix.zabbix_inventory
server_url: https://zabbix.com
add_zabbix_groups: true
login_user: Admin
login_password: password
validate_certs: false
#Using compose to modify vars
plugin: community.zabbix.zabbix_inventory
server_url: https://zabbix.com
login_user: Admin
login_password: password
validate_certs: false
compose:
zbx_testvar: zbx_status.replace("1", "Disabled")
```
### Authors
* Timothy Test (@ttestscripting)
| programming_docs |
ansible community.zabbix.zabbix_template_info – Gather information about Zabbix template community.zabbix.zabbix\_template\_info – Gather information about Zabbix template
==================================================================================
Note
This plugin is part of the [community.zabbix collection](https://galaxy.ansible.com/community/zabbix) (version 1.5.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.zabbix`.
To use it in a playbook, specify: `community.zabbix.zabbix_template_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module allows you to search for Zabbix template.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* zabbix-api >= 0.5.4
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **format** string | **Choices:*** **json** ←
* xml
| Format to use when dumping template. |
| **http\_login\_password** string | | Basic Auth password |
| **http\_login\_user** string | | Basic Auth login |
| **login\_password** string / required | | Zabbix user password. If not set the environment variable `ZABBIX_PASSWORD` will be used. |
| **login\_user** string / required | | Zabbix user name. If not set the environment variable `ZABBIX_USERNAME` will be used. |
| **omit\_date** boolean | **Choices:*** **no** ←
* yes
| Removes the date field for the dumped template |
| **server\_url** string / required | | URL of Zabbix server, with protocol (http or https). `url` is an alias for `server_url`. If not set the environment variable `ZABBIX_SERVER` will be used.
aliases: url |
| **template\_name** string / required | | Name of the template in Zabbix. |
| **timeout** integer | **Default:**10 | The timeout of API request (seconds). |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. If not set the environment variable `ZABBIX_VALIDATE_CERTS` will be used. |
Notes
-----
Note
* If you use *login\_password=zabbix*, the word “zabbix” is replaced by “**\*\*\*\***” in all module output, because *login\_password* uses `no_log`. See [this FAQ](../../../network/user_guide/faq#why-is-my-output-sometimes-replaced-with) for more information.
Examples
--------
```
- name: Get Zabbix template as JSON
community.zabbix.zabbix_template_info:
server_url: "http://zabbix.example.com/zabbix/"
login_user: admin
login_password: secret
template_name: Template
format: json
omit_date: yes
register: template_json
- name: Get Zabbix template as XML
community.zabbix.zabbix_template_info:
server_url: "http://zabbix.example.com/zabbix/"
login_user: admin
login_password: secret
template_name: Template
format: xml
omit_date: no
register: template_json
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **template\_json** string | when format is json and omit\_date is true | The JSON of the template **Sample:** {'zabbix\_export': {'groups': [{'name': 'Templates'}], 'templates': [{'applications': [{'name': 'Test Application'}], 'description': 'Testing template import', 'discovery\_rules': [], 'groups': [{'name': 'Templates'}], 'httptests': [], 'items': [], 'macros': [], 'name': 'Template for Testing', 'screens': [], 'template': 'Test Template', 'templates': []}], 'version': '4.0'}} |
| **template\_xml** string | when format is xml and omit\_date is false | The XML of the template **Sample:** <zabbix\_export> <version>4.0</version> <date>2019-10-27T14:49:57Z</date> <groups> <group> <name>Templates</name> </group> </groups> <templates> <template> <template>Test Template</template> <name>Template for Testing</name> <description>Testing template import</description> <groups> <group> <name>Templates</name> </group> </groups> <applications> <application> <name>Test Application</name> </application> </applications> <items /> <discovery\_rules /> <httptests /> <macros /> <templates /> <screens /> </template> </templates> </zabbix\_export> |
### Authors
* sky-joker (@sky-joker)
ansible community.zabbix.zabbix_proxy – Create/delete/get/update Zabbix proxies community.zabbix.zabbix\_proxy – Create/delete/get/update Zabbix proxies
========================================================================
Note
This plugin is part of the [community.zabbix collection](https://galaxy.ansible.com/community/zabbix) (version 1.5.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.zabbix`.
To use it in a playbook, specify: `community.zabbix.zabbix_proxy`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module allows you to create, modify, get and delete Zabbix proxy entries.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* zabbix-api >= 0.5.4
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **ca\_cert** string | | Certificate issuer.
aliases: tls\_issuer |
| **description** string | | Description of the proxy. |
| **http\_login\_password** string | | Basic Auth password |
| **http\_login\_user** string | | Basic Auth login |
| **interface** dictionary | **Default:**{} | Dictionary with params for the interface when proxy is in passive mode. For more information, review proxy interface documentation at
<https://www.zabbix.com/documentation/4.0/manual/api/reference/proxy/object#proxy_interface>. |
| | **dns** string | **Default:**"" | DNS name of the proxy interface. Required if *useip=0*. |
| | **ip** string | **Default:**"" | IP address used by proxy interface. Required if *useip=1*. |
| | **main** integer | **Default:**0 | Whether the interface is used as default. This suboption is currently ignored for Zabbix proxy. This suboption is deprecated since Ansible 2.10 and will eventually be removed in 2.14. |
| | **port** string | **Default:**"10051" | Port used by proxy interface. |
| | **type** integer | **Default:**0 | Interface type to add. This suboption is currently ignored for Zabbix proxy. This suboption is deprecated since Ansible 2.10 and will eventually be removed in 2.14. |
| | **useip** integer | **Choices:*** 0
* 1
**Default:**0 | Connect to proxy interface with IP address instead of DNS name. 0 (don't use ip), 1 (use ip). |
| **login\_password** string / required | | Zabbix user password. If not set the environment variable `ZABBIX_PASSWORD` will be used. |
| **login\_user** string / required | | Zabbix user name. If not set the environment variable `ZABBIX_USERNAME` will be used. |
| **proxy\_address** string | | Comma-delimited list of IP/CIDR addresses or DNS names to accept active proxy requests from. Requires *status=active*. Works only with >= Zabbix 4.0. ( remove option for <= 4.0 ) |
| **proxy\_name** string / required | | Name of the proxy in Zabbix. |
| **server\_url** string / required | | URL of Zabbix server, with protocol (http or https). `url` is an alias for `server_url`. If not set the environment variable `ZABBIX_SERVER` will be used.
aliases: url |
| **state** string | **Choices:*** **present** ←
* absent
| State of the proxy. On `present`, it will create if proxy does not exist or update the proxy if the associated data is different. On `absent` will remove a proxy if it exists. |
| **status** string | **Choices:*** **active** ←
* passive
| Type of proxy. (4 - active, 5 - passive) |
| **timeout** integer | **Default:**10 | The timeout of API request (seconds). |
| **tls\_accept** string | **Choices:*** **no\_encryption** ←
* PSK
* certificate
| Connections from proxy. |
| **tls\_connect** string | **Choices:*** **no\_encryption** ←
* PSK
* certificate
| Connections to proxy. |
| **tls\_psk** string | | The preshared key, at least 32 hex digits. Required if either *tls\_connect* or *tls\_accept* has PSK enabled. |
| **tls\_psk\_identity** string | | PSK identity. Required if either *tls\_connect* or *tls\_accept* has PSK enabled. |
| **tls\_subject** string | | Certificate subject. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. If not set the environment variable `ZABBIX_VALIDATE_CERTS` will be used. |
Notes
-----
Note
* If you use *login\_password=zabbix*, the word “zabbix” is replaced by “**\*\*\*\***” in all module output, because *login\_password* uses `no_log`. See [this FAQ](../../../network/user_guide/faq#why-is-my-output-sometimes-replaced-with) for more information.
Examples
--------
```
- name: Create or update a proxy with proxy type active
local_action:
module: community.zabbix.zabbix_proxy
server_url: http://monitor.example.com
login_user: username
login_password: password
proxy_name: ExampleProxy
description: ExampleProxy
status: active
state: present
proxy_address: ExampleProxy.local
- name: Create a new passive proxy using only it's IP
local_action:
module: community.zabbix.zabbix_proxy
server_url: http://monitor.example.com
login_user: username
login_password: password
proxy_name: ExampleProxy
description: ExampleProxy
status: passive
state: present
interface:
useip: 1
ip: 10.1.1.2
port: 10051
- name: Create a new passive proxy using only it's DNS
local_action:
module: community.zabbix.zabbix_proxy
server_url: http://monitor.example.com
login_user: username
login_password: password
proxy_name: ExampleProxy
description: ExampleProxy
status: passive
state: present
interface:
dns: proxy.example.com
port: 10051
```
### Authors
* Alen Komic (@akomic)
ansible community.zabbix.zabbix_proxy_info – Gather information about Zabbix proxy community.zabbix.zabbix\_proxy\_info – Gather information about Zabbix proxy
============================================================================
Note
This plugin is part of the [community.zabbix collection](https://galaxy.ansible.com/community/zabbix) (version 1.5.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.zabbix`.
To use it in a playbook, specify: `community.zabbix.zabbix_proxy_info`.
New in version 1.5.0: of community.zabbix
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module allows you to obtain detailed information about configured zabbix proxies.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* zabbix-api >= 0.5.4
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **http\_login\_password** string | | Basic Auth password |
| **http\_login\_user** string | | Basic Auth login |
| **login\_password** string / required | | Zabbix user password. If not set the environment variable `ZABBIX_PASSWORD` will be used. |
| **login\_user** string / required | | Zabbix user name. If not set the environment variable `ZABBIX_USERNAME` will be used. |
| **proxy\_hosts** boolean | **Choices:*** **no** ←
* yes
| Also return list of hosts monitored by the proxy. |
| **proxy\_name** string / required | | Name of the Zabbix proxy. |
| **server\_url** string / required | | URL of Zabbix server, with protocol (http or https). `url` is an alias for `server_url`. If not set the environment variable `ZABBIX_SERVER` will be used.
aliases: url |
| **timeout** integer | **Default:**10 | The timeout of API request (seconds). |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. If not set the environment variable `ZABBIX_VALIDATE_CERTS` will be used. |
Notes
-----
Note
* If you use *login\_password=zabbix*, the word “zabbix” is replaced by “**\*\*\*\***” in all module output, because *login\_password* uses `no_log`. See [this FAQ](../../../network/user_guide/faq#why-is-my-output-sometimes-replaced-with) for more information.
Examples
--------
```
- name: Get zabbix proxy info alongside the list of hosts monitored by the proxy
community.zabbix.zabbix_proxy_info:
server_url: "http://zabbix.example.com/zabbix/"
login_user: admin
login_password: secret
proxy_name: zbx01.example.com
proxy_hosts: True
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **zabbix\_proxy** dictionary | always | example **Sample:** {'auto\_compress': '1', 'custom\_interfaces': '0', 'description': 'ExampleProxy', 'discover': '0', 'flags': '0', 'host': 'ExampleProxy', 'hosts': [{'host': 'ExampleHost', 'hostid': '10453'}], 'interface': {'available': '0', 'details': [], 'disable\_until': '0', 'dns': 'ExampleProxy.local', 'error': '', 'errors\_from': '0', 'hostid': '10452', 'interfaceid': '10', 'ip': '10.1.1.2', 'main': '1', 'port': '10051', 'type': '0', 'useip': '1'}, 'ipmi\_authtype': '-1', 'ipmi\_password': '', 'ipmi\_privilege': '2', 'ipmi\_username': '', 'lastaccess': '0', 'maintenance\_from': '0', 'maintenance\_status': '0', 'maintenance\_type': '0', 'maintenanceid': '0', 'name': '', 'proxy\_address': '', 'proxy\_hostid': '0', 'proxyid': '10452', 'status': '6', 'templateid': '0', 'tls\_accept': '1', 'tls\_connect': '1', 'tls\_issuer': '', 'tls\_subject': '', 'uuid': ''} |
### Authors
* Dusan Matejka (@D3DeFi)
ansible community.zabbix.zabbix_host_events_info – Get all triggers about a Zabbix host community.zabbix.zabbix\_host\_events\_info – Get all triggers about a Zabbix host
==================================================================================
Note
This plugin is part of the [community.zabbix collection](https://galaxy.ansible.com/community/zabbix) (version 1.5.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.zabbix`.
To use it in a playbook, specify: `community.zabbix.zabbix_host_events_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module allows you to see if a Zabbix host have no active alert to make actions on it. For this case use module Ansible ‘fail’ to exclude host in trouble.
* Length of “triggers\_ok” allow if template’s triggers exist for Zabbix Host
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7
* zabbix-api >= 0.5.3
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **host\_id\_type** string | **Choices:*** **hostname** ←
* visible\_name
* hostid
| Type of host\_identifier |
| **host\_identifier** string / required | | Identifier of Zabbix Host |
| **http\_login\_password** string | | Basic Auth password |
| **http\_login\_user** string | | Basic Auth login |
| **login\_password** string / required | | Zabbix user password. If not set the environment variable `ZABBIX_PASSWORD` will be used. |
| **login\_user** string / required | | Zabbix user name. If not set the environment variable `ZABBIX_USERNAME` will be used. |
| **server\_url** string / required | | URL of Zabbix server, with protocol (http or https). `url` is an alias for `server_url`. If not set the environment variable `ZABBIX_SERVER` will be used.
aliases: url |
| **timeout** integer | **Default:**10 | The timeout of API request (seconds). |
| **trigger\_severity** string | **Choices:*** not\_classified
* information
* warning
* **average** ←
* high
* disaster
| Zabbix severity for search filter |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. If not set the environment variable `ZABBIX_VALIDATE_CERTS` will be used. |
Notes
-----
Note
* If you use *login\_password=zabbix*, the word “zabbix” is replaced by “**\*\*\*\***” in all module output, because *login\_password* uses `no_log`. See [this FAQ](../../../network/user_guide/faq#why-is-my-output-sometimes-replaced-with) for more information.
Examples
--------
```
- name: exclude machine if alert active on it
community.zabbix.zabbix_host_events_info:
server_url: "{{ zabbix_api_server_url }}"
login_user: "{{ lookup('env','ZABBIX_USER') }}"
login_password: "{{ lookup('env','ZABBIX_PASSWORD') }}"
host_identifier: "{{inventory_hostname}}"
host_id_type: "hostname"
timeout: 120
register: zbx_host
delegate_to: localhost
- fail:
msg: "machine alert in zabbix"
when: zbx_host['triggers_problem']|length > 0
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **triggers\_ok** complex | On success | Host Zabbix Triggers in OK state |
| | **comments** string | success | Additional description of the trigger |
| | **description** string | success | Name of the trigger |
| | **error** string | success | Error text if there have been any problems when updating the state of the trigger |
| | **expression** string | success | Reduced trigger expression |
| | **flags** integer | success | Origin of the trigger |
| | **lastchange** integer | success | Time when the trigger last changed its state (timestamp) |
| | **priority** integer | success | Severity of the trigger |
| | **state** integer | success | State of the trigger |
| | **status** integer | success | Whether the trigger is enabled or disabled |
| | **templateid** integer | success | ID of the parent template trigger |
| | **triggerid** integer | success | ID of the trigger |
| | **type** integer | success | Whether the trigger can generate multiple problem events |
| | **url** string | success | URL associated with the trigger |
| | **value** integer | success | Whether the trigger is in OK or problem state |
| **triggers\_problem** complex | On success | Host Zabbix Triggers in problem state. See trigger and event objects in API documentation of your zabbix version for more |
| | **comments** string | success | Additional description of the trigger |
| | **description** string | success | Name of the trigger |
| | **error** string | success | Error text if there have been any problems when updating the state of the trigger |
| | **expression** string | success | Reduced trigger expression |
| | **flags** integer | success | Origin of the trigger |
| | **last\_event** complex | success | last event informations |
| | | **acknowledged** integer | success | If set to true return only acknowledged events |
| | | **acknowledges** complex | success | acknowledges informations |
| | | | **alias** string | success | Account who acknowledge |
| | | | **clock** integer | success | Time when the event was created (timestamp) |
| | | | **message** string | success | Text of the acknowledgement message |
| | | **clock** integer | success | Time when the event was created (timestamp) |
| | | **eventid** integer | success | ID of the event |
| | | **value** integer | success | State of the related object |
| | **lastchange** integer | success | Time when the trigger last changed its state (timestamp) |
| | **priority** integer | success | Severity of the trigger |
| | **state** integer | success | State of the trigger |
| | **status** integer | success | Whether the trigger is enabled or disabled |
| | **templateid** integer | success | ID of the parent template trigger |
| | **triggerid** integer | success | ID of the trigger |
| | **type** integer | success | Whether the trigger can generate multiple problem events |
| | **url** string | success | URL associated with the trigger |
| | **value** integer | success | Whether the trigger is in OK or problem state |
### Authors
* Stéphane Travassac (@stravassac)
| programming_docs |
ansible community.zabbix.zabbix_maintenance – Create Zabbix maintenance windows community.zabbix.zabbix\_maintenance – Create Zabbix maintenance windows
========================================================================
Note
This plugin is part of the [community.zabbix collection](https://galaxy.ansible.com/community/zabbix) (version 1.5.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.zabbix`.
To use it in a playbook, specify: `community.zabbix.zabbix_maintenance`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module will let you create Zabbix maintenance windows.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* zabbix-api >= 0.5.4
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **collect\_data** boolean | **Choices:*** no
* **yes** ←
| Type of maintenance. With data collection, or without. |
| **desc** string | **Default:**"Created by Ansible" | Short description of maintenance window. |
| **host\_groups** list / elements=string | | Host groups to manage maintenance window for.
**Required** option when *state=present* and *host\_names* is not used.
aliases: host\_group |
| **host\_names** list / elements=string | | Hosts to manage maintenance window for.
**Required** option when *state=present* and *host\_groups* is not used.
aliases: host\_name |
| **http\_login\_password** string | | Basic Auth password |
| **http\_login\_user** string | | Basic Auth login |
| **login\_password** string / required | | Zabbix user password. If not set the environment variable `ZABBIX_PASSWORD` will be used. |
| **login\_user** string / required | | Zabbix user name. If not set the environment variable `ZABBIX_USERNAME` will be used. |
| **minutes** integer | **Default:**10 | Length of maintenance window in minutes. |
| **name** string / required | | Unique name of maintenance window. |
| **server\_url** string / required | | URL of Zabbix server, with protocol (http or https). `url` is an alias for `server_url`. If not set the environment variable `ZABBIX_SERVER` will be used.
aliases: url |
| **state** string | **Choices:*** **present** ←
* absent
| Create or remove a maintenance window. Maintenance window to remove is identified by name. |
| **timeout** integer | **Default:**10 | The timeout of API request (seconds). |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. If not set the environment variable `ZABBIX_VALIDATE_CERTS` will be used. |
| **visible\_name** boolean added in 2.0.0 of community.zabbix | **Choices:*** no
* **yes** ←
| Type of zabbix host name to use for identifying hosts to include in the maintenance.
*visible\_name=yes* to search by visible name, *visible\_name=no* to search by technical name. |
Notes
-----
Note
* Useful for setting hosts in maintenance mode before big update, and removing maintenance window after update.
* Module creates maintenance window from now() to now() + minutes, so if Zabbix server’s time and host’s time are not synchronized, you will get strange results.
* Install required module with ‘pip install zabbix-api’ command.
* If you use *login\_password=zabbix*, the word “zabbix” is replaced by “**\*\*\*\***” in all module output, because *login\_password* uses `no_log`. See [this FAQ](../../../network/user_guide/faq#why-is-my-output-sometimes-replaced-with) for more information.
Examples
--------
```
- name: Create a named maintenance window for host www1 for 90 minutes
community.zabbix.zabbix_maintenance:
name: Update of www1
host_name: www1.example.com
state: present
minutes: 90
server_url: https://monitoring.example.com
login_user: ansible
login_password: pAsSwOrD
- name: Create a named maintenance window for host www1 and host groups Office and Dev
community.zabbix.zabbix_maintenance:
name: Update of www1
host_name: www1.example.com
host_groups:
- Office
- Dev
state: present
server_url: https://monitoring.example.com
login_user: ansible
login_password: pAsSwOrD
- name: Create a named maintenance window for hosts www1 and db1, without data collection.
community.zabbix.zabbix_maintenance:
name: update
host_names:
- www1.example.com
- db1.example.com
state: present
collect_data: False
server_url: https://monitoring.example.com
login_user: ansible
login_password: pAsSwOrD
- name: Remove maintenance window by name
community.zabbix.zabbix_maintenance:
name: Test1
state: absent
server_url: https://monitoring.example.com
login_user: ansible
login_password: pAsSwOrD
```
### Authors
* Alexander Bulimov (@abulimov)
ansible community.zabbix.zabbix_user – Create/update/delete Zabbix users community.zabbix.zabbix\_user – Create/update/delete Zabbix users
=================================================================
Note
This plugin is part of the [community.zabbix collection](https://galaxy.ansible.com/community/zabbix) (version 1.5.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.zabbix`.
To use it in a playbook, specify: `community.zabbix.zabbix_user`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module allows you to create, modify and delete Zabbix users.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* zabbix-api >= 0.5.4
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **after\_login\_url** string | | URL of the page to redirect the user to after logging in. |
| **alias** string / required | | Name of the user alias in Zabbix. alias is the unique identifier used and cannot be updated using this module.
aliases: username |
| **autologin** boolean | **Choices:*** no
* yes
| Whether to enable auto-login. If enable autologin, cannot enable autologout. |
| **autologout** string | | User session life time in seconds. If set to 0, the session will never expire. If enable autologout, cannot enable autologin. |
| **http\_login\_password** string | | Basic Auth password |
| **http\_login\_user** string | | Basic Auth login |
| **lang** string | **Choices:*** en\_GB
* en\_US
* zh\_CN
* cs\_CZ
* fr\_FR
* he\_IL
* it\_IT
* ko\_KR
* ja\_JP
* nb\_NO
* pl\_PL
* pt\_BR
* pt\_PT
* ru\_RU
* sk\_SK
* tr\_TR
* uk\_UA
* default
| Language code of the user's language.
`default` can be used with Zabbix version 5.2 or higher. |
| **login\_password** string / required | | Zabbix user password. If not set the environment variable `ZABBIX_PASSWORD` will be used. |
| **login\_user** string / required | | Zabbix user name. If not set the environment variable `ZABBIX_USERNAME` will be used. |
| **name** string | | Name of the user. |
| **override\_passwd** boolean | **Choices:*** **no** ←
* yes
| Override password for the user. Password will not be updated on subsequent runs without setting this value to yes. |
| **passwd** string | | User's password. Required unless all of the *usrgrps* are set to use LDAP as frontend access. Always required for Zabbix versions lower than 4.0. |
| **refresh** string | | Automatic refresh period in seconds. |
| **role\_name** string added in 1.2.0 of community.zabbix | | User's role.
*role\_name* can be used when Zabbix version is 5.2 or higher. Default is `User role` when creating a new user. The default value will be removed at the version 2.0.0. |
| **rows\_per\_page** string | | Amount of object rows to show per page. |
| **server\_url** string / required | | URL of Zabbix server, with protocol (http or https). `url` is an alias for `server_url`. If not set the environment variable `ZABBIX_SERVER` will be used.
aliases: url |
| **state** string | **Choices:*** **present** ←
* absent
| State of the user. On `present`, it will create if user does not exist or update the user if the associated data is different. On `absent` will remove a user if it exists. |
| **surname** string | | Surname of the user. |
| **theme** string | **Choices:*** default
* blue-theme
* dark-theme
| User's theme. |
| **timeout** integer | **Default:**10 | The timeout of API request (seconds). |
| **timezone** string added in 1.2.0 of community.zabbix | | User's time zone.
*timezone* can be used with Zabbix version 5.2 or higher. For the full list of supported time zones please refer to <https://www.php.net/manual/en/timezones.php>
|
| **type** string | **Choices:*** Zabbix user
* Zabbix admin
* Zabbix super admin
| Type of the user.
*type* can be used when Zabbix version is 5.0 or lower. |
| **user\_medias** list / elements=dictionary | | Set the user's media. If not set, makes no changes to media. |
| | **active** boolean | **Choices:*** no
* **yes** ←
| Whether the media is enabled. |
| | **mediatype** string | **Default:**"Email" | Media type name to set. |
| | **period** string | **Default:**"1-7,00:00-24:00" | Time when the notifications can be sent as a time period or user macros separated by a semicolon. Please review the documentation for more information on the supported time period. https://www.zabbix.com/documentation/4.0/manual/appendix/time\_period |
| | **sendto** string / required | | Address, user name or other identifier of the recipient. |
| | **severity** dictionary | **Default:**{"average": true, "disaster": true, "high": true, "information": true, "not\_classified": true, "warning": true} | Trigger severities to send notifications about. |
| | | **average** boolean | **Choices:*** no
* **yes** ←
| severity average enable/disable. |
| | | **disaster** boolean | **Choices:*** no
* **yes** ←
| severity disaster enable/disable. |
| | | **high** boolean | **Choices:*** no
* **yes** ←
| severity high enable/disable. |
| | | **information** boolean | **Choices:*** no
* **yes** ←
| severity information enable/disable. |
| | | **not\_classified** boolean | **Choices:*** no
* **yes** ←
| severity not\_classified enable/disable. |
| | | **warning** boolean | **Choices:*** no
* **yes** ←
| severity warning enable/disable. |
| **usrgrps** list / elements=string | | User groups to add the user to. Required when *state=present*. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. If not set the environment variable `ZABBIX_VALIDATE_CERTS` will be used. |
Notes
-----
Note
* If you use *login\_password=zabbix*, the word “zabbix” is replaced by “**\*\*\*\***” in all module output, because *login\_password* uses `no_log`. See [this FAQ](../../../network/user_guide/faq#why-is-my-output-sometimes-replaced-with) for more information.
Examples
--------
```
- name: create a new zabbix user.
community.zabbix.zabbix_user:
server_url: "http://zabbix.example.com/zabbix/"
login_user: Admin
login_password: secret
alias: example
name: user name
surname: user surname
usrgrps:
- Guests
- Disabled
passwd: password
lang: en_GB
theme: blue-theme
autologin: no
autologout: '0'
refresh: '30'
rows_per_page: '200'
after_login_url: ''
user_medias:
- mediatype: Email
sendto: [email protected]
period: 1-7,00:00-24:00
severity:
not_classified: no
information: yes
warning: yes
average: yes
high: yes
disaster: yes
active: no
type: Zabbix super admin
state: present
- name: delete existing zabbix user.
community.zabbix.zabbix_user:
server_url: "http://zabbix.example.com/zabbix/"
login_user: admin
login_password: secret
alias: example
usrgrps:
- Guests
passwd: password
user_medias:
- sendto: [email protected]
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **user\_ids** dictionary | success | User id created or changed **Sample:** {'userids': ['5']} |
### Authors
* sky-joker (@sky-joker)
ansible community.zabbix.zabbix_action – Create/Delete/Update Zabbix actions community.zabbix.zabbix\_action – Create/Delete/Update Zabbix actions
=====================================================================
Note
This plugin is part of the [community.zabbix collection](https://galaxy.ansible.com/community/zabbix) (version 1.5.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.zabbix`.
To use it in a playbook, specify: `community.zabbix.zabbix_action`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module allows you to create, modify and delete Zabbix actions.
Requirements
------------
The below requirements are needed on the host that executes this module.
* zabbix-api >= 0.5.4
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **acknowledge\_default\_message** string | | Update operation (known as "Acknowledge operation" before Zabbix 4.0) message text. With >= Zabbix 5.0 this field is removed from the API and is dropped silently by module. Works only with >= Zabbix 3.4 and < Zabbix 5.0 |
| **acknowledge\_default\_subject** string | | Update operation (known as "Acknowledge operation" before Zabbix 4.0) message subject. With >= Zabbix 5.0 this field is removed from the API and is dropped silently by module. Works only with >= Zabbix 3.4 and < Zabbix 5.0 |
| **acknowledge\_operations** list / elements=string | | List of acknowledge operations. Action acknowledge operations are known as update operations since Zabbix 4.0.
`Suboptions` are the same as for *operations*. Works only with >= Zabbix 3.4
aliases: update\_operations |
| **conditions** list / elements=dictionary | | List of conditions to use for filtering results. For more information about suboptions of this option please check out Zabbix API documentation <https://www.zabbix.com/documentation/5.0/manual/api/reference/action/object#action_filter_condition>
|
| | **formulaid** string | | Arbitrary unique ID that is used to reference the condition from a custom expression. Can only contain upper-case letters. Required for custom expression filters and ignored otherwise. |
| | **operator** string | **Choices:*** =
* <>
* like
* not like
* in
* >=
* <=
* not in
* matches
* does not match
* Yes
* No
| Condition operator. When *type* is set to `time_period`, the choices are `in`, `not in`.
`matches`, `does not match`, `Yes` and `No` condition operators work only with >= Zabbix 4.0 |
| | **type** string | | Type (label) of the condition. Possible values when *event\_source=trigger*: - `host_group`
- `host`
- `trigger`
- `trigger_name`
- `trigger_severity`
- `time_period`
- `host_template`
- `application`
- `maintenance_status` known in Zabbix 4.0 and above as "Problem is suppressed" - `event_tag`
- `event_tag_value`
Possible values when *event\_source=discovery*: - `host_IP`
- `discovered_service_type`
- `discovered_service_port`
- `discovery_status`
- `uptime_or_downtime_duration`
- `received_value`
- `discovery_rule`
- `discovery_check`
- `proxy`
- `discovery_object`
Possible values when *event\_source=auto\_registration*: - `proxy`
- `host_name`
- `host_metadata`
Possible values when *event\_source=internal*: - `host_group`
- `host`
- `host_template`
- `application`
- `event_type`
|
| | **value** string | | Value to compare with. When *type=discovery\_status*, the choices are: - `up`
- `down`
- `discovered`
- `lost`
When *type=discovery\_object*, the choices are: - `host`
- `service`
When *type=event\_type*, the choices are: - `item in not supported state`
- `item in normal state`
- `LLD rule in not supported state`
- `LLD rule in normal state`
- `trigger in unknown state`
- `trigger in normal state`
When *type=trigger\_severity*, the choices are (case-insensitive): - `not classified`
- `information`
- `warning`
- `average`
- `high`
- `disaster`
Irrespective of user-visible names being changed in Zabbix. Defaults to `not classified` if omitted. Besides the above options, this is usually either the name of the object or a string to compare with. |
| | **value2** string | | Secondary value to compare with. Required for trigger actions when condition *type=event\_tag\_value*. |
| **default\_message** string | | Problem message default text. With >= Zabbix 5.0 this field is removed from the API and is dropped silently by module. Works only with < Zabbix 5.0 |
| **default\_subject** string | | Problem message default subject. With >= Zabbix 5.0 this field is removed from the API and is dropped silently by module. Works only with < Zabbix 5.0 |
| **esc\_period** string | | Default operation step duration. Must be greater than 60 seconds. Accepts only seconds in int for <= Zabbix 3.2 Accepts seconds, time unit with suffix and user macro since => Zabbix 3.4 Required when `state=present`. |
| **eval\_type** string | **Choices:*** andor
* and
* or
* custom\_expression
| Filter condition evaluation method. Defaults to `andor` if conditions are less then 2 or if *formula* is not specified. Defaults to `custom_expression` when formula is specified. |
| **event\_source** string | **Choices:*** trigger
* discovery
* auto\_registration
* internal
| Type of events that the action will handle. Required when `state=present`. |
| **formula** string | | User-defined expression to be used for evaluating conditions with a custom expression. The expression must contain IDs that reference each condition by its formulaid. The IDs used in the expression must exactly match the ones defined in the *conditions*. No condition can remain unused or omitted. Required when *eval\_type=custom\_expression*. Use sequential IDs that start at "A". If non-sequential IDs are used, Zabbix re-indexes them. This makes each module run notice the difference in IDs and update the action. |
| **http\_login\_password** string | | Basic Auth password |
| **http\_login\_user** string | | Basic Auth login |
| **login\_password** string / required | | Zabbix user password. If not set the environment variable `ZABBIX_PASSWORD` will be used. |
| **login\_user** string / required | | Zabbix user name. If not set the environment variable `ZABBIX_USERNAME` will be used. |
| **name** string / required | | Name of the action |
| **operations** list / elements=string | | List of action operations |
| | **command** string | | Command to run. Required when *type=remote\_command* and *command\_type!=global\_script*. |
| | **command\_type** string | **Choices:*** custom\_script
* ipmi
* ssh
* telnet
* global\_script
| Type of operation command. Required when *type=remote\_command*. |
| | **esc\_period** string | **Default:**"0s" | Duration of an escalation step in seconds. Must be greater than 60 seconds. Accepts only seconds in int for <= Zabbix 3.2 Accepts seconds, time unit with suffix and user macro since => Zabbix 3.4 If set to 0 or 0s, the default action escalation period will be used. |
| | **esc\_step\_from** string | **Default:**1 | Step to start escalation from. |
| | **esc\_step\_to** string | **Default:**1 | Step to end escalation at. Specify 0 for infinitely. |
| | **execute\_on** string | **Choices:*** agent
* server
* proxy
| Target on which the custom script operation command will be executed. Required when *type=remote\_command* and *command\_type=custom\_script*. |
| | **host\_groups** list / elements=string | | List of host groups host should be added to. Required when *type=add\_to\_host\_group* or *type=remove\_from\_host\_group*. |
| | **inventory** string | **Choices:*** manual
* automatic
| Host inventory mode. Required when *type=set\_host\_inventory\_mode*. |
| | **media\_type** string | **Default:**"all" | Media type that will be used to send the message. Can be used with *type=send\_message* or *type=notify\_all\_involved* inside *acknowledge\_operations*. Set to `all` for all media types |
| | **message** string | | Operation message text. Will check the 'default message' and use the text from *default\_message* if this and *default\_subject* are not specified |
| | **operation\_condition** string | **Choices:*** acknowledged
* not\_acknowledged
| The action operation condition object defines a condition that must be met to perform the current operation. |
| | **password** string | | Password used for authentication. Required when *ssh\_auth\_type=password* or *command\_type=telnet*. Can be used when *type=remote\_command*. |
| | **port** string | | Port number used for authentication. Can be used when *command\_type in [ssh, telnet]* and *type=remote\_command*. |
| | **run\_on\_groups** string | | Host groups to run remote commands on. Required when *type=remote\_command* and *run\_on\_hosts* is not set. |
| | **run\_on\_hosts** string | | Hosts to run remote commands on. Required when *type=remote\_command* and *run\_on\_groups* is not set. If set to 0 the command will be run on the current host. |
| | **script\_name** string | | The name of script used for global script commands. Required when *command\_type=global\_script*. Can be used when *type=remote\_command*. |
| | **send\_to\_groups** list / elements=string | | User groups to send messages to. |
| | **send\_to\_users** list / elements=string | | Users (usernames or aliases) to send messages to. |
| | **ssh\_auth\_type** string | **Choices:*** password
* public\_key
| Authentication method used for SSH commands. Required when *type=remote\_command* and *command\_type=ssh*. |
| | **ssh\_privatekey\_file** string | | Name of the private key file used for SSH commands with public key authentication. Required when *ssh\_auth\_type=public\_key*. Can be used when *type=remote\_command*. |
| | **ssh\_publickey\_file** string | | Name of the public key file used for SSH commands with public key authentication. Required when *ssh\_auth\_type=public\_key*. Can be used when *type=remote\_command*. |
| | **subject** string | | Operation message subject. Will check the 'default message' and use the text from *default\_subject* if this and *default\_subject* are not specified |
| | **templates** list / elements=string | | List of templates host should be linked to. Required when *type=link\_to\_template* or *type=unlink\_from\_template*. |
| | **type** string | **Choices:*** send\_message
* remote\_command
* add\_host
* remove\_host
* add\_to\_host\_group
* remove\_from\_host\_group
* link\_to\_template
* unlink\_from\_template
* enable\_host
* disable\_host
* set\_host\_inventory\_mode
* notify\_all\_involved
| Type of operation. Valid choices when setting type for *recovery\_operations* and *acknowledge\_operations*: - `send_message`
- `remote_command`
- `notify_all_involved`
Choice `notify_all_involved` only supported in *recovery\_operations* and *acknowledge\_operations*. |
| | **username** string | | User name used for authentication. Required when *ssh\_auth\_type in [public\_key, password]* or *command\_type=telnet*. Can be used when *type=remote\_command*. |
| **pause\_in\_maintenance** boolean | **Choices:*** no
* **yes** ←
| Whether to pause escalation during maintenance periods or not. Can be used when *event\_source=trigger*. |
| **recovery\_default\_message** string | | Recovery message text. With >= Zabbix 5.0 this field is removed from the API and is dropped silently by module. Works only with >= Zabbix 3.2 and < Zabbix 5.0 |
| **recovery\_default\_subject** string | | Recovery message subject. With >= Zabbix 5.0 this field is removed from the API and is dropped silently by module. Works only with >= Zabbix 3.2 and < Zabbix 5.0 |
| **recovery\_operations** list / elements=string | | List of recovery operations.
`Suboptions` are the same as for *operations*. Works only with >= Zabbix 3.2 |
| **server\_url** string / required | | URL of Zabbix server, with protocol (http or https). `url` is an alias for `server_url`. If not set the environment variable `ZABBIX_SERVER` will be used.
aliases: url |
| **state** string | **Choices:*** **present** ←
* absent
| State of the action. On `present`, it will create an action if it does not exist or update the action if the associated data is different. On `absent`, it will remove the action if it exists. |
| **status** string | **Choices:*** **enabled** ←
* disabled
| Status of the action. |
| **timeout** integer | **Default:**10 | The timeout of API request (seconds). |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. If not set the environment variable `ZABBIX_VALIDATE_CERTS` will be used. |
Notes
-----
Note
* Only Zabbix >= 3.0 is supported.
* If you use *login\_password=zabbix*, the word “zabbix” is replaced by “**\*\*\*\***” in all module output, because *login\_password* uses `no_log`. See [this FAQ](../../../network/user_guide/faq#why-is-my-output-sometimes-replaced-with) for more information.
Examples
--------
```
# Trigger action with only one condition
- name: Deploy trigger action
community.zabbix.zabbix_action:
server_url: "http://zabbix.example.com/zabbix/"
login_user: Admin
login_password: secret
name: "Send alerts to Admin"
event_source: 'trigger'
state: present
status: enabled
esc_period: 60
conditions:
- type: 'trigger_severity'
operator: '>='
value: 'Information'
operations:
- type: send_message
subject: "Something bad is happening"
message: "Come on, guys do something"
media_type: 'Email'
send_to_users:
- 'Admin'
# Trigger action with multiple conditions and operations
- name: Deploy trigger action
community.zabbix.zabbix_action:
server_url: "http://zabbix.example.com/zabbix/"
login_user: Admin
login_password: secret
name: "Send alerts to Admin"
event_source: 'trigger'
state: present
status: enabled
esc_period: 1m
conditions:
- type: 'trigger_name'
operator: 'like'
value: 'Zabbix agent is unreachable'
formulaid: A
- type: 'trigger_severity'
operator: '>='
value: 'disaster'
formulaid: B
formula: A or B
operations:
- type: send_message
media_type: 'Email'
send_to_users:
- 'Admin'
- type: remote_command
command: 'systemctl restart zabbix-agent'
command_type: custom_script
execute_on: server
run_on_hosts:
- 0
# Trigger action with recovery and acknowledge operations
- name: Deploy trigger action
community.zabbix.zabbix_action:
server_url: "http://zabbix.example.com/zabbix/"
login_user: Admin
login_password: secret
name: "Send alerts to Admin"
event_source: 'trigger'
state: present
status: enabled
esc_period: 1h
conditions:
- type: 'trigger_severity'
operator: '>='
value: 'Information'
operations:
- type: send_message
subject: "Something bad is happening"
message: "Come on, guys do something"
media_type: 'Email'
send_to_users:
- 'Admin'
recovery_operations:
- type: send_message
subject: "Host is down"
message: "Come on, guys do something"
media_type: 'Email'
send_to_users:
- 'Admin'
acknowledge_operations:
- type: send_message
media_type: 'Email'
send_to_users:
- 'Admin'
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | success | The result of the operation **Sample:** Action Deleted: Register webservers, ID: 0001 |
### Authors
* Ruben Tsirunyan (@rubentsirunyan)
* Ruben Harutyunov (@K-DOT)
| programming_docs |
ansible community.zabbix.zabbix_host_info – Gather information about Zabbix host community.zabbix.zabbix\_host\_info – Gather information about Zabbix host
==========================================================================
Note
This plugin is part of the [community.zabbix collection](https://galaxy.ansible.com/community/zabbix) (version 1.5.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.zabbix`.
To use it in a playbook, specify: `community.zabbix.zabbix_host_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module allows you to search for Zabbix host entries.
* This module was called `zabbix_host_facts` before Ansible 2.9. The usage did not change.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* zabbix-api >= 0.5.4
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **exact\_match** boolean | **Choices:*** **no** ←
* yes
| Find the exact match |
| **host\_inventory** list / elements=string | | List of host inventory keys to display in result. Whole host inventory is retrieved if keys are not specified. |
| **host\_ip** list / elements=string | | Host interface IP of the host in Zabbix. Required when *host\_name* is not used. |
| **host\_name** string | | Name of the host in Zabbix. host\_name is the unique identifier used and cannot be updated using this module. Required when *host\_ip* is not used. |
| **http\_login\_password** string | | Basic Auth password |
| **http\_login\_user** string | | Basic Auth login |
| **login\_password** string / required | | Zabbix user password. If not set the environment variable `ZABBIX_PASSWORD` will be used. |
| **login\_user** string / required | | Zabbix user name. If not set the environment variable `ZABBIX_USERNAME` will be used. |
| **remove\_duplicate** boolean | **Choices:*** no
* **yes** ←
| Remove duplicate host from host result |
| **server\_url** string / required | | URL of Zabbix server, with protocol (http or https). `url` is an alias for `server_url`. If not set the environment variable `ZABBIX_SERVER` will be used.
aliases: url |
| **timeout** integer | **Default:**10 | The timeout of API request (seconds). |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. If not set the environment variable `ZABBIX_VALIDATE_CERTS` will be used. |
Notes
-----
Note
* If you use *login\_password=zabbix*, the word “zabbix” is replaced by “**\*\*\*\***” in all module output, because *login\_password* uses `no_log`. See [this FAQ](../../../network/user_guide/faq#why-is-my-output-sometimes-replaced-with) for more information.
Examples
--------
```
- name: Get host info
local_action:
module: community.zabbix.zabbix_host_info
server_url: http://monitor.example.com
login_user: username
login_password: password
host_name: ExampleHost
host_ip: 127.0.0.1
timeout: 10
exact_match: no
remove_duplicate: yes
- name: Reduce host inventory information to provided keys
local_action:
module: community.zabbix.zabbix_host_info
server_url: http://monitor.example.com
login_user: username
login_password: password
host_name: ExampleHost
host_inventory:
- os
- tag
host_ip: 127.0.0.1
timeout: 10
exact_match: no
remove_duplicate: yes
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **hosts** dictionary | success | List of Zabbix hosts. See https://www.zabbix.com/documentation/4.0/manual/api/reference/host/get for list of host values. **Sample:** [{'...': None, 'available': '1', 'description': '', 'disable\_until': '0', 'error': '', 'flags': '0', 'groups': ['1'], 'host': 'Host A'}] |
### Authors
* Michael Miko (@RedWhiteMiko)
ansible community.zabbix.zabbix_map – Create/update/delete Zabbix maps community.zabbix.zabbix\_map – Create/update/delete Zabbix maps
===============================================================
Note
This plugin is part of the [community.zabbix collection](https://galaxy.ansible.com/community/zabbix) (version 1.5.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.zabbix`.
To use it in a playbook, specify: `community.zabbix.zabbix_map`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module allows you to create, modify and delete Zabbix map entries, using Graphviz binaries and text description written in DOT language. Nodes of the graph will become map elements and edges will become links between map elements. See <https://en.wikipedia.org/wiki/DOT_(graph_description_language>) and <https://www.graphviz.org/> for details. Inspired by <http://blog.zabbix.com/maps-for-the-lazy/>.
* The following extra node attributes are supported: `zbx_host` contains name of the host in Zabbix. Use this if desired type of map element is `host`. `zbx_group` contains name of the host group in Zabbix. Use this if desired type of map element is `host group`. `zbx_sysmap` contains name of the map in Zabbix. Use this if desired type of map element is `map`. `zbx_label` contains label of map element. `zbx_image` contains name of the image used to display the element in default state. `zbx_image_disabled` contains name of the image used to display disabled map element. `zbx_image_maintenance` contains name of the image used to display map element in maintenance. `zbx_image_problem` contains name of the image used to display map element with problems. `zbx_url` contains map element URL in `name:url` format. More than one URL could be specified by adding a postfix (e.g., `zbx_url1`, `zbx_url2`).
* The following extra link attributes are supported: `zbx_draw_style` contains link line draw style. Possible values: `line`, `bold`, `dotted`, `dashed`. `zbx_trigger` contains name of the trigger used as a link indicator in `host_name:trigger_name` format. More than one trigger could be specified by adding a postfix (e.g., `zbx_trigger1`, `zbx_trigger2`). `zbx_trigger_color` contains indicator color specified either as CSS3 name or as a hexadecimal code starting with `#`. `zbx_trigger_draw_style` contains indicator draw style. Possible values are the same as for `zbx_draw_style`.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* zabbix-api >= 0.5.4
* pydotplus
* webcolors
* Pillow
* Graphviz
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **data** string | | Graph written in DOT language.
aliases: dot\_data |
| **default\_image** string | | Name of the Zabbix image used to display the element if this element doesn't have the `zbx_image` attribute defined.
aliases: image |
| **expand\_problem** boolean | **Choices:*** no
* **yes** ←
| Whether the problem trigger will be displayed for elements with a single problem. |
| **height** integer | **Default:**600 | Height of the map. |
| **highlight** boolean | **Choices:*** no
* **yes** ←
| Whether icon highlighting is enabled. |
| **http\_login\_password** string | | Basic Auth password |
| **http\_login\_user** string | | Basic Auth login |
| **label\_type** string | **Choices:*** label
* ip
* **name** ←
* status
* nothing
* custom
| Map element label type. |
| **login\_password** string / required | | Zabbix user password. If not set the environment variable `ZABBIX_PASSWORD` will be used. |
| **login\_user** string / required | | Zabbix user name. If not set the environment variable `ZABBIX_USERNAME` will be used. |
| **margin** integer | **Default:**40 | Size of white space between map's borders and its elements. |
| **name** string / required | | Name of the map.
aliases: map\_name |
| **server\_url** string / required | | URL of Zabbix server, with protocol (http or https). `url` is an alias for `server_url`. If not set the environment variable `ZABBIX_SERVER` will be used.
aliases: url |
| **state** string | **Choices:*** **present** ←
* absent
| State of the map. On `present`, it will create if map does not exist or update the map if the associated data is different. On `absent` will remove the map if it exists. |
| **timeout** integer | **Default:**10 | The timeout of API request (seconds). |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. If not set the environment variable `ZABBIX_VALIDATE_CERTS` will be used. |
| **width** integer | **Default:**800 | Width of the map. |
Notes
-----
Note
* If you use *login\_password=zabbix*, the word “zabbix” is replaced by “**\*\*\*\***” in all module output, because *login\_password* uses `no_log`. See [this FAQ](../../../network/user_guide/faq#why-is-my-output-sometimes-replaced-with) for more information.
Examples
--------
```
###
### Example inventory:
# [web]
# web[01:03].example.com ansible_host=127.0.0.1
# [db]
# db.example.com ansible_host=127.0.0.1
# [backup]
# backup.example.com ansible_host=127.0.0.1
###
### Each inventory host is present in Zabbix with a matching name.
###
### Contents of 'map.j2':
# digraph G {
# graph [layout=dot splines=false overlap=scale]
# INTERNET [zbx_url="Google:https://google.com" zbx_image="Cloud_(96)"]
# {% for web_host in groups.web %}
# {% set web_loop = loop %}
# web{{ '%03d' % web_loop.index }} [zbx_host="{{ web_host }}"]
# INTERNET -> web{{ '%03d' % web_loop.index }} [zbx_trigger="{{ web_host }}:Zabbix agent on {HOST.NAME} is unreachable for 5 minutes"]
# {% for db_host in groups.db %}
# {% set db_loop = loop %}
# web{{ '%03d' % web_loop.index }} -> db{{ '%03d' % db_loop.index }}
# {% endfor %}
# {% endfor %}
# { rank=same
# {% for db_host in groups.db %}
# {% set db_loop = loop %}
# db{{ '%03d' % db_loop.index }} [zbx_host="{{ db_host }}"]
# {% for backup_host in groups.backup %}
# {% set backup_loop = loop %}
# db{{ '%03d' % db_loop.index }} -> backup{{ '%03d' % backup_loop.index }} [color="blue"]
# {% endfor %}
# {% endfor %}
# {% for backup_host in groups.backup %}
# {% set backup_loop = loop %}
# backup{{ '%03d' % backup_loop.index }} [zbx_host="{{ backup_host }}"]
# {% endfor %}
# }
# }
###
### Create Zabbix map "Demo Map" made of template 'map.j2'
- name: Create Zabbix map
community.zabbix.zabbix_map:
server_url: http://zabbix.example.com
login_user: username
login_password: password
name: Demo map
state: present
data: "{{ lookup('template', 'map.j2') }}"
default_image: Server_(64)
expand_problem: no
highlight: no
label_type: label
delegate_to: localhost
run_once: yes
```
### Authors
* Antony Alekseyev (@Akint)
ansible community.zabbix.zabbix_mediatype – Create/Update/Delete Zabbix media types community.zabbix.zabbix\_mediatype – Create/Update/Delete Zabbix media types
============================================================================
Note
This plugin is part of the [community.zabbix collection](https://galaxy.ansible.com/community/zabbix) (version 1.5.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.zabbix`.
To use it in a playbook, specify: `community.zabbix.zabbix_mediatype`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module allows you to create, modify and delete Zabbix media types.
Requirements
------------
The below requirements are needed on the host that executes this module.
* zabbix-api >= 0.5.4
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **attempt\_interval** integer | **Default:**10 | The interval between retry attempts. Possible range is 0-60. Works only with Zabbix versions 3.4 or newer. |
| **description** string | **Default:**"" | Description of the media type. Works only with Zabbix versions 4.4 or newer. |
| **event\_menu** boolean | **Choices:*** **no** ←
* yes
| Can be used when *type=webhook*. Includes entry in Event menu with link to created external ticket. |
| **event\_menu\_name** string | | Requred when *event\_menu=True*. Event menu entry name. |
| **event\_menu\_url** string | | Requred when *event\_menu=True*. Event menu entry underlying URL. |
| **gsm\_modem** string | | Serial device name of the gsm modem. Required when *type=sms*. |
| **http\_login\_password** string | | Basic Auth password |
| **http\_login\_user** string | | Basic Auth login |
| **login\_password** string / required | | Zabbix user password. If not set the environment variable `ZABBIX_PASSWORD` will be used. |
| **login\_user** string / required | | Zabbix user name. If not set the environment variable `ZABBIX_USERNAME` will be used. |
| **max\_attempts** integer | **Default:**3 | The maximum number of attempts to send an alert. Possible range is 0-10. Works only with Zabbix versions 3.4 or newer. |
| **max\_sessions** integer | **Default:**1 | The maximum number of alerts that can be processed in parallel. Possible value is 1 when *type=sms* and 0-100 otherwise. Works only with Zabbix versions 3.4 or newer. |
| **message\_templates** list / elements=dictionary | **Default:**[] | Default notification messages for the event types. Works only with Zabbix versions 5.0 or newer. |
| | **body** string | **Default:**"" | Body of the default message. May contain macros. |
| | **eventsource** string | **Choices:*** triggers
* discovery
* autoregistration
* internal
| Event source. Required when *recovery* is used. |
| | **recovery** string | **Choices:*** operations
* recovery\_operations
* update\_operations
| Operation mode. Required when *eventsource* is used. |
| | **subject** string | **Default:**"" | Subject of the default message. May contain macros and is limited to 255 characters. |
| **message\_text\_limit** string | **Choices:*** USA
* Canada
| The message text limit. Required when *type=ez\_texting*. 160 characters for USA and 136 characters for Canada. |
| **name** string / required | | Name of the media type. |
| **password** string | | Authentication password. Required when *type=jabber* or *type=ez\_texting*. Required when *type=email* and *smtp\_authentication=true*. |
| **process\_tags** boolean | **Choices:*** **no** ←
* yes
| Can be used when *type=webhook*. Process returned JSON property values as tags. These tags are added to the already existing (if any) problem event tags in Zabbix. |
| **script\_name** string | | The name of the executed script. Required when *type=script*. |
| **script\_params** list / elements=string | | List of script parameters. Required when *type=script*. |
| **server\_url** string / required | | URL of Zabbix server, with protocol (http or https). `url` is an alias for `server_url`. If not set the environment variable `ZABBIX_SERVER` will be used.
aliases: url |
| **smtp\_authentication** boolean | **Choices:*** **no** ←
* yes
| Whether SMTP authentication with username and password should be enabled or not. If set to `true`, `username` and `password` should be specified. |
| **smtp\_email** string | | Email address from which notifications will be sent. Required when *type=email*. |
| **smtp\_helo** string | **Default:**"localhost" | SMTP HELO. Required when *type=email*. |
| **smtp\_security** string | **Choices:*** None
* STARTTLS
* SSL/TLS
| SMTP connection security level to use. |
| **smtp\_server** string | **Default:**"localhost" | SMTP server host. Required when *type=email*. |
| **smtp\_server\_port** integer | **Default:**25 | SMTP server port. Required when *type=email*. |
| **smtp\_verify\_host** boolean | **Choices:*** **no** ←
* yes
| SSL verify host for SMTP. Can be specified when *smtp\_security=STARTTLS* or *smtp\_security=SSL/TLS*
|
| **smtp\_verify\_peer** boolean | **Choices:*** **no** ←
* yes
| SSL verify peer for SMTP. Can be specified when *smtp\_security=STARTTLS* or *smtp\_security=SSL/TLS*
|
| **state** string | **Choices:*** **present** ←
* absent
| Desired state of the mediatype. On `present`, it will create a mediatype if it does not exist or update the mediatype if the associated data is different. On `absent`, it will remove the mediatype if it exists. |
| **status** string | **Choices:*** **enabled** ←
* disabled
| Whether the media type is enabled or no. |
| **timeout** integer | **Default:**10 | The timeout of API request (seconds). |
| **type** string / required | **Choices:*** email
* script
* sms
* webhook
* jabber
* ez\_texting
| Type of the media type. Media types *jabber* and *ez\_texting* works only with Zabbix versions 4.2 or older. Media type *webhook* works only with Zabbix versions 4.4 or newer. |
| **username** string | | Username or Jabber identifier. Required when *type=jabber* or *type=ez\_texting*. Required when *type=email* and *smtp\_authentication=true*. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. If not set the environment variable `ZABBIX_VALIDATE_CERTS` will be used. |
| **webhook\_params** list / elements=dictionary | **Default:**[] | Can be used when *type=webhook*. Webhook variables that are passed to webhook script when executed. |
| | **name** string / required | | Name of the parameter. |
| | **value** string | **Default:**"" | Value of the parameter. All macros that are supported in problem notifications are supported in the parameters. Values are URL-encoded automatically. Values from macros are resolved and then URL-encoded automatically. |
| **webhook\_script** string | | Required when *type=webhook*. JavaScript code that will perform webhook operation. This code has access to all parameters in *webhook\_params*. It may perform HTTP GET, POST, PUT and DELETE requests and has control over HTTP headers and request body. It may return OK status along with an optional list of tags and tag values or an error string. Works only with Zabbix versions 4.4 or newer. |
| **webhook\_timeout** string | **Default:**"30s" | Can be used when *type=webhook*. Execution timeout for JavaScript code in *webhook\_script*. Possible values are 1-60s. |
Notes
-----
Note
* If you use *login\_password=zabbix*, the word “zabbix” is replaced by “**\*\*\*\***” in all module output, because *login\_password* uses `no_log`. See [this FAQ](../../../network/user_guide/faq#why-is-my-output-sometimes-replaced-with) for more information.
Examples
--------
```
- name: 'Create an email mediatype with SMTP authentication'
community.zabbix.zabbix_mediatype:
name: "Ops email"
server_url: "http://example.com/zabbix/"
login_user: Admin
login_password: "zabbix"
type: 'email'
smtp_server: 'example.com'
smtp_server_port: 2000
smtp_email: '[email protected]'
smtp_authentication: true
username: 'smtp_user'
password: 'smtp_pass'
- name: 'Create a script mediatype'
community.zabbix.zabbix_mediatype:
name: "my script"
server_url: "http://example.com/zabbix/"
login_user: Admin
login_password: "zabbix"
type: 'script'
script_name: 'my_script.py'
script_params:
- 'arg1'
- 'arg2'
- name: 'Create a jabber mediatype'
community.zabbix.zabbix_mediatype:
name: "My jabber"
server_url: "http://example.com/zabbix/"
login_user: Admin
login_password: "zabbix"
type: 'jabber'
username: 'jabber_id'
password: 'jabber_pass'
- name: 'Create a SMS mediatype'
community.zabbix.zabbix_mediatype:
name: "My SMS Mediatype"
server_url: "http://example.com/zabbix/"
login_user: Admin
login_password: "zabbix"
type: 'sms'
gsm_modem: '/dev/ttyS0'
# Supported since Zabbix 4.4
- name: 'Create a webhook mediatype'
community.zabbix.zabbix_mediatype:
name: "My webhook Mediatype"
server_url: "http://example.com/zabbix/"
login_user: Admin
login_password: "zabbix"
type: 'webhook'
webhook_script: "{{ lookup('file', 'slack.js') }}"
webhook_params:
- name: alert_message
value: '{ALERT.MESSAGE}'
- name: zabbix_url
value: '{$ZABBIX.URL}'
process_tags: True
event_menu: true
event_menu_name: "Open in Slack: '{EVENT.TAGS.__channel_name}'"
event_menu_url: '{EVENT.TAGS.__message_link}'
# Supported since Zabbix 5.0
- name: 'Create an email mediatype with message templates'
community.zabbix.zabbix_mediatype:
name: "Ops email"
server_url: "http://example.com/zabbix/"
login_user: Admin
login_password: "zabbix"
type: 'email'
smtp_email: '[email protected]'
message_templates:
- eventsource: triggers
recovery: operations
subject: "Problem: {EVENT.NAME}"
body: "Problem started at {EVENT.TIME} on {EVENT.DATE}\r\nProblem name: {EVENT.NAME}\r\n"
- eventsource: triggers
recovery: recovery_operations
subject: "Resolved: {EVENT.NAME}"
body: "Problem resolved at {EVENT.TIME} on {EVENT.DATE}\r\nProblem name: {EVENT.NAME}\r\n"
- eventsource: triggers
recovery: update_operations
subject: "Updated problem: {EVENT.NAME}"
body: "{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.\r\n"
- eventsource: discovery
recovery: operations
subject: "Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}"
body: "Discovery rule: {DISCOVERY.RULE.NAME}\r\n\r\nDevice IP: {DISCOVERY.DEVICE.IPADDRESS}"
- eventsource: autoregistration
recovery: operations
subject: "Autoregistration: {HOST.HOST}"
body: "Host name: {HOST.HOST}\r\nHost IP: {HOST.IP}\r\nAgent port: {HOST.PORT}"
```
### Authors
* Ruben Tsirunyan (@rubentsirunyan)
| programming_docs |
ansible community.zabbix.zabbix_service – Create/update/delete Zabbix service community.zabbix.zabbix\_service – Create/update/delete Zabbix service
======================================================================
Note
This plugin is part of the [community.zabbix collection](https://galaxy.ansible.com/community/zabbix) (version 1.5.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.zabbix`.
To use it in a playbook, specify: `community.zabbix.zabbix_service`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Create/update/delete Zabbix service.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7
* zabbix-api >= 0.5.4
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **algorithm** string | **Choices:*** no
* **one\_child** ←
* all\_children
| Algorithm used to calculate the sla
`no`, sla is not calculated
`one_child`, problem if at least one child has a problem
`all_children`, problem if all children have problems |
| **calculate\_sla** boolean | **Choices:*** **no** ←
* yes
| If yes, calculate the SLA value for this service, showsla in Zabbix API |
| **http\_login\_password** string | | Basic Auth password |
| **http\_login\_user** string | | Basic Auth login |
| **login\_password** string / required | | Zabbix user password. If not set the environment variable `ZABBIX_PASSWORD` will be used. |
| **login\_user** string / required | | Zabbix user name. If not set the environment variable `ZABBIX_USERNAME` will be used. |
| **name** string / required | | Name of Zabbix service |
| **parent** string | | Name of Zabbix service parent |
| **server\_url** string / required | | URL of Zabbix server, with protocol (http or https). `url` is an alias for `server_url`. If not set the environment variable `ZABBIX_SERVER` will be used.
aliases: url |
| **sla** float | | Sla value (i.e 99.99), goodsla in Zabbix API |
| **state** string | **Choices:*** **present** ←
* absent
| State: present - create/update service; absent - delete service |
| **timeout** integer | **Default:**10 | The timeout of API request (seconds). |
| **trigger\_host** string | | Name of host linked to the service |
| **trigger\_name** string | | Name of trigger linked to the service |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. If not set the environment variable `ZABBIX_VALIDATE_CERTS` will be used. |
Notes
-----
Note
* If you use *login\_password=zabbix*, the word “zabbix” is replaced by “**\*\*\*\***” in all module output, because *login\_password* uses `no_log`. See [this FAQ](../../../network/user_guide/faq#why-is-my-output-sometimes-replaced-with) for more information.
Examples
--------
```
---
# Creates a new Zabbix service
- name: Manage services
local_action:
module: community.zabbix.zabbix_service
server_url: "https://192.168.1.1"
login_user: username
login_password: password
name: apache2 service
sla: 99.99
calculate_sla: yes
algorithm: one_child
trigger_name: apache2 service status
trigger_host: webserver01
state: present
```
### Authors
* Emmanuel Riviere (@emriver)
ansible community.zabbix.zabbix_group_info – Gather information about Zabbix hostgroup community.zabbix.zabbix\_group\_info – Gather information about Zabbix hostgroup
================================================================================
Note
This plugin is part of the [community.zabbix collection](https://galaxy.ansible.com/community/zabbix) (version 1.5.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.zabbix`.
To use it in a playbook, specify: `community.zabbix.zabbix_group_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module allows you to search for Zabbix hostgroup entries.
* This module was called `zabbix_group_facts` before Ansible 2.9. The usage did not change.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* zabbix-api >= 0.5.4
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **hostgroup\_name** list / elements=string / required | | Name of the hostgroup in Zabbix. hostgroup is the unique identifier used and cannot be updated using this module. |
| **http\_login\_password** string | | Basic Auth password |
| **http\_login\_user** string | | Basic Auth login |
| **login\_password** string / required | | Zabbix user password. If not set the environment variable `ZABBIX_PASSWORD` will be used. |
| **login\_user** string / required | | Zabbix user name. If not set the environment variable `ZABBIX_USERNAME` will be used. |
| **server\_url** string / required | | URL of Zabbix server, with protocol (http or https). `url` is an alias for `server_url`. If not set the environment variable `ZABBIX_SERVER` will be used.
aliases: url |
| **timeout** integer | **Default:**10 | The timeout of API request (seconds). |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. If not set the environment variable `ZABBIX_VALIDATE_CERTS` will be used. |
Notes
-----
Note
* If you use *login\_password=zabbix*, the word “zabbix” is replaced by “**\*\*\*\***” in all module output, because *login\_password* uses `no_log`. See [this FAQ](../../../network/user_guide/faq#why-is-my-output-sometimes-replaced-with) for more information.
Examples
--------
```
- name: Get hostgroup info
local_action:
module: community.zabbix.zabbix_group_info
server_url: http://monitor.example.com
login_user: username
login_password: password
hostgroup_name:
- ExampleHostgroup
timeout: 10
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **host\_groups** dictionary | success | List of Zabbix groups. **Sample:** [{'flags': '0', 'groupid': '33', 'internal': '0', 'name': 'Hostgruup A'}] |
### Authors
* Michael Miko (@RedWhiteMiko)
ansible community.zabbix.zabbix_template – Create/update/delete/dump Zabbix template community.zabbix.zabbix\_template – Create/update/delete/dump Zabbix template
=============================================================================
Note
This plugin is part of the [community.zabbix collection](https://galaxy.ansible.com/community/zabbix) (version 1.5.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.zabbix`.
To use it in a playbook, specify: `community.zabbix.zabbix_template`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module allows you to create, modify, delete and dump Zabbix templates.
* Multiple templates can be created or modified at once if passing JSON or XML to module.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* zabbix-api >= 0.5.4
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **clear\_templates** list / elements=string | | List of template names to be unlinked and cleared from the template. This option is ignored if template is being created for the first time. |
| **dump\_format** string | **Choices:*** **json** ←
* xml
| Format to use when dumping template with `state=dump`. This option is deprecated and will eventually be removed in 2.14. |
| **http\_login\_password** string | | Basic Auth password |
| **http\_login\_user** string | | Basic Auth login |
| **link\_templates** list / elements=string | | List of template names to be linked to the template. Templates that are not specified and are linked to the existing template will be only unlinked and not cleared from the template. |
| **login\_password** string / required | | Zabbix user password. If not set the environment variable `ZABBIX_PASSWORD` will be used. |
| **login\_user** string / required | | Zabbix user name. If not set the environment variable `ZABBIX_USERNAME` will be used. |
| **macros** list / elements=dictionary | | List of user macros to create for the template. Macros that are not specified and are present on the existing template will be replaced. See examples on how to pass macros. |
| | **macro** string / required | | Name of the macro. Must be specified in {$NAME} format. |
| | **value** string / required | | Value of the macro. |
| **omit\_date** boolean | **Choices:*** **no** ←
* yes
| Removes the date field for the exported/dumped template Requires `state=dump`
|
| **server\_url** string / required | | URL of Zabbix server, with protocol (http or https). `url` is an alias for `server_url`. If not set the environment variable `ZABBIX_SERVER` will be used.
aliases: url |
| **state** string | **Choices:*** **present** ←
* absent
* dump
| Required state of the template. On `state=present` template will be created/imported or updated depending if it is already present. On `state=dump` template content will get dumped into required format specified in *dump\_format*. On `state=absent` template will be deleted. The `state=dump` is deprecated and will be removed in 2.14. The [community.zabbix.zabbix\_template\_info](zabbix_template_info_module) module should be used instead. |
| **template\_groups** list / elements=string | | List of host groups to add template to when template is created. Replaces the current host groups the template belongs to if the template is already present. Required when creating a new template with `state=present` and *template\_name* is used. Not required when updating an existing template. |
| **template\_json** json | | JSON dump of templates to import. Multiple templates can be imported this way. Mutually exclusive with *template\_name* and *template\_xml*. |
| **template\_name** string | | Name of Zabbix template. Required when *template\_json* or *template\_xml* are not used. Mutually exclusive with *template\_json* and *template\_xml*. |
| **template\_xml** string | | XML dump of templates to import. Multiple templates can be imported this way. You are advised to pass XML structure matching the structure used by your version of Zabbix server. Custom XML structure can be imported as long as it is valid, but may not yield consistent idempotent results on subsequent runs. Mutually exclusive with *template\_name* and *template\_json*. |
| **timeout** integer | **Default:**10 | The timeout of API request (seconds). |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. If not set the environment variable `ZABBIX_VALIDATE_CERTS` will be used. |
Notes
-----
Note
* If you use *login\_password=zabbix*, the word “zabbix” is replaced by “**\*\*\*\***” in all module output, because *login\_password* uses `no_log`. See [this FAQ](../../../network/user_guide/faq#why-is-my-output-sometimes-replaced-with) for more information.
Examples
--------
```
---
- name: Create a new Zabbix template linked to groups, macros and templates
local_action:
module: community.zabbix.zabbix_template
server_url: http://127.0.0.1
login_user: username
login_password: password
template_name: ExampleHost
template_groups:
- Role
- Role2
link_templates:
- Example template1
- Example template2
macros:
- macro: '{$EXAMPLE_MACRO1}'
value: 30000
- macro: '{$EXAMPLE_MACRO2}'
value: 3
- macro: '{$EXAMPLE_MACRO3}'
value: 'Example'
state: present
- name: Unlink and clear templates from the existing Zabbix template
local_action:
module: community.zabbix.zabbix_template
server_url: http://127.0.0.1
login_user: username
login_password: password
template_name: ExampleHost
clear_templates:
- Example template3
- Example template4
state: present
- name: Import Zabbix templates from JSON
local_action:
module: community.zabbix.zabbix_template
server_url: http://127.0.0.1
login_user: username
login_password: password
template_json: "{{ lookup('file', 'zabbix_apache2.json') }}"
state: present
- name: Import Zabbix templates from XML
local_action:
module: community.zabbix.zabbix_template
server_url: http://127.0.0.1
login_user: username
login_password: password
template_xml: "{{ lookup('file', 'zabbix_apache2.xml') }}"
state: present
- name: Import Zabbix template from Ansible dict variable
community.zabbix.zabbix_template:
login_user: username
login_password: password
server_url: http://127.0.0.1
template_json:
zabbix_export:
version: '3.2'
templates:
- name: Template for Testing
description: 'Testing template import'
template: Test Template
groups:
- name: Templates
applications:
- name: Test Application
state: present
- name: Configure macros on the existing Zabbix template
local_action:
module: community.zabbix.zabbix_template
server_url: http://127.0.0.1
login_user: username
login_password: password
template_name: Template
macros:
- macro: '{$TEST_MACRO}'
value: 'Example'
state: present
- name: Delete Zabbix template
local_action:
module: community.zabbix.zabbix_template
server_url: http://127.0.0.1
login_user: username
login_password: password
template_name: Template
state: absent
- name: Dump Zabbix template as JSON
local_action:
module: community.zabbix.zabbix_template
server_url: http://127.0.0.1
login_user: username
login_password: password
template_name: Template
omit_date: yes
state: dump
register: template_dump
- name: Dump Zabbix template as XML
local_action:
module: community.zabbix.zabbix_template
server_url: http://127.0.0.1
login_user: username
login_password: password
template_name: Template
dump_format: xml
omit_date: false
state: dump
register: template_dump
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **template\_json** string | when state is dump and omit\_date is no | The JSON dump of the template **Sample:** {'zabbix\_export': {'date': '2017-11-29T16:37:24Z', 'groups': [{'name': 'Templates'}], 'templates': [{'applications': [], 'description': '', 'discovery\_rules': [], 'groups': [{'name': 'Templates'}], 'httptests': [], 'items': [], 'macros': [], 'name': 'Test Template', 'screens': [], 'template': 'test', 'templates': []}], 'version': '3.2'}} |
| **template\_xml** string | when state is dump, dump\_format is xml and omit\_date is yes | dump of the template in XML representation **Sample:** <?xml version="1.0" ?> <zabbix\_export> <version>4.2</version> <groups> <group> <name>Templates</name> </group> </groups> <templates> <template> <template>test</template> <name>Test Template</name> <description/> <groups> <group> <name>Templates</name> </group> </groups> <applications/> <items/> <discovery\_rules/> <httptests/> <macros/> <templates/> <screens/> <tags/> </template> </templates> </zabbix\_export> |
### Authors
* sookido (@sookido)
* Logan Vig (@logan2211)
* Dusan Matejka (@D3DeFi)
ansible community.zabbix.zabbix_usergroup – Create/delete/update Zabbix user groups community.zabbix.zabbix\_usergroup – Create/delete/update Zabbix user groups
============================================================================
Note
This plugin is part of the [community.zabbix collection](https://galaxy.ansible.com/community/zabbix) (version 1.5.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.zabbix`.
To use it in a playbook, specify: `community.zabbix.zabbix_usergroup`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create user groups if they do not exist.
* Delete existing user groups if they exist and are empty.
* Update existing user groups.
Requirements
------------
The below requirements are needed on the host that executes this module.
* zabbix-api >= 0.5.4
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **debug\_mode** string | **Choices:*** **disabled** ←
* enabled
| Whether debug mode is enabled or disabled. |
| **gui\_access** string | **Choices:*** **default** ←
* internal
* LDAP
* disable
| Frontend authentication method of the users in the group. Possible values: default - use the system default authentication method; internal - use internal authentication; LDAP - use LDAP authentication; disable - disable access to the frontend. |
| **http\_login\_password** string | | Basic Auth password |
| **http\_login\_user** string | | Basic Auth login |
| **login\_password** string / required | | Zabbix user password. If not set the environment variable `ZABBIX_PASSWORD` will be used. |
| **login\_user** string / required | | Zabbix user name. If not set the environment variable `ZABBIX_USERNAME` will be used. |
| **name** string / required | | Name of the user group to create, update or delete.
aliases: user\_group |
| **rights** list / elements=dictionary | | Permissions to assign to the group |
| | **host\_group** string / required | | Name of the host group to add permission to. |
| | **permission** string / required | **Choices:*** denied
* read-only
* read-write
| Access level to the host group. |
| **server\_url** string / required | | URL of Zabbix server, with protocol (http or https). `url` is an alias for `server_url`. If not set the environment variable `ZABBIX_SERVER` will be used.
aliases: url |
| **state** string | **Choices:*** **present** ←
* absent
| State of the user group. On `present`, it will create if user group does not exist or update the user group if the associated data is different. On `absent` will remove a user group if it exists. |
| **status** string | **Choices:*** **enabled** ←
* disabled
| Whether the user group is enabled or disabled. |
| **tag\_filters** list / elements=dictionary | | Tag based permissions to assign to the group |
| | **host\_group** string / required | | Name of the host group to add permission to. |
| | **tag** string | **Default:**"" | Tag name. |
| | **value** string | **Default:**"" | Tag value. |
| **timeout** integer | **Default:**10 | The timeout of API request (seconds). |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. If not set the environment variable `ZABBIX_VALIDATE_CERTS` will be used. |
Notes
-----
Note
* Only Zabbix >= 4.0 is supported.
* If you use *login\_password=zabbix*, the word “zabbix” is replaced by “**\*\*\*\***” in all module output, because *login\_password* uses `no_log`. See [this FAQ](../../../network/user_guide/faq#why-is-my-output-sometimes-replaced-with) for more information.
Examples
--------
```
# Base create user group example
- name: Create user group
community.zabbix.zabbix_usergroup:
server_url: "http://zabbix.example.com/zabbix/"
login_user: admin
login_password: secret
name: ACME
state: present
# Base create user group with disabled gui access
- name: Create user group with disabled gui access
community.zabbix.zabbix_usergroup:
server_url: "http://zabbix.example.com/zabbix/"
login_user: admin
login_password: secret
name: ACME
gui_access: disable
# Base create user group with permissions
- name: Create user group with permissions
community.zabbix.zabbix_usergroup:
server_url: "http://zabbix.example.com/zabbix/"
login_user: admin
login_password: secret
name: ACME
rights:
- host_group: Webserver
permission: read-write
- host_group: Databaseserver
permission: read-only
state: present
# Base create user group with tag permissions
- name: Create user group with tag permissions
community.zabbix.zabbix_usergroup:
server_url: "http://zabbix.example.com/zabbix/"
login_user: admin
login_password: secret
name: ACME
tag_filters:
- host_group: Webserver
tag: Application
value: Java
- host_group: Discovered hosts
tag: Service
value: JIRA
state: present
# Base delete user groups example
- name: Delete user groups
community.zabbix.zabbix_usergroup:
server_url: "http://zabbix.example.com/zabbix/"
login_user: admin
login_password: secret
name: ACME
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **msg** string | always | The result of the operation **Sample:** User group created: ACME, ID: 42 |
| **state** string | on success | User group state at the end of execution. **Sample:** present |
| **usergroup** string | on success | User group name. **Sample:** ACME |
| **usrgrpid** string | on success | User group id, if created, changed or deleted. **Sample:** 42 |
### Authors
* Tobias Birkefeld (@tcraxs)
| programming_docs |
ansible community.zabbix.zabbix_group – Create/delete Zabbix host groups community.zabbix.zabbix\_group – Create/delete Zabbix host groups
=================================================================
Note
This plugin is part of the [community.zabbix collection](https://galaxy.ansible.com/community/zabbix) (version 1.5.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.zabbix`.
To use it in a playbook, specify: `community.zabbix.zabbix_group`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Create host groups if they do not exist.
* Delete existing host groups if they exist.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* zabbix-api >= 0.5.4
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **host\_groups** list / elements=string / required | | List of host groups to create or delete.
aliases: host\_group |
| **http\_login\_password** string | | Basic Auth password |
| **http\_login\_user** string | | Basic Auth login |
| **login\_password** string / required | | Zabbix user password. If not set the environment variable `ZABBIX_PASSWORD` will be used. |
| **login\_user** string / required | | Zabbix user name. If not set the environment variable `ZABBIX_USERNAME` will be used. |
| **server\_url** string / required | | URL of Zabbix server, with protocol (http or https). `url` is an alias for `server_url`. If not set the environment variable `ZABBIX_SERVER` will be used.
aliases: url |
| **state** string | **Choices:*** **present** ←
* absent
| Create or delete host group. |
| **timeout** integer | **Default:**10 | The timeout of API request (seconds). |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. If not set the environment variable `ZABBIX_VALIDATE_CERTS` will be used. |
Notes
-----
Note
* Too many concurrent updates to the same group may cause Zabbix to return errors, see examples for a workaround if needed.
* If you use *login\_password=zabbix*, the word “zabbix” is replaced by “**\*\*\*\***” in all module output, because *login\_password* uses `no_log`. See [this FAQ](../../../network/user_guide/faq#why-is-my-output-sometimes-replaced-with) for more information.
Examples
--------
```
# Base create host groups example
- name: Create host groups
local_action:
module: community.zabbix.zabbix_group
server_url: http://monitor.example.com
login_user: username
login_password: password
state: present
host_groups:
- Example group1
- Example group2
# Limit the Zabbix group creations to one host since Zabbix can return an error when doing concurrent updates
- name: Create host groups
local_action:
module: community.zabbix.zabbix_group
server_url: http://monitor.example.com
login_user: username
login_password: password
state: present
host_groups:
- Example group1
- Example group2
when: inventory_hostname==groups['group_name'][0]
```
### Authors
* Cove (@cove)
* Tony Minfei Ding (!UNKNOWN)
* Harrison Gu (@harrisongu)
ansible community.zabbix.zabbix_discovery_rule – Create/delete/update Zabbix discovery rules community.zabbix.zabbix\_discovery\_rule – Create/delete/update Zabbix discovery rules
======================================================================================
Note
This plugin is part of the [community.zabbix collection](https://galaxy.ansible.com/community/zabbix) (version 1.5.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.zabbix`.
To use it in a playbook, specify: `community.zabbix.zabbix_discovery_rule`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Create discovery rule.
* Delete existing discovery rule.
* Update existing discovery rule with new options.
Requirements
------------
The below requirements are needed on the host that executes this module.
* zabbix-api >= 0.5.4
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **dchecks** list / elements=dictionary | | List of dictionaries of discovery check objects. For more information, review discovery check object documentation at <https://www.zabbix.com/documentation/current/manual/api/reference/dcheck/object>
aliases: dcheck |
| | **host\_source** string | **Choices:*** **DNS** ←
* IP
* discovery
| Source for host name. Possible values: DNS (default) IP discovery - discovery value of this check Options is available since Zabbix 4.4 |
| | **key** string | | The value of this property differs depending on the type of the check: - key to query for Zabbix agent checks - SNMP OID for SNMPv1, SNMPv2 and SNMPv3 checks |
| | **name\_source** string | **Choices:*** **None** ←
* DNS
* IP
* discovery
| Source for visible name. Possible values: none - (default) not specified DNS IP discovery - discovery value of this check Options is available since Zabbix 4.4 |
| | **ports** string | | One or several port ranges to check separated by commas. Used for all checks except for ICMP. |
| | **snmp\_community** string | | SNMP community. Required for SNMPv1 and SNMPv2 agent checks. |
| | **snmpv3\_authpassphrase** string | | Authentication passphrase used for SNMPv3 agent checks with security level set to authNoPriv or authPriv. |
| | **snmpv3\_authprotocol** string | **Choices:*** MD5
* SHA
| Authentication protocol used for SNMPv3 agent checks with security level set to authNoPriv or authPriv. Possible values: MD5 SHA |
| | **snmpv3\_contextname** string | | SNMPv3 context name. Used only by SNMPv3 checks. |
| | **snmpv3\_privpassphrase** string | | Privacy passphrase used for SNMPv3 agent checks with security level set to authPriv. |
| | **snmpv3\_privprotocol** string | **Choices:*** DES
* AES
| Privacy protocol used for SNMPv3 agent checks with security level set to authPriv. Possible values: DES AES |
| | **snmpv3\_securitylevel** string | **Choices:*** noAuthNoPriv
* authNoPriv
* authPriv
| Security level used for SNMPv3 agent checks. Possible values: noAuthNoPriv authNoPriv authPriv |
| | **snmpv3\_securityname** string | | Security name used for SNMPv3 agent checks. |
| | **type** string | **Choices:*** SSH
* LDAP
* SMTP
* FTP
* HTTP
* POP
* NNTP
* IMAP
* TCP
* Zabbix
* SNMPv1
* SNMPv2
* ICMP
* SNMPv3
* HTTPS
* Telnet
| Type of check. |
| | **uniq** boolean | **Choices:*** **no** ←
* yes
| Whether to use this check as a device uniqueness criteria. Only a single unique check can be configured for a discovery rule. Used for Zabbix agent, SNMPv1, SNMPv2 and SNMPv3 agent checks. Possible values: no - (default) do not use this check as a uniqueness criteria yes - use this check as a uniqueness criteria |
| **delay** string | **Default:**"1h" | Execution interval of the discovery rule. Accepts seconds, time unit with suffix and user macro. |
| **http\_login\_password** string | | Basic Auth password |
| **http\_login\_user** string | | Basic Auth login |
| **iprange** list / elements=string | | One or several IP ranges to check separated by commas. |
| **login\_password** string / required | | Zabbix user password. If not set the environment variable `ZABBIX_PASSWORD` will be used. |
| **login\_user** string / required | | Zabbix user name. If not set the environment variable `ZABBIX_USERNAME` will be used. |
| **name** string / required | | Name of the discovery rule. |
| **proxy** string | | Name of the proxy used for discovery. |
| **server\_url** string / required | | URL of Zabbix server, with protocol (http or https). `url` is an alias for `server_url`. If not set the environment variable `ZABBIX_SERVER` will be used.
aliases: url |
| **state** string | **Choices:*** **present** ←
* absent
| Create or delete discovery rules. |
| **status** string | **Choices:*** **enabled** ←
* disabled
| Whether the discovery rule is enabled. Possible values: enabled (default) disabled |
| **timeout** integer | **Default:**10 | The timeout of API request (seconds). |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. If not set the environment variable `ZABBIX_VALIDATE_CERTS` will be used. |
Notes
-----
Note
* Only Zabbix >= 4.0 is supported.
* If you use *login\_password=zabbix*, the word “zabbix” is replaced by “**\*\*\*\***” in all module output, because *login\_password* uses `no_log`. See [this FAQ](../../../network/user_guide/faq#why-is-my-output-sometimes-replaced-with) for more information.
Examples
--------
```
# Base create discovery rule example
- name: Create discovery rule with ICMP and zabbix agent checks
community.zabbix.zabbix_discovery_rule:
server_url: "http://zabbix.example.com/zabbix/"
login_user: admin
login_password: secret
name: ACME
state: present
iprange: 192.168.1.1-255
dchecks:
- type: ICMP
- type: Zabbix
key: "system.hostname"
ports: 10050
uniq: yes
host_source: "discovery"
# Base update (add new dcheck) discovery rule example
- name: Create discovery rule with ICMP and zabbix agent checks
community.zabbix.zabbix_discovery_rule:
server_url: "http://zabbix.example.com/zabbix/"
login_user: admin
login_password: secret
name: ACME
state: present
iprange: 192.168.1.1-255
dchecks:
- type: SNMPv3
snmp_community: CUSTOMER@snmp3-readonly
ports: "161"
key: iso.3.6.1.2.1.1.1.0
snmpv3_contextname: "ContextName"
snmpv3_securityname: "SecurityName"
snmpv3_securitylevel: "authPriv"
snmpv3_authprotocol: "SHA"
snmpv3_authpassphrase: "SeCrEt"
snmpv3_privprotocol: "AES"
snmpv3_privpassphrase: "TopSecret"
uniq: no
host_source: "DNS"
name_source: "None"
# Base delete discovery rule example
- name: Delete discovery rule
community.zabbix.zabbix_discovery_rule:
server_url: "http://zabbix.example.com/zabbix/"
login_user: admin
login_password: secret
name: ACME
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **drule** string | on success | Discovery rule name. **Sample:** ACME |
| **druleid** string | on success | Discovery rule id. **Sample:** 42 |
| **msg** string | always | The result of the operation **Sample:** Discovery rule created: ACME, ID: 42 |
| **state** string | on success | Discovery rule state at the end of execution. **Sample:** present |
### Authors
* Tobias Birkefeld (@tcraxs)
ansible community.kubernetes.helm_plugin_info – Gather information about Helm plugins community.kubernetes.helm\_plugin\_info – Gather information about Helm plugins
===============================================================================
Note
This plugin is part of the [community.kubernetes collection](https://galaxy.ansible.com/community/kubernetes) (version 1.2.1).
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.kubernetes`.
To use it in a playbook, specify: `community.kubernetes.helm_plugin_info`.
New in version 1.0.0: of community.kubernetes
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Gather information about Helm plugins installed in namespace.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Requirements
------------
The below requirements are needed on the host that executes this module.
* helm (<https://github.com/helm/helm/releases>)
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_key** string added in 1.2.0 of community.kubernetes | | Token used to authenticate with the API. Can also be specified via `K8S_AUTH_API_KEY` environment variable. |
| **binary\_path** path | | The path of a helm binary to use. |
| **ca\_cert** path added in 1.2.0 of community.kubernetes | | Path to a CA certificate used to authenticate with the API. The full certificate chain must be provided to avoid certificate validation errors. Can also be specified via `K8S_AUTH_SSL_CA_CERT` environment variable.
aliases: ssl\_ca\_cert |
| **context** string | | Helm option to specify which kubeconfig context to use. If the value is not specified in the task, the value of environment variable `K8S_AUTH_CONTEXT` will be used instead.
aliases: kube\_context |
| **host** string added in 1.2.0 of community.kubernetes | | Provide a URL for accessing the API. Can also be specified via `K8S_AUTH_HOST` environment variable. |
| **kubeconfig** path | | Helm option to specify kubeconfig path to use. If the value is not specified in the task, the value of environment variable `K8S_AUTH_KUBECONFIG` will be used instead.
aliases: kubeconfig\_path |
| **plugin\_name** string | | Name of Helm plugin, to gather particular plugin info. |
| **release\_namespace** string | | Kubernetes namespace where the helm plugins are installed.
aliases: namespace |
| **validate\_certs** boolean added in 1.2.0 of community.kubernetes | **Choices:*** no
* **yes** ←
| Whether or not to verify the API server's SSL certificates. Can also be specified via `K8S_AUTH_VERIFY_SSL` environment variable.
aliases: verify\_ssl |
Examples
--------
```
- name: Gather Helm plugin info
community.kubernetes.helm_plugin_info:
- name: Gather Helm env plugin info
community.kubernetes.helm_plugin_info:
plugin_name: env
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **command** string | always | Full `helm` command built by this module, in case you want to re-run the command outside the module or debug a problem. **Sample:** helm plugin list ... |
| **plugin\_list** list / elements=string | always | Helm plugin dict inside a list **Sample:** {'description': 'Print out the helm environment.', 'name': 'env', 'version': '0.1.0'} |
| **rc** integer | always | Helm plugin command return code **Sample:** 1 |
| **stderr** string | always | Full `helm` command stderr, in case you want to display it or examine the event log |
| **stdout** string | always | Full `helm` command stdout, in case you want to display it or examine the event log |
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.kubernetes.helm_plugin – Manage Helm plugins community.kubernetes.helm\_plugin – Manage Helm plugins
=======================================================
Note
This plugin is part of the [community.kubernetes collection](https://galaxy.ansible.com/community/kubernetes) (version 1.2.1).
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.kubernetes`.
To use it in a playbook, specify: `community.kubernetes.helm_plugin`.
New in version 1.0.0: of community.kubernetes
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manages Helm plugins.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Requirements
------------
The below requirements are needed on the host that executes this module.
* helm (<https://github.com/helm/helm/releases>)
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_key** string added in 1.2.0 of community.kubernetes | | Token used to authenticate with the API. Can also be specified via `K8S_AUTH_API_KEY` environment variable. |
| **binary\_path** path | | The path of a helm binary to use. |
| **ca\_cert** path added in 1.2.0 of community.kubernetes | | Path to a CA certificate used to authenticate with the API. The full certificate chain must be provided to avoid certificate validation errors. Can also be specified via `K8S_AUTH_SSL_CA_CERT` environment variable.
aliases: ssl\_ca\_cert |
| **context** string | | Helm option to specify which kubeconfig context to use. If the value is not specified in the task, the value of environment variable `K8S_AUTH_CONTEXT` will be used instead.
aliases: kube\_context |
| **host** string added in 1.2.0 of community.kubernetes | | Provide a URL for accessing the API. Can also be specified via `K8S_AUTH_HOST` environment variable. |
| **kubeconfig** path | | Helm option to specify kubeconfig path to use. If the value is not specified in the task, the value of environment variable `K8S_AUTH_KUBECONFIG` will be used instead.
aliases: kubeconfig\_path |
| **plugin\_name** string | | Name of Helm plugin. Required only if `state=absent`. |
| **plugin\_path** string | | Plugin path to a plugin on your local file system or a url of a remote VCS repo. If plugin path from file system is provided, make sure that tar is present on remote machine and not on Ansible controller. Required only if `state=present`. |
| **release\_namespace** string | | Kubernetes namespace where the helm plugin should be installed.
aliases: namespace |
| **state** string | **Choices:*** absent
* **present** ←
| If `state=present` the Helm plugin will be installed. If `state=absent` the Helm plugin will be removed. |
| **validate\_certs** boolean added in 1.2.0 of community.kubernetes | **Choices:*** no
* **yes** ←
| Whether or not to verify the API server's SSL certificates. Can also be specified via `K8S_AUTH_VERIFY_SSL` environment variable.
aliases: verify\_ssl |
Examples
--------
```
- name: Install Helm env plugin
community.kubernetes.helm_plugin:
plugin_path: https://github.com/adamreese/helm-env
state: present
- name: Install Helm plugin from local filesystem
community.kubernetes.helm_plugin:
plugin_path: https://domain/path/to/plugin.tar.gz
state: present
- name: Remove Helm env plugin
community.kubernetes.helm_plugin:
plugin_name: env
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **command** string | always | Full `helm` command built by this module, in case you want to re-run the command outside the module or debug a problem. **Sample:** helm plugin list ... |
| **msg** string | always | Info about successful command **Sample:** Plugin installed successfully |
| **rc** integer | always | Helm plugin command return code **Sample:** 1 |
| **stderr** string | always | Full `helm` command stderr, in case you want to display it or examine the event log |
| **stdout** string | always | Full `helm` command stdout, in case you want to display it or examine the event log |
### Authors
* Abhijeet Kasurde (@Akasurde)
| programming_docs |
ansible community.kubernetes.openshift – OpenShift inventory source community.kubernetes.openshift – OpenShift inventory source
===========================================================
Note
This plugin is part of the [community.kubernetes collection](https://galaxy.ansible.com/community/kubernetes) (version 1.2.1).
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.kubernetes`.
To use it in a playbook, specify: `community.kubernetes.openshift`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* Fetch containers, services and routes for one or more clusters
* Groups by cluster name, namespace, namespace\_services, namespace\_pods, namespace\_routes, and labels
* Uses openshift.(yml|yaml) YAML configuration file to set parameter values.
Requirements
------------
The below requirements are needed on the local controller node that executes this inventory.
* python >= 2.7
* openshift >= 0.6
* PyYAML >= 3.11
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **connections** string | | | Optional list of cluster connection settings. If no connections are provided, the default *~/.kube/config* and active context will be used, and objects will be returned for all namespaces the active user is authorized to access. |
| | **api\_key** string | | | Token used to authenticate with the API. Can also be specified via K8S\_AUTH\_API\_KEY environment variable. |
| | **ca\_cert** string | | | Path to a CA certificate used to authenticate with the API. Can also be specified via K8S\_AUTH\_SSL\_CA\_CERT environment variable.
aliases: ssl\_ca\_cert |
| | **client\_cert** string | | | Path to a certificate used to authenticate with the API. Can also be specified via K8S\_AUTH\_CERT\_FILE environment variable.
aliases: cert\_file |
| | **client\_key** string | | | Path to a key file used to authenticate with the API. Can also be specified via K8S\_AUTH\_KEY\_FILE environment variable.
aliases: key\_file |
| | **context** string | | | The name of a context found in the config file. Can also be specified via K8S\_AUTH\_CONTEXT environment variable. |
| | **host** string | | | Provide a URL for accessing the API. Can also be specified via K8S\_AUTH\_HOST environment variable. |
| | **kubeconfig** string | | | Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the OpenShift client will attempt to load the default configuration file from *~/.kube/config.json*. Can also be specified via K8S\_AUTH\_KUBECONFIG environment variable. |
| | **name** string | | | Optional name to assign to the cluster. If not provided, a name is constructed from the server and port. |
| | **namespaces** string | | | List of namespaces. If not specified, will fetch all containers for all namespaces user is authorized to access. |
| | **password** string | | | Provide a password for authenticating with the API. Can also be specified via K8S\_AUTH\_PASSWORD environment variable. |
| | **username** string | | | Provide a username for authenticating with the API. Can also be specified via K8S\_AUTH\_USERNAME environment variable. |
| | **validate\_certs** boolean | **Choices:*** no
* yes
| | Whether or not to verify the API server's SSL certificates. Can also be specified via K8S\_AUTH\_VERIFY\_SSL environment variable.
aliases: verify\_ssl |
| **plugin** string / required | **Choices:*** openshift
| | token that ensures this is a source file for the 'openshift' plugin. |
Examples
--------
```
# File must be named openshift.yaml or openshift.yml
# Authenticate with token, and return all pods and services for all namespaces
plugin: community.kubernetes.openshift
connections:
- host: https://192.168.64.4:8443
api_key: xxxxxxxxxxxxxxxx
verify_ssl: false
# Use default config (~/.kube/config) file and active context, and return objects for a specific namespace
plugin: community.kubernetes.openshift
connections:
- namespaces:
- testing
# Use a custom config file, and a specific context.
plugin: community.kubernetes.openshift
connections:
- kubeconfig: /path/to/config
context: 'awx/192-168-64-4:8443/developer'
```
### Authors
* Chris Houseknecht <@chouseknecht>
ansible Community.Kubernetes Community.Kubernetes
====================
Collection version 1.2.1
Plugin Index
------------
These are the plugins in the community.kubernetes collection
### Connection Plugins
* [kubectl](kubectl_connection#ansible-collections-community-kubernetes-kubectl-connection) – Execute tasks in pods running on Kubernetes.
### Inventory Plugins
* [k8s](k8s_inventory#ansible-collections-community-kubernetes-k8s-inventory) – Kubernetes (K8s) inventory source
* [openshift](openshift_inventory#ansible-collections-community-kubernetes-openshift-inventory) – OpenShift inventory source
### Lookup Plugins
* [k8s](k8s_lookup#ansible-collections-community-kubernetes-k8s-lookup) – Query the K8s API
### Modules
* [helm](helm_module#ansible-collections-community-kubernetes-helm-module) – Manages Kubernetes packages with the Helm package manager
* [helm\_info](helm_info_module#ansible-collections-community-kubernetes-helm-info-module) – Get information from Helm package deployed inside the cluster
* [helm\_plugin](helm_plugin_module#ansible-collections-community-kubernetes-helm-plugin-module) – Manage Helm plugins
* [helm\_plugin\_info](helm_plugin_info_module#ansible-collections-community-kubernetes-helm-plugin-info-module) – Gather information about Helm plugins
* [helm\_repository](helm_repository_module#ansible-collections-community-kubernetes-helm-repository-module) – Manage Helm repositories.
* [helm\_template](helm_template_module#ansible-collections-community-kubernetes-helm-template-module) – Render chart templates
* [k8s](k8s_module#ansible-collections-community-kubernetes-k8s-module) – Manage Kubernetes (K8s) objects
* [k8s\_auth](k8s_auth_module#ansible-collections-community-kubernetes-k8s-auth-module) – Authenticate to Kubernetes clusters which require an explicit login step
* [k8s\_cluster\_info](k8s_cluster_info_module#ansible-collections-community-kubernetes-k8s-cluster-info-module) – Describe Kubernetes (K8s) cluster, APIs available and their respective versions
* [k8s\_exec](k8s_exec_module#ansible-collections-community-kubernetes-k8s-exec-module) – Execute command in Pod
* [k8s\_info](k8s_info_module#ansible-collections-community-kubernetes-k8s-info-module) – Describe Kubernetes (K8s) objects
* [k8s\_log](k8s_log_module#ansible-collections-community-kubernetes-k8s-log-module) – Fetch logs from Kubernetes resources
* [k8s\_rollback](k8s_rollback_module#ansible-collections-community-kubernetes-k8s-rollback-module) – Rollback Kubernetes (K8S) Deployments and DaemonSets
* [k8s\_scale](k8s_scale_module#ansible-collections-community-kubernetes-k8s-scale-module) – Set a new size for a Deployment, ReplicaSet, Replication Controller, or Job.
* [k8s\_service](k8s_service_module#ansible-collections-community-kubernetes-k8s-service-module) – Manage Services on Kubernetes
See also
List of [collections](../../index#list-of-collections) with docs hosted here.
ansible community.kubernetes.k8s_info – Describe Kubernetes (K8s) objects community.kubernetes.k8s\_info – Describe Kubernetes (K8s) objects
==================================================================
Note
This plugin is part of the [community.kubernetes collection](https://galaxy.ansible.com/community/kubernetes) (version 1.2.1).
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.kubernetes`.
To use it in a playbook, specify: `community.kubernetes.k8s_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Use the OpenShift Python client to perform read operations on K8s objects.
* Access to the full range of K8s APIs.
* Authenticate using either a config file, certificates, password or token.
* Supports check mode.
* This module was called `k8s_facts` before Ansible 2.9. The usage did not change.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7
* openshift >= 0.6
* PyYAML >= 3.11
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_key** string | | Token used to authenticate with the API. Can also be specified via K8S\_AUTH\_API\_KEY environment variable. |
| **api\_version** string | **Default:**"v1" | Use to specify the API version. Use to create, delete, or discover an object without providing a full resource definition. Use in conjunction with *kind*, *name*, and *namespace* to identify a specific object. If *resource definition* is provided, the *apiVersion* value from the *resource\_definition* will override this option.
aliases: api, version |
| **ca\_cert** path | | Path to a CA certificate used to authenticate with the API. The full certificate chain must be provided to avoid certificate validation errors. Can also be specified via K8S\_AUTH\_SSL\_CA\_CERT environment variable.
aliases: ssl\_ca\_cert |
| **client\_cert** path | | Path to a certificate used to authenticate with the API. Can also be specified via K8S\_AUTH\_CERT\_FILE environment variable.
aliases: cert\_file |
| **client\_key** path | | Path to a key file used to authenticate with the API. Can also be specified via K8S\_AUTH\_KEY\_FILE environment variable.
aliases: key\_file |
| **context** string | | The name of a context found in the config file. Can also be specified via K8S\_AUTH\_CONTEXT environment variable. |
| **field\_selectors** list / elements=string | | List of field selectors to use to filter results |
| **host** string | | Provide a URL for accessing the API. Can also be specified via K8S\_AUTH\_HOST environment variable. |
| **kind** string / required | | Use to specify an object model. Use to create, delete, or discover an object without providing a full resource definition. Use in conjunction with *api\_version*, *name*, and *namespace* to identify a specific object. If *resource definition* is provided, the *kind* value from the *resource\_definition* will override this option. |
| **kubeconfig** path | | Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the openshift client will attempt to load the default configuration file from *~/.kube/config.json*. Can also be specified via K8S\_AUTH\_KUBECONFIG environment variable. |
| **label\_selectors** list / elements=string | | List of label selectors to use to filter results |
| **name** string | | Use to specify an object name. Use to create, delete, or discover an object without providing a full resource definition. Use in conjunction with *api\_version*, *kind* and *namespace* to identify a specific object. If *resource definition* is provided, the *metadata.name* value from the *resource\_definition* will override this option. |
| **namespace** string | | Use to specify an object namespace. Useful when creating, deleting, or discovering an object without providing a full resource definition. Use in conjunction with *api\_version*, *kind*, and *name* to identify a specific object. If *resource definition* is provided, the *metadata.namespace* value from the *resource\_definition* will override this option. |
| **password** string | | Provide a password for authenticating with the API. Can also be specified via K8S\_AUTH\_PASSWORD environment variable. Please read the description of the `username` option for a discussion of when this option is applicable. |
| **persist\_config** boolean | **Choices:*** no
* yes
| Whether or not to save the kube config refresh tokens. Can also be specified via K8S\_AUTH\_PERSIST\_CONFIG environment variable. When the k8s context is using a user credentials with refresh tokens (like oidc or gke/gcloud auth), the token is refreshed by the k8s python client library but not saved by default. So the old refresh token can expire and the next auth might fail. Setting this flag to true will tell the k8s python client to save the new refresh token to the kube config file. Default to false. Please note that the current version of the k8s python client library does not support setting this flag to True yet. The fix for this k8s python library is here: https://github.com/kubernetes-client/python-base/pull/169 |
| **proxy** string | | The URL of an HTTP proxy to use for the connection. Can also be specified via K8S\_AUTH\_PROXY environment variable. Please note that this module does not pick up typical proxy settings from the environment (e.g. HTTP\_PROXY). |
| **username** string | | Provide a username for authenticating with the API. Can also be specified via K8S\_AUTH\_USERNAME environment variable. Please note that this only works with clusters configured to use HTTP Basic Auth. If your cluster has a different form of authentication (e.g. OAuth2 in OpenShift), this option will not work as expected and you should look into the `k8s_auth` module, as that might do what you need. |
| **validate\_certs** boolean | **Choices:*** no
* yes
| Whether or not to verify the API server's SSL certificates. Can also be specified via K8S\_AUTH\_VERIFY\_SSL environment variable.
aliases: verify\_ssl |
| **wait** boolean | **Choices:*** **no** ←
* yes
| Whether to wait for certain resource kinds to end up in the desired state. By default the module exits once Kubernetes has received the request. Implemented for `state=present` for `Deployment`, `DaemonSet` and `Pod`, and for `state=absent` for all resource kinds. For resource kinds without an implementation, `wait` returns immediately unless `wait_condition` is set. |
| **wait\_condition** dictionary | | Specifies a custom condition on the status to wait for. Ignored if `wait` is not set or is set to False. |
| | **reason** string | | The value of the reason field in your desired condition For example, if a `Deployment` is paused, The `Progressing` `type` will have the `DeploymentPaused` reason. The possible reasons in a condition are specific to each resource type in Kubernetes. See the API documentation of the status field for a given resource to see possible choices. |
| | **status** string | **Choices:*** **True** ←
* False
* Unknown
| The value of the status field in your desired condition. For example, if a `Deployment` is paused, the `Progressing` `type` will have the `Unknown` status. |
| | **type** string | | The type of condition to wait for. For example, the `Pod` resource will set the `Ready` condition (among others). Required if you are specifying a `wait_condition`. If left empty, the `wait_condition` field will be ignored. The possible types for a condition are specific to each resource type in Kubernetes. See the API documentation of the status field for a given resource to see possible choices. |
| **wait\_sleep** integer | **Default:**5 | Number of seconds to sleep between checks. |
| **wait\_timeout** integer | **Default:**120 | How long in seconds to wait for the resource to end up in the desired state. Ignored if `wait` is not set. |
Notes
-----
Note
* The OpenShift Python client wraps the K8s Python client, providing full access to all of the APIS and models available on both platforms. For API version details and additional information visit <https://github.com/openshift/openshift-restclient-python>
* To avoid SSL certificate validation errors when `validate_certs` is *True*, the full certificate chain for the API server must be provided via `ca_cert` or in the kubeconfig file.
Examples
--------
```
- name: Get an existing Service object
community.kubernetes.k8s_info:
api_version: v1
kind: Service
name: web
namespace: testing
register: web_service
- name: Get a list of all service objects
community.kubernetes.k8s_info:
api_version: v1
kind: Service
namespace: testing
register: service_list
- name: Get a list of all pods from any namespace
community.kubernetes.k8s_info:
kind: Pod
register: pod_list
- name: Search for all Pods labelled app=web
community.kubernetes.k8s_info:
kind: Pod
label_selectors:
- app = web
- tier in (dev, test)
- name: Using vars while using label_selectors
community.kubernetes.k8s_info:
kind: Pod
label_selectors:
- "app = {{ app_label_web }}"
vars:
app_label_web: web
- name: Search for all running pods
community.kubernetes.k8s_info:
kind: Pod
field_selectors:
- status.phase=Running
- name: List custom objects created using CRD
community.kubernetes.k8s_info:
kind: MyCustomObject
api_version: "stable.example.com/v1"
- name: Wait till the Object is created
community.kubernetes.k8s_info:
kind: Pod
wait: yes
name: pod-not-yet-created
namespace: default
wait_sleep: 10
wait_timeout: 360
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **api\_found** boolean | always | Whether the specified api\_version and kind were successfully mapped to an existing API on the targeted cluster. Version added 1.2.0. |
| **resources** complex | success | The object(s) that exists |
| | **api\_version** string | success | The versioned schema of this representation of an object. |
| | **kind** string | success | Represents the REST resource this object represents. |
| | **metadata** dictionary | success | Standard object metadata. Includes name, namespace, annotations, labels, etc. |
| | **spec** dictionary | success | Specific attributes of the object. Will vary based on the *api\_version* and *kind*. |
| | **status** dictionary | success | Current status details for the object. |
### Authors
* Will Thames (@willthames)
ansible community.kubernetes.helm_template – Render chart templates community.kubernetes.helm\_template – Render chart templates
============================================================
Note
This plugin is part of the [community.kubernetes collection](https://galaxy.ansible.com/community/kubernetes) (version 1.2.1).
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.kubernetes`.
To use it in a playbook, specify: `community.kubernetes.helm_template`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Render chart templates to an output directory or as text of concatenated yaml documents.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **binary\_path** path | | The path of a helm binary to use. |
| **chart\_ref** path / required | | Chart reference with repo prefix, for example, `nginx-stable/nginx-ingress`. Path to a packaged chart. Path to an unpacked chart directory. Absolute URL. |
| **chart\_repo\_url** string | | Chart repository URL where the requested chart is located. |
| **chart\_version** string | | Chart version to use. If this is not specified, the latest version is installed. |
| **include\_crds** boolean | **Choices:*** **no** ←
* yes
| Include custom resource descriptions in rendered templates. |
| **output\_dir** path | | Output directory where templates will be written. If the directory already exists, it will be overwritten. |
| **release\_values** dictionary | **Default:**{} | Values to pass to chart.
aliases: values |
| **update\_repo\_cache** boolean | **Choices:*** **no** ←
* yes
| Run `helm repo update` before the operation. Can be run as part of the template generation or as a separate step. |
| **values\_files** list / elements=string | **Default:**[] | Value files to pass to chart. Paths will be read from the target host's filesystem, not the host running ansible.
*values\_files* option is evaluated before *values* option if both are used. Paths are evaluated in the order the paths are specified. |
Examples
--------
```
- name: Render templates to specified directory
community.kubernetes.helm_template:
chart_ref: stable/prometheus
output_dir: mycharts
- name: Render templates
community.kubernetes.helm_template:
chart_ref: stable/prometheus
register: result
- name: Write templates to file
copy:
dest: myfile.yaml
content: "{{ result.stdout }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **command** string | always | Full `helm` command run by this module, in case you want to re-run the command outside the module or debug a problem. **Sample:** helm template --output-dir mychart nginx-stable/nginx-ingress |
| **stderr** string | always | Full `helm` command stderr, in case you want to display it or examine the event log. |
| **stdout** string | always | Full `helm` command stdout. If no *output\_dir* has been provided this will contain the rendered templates as concatenated yaml documents. |
### Authors
* Mike Graves (@gravesm)
| programming_docs |
ansible community.kubernetes.kubectl – Execute tasks in pods running on Kubernetes. community.kubernetes.kubectl – Execute tasks in pods running on Kubernetes.
===========================================================================
Note
This plugin is part of the [community.kubernetes collection](https://galaxy.ansible.com/community/kubernetes) (version 1.2.1).
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.kubernetes`.
To use it in a playbook, specify: `community.kubernetes.kubectl`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
Synopsis
--------
* Use the kubectl exec command to run tasks in, or put/fetch files to, pods running on the Kubernetes container platform.
Requirements
------------
The below requirements are needed on the local controller node that executes this connection.
* kubectl (go binary)
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **ca\_cert** string | **Default:**"" | env:K8S\_AUTH\_SSL\_CA\_CERT var: ansible\_kubectl\_ssl\_ca\_cert var: ansible\_kubectl\_ca\_cert | Path to a CA certificate used to authenticate with the API.
aliases: kubectl\_ssl\_ca\_cert |
| **client\_cert** string | **Default:**"" | env:K8S\_AUTH\_CERT\_FILE var: ansible\_kubectl\_cert\_file var: ansible\_kubectl\_client\_cert | Path to a certificate used to authenticate with the API.
aliases: kubectl\_cert\_file |
| **client\_key** string | **Default:**"" | env:K8S\_AUTH\_KEY\_FILE var: ansible\_kubectl\_key\_file var: ansible\_kubectl\_client\_key | Path to a key file used to authenticate with the API.
aliases: kubectl\_key\_file |
| **kubectl\_container** string | **Default:**"" | env:K8S\_AUTH\_CONTAINER var: ansible\_kubectl\_container | Container name. Required when a pod contains more than one container. |
| **kubectl\_context** string | **Default:**"" | env:K8S\_AUTH\_CONTEXT var: ansible\_kubectl\_context | The name of a context found in the K8s config file. |
| **kubectl\_extra\_args** string | **Default:**"" | env:K8S\_AUTH\_EXTRA\_ARGS var: ansible\_kubectl\_extra\_args | Extra arguments to pass to the kubectl command line. Please be aware that this passes information directly on the command line and it could expose sensitive data. |
| **kubectl\_host** string | **Default:**"" | env:K8S\_AUTH\_HOST env:K8S\_AUTH\_SERVER var: ansible\_kubectl\_host var: ansible\_kubectl\_server | URL for accessing the API. |
| **kubectl\_kubeconfig** string | **Default:**"" | env:K8S\_AUTH\_KUBECONFIG var: ansible\_kubectl\_kubeconfig var: ansible\_kubectl\_config | Path to a kubectl config file. Defaults to *~/.kube/config*
|
| **kubectl\_namespace** string | **Default:**"" | env:K8S\_AUTH\_NAMESPACE var: ansible\_kubectl\_namespace | The namespace of the pod |
| **kubectl\_password** string | **Default:**"" | env:K8S\_AUTH\_PASSWORD var: ansible\_kubectl\_password | Provide a password for authenticating with the API. Please be aware that this passes information directly on the command line and it could expose sensitive data. We recommend using the file based authentication options instead. |
| **kubectl\_pod** string | **Default:**"" | env:K8S\_AUTH\_POD var: ansible\_kubectl\_pod | Pod name. Required when the host name does not match pod name. |
| **kubectl\_token** string | | env:K8S\_AUTH\_TOKEN env:K8S\_AUTH\_API\_KEY var: ansible\_kubectl\_token var: ansible\_kubectl\_api\_key | API authentication bearer token. Please be aware that this passes information directly on the command line and it could expose sensitive data. We recommend using the file based authentication options instead. |
| **kubectl\_username** string | **Default:**"" | env:K8S\_AUTH\_USERNAME var: ansible\_kubectl\_username var: ansible\_kubectl\_user | Provide a username for authenticating with the API. |
| **validate\_certs** string | **Default:**"" | env:K8S\_AUTH\_VERIFY\_SSL var: ansible\_kubectl\_verify\_ssl var: ansible\_kubectl\_validate\_certs | Whether or not to verify the API server's SSL certificate. Defaults to *true*.
aliases: kubectl\_verify\_ssl |
### Authors
* xuxinkun
ansible community.kubernetes.k8s_cluster_info – Describe Kubernetes (K8s) cluster, APIs available and their respective versions community.kubernetes.k8s\_cluster\_info – Describe Kubernetes (K8s) cluster, APIs available and their respective versions
=========================================================================================================================
Note
This plugin is part of the [community.kubernetes collection](https://galaxy.ansible.com/community/kubernetes) (version 1.2.1).
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.kubernetes`.
To use it in a playbook, specify: `community.kubernetes.k8s_cluster_info`.
New in version 0.11.1: of community.kubernetes
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Use the OpenShift Python client to perform read operations on K8s objects.
* Authenticate using either a config file, certificates, password or token.
* Supports check mode.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7
* openshift >= 0.6
* PyYAML >= 3.11
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_key** string | | Token used to authenticate with the API. Can also be specified via K8S\_AUTH\_API\_KEY environment variable. |
| **ca\_cert** path | | Path to a CA certificate used to authenticate with the API. The full certificate chain must be provided to avoid certificate validation errors. Can also be specified via K8S\_AUTH\_SSL\_CA\_CERT environment variable.
aliases: ssl\_ca\_cert |
| **client\_cert** path | | Path to a certificate used to authenticate with the API. Can also be specified via K8S\_AUTH\_CERT\_FILE environment variable.
aliases: cert\_file |
| **client\_key** path | | Path to a key file used to authenticate with the API. Can also be specified via K8S\_AUTH\_KEY\_FILE environment variable.
aliases: key\_file |
| **context** string | | The name of a context found in the config file. Can also be specified via K8S\_AUTH\_CONTEXT environment variable. |
| **host** string | | Provide a URL for accessing the API. Can also be specified via K8S\_AUTH\_HOST environment variable. |
| **invalidate\_cache** boolean | **Choices:*** no
* **yes** ←
| Invalidate cache before retrieving information about cluster. |
| **kubeconfig** path | | Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the openshift client will attempt to load the default configuration file from *~/.kube/config.json*. Can also be specified via K8S\_AUTH\_KUBECONFIG environment variable. |
| **password** string | | Provide a password for authenticating with the API. Can also be specified via K8S\_AUTH\_PASSWORD environment variable. Please read the description of the `username` option for a discussion of when this option is applicable. |
| **persist\_config** boolean | **Choices:*** no
* yes
| Whether or not to save the kube config refresh tokens. Can also be specified via K8S\_AUTH\_PERSIST\_CONFIG environment variable. When the k8s context is using a user credentials with refresh tokens (like oidc or gke/gcloud auth), the token is refreshed by the k8s python client library but not saved by default. So the old refresh token can expire and the next auth might fail. Setting this flag to true will tell the k8s python client to save the new refresh token to the kube config file. Default to false. Please note that the current version of the k8s python client library does not support setting this flag to True yet. The fix for this k8s python library is here: https://github.com/kubernetes-client/python-base/pull/169 |
| **proxy** string | | The URL of an HTTP proxy to use for the connection. Can also be specified via K8S\_AUTH\_PROXY environment variable. Please note that this module does not pick up typical proxy settings from the environment (e.g. HTTP\_PROXY). |
| **username** string | | Provide a username for authenticating with the API. Can also be specified via K8S\_AUTH\_USERNAME environment variable. Please note that this only works with clusters configured to use HTTP Basic Auth. If your cluster has a different form of authentication (e.g. OAuth2 in OpenShift), this option will not work as expected and you should look into the `k8s_auth` module, as that might do what you need. |
| **validate\_certs** boolean | **Choices:*** no
* yes
| Whether or not to verify the API server's SSL certificates. Can also be specified via K8S\_AUTH\_VERIFY\_SSL environment variable.
aliases: verify\_ssl |
Notes
-----
Note
* The OpenShift Python client wraps the K8s Python client, providing full access to all of the APIS and models available on both platforms. For API version details and additional information visit <https://github.com/openshift/openshift-restclient-python>
* To avoid SSL certificate validation errors when `validate_certs` is *True*, the full certificate chain for the API server must be provided via `ca_cert` or in the kubeconfig file.
Examples
--------
```
- name: Get Cluster information
community.kubernetes.k8s_cluster_info:
register: api_status
- name: Do not invalidate cache before getting information
community.kubernetes.k8s_cluster_info:
invalidate_cache: False
register: api_status
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **apis** dictionary | success | The API(s) that exists in dictionary |
| | **api\_version** string | success | API version |
| | **available\_api\_version** list / elements=string | success | All available versions of the given API |
| | **categories** list / elements=string | success | API categories |
| | **group\_version** string | success | Resource Group version |
| | **kind** string | success | Resource kind |
| | **name** string | success | Resource short name |
| | **namespaced** boolean | success | If resource is namespaced |
| | **preferred** boolean | success | If resource version preferred |
| | **preferred\_api\_version** string | success | Preferred version of the given API |
| | **short\_names** string | success | Resource short names |
| | **singular\_name** string | success | Resource singular name |
| **connection** dictionary | success | Connection information |
| | **cert\_file** string | success | Path to client certificate. |
| | **host** string | success | Host URL |
| | **password** string | success | User password |
| | **proxy** string | success | Proxy details |
| | **ssl\_ca\_cert** string | success | Path to CA certificate |
| | **username** string | success | Username |
| | **verify\_ssl** boolean | success | SSL verification status |
| **version** dictionary | success | Information about server and client version |
| | **client** string | success | Client version |
| | **server** dictionary | success | Server version |
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.kubernetes.helm_info – Get information from Helm package deployed inside the cluster community.kubernetes.helm\_info – Get information from Helm package deployed inside the cluster
===============================================================================================
Note
This plugin is part of the [community.kubernetes collection](https://galaxy.ansible.com/community/kubernetes) (version 1.2.1).
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.kubernetes`.
To use it in a playbook, specify: `community.kubernetes.helm_info`.
New in version 0.11.0: of community.kubernetes
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Get information (values, states, …) from Helm package deployed inside the cluster.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Requirements
------------
The below requirements are needed on the host that executes this module.
* helm (<https://github.com/helm/helm/releases>)
* yaml (<https://pypi.org/project/PyYAML/>)
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_key** string added in 1.2.0 of community.kubernetes | | Token used to authenticate with the API. Can also be specified via `K8S_AUTH_API_KEY` environment variable. |
| **binary\_path** path | | The path of a helm binary to use. |
| **ca\_cert** path added in 1.2.0 of community.kubernetes | | Path to a CA certificate used to authenticate with the API. The full certificate chain must be provided to avoid certificate validation errors. Can also be specified via `K8S_AUTH_SSL_CA_CERT` environment variable.
aliases: ssl\_ca\_cert |
| **context** string | | Helm option to specify which kubeconfig context to use. If the value is not specified in the task, the value of environment variable `K8S_AUTH_CONTEXT` will be used instead.
aliases: kube\_context |
| **host** string added in 1.2.0 of community.kubernetes | | Provide a URL for accessing the API. Can also be specified via `K8S_AUTH_HOST` environment variable. |
| **kubeconfig** path | | Helm option to specify kubeconfig path to use. If the value is not specified in the task, the value of environment variable `K8S_AUTH_KUBECONFIG` will be used instead.
aliases: kubeconfig\_path |
| **release\_name** string / required | | Release name to manage.
aliases: name |
| **release\_namespace** string / required | | Kubernetes namespace where the chart should be installed.
aliases: namespace |
| **validate\_certs** boolean added in 1.2.0 of community.kubernetes | **Choices:*** no
* **yes** ←
| Whether or not to verify the API server's SSL certificates. Can also be specified via `K8S_AUTH_VERIFY_SSL` environment variable.
aliases: verify\_ssl |
Examples
--------
```
- name: Deploy latest version of Grafana chart inside monitoring namespace
community.kubernetes.helm_info:
name: test
release_namespace: monitoring
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **status** complex | only when release exists | A dictionary of status output |
| | **appversion** string | always | Version of app deployed |
| | **chart** string | always | Chart name and chart version |
| | **name** string | always | Name of the release |
| | **namespace** string | always | Namespace where the release is deployed |
| | **revision** string | always | Number of time where the release has been updated |
| | **status** string | always | Status of release (can be DEPLOYED, FAILED, ...) |
| | **updated** string | always | The Date of last update |
| | **values** string | always | Dict of Values used to deploy |
### Authors
* Lucas Boisserie (@LucasBoisserie)
ansible community.kubernetes.k8s_log – Fetch logs from Kubernetes resources community.kubernetes.k8s\_log – Fetch logs from Kubernetes resources
====================================================================
Note
This plugin is part of the [community.kubernetes collection](https://galaxy.ansible.com/community/kubernetes) (version 1.2.1).
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.kubernetes`.
To use it in a playbook, specify: `community.kubernetes.k8s_log`.
New in version 0.10.0: of community.kubernetes
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Use the OpenShift Python client to perform read operations on K8s log endpoints.
* Authenticate using either a config file, certificates, password or token.
* Supports check mode.
* Analogous to `kubectl logs` or `oc logs`
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7
* openshift >= 0.6
* PyYAML >= 3.11
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_key** string | | Token used to authenticate with the API. Can also be specified via K8S\_AUTH\_API\_KEY environment variable. |
| **api\_version** string | **Default:**"v1" | Use to specify the API version. Use to create, delete, or discover an object without providing a full resource definition. Use in conjunction with *kind*, *name*, and *namespace* to identify a specific object. If *resource definition* is provided, the *apiVersion* value from the *resource\_definition* will override this option.
aliases: api, version |
| **ca\_cert** path | | Path to a CA certificate used to authenticate with the API. The full certificate chain must be provided to avoid certificate validation errors. Can also be specified via K8S\_AUTH\_SSL\_CA\_CERT environment variable.
aliases: ssl\_ca\_cert |
| **client\_cert** path | | Path to a certificate used to authenticate with the API. Can also be specified via K8S\_AUTH\_CERT\_FILE environment variable.
aliases: cert\_file |
| **client\_key** path | | Path to a key file used to authenticate with the API. Can also be specified via K8S\_AUTH\_KEY\_FILE environment variable.
aliases: key\_file |
| **container** string | | Use to specify the container within a pod to grab the log from. If there is only one container, this will default to that container. If there is more than one container, this option is required. |
| **context** string | | The name of a context found in the config file. Can also be specified via K8S\_AUTH\_CONTEXT environment variable. |
| **host** string | | Provide a URL for accessing the API. Can also be specified via K8S\_AUTH\_HOST environment variable. |
| **kind** string | **Default:**"Pod" | Use to specify an object model. Use in conjunction with *api\_version*, *name*, and *namespace* to identify a specific object. If using *label\_selectors*, cannot be overridden. |
| **kubeconfig** path | | Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the openshift client will attempt to load the default configuration file from *~/.kube/config.json*. Can also be specified via K8S\_AUTH\_KUBECONFIG environment variable. |
| **label\_selectors** list / elements=string | | List of label selectors to use to filter results Only one of *name* or *label\_selectors* may be provided. |
| **name** string | | Use to specify an object name. Use in conjunction with *api\_version*, *kind* and *namespace* to identify a specific object. Only one of *name* or *label\_selectors* may be provided. |
| **namespace** string | | Use to specify an object namespace. Useful when creating, deleting, or discovering an object without providing a full resource definition. Use in conjunction with *api\_version*, *kind*, and *name* to identify a specific object. If *resource definition* is provided, the *metadata.namespace* value from the *resource\_definition* will override this option. |
| **password** string | | Provide a password for authenticating with the API. Can also be specified via K8S\_AUTH\_PASSWORD environment variable. Please read the description of the `username` option for a discussion of when this option is applicable. |
| **persist\_config** boolean | **Choices:*** no
* yes
| Whether or not to save the kube config refresh tokens. Can also be specified via K8S\_AUTH\_PERSIST\_CONFIG environment variable. When the k8s context is using a user credentials with refresh tokens (like oidc or gke/gcloud auth), the token is refreshed by the k8s python client library but not saved by default. So the old refresh token can expire and the next auth might fail. Setting this flag to true will tell the k8s python client to save the new refresh token to the kube config file. Default to false. Please note that the current version of the k8s python client library does not support setting this flag to True yet. The fix for this k8s python library is here: https://github.com/kubernetes-client/python-base/pull/169 |
| **proxy** string | | The URL of an HTTP proxy to use for the connection. Can also be specified via K8S\_AUTH\_PROXY environment variable. Please note that this module does not pick up typical proxy settings from the environment (e.g. HTTP\_PROXY). |
| **username** string | | Provide a username for authenticating with the API. Can also be specified via K8S\_AUTH\_USERNAME environment variable. Please note that this only works with clusters configured to use HTTP Basic Auth. If your cluster has a different form of authentication (e.g. OAuth2 in OpenShift), this option will not work as expected and you should look into the `k8s_auth` module, as that might do what you need. |
| **validate\_certs** boolean | **Choices:*** no
* yes
| Whether or not to verify the API server's SSL certificates. Can also be specified via K8S\_AUTH\_VERIFY\_SSL environment variable.
aliases: verify\_ssl |
Notes
-----
Note
* The OpenShift Python client wraps the K8s Python client, providing full access to all of the APIS and models available on both platforms. For API version details and additional information visit <https://github.com/openshift/openshift-restclient-python>
* To avoid SSL certificate validation errors when `validate_certs` is *True*, the full certificate chain for the API server must be provided via `ca_cert` or in the kubeconfig file.
Examples
--------
```
- name: Get a log from a Pod
community.kubernetes.k8s_log:
name: example-1
namespace: testing
register: log
# This will get the log from the first Pod found matching the selector
- name: Log a Pod matching a label selector
community.kubernetes.k8s_log:
namespace: testing
label_selectors:
- app=example
register: log
# This will get the log from a single Pod managed by this Deployment
- name: Get a log from a Deployment
community.kubernetes.k8s_log:
api_version: apps/v1
kind: Deployment
namespace: testing
name: example
register: log
# This will get the log from a single Pod managed by this DeploymentConfig
- name: Get a log from a DeploymentConfig
community.kubernetes.k8s_log:
api_version: apps.openshift.io/v1
kind: DeploymentConfig
namespace: testing
name: example
register: log
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **log** string | success | The text log of the object |
| **log\_lines** list / elements=string | success | The log of the object, split on newlines |
### Authors
* Fabian von Feilitzsch (@fabianvf)
| programming_docs |
ansible community.kubernetes.k8s – Manage Kubernetes (K8s) objects community.kubernetes.k8s – Manage Kubernetes (K8s) objects
==========================================================
Note
This plugin is part of the [community.kubernetes collection](https://galaxy.ansible.com/community/kubernetes) (version 1.2.1).
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.kubernetes`.
To use it in a playbook, specify: `community.kubernetes.k8s`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Use the OpenShift Python client to perform CRUD operations on K8s objects.
* Pass the object definition from a source file or inline. See examples for reading files and using Jinja templates or vault-encrypted files.
* Access to the full range of K8s APIs.
* Use the [community.kubernetes.k8s\_info](k8s_info_module#ansible-collections-community-kubernetes-k8s-info-module) module to obtain a list of items about an object of type `kind`
* Authenticate using either a config file, certificates, password or token.
* Supports check mode.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7
* openshift >= 0.6
* PyYAML >= 3.11
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_key** string | | Token used to authenticate with the API. Can also be specified via K8S\_AUTH\_API\_KEY environment variable. |
| **api\_version** string | **Default:**"v1" | Use to specify the API version. Use to create, delete, or discover an object without providing a full resource definition. Use in conjunction with *kind*, *name*, and *namespace* to identify a specific object. If *resource definition* is provided, the *apiVersion* value from the *resource\_definition* will override this option.
aliases: api, version |
| **append\_hash** boolean | **Choices:*** **no** ←
* yes
| Whether to append a hash to a resource name for immutability purposes Applies only to ConfigMap and Secret resources The parameter will be silently ignored for other resource kinds The full definition of an object is needed to generate the hash - this means that deleting an object created with append\_hash will only work if the same object is passed with state=absent (alternatively, just use state=absent with the name including the generated hash and append\_hash=no) Requires openshift >= 0.7.2 |
| **apply** boolean | **Choices:*** **no** ←
* yes
|
`apply` compares the desired resource definition with the previously supplied resource definition, ignoring properties that are automatically generated
`apply` works better with Services than 'force=yes' Requires openshift >= 0.9.2 mutually exclusive with `merge_type`
|
| **ca\_cert** path | | Path to a CA certificate used to authenticate with the API. The full certificate chain must be provided to avoid certificate validation errors. Can also be specified via K8S\_AUTH\_SSL\_CA\_CERT environment variable.
aliases: ssl\_ca\_cert |
| **client\_cert** path | | Path to a certificate used to authenticate with the API. Can also be specified via K8S\_AUTH\_CERT\_FILE environment variable.
aliases: cert\_file |
| **client\_key** path | | Path to a key file used to authenticate with the API. Can also be specified via K8S\_AUTH\_KEY\_FILE environment variable.
aliases: key\_file |
| **context** string | | The name of a context found in the config file. Can also be specified via K8S\_AUTH\_CONTEXT environment variable. |
| **delete\_options** dictionary added in 1.2.0 of community.kubernetes | | Configure behavior when deleting an object. Only used when *state=absent*. |
| | **gracePeriodSeconds** integer | | Specify how many seconds to wait before forcefully terminating. Only implemented for Pod resources. If not specified, the default grace period for the object type will be used. |
| | **preconditions** dictionary | | Specify condition that must be met for delete to proceed. |
| | | **resourceVersion** string | | Specify the resource version of the target object. |
| | | **uid** string | | Specify the UID of the target object. |
| | **propagationPolicy** string | **Choices:*** Foreground
* Background
* Orphan
| Use to control how dependent objects are deleted. If not specified, the default policy for the object type will be used. This may vary across object types. |
| **force** boolean | **Choices:*** **no** ←
* yes
| If set to `yes`, and *state* is `present`, an existing object will be replaced. |
| **host** string | | Provide a URL for accessing the API. Can also be specified via K8S\_AUTH\_HOST environment variable. |
| **kind** string | | Use to specify an object model. Use to create, delete, or discover an object without providing a full resource definition. Use in conjunction with *api\_version*, *name*, and *namespace* to identify a specific object. If *resource definition* is provided, the *kind* value from the *resource\_definition* will override this option. |
| **kubeconfig** path | | Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the openshift client will attempt to load the default configuration file from *~/.kube/config.json*. Can also be specified via K8S\_AUTH\_KUBECONFIG environment variable. |
| **merge\_type** list / elements=string | **Choices:*** json
* merge
* strategic-merge
| Whether to override the default patch merge approach with a specific type. By default, the strategic merge will typically be used. For example, Custom Resource Definitions typically aren't updatable by the usual strategic merge. You may want to use `merge` if you see "strategic merge patch format is not supported" See <https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch/#use-a-json-merge-patch-to-update-a-deployment>
Requires openshift >= 0.6.2 If more than one merge\_type is given, the merge\_types will be tried in order If openshift >= 0.6.2, this defaults to `['strategic-merge', 'merge']`, which is ideal for using the same parameters on resource kinds that combine Custom Resources and built-in resources. For openshift < 0.6.2, the default is simply `strategic-merge`. mutually exclusive with `apply`
|
| **name** string | | Use to specify an object name. Use to create, delete, or discover an object without providing a full resource definition. Use in conjunction with *api\_version*, *kind* and *namespace* to identify a specific object. If *resource definition* is provided, the *metadata.name* value from the *resource\_definition* will override this option. |
| **namespace** string | | Use to specify an object namespace. Useful when creating, deleting, or discovering an object without providing a full resource definition. Use in conjunction with *api\_version*, *kind*, and *name* to identify a specific object. If *resource definition* is provided, the *metadata.namespace* value from the *resource\_definition* will override this option. |
| **password** string | | Provide a password for authenticating with the API. Can also be specified via K8S\_AUTH\_PASSWORD environment variable. Please read the description of the `username` option for a discussion of when this option is applicable. |
| **persist\_config** boolean | **Choices:*** no
* yes
| Whether or not to save the kube config refresh tokens. Can also be specified via K8S\_AUTH\_PERSIST\_CONFIG environment variable. When the k8s context is using a user credentials with refresh tokens (like oidc or gke/gcloud auth), the token is refreshed by the k8s python client library but not saved by default. So the old refresh token can expire and the next auth might fail. Setting this flag to true will tell the k8s python client to save the new refresh token to the kube config file. Default to false. Please note that the current version of the k8s python client library does not support setting this flag to True yet. The fix for this k8s python library is here: https://github.com/kubernetes-client/python-base/pull/169 |
| **proxy** string | | The URL of an HTTP proxy to use for the connection. Can also be specified via K8S\_AUTH\_PROXY environment variable. Please note that this module does not pick up typical proxy settings from the environment (e.g. HTTP\_PROXY). |
| **resource\_definition** string | | Provide a valid YAML definition (either as a string, list, or dict) for an object when creating or updating. NOTE: *kind*, *api\_version*, *name*, and *namespace* will be overwritten by corresponding values found in the provided *resource\_definition*.
aliases: definition, inline |
| **src** path | | Provide a path to a file containing a valid YAML definition of an object or objects to be created or updated. Mutually exclusive with *resource\_definition*. NOTE: *kind*, *api\_version*, *name*, and *namespace* will be overwritten by corresponding values found in the configuration read in from the *src* file. Reads from the local file system. To read from the Ansible controller's file system, including vaulted files, use the file lookup plugin or template lookup plugin, combined with the from\_yaml filter, and pass the result to *resource\_definition*. See Examples below. Mutually exclusive with *template* in case of M(k8s) module. |
| **state** string | **Choices:*** absent
* **present** ←
| Determines if an object should be created, patched, or deleted. When set to `present`, an object will be created, if it does not already exist. If set to `absent`, an existing object will be deleted. If set to `present`, an existing object will be patched, if its attributes differ from those specified using *resource\_definition* or *src*. |
| **template** raw | | Provide a valid YAML template definition file for an object when creating or updating. Value can be provided as string or dictionary. Mutually exclusive with `src` and `resource_definition`. Template files needs to be present on the Ansible Controller's file system. Additional parameters can be specified using dictionary. Valid additional parameters -
`newline_sequence` (str): Specify the newline sequence to use for templating files. valid choices are "\n", "\r", "\r\n". Default value "\n".
`block_start_string` (str): The string marking the beginning of a block. Default value "{%".
`block_end_string` (str): The string marking the end of a block. Default value "%}".
`variable_start_string` (str): The string marking the beginning of a print statement. Default value "{{".
`variable_end_string` (str): The string marking the end of a print statement. Default value "}}".
`trim_blocks` (bool): Determine when newlines should be removed from blocks. When set to `yes` the first newline after a block is removed (block, not variable tag!). Default value is true.
`lstrip_blocks` (bool): Determine when leading spaces and tabs should be stripped. When set to `yes` leading spaces and tabs are stripped from the start of a line to a block. This functionality requires Jinja 2.7 or newer. Default value is false. |
| **username** string | | Provide a username for authenticating with the API. Can also be specified via K8S\_AUTH\_USERNAME environment variable. Please note that this only works with clusters configured to use HTTP Basic Auth. If your cluster has a different form of authentication (e.g. OAuth2 in OpenShift), this option will not work as expected and you should look into the `k8s_auth` module, as that might do what you need. |
| **validate** dictionary | | how (if at all) to validate the resource definition against the kubernetes schema. Requires the kubernetes-validate python module and openshift >= 0.8.0 |
| | **fail\_on\_error** boolean | **Choices:*** no
* yes
| whether to fail on validation errors. |
| | **strict** boolean | **Choices:*** no
* **yes** ←
| whether to fail when passing unexpected properties |
| | **version** string | | version of Kubernetes to validate against. defaults to Kubernetes server version |
| **validate\_certs** boolean | **Choices:*** no
* yes
| Whether or not to verify the API server's SSL certificates. Can also be specified via K8S\_AUTH\_VERIFY\_SSL environment variable.
aliases: verify\_ssl |
| **wait** boolean | **Choices:*** **no** ←
* yes
| Whether to wait for certain resource kinds to end up in the desired state. By default the module exits once Kubernetes has received the request. Implemented for `state=present` for `Deployment`, `DaemonSet` and `Pod`, and for `state=absent` for all resource kinds. For resource kinds without an implementation, `wait` returns immediately unless `wait_condition` is set. |
| **wait\_condition** dictionary | | Specifies a custom condition on the status to wait for. Ignored if `wait` is not set or is set to False. |
| | **reason** string | | The value of the reason field in your desired condition For example, if a `Deployment` is paused, The `Progressing` `type` will have the `DeploymentPaused` reason. The possible reasons in a condition are specific to each resource type in Kubernetes. See the API documentation of the status field for a given resource to see possible choices. |
| | **status** string | **Choices:*** **True** ←
* False
* Unknown
| The value of the status field in your desired condition. For example, if a `Deployment` is paused, the `Progressing` `type` will have the `Unknown` status. |
| | **type** string | | The type of condition to wait for. For example, the `Pod` resource will set the `Ready` condition (among others). Required if you are specifying a `wait_condition`. If left empty, the `wait_condition` field will be ignored. The possible types for a condition are specific to each resource type in Kubernetes. See the API documentation of the status field for a given resource to see possible choices. |
| **wait\_sleep** integer | **Default:**5 | Number of seconds to sleep between checks. |
| **wait\_timeout** integer | **Default:**120 | How long in seconds to wait for the resource to end up in the desired state. Ignored if `wait` is not set. |
Notes
-----
Note
* If your OpenShift Python library is not 0.9.0 or newer and you are trying to remove an item from an associative array/dictionary, for example a label or an annotation, you will need to explicitly set the value of the item to be removed to `null`. Simply deleting the entry in the dictionary will not remove it from openshift or kubernetes.
* The OpenShift Python client wraps the K8s Python client, providing full access to all of the APIS and models available on both platforms. For API version details and additional information visit <https://github.com/openshift/openshift-restclient-python>
* To avoid SSL certificate validation errors when `validate_certs` is *True*, the full certificate chain for the API server must be provided via `ca_cert` or in the kubeconfig file.
Examples
--------
```
- name: Create a k8s namespace
community.kubernetes.k8s:
name: testing
api_version: v1
kind: Namespace
state: present
- name: Create a Service object from an inline definition
community.kubernetes.k8s:
state: present
definition:
apiVersion: v1
kind: Service
metadata:
name: web
namespace: testing
labels:
app: galaxy
service: web
spec:
selector:
app: galaxy
service: web
ports:
- protocol: TCP
targetPort: 8000
name: port-8000-tcp
port: 8000
- name: Remove an existing Service object
community.kubernetes.k8s:
state: absent
api_version: v1
kind: Service
namespace: testing
name: web
# Passing the object definition from a file
- name: Create a Deployment by reading the definition from a local file
community.kubernetes.k8s:
state: present
src: /testing/deployment.yml
- name: >-
Read definition file from the Ansible controller file system.
If the definition file has been encrypted with Ansible Vault it will automatically be decrypted.
community.kubernetes.k8s:
state: present
definition: "{{ lookup('file', '/testing/deployment.yml') | from_yaml }}"
- name: Read definition template file from the Ansible controller file system
community.kubernetes.k8s:
state: present
template: '/testing/deployment.j2'
- name: Read definition template file from the Ansible controller file system that uses custom start/end strings
community.kubernetes.k8s:
state: present
template:
path: '/testing/deployment.j2'
variable_start_string: '[['
variable_end_string: ']]'
- name: fail on validation errors
community.kubernetes.k8s:
state: present
definition: "{{ lookup('template', '/testing/deployment.yml') | from_yaml }}"
validate:
fail_on_error: yes
- name: warn on validation errors, check for unexpected properties
community.kubernetes.k8s:
state: present
definition: "{{ lookup('template', '/testing/deployment.yml') | from_yaml }}"
validate:
fail_on_error: no
strict: yes
# Download and apply manifest
- name: Download metrics-server manifest to the cluster.
ansible.builtin.get_url:
url: https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
dest: ~/metrics-server.yaml
mode: '0664'
- name: Apply metrics-server manifest to the cluster.
community.kubernetes.k8s:
state: present
src: ~/metrics-server.yaml
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **result** complex | success | The created, patched, or otherwise present object. Will be empty in the case of a deletion. |
| | **api\_version** string | success | The versioned schema of this representation of an object. |
| | **duration** integer | when `wait` is true | elapsed time of task in seconds **Sample:** 48 |
| | **items** list / elements=string | when resource\_definition or src contains list of objects | Returned only when multiple yaml documents are passed to src or resource\_definition |
| | **kind** string | success | Represents the REST resource this object represents. |
| | **metadata** complex | success | Standard object metadata. Includes name, namespace, annotations, labels, etc. |
| | **spec** complex | success | Specific attributes of the object. Will vary based on the *api\_version* and *kind*. |
| | **status** complex | success | Current status details for the object. |
### Authors
* Chris Houseknecht (@chouseknecht)
* Fabian von Feilitzsch (@fabianvf)
ansible community.kubernetes.helm – Manages Kubernetes packages with the Helm package manager community.kubernetes.helm – Manages Kubernetes packages with the Helm package manager
=====================================================================================
Note
This plugin is part of the [community.kubernetes collection](https://galaxy.ansible.com/community/kubernetes) (version 1.2.1).
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.kubernetes`.
To use it in a playbook, specify: `community.kubernetes.helm`.
New in version 0.11.0: of community.kubernetes
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Install, upgrade, delete packages with the Helm package manager.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Requirements
------------
The below requirements are needed on the host that executes this module.
* helm (<https://github.com/helm/helm/releases>)
* yaml (<https://pypi.org/project/PyYAML/>)
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_key** string added in 1.2.0 of community.kubernetes | | Token used to authenticate with the API. Can also be specified via `K8S_AUTH_API_KEY` environment variable. |
| **atomic** boolean | **Choices:*** **no** ←
* yes
| If set, the installation process deletes the installation on failure. |
| **binary\_path** path | | The path of a helm binary to use. |
| **ca\_cert** path added in 1.2.0 of community.kubernetes | | Path to a CA certificate used to authenticate with the API. The full certificate chain must be provided to avoid certificate validation errors. Can also be specified via `K8S_AUTH_SSL_CA_CERT` environment variable.
aliases: ssl\_ca\_cert |
| **chart\_ref** path | | chart\_reference on chart repository. path to a packaged chart. path to an unpacked chart directory. absolute URL. Required when *release\_state* is set to `present`. |
| **chart\_repo\_url** string | | Chart repository URL where to locate the requested chart. |
| **chart\_version** string | | Chart version to install. If this is not specified, the latest version is installed. |
| **context** string | | Helm option to specify which kubeconfig context to use. If the value is not specified in the task, the value of environment variable `K8S_AUTH_CONTEXT` will be used instead.
aliases: kube\_context |
| **create\_namespace** boolean added in 0.11.1 of community.kubernetes | **Choices:*** **no** ←
* yes
| Create the release namespace if not present. |
| **disable\_hook** boolean | **Choices:*** **no** ←
* yes
| Helm option to disable hook on install/upgrade/delete. |
| **force** boolean | **Choices:*** **no** ←
* yes
| Helm option to force reinstall, ignore on new install. |
| **host** string added in 1.2.0 of community.kubernetes | | Provide a URL for accessing the API. Can also be specified via `K8S_AUTH_HOST` environment variable. |
| **kubeconfig** path | | Helm option to specify kubeconfig path to use. If the value is not specified in the task, the value of environment variable `K8S_AUTH_KUBECONFIG` will be used instead.
aliases: kubeconfig\_path |
| **purge** boolean | **Choices:*** no
* **yes** ←
| Remove the release from the store and make its name free for later use. |
| **release\_name** string / required | | Release name to manage.
aliases: name |
| **release\_namespace** string / required | | Kubernetes namespace where the chart should be installed.
aliases: namespace |
| **release\_state** string | **Choices:*** **present** ←
* absent
| Desirated state of release.
aliases: state |
| **release\_values** dictionary | **Default:**{} | Value to pass to chart.
aliases: values |
| **replace** boolean added in 1.11.0 of community.kubernetes | **Choices:*** **no** ←
* yes
| Reuse the given name, only if that name is a deleted release which remains in the history. This is unsafe in production environment. |
| **skip\_crds** boolean added in 1.2.0 of community.kubernetes | **Choices:*** **no** ←
* yes
| Skip custom resource definitions when installing or upgrading. |
| **update\_repo\_cache** boolean | **Choices:*** **no** ←
* yes
| Run `helm repo update` before the operation. Can be run as part of the package installation or as a separate step. |
| **validate\_certs** boolean added in 1.2.0 of community.kubernetes | **Choices:*** no
* **yes** ←
| Whether or not to verify the API server's SSL certificates. Can also be specified via `K8S_AUTH_VERIFY_SSL` environment variable.
aliases: verify\_ssl |
| **values\_files** list / elements=string added in 1.1.0 of community.kubernetes | **Default:**[] | Value files to pass to chart. Paths will be read from the target host's filesystem, not the host running ansible. values\_files option is evaluated before values option if both are used. Paths are evaluated in the order the paths are specified. |
| **wait** boolean | **Choices:*** **no** ←
* yes
| Wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful. |
| **wait\_timeout** string | | Timeout when wait option is enabled (helm2 is a number of seconds, helm3 is a duration). |
Examples
--------
```
- name: Deploy latest version of Prometheus chart inside monitoring namespace (and create it)
community.kubernetes.helm:
name: test
chart_ref: stable/prometheus
release_namespace: monitoring
create_namespace: true
# From repository
- name: Add stable chart repo
community.kubernetes.helm_repository:
name: stable
repo_url: "https://kubernetes.github.io/ingress-nginx"
- name: Deploy latest version of Grafana chart inside monitoring namespace with values
community.kubernetes.helm:
name: test
chart_ref: stable/grafana
release_namespace: monitoring
values:
replicas: 2
- name: Deploy Grafana chart on 5.0.12 with values loaded from template
community.kubernetes.helm:
name: test
chart_ref: stable/grafana
chart_version: 5.0.12
values: "{{ lookup('template', 'somefile.yaml') | from_yaml }}"
- name: Deploy Grafana chart using values files on target
community.kubernetes.helm:
name: test
chart_ref: stable/grafana
release_namespace: monitoring
values_files:
- /path/to/values.yaml
- name: Remove test release and waiting suppression ending
community.kubernetes.helm:
name: test
state: absent
wait: true
# From git
- name: Git clone stable repo on HEAD
ansible.builtin.git:
repo: "http://github.com/helm/charts.git"
dest: /tmp/helm_repo
- name: Deploy Grafana chart from local path
community.kubernetes.helm:
name: test
chart_ref: /tmp/helm_repo/stable/grafana
release_namespace: monitoring
# From url
- name: Deploy Grafana chart on 5.6.0 from url
community.kubernetes.helm:
name: test
chart_ref: "https://github.com/grafana/helm-charts/releases/download/grafana-5.6.0/grafana-5.6.0.tgz"
release_namespace: monitoring
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **command** string | always | Full `helm` command built by this module, in case you want to re-run the command outside the module or debug a problem. **Sample:** helm upgrade ... |
| **status** complex | on success Creation/Upgrade/Already deploy | A dictionary of status output |
| | **appversion** string | always | Version of app deployed |
| | **chart** string | always | Chart name and chart version |
| | **name** string | always | Name of the release |
| | **namespace** string | always | Namespace where the release is deployed |
| | **revision** string | always | Number of time where the release has been updated |
| | **status** string | always | Status of release (can be DEPLOYED, FAILED, ...) |
| | **updated** string | always | The Date of last update |
| | **values** string | always | Dict of Values used to deploy |
| **stderr** string | always | Full `helm` command stderr, in case you want to display it or examine the event log |
| **stdout** string | always | Full `helm` command stdout, in case you want to display it or examine the event log |
### Authors
* Lucas Boisserie (@LucasBoisserie)
* Matthieu Diehr (@d-matt)
| programming_docs |
ansible community.kubernetes.k8s_scale – Set a new size for a Deployment, ReplicaSet, Replication Controller, or Job. community.kubernetes.k8s\_scale – Set a new size for a Deployment, ReplicaSet, Replication Controller, or Job.
==============================================================================================================
Note
This plugin is part of the [community.kubernetes collection](https://galaxy.ansible.com/community/kubernetes) (version 1.2.1).
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.kubernetes`.
To use it in a playbook, specify: `community.kubernetes.k8s_scale`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Similar to the kubectl scale command. Use to set the number of replicas for a Deployment, ReplicaSet, or Replication Controller, or the parallelism attribute of a Job. Supports check mode.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7
* openshift >= 0.6
* PyYAML >= 3.11
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_key** string | | Token used to authenticate with the API. Can also be specified via K8S\_AUTH\_API\_KEY environment variable. |
| **api\_version** string | **Default:**"v1" | Use to specify the API version. Use to create, delete, or discover an object without providing a full resource definition. Use in conjunction with *kind*, *name*, and *namespace* to identify a specific object. If *resource definition* is provided, the *apiVersion* value from the *resource\_definition* will override this option.
aliases: api, version |
| **ca\_cert** path | | Path to a CA certificate used to authenticate with the API. The full certificate chain must be provided to avoid certificate validation errors. Can also be specified via K8S\_AUTH\_SSL\_CA\_CERT environment variable.
aliases: ssl\_ca\_cert |
| **client\_cert** path | | Path to a certificate used to authenticate with the API. Can also be specified via K8S\_AUTH\_CERT\_FILE environment variable.
aliases: cert\_file |
| **client\_key** path | | Path to a key file used to authenticate with the API. Can also be specified via K8S\_AUTH\_KEY\_FILE environment variable.
aliases: key\_file |
| **context** string | | The name of a context found in the config file. Can also be specified via K8S\_AUTH\_CONTEXT environment variable. |
| **current\_replicas** integer | | For Deployment, ReplicaSet, Replication Controller, only scale, if the number of existing replicas matches. In the case of a Job, update parallelism only if the current parallelism value matches. |
| **host** string | | Provide a URL for accessing the API. Can also be specified via K8S\_AUTH\_HOST environment variable. |
| **kind** string | | Use to specify an object model. Use to create, delete, or discover an object without providing a full resource definition. Use in conjunction with *api\_version*, *name*, and *namespace* to identify a specific object. If *resource definition* is provided, the *kind* value from the *resource\_definition* will override this option. |
| **kubeconfig** path | | Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the openshift client will attempt to load the default configuration file from *~/.kube/config.json*. Can also be specified via K8S\_AUTH\_KUBECONFIG environment variable. |
| **name** string | | Use to specify an object name. Use to create, delete, or discover an object without providing a full resource definition. Use in conjunction with *api\_version*, *kind* and *namespace* to identify a specific object. If *resource definition* is provided, the *metadata.name* value from the *resource\_definition* will override this option. |
| **namespace** string | | Use to specify an object namespace. Useful when creating, deleting, or discovering an object without providing a full resource definition. Use in conjunction with *api\_version*, *kind*, and *name* to identify a specific object. If *resource definition* is provided, the *metadata.namespace* value from the *resource\_definition* will override this option. |
| **password** string | | Provide a password for authenticating with the API. Can also be specified via K8S\_AUTH\_PASSWORD environment variable. Please read the description of the `username` option for a discussion of when this option is applicable. |
| **persist\_config** boolean | **Choices:*** no
* yes
| Whether or not to save the kube config refresh tokens. Can also be specified via K8S\_AUTH\_PERSIST\_CONFIG environment variable. When the k8s context is using a user credentials with refresh tokens (like oidc or gke/gcloud auth), the token is refreshed by the k8s python client library but not saved by default. So the old refresh token can expire and the next auth might fail. Setting this flag to true will tell the k8s python client to save the new refresh token to the kube config file. Default to false. Please note that the current version of the k8s python client library does not support setting this flag to True yet. The fix for this k8s python library is here: https://github.com/kubernetes-client/python-base/pull/169 |
| **proxy** string | | The URL of an HTTP proxy to use for the connection. Can also be specified via K8S\_AUTH\_PROXY environment variable. Please note that this module does not pick up typical proxy settings from the environment (e.g. HTTP\_PROXY). |
| **replicas** integer / required | | The desired number of replicas. |
| **resource\_definition** string | | Provide a valid YAML definition (either as a string, list, or dict) for an object when creating or updating. NOTE: *kind*, *api\_version*, *name*, and *namespace* will be overwritten by corresponding values found in the provided *resource\_definition*.
aliases: definition, inline |
| **resource\_version** string | | Only attempt to scale, if the current object version matches. |
| **src** path | | Provide a path to a file containing a valid YAML definition of an object or objects to be created or updated. Mutually exclusive with *resource\_definition*. NOTE: *kind*, *api\_version*, *name*, and *namespace* will be overwritten by corresponding values found in the configuration read in from the *src* file. Reads from the local file system. To read from the Ansible controller's file system, including vaulted files, use the file lookup plugin or template lookup plugin, combined with the from\_yaml filter, and pass the result to *resource\_definition*. See Examples below. Mutually exclusive with *template* in case of M(k8s) module. |
| **username** string | | Provide a username for authenticating with the API. Can also be specified via K8S\_AUTH\_USERNAME environment variable. Please note that this only works with clusters configured to use HTTP Basic Auth. If your cluster has a different form of authentication (e.g. OAuth2 in OpenShift), this option will not work as expected and you should look into the `k8s_auth` module, as that might do what you need. |
| **validate\_certs** boolean | **Choices:*** no
* yes
| Whether or not to verify the API server's SSL certificates. Can also be specified via K8S\_AUTH\_VERIFY\_SSL environment variable.
aliases: verify\_ssl |
| **wait** boolean | **Choices:*** no
* **yes** ←
| For Deployment, ReplicaSet, Replication Controller, wait for the status value of *ready\_replicas* to change to the number of *replicas*. In the case of a Job, this option is ignored. |
| **wait\_timeout** integer | **Default:**20 | When `wait` is *True*, the number of seconds to wait for the *ready\_replicas* status to equal *replicas*. If the status is not reached within the allotted time, an error will result. In the case of a Job, this option is ignored. |
Notes
-----
Note
* The OpenShift Python client wraps the K8s Python client, providing full access to all of the APIS and models available on both platforms. For API version details and additional information visit <https://github.com/openshift/openshift-restclient-python>
* To avoid SSL certificate validation errors when `validate_certs` is *True*, the full certificate chain for the API server must be provided via `ca_cert` or in the kubeconfig file.
Examples
--------
```
- name: Scale deployment up, and extend timeout
community.kubernetes.k8s_scale:
api_version: v1
kind: Deployment
name: elastic
namespace: myproject
replicas: 3
wait_timeout: 60
- name: Scale deployment down when current replicas match
community.kubernetes.k8s_scale:
api_version: v1
kind: Deployment
name: elastic
namespace: myproject
current_replicas: 3
replicas: 2
- name: Increase job parallelism
community.kubernetes.k8s_scale:
api_version: batch/v1
kind: job
name: pi-with-timeout
namespace: testing
replicas: 2
# Match object using local file or inline definition
- name: Scale deployment based on a file from the local filesystem
community.kubernetes.k8s_scale:
src: /myproject/elastic_deployment.yml
replicas: 3
wait: no
- name: Scale deployment based on a template output
community.kubernetes.k8s_scale:
resource_definition: "{{ lookup('template', '/myproject/elastic_deployment.yml') | from_yaml }}"
replicas: 3
wait: no
- name: Scale deployment based on a file from the Ansible controller filesystem
community.kubernetes.k8s_scale:
resource_definition: "{{ lookup('file', '/myproject/elastic_deployment.yml') | from_yaml }}"
replicas: 3
wait: no
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **result** complex | success | If a change was made, will return the patched object, otherwise returns the existing object. |
| | **api\_version** string | success | The versioned schema of this representation of an object. |
| | **duration** integer | when `wait` is true | elapsed time of task in seconds **Sample:** 48 |
| | **kind** string | success | Represents the REST resource this object represents. |
| | **metadata** complex | success | Standard object metadata. Includes name, namespace, annotations, labels, etc. |
| | **spec** complex | success | Specific attributes of the object. Will vary based on the *api\_version* and *kind*. |
| | **status** complex | success | Current status details for the object. |
### Authors
* Chris Houseknecht (@chouseknecht)
* Fabian von Feilitzsch (@fabianvf)
ansible community.kubernetes.helm_repository – Manage Helm repositories. community.kubernetes.helm\_repository – Manage Helm repositories.
=================================================================
Note
This plugin is part of the [community.kubernetes collection](https://galaxy.ansible.com/community/kubernetes) (version 1.2.1).
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.kubernetes`.
To use it in a playbook, specify: `community.kubernetes.helm_repository`.
New in version 0.11.0: of community.kubernetes
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Manage Helm repositories.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Requirements
------------
The below requirements are needed on the host that executes this module.
* helm (<https://github.com/helm/helm/releases>)
* yaml (<https://pypi.org/project/PyYAML/>)
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **binary\_path** path | | The path of a helm binary to use. |
| **repo\_name** string / required | | Chart repository name.
aliases: name |
| **repo\_password** string | | Chart repository password for repository with basic auth. Required if chart\_repo\_username is specified.
aliases: password |
| **repo\_state** string | **Choices:*** **present** ←
* absent
| Desired state of repository.
aliases: state |
| **repo\_url** string | | Chart repository url
aliases: url |
| **repo\_username** string | | Chart repository username for repository with basic auth. Required if chart\_repo\_password is specified.
aliases: username |
Examples
--------
```
- name: Add a repository
community.kubernetes.helm_repository:
name: stable
repo_url: https://kubernetes.github.io/ingress-nginx
- name: Add Red Hat Helm charts repository
community.kubernetes.helm_repository:
name: redhat-charts
repo_url: https://redhat-developer.github.com/redhat-helm-charts
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **command** string | always | Full `helm` command built by this module, in case you want to re-run the command outside the module or debug a problem. **Sample:** /usr/local/bin/helm repo add bitnami https://charts.bitnami.com/bitnami |
| **msg** string | on failure | Error message returned by `helm` command **Sample:** Repository already have a repository named bitnami |
| **stderr** string | always | Full `helm` command stderr, in case you want to display it or examine the event log |
| **stderr\_lines** list / elements=string | always | Full `helm` command stderr in list, in case you want to display it or examine the event log **Sample:** [''] |
| **stdout** string | always | Full `helm` command stdout, in case you want to display it or examine the event log **Sample:** "bitnami" has been added to your repositories |
| **stdout\_lines** list / elements=string | always | Full `helm` command stdout in list, in case you want to display it or examine the event log **Sample:** ['"bitnami" has been added to your repositories'] |
### Authors
* Lucas Boisserie (@LucasBoisserie)
ansible community.kubernetes.k8s_auth – Authenticate to Kubernetes clusters which require an explicit login step community.kubernetes.k8s\_auth – Authenticate to Kubernetes clusters which require an explicit login step
=========================================================================================================
Note
This plugin is part of the [community.kubernetes collection](https://galaxy.ansible.com/community/kubernetes) (version 1.2.1).
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.kubernetes`.
To use it in a playbook, specify: `community.kubernetes.k8s_auth`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module handles authenticating to Kubernetes clusters requiring *explicit* authentication procedures, meaning ones where a client logs in (obtains an authentication token), performs API operations using said token and then logs out (revokes the token). An example of a Kubernetes distribution requiring this module is OpenShift.
* On the other hand a popular configuration for username+password authentication is one utilizing HTTP Basic Auth, which does not involve any additional login/logout steps (instead login credentials can be attached to each and every API call performed) and as such is handled directly by the `k8s` module (and other resource–specific modules) by utilizing the `host`, `username` and `password` parameters. Please consult your preferred module’s documentation for more details.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7
* urllib3
* requests
* requests-oauthlib
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_key** string | | When `state` is set to *absent*, this specifies the token to revoke. |
| **ca\_cert** path | | Path to a CA certificate file used to verify connection to the API server. The full certificate chain must be provided to avoid certificate validation errors.
aliases: ssl\_ca\_cert |
| **host** string / required | | Provide a URL for accessing the API server. |
| **password** string | | Provide a password for authenticating with the API server. |
| **state** string | **Choices:*** **present** ←
* absent
| If set to *present* connect to the API server using the URL specified in `host` and attempt to log in. If set to *absent* attempt to log out by revoking the authentication token specified in `api_key`. |
| **username** string | | Provide a username for authenticating with the API server. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| Whether or not to verify the API server's SSL certificates.
aliases: verify\_ssl |
Examples
--------
```
- hosts: localhost
module_defaults:
group/k8s:
host: https://k8s.example.com/
ca_cert: ca.pem
tasks:
- block:
# It's good practice to store login credentials in a secure vault and not
# directly in playbooks.
- include_vars: k8s_passwords.yml
- name: Log in (obtain access token)
community.kubernetes.k8s_auth:
username: admin
password: "{{ k8s_admin_password }}"
register: k8s_auth_results
# Previous task provides the token/api_key, while all other parameters
# are taken from module_defaults
- name: Get a list of all pods from any namespace
community.kubernetes.k8s_info:
api_key: "{{ k8s_auth_results.k8s_auth.api_key }}"
kind: Pod
register: pod_list
always:
- name: If login succeeded, try to log out (revoke access token)
when: k8s_auth_results.k8s_auth.api_key is defined
community.kubernetes.k8s_auth:
state: absent
api_key: "{{ k8s_auth_results.k8s_auth.api_key }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **k8s\_auth** complex | success | Kubernetes authentication facts. |
| | **api\_key** string | success | Authentication token. |
| | **ca\_cert** string | success | Path to a CA certificate file used to verify connection to the API server. |
| | **host** string | success | URL for accessing the API server. |
| | **username** string | success | Username for authenticating with the API server. |
| | **validate\_certs** boolean | success | Whether or not to verify the API server's SSL certificates. |
### Authors
* KubeVirt Team (@kubevirt)
ansible community.kubernetes.k8s_rollback – Rollback Kubernetes (K8S) Deployments and DaemonSets community.kubernetes.k8s\_rollback – Rollback Kubernetes (K8S) Deployments and DaemonSets
=========================================================================================
Note
This plugin is part of the [community.kubernetes collection](https://galaxy.ansible.com/community/kubernetes) (version 1.2.1).
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.kubernetes`.
To use it in a playbook, specify: `community.kubernetes.k8s_rollback`.
New in version 1.0.0: of community.kubernetes
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Use the OpenShift Python client to perform the Rollback.
* Authenticate using either a config file, certificates, password or token.
* Similar to the `kubectl rollout undo` command.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7
* openshift >= 0.6
* PyYAML >= 3.11
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_key** string | | Token used to authenticate with the API. Can also be specified via K8S\_AUTH\_API\_KEY environment variable. |
| **api\_version** string | **Default:**"v1" | Use to specify the API version. Use to create, delete, or discover an object without providing a full resource definition. Use in conjunction with *kind*, *name*, and *namespace* to identify a specific object. If *resource definition* is provided, the *apiVersion* value from the *resource\_definition* will override this option.
aliases: api, version |
| **ca\_cert** path | | Path to a CA certificate used to authenticate with the API. The full certificate chain must be provided to avoid certificate validation errors. Can also be specified via K8S\_AUTH\_SSL\_CA\_CERT environment variable.
aliases: ssl\_ca\_cert |
| **client\_cert** path | | Path to a certificate used to authenticate with the API. Can also be specified via K8S\_AUTH\_CERT\_FILE environment variable.
aliases: cert\_file |
| **client\_key** path | | Path to a key file used to authenticate with the API. Can also be specified via K8S\_AUTH\_KEY\_FILE environment variable.
aliases: key\_file |
| **context** string | | The name of a context found in the config file. Can also be specified via K8S\_AUTH\_CONTEXT environment variable. |
| **field\_selectors** list / elements=string | | List of field selectors to use to filter results. |
| **host** string | | Provide a URL for accessing the API. Can also be specified via K8S\_AUTH\_HOST environment variable. |
| **kind** string | | Use to specify an object model. Use to create, delete, or discover an object without providing a full resource definition. Use in conjunction with *api\_version*, *name*, and *namespace* to identify a specific object. If *resource definition* is provided, the *kind* value from the *resource\_definition* will override this option. |
| **kubeconfig** path | | Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the openshift client will attempt to load the default configuration file from *~/.kube/config.json*. Can also be specified via K8S\_AUTH\_KUBECONFIG environment variable. |
| **label\_selectors** list / elements=string | | List of label selectors to use to filter results. |
| **name** string | | Use to specify an object name. Use to create, delete, or discover an object without providing a full resource definition. Use in conjunction with *api\_version*, *kind* and *namespace* to identify a specific object. If *resource definition* is provided, the *metadata.name* value from the *resource\_definition* will override this option. |
| **namespace** string | | Use to specify an object namespace. Useful when creating, deleting, or discovering an object without providing a full resource definition. Use in conjunction with *api\_version*, *kind*, and *name* to identify a specific object. If *resource definition* is provided, the *metadata.namespace* value from the *resource\_definition* will override this option. |
| **password** string | | Provide a password for authenticating with the API. Can also be specified via K8S\_AUTH\_PASSWORD environment variable. Please read the description of the `username` option for a discussion of when this option is applicable. |
| **persist\_config** boolean | **Choices:*** no
* yes
| Whether or not to save the kube config refresh tokens. Can also be specified via K8S\_AUTH\_PERSIST\_CONFIG environment variable. When the k8s context is using a user credentials with refresh tokens (like oidc or gke/gcloud auth), the token is refreshed by the k8s python client library but not saved by default. So the old refresh token can expire and the next auth might fail. Setting this flag to true will tell the k8s python client to save the new refresh token to the kube config file. Default to false. Please note that the current version of the k8s python client library does not support setting this flag to True yet. The fix for this k8s python library is here: https://github.com/kubernetes-client/python-base/pull/169 |
| **proxy** string | | The URL of an HTTP proxy to use for the connection. Can also be specified via K8S\_AUTH\_PROXY environment variable. Please note that this module does not pick up typical proxy settings from the environment (e.g. HTTP\_PROXY). |
| **username** string | | Provide a username for authenticating with the API. Can also be specified via K8S\_AUTH\_USERNAME environment variable. Please note that this only works with clusters configured to use HTTP Basic Auth. If your cluster has a different form of authentication (e.g. OAuth2 in OpenShift), this option will not work as expected and you should look into the `k8s_auth` module, as that might do what you need. |
| **validate\_certs** boolean | **Choices:*** no
* yes
| Whether or not to verify the API server's SSL certificates. Can also be specified via K8S\_AUTH\_VERIFY\_SSL environment variable.
aliases: verify\_ssl |
Notes
-----
Note
* The OpenShift Python client wraps the K8s Python client, providing full access to all of the APIS and models available on both platforms. For API version details and additional information visit <https://github.com/openshift/openshift-restclient-python>
* To avoid SSL certificate validation errors when `validate_certs` is *True*, the full certificate chain for the API server must be provided via `ca_cert` or in the kubeconfig file.
Examples
--------
```
- name: Rollback a failed deployment
community.kubernetes.k8s_rollback:
api_version: apps/v1
kind: Deployment
name: web
namespace: testing
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **rollback\_info** complex | success | The object that was rolled back. |
| | **api\_version** string | success | The versioned schema of this representation of an object. |
| | **code** string | success | The HTTP Code of the response |
| | **kind** string | success | Status |
| | **metadata** dictionary | success | Standard object metadata. Includes name, namespace, annotations, labels, etc. |
| | **status** dictionary | success | Current status details for the object. |
### Authors
* Julien Huon (@julienhuon)
| programming_docs |
ansible community.kubernetes.k8s_exec – Execute command in Pod community.kubernetes.k8s\_exec – Execute command in Pod
=======================================================
Note
This plugin is part of the [community.kubernetes collection](https://galaxy.ansible.com/community/kubernetes) (version 1.2.1).
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.kubernetes`.
To use it in a playbook, specify: `community.kubernetes.k8s_exec`.
New in version 0.10.0: of community.kubernetes
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Use the Kubernetes Python client to execute command on K8s pods.
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7
* openshift == 0.4.3
* PyYAML >= 3.11
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_key** string | | Token used to authenticate with the API. Can also be specified via K8S\_AUTH\_API\_KEY environment variable. |
| **ca\_cert** path | | Path to a CA certificate used to authenticate with the API. The full certificate chain must be provided to avoid certificate validation errors. Can also be specified via K8S\_AUTH\_SSL\_CA\_CERT environment variable.
aliases: ssl\_ca\_cert |
| **client\_cert** path | | Path to a certificate used to authenticate with the API. Can also be specified via K8S\_AUTH\_CERT\_FILE environment variable.
aliases: cert\_file |
| **client\_key** path | | Path to a key file used to authenticate with the API. Can also be specified via K8S\_AUTH\_KEY\_FILE environment variable.
aliases: key\_file |
| **command** string / required | | The command to execute |
| **container** string | | The name of the container in the pod to connect to. Defaults to only container if there is only one container in the pod. |
| **context** string | | The name of a context found in the config file. Can also be specified via K8S\_AUTH\_CONTEXT environment variable. |
| **host** string | | Provide a URL for accessing the API. Can also be specified via K8S\_AUTH\_HOST environment variable. |
| **kubeconfig** path | | Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the openshift client will attempt to load the default configuration file from *~/.kube/config.json*. Can also be specified via K8S\_AUTH\_KUBECONFIG environment variable. |
| **namespace** string / required | | The pod namespace name |
| **password** string | | Provide a password for authenticating with the API. Can also be specified via K8S\_AUTH\_PASSWORD environment variable. Please read the description of the `username` option for a discussion of when this option is applicable. |
| **persist\_config** boolean | **Choices:*** no
* yes
| Whether or not to save the kube config refresh tokens. Can also be specified via K8S\_AUTH\_PERSIST\_CONFIG environment variable. When the k8s context is using a user credentials with refresh tokens (like oidc or gke/gcloud auth), the token is refreshed by the k8s python client library but not saved by default. So the old refresh token can expire and the next auth might fail. Setting this flag to true will tell the k8s python client to save the new refresh token to the kube config file. Default to false. Please note that the current version of the k8s python client library does not support setting this flag to True yet. The fix for this k8s python library is here: https://github.com/kubernetes-client/python-base/pull/169 |
| **pod** string / required | | The pod name |
| **proxy** string | | The URL of an HTTP proxy to use for the connection. Can also be specified via *K8S\_AUTH\_PROXY* environment variable. Please note that this module does not pick up typical proxy settings from the environment (e.g. HTTP\_PROXY). |
| **username** string | | Provide a username for authenticating with the API. Can also be specified via K8S\_AUTH\_USERNAME environment variable. Please note that this only works with clusters configured to use HTTP Basic Auth. If your cluster has a different form of authentication (e.g. OAuth2 in OpenShift), this option will not work as expected and you should look into the `k8s_auth` module, as that might do what you need. |
| **validate\_certs** boolean | **Choices:*** no
* yes
| Whether or not to verify the API server's SSL certificates. Can also be specified via K8S\_AUTH\_VERIFY\_SSL environment variable.
aliases: verify\_ssl |
Notes
-----
Note
* Return code `return_code` for the command executed is added in output in version 1.0.0.
* The authenticated user must have at least read access to the pods resource and write access to the pods/exec resource.
* The OpenShift Python client wraps the K8s Python client, providing full access to all of the APIS and models available on both platforms. For API version details and additional information visit <https://github.com/openshift/openshift-restclient-python>
* To avoid SSL certificate validation errors when `validate_certs` is *True*, the full certificate chain for the API server must be provided via `ca_cert` or in the kubeconfig file.
Examples
--------
```
- name: Execute a command
community.kubernetes.k8s_exec:
namespace: myproject
pod: zuul-scheduler
command: zuul-scheduler full-reconfigure
- name: Check RC status of command executed
community.kubernetes.k8s_exec:
namespace: myproject
pod: busybox-test
command: cmd_with_non_zero_exit_code
register: command_status
ignore_errors: True
- name: Check last command status
debug:
msg: "cmd failed"
when: command_status.return_code != 0
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **result** complex | success | The command object |
| | **return\_code** integer | success | The command status code |
| | **stderr** string | success | The command stderr |
| | **stderr\_lines** string | success | The command stderr |
| | **stdout** string | success | The command stdout |
| | **stdout\_lines** string | success | The command stdout |
### Authors
* Tristan de Cacqueray (@tristanC)
ansible community.kubernetes.k8s – Kubernetes (K8s) inventory source community.kubernetes.k8s – Kubernetes (K8s) inventory source
============================================================
Note
This plugin is part of the [community.kubernetes collection](https://galaxy.ansible.com/community/kubernetes) (version 1.2.1).
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.kubernetes`.
To use it in a playbook, specify: `community.kubernetes.k8s`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* Fetch containers and services for one or more clusters.
* Groups by cluster name, namespace, namespace\_services, namespace\_pods, and labels.
* Uses the kubectl connection plugin to access the Kubernetes cluster.
* Uses k8s.(yml|yaml) YAML configuration file to set parameter values.
Requirements
------------
The below requirements are needed on the local controller node that executes this inventory.
* python >= 2.7
* openshift >= 0.6
* PyYAML >= 3.11
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **connections** string | | | Optional list of cluster connection settings. If no connections are provided, the default *~/.kube/config* and active context will be used, and objects will be returned for all namespaces the active user is authorized to access. |
| | **api\_key** string | | | Token used to authenticate with the API. Can also be specified via K8S\_AUTH\_API\_KEY environment variable. |
| | **ca\_cert** string | | | Path to a CA certificate used to authenticate with the API. Can also be specified via K8S\_AUTH\_SSL\_CA\_CERT environment variable.
aliases: ssl\_ca\_cert |
| | **client\_cert** string | | | Path to a certificate used to authenticate with the API. Can also be specified via K8S\_AUTH\_CERT\_FILE environment variable.
aliases: cert\_file |
| | **client\_key** string | | | Path to a key file used to authenticate with the API. Can also be specified via K8S\_AUTH\_KEY\_FILE environment variable.
aliases: key\_file |
| | **context** string | | | The name of a context found in the config file. Can also be specified via K8S\_AUTH\_CONTEXT environment variable. |
| | **host** string | | | Provide a URL for accessing the API. Can also be specified via K8S\_AUTH\_HOST environment variable. |
| | **kubeconfig** string | | | Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the OpenShift client will attempt to load the default configuration file from *~/.kube/config.json*. Can also be specified via K8S\_AUTH\_KUBECONFIG environment variable. |
| | **name** string | | | Optional name to assign to the cluster. If not provided, a name is constructed from the server and port. |
| | **namespaces** string | | | List of namespaces. If not specified, will fetch all containers for all namespaces user is authorized to access. |
| | **password** string | | | Provide a password for authenticating with the API. Can also be specified via K8S\_AUTH\_PASSWORD environment variable. |
| | **username** string | | | Provide a username for authenticating with the API. Can also be specified via K8S\_AUTH\_USERNAME environment variable. |
| | **validate\_certs** boolean | **Choices:*** no
* yes
| | Whether or not to verify the API server's SSL certificates. Can also be specified via K8S\_AUTH\_VERIFY\_SSL environment variable.
aliases: verify\_ssl |
| **plugin** string / required | **Choices:*** k8s
| | token that ensures this is a source file for the 'k8s' plugin. |
Examples
--------
```
# File must be named k8s.yaml or k8s.yml
# Authenticate with token, and return all pods and services for all namespaces
plugin: community.kubernetes.k8s
connections:
- host: https://192.168.64.4:8443
api_key: xxxxxxxxxxxxxxxx
validate_certs: false
# Use default config (~/.kube/config) file and active context, and return objects for a specific namespace
plugin: community.kubernetes.k8s
connections:
- namespaces:
- testing
# Use a custom config file, and a specific context.
plugin: community.kubernetes.k8s
connections:
- kubeconfig: /path/to/config
context: 'awx/192-168-64-4:8443/developer'
```
### Authors
* Chris Houseknecht <@chouseknecht>
* Fabian von Feilitzsch <@fabianvf>
ansible community.kubernetes.k8s – Query the K8s API community.kubernetes.k8s – Query the K8s API
============================================
Note
This plugin is part of the [community.kubernetes collection](https://galaxy.ansible.com/community/kubernetes) (version 1.2.1).
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.kubernetes`.
To use it in a playbook, specify: `community.kubernetes.k8s`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Uses the OpenShift Python client to fetch a specific object by name, all matching objects within a namespace, or all matching objects for all namespaces, as well as information about the cluster.
* Provides access the full range of K8s APIs.
* Enables authentication via config file, certificates, password or token.
Requirements
------------
The below requirements are needed on the local controller node that executes this lookup.
* python >= 2.7
* openshift >= 0.6
* PyYAML >= 3.11
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **api\_key** string | | | Token used to authenticate with the API. Can also be specified via K8S\_AUTH\_API\_KEY environment variable. |
| **api\_version** string | **Default:**"v1" | | Use to specify the API version. If *resource definition* is provided, the *apiVersion* from the *resource\_definition* will override this option. |
| **ca\_cert** string | | | Path to a CA certificate used to authenticate with the API. Can also be specified via K8S\_AUTH\_SSL\_CA\_CERT environment variable.
aliases: ssl\_ca\_cert |
| **client\_cert** string | | | Path to a certificate used to authenticate with the API. Can also be specified via K8S\_AUTH\_CERT\_FILE environment variable.
aliases: cert\_file |
| **client\_key** string | | | Path to a key file used to authenticate with the API. Can also be specified via K8S\_AUTH\_KEY\_FILE environment variable.
aliases: key\_file |
| **cluster\_info** string | | | Use to specify the type of cluster information you are attempting to retrieve. Will take priority over all the other options. |
| **context** string | | | The name of a context found in the config file. Can also be specified via K8S\_AUTH\_CONTEXT environment variable. |
| **field\_selector** string | | | Specific fields on which to query. Ignored when *resource\_name* is provided. |
| **host** string | | | Provide a URL for accessing the API. Can also be specified via K8S\_AUTH\_HOST environment variable. |
| **kind** string / required | | | Use to specify an object model. If *resource definition* is provided, the *kind* from a *resource\_definition* will override this option. |
| **kubeconfig** string | | | Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the openshift client will attempt to load the default configuration file from *~/.kube/config.json*. Can also be specified via K8S\_AUTH\_KUBECONFIG environment variable. |
| **label\_selector** string | | | Additional labels to include in the query. Ignored when *resource\_name* is provided. |
| **namespace** string | | | Limit the objects returned to a specific namespace. If *resource definition* is provided, the *metadata.namespace* value from the *resource\_definition* will override this option. |
| **password** string | | | Provide a password for authenticating with the API. Can also be specified via K8S\_AUTH\_PASSWORD environment variable. |
| **resource\_definition** string | | | Provide a YAML configuration for an object. NOTE: *kind*, *api\_version*, *resource\_name*, and *namespace* will be overwritten by corresponding values found in the provided *resource\_definition*. |
| **resource\_name** string | | | Fetch a specific object by name. If *resource definition* is provided, the *metadata.name* value from the *resource\_definition* will override this option. |
| **src** string | | | Provide a path to a file containing a valid YAML definition of an object dated. Mutually exclusive with *resource\_definition*. NOTE: *kind*, *api\_version*, *resource\_name*, and *namespace* will be overwritten by corresponding values found in the configuration read in from the *src* file. Reads from the local file system. To read from the Ansible controller's file system, use the file lookup plugin or template lookup plugin, combined with the from\_yaml filter, and pass the result to *resource\_definition*. See Examples below. |
| **username** string | | | Provide a username for authenticating with the API. Can also be specified via K8S\_AUTH\_USERNAME environment variable. |
| **validate\_certs** boolean | **Choices:*** no
* yes
| | Whether or not to verify the API server's SSL certificates. Can also be specified via K8S\_AUTH\_VERIFY\_SSL environment variable.
aliases: verify\_ssl |
Notes
-----
Note
* The OpenShift Python client wraps the K8s Python client, providing full access to all of the APIS and models available on both platforms. For API version details and additional information visit <https://github.com/openshift/openshift-restclient-python>
Examples
--------
```
- name: Fetch a list of namespaces
set_fact:
projects: "{{ lookup('community.kubernetes.k8s', api_version='v1', kind='Namespace') }}"
- name: Fetch all deployments
set_fact:
deployments: "{{ lookup('community.kubernetes.k8s', kind='Deployment') }}"
- name: Fetch all deployments in a namespace
set_fact:
deployments: "{{ lookup('community.kubernetes.k8s', kind='Deployment', namespace='testing') }}"
- name: Fetch a specific deployment by name
set_fact:
deployments: "{{ lookup('community.kubernetes.k8s', kind='Deployment', namespace='testing', resource_name='elastic') }}"
- name: Fetch with label selector
set_fact:
service: "{{ lookup('community.kubernetes.k8s', kind='Service', label_selector='app=galaxy') }}"
# Use parameters from a YAML config
- name: Load config from the Ansible controller filesystem
set_fact:
config: "{{ lookup('file', 'service.yml') | from_yaml }}"
- name: Using the config (loaded from a file in prior task), fetch the latest version of the object
set_fact:
service: "{{ lookup('community.kubernetes.k8s', resource_definition=config) }}"
- name: Use a config from the local filesystem
set_fact:
service: "{{ lookup('community.kubernetes.k8s', src='service.yml') }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this lookup:
| Key | Returned | Description |
| --- | --- | --- |
| **\_list** complex | success | One ore more object definitions returned from the API. |
| | **api\_version** string | success | The versioned schema of this representation of an object. |
| | **kind** string | success | Represents the REST resource this object represents. |
| | **metadata** complex | success | Standard object metadata. Includes name, namespace, annotations, labels, etc. |
| | **spec** complex | success | Specific attributes of the object. Will vary based on the *api\_version* and *kind*. |
| | **status** complex | success | Current status details for the object. |
ansible community.kubernetes.k8s_service – Manage Services on Kubernetes community.kubernetes.k8s\_service – Manage Services on Kubernetes
=================================================================
Note
This plugin is part of the [community.kubernetes collection](https://galaxy.ansible.com/community/kubernetes) (version 1.2.1).
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.kubernetes`.
To use it in a playbook, specify: `community.kubernetes.k8s_service`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Use Openshift Python SDK to manage Services on Kubernetes
Note
This module has a corresponding [action plugin](../../../plugins/action#action-plugins).
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7
* openshift >= 0.6.2
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_key** string | | Token used to authenticate with the API. Can also be specified via K8S\_AUTH\_API\_KEY environment variable. |
| **apply** boolean | **Choices:*** **no** ←
* yes
|
`apply` compares the desired resource definition with the previously supplied resource definition, ignoring properties that are automatically generated
`apply` works better with Services than 'force=yes' mutually exclusive with `merge_type`
|
| **ca\_cert** path | | Path to a CA certificate used to authenticate with the API. The full certificate chain must be provided to avoid certificate validation errors. Can also be specified via K8S\_AUTH\_SSL\_CA\_CERT environment variable.
aliases: ssl\_ca\_cert |
| **client\_cert** path | | Path to a certificate used to authenticate with the API. Can also be specified via K8S\_AUTH\_CERT\_FILE environment variable.
aliases: cert\_file |
| **client\_key** path | | Path to a key file used to authenticate with the API. Can also be specified via K8S\_AUTH\_KEY\_FILE environment variable.
aliases: key\_file |
| **context** string | | The name of a context found in the config file. Can also be specified via K8S\_AUTH\_CONTEXT environment variable. |
| **force** boolean | **Choices:*** **no** ←
* yes
| If set to `yes`, and *state* is `present`, an existing object will be replaced. |
| **host** string | | Provide a URL for accessing the API. Can also be specified via K8S\_AUTH\_HOST environment variable. |
| **kubeconfig** path | | Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, the openshift client will attempt to load the default configuration file from *~/.kube/config.json*. Can also be specified via K8S\_AUTH\_KUBECONFIG environment variable. |
| **merge\_type** list / elements=string | **Choices:*** json
* merge
* strategic-merge
| Whether to override the default patch merge approach with a specific type. By default, the strategic merge will typically be used. For example, Custom Resource Definitions typically aren't updatable by the usual strategic merge. You may want to use `merge` if you see "strategic merge patch format is not supported" See <https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch/#use-a-json-merge-patch-to-update-a-deployment>
Requires openshift >= 0.6.2 If more than one merge\_type is given, the merge\_types will be tried in order If openshift >= 0.6.2, this defaults to `['strategic-merge', 'merge']`, which is ideal for using the same parameters on resource kinds that combine Custom Resources and built-in resources. For openshift < 0.6.2, the default is simply `strategic-merge`. |
| **name** string / required | | Use to specify a Service object name. |
| **namespace** string / required | | Use to specify a Service object namespace. |
| **password** string | | Provide a password for authenticating with the API. Can also be specified via K8S\_AUTH\_PASSWORD environment variable. Please read the description of the `username` option for a discussion of when this option is applicable. |
| **persist\_config** boolean | **Choices:*** no
* yes
| Whether or not to save the kube config refresh tokens. Can also be specified via K8S\_AUTH\_PERSIST\_CONFIG environment variable. When the k8s context is using a user credentials with refresh tokens (like oidc or gke/gcloud auth), the token is refreshed by the k8s python client library but not saved by default. So the old refresh token can expire and the next auth might fail. Setting this flag to true will tell the k8s python client to save the new refresh token to the kube config file. Default to false. Please note that the current version of the k8s python client library does not support setting this flag to True yet. The fix for this k8s python library is here: https://github.com/kubernetes-client/python-base/pull/169 |
| **ports** list / elements=dictionary | | A list of ports to expose. <https://kubernetes.io/docs/concepts/services-networking/service/#multi-port-services> |
| **proxy** string | | The URL of an HTTP proxy to use for the connection. Can also be specified via K8S\_AUTH\_PROXY environment variable. Please note that this module does not pick up typical proxy settings from the environment (e.g. HTTP\_PROXY). |
| **resource\_definition** string | | Provide a valid YAML definition (either as a string, list, or dict) for an object when creating or updating. NOTE: *kind*, *api\_version*, *name*, and *namespace* will be overwritten by corresponding values found in the provided *resource\_definition*.
aliases: definition, inline |
| **selector** dictionary | | Label selectors identify objects this Service should apply to. <https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/> |
| **src** path | | Provide a path to a file containing a valid YAML definition of an object or objects to be created or updated. Mutually exclusive with *resource\_definition*. NOTE: *kind*, *api\_version*, *name*, and *namespace* will be overwritten by corresponding values found in the configuration read in from the *src* file. Reads from the local file system. To read from the Ansible controller's file system, including vaulted files, use the file lookup plugin or template lookup plugin, combined with the from\_yaml filter, and pass the result to *resource\_definition*. See Examples below. Mutually exclusive with *template* in case of M(k8s) module. |
| **state** string | **Choices:*** absent
* **present** ←
| Determines if an object should be created, patched, or deleted. When set to `present`, an object will be created, if it does not already exist. If set to `absent`, an existing object will be deleted. If set to `present`, an existing object will be patched, if its attributes differ from those specified using *resource\_definition* or *src*. |
| **type** string | **Choices:*** NodePort
* ClusterIP
* LoadBalancer
* ExternalName
| Specifies the type of Service to create. See <https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types>
|
| **username** string | | Provide a username for authenticating with the API. Can also be specified via K8S\_AUTH\_USERNAME environment variable. Please note that this only works with clusters configured to use HTTP Basic Auth. If your cluster has a different form of authentication (e.g. OAuth2 in OpenShift), this option will not work as expected and you should look into the `k8s_auth` module, as that might do what you need. |
| **validate\_certs** boolean | **Choices:*** no
* yes
| Whether or not to verify the API server's SSL certificates. Can also be specified via K8S\_AUTH\_VERIFY\_SSL environment variable.
aliases: verify\_ssl |
Notes
-----
Note
* The OpenShift Python client wraps the K8s Python client, providing full access to all of the APIS and models available on both platforms. For API version details and additional information visit <https://github.com/openshift/openshift-restclient-python>
* To avoid SSL certificate validation errors when `validate_certs` is *True*, the full certificate chain for the API server must be provided via `ca_cert` or in the kubeconfig file.
Examples
--------
```
- name: Expose https port with ClusterIP
community.kubernetes.k8s_service:
state: present
name: test-https
namespace: default
ports:
- port: 443
protocol: TCP
selector:
key: special
- name: Expose https port with ClusterIP using spec
community.kubernetes.k8s_service:
state: present
name: test-https
namespace: default
inline:
spec:
ports:
- port: 443
protocol: TCP
selector:
key: special
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **result** complex | success | The created, patched, or otherwise present Service object. Will be empty in the case of a deletion. |
| | **api\_version** string | success | The versioned schema of this representation of an object. |
| | **kind** string | success | Always 'Service'. |
| | **metadata** complex | success | Standard object metadata. Includes name, namespace, annotations, labels, etc. |
| | **spec** complex | success | Specific attributes of the object. Will vary based on the *api\_version* and *kind*. |
| | **status** complex | success | Current status details for the object. |
### Authors
* KubeVirt Team (@kubevirt)
| programming_docs |
ansible community.proxysql.proxysql_replication_hostgroups – Manages replication hostgroups using the proxysql admin interface community.proxysql.proxysql\_replication\_hostgroups – Manages replication hostgroups using the proxysql admin interface
========================================================================================================================
Note
This plugin is part of the [community.proxysql collection](https://galaxy.ansible.com/community/proxysql) (version 1.3.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.proxysql`.
To use it in a playbook, specify: `community.proxysql.proxysql_replication_hostgroups`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Each row in mysql\_replication\_hostgroups represent a pair of writer\_hostgroup and reader\_hostgroup. ProxySQL will monitor the value of read\_only for all the servers in specified hostgroups, and based on the value of read\_only will assign the server to the writer or reader hostgroups.
Requirements
------------
The below requirements are needed on the host that executes this module.
* PyMySQL
* mysqlclient
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **check\_type** string added in 1.3.0 of community.proxysql | **Choices:*** **read\_only** ←
* innodb\_read\_only
* super\_read\_only
* read\_only|innodb\_read\_only
* read\_only&innodb\_read\_only
| Which check type to use when detecting that the node is a standby. Requires proxysql >= 2.0.1. Otherwise it has no effect.
`read_only|innodb_read_only` and `read_only&innodb_read_only` requires proxysql >= 2.0.8. |
| **comment** string | **Default:**"" | Text field that can be used for any purposes defined by the user. |
| **config\_file** path | **Default:**"" | Specify a config file from which *login\_user* and *login\_password* are to be read. |
| **load\_to\_runtime** boolean | **Choices:*** no
* **yes** ←
| Dynamically load config to runtime memory. |
| **login\_host** string | **Default:**"127.0.0.1" | The host used to connect to ProxySQL admin interface. |
| **login\_password** string | | The password used to authenticate to ProxySQL admin interface. |
| **login\_port** integer | **Default:**6032 | The port used to connect to ProxySQL admin interface. |
| **login\_unix\_socket** string | | The socket used to connect to ProxySQL admin interface. |
| **login\_user** string | | The username used to authenticate to ProxySQL admin interface. |
| **reader\_hostgroup** integer / required | | Id of the reader hostgroup. |
| **save\_to\_disk** boolean | **Choices:*** no
* **yes** ←
| Save config to sqlite db on disk to persist the configuration. |
| **state** string | **Choices:*** **present** ←
* absent
| When `present` - adds the replication hostgroup, when `absent` - removes the replication hostgroup. |
| **writer\_hostgroup** integer / required | | Id of the writer hostgroup. |
Notes
-----
Note
* Supports `check_mode`.
Examples
--------
```
---
# This example adds a replication hostgroup, it saves the mysql server config
# to disk, but avoids loading the mysql server config to runtime (this might be
# because several replication hostgroup are being added and the user wants to
# push the config to runtime in a single batch using the
# community.general.proxysql_manage_config module). It uses supplied credentials
# to connect to the proxysql admin interface.
- name: Add a replication hostgroup
community.proxysql.proxysql_replication_hostgroups:
login_user: 'admin'
login_password: 'admin'
writer_hostgroup: 1
reader_hostgroup: 2
state: present
load_to_runtime: False
- name: Change check_type
community.proxysql.proxysql_replication_hostgroups:
login_user: 'admin'
login_password: 'admin'
writer_hostgroup: 1
reader_hostgroup: 2
check_type: innodb_read_only
state: present
load_to_runtime: False
# This example removes a replication hostgroup, saves the mysql server config
# to disk, and dynamically loads the mysql server config to runtime. It uses
# credentials in a supplied config file to connect to the proxysql admin
# interface.
- name: Remove a replication hostgroup
community.proxysql.proxysql_replication_hostgroups:
config_file: '~/proxysql.cnf'
writer_hostgroup: 3
reader_hostgroup: 4
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **stdout** dictionary | On create/update will return the newly modified group, on delete it will return the deleted record. | The replication hostgroup modified or removed from proxysql. **Sample:** {'changed': True, 'msg': 'Added server to mysql\_hosts', 'repl\_group': {'check\_type': 'read\_only', 'comment': '', 'reader\_hostgroup': '1', 'writer\_hostgroup': '2'}, 'state': 'present'} |
### Authors
* Ben Mildren (@bmildren)
ansible community.proxysql.proxysql_global_variables – Gets or sets the proxysql global variables community.proxysql.proxysql\_global\_variables – Gets or sets the proxysql global variables
===========================================================================================
Note
This plugin is part of the [community.proxysql collection](https://galaxy.ansible.com/community/proxysql) (version 1.3.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.proxysql`.
To use it in a playbook, specify: `community.proxysql.proxysql_global_variables`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* The [community.proxysql.proxysql\_global\_variables](#ansible-collections-community-proxysql-proxysql-global-variables-module) module gets or sets the proxysql global variables.
Requirements
------------
The below requirements are needed on the host that executes this module.
* PyMySQL
* mysqlclient
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config\_file** path | **Default:**"" | Specify a config file from which *login\_user* and *login\_password* are to be read. |
| **load\_to\_runtime** boolean | **Choices:*** no
* **yes** ←
| Dynamically load config to runtime memory. |
| **login\_host** string | **Default:**"127.0.0.1" | The host used to connect to ProxySQL admin interface. |
| **login\_password** string | | The password used to authenticate to ProxySQL admin interface. |
| **login\_port** integer | **Default:**6032 | The port used to connect to ProxySQL admin interface. |
| **login\_unix\_socket** string | | The socket used to connect to ProxySQL admin interface. |
| **login\_user** string | | The username used to authenticate to ProxySQL admin interface. |
| **save\_to\_disk** boolean | **Choices:*** no
* **yes** ←
| Save config to sqlite db on disk to persist the configuration. |
| **value** string | | Defines a value the variable specified using *variable* should be set to. |
| **variable** string / required | | Defines which variable should be returned, or if *value* is specified which variable should be updated. |
Notes
-----
Note
* Supports `check_mode`.
Examples
--------
```
---
# This example sets the value of a variable, saves the mysql admin variables
# config to disk, and dynamically loads the mysql admin variables config to
# runtime. It uses supplied credentials to connect to the proxysql admin
# interface.
- name: Set the value of a variable
community.proxysql.proxysql_global_variables:
login_user: 'admin'
login_password: 'admin'
variable: 'mysql-max_connections'
value: 4096
# This example gets the value of a variable. It uses credentials in a
# supplied config file to connect to the proxysql admin interface.
- name: Get the value of a variable
community.proxysql.proxysql_global_variables:
config_file: '~/proxysql.cnf'
variable: 'mysql-default_query_delay'
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **stdout** dictionary | Returns the current variable and value, or the newly set value for the variable supplied.. | Returns the mysql variable supplied with it's associated value. **Sample:** {'changed': False, 'msg': 'The variable is already been set to the supplied value', 'var': {'variable\_name': 'mysql-poll\_timeout', 'variable\_value': '3000'}} |
### Authors
* Ben Mildren (@bmildren)
ansible community.proxysql.proxysql_scheduler – Adds or removes schedules from proxysql admin interface community.proxysql.proxysql\_scheduler – Adds or removes schedules from proxysql admin interface
================================================================================================
Note
This plugin is part of the [community.proxysql collection](https://galaxy.ansible.com/community/proxysql) (version 1.3.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.proxysql`.
To use it in a playbook, specify: `community.proxysql.proxysql_scheduler`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* The [community.proxysql.proxysql\_scheduler](#ansible-collections-community-proxysql-proxysql-scheduler-module) module adds or removes schedules using the proxysql admin interface.
Requirements
------------
The below requirements are needed on the host that executes this module.
* PyMySQL
* mysqlclient
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **active** boolean | **Choices:*** no
* **yes** ←
| A schedule with *active* set to `False` will be tracked in the database, but will be never loaded in the in-memory data structures. |
| **arg1** string | | Argument that can be passed to the job. |
| **arg2** string | | Argument that can be passed to the job. |
| **arg3** string | | Argument that can be passed to the job. |
| **arg4** string | | Argument that can be passed to the job. |
| **arg5** string | | Argument that can be passed to the job. |
| **comment** string | | Text field that can be used for any purposed defined by the user. |
| **config\_file** path | **Default:**"" | Specify a config file from which *login\_user* and *login\_password* are to be read. |
| **filename** string / required | | Full path of the executable to be executed. |
| **force\_delete** boolean | **Choices:*** **no** ←
* yes
| By default we avoid deleting more than one schedule in a single batch, however if you need this behaviour and you are not concerned about the schedules deleted, you can set *force\_delete* to `True`. |
| **interval\_ms** integer | **Default:**10000 | How often (in millisecond) the job will be started. The minimum value for *interval\_ms* is 100 milliseconds. |
| **load\_to\_runtime** boolean | **Choices:*** no
* **yes** ←
| Dynamically load config to runtime memory. |
| **login\_host** string | **Default:**"127.0.0.1" | The host used to connect to ProxySQL admin interface. |
| **login\_password** string | | The password used to authenticate to ProxySQL admin interface. |
| **login\_port** integer | **Default:**6032 | The port used to connect to ProxySQL admin interface. |
| **login\_unix\_socket** string | | The socket used to connect to ProxySQL admin interface. |
| **login\_user** string | | The username used to authenticate to ProxySQL admin interface. |
| **save\_to\_disk** boolean | **Choices:*** no
* **yes** ←
| Save config to sqlite db on disk to persist the configuration. |
| **state** string | **Choices:*** **present** ←
* absent
| When `present` - adds the schedule, when `absent` - removes the schedule. |
Notes
-----
Note
* Supports `check_mode`.
Examples
--------
```
---
# This example adds a schedule, it saves the scheduler config to disk, but
# avoids loading the scheduler config to runtime (this might be because
# several servers are being added and the user wants to push the config to
# runtime in a single batch using the community.general.proxysql_manage_config
# module). It uses supplied credentials to connect to the proxysql admin
# interface.
- name: Add a schedule
community.proxysql.proxysql_scheduler:
login_user: 'admin'
login_password: 'admin'
interval_ms: 1000
filename: "/opt/maintenance.py"
state: present
load_to_runtime: False
# This example removes a schedule, saves the scheduler config to disk, and
# dynamically loads the scheduler config to runtime. It uses credentials
# in a supplied config file to connect to the proxysql admin interface.
- name: Remove a schedule
community.proxysql.proxysql_scheduler:
config_file: '~/proxysql.cnf'
filename: "/opt/old_script.py"
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **stdout** dictionary | On create/update will return the newly modified schedule, on delete it will return the deleted record. | The schedule modified or removed from proxysql. **Sample:** {'changed': True, 'filename': '/opt/test.py', 'msg': 'Added schedule to scheduler', 'schedules': [{'active': '1', 'arg1': None, 'arg2': None, 'arg3': None, 'arg4': None, 'arg5': None, 'comment': '', 'filename': '/opt/test.py', 'id': '1', 'interval\_ms': '10000'}], 'state': 'present'} |
### Authors
* Ben Mildren (@bmildren)
ansible community.proxysql.proxysql_manage_config – Writes the proxysql configuration settings between layers community.proxysql.proxysql\_manage\_config – Writes the proxysql configuration settings between layers
=======================================================================================================
Note
This plugin is part of the [community.proxysql collection](https://galaxy.ansible.com/community/proxysql) (version 1.3.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.proxysql`.
To use it in a playbook, specify: `community.proxysql.proxysql_manage_config`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* The [community.proxysql.proxysql\_global\_variables](proxysql_global_variables_module#ansible-collections-community-proxysql-proxysql-global-variables-module) module writes the proxysql configuration settings between layers. Currently this module will always report a changed state, so should typically be used with WHEN however this will change in a future version when the CHECKSUM table commands are available for all tables in proxysql.
Requirements
------------
The below requirements are needed on the host that executes this module.
* PyMySQL
* mysqlclient
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **action** string / required | **Choices:*** LOAD
* SAVE
| The supplied *action* combines with the supplied *direction* to provide the semantics of how we want to move the *config\_settings* between the *config\_layers*. |
| **config\_file** path | **Default:**"" | Specify a config file from which *login\_user* and *login\_password* are to be read. |
| **config\_layer** string / required | **Choices:*** MEMORY
* DISK
* RUNTIME
* CONFIG
| RUNTIME - represents the in-memory data structures of ProxySQL used by the threads that are handling the requests. MEMORY - (sometimes also referred as main) represents the in-memory SQLite3 database. DISK - represents the on-disk SQLite3 database. CONFIG - is the classical config file. You can only LOAD FROM the config file. |
| **config\_settings** string / required | **Choices:*** MYSQL USERS
* MYSQL SERVERS
* MYSQL QUERY RULES
* MYSQL VARIABLES
* ADMIN VARIABLES
* SCHEDULER
| The *config\_settings* specifies which configuration we're writing. |
| **direction** string / required | **Choices:*** FROM
* TO
| FROM - denotes we're reading values FROM the supplied *config\_layer* and writing to the next layer. TO - denotes we're reading from the previous layer and writing TO the supplied *config\_layer*." |
| **login\_host** string | **Default:**"127.0.0.1" | The host used to connect to ProxySQL admin interface. |
| **login\_password** string | | The password used to authenticate to ProxySQL admin interface. |
| **login\_port** integer | **Default:**6032 | The port used to connect to ProxySQL admin interface. |
| **login\_unix\_socket** string | | The socket used to connect to ProxySQL admin interface. |
| **login\_user** string | | The username used to authenticate to ProxySQL admin interface. |
Notes
-----
Note
* Supports `check_mode`.
Examples
--------
```
---
# This example saves the mysql users config from memory to disk. It uses
# supplied credentials to connect to the proxysql admin interface.
- name: Save the mysql users config from memory to disk
community.proxysql.proxysql_manage_config:
login_user: 'admin'
login_password: 'admin'
action: "SAVE"
config_settings: "MYSQL USERS"
direction: "FROM"
config_layer: "MEMORY"
# This example loads the mysql query rules config from memory to runtime. It
# uses supplied credentials to connect to the proxysql admin interface.
- name: Load the mysql query rules config from memory to runtime
community.proxysql.proxysql_manage_config:
config_file: '~/proxysql.cnf'
action: "LOAD"
config_settings: "MYSQL QUERY RULES"
direction: "TO"
config_layer: "RUNTIME"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **stdout** dictionary | Currently the returned value with always be changed=True. | Simply reports whether the action reported a change. **Sample:** {'changed': True} |
### Authors
* Ben Mildren (@bmildren)
ansible Community.Proxysql Community.Proxysql
==================
Collection version 1.3.0
Plugin Index
------------
These are the plugins in the community.proxysql collection
### Modules
* [proxysql\_backend\_servers](proxysql_backend_servers_module#ansible-collections-community-proxysql-proxysql-backend-servers-module) – Adds or removes mysql hosts from proxysql admin interface
* [proxysql\_global\_variables](proxysql_global_variables_module#ansible-collections-community-proxysql-proxysql-global-variables-module) – Gets or sets the proxysql global variables
* [proxysql\_info](proxysql_info_module#ansible-collections-community-proxysql-proxysql-info-module) – Gathers information about proxysql server
* [proxysql\_manage\_config](proxysql_manage_config_module#ansible-collections-community-proxysql-proxysql-manage-config-module) – Writes the proxysql configuration settings between layers
* [proxysql\_mysql\_users](proxysql_mysql_users_module#ansible-collections-community-proxysql-proxysql-mysql-users-module) – Adds or removes mysql users from proxysql admin interface
* [proxysql\_query\_rules](proxysql_query_rules_module#ansible-collections-community-proxysql-proxysql-query-rules-module) – Modifies query rules using the proxysql admin interface
* [proxysql\_query\_rules\_fast\_routing](proxysql_query_rules_fast_routing_module#ansible-collections-community-proxysql-proxysql-query-rules-fast-routing-module) – Modifies query rules for fast routing policies using the proxysql admin interface
* [proxysql\_replication\_hostgroups](proxysql_replication_hostgroups_module#ansible-collections-community-proxysql-proxysql-replication-hostgroups-module) – Manages replication hostgroups using the proxysql admin interface
* [proxysql\_scheduler](proxysql_scheduler_module#ansible-collections-community-proxysql-proxysql-scheduler-module) – Adds or removes schedules from proxysql admin interface
See also
List of [collections](../../index#list-of-collections) with docs hosted here.
| programming_docs |
ansible community.proxysql.proxysql_mysql_users – Adds or removes mysql users from proxysql admin interface community.proxysql.proxysql\_mysql\_users – Adds or removes mysql users from proxysql admin interface
=====================================================================================================
Note
This plugin is part of the [community.proxysql collection](https://galaxy.ansible.com/community/proxysql) (version 1.3.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.proxysql`.
To use it in a playbook, specify: `community.proxysql.proxysql_mysql_users`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* The [community.proxysql.proxysql\_mysql\_users](#ansible-collections-community-proxysql-proxysql-mysql-users-module) module adds or removes mysql users using the proxysql admin interface.
Requirements
------------
The below requirements are needed on the host that executes this module.
* PyMySQL
* mysqlclient
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **active** boolean | **Choices:*** no
* yes
| A user with *active* set to `False` will be tracked in the database, but will be never loaded in the in-memory data structures. If omitted the proxysql database default for *active* is `True`. |
| **backend** boolean | **Choices:*** no
* **yes** ←
| If *backend* is set to `True`, this (username, password) pair is used for authenticating to the ProxySQL instance. |
| **config\_file** path | **Default:**"" | Specify a config file from which *login\_user* and *login\_password* are to be read. |
| **default\_hostgroup** integer | | If there is no matching rule for the queries sent by this user, the traffic it generates is sent to the specified hostgroup. If omitted the proxysql database default for *use\_ssl* is 0. |
| **default\_schema** string | | The schema to which the connection should change to by default. |
| **encrypt\_password** boolean | **Choices:*** **no** ←
* yes
| Encrypt a cleartext password passed in the *password* option, using the method defined in *encryption\_method*. |
| **encryption\_method** string | **Choices:*** **mysql\_native\_password** ←
| Encryption method used when *encrypt\_password* is set to `True`. |
| **fast\_forward** boolean | **Choices:*** no
* yes
| If *fast\_forward* is set to `True`, *fast\_forward* will bypass the query processing layer (rewriting, caching) and pass through the query directly as is to the backend server. If omitted the proxysql database default for *fast\_forward* is `False`. |
| **frontend** boolean | **Choices:*** no
* **yes** ←
| If *frontend* is set to `True`, this (username, password) pair is used for authenticating to the mysqld servers against any hostgroup. |
| **load\_to\_runtime** boolean | **Choices:*** no
* **yes** ←
| Dynamically load config to runtime memory. |
| **login\_host** string | **Default:**"127.0.0.1" | The host used to connect to ProxySQL admin interface. |
| **login\_password** string | | The password used to authenticate to ProxySQL admin interface. |
| **login\_port** integer | **Default:**6032 | The port used to connect to ProxySQL admin interface. |
| **login\_unix\_socket** string | | The socket used to connect to ProxySQL admin interface. |
| **login\_user** string | | The username used to authenticate to ProxySQL admin interface. |
| **max\_connections** integer | | The maximum number of connections ProxySQL will open to the backend for this user. If omitted the proxysql database default for *max\_connections* is 10000. |
| **password** string | | Password of the user connecting to the mysqld or ProxySQL instance. |
| **save\_to\_disk** boolean | **Choices:*** no
* **yes** ←
| Save config to sqlite db on disk to persist the configuration. |
| **state** string | **Choices:*** **present** ←
* absent
| When `present` - adds the user, when `absent` - removes the user. |
| **transaction\_persistent** boolean | **Choices:*** no
* yes
| If this is set for the user with which the MySQL client is connecting to ProxySQL (thus a "frontend" user), transactions started within a hostgroup will remain within that hostgroup regardless of any other rules. If omitted the proxysql database default for *transaction\_persistent* is `False`. |
| **use\_ssl** boolean | **Choices:*** no
* yes
| If *use\_ssl* is set to `True`, connections by this user will be made using SSL connections. If omitted the proxysql database default for *use\_ssl* is `False`. |
| **username** string / required | | Name of the user connecting to the mysqld or ProxySQL instance. |
Notes
-----
Note
* Supports `check_mode`.
Examples
--------
```
---
# This example adds a user, it saves the mysql user config to disk, but
# avoids loading the mysql user config to runtime (this might be because
# several users are being added and the user wants to push the config to
# runtime in a single batch using the community.general.proxysql_manage_config
# module). It uses supplied credentials to connect to the proxysql admin
# interface.
- name: Add a user
community.proxysql.proxysql_mysql_users:
login_user: 'admin'
login_password: 'admin'
username: 'productiondba'
state: present
load_to_runtime: False
# This example removes a user, saves the mysql user config to disk, and
# dynamically loads the mysql user config to runtime. It uses credentials
# in a supplied config file to connect to the proxysql admin interface.
- name: Remove a user
community.proxysql.proxysql_mysql_users:
config_file: '~/proxysql.cnf'
username: 'mysqlboy'
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **stdout** dictionary | On create/update will return the newly modified user, on delete it will return the deleted record. | The mysql user modified or removed from proxysql. **Sample:** {'changed': True, 'msg': 'Added user to mysql\_users', 'state': 'present', 'user': {'active': 1, 'backend': 1, 'default\_hostgroup': 1, 'default\_schema': None, 'fast\_forward': 0, 'frontend': 1, 'max\_connections': 10000, 'password': 'VALUE\_SPECIFIED\_IN\_NO\_LOG\_PARAMETER', 'schema\_locked': 0, 'transaction\_persistent': 0, 'use\_ssl': 0, 'username': 'guest\_ro'}, 'username': 'guest\_ro'} |
### Authors
* Ben Mildren (@bmildren)
ansible community.proxysql.proxysql_info – Gathers information about proxysql server community.proxysql.proxysql\_info – Gathers information about proxysql server
=============================================================================
Note
This plugin is part of the [community.proxysql collection](https://galaxy.ansible.com/community/proxysql) (version 1.3.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.proxysql`.
To use it in a playbook, specify: `community.proxysql.proxysql_info`.
New in version 1.2.0: of community.proxysql
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Gathers information about proxysql server.
* Caution. The number of tables that returns, depends on the underlying proyxsql server version.
Requirements
------------
The below requirements are needed on the host that executes this module.
* PyMySQL
* mysqlclient
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **config\_file** path | **Default:**"" | Specify a config file from which *login\_user* and *login\_password* are to be read. |
| **login\_host** string | **Default:**"127.0.0.1" | The host used to connect to ProxySQL admin interface. |
| **login\_password** string | | The password used to authenticate to ProxySQL admin interface. |
| **login\_port** integer | **Default:**6032 | The port used to connect to ProxySQL admin interface. |
| **login\_unix\_socket** string | | The socket used to connect to ProxySQL admin interface. |
| **login\_user** string | | The username used to authenticate to ProxySQL admin interface. |
Notes
-----
Note
* Supports `check_mode`.
Examples
--------
```
- name: Receive information about proxysql setup
community.proxysql.proxysql_info:
login_user: admin
login_password: admin
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **stdout** dictionary | Always | The number of tables that returns, depends on the underlying proyxsql server version. **Sample:** {'changed': False, 'failed': False, 'global\_variables': {'description': 'Global variables of requested proxysql.', 'returned': 'Always', 'type': 'dict'}, 'tables': {'description': 'List of tables that exist in the requested proxysql version.', 'returned': 'Always', 'sample': ['global\_variables', 'mysql\_aws\_aurora\_hostgroups', 'mysql\_collations', 'mysql\_firewall\_whitelist\_rules', 'mysql\_firewall\_whitelist\_sqli\_fingerprints', 'mysql\_firewall\_whitelist\_users', 'mysql\_galera\_hostgroups', 'mysql\_group\_replication\_hostgroups', 'mysql\_query\_rules', 'mysql\_query\_rules\_fast\_routing', 'mysql\_replication\_hostgroups', 'mysql\_servers', 'mysql\_users', 'proxysql\_servers', 'restapi\_routes', 'runtime\_checksums\_values', 'runtime\_global\_variables', 'runtime\_mysql\_aws\_aurora\_hostgroups', 'runtime\_mysql\_firewall\_whitelist\_rules', 'runtime\_mysql\_firewall\_whitelist\_sqli\_fingerprints', 'runtime\_mysql\_firewall\_whitelist\_users', 'runtime\_mysql\_galera\_hostgroups', 'runtime\_mysql\_group\_replication\_hostgroups', 'runtime\_mysql\_query\_rules', 'runtime\_mysql\_query\_rules\_fast\_routing', 'runtime\_mysql\_replication\_hostgroups', 'runtime\_mysql\_servers', 'runtime\_mysql\_users', 'runtime\_proxysql\_servers', 'runtime\_restapi\_routes', 'runtime\_scheduler', 'scheduler'], 'type': 'list'}, 'version': {'description': 'Version of proxysql.', 'returned': 'Always', 'sample': {'full': '2.1.1-40-g1c2b7e4', 'major': 2, 'minor': 1, 'release': 1, 'suffix': 40}, 'type': 'dict'}} |
### Authors
* Markus Bergholz (@markuman)
ansible community.proxysql.proxysql_backend_servers – Adds or removes mysql hosts from proxysql admin interface community.proxysql.proxysql\_backend\_servers – Adds or removes mysql hosts from proxysql admin interface
=========================================================================================================
Note
This plugin is part of the [community.proxysql collection](https://galaxy.ansible.com/community/proxysql) (version 1.3.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.proxysql`.
To use it in a playbook, specify: `community.proxysql.proxysql_backend_servers`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* The [community.proxysql.proxysql\_backend\_servers](#ansible-collections-community-proxysql-proxysql-backend-servers-module) module adds or removes mysql hosts using the proxysql admin interface.
Requirements
------------
The below requirements are needed on the host that executes this module.
* PyMySQL
* mysqlclient
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **comment** string | **Default:**"" | Text field that can be used for any purposed defined by the user. Could be a description of what the host stores, a reminder of when the host was added or disabled, or a JSON processed by some checker script. |
| **compression** integer | | If the value of *compression* is greater than 0, new connections to that server will use compression. If omitted the proxysql database default for *compression* is 0. |
| **config\_file** path | **Default:**"" | Specify a config file from which *login\_user* and *login\_password* are to be read. |
| **hostgroup\_id** integer | **Default:**0 | The hostgroup in which this mysqld instance is included. An instance can be part of one or more hostgroups. |
| **hostname** string / required | | The ip address at which the mysqld instance can be contacted. |
| **load\_to\_runtime** boolean | **Choices:*** no
* **yes** ←
| Dynamically load config to runtime memory. |
| **login\_host** string | **Default:**"127.0.0.1" | The host used to connect to ProxySQL admin interface. |
| **login\_password** string | | The password used to authenticate to ProxySQL admin interface. |
| **login\_port** integer | **Default:**6032 | The port used to connect to ProxySQL admin interface. |
| **login\_unix\_socket** string | | The socket used to connect to ProxySQL admin interface. |
| **login\_user** string | | The username used to authenticate to ProxySQL admin interface. |
| **max\_connections** integer | | The maximum number of connections ProxySQL will open to this backend server. If omitted the proxysql database default for *max\_connections* is 1000. |
| **max\_latency\_ms** integer | | Ping time is monitored regularly. If a host has a ping time greater than *max\_latency\_ms* it is excluded from the connection pool (although the server stays ONLINE). If omitted the proxysql database default for *max\_latency\_ms* is 0. |
| **max\_replication\_lag** integer | | If greater than 0, ProxySQL will regularly monitor replication lag. If replication lag goes above *max\_replication\_lag*, proxysql will temporarily shun the server until replication catches up. If omitted the proxysql database default for *max\_replication\_lag* is 0. |
| **port** integer | **Default:**3306 | The port at which the mysqld instance can be contacted. |
| **save\_to\_disk** boolean | **Choices:*** no
* **yes** ←
| Save config to sqlite db on disk to persist the configuration. |
| **state** string | **Choices:*** **present** ←
* absent
| When `present` - adds the host, when `absent` - removes the host. |
| **status** string | **Choices:*** ONLINE
* OFFLINE\_SOFT
* OFFLINE\_HARD
| ONLINE - Backend server is fully operational. OFFLINE\_SOFT - When a server is put into `OFFLINE_SOFT` mode, connections are kept in use until the current transaction is completed. This allows to gracefully detach a backend. OFFLINE\_HARD - When a server is put into `OFFLINE_HARD` mode, the existing connections are dropped, while new incoming connections aren't accepted either. If omitted the proxysql database default for *status* is `ONLINE`. |
| **use\_ssl** boolean | **Choices:*** no
* yes
| If *use\_ssl* is set to `True`, connections to this server will be made using SSL connections. If omitted the proxysql database default for *use\_ssl* is `False`. |
| **weight** integer | | The bigger the weight of a server relative to other weights, the higher the probability of the server being chosen from the hostgroup. If omitted the proxysql database default for *weight* is 1. |
Notes
-----
Note
* Supports `check_mode`.
Examples
--------
```
---
# This example adds a server, it saves the mysql server config to disk, but
# avoids loading the mysql server config to runtime (this might be because
# several servers are being added and the user wants to push the config to
# runtime in a single batch using the community.general.proxysql_manage_config
# module). It uses supplied credentials to connect to the proxysql admin
# interface.
- name: Add a server
community.proxysql.proxysql_backend_servers:
login_user: 'admin'
login_password: 'admin'
hostname: 'mysql01'
state: present
load_to_runtime: False
# This example removes a server, saves the mysql server config to disk, and
# dynamically loads the mysql server config to runtime. It uses credentials
# in a supplied config file to connect to the proxysql admin interface.
- name: Remove a server
community.proxysql.proxysql_backend_servers:
config_file: '~/proxysql.cnf'
hostname: 'mysql02'
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **stdout** dictionary | On create/update will return the newly modified host, on delete it will return the deleted record. | The mysql host modified or removed from proxysql **Sample:** {'changed': True, 'hostname': '192.168.52.1', 'msg': 'Added server to mysql\_hosts', 'server': {'comment': '', 'compression': '0', 'hostgroup\_id': '1', 'hostname': '192.168.52.1', 'max\_connections': '1000', 'max\_latency\_ms': '0', 'max\_replication\_lag': '0', 'port': '3306', 'status': 'ONLINE', 'use\_ssl': '0', 'weight': '1'}, 'state': 'present'} |
### Authors
* Ben Mildren (@bmildren)
ansible community.proxysql.proxysql_query_rules_fast_routing – Modifies query rules for fast routing policies using the proxysql admin interface community.proxysql.proxysql\_query\_rules\_fast\_routing – Modifies query rules for fast routing policies using the proxysql admin interface
============================================================================================================================================
Note
This plugin is part of the [community.proxysql collection](https://galaxy.ansible.com/community/proxysql) (version 1.3.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.proxysql`.
To use it in a playbook, specify: `community.proxysql.proxysql_query_rules_fast_routing`.
New in version 1.1.0: of community.proxysql
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* The [community.proxysql.proxysql\_query\_rules\_fast\_routing](#ansible-collections-community-proxysql-proxysql-query-rules-fast-routing-module) module modifies query rules for fast routing policies and attributes using the proxysql admin interface.
Requirements
------------
The below requirements are needed on the host that executes this module.
* PyMySQL
* mysqlclient
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **comment** string | **Default:**"" | Free form text field, usable for a descriptive comment of the query rule. |
| **config\_file** path | **Default:**"" | Specify a config file from which *login\_user* and *login\_password* are to be read. |
| **destination\_hostgroup** integer / required | | Route matched queries to this hostgroup. This happens unless there is a started transaction and the logged in user has *transaction\_persistent* set to `True` (refer to [community.proxysql.proxysql\_mysql\_users](proxysql_mysql_users_module)). |
| **flagIN** integer | **Default:**0 | Evaluated in the same way as *flagIN* is in **mysql\_query\_rules** and correlates to the *flagOUT/apply* specified in the **mysql\_query\_rules** table. (see [community.proxysql.proxysql\_query\_rules](proxysql_query_rules_module)). |
| **force\_delete** boolean | **Choices:*** **no** ←
* yes
| By default, we avoid deleting more than one schedule in a single batch; however, if you need this behaviour and you are not concerned about the schedules deleted, you can set *force\_delete* to `True`. |
| **load\_to\_runtime** boolean | **Choices:*** no
* **yes** ←
| Dynamically load config to runtime memory. |
| **login\_host** string | **Default:**"127.0.0.1" | The host used to connect to ProxySQL admin interface. |
| **login\_password** string | | The password used to authenticate to ProxySQL admin interface. |
| **login\_port** integer | **Default:**6032 | The port used to connect to ProxySQL admin interface. |
| **login\_unix\_socket** string | | The socket used to connect to ProxySQL admin interface. |
| **login\_user** string | | The username used to authenticate to ProxySQL admin interface. |
| **save\_to\_disk** boolean | **Choices:*** no
* **yes** ←
| Save config to sqlite db on disk to persist the configuration. |
| **schemaname** string / required | | Filtering criteria matching schemaname, a query will match only if the connection uses schemaname as its default schema. |
| **state** string | **Choices:*** **present** ←
* absent
| When `present`, adds the rule. When `absent`, removes the rule. |
| **username** string / required | | Filtering criteria matching username, a query will match only if the connection is made with the correct username. |
Notes
-----
Note
* Supports `check_mode`.
Examples
--------
```
---
# This example adds a rule for fast routing
- name: Add a rule
community.proxysql.proxysql_query_rules_fast_routing:
login_user: admin
login_password: admin
username: 'user_ro'
schemaname: 'default'
destination_hostgroup: 1
comment: 'fast route user_ro to default schema'
state: present
save_to_disk: yes
load_to_runtime: yes
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **stdout** dictionary | On create/update will return the newly modified rule, in all other cases will return a list of rules that match the supplied criteria. | The mysql user modified or removed from proxysql. **Sample:** {'changed': True, 'msg': 'Added rule to mysql\_query\_rules\_fast\_routing', 'rules': [{'comment': '', 'destination\_hostgroup': 1, 'flagIN': '0', 'schemaname': 'default', 'username': 'user\_ro'}], 'state': 'present'} |
### Authors
* Akim Lindberg (@akimrx)
| programming_docs |
ansible community.proxysql.proxysql_query_rules – Modifies query rules using the proxysql admin interface community.proxysql.proxysql\_query\_rules – Modifies query rules using the proxysql admin interface
===================================================================================================
Note
This plugin is part of the [community.proxysql collection](https://galaxy.ansible.com/community/proxysql) (version 1.3.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.proxysql`.
To use it in a playbook, specify: `community.proxysql.proxysql_query_rules`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* The [community.proxysql.proxysql\_query\_rules](#ansible-collections-community-proxysql-proxysql-query-rules-module) module modifies query rules using the proxysql admin interface.
Requirements
------------
The below requirements are needed on the host that executes this module.
* PyMySQL
* mysqlclient
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **active** boolean | **Choices:*** no
* yes
| A rule with *active* set to `False` will be tracked in the database, but will be never loaded in the in-memory data structures. |
| **apply** boolean | **Choices:*** no
* yes
| Used in combination with *flagIN* and *flagOUT* to create chains of rules. Setting apply to True signifies the last rule to be applied. |
| **cache\_empty\_result** boolean added in 1.1.0 of community.proxysql | **Choices:*** no
* yes
| Controls if resultset without rows will be cached or not. |
| **cache\_ttl** integer | | The number of milliseconds for which to cache the result of the query. Note in ProxySQL 1.1 *cache\_ttl* was in seconds. |
| **client\_addr** string | | Match traffic from a specific source. |
| **comment** string | | Free form text field, usable for a descriptive comment of the query rule. |
| **config\_file** path | **Default:**"" | Specify a config file from which *login\_user* and *login\_password* are to be read. |
| **delay** integer | | Number of milliseconds to delay the execution of the query. This is essentially a throttling mechanism and QoS, and allows a way to give priority to queries over others. This value is added to the mysql-default\_query\_delay global variable that applies to all queries. |
| **destination\_hostgroup** integer | | Route matched queries to this hostgroup. This happens unless there is a started transaction and the logged in user has *transaction\_persistent* set to `True` (see [community.proxysql.proxysql\_mysql\_users](proxysql_mysql_users_module)). |
| **digest** string | | Match queries with a specific digest, as returned by stats\_mysql\_query\_digest.digest. |
| **error\_msg** string | | Query will be blocked, and the specified error\_msg will be returned to the client. |
| **flagIN** integer | | Used in combination with *flagOUT* and *apply* to create chains of rules. |
| **flagOUT** integer | | Used in combination with *flagIN* and apply to create chains of rules. When set, *flagOUT* signifies the *flagIN* to be used in the next chain of rules. |
| **force\_delete** boolean | **Choices:*** **no** ←
* yes
| By default we avoid deleting more than one schedule in a single batch, however if you need this behaviour and you are not concerned about the schedules deleted, you can set *force\_delete* to `True`. |
| **load\_to\_runtime** boolean | **Choices:*** no
* **yes** ←
| Dynamically load config to runtime memory. |
| **log** boolean | **Choices:*** no
* yes
| Query will be logged. |
| **login\_host** string | **Default:**"127.0.0.1" | The host used to connect to ProxySQL admin interface. |
| **login\_password** string | | The password used to authenticate to ProxySQL admin interface. |
| **login\_port** integer | **Default:**6032 | The port used to connect to ProxySQL admin interface. |
| **login\_unix\_socket** string | | The socket used to connect to ProxySQL admin interface. |
| **login\_user** string | | The username used to authenticate to ProxySQL admin interface. |
| **match\_digest** string | | Regular expression that matches the query digest. The dialect of regular expressions used is that of re2 - <https://github.com/google/re2>. |
| **match\_pattern** string | | Regular expression that matches the query text. The dialect of regular expressions used is that of re2 - <https://github.com/google/re2>. |
| **mirror\_flagOUT** integer | | Enables query mirroring. If set *mirror\_flagOUT* can be used to evaluates the mirrored query against the specified chain of rules. |
| **mirror\_hostgroup** integer | | Enables query mirroring. If set *mirror\_hostgroup* can be used to mirror queries to the same or different hostgroup. |
| **multiplex** integer added in 1.1.0 of community.proxysql | **Choices:*** 0
* 1
* 2
| If `0`, multiplex will be disabled. If `1`, try to enable multiplex. There can be other conditions preventing this (for example, user variables or transactions). If `2`, multiplexing is not disabled for just the current query. By default, does not change multiplexing policies. |
| **negate\_match\_pattern** boolean | **Choices:*** no
* yes
| If *negate\_match\_pattern* is set to `True`, only queries not matching the query text will be considered as a match. This acts as a NOT operator in front of the regular expression matching against match\_pattern. |
| **next\_query\_flagIN** integer added in 1.3.0 of community.proxysql | | When is set, its value will become the *flagIN* value for the next queries. |
| **OK\_msg** string added in 1.1.0 of community.proxysql | | The specified message will be returned for a query that uses the defined rule. |
| **proxy\_addr** string | | Match incoming traffic on a specific local IP. |
| **proxy\_port** integer | | Match incoming traffic on a specific local port. |
| **re\_modifiers** string added in 1.3.0 of community.proxysql | | Comma separated list of options to modify the behavior of the RE engine. With `CASELESS` the match is case insensitive. With `GLOBAL` the replace is global (replaces all matches and not just the first). For backward compatibility, only `CASELESS` is the enabled by default. |
| **replace\_pattern** string | | This is the pattern with which to replace the matched pattern. Note that this is optional, and when omitted, the query processor will only cache, route, or set other parameters without rewriting. |
| **retries** integer | | The maximum number of times a query needs to be re-executed in case of detected failure during the execution of the query. If retries is not specified, the global variable mysql-query\_retries\_on\_failure applies. |
| **rule\_id** integer | | The unique id of the rule. Rules are processed in rule\_id order. |
| **save\_to\_disk** boolean | **Choices:*** no
* **yes** ←
| Save config to sqlite db on disk to persist the configuration. |
| **schemaname** string | | Filtering criteria matching schemaname. If *schemaname* is non-NULL, a query will match only if the connection uses schemaname as its default schema. |
| **state** string | **Choices:*** **present** ←
* absent
| When `present` - adds the rule, when `absent` - removes the rule. |
| **timeout** integer | | The maximum timeout in milliseconds with which the matched or rewritten query should be executed. If a query run for longer than the specific threshold, the query is automatically killed. If timeout is not specified, the global variable mysql-default\_query\_timeout applies. |
| **username** string | | Filtering criteria matching username. If *username* is non-NULL, a query will match only if the connection is made with the correct username. |
Notes
-----
Note
* Supports `check_mode`.
Examples
--------
```
---
# This example adds a rule to redirect queries from a specific user to another
# hostgroup, it saves the mysql query rule config to disk, but avoids loading
# the mysql query config config to runtime (this might be because several
# rules are being added and the user wants to push the config to runtime in a
# single batch using the community.general.proxysql_manage_config module). It
# uses supplied credentials to connect to the proxysql admin interface.
- name: Add a rule
community.proxysql.proxysql_query_rules:
login_user: admin
login_password: admin
username: 'guest_ro'
match_pattern: "^SELECT.*"
destination_hostgroup: 1
active: 1
retries: 3
state: present
load_to_runtime: False
# This example demonstrates the situation, if your application tries to set a
# variable that will disable multiplexing, and you think it can be filtered out,
# you can create a filter that returns OK without executing the request.
- name: Add a filter rule
community.proxysql.proxysql_query_rules:
login_user: admin
login_password: admin
match_digest: '^SET @@wait_timeout = ?'
active: 1
OK_msg: 'The wait_timeout variable is ignored'
# This example adds a caching rule for a query that matches the digest.
# The query digest can be obtained from the `stats_mysql_query_digest`
# table. `cache_ttl` is specified in milliseconds. Empty responses are
# not cached.
- name: Add a cache rule
community.proxysql.proxysql_query_rules:
login_user: admin
login_password: admin
rule_id: 1
digest: 0xECA450EA500A9A55
cache_ttl: 30000
cache_empty_result: no
destination_hostgroup: 1
active: yes
state: present
save_to_disk: yes
load_to_runtime: yes
# This example demonstrates how to prevent disabling multiplexing for
# situations where a request contains @.
- name: Add a rule with multiplex
community.proxysql.proxysql_query_rules:
login_user: admin
login_password: admin
rule_id: 1
active: 1
match_digest: '^SELECT @@max_allowed_packet'
multiplex: 2
# This example demonstrates how to use next_query_flagIN argument. It allows
# ProxySQL query rules to be chained. The examples shows how you can have SELECTS
# immediately follow INSERT/UPDATE/DELETE statements to query the primary hostgroup
# and avoid replication lag
- name: Add insert query rule
proxysql_query_rules:
match_digest: "^INSERT"
destination_hostgroup: 1,
next_query_flagIN: 1
- name: Add update query rule
proxysql_query_rules:
match_digest: "^UPDATE"
destination_hostgroup: 1,
next_query_flagIN: 1
- name: Add delete query rules
proxysql_query_rules:
match_digest: "^DELETE"
destination_hostgroup: 1,
next_query_flagIN: 1
- name: Add insert query rules
proxysql_query_rules:
match_digest: ".*"
destination_hostgroup: 1,
next_query_flagIN: 1
comment: Match every queries after an INSERT/UPDATE/DELETE query
# This example removes all rules that use the username 'guest_ro', saves the
# mysql query rule config to disk, and dynamically loads the mysql query rule
# config to runtime. It uses credentials in a supplied config file to connect
# to the proxysql admin interface.
- name: Remove rules
community.proxysql.proxysql_query_rules:
config_file: '~/proxysql.cnf'
username: 'guest_ro'
state: absent
force_delete: true
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **stdout** dictionary | On create/update will return the newly modified rule, in all other cases will return a list of rules that match the supplied criteria. | The mysql user modified or removed from proxysql. **Sample:** {'changed': True, 'msg': 'Added rule to mysql\_query\_rules', 'rules': [{'OK\_msg': None, 'active': '0', 'apply': '0', 'cache\_empty\_result': None, 'cache\_ttl': None, 'client\_addr': None, 'comment': None, 'delay': None, 'destination\_hostgroup': 1, 'digest': None, 'error\_msg': None, 'flagIN': '0', 'flagOUT': None, 'log': None, 'match\_digest': None, 'match\_pattern': None, 'mirror\_flagOUT': None, 'mirror\_hostgroup': None, 'multiplex': None, 'negate\_match\_pattern': '0', 'proxy\_addr': None, 'proxy\_port': None, 'reconnect': None, 'replace\_pattern': None, 'retries': None, 'rule\_id': '1', 'schemaname': None, 'timeout': None, 'username': 'guest\_ro'}], 'state': 'present'} |
### Authors
* Ben Mildren (@bmildren)
ansible community.vmware.vmware_export_ovf – Exports a VMware virtual machine to an OVF file, device files and a manifest file community.vmware.vmware\_export\_ovf – Exports a VMware virtual machine to an OVF file, device files and a manifest file
========================================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_export_ovf`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to export a VMware virtual machine to OVF template from vCenter server or ESXi host.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **datacenter** string | **Default:**"ha-datacenter" | Datacenter name of the virtual machine to export. This parameter is case sensitive. |
| **download\_timeout** integer | **Default:**30 | The user defined timeout in second of exporting file. If the vmdk file is too large, you can increase the value. |
| **export\_dir** path / required | | Absolute path to place the exported files on the server running this task, must have write permission. If folder not exist will create it, also create a folder under this path named with VM name. |
| **export\_with\_images** boolean | **Choices:*** **no** ←
* yes
| Export an ISO image of the media mounted on the CD/DVD Drive within the virtual machine. |
| **folder** string | | Destination folder, absolute path to find the specified guest. The folder should include the datacenter. ESX datacenter is ha-datacenter. This parameter is case sensitive. If multiple machines are found with same name, this parameter is used to identify Examples: folder: /ha-datacenter/vm folder: ha-datacenter/vm folder: /datacenter1/vm folder: datacenter1/vm folder: /datacenter1/vm/folder1 folder: datacenter1/vm/folder1 folder: /folder1/datacenter1/vm folder: folder1/datacenter1/vm folder: /folder1/datacenter1/vm/folder2 |
| **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. |
| **moid** string | | Managed Object ID of the instance to manage if known, this is a unique identifier only within a single vCenter instance. This is required if `name` or `uuid` is not supplied. |
| **name** string | | Name of the virtual machine to export. This is a required parameter, if parameter `uuid` or `moid` is not supplied. |
| **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. |
| **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 |
| **uuid** string | | Uuid of the virtual machine to export. This is a required parameter, if parameter `name` or `moid` is not supplied. |
| **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
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- community.vmware.vmware_export_ovf:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
name: '{{ vm_name }}'
export_with_images: true
export_dir: /path/to/ovf_template/
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **instance** dictionary | always | list of the exported files, if exported from vCenter server, device file is not named with vm name **Sample:** None |
### Authors
* Diane Wang (@Tomorrow9) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#15717c747b7062333626222e333620272e3336212d2e637862746770333621232e767a78)>
ansible community.vmware.vmware_vm_host_drs_rule – Creates vm/host group in a given cluster community.vmware.vmware\_vm\_host\_drs\_rule – Creates vm/host group in a given cluster
=======================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_vm_host_drs_rule`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module can be used to create VM-Host rules in a given cluster.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **affinity\_rule** boolean | **Choices:*** no
* **yes** ←
| If set to `True`, the DRS rule will be an Affinity rule. If set to `False`, the DRS rule will be an Anti-Affinity rule. Effective only if `state` is set to `present`. |
| **cluster\_name** string / required | | Cluster to create VM-Host rule. |
| **datacenter** string | | Datacenter to search for given cluster. If not set, we use first cluster we encounter with `cluster_name`.
aliases: datacenter\_name |
| **drs\_rule\_name** string / required | | Name of rule to create or remove. |
| **enabled** boolean | **Choices:*** **no** ←
* yes
| If set to `True`, the DRS rule will be enabled. Effective only if `state` is set to `present`. |
| **host\_group\_name** string | | Name of Host group to use with rule. Effective only if `state` is set to `present`. |
| **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. |
| **mandatory** boolean | **Choices:*** **no** ←
* yes
| If set to `True`, the DRS rule will be mandatory. Effective only if `state` is set to `present`. |
| **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. |
| **state** string | **Choices:*** **present** ←
* absent
| If set to `present` and the rule does not exist then the rule will be created. If set to `absent` and the rule exists then the rule will be deleted. |
| **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. |
| **vm\_group\_name** string | | Name of VM group to use with rule. Effective only if `state` is set to `present`. |
Notes
-----
Note
* Tested on vSphere 6.5 and 6.7
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
---
- name: "Create mandatory DRS Affinity rule for VM/Host"
community.vmware.vmware_vm_host_drs_rule:
hostname: "{{ vcenter_hostname }}"
password: "{{ vcenter_password }}"
username: "{{ vcenter_username }}"
cluster_name: DC0_C0
drs_rule_name: drs_rule_host_aff_0001
host_group_name: DC0_C0_HOST_GR1
vm_group_name: DC0_C0_VM_GR1
mandatory: True
enabled: True
affinity_rule: True
```
### Authors
* Karsten Kaj Jakobsen (@karstenjakobsen)
| programming_docs |
ansible community.vmware.vmware_host_powermgmt_policy – Manages the Power Management Policy of an ESXI host system community.vmware.vmware\_host\_powermgmt\_policy – Manages the Power Management Policy of an ESXI host system
=============================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_powermgmt_policy`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to manage the Power Management Policy of ESXi host systems in given vCenter infrastructure.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster from which all host systems will be used. This is required parameter if `esxi_hostname` is not specified. |
| **esxi\_hostname** string | | Name of the host system to work with. This is required parameter if `cluster_name` is not specified. |
| **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. |
| **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 |
| **policy** string | **Choices:*** high-performance
* **balanced** ←
* low-power
* custom
| Set the Power Management Policy of the host system. |
| **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. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Set the Power Management Policy of a host system to high-performance
community.vmware.vmware_host_powermgmt_policy:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_host }}'
policy: high-performance
delegate_to: localhost
- name: Set the Power Management Policy of all host systems from cluster to high-performance
community.vmware.vmware_host_powermgmt_policy:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: '{{ cluster_name }}'
policy: high-performance
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **result** dictionary | always | metadata about host system's Power Management Policy **Sample:** {'changed': True, 'result': {'esxi01': {'changed': True, 'current\_state': 'high-performance', 'desired\_state': 'high-performance', 'msg': 'Power policy changed', 'previous\_state': 'balanced'}}} |
### Authors
* Christian Kotte (@ckotte) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#27444f554e54534e4649010413111c4c48535342010414101c010412151c0104131f1c404a5f010413111c4342)>
ansible community.vmware.vmware – HttpApi Plugin for VMware REST API community.vmware.vmware – HttpApi Plugin for VMware REST API
============================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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`.
Synopsis
--------
* This HttpApi plugin provides methods to connect to VMware vCenter over a HTTP(S)-based APIs.
### Authors
* Abhijeet Kasurde (Akasurde)
ansible community.vmware.vmware_guest_controller – Manage disk or USB controllers related to virtual machine in given vCenter infrastructure community.vmware.vmware\_guest\_controller – Manage disk or USB controllers related to virtual machine in given vCenter infrastructure
======================================================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_guest_controller`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to add, remove disk controllers or USB controllers belonging to given virtual machine.
* All parameters and VMware object names are case sensitive.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **controllers** list / elements=dictionary | | A list of disk or USB controllers to add or remove. Total 4 disk controllers with the same type are allowed per VM. Total 2 USB controllers are allowed per VM, 1 USB 2.0 and 1 USB 3.0 or 3.1. For specific guest OS, supported controller types please refer to VMware Compatibility Guide. |
| | **bus\_sharing** string added in 1.11.0 of community.vmware | **Choices:*** **noSharing** ←
* physicalSharing
* virtualSharing
| Bus sharing type for SCSI controller. |
| | **controller\_number** integer | **Choices:*** 0
* 1
* 2
* 3
| Disk controller bus number. When `state` is set to `absent`, this parameter is required. When `type` set to `usb2` or `usb3`, this parameter is not required. |
| | **state** string / required | **Choices:*** present
* absent
| Add new controller or remove specified existing controller. If `state` is set to `absent`, the specified controller will be removed from virtual machine when there is no disk or device attaching to it. If specified controller is removed or not exist, no action will be taken only warning message. If `state` is set to `present`, new controller with specified type will be added. If the number of controller with specified controller type reaches it's maximum, no action will be taken only warning message. |
| | **type** string / required | **Choices:*** buslogic
* lsilogic
* lsilogicsas
* paravirtual
* sata
* nvme
* usb2
* usb3
| Type of disk or USB controller. From vSphere 6.5 and virtual machine with hardware version 13, `nvme` controller starts to be supported. |
| **datacenter** string | **Default:**"ha-datacenter" | The datacenter name to which virtual machine belongs to. |
| **folder** string | | Destination folder, absolute or relative path to find an existing guest. This is a required parameter, only if multiple VMs are found with same name. The folder should include the datacenter. ESX's datacenter is ha-datacenter Examples: folder: /ha-datacenter/vm folder: ha-datacenter/vm folder: /datacenter1/vm folder: datacenter1/vm folder: /datacenter1/vm/folder1 folder: datacenter1/vm/folder1 folder: /folder1/datacenter1/vm folder: folder1/datacenter1/vm folder: /folder1/datacenter1/vm/folder2 |
| **gather\_disk\_controller\_facts** boolean | **Choices:*** **no** ←
* yes
| Whether to collect existing disk and USB controllers facts only. When this parameter is set to `True`, `controllers` parameter will be ignored. |
| **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. |
| **moid** string | | Managed Object ID of the instance to manage if known, this is a unique identifier only within a single vCenter instance. This is required if `name` or `uuid` is not supplied. |
| **name** string | | Name of the virtual machine. This is a required parameter, if parameter `uuid` or `moid` is not supplied. |
| **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. |
| **sleep\_time** integer | **Default:**10 | The sleep time in seconds after VM reconfigure task completes, used when not get the updated VM controller facts after VM reconfiguration. This parameter is not required. Maximum value is 600. |
| **use\_instance\_uuid** boolean | **Choices:*** **no** ←
* yes
| Whether to use the VMware instance UUID rather than the BIOS UUID. |
| **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 |
| **uuid** string | | UUID of the instance to gather facts if known, this is VMware's unique identifier. This is a required parameter, if parameter `name` or `moid` is not supplied. |
| **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 on vSphere 6.0, 6.5 and 6.7
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Add disk and USB 3.0 controllers for virtual machine located by name
community.vmware.vmware_guest_controller:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
name: test_VM
controllers:
- state: present
type: sata
- state: present
type: nvme
- state: present
type: usb3
delegate_to: localhost
register: disk_controller_facts
- name: Remove disk controllers and USB 2.0 from virtual machine located by moid
community.vmware.vmware_guest_controller:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
moid: vm-33
controllers:
- state: absent
controller_number: 1
type: sata
- state: absent
controller_number: 0
type: nvme
- state: absent
type: usb2
delegate_to: localhost
register: disk_controller_facts
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **disk\_controller\_status** dictionary | always | metadata about the virtual machine's existing disk controllers or after adding or removing operation **Sample:** {'nvme': {'0': {'controller\_busnumber': 0, 'controller\_controllerkey': 100, 'controller\_devicekey': 31000, 'controller\_disks\_devicekey': [], 'controller\_label': 'NVME controller 0', 'controller\_summary': 'NVME controller 0', 'controller\_unitnumber': 30}}, 'sata': {'0': {'controller\_busnumber': 0, 'controller\_controllerkey': 100, 'controller\_devicekey': 15000, 'controller\_disks\_devicekey': [16000, 16001], 'controller\_label': 'SATA controller 0', 'controller\_summary': 'AHCI', 'controller\_unitnumber': 24}}, 'scsi': {'0': {'controller\_bus\_sharing': 'noSharing', 'controller\_busnumber': 0, 'controller\_controllerkey': 100, 'controller\_devicekey': 1000, 'controller\_disks\_devicekey': [2000], 'controller\_label': 'SCSI controller 0', 'controller\_summary': 'LSI Logic SAS', 'controller\_unitnumber': 3}, '1': {'controller\_bus\_sharing': 'physicalSharing', 'controller\_busnumber': 1, 'controller\_controllerkey': 100, 'controller\_devicekey': 1001, 'controller\_disks\_devicekey': [], 'controller\_label': 'SCSI controller 1', 'controller\_summary': 'VMware paravirtual SCSI', 'controller\_unitnumber': 4}}, 'usb2': {'0': {'controller\_busnumber': 0, 'controller\_controllerkey': 100, 'controller\_devicekey': 7000, 'controller\_disks\_devicekey': [], 'controller\_label': 'USB Controller', 'controller\_summary': 'Auto connect Disabled', 'controller\_unitnumber': 22}}} |
### Authors
* Diane Wang (@Tomorrow9) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#e88c8189868d9fcecbdbdfd3cecbdddad3cecbdcd0d39e859f899a8dcecbdcded38b8785)>
ansible community.vmware.vmware_guest_tools_wait – Wait for VMware tools to become available community.vmware.vmware\_guest\_tools\_wait – Wait for VMware tools to become available
=======================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_guest_tools_wait`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to wait for VMware tools to become available on the given VM and return facts.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **datacenter** string added in 1.15.0 of community.vmware | | Name of the datacenter. The datacenter to search for a virtual machine. |
| **folder** string | | Destination folder, absolute or relative path to find an existing guest. This is required only, if multiple VMs with same `name` is found. The folder should include the datacenter. ESX's datacenter is `ha-datacenter`. Examples: folder: /ha-datacenter/vm folder: ha-datacenter/vm folder: /datacenter1/vm folder: datacenter1/vm folder: /datacenter1/vm/folder1 folder: datacenter1/vm/folder1 folder: /folder1/datacenter1/vm folder: folder1/datacenter1/vm folder: /folder1/datacenter1/vm/folder2 |
| **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. |
| **moid** string | | Managed Object ID of the instance to manage if known, this is a unique identifier only within a single vCenter instance. This is required if `name` or `uuid` is not supplied. |
| **name** string | | Name of the VM for which to wait until the tools become available. This is required if `uuid` or `moid` is not supplied. |
| **name\_match** string | **Choices:*** **first** ←
* last
| If multiple VMs match the name, use the first or last found. |
| **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. |
| **timeout** integer | **Default:**500 | Max duration of the waiting period (seconds). |
| **use\_instance\_uuid** boolean | **Choices:*** **no** ←
* yes
| Whether to use the VMware instance UUID rather than the BIOS UUID. |
| **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 |
| **uuid** string | | UUID of the VM for which to wait until the tools become available, if known. This is VMware's unique identifier. This is required, if `name` or `moid` is not supplied. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Wait for VMware tools to become available by UUID
vmware_guest_facts:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter }}"
folder: "/{{datacenter}}/vm"
name: "{{ vm_name }}"
delegate_to: localhost
register: vm_facts
- name: Get UUID from previous task and pass it to this task
community.vmware.vmware_guest_tools_wait:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
uuid: "{{ vm_facts.instance.hw_product_uuid }}"
delegate_to: localhost
register: facts
- name: Wait for VMware tools to become available by MoID
community.vmware.vmware_guest_tools_wait:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
moid: vm-42
delegate_to: localhost
register: facts
- name: Wait for VMware tools to become available by name
community.vmware.vmware_guest_tools_wait:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
name: test-vm
folder: "/{{datacenter}}/vm"
datacenter: "{{ datacenter }}"
delegate_to: localhost
register: facts
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **instance** dictionary | always | metadata about the virtual machine **Sample:** None |
### Authors
* Philippe Dellaert (@pdellaert) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#304058595c59404055161303070b161305020b161304080b54555c5c51554244161304060b5f4257)>
| programming_docs |
ansible community.vmware.vmware_guest_tools_info – Gather info about VMware tools installed in VM community.vmware.vmware\_guest\_tools\_info – Gather info about VMware tools installed in VM
============================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_guest_tools_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Gather information about the VMware tools installed in virtual machine.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **datacenter** string | | The datacenter name to which virtual machine belongs to. |
| **folder** string | | Destination folder, absolute or relative path to find an existing guest. This is required if name is supplied. The folder should include the datacenter. ESXi server's datacenter is ha-datacenter. Examples: folder: /ha-datacenter/vm folder: ha-datacenter/vm folder: /datacenter1/vm folder: datacenter1/vm folder: /datacenter1/vm/folder1 folder: datacenter1/vm/folder1 folder: /folder1/datacenter1/vm folder: folder1/datacenter1/vm folder: /folder1/datacenter1/vm/folder2 |
| **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. |
| **moid** string | | Managed Object ID of the instance to manage if known, this is a unique identifier only within a single vCenter instance. This is required if `name` or `uuid` is not supplied. |
| **name** string | | Name of the VM to get VMware tools info. This is required if `uuid` or `moid` is not supplied. |
| **name\_match** string | **Choices:*** **first** ←
* last
| If multiple VMs matching the name, use the first or last found. |
| **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. |
| **use\_instance\_uuid** boolean | **Choices:*** **no** ←
* yes
| Whether to use the VMware instance UUID rather than the BIOS UUID. |
| **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 |
| **uuid** string | | UUID of the instance to manage if known, this is VMware's unique identifier. This is required if `name` or `moid` is not supplied. |
| **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 on vSphere 6.0, 6.5, 6.7
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather VMware tools info installed in VM specified by uuid
community.vmware.vmware_guest_tools_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
uuid: 421e4592-c069-924d-ce20-7e7533fab926
delegate_to: localhost
register: vmtools_info
- name: Gather VMware tools info installed in VM specified by name
community.vmware.vmware_guest_tools_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
name: "{{ vm_name }}"
delegate_to: localhost
register: vmtools_info
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **vmtools\_info** dictionary | always | metadata about the VMware tools installed in virtual machine **Sample:** {'vm\_guest\_fullname': 'Microsoft Windows 10 (64-bit)', 'vm\_guest\_hostname': 'test', 'vm\_guest\_id': 'windows9\_64Guest', 'vm\_hw\_version': 'vmx-14', 'vm\_ipaddress': '10.10.10.10', 'vm\_moid': None, 'vm\_name': 'test\_vm', 'vm\_tools\_install\_status': 'toolsOk', 'vm\_tools\_install\_type': 'guestToolsTypeMSI', 'vm\_tools\_last\_install\_count': 0, 'vm\_tools\_running\_status': 'guestToolsRunning', 'vm\_tools\_upgrade\_policy': 'manual', 'vm\_tools\_version': 10341, 'vm\_tools\_version\_status': 'guestToolsCurrent', 'vm\_use\_instance\_uuid': False, 'vm\_uuid': None} |
### Authors
* Diane Wang (@Tomorrow9) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#84e0ede5eae1f3a2a7b7b3bfa2a7b1b6bfa2a7b0bcbff2e9f3e5f6e1a2a7b0b2bfe7ebe9)>
ansible community.vmware.vmware_content_deploy_template – Deploy Virtual Machine from template stored in content library. community.vmware.vmware\_content\_deploy\_template – Deploy Virtual Machine from template stored in content library.
====================================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_content_deploy_template`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Module to deploy virtual machine from template in content library.
* Content Library feature is introduced in vSphere 6.0 version.
* vmtx templates feature is introduced in vSphere 67U1 and APIs for clone template from content library in 67U2.
* This module does not work with vSphere version older than 67U2.
* All variables and VMware object names are case sensitive.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
* vSphere Automation SDK
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster** string | | Name of the cluster in datacenter in which to place deployed VM. Required if *resource\_pool* is not specified. |
| **datacenter** string / required | | Name of the datacenter, where VM to be deployed. |
| **datastore** string | | Name of the datastore to store deployed VM and disk. Required if *datastore\_cluster* is not provided. |
| **datastore\_cluster** string added in 1.7.0 of community.vmware | | Name of the datastore cluster to store deployed VM and disk. Please make sure Storage DRS is active for recommended datastore from the given datastore cluster. If Storage DRS is not enabled, datastore with largest free storage space is selected. Required if *datastore* is not provided. |
| **folder** string | **Default:**"vm" | Name of the folder in datacenter in which to place deployed VM. |
| **host** string | | Name of the ESX Host in datacenter in which to place deployed VM. The host has to be a member of the cluster that contains the resource pool. Required with *resource\_pool* to find resource pool details. This will be used as additional information when there are resource pools with same name. |
| **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. |
| **library** string | | The name of the content library from where the template resides.
aliases: content\_library, content\_library\_src |
| **log\_level** string added in 1.9.0 of community.vmware | **Choices:*** debug
* info
* **normal** ←
| The level of logging desired in this module. |
| **name** string / required | | The name of the VM to be deployed.
aliases: vm\_name |
| **password** 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.
aliases: pass, pwd |
| **port** integer | **Default:**443 | The port number of the vSphere vCenter. If the value is not specified in the task, the value of environment variable `VMWARE_PORT` will be used instead. |
| **protocol** string | **Choices:*** http
* **https** ←
| The connection to protocol. |
| **proxy\_host** string added in 1.12.0 of community.vmware | | 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 added in 1.12.0 of community.vmware | | 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. |
| **resource\_pool** string | | Name of the resource pool in datacenter in which to place deployed VM. Required if *cluster* is not specified. For default or non-unique resource pool names, specify *host* and *cluster*.
`Resources` is the default name of resource pool. |
| **state** string | **Choices:*** **present** ←
* poweredon
| The state of Virtual Machine deployed from template in content library. If set to `present` and VM does not exists, then VM is created. If set to `present` and VM exists, no action is taken. If set to `poweredon` and VM does not exists, then VM is created with powered on state. If set to `poweredon` and VM exists, no action is taken. |
| **template** string / required | | The name of template from which VM to be deployed.
aliases: template\_src |
| **username** 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.
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. |
Notes
-----
Note
* Tested on vSphere 6.7 U3
Examples
--------
```
- name: Deploy Virtual Machine from template in content library
community.vmware.vmware_content_deploy_template:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
template: rhel_test_template
datastore: Shared_NFS_Volume
folder: vm
datacenter: Sample_DC_1
name: Sample_VM
resource_pool: test_rp
state: present
delegate_to: localhost
- name: Deploy Virtual Machine from template in content library with PowerON State
community.vmware.vmware_content_deploy_template:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
template: rhel_test_template
content_library: test_content_library
datastore: Shared_NFS_Volume
folder: vm
datacenter: Sample_DC_1
name: Sample_VM
resource_pool: test_rp
state: poweredon
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **vm\_deploy\_info** dictionary | on success | Virtual machine deployment message and vm\_id **Sample:** {'msg': "Deployed Virtual Machine 'Sample\_VM'.", 'vm\_id': 'vm-1009'} |
### Authors
* Pavan Bidkar (@pgbidkar)
ansible community.vmware.vmware_guest_customization_info – Gather info about VM customization specifications community.vmware.vmware\_guest\_customization\_info – Gather info about VM customization specifications
=======================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_guest_customization_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to gather information about customization specifications.
* All parameters and VMware object names are case sensitive.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **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. |
| **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. |
| **spec\_name** string | | Name of customization specification to find. |
| **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 on vSphere 6.0 and 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather info about all customization specification
community.vmware.vmware_guest_customization_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
delegate_to: localhost
register: all_custom_spec_info
- name: Gather info about customization specification with the given name
community.vmware.vmware_guest_customization_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
spec_name: custom_linux_spec
delegate_to: localhost
register: custom_spec_info
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **custom\_spec\_info** dictionary | always | metadata about the customization specification **Sample:** {'assignip-eee0d684-44b7-457c-8c55-2585590b0d99': {'change\_version': '1523438001', 'description': 'sample description', 'dns\_server\_list': [], 'dns\_suffix\_list': [], 'domain': 'None', 'hostname': 'sample1', 'hw\_clock\_utc': None, 'last\_updated\_time': '2018-04-11T09:13:21+00:00', 'name': 'sample', 'nic\_setting\_map': [{'dns\_domain': None, 'gateway': [], 'ip\_address': '192.168.10.10', 'net\_bios': None, 'nic\_dns\_server\_list': [], 'primary\_wins': None, 'secondry\_wins': None, 'subnet\_mask': '255.255.255.0'}], 'time\_zone': None, 'type': 'Linux'}} |
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_dvs_portgroup_find – Find portgroup(s) in a VMware environment community.vmware.vmware\_dvs\_portgroup\_find – Find portgroup(s) in a VMware environment
=========================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_dvs_portgroup_find`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Find portgroup(s) based on different criteria such as distributed vSwitch, VLAN id or a string in the name.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **dvswitch** string | | Name of a distributed vSwitch to look for. |
| **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. |
| **name** string | | string to check inside the name of the portgroup. Basic containment check using python `in` operation. |
| **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. |
| **show\_uplink** boolean | **Choices:*** **no** ←
* yes
| Show or hide uplink portgroups. Only relevant when `vlanid` is supplied. |
| **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. |
| **vlanid** integer | | VLAN id can be any number between 1 and 4094. This search criteria will looks into VLAN ranges to find possible matches. |
Notes
-----
Note
* Tested on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Get all portgroups in dvswitch vDS
community.vmware.vmware_dvs_portgroup_find:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
dvswitch: 'vDS'
delegate_to: localhost
- name: Confirm if vlan 15 is present
community.vmware.vmware_dvs_portgroup_find:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
vlanid: '15'
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **dvs\_portgroups** list / elements=string | on success | basic details of portgroups found **Sample:** [{'dvswitch': 'vDS', 'name': 'N-51', 'pvlan': True, 'trunk': True, 'vlan\_id': '0'}] |
### Authors
* David Martinez (@dx0xm)
| programming_docs |
ansible community.vmware.vmware_guest_custom_attributes – Manage custom attributes from VMware for the given virtual machine community.vmware.vmware\_guest\_custom\_attributes – Manage custom attributes from VMware for the given virtual machine
=======================================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_guest_custom_attributes`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to add, remove and update custom attributes for the given virtual machine.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **attributes** list / elements=dictionary | **Default:**[] | A list of name and value of custom attributes that needs to be manage. Value of custom attribute is not required and will be ignored, if `state` is set to `absent`. |
| | **name** string / required | | Name of the attribute. |
| | **value** string | **Default:**"" | Value of the attribute. |
| **datacenter** string | | Datacenter name where the virtual machine is located in. |
| **folder** string | | Absolute path to find an existing guest. This is required parameter, if `name` is supplied and multiple virtual machines with same name are found. |
| **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. |
| **moid** string | | Managed Object ID of the instance to manage if known, this is a unique identifier only within a single vCenter instance. This is required if `name` or `uuid` is not supplied. |
| **name** string | | Name of the virtual machine to work with. This is required parameter, if `uuid` or `moid` is not supplied. |
| **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. |
| **state** string | **Choices:*** **present** ←
* absent
| The action to take. If set to `present`, then custom attribute is added or updated. If set to `absent`, then custom attribute is removed. |
| **use\_instance\_uuid** boolean | **Choices:*** **no** ←
* yes
| Whether to use the VMware instance UUID rather than the BIOS UUID. |
| **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 |
| **uuid** string | | UUID of the virtual machine to manage if known. This is VMware's unique identifier. This is required parameter, if `name` or `moid` is not supplied. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Add virtual machine custom attributes
community.vmware.vmware_guest_custom_attributes:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
uuid: 421e4592-c069-924d-ce20-7e7533fab926
state: present
attributes:
- name: MyAttribute
value: MyValue
delegate_to: localhost
register: attributes
- name: Add multiple virtual machine custom attributes
community.vmware.vmware_guest_custom_attributes:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
uuid: 421e4592-c069-924d-ce20-7e7533fab926
state: present
attributes:
- name: MyAttribute
value: MyValue
- name: MyAttribute2
value: MyValue2
delegate_to: localhost
register: attributes
- name: Remove virtual machine Attribute
community.vmware.vmware_guest_custom_attributes:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
uuid: 421e4592-c069-924d-ce20-7e7533fab926
state: absent
attributes:
- name: MyAttribute
delegate_to: localhost
register: attributes
- name: Remove virtual machine Attribute using Virtual Machine MoID
community.vmware.vmware_guest_custom_attributes:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
moid: vm-42
state: absent
attributes:
- name: MyAttribute
delegate_to: localhost
register: attributes
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **custom\_attributes** dictionary | always | metadata about the virtual machine attributes **Sample:** {'mycustom': 'my\_custom\_value', 'mycustom\_2': 'my\_custom\_value\_2', 'sample\_1': 'sample\_1\_value', 'sample\_2': 'sample\_2\_value', 'sample\_3': 'sample\_3\_value'} |
### Authors
* Jimmy Conner (@cigamit)
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_local_role_info – Gather info about local roles on an ESXi host community.vmware.vmware\_local\_role\_info – Gather info about local roles on an ESXi host
==========================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_local_role_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to gather information about local role info on an ESXi host
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **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. |
| **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. |
| **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 on ESXi 6.5
* Be sure that the ESXi user used for login, has the appropriate rights to view roles
* The module returns a list of dict in version 2.8 and above.
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather info about local role from an ESXi
community.vmware.vmware_local_role_info:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
register: fact_details
delegate_to: localhost
- name: Get Admin privileges
set_fact:
admin_priv: "{{ fact_details.local_role_info | selectattr('role_name', 'equalto', 'Admin') | map(attribute='privileges') | first }}"
- debug:
msg: "{{ admin_priv }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **local\_role\_info** list / elements=string | always | A list of dict about role information present on ESXi host **Sample:** [{'privileges': ['Alarm.Acknowledge', 'Alarm.Create', 'Alarm.Delete', 'Alarm.DisableActions'], 'role\_id': -12, 'role\_info\_label': 'Ansible User', 'role\_info\_summary': 'Ansible Automation user', 'role\_name': 'AnsiUser1', 'role\_system': True}, {'privileges': [], 'role\_id': -5, 'role\_info\_label': 'No access', 'role\_info\_summary': 'Used for restricting granted access', 'role\_name': 'NoAccess', 'role\_system': True}, {'privileges': ['System.Anonymous', 'System.View'], 'role\_id': -3, 'role\_info\_label': 'View', 'role\_info\_summary': 'Visibility access (cannot be granted)', 'role\_name': 'View', 'role\_system': True}] |
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vcenter_extension_facts – Gather facts vCenter extensions community.vmware.vcenter\_extension\_facts – Gather facts vCenter extensions
============================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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.vcenter_extension_facts`.
* [DEPRECATED](#deprecated)
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
* [Status](#status)
DEPRECATED
----------
Removed in
major release after 2021-12-01
Why
Deprecated in favour of [community.vmware.vcenter\_extension\_info](vcenter_extension_info_module#ansible-collections-community-vmware-vcenter-extension-info-module) module.
Alternative
Use [community.vmware.vcenter\_extension\_info](vcenter_extension_info_module#ansible-collections-community-vmware-vcenter-extension-info-module) instead.
Synopsis
--------
* This module can be used to gather facts about vCenter extension.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **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. |
| **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. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather facts about vCenter Extensions
community.vmware.vcenter_extension_facts:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
register: ext_facts
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **extension\_facts** list / elements=string | success | List of extensions **Sample:** [{'extension\_company': 'VMware, Inc.', 'extension\_key': 'com.vmware.vim.ls', 'extension\_label': 'License Services', 'extension\_last\_heartbeat\_time': '2018-09-03T09:36:18.003768+00:00', 'extension\_subject\_name': '', 'extension\_summary': 'Provides various license services', 'extension\_type': '', 'extension\_version': '5.0'}, {'extension\_company': 'VMware Inc.', 'extension\_key': 'com.vmware.vim.sms', 'extension\_label': 'VMware vCenter Storage Monitoring Service', 'extension\_last\_heartbeat\_time': '2018-09-03T09:36:18.005730+00:00', 'extension\_subject\_name': '', 'extension\_summary': 'Storage Monitoring and Reporting', 'extension\_type': '', 'extension\_version': '5.5'}] |
Status
------
* This module will be removed in a major release after 2021-12-01. *[deprecated]*
* For more information see [DEPRECATED](#deprecated).
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_deploy_ovf – Deploys a VMware virtual machine from an OVF or OVA file community.vmware.vmware\_deploy\_ovf – Deploys a VMware virtual machine from an OVF or OVA file
===============================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_deploy_ovf`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to deploy a VMware VM from an OVF or OVA file
Requirements
------------
The below requirements are needed on the host that executes this module.
* pyvmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **allow\_duplicates** boolean | **Choices:*** no
* yes
**Default:**"True" | Whether or not to allow duplicate VM names. ESXi allows duplicates, vCenter may not. |
| **cluster** string | | Cluster to deploy to. This is a required parameter, if `esxi_hostname` is not set and `hostname` is set to the vCenter server.
`esxi_hostname` and `cluster` are mutually exclusive parameters. This parameter is case sensitive. |
| **datacenter** string | **Default:**"ha-datacenter" | Datacenter to deploy to. |
| **datastore** string | **Default:**"datastore1" | Datastore to deploy to. |
| **deployment\_option** string | | The key of the chosen deployment option. |
| **disk\_provisioning** string | **Choices:*** flat
* eagerZeroedThick
* monolithicSparse
* twoGbMaxExtentSparse
* twoGbMaxExtentFlat
* **thin** ←
* sparse
* thick
* seSparse
* monolithicFlat
| Disk provisioning type. |
| **esxi\_hostname** string added in 1.9.0 of community.vmware | | The ESXi hostname where the virtual machine will run. This is a required parameter, if `cluster` is not set and `hostname` is set to the vCenter server.
`esxi_hostname` and `cluster` are mutually exclusive parameters. This parameter is case sensitive. |
| **fail\_on\_spec\_warnings** boolean | **Choices:*** **no** ←
* yes
| Cause the module to treat OVF Import Spec warnings as errors. |
| **folder** string | | Absolute path of folder to place the virtual machine. If not specified, defaults to the value of `datacenter.vmFolder`. Examples: folder: /ha-datacenter/vm folder: ha-datacenter/vm folder: /datacenter1/vm folder: datacenter1/vm folder: /datacenter1/vm/folder1 folder: datacenter1/vm/folder1 folder: /folder1/datacenter1/vm folder: folder1/datacenter1/vm folder: /folder1/datacenter1/vm/folder2 |
| **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. |
| **inject\_ovf\_env** boolean | **Choices:*** **no** ←
* yes
| Force the given properties to be inserted into an OVF Environment and injected through VMware Tools. |
| **name** string | | Name of the VM to work with. Virtual machine names in vCenter are not necessarily unique, which may be problematic. |
| **networks** dictionary | **Default:**{"VM Network": "VM Network"} |
`key: value` mapping of OVF network name, to the vCenter network name. |
| **ovf** path | | Path to OVF or OVA file to deploy.
aliases: ova |
| **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. |
| **power\_on** boolean | **Choices:*** no
* **yes** ←
| Whether or not to power on the virtual machine after creation. |
| **properties** dictionary | | The assignment of values to the properties found in the OVF as key value pairs. |
| **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. |
| **resource\_pool** string | **Default:**"Resources" | Resource Pool to deploy to. |
| **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. |
| **wait** boolean | **Choices:*** no
* **yes** ←
| Wait for the host to power on. |
| **wait\_for\_ip\_address** boolean | **Choices:*** **no** ←
* yes
| Wait until vCenter detects an IP address for the VM. This requires vmware-tools (vmtoolsd) to properly work after creation. |
Notes
-----
Note
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- community.vmware.vmware_deploy_ovf:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
ovf: /path/to/ubuntu-16.04-amd64.ovf
wait_for_ip_address: true
delegate_to: localhost
# Deploys a new VM named 'NewVM' in specific datacenter/cluster, with network mapping taken from variable and using ova template from an absolute path
- community.vmware.vmware_deploy_ovf:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter: Datacenter1
cluster: Cluster1
datastore: vsandatastore
name: NewVM
networks: "{u'VM Network':u'{{ ProvisioningNetworkLabel }}'}"
power_on: no
ovf: /absolute/path/to/template/mytemplate.ova
delegate_to: localhost
- community.vmware.vmware_deploy_ovf:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter: Datacenter1
esxi_hostname: test-server
datastore: test-datastore
ovf: /path/to/ubuntu-16.04-amd64.ovf
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **instance** dictionary | always | metadata about the new virtual machine **Sample:** None |
### Authors
* Matt Martz (@sivel)
| programming_docs |
ansible community.vmware.vmware_drs_rule_info – Gathers info about DRS rule on the given cluster community.vmware.vmware\_drs\_rule\_info – Gathers info about DRS rule on the given cluster
===========================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_drs_rule_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to gather information about DRS VM-VM and VM-HOST rules from the given cluster.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster. DRS information for the given cluster will be returned. This is required parameter if `datacenter` parameter is not provided. |
| **datacenter** string | | Name of the datacenter. DRS information for all the clusters from the given datacenter will be returned. This is required parameter if `cluster_name` parameter is not provided. |
| **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. |
| **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. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather DRS info about given Cluster
community.vmware.vmware_drs_rule_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: '{{ cluster_name }}'
delegate_to: localhost
register: cluster_drs_info
- name: Gather DRS info about all Clusters in given datacenter
community.vmware.vmware_drs_rule_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter: '{{ datacenter_name }}'
delegate_to: localhost
register: datacenter_drs_info
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **drs\_rule\_info** dictionary | always | metadata about DRS rule from given cluster / datacenter **Sample:** {'DC0\_C0': [{'rule\_affinity': False, 'rule\_enabled': True, 'rule\_key': 1, 'rule\_mandatory': True, 'rule\_name': 'drs\_rule\_0001', 'rule\_type': 'vm\_vm\_rule', 'rule\_uuid': '52be5061-665a-68dc-3d25-85cd2d37e114', 'rule\_vms': ['VM\_65', 'VM\_146']}], 'DC1\_C1': [{'rule\_affine\_host\_group\_name': 'host\_group\_1', 'rule\_affine\_hosts': ['10.76.33.204'], 'rule\_anti\_affine\_host\_group\_name': None, 'rule\_anti\_affine\_hosts': [], 'rule\_enabled': True, 'rule\_key': 1, 'rule\_mandatory': False, 'rule\_name': 'vm\_host\_rule\_0001', 'rule\_type': 'vm\_host\_rule', 'rule\_uuid': '52687108-4d3a-76f2-d29c-b708c40dbe40', 'rule\_vm\_group\_name': 'test\_vm\_group\_1', 'rule\_vms': ['VM\_8916', 'VM\_4010']}]} |
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vca_fw – add remove firewall rules in a gateway in a vca community.vmware.vca\_fw – add remove firewall rules in a gateway in a vca
==========================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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.vca_fw`.
* [DEPRECATED](#deprecated)
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Examples](#examples)
* [Status](#status)
DEPRECATED
----------
Removed in
major release after 2022-06-01
Why
Module depends upon deprecated version of Pyvcloud library.
Alternative
Use <https://github.com/vmware/ansible-module-vcloud-director> instead.
Synopsis
--------
* Adds or removes firewall rules from a gateway in a vca environment
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_version** string | **Default:**"5.7" | The API version to be used with the vca. |
| **fw\_rules** string / required | **Default:**"no" | A list of firewall rules to be added to the gateway, Please see examples on valid entries |
| **gateway\_name** string | **Default:**"gateway" | The name of the gateway of the vdc where the rule should be added. |
| **host** string | | The authentication host to be used when service type is vcd. |
| **instance\_id** string | | The instance ID in a vchs environment to be used for creating the vapp. |
| **org** string | | The org to login to for creating vapp. This option is required when the `service_type` is *vdc*. |
| **password** string | | The vca password, if not set the environment variable `VCA_PASS` is checked for the password.
aliases: pass, passwd |
| **service\_type** string | **Choices:*** **vca** ←
* vcd
* vchs
| The type of service we are authenticating against. |
| **state** string | **Choices:*** absent
* **present** ←
| Whether the object should be added or removed. |
| **username** string | | The vca username or email address, if not set the environment variable `VCA_USER` is checked for the username.
aliases: user |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If the certificates of the authentication is to be verified.
aliases: verify\_certs |
| **vdc\_name** string | | The name of the vdc where the gateway is located. |
Examples
--------
```
#Add a set of firewall rules
- hosts: localhost
connection: local
tasks:
- community.vmware.vca_fw:
instance_id: 'b15ff1e5-1024-4f55-889f-ea0209726282'
vdc_name: 'benz_ansible'
state: 'absent'
fw_rules:
- description: "ben testing"
source_ip: "Any"
dest_ip: 192.0.2.23
- description: "ben testing 2"
source_ip: 192.0.2.50
source_port: "Any"
dest_port: "22"
dest_ip: 192.0.2.101
is_enable: "true"
enable_logging: "false"
protocol: "Tcp"
policy: "allow"
```
Status
------
* This module will be removed in a major release after 2022-06-01. *[deprecated]*
* For more information see [DEPRECATED](#deprecated).
### Authors
* Peter Sprygada (@privateip)
ansible community.vmware.vmware_host_disk_info – Gathers information about disks attached to given ESXi host/s. community.vmware.vmware\_host\_disk\_info – Gathers information about disks attached to given ESXi host/s.
==========================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_disk_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module returns information about disks attached to given ESXi host/s
* If *cluster\_name* is provided, then disk information about all hosts from the given cluster will be returned.
* If *esxi\_hostname* is provided, then disk information about the given host system will be returned.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster from which the ESXi host belong to. If `esxi_hostname` is not given, this parameter is required. |
| **esxi\_hostname** string | | ESXi hostname to gather information from. If `cluster_name` is not given, this parameter is required. |
| **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. |
| **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. |
| **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 on vSphere 6.7 and 7.0
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather info about vmhbas of all ESXi Host in the given Cluster
community.vmware.vmware_host_disk_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: '{{ cluster_name }}'
delegate_to: localhost
register: cluster_host_vmhbas
- name: Gather info about vmhbas of an ESXi Host
community.vmware.vmware_host_disk_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
delegate_to: localhost
register: host_vmhbas
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **hosts\_disk\_info** list / elements=string | always | list of information for all disks attached to each ESXi host **Sample:** "192.168.0.182": [ { "canonical\_name": "naa.6000c296ed6217bd61df35622eb21a3a", "capacity\_mb": 4096, "device\_path": "/vmfs/devices/disks/naa.6000c296ed6217bd61df35622eb21a3a", "device\_type": "disk", "device\_ctd\_list": [ "vmhba0:C0:T1:L0" ], "disk\_uid": "key-vim.host.ScsiDisk-02000000006000c296ed6217bd61df35622eb21a3a566972747561", "display\_name": "Local VMware Disk (naa.6000c296ed6217bd61df35622eb21a3a)" }, { "canonical\_name": "naa.6000c2968ad7142d93faae527fe8822b", "capacity\_mb": 204800, "device\_path": "/vmfs/devices/disks/naa.6000c2968ad7142d93faae527fe8822b", "device\_type": "disk", "device\_ctd\_list": [ "vmhba0:C0:T3:L0" ], "disk\_uid": "key-vim.host.ScsiDisk-02000000006000c2968ad7142d93faae527fe8822b566972747561", "display\_name": "Local VMware Disk (naa.6000c2968ad7142d93faae527fe8822b)" },] |
### Authors
* Matt Proud (@laidbackware)
ansible community.vmware.vmware_host_facts – Gathers facts about remote ESXi hostsystem community.vmware.vmware\_host\_facts – Gathers facts about remote ESXi hostsystem
=================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_facts`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module can be used to gathers facts like CPU, memory, datastore, network and system etc. about ESXi host system.
* Please specify hostname or IP address of ESXi host system as `hostname`.
* If hostname or IP address of vCenter is provided as `hostname` and `esxi_hostname` is not specified, then the module will throw an error.
* VSAN facts added in 2.7 version.
* SYSTEM fact uuid added in 2.10 version.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **esxi\_hostname** string | | ESXi hostname. Host facts about the specified ESXi server will be returned. By specifying this option, you can select which ESXi hostsystem is returned if connecting to a vCenter. |
| **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. |
| **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. |
| **properties** list / elements=string | | Specify the properties to retrieve. If not specified, all properties are retrieved (deeply). Results are returned in a structure identical to the vsphere API. Example: properties: [ "hardware.memorySize", "hardware.cpuInfo.numCpuCores", "config.product.apiVersion", "overallStatus" ] Only valid when `schema` is `vsphere`. |
| **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. |
| **schema** string | **Choices:*** **summary** ←
* vsphere
| Specify the output schema desired. The 'summary' output schema is the legacy output from the module The 'vsphere' output schema is the vSphere API class definition which requires pyvmomi>6.7.1 |
| **show\_tag** boolean | **Choices:*** **no** ←
* yes
| Tags related to Host are shown if set to `True`. |
| **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
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather vmware host facts
community.vmware.vmware_host_facts:
hostname: "{{ esxi_server }}"
username: "{{ esxi_username }}"
password: "{{ esxi_password }}"
register: host_facts
delegate_to: localhost
- name: Gather vmware host facts from vCenter
community.vmware.vmware_host_facts:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
esxi_hostname: "{{ esxi_hostname }}"
register: host_facts
delegate_to: localhost
- name: Gather vmware host facts from vCenter with tag information
community.vmware.vmware_host_facts:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
esxi_hostname: "{{ esxi_hostname }}"
show_tag: True
register: host_facts_tag
delegate_to: localhost
- name: Get VSAN Cluster UUID from host facts
community.vmware.vmware_host_facts:
hostname: "{{ esxi_server }}"
username: "{{ esxi_username }}"
password: "{{ esxi_password }}"
register: host_facts
- set_fact:
cluster_uuid: "{{ host_facts['ansible_facts']['vsan_cluster_uuid'] }}"
- name: Gather some info from a host using the vSphere API output schema
community.vmware.vmware_host_facts:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
esxi_hostname: "{{ esxi_hostname }}"
schema: vsphere
properties:
- hardware.memorySize
- hardware.cpuInfo.numCpuCores
- config.product.apiVersion
- overallStatus
register: host_facts
- name: Gather information about powerstate and connection state
community.vmware.vmware_host_facts:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
esxi_hostname: "{{ esxi_hostname }}"
schema: vsphere
properties:
- runtime.connectionState
- runtime.powerState
- name: How to retrieve Product, Version, Build, Update info for ESXi from vCenter
block:
- name: Gather product version info for ESXi from vCenter
community.vmware.vmware_host_facts:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
esxi_hostname: "{{ esxi_hostname }}"
schema: vsphere
properties:
- config.product
- config.option
register: gather_host_facts_result
- name: Extract update level info from option properties
set_fact:
update_level_info: "{{ item.value }}"
loop: "{{ gather_host_facts_result.ansible_facts.config.option }}"
when:
- item.key == 'Misc.HostAgentUpdateLevel'
- name: The output of Product, Version, Build, Update info for ESXi
debug:
msg:
- "Product : {{ gather_host_facts_result.ansible_facts.config.product.name }}"
- "Version : {{ gather_host_facts_result.ansible_facts.config.product.version }}"
- "Build : {{ gather_host_facts_result.ansible_facts.config.product.build }}"
- "Update : {{ update_level_info }}"
```
### Authors
* Wei Gao (@woshihaoren)
| programming_docs |
ansible community.vmware.vmware_target_canonical_info – Return canonical (NAA) from an ESXi host system community.vmware.vmware\_target\_canonical\_info – Return canonical (NAA) from an ESXi host system
==================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_target_canonical_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to gather information about canonical (NAA) from an ESXi host based on SCSI target ID.
Requirements
------------
The below requirements are needed on the host that executes this module.
* Tested on vSphere 5.5 and 6.5
* PyVmomi installed
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster. Info about all SCSI devices for all host system in the given cluster is returned. This parameter is required, if `esxi_hostname` is not provided. |
| **esxi\_hostname** string | | Name of the ESXi host system. Info about all SCSI devices for the given ESXi host system is returned. This parameter is required, if `cluster_name` is not provided. |
| **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. |
| **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. |
| **target\_id** integer | | The target id based on order of scsi device. version 2.6 onwards, this parameter is optional. |
| **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
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Get Canonical name of particular target on particular ESXi host system
community.vmware.vmware_target_canonical_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
target_id: 7
esxi_hostname: esxi_hostname
delegate_to: localhost
- name: Get Canonical name of all target on particular ESXi host system
community.vmware.vmware_target_canonical_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
delegate_to: localhost
- name: Get Canonical name of all ESXi hostname on particular Cluster
community.vmware.vmware_target_canonical_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: '{{ cluster_name }}'
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **canonical** string | if host system and target id is given | metadata about SCSI Target device **Sample:** mpx.vmhba0:C0:T0:L0 |
| **scsi\_tgt\_info** dictionary | if host system or cluster is given | metadata about all SCSI Target devices **Sample:** {'DC0\_C0\_H0': {'scsilun\_canonical': {'key-vim.host.ScsiDisk-0000000000766d686261303a303a30': 'mpx.vmhba0:C0:T0:L0', 'key-vim.host.ScsiLun-0005000000766d686261313a303a30': 'mpx.vmhba1:C0:T0:L0'}, 'target\_lun\_uuid': {'0': 'key-vim.host.ScsiDisk-0000000000766d686261303a303a30'}}, 'DC0\_C0\_H1': {'scsilun\_canonical': {'key-vim.host.ScsiDisk-0000000000766d686261303a303a30': 'mpx.vmhba0:C0:T0:L0', 'key-vim.host.ScsiLun-0005000000766d686261313a303a30': 'mpx.vmhba1:C0:T0:L0'}, 'target\_lun\_uuid': {'0': 'key-vim.host.ScsiDisk-0000000000766d686261303a303a30'}}} |
### Authors
* Joseph Callen (@jcpowermac)
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_local_role_facts – Gather facts about local roles on an ESXi host community.vmware.vmware\_local\_role\_facts – Gather facts about local roles on an ESXi host
============================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_local_role_facts`.
* [DEPRECATED](#deprecated)
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
* [Status](#status)
DEPRECATED
----------
Removed in
major release after 2021-12-01
Why
Deprecated in favour of [community.vmware.vmware\_local\_role\_info](vmware_local_role_info_module#ansible-collections-community-vmware-vmware-local-role-info-module) module.
Alternative
Use [community.vmware.vmware\_local\_role\_info](vmware_local_role_info_module#ansible-collections-community-vmware-vmware-local-role-info-module) instead.
Synopsis
--------
* This module can be used to gather facts about local role facts on an ESXi host
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **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. |
| **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. |
| **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 on ESXi 6.5
* Be sure that the ESXi user used for login, has the appropriate rights to view roles
* The module returns a list of dict in version 2.8 and above.
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather facts about local role from an ESXi
community.vmware.vmware_local_role_facts:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
register: fact_details
delegate_to: localhost
- name: Get Admin privileges
set_fact:
admin_priv: "{{ fact_details.local_role_facts['Admin']['privileges'] }}"
- debug:
msg: "{{ admin_priv }}"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **local\_role\_facts** dictionary | always | Facts about role present on ESXi host **Sample:** [{'privileges': ['Alarm.Acknowledge', 'Alarm.Create', 'Alarm.Delete', 'Alarm.DisableActions'], 'role\_id': -12, 'role\_info\_label': 'Ansible User', 'role\_info\_summary': 'Ansible Automation user', 'role\_name': 'AnsiUser1', 'role\_system': True}, {'privileges': [], 'role\_id': -5, 'role\_info\_label': 'No access', 'role\_info\_summary': 'Used for restricting granted access', 'role\_name': 'NoAccess', 'role\_system': True}, {'privileges': ['System.Anonymous', 'System.View'], 'role\_id': -3, 'role\_info\_label': 'View', 'role\_info\_summary': 'Visibility access (cannot be granted)', 'role\_name': 'View', 'role\_system': True}] |
Status
------
* This module will be removed in a major release after 2021-12-01. *[deprecated]*
* For more information see [DEPRECATED](#deprecated).
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_host_tcpip_stacks – Manage the TCP/IP Stacks configuration of ESXi host community.vmware.vmware\_host\_tcpip\_stacks – Manage the TCP/IP Stacks configuration of ESXi host
==================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_tcpip_stacks`.
New in version 1.10.0: of community.vmware
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to modify the TCP/IP stacks configuration.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **default** dictionary | | The TCP/IP stacks configuration of the *default*. |
| | **alternate\_dns** string | | The IP address of the alternate dns server. |
| | **congestion\_algorithm** string | **Choices:*** **newreno** ←
* cubic
| The TCP congest control algorithm. |
| | **domain** string / required | | The domain name portion of the DNS name. |
| | **gateway** string | | The ipv4 gateway address. |
| | **hostname** string / required | | The host name of the ESXi host. |
| | **ipv6\_gateway** string added in 1.11.0 of community.vmware | | The ipv6 gateway address. |
| | **max\_num\_connections** integer | **Default:**11000 | The maximum number of socket connection that are requested. |
| | **preferred\_dns** string | | The IP address of the preferred dns server. |
| | **search\_domains** list / elements=string | **Default:**[] | The domain in which to search for hosts, placed in order of preference. |
| **esxi\_hostname** string / required | | Name of the ESXi host. |
| **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. |
| **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. |
| **provisioning** dictionary | | The TCP/IP stacks configuration of the *provisioning*. |
| | **congestion\_algorithm** string | **Choices:*** **newreno** ←
* cubic
| The TCP congest control algorithm. |
| | **gateway** string | | The ipv4 gateway address. |
| | **ipv6\_gateway** string added in 1.11.0 of community.vmware | | The ipv6 gateway address. |
| | **max\_num\_connections** integer | **Default:**11000 | The maximum number of socket connection that are requested. |
| **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. |
| **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. |
| **vmotion** dictionary | | The TCP/IP stacks configuration of the *vmotion*. |
| | **congestion\_algorithm** string | **Choices:*** **newreno** ←
* cubic
| The TCP congest control algorithm. |
| | **gateway** string | | The ipv4 gateway address. |
| | **ipv6\_gateway** string added in 1.11.0 of community.vmware | | The ipv6 gateway address. |
| | **max\_num\_connections** integer | **Default:**11000 | The maximum number of socket connection that are requested. |
| **vxlan** dictionary | | The TCP/IP stacks configuration of the *vxlan*.
aliases: nsx\_overlay |
| | **congestion\_algorithm** string | **Choices:*** **newreno** ←
* cubic
| The TCP congest control algorithm. |
| | **gateway** string | | The ipv4 gateway address. |
| | **ipv6\_gateway** string added in 1.11.0 of community.vmware | | The ipv6 gateway address. |
| | **max\_num\_connections** integer | **Default:**11000 | The maximum number of socket connection that are requested. |
Notes
-----
Note
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Update the TCP/IP stack configuration of the default
community.vmware.vmware_host_tcpip_stacks:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: false
esxi_hostname: "{{ esxi_hostname }}"
default:
hostname: "{{ esxi_hostname }}"
domain: example.com
preferred_dns: 192.168.10.1
alternate_dns: 192.168.20.1
search_domains:
- hoge.com
- fuga.com
gateway: 192.168.10.1
congestion_algorithm: cubic
max_num_connections: 12000
- name: Update the TCP/IP stack configuration of the provisioning
community.vmware.vmware_host_tcpip_stacks:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: false
esxi_hostname: "{{ esxi_hostname }}"
provisioning:
congestion_algorithm: newreno
max_num_connections: 12000
gateway: 10.10.10.254
- name: Update the TCP/IP stack configuration of the default and provisioning
community.vmware.vmware_host_tcpip_stacks:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: false
esxi_hostname: "{{ esxi_hostname }}"
default:
hostname: "{{ esxi_hostname }}"
domain: example.com
preferred_dns: 192.168.10.1
alternate_dns: 192.168.20.1
search_domains:
- hoge.com
- fuga.com
gateway: 192.168.10.1
congestion_algorithm: cubic
max_num_connections: 12000
provisioning:
congestion_algorithm: newreno
max_num_connections: 12000
gateway: 10.10.10.254
- name: Update the ipv6 gateway of the provisioning TCP/IP stack
community.vmware.vmware_host_tcpip_stacks:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: false
esxi_hostname: "{{ esxi_hostname }}"
provisioning:
ipv6_gateway: ::ffff:6440:301
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **default** dictionary | always | dict of the TCP/IP stack configuration of the default. **Sample:** { "alternate\_dns": "192.168.20.1", "congestion\_algorithm": "cubic", "domain": "example.com", "gateway": "192.168.10.1", "ipv6\_gateway", null, "hostname": "esxi-test03", "max\_num\_connections": 12000, "preferred\_dns": "192.168.10.1", "search\_domains": [ "hoge.com", "fuga.com" ] } |
| **provisioning** dictionary | always | dict of the TCP/IP stack configuration of the provisioning. **Sample:** { "congestion\_algorithm": "newreno", "gateway": "10.10.10.254", "ipv6\_gateway": null, "max\_num\_connections": 12000 } |
| **vmotion** dictionary | always | dict of the TCP/IP stack configuration of the vmotion. **Sample:** { "congestion\_algorithm": "newreno", "gateway": null, "ipv6\_gateway": null, "max\_num\_connections": 11000 } |
| **vxlan** dictionary | always | dict of the TCP/IP stack configuration of the vxlan. **Sample:** { "congestion\_algorithm": "newreno", "gateway": null, "ipv6\_gateway": null, "max\_num\_connections": 11000 } |
### Authors
* sky-joker (@sky-joker)
| programming_docs |
ansible community.vmware.vmware_cluster_info – Gather info about clusters available in given vCenter community.vmware.vmware\_cluster\_info – Gather info about clusters available in given vCenter
==============================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_cluster_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to gather information about clusters in VMWare infrastructure.
* All values and VMware object names are case sensitive.
* This module was called `vmware_cluster_facts` before Ansible 2.9. The usage did not change.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster. If set, information of this cluster will be returned. This parameter is required, if `datacenter` is not supplied. |
| **datacenter** string | | Datacenter to search for cluster/s. This parameter is required, if `cluster_name` is not supplied. |
| **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. |
| **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. |
| **properties** list / elements=string added in 1.0.0 of community.vmware | | Specify the properties to retrieve. Example: properties: [ "name", "configuration.dasConfig.enabled", "summary.totalCpu" ] Only valid when `schema` is `vsphere`. |
| **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. |
| **schema** string added in 1.0.0 of community.vmware | **Choices:*** **summary** ←
* vsphere
| Specify the output schema desired. The 'summary' output schema is the legacy output from the module. The 'vsphere' output schema is the vSphere API class definition which requires pyvmomi>6.7.1. |
| **show\_tag** boolean | **Choices:*** **no** ←
* yes
| Tags related to cluster are shown if set to `True`. |
| **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 on vSphere 6.5, 6.7
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather cluster info from given datacenter
community.vmware.vmware_cluster_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter: ha-datacenter
delegate_to: localhost
register: cluster_info
- name: Gather info from datacenter about specific cluster
community.vmware.vmware_cluster_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: DC0_C0
delegate_to: localhost
register: cluster_info
- name: Gather info from datacenter about specific cluster with tags
community.vmware.vmware_cluster_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: DC0_C0
show_tag: True
delegate_to: localhost
register: cluster_info
- name: Gather some info from a cluster using the vSphere API output schema
vmware_cluster_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: DC0_C0
schema: vsphere
properties:
- name
- configuration.dasConfig.enabled
- summary.totalCpu
delegate_to: localhost
register: cluster_info
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **clusters** dictionary | always | metadata about the available clusters datacenter added in the return values from version 1.6.0 **Sample:** {'DC0\_C0': {'datacenter': 'DC0', 'drs\_default\_vm\_behavior': None, 'drs\_enable\_vm\_behavior\_overrides': None, 'drs\_vmotion\_rate': None, 'enable\_ha': None, 'enabled\_drs': True, 'enabled\_vsan': False, 'ha\_admission\_control\_enabled': None, 'ha\_failover\_level': None, 'ha\_host\_monitoring': None, 'ha\_restart\_priority': None, 'ha\_vm\_failure\_interval': None, 'ha\_vm\_max\_failure\_window': None, 'ha\_vm\_max\_failures': None, 'ha\_vm\_min\_up\_time': None, 'ha\_vm\_monitoring': None, 'ha\_vm\_tools\_monitoring': None, 'hosts': [{'folder': '/DC0/host/DC0\_C0', 'name': 'esxi01.vsphere.local'}, {'folder': '/DC0/host/DC0\_C0', 'name': 'esxi02.vsphere.local'}, {'folder': '/DC0/host/DC0\_C0', 'name': 'esxi03.vsphere.local'}, {'folder': '/DC0/host/DC0\_C0', 'name': 'esxi04.vsphere.local'}], 'moid': 'domain-c9', 'resource\_summary': {'cpuCapacityMHz': 4224, 'cpuUsedMHz': 87, 'memCapacityMB': 6139, 'memUsedMB': 1254, 'pMemAvailableMB': 0, 'pMemCapacityMB': 0, 'storageCapacityMB': 33280, 'storageUsedMB': 19953}, 'tags': [{'category\_id': 'urn:vmomi:InventoryServiceCategory:9fbf83de-7903-442e-8004-70fd3940297c:GLOBAL', 'category\_name': 'sample\_cluster\_cat\_0001', 'description': '', 'id': 'urn:vmomi:InventoryServiceTag:93d680db-b3a6-4834-85ad-3e9516e8fee8:GLOBAL', 'name': 'sample\_cluster\_tag\_0001'}], 'vsan\_auto\_claim\_storage': False}} |
### Authors
* Abhijeet Kasurde (@Akasurde)
* Christian Neugum (@digifuchsi)
ansible community.vmware.vmware_guest_sendkey – Send USB HID codes to the Virtual Machine’s keyboard. community.vmware.vmware\_guest\_sendkey – Send USB HID codes to the Virtual Machine’s keyboard.
===============================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_guest_sendkey`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module is used to send keystrokes to given virtual machine.
* All parameters and VMware object names are case sensitive.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster** string | | The name of cluster where the virtual machine is running. This is a required parameter, if `esxi_hostname` is not set.
`esxi_hostname` and `cluster` are mutually exclusive parameters. |
| **datacenter** string | | The datacenter name to which virtual machine belongs to. |
| **esxi\_hostname** string | | The ESXi hostname where the virtual machine is running. This is a required parameter, if `cluster` is not set.
`esxi_hostname` and `cluster` are mutually exclusive parameters. |
| **folder** string | | Destination folder, absolute or relative path to find an existing guest. This is a required parameter, only if multiple VMs are found with same name. The folder should include the datacenter. ESXi server's datacenter is ha-datacenter. Examples: folder: /ha-datacenter/vm folder: ha-datacenter/vm folder: /datacenter1/vm folder: datacenter1/vm folder: /datacenter1/vm/folder1 folder: datacenter1/vm/folder1 folder: /folder1/datacenter1/vm folder: folder1/datacenter1/vm folder: /folder1/datacenter1/vm/folder2 |
| **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. |
| **keys\_send** list / elements=string | | The list of the keys will be sent to the virtual machine. Valid values are `ENTER`, `ESC`, `BACKSPACE`, `TAB`, `SPACE`, `CAPSLOCK`, `DELETE`, `CTRL_ALT_DEL`, `CTRL_C` and `F1` to `F12`, `RIGHTARROW`, `LEFTARROW`, `DOWNARROW`, `UPARROW`. If both `keys_send` and `string_send` are specified, keys in `keys_send` list will be sent in front of the `string_send`. |
| **moid** string | | Managed Object ID of the instance to manage if known, this is a unique identifier only within a single vCenter instance. This is required if `name` or `uuid` is not supplied. |
| **name** string | | Name of the virtual machine. This is a required parameter, if parameter `uuid` or `moid` is not supplied. |
| **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. |
| **sleep\_time** integer added in 1.4.0 of community.vmware | **Default:**0 | Sleep time in seconds between two keys or string sent to the virtual machine. API is faster than actual key or string send to virtual machine, this parameter allow to control delay between keys and/or strings. |
| **string\_send** string | | The string will be sent to the virtual machine. This string can contain valid special character, alphabet and digit on the keyboard. |
| **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 |
| **uuid** string | | UUID of the instance to gather facts if known, this is VMware's unique identifier. This is a required parameter, if parameter `name` or `moid` is not supplied. |
| **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 on vSphere 6.5 and 6.7
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Send list of keys to virtual machine
community.vmware.vmware_guest_sendkey:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
folder: "{{ folder_name }}"
name: "{{ vm_name }}"
keys_send:
- TAB
- TAB
- ENTER
delegate_to: localhost
register: keys_num_sent
- name: Send list of keys to virtual machine using MoID
community.vmware.vmware_guest_sendkey:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
folder: "{{ folder_name }}"
moid: vm-42
keys_send:
- CTRL_ALT_DEL
delegate_to: localhost
register: ctrl_alt_del_sent
- name: Send a string to virtual machine
community.vmware.vmware_guest_sendkey:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
folder: "{{ folder_name }}"
name: "{{ vm_name }}"
string_send: "user_logon"
delegate_to: localhost
register: keys_num_sent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **sendkey\_info** dictionary | always | display the keys and the number of keys sent to the virtual machine **Sample:** {'keys\_send': ['SPACE', 'DOWNARROW', 'DOWNARROW', 'ENTER'], 'keys\_send\_number': 4, 'returned\_keys\_send\_number': 4, 'string\_send': None, 'virtual\_machine': 'test\_vm'} |
### Authors
* Diane Wang (@Tomorrow9) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#d1b5b8b0bfb4a6f7f2e2e6eaf7f2e4e3eaf7f2e5e9eaa7bca6b0a3b4f7f2e5e7eab2bebc)>
ansible community.vmware.vmware_host_capability_info – Gathers info about an ESXi host’s capability information community.vmware.vmware\_host\_capability\_info – Gathers info about an ESXi host’s capability information
==========================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_capability_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to gather information about an ESXi host’s capability information when ESXi hostname or Cluster name is given.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster from all host systems to be used for information gathering. If `esxi_hostname` is not given, this parameter is required. |
| **esxi\_hostname** string | | ESXi hostname to gather information from. If `cluster_name` is not given, this parameter is required. |
| **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. |
| **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. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather capability info about all ESXi Host in given Cluster
community.vmware.vmware_host_capability_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: cluster_name
delegate_to: localhost
register: all_cluster_hosts_info
- name: Gather capability info about ESXi Host
community.vmware.vmware_host_capability_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
delegate_to: localhost
register: hosts_info
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **hosts\_capability\_info** dictionary | always | metadata about host's capability info **Sample:** {'esxi\_hostname\_0001': {'accel3dSupported': False, 'backgroundSnapshotsSupported': False, 'checkpointFtCompatibilityIssues': [], 'checkpointFtSupported': False, 'cloneFromSnapshotSupported': True, 'cpuHwMmuSupported': True}} |
### Authors
* Abhijeet Kasurde (@Akasurde)
| programming_docs |
ansible community.vmware.vmware_cluster_ha – Manage High Availability (HA) on VMware vSphere clusters community.vmware.vmware\_cluster\_ha – Manage High Availability (HA) on VMware vSphere clusters
===============================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_cluster_ha`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Manages HA configuration on VMware vSphere clusters.
* All values and VMware object names are case sensitive.
Requirements
------------
The below requirements are needed on the host that executes this module.
* Tested on ESXi 5.5 and 6.5.
* PyVmomi installed.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **advanced\_settings** dictionary | **Default:**{} | A dictionary of advanced HA settings. |
| **apd\_response** string added in 1.4.0 of community.vmware | **Choices:*** disabled
* **warning** ←
* restartConservative
* restartAggressive
| VM storage protection setting for storage failures categorized as All Paths Down (APD). |
| **cluster\_name** string / required | | The name of the cluster to be managed. |
| **datacenter** string / required | | The name of the datacenter.
aliases: datacenter\_name |
| **enable** boolean | **Choices:*** **no** ←
* yes
| Whether to enable HA.
aliases: enable\_ha |
| **failover\_host\_admission\_control** dictionary | | Configure dedicated failover hosts.
`slot_based_admission_control`, `reservation_based_admission_control` and `failover_host_admission_control` are mutually exclusive. |
| | **failover\_hosts** list / elements=string / required | | List of dedicated failover hosts. |
| **ha\_host\_monitoring** string | **Choices:*** **enabled** ←
* disabled
| Whether HA restarts virtual machines after a host fails. If set to `enabled`, HA restarts virtual machines after a host fails. If set to `disabled`, HA does not restart virtual machines after a host fails. If `enable` is set to `False`, then this value is ignored. |
| **ha\_restart\_priority** string | **Choices:*** disabled
* high
* low
* **medium** ←
| Priority HA gives to a virtual machine if sufficient capacity is not available to power on all failed virtual machines. Valid only if *ha\_vm\_monitoring* is set to either `vmAndAppMonitoring` or `vmMonitoringOnly`. If set to `disabled`, then HA is disabled for this virtual machine. If set to `high`, then virtual machine with this priority have a higher chance of powering on after a failure, when there is insufficient capacity on hosts to meet all virtual machine needs. If set to `medium`, then virtual machine with this priority have an intermediate chance of powering on after a failure, when there is insufficient capacity on hosts to meet all virtual machine needs. If set to `low`, then virtual machine with this priority have a lower chance of powering on after a failure, when there is insufficient capacity on hosts to meet all virtual machine needs. |
| **ha\_vm\_failure\_interval** integer | **Default:**30 | The number of seconds after which virtual machine is declared as failed if no heartbeat has been received. This setting is only valid if `ha_vm_monitoring` is set to, either `vmAndAppMonitoring` or `vmMonitoringOnly`. Unit is seconds. |
| **ha\_vm\_max\_failure\_window** integer | **Default:**-1 | The number of seconds for the window during which up to `ha_vm_max_failures` resets can occur before automated responses stop. Valid only when *ha\_vm\_monitoring* is set to either `vmAndAppMonitoring` or `vmMonitoringOnly`. Unit is seconds. Default specifies no failure window. |
| **ha\_vm\_max\_failures** integer | **Default:**3 | Maximum number of failures and automated resets allowed during the time that `ha_vm_max_failure_window` specifies. Valid only when *ha\_vm\_monitoring* is set to either `vmAndAppMonitoring` or `vmMonitoringOnly`. |
| **ha\_vm\_min\_up\_time** integer | **Default:**120 | The number of seconds for the virtual machine's heartbeats to stabilize after the virtual machine has been powered on. Valid only when *ha\_vm\_monitoring* is set to either `vmAndAppMonitoring` or `vmMonitoringOnly`. Unit is seconds. |
| **ha\_vm\_monitoring** string | **Choices:*** vmAndAppMonitoring
* vmMonitoringOnly
* **vmMonitoringDisabled** ←
| State of virtual machine health monitoring service. If set to `vmAndAppMonitoring`, HA response to both virtual machine and application heartbeat failure. If set to `vmMonitoringDisabled`, virtual machine health monitoring is disabled. If set to `vmMonitoringOnly`, HA response to virtual machine heartbeat failure. If `enable` is set to `False`, then this value is ignored. |
| **host\_isolation\_response** string | **Choices:*** **none** ←
* powerOff
* shutdown
| Indicates whether or VMs should be powered off if a host determines that it is isolated from the rest of the compute resource. If set to `none`, do not power off VMs in the event of a host network isolation. If set to `powerOff`, power off VMs in the event of a host network isolation. If set to `shutdown`, shut down VMs guest operating system in the event of a host network isolation. |
| **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. |
| **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 |
| **pdl\_response** string added in 1.4.0 of community.vmware | **Choices:*** disabled
* **warning** ←
* restartAggressive
| VM storage protection setting for storage failures categorized as Permenant Device Loss (PDL). |
| **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. |
| **reservation\_based\_admission\_control** dictionary | | Configure reservation based admission control policy.
`slot_based_admission_control`, `reservation_based_admission_control` and `failover_host_admission_control` are mutually exclusive. |
| | **auto\_compute\_percentages** boolean | **Choices:*** no
* **yes** ←
| By default, `failover_level` is used to calculate `cpu_failover_resources_percent` and `memory_failover_resources_percent`. If a user wants to override the percentage values, he has to set this field to false. |
| | **cpu\_failover\_resources\_percent** integer | **Default:**50 | Percentage of CPU resources in the cluster to reserve for failover. Ignored if `auto_compute_percentages` is not set to false. |
| | **failover\_level** integer / required | | Number of host failures that should be tolerated. |
| | **memory\_failover\_resources\_percent** integer | **Default:**50 | Percentage of memory resources in the cluster to reserve for failover. Ignored if `auto_compute_percentages` is not set to false. |
| **slot\_based\_admission\_control** dictionary | | Configure slot based admission control policy.
`slot_based_admission_control`, `reservation_based_admission_control` and `failover_host_admission_control` are mutually exclusive. |
| | **failover\_level** integer / required | | Number of host failures that should be tolerated. |
| **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
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Enable HA without admission control
community.vmware.vmware_cluster_ha:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter_name: datacenter
cluster_name: cluster
enable: true
delegate_to: localhost
- name: Enable HA and VM monitoring without admission control
community.vmware.vmware_cluster_ha:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter_name: DC0
cluster_name: "{{ cluster_name }}"
enable: True
ha_vm_monitoring: vmMonitoringOnly
delegate_to: localhost
- name: Enable HA with admission control reserving 50% of resources for HA
community.vmware.vmware_cluster_ha:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter_name: datacenter
cluster_name: cluster
enable: true
reservation_based_admission_control:
auto_compute_percentages: False
failover_level: 1
cpu_failover_resources_percent: 50
memory_failover_resources_percent: 50
delegate_to: localhost
```
### Authors
* Joseph Callen (@jcpowermac)
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vcenter_license – Manage VMware vCenter license keys community.vmware.vcenter\_license – Manage VMware vCenter license keys
======================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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.vcenter_license`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Add and delete vCenter, ESXi server license keys.
Requirements
------------
The below requirements are needed on the host that executes this module.
* pyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster to apply vSAN license. |
| **datacenter** string | | The datacenter name to use for the operation. |
| **esxi\_hostname** string | | The hostname of the ESXi server to which the specified license will be assigned. This parameter is optional. |
| **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. Environment variable supported added in Ansible 2.6. |
| **labels** dictionary | **Default:**{"source": "ansible"} | The optional labels of the license key to manage in vSphere vCenter. This is dictionary with key/value pair. |
| **license** string / required | | The license key to manage in vSphere vCenter. |
| **password** 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. Environment variable supported added in Ansible 2.6.
aliases: pass, pwd |
| **port** integer added in 2.5 of ansible.builtin | **Default:**443 | 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. Environment variable supported added in Ansible 2.6. |
| **proxy\_host** string added in 2.9 of ansible.builtin | | 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 added in 2.9 of ansible.builtin | | 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. |
| **state** string | **Choices:*** absent
* **present** ←
| Whether to add (`present`) or remove (`absent`) the license key. |
| **username** 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. Environment variable supported 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 supported added in Ansible 2.6. If set to `true`, please make sure Python >= 2.7.9 is installed on the given machine. |
Notes
-----
Note
* This module will also auto-assign the current vCenter to the license key if the product matches the license key, and vCenter us currently assigned an evaluation license only.
* The evaluation license (00000-00000-00000-00000-00000) is not listed when unused.
* If `esxi_hostname` is specified, then will assign the `license` key to the ESXi host.
* If `esxi_hostname` is not specified, then will just register the `license` key to vCenter inventory without assigning it to an ESXi host.
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Add a new vCenter license
community.vmware.vcenter_license:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
license: f600d-21ae3-5592b-249e0-cc341
state: present
delegate_to: localhost
- name: Remove an (unused) vCenter license
community.vmware.vcenter_license:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
license: f600d-21ae3-5592b-249e0-cc341
state: absent
delegate_to: localhost
- name: Add ESXi license and assign to the ESXi host
community.vmware.vcenter_license:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
license: f600d-21ae3-5592b-249e0-dd502
state: present
delegate_to: localhost
- name: Add vSAN license and assign to the given cluster
community.vmware.vcenter_license:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter: '{{ datacenter_name }}'
cluster_name: '{{ cluster_name }}'
license: f600d-21ae3-5592b-249e0-dd502
state: present
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **licenses** list / elements=string | always | list of license keys after module executed **Sample:** ['f600d-21ae3-5592b-249e0-cc341', '143cc-0e942-b2955-3ea12-d006f'] |
### Authors
* Dag Wieers (@dagwieers)
ansible community.vmware.vmware_host_powerstate – Manages power states of host systems in vCenter community.vmware.vmware\_host\_powerstate – Manages power states of host systems in vCenter
===========================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_powerstate`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to manage power states of host systems in given vCenter infrastructure.
* User can set power state to ‘power-down-to-standby’, ‘power-up-from-standby’, ‘shutdown-host’ and ‘reboot-host’.
* State ‘reboot-host’, ‘shutdown-host’ and ‘power-down-to-standby’ are not supported by all the host systems.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster from which all host systems will be used. This is required parameter if `esxi_hostname` is not specified. |
| **esxi\_hostname** string | | Name of the host system to work with. This is required parameter if `cluster_name` is not specified. |
| **force** boolean | **Choices:*** **no** ←
* yes
| This parameter specify if the host should be proceeding with user defined powerstate regardless of whether it is in maintenance mode. If `state` set to `reboot-host` and `force` as `true`, then host system is rebooted regardless of whether it is in maintenance mode. If `state` set to `shutdown-host` and `force` as `true`, then host system is shutdown regardless of whether it is in maintenance mode. If `state` set to `power-down-to-standby` and `force` to `true`, then all powered off VMs will evacuated. Not applicable if `state` set to `power-up-from-standby`. |
| **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. |
| **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. |
| **state** string | **Choices:*** power-down-to-standby
* power-up-from-standby
* **shutdown-host** ←
* reboot-host
| Set the state of the host system. |
| **timeout** integer | **Default:**600 | This parameter defines timeout for `state` set to `power-down-to-standby` or `power-up-from-standby`. Ignored if `state` set to `reboot-host` or `shutdown-host`. This parameter is defined in seconds. |
| **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
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Set the state of a host system to reboot
community.vmware.vmware_host_powerstate:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
state: reboot-host
delegate_to: localhost
register: reboot_host
- name: Set the state of a host system to power down to standby
community.vmware.vmware_host_powerstate:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
state: power-down-to-standby
delegate_to: localhost
register: power_down
- name: Set the state of all host systems from cluster to reboot
community.vmware.vmware_host_powerstate:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: '{{ cluster_name }}'
state: reboot-host
delegate_to: localhost
register: reboot_host
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **result** dictionary | always | metadata about host system's state **Sample:** {'esxi01': {'error': '', 'msg': "power down 'esxi01' to standby"}} |
### Authors
* Abhijeet Kasurde (@Akasurde)
| programming_docs |
ansible Community.Vmware Community.Vmware
================
Collection version 1.15.0
Scenario Guide
--------------
* [VMware Guide](docsite/scenario_guide)
Plugin Index
------------
These are the plugins in the community.vmware collection
### Connection Plugins
* [vmware\_tools](vmware_tools_connection#ansible-collections-community-vmware-vmware-tools-connection) – Execute tasks inside a VM via VMware Tools
### Httpapi Plugins
* [vmware](vmware_httpapi#ansible-collections-community-vmware-vmware-httpapi) – HttpApi Plugin for VMware REST API
### Inventory Plugins
* [vmware\_host\_inventory](vmware_host_inventory_inventory#ansible-collections-community-vmware-vmware-host-inventory-inventory) – VMware ESXi hostsystem inventory source
* [vmware\_vm\_inventory](vmware_vm_inventory_inventory#ansible-collections-community-vmware-vmware-vm-inventory-inventory) – VMware Guest inventory source
### Modules
* [vca\_fw](vca_fw_module#ansible-collections-community-vmware-vca-fw-module) – add remove firewall rules in a gateway in a vca
* [vca\_nat](vca_nat_module#ansible-collections-community-vmware-vca-nat-module) – add remove nat rules in a gateway in a vca
* [vca\_vapp](vca_vapp_module#ansible-collections-community-vmware-vca-vapp-module) – Manages vCloud Air vApp instances.
* [vcenter\_domain\_user\_group\_info](vcenter_domain_user_group_info_module#ansible-collections-community-vmware-vcenter-domain-user-group-info-module) – Gather user or group information of a domain
* [vcenter\_extension](vcenter_extension_module#ansible-collections-community-vmware-vcenter-extension-module) – Register/deregister vCenter Extensions
* [vcenter\_extension\_facts](vcenter_extension_facts_module#ansible-collections-community-vmware-vcenter-extension-facts-module) – Gather facts vCenter extensions
* [vcenter\_extension\_info](vcenter_extension_info_module#ansible-collections-community-vmware-vcenter-extension-info-module) – Gather info vCenter extensions
* [vcenter\_folder](vcenter_folder_module#ansible-collections-community-vmware-vcenter-folder-module) – Manage folders on given datacenter
* [vcenter\_license](vcenter_license_module#ansible-collections-community-vmware-vcenter-license-module) – Manage VMware vCenter license keys
* [vmware\_about\_facts](vmware_about_facts_module#ansible-collections-community-vmware-vmware-about-facts-module) – Provides information about VMware server to which user is connecting to
* [vmware\_about\_info](vmware_about_info_module#ansible-collections-community-vmware-vmware-about-info-module) – Provides information about VMware server to which user is connecting to
* [vmware\_category](vmware_category_module#ansible-collections-community-vmware-vmware-category-module) – Manage VMware categories
* [vmware\_category\_facts](vmware_category_facts_module#ansible-collections-community-vmware-vmware-category-facts-module) – Gather facts about VMware tag categories
* [vmware\_category\_info](vmware_category_info_module#ansible-collections-community-vmware-vmware-category-info-module) – Gather info about VMware tag categories
* [vmware\_cfg\_backup](vmware_cfg_backup_module#ansible-collections-community-vmware-vmware-cfg-backup-module) – Backup / Restore / Reset ESXi host configuration
* [vmware\_cluster](vmware_cluster_module#ansible-collections-community-vmware-vmware-cluster-module) – Manage VMware vSphere clusters
* [vmware\_cluster\_drs](vmware_cluster_drs_module#ansible-collections-community-vmware-vmware-cluster-drs-module) – Manage Distributed Resource Scheduler (DRS) on VMware vSphere clusters
* [vmware\_cluster\_ha](vmware_cluster_ha_module#ansible-collections-community-vmware-vmware-cluster-ha-module) – Manage High Availability (HA) on VMware vSphere clusters
* [vmware\_cluster\_info](vmware_cluster_info_module#ansible-collections-community-vmware-vmware-cluster-info-module) – Gather info about clusters available in given vCenter
* [vmware\_cluster\_vsan](vmware_cluster_vsan_module#ansible-collections-community-vmware-vmware-cluster-vsan-module) – Manages virtual storage area network (vSAN) configuration on VMware vSphere clusters
* [vmware\_content\_deploy\_ovf\_template](vmware_content_deploy_ovf_template_module#ansible-collections-community-vmware-vmware-content-deploy-ovf-template-module) – Deploy Virtual Machine from ovf template stored in content library.
* [vmware\_content\_deploy\_template](vmware_content_deploy_template_module#ansible-collections-community-vmware-vmware-content-deploy-template-module) – Deploy Virtual Machine from template stored in content library.
* [vmware\_content\_library\_info](vmware_content_library_info_module#ansible-collections-community-vmware-vmware-content-library-info-module) – Gather information about VMWare Content Library
* [vmware\_content\_library\_manager](vmware_content_library_manager_module#ansible-collections-community-vmware-vmware-content-library-manager-module) – Create, update and delete VMware content library
* [vmware\_datacenter](vmware_datacenter_module#ansible-collections-community-vmware-vmware-datacenter-module) – Manage VMware vSphere Datacenters
* [vmware\_datacenter\_info](vmware_datacenter_info_module#ansible-collections-community-vmware-vmware-datacenter-info-module) – Gather information about VMware vSphere Datacenters
* [vmware\_datastore\_cluster](vmware_datastore_cluster_module#ansible-collections-community-vmware-vmware-datastore-cluster-module) – Manage VMware vSphere datastore clusters
* [vmware\_datastore\_cluster\_manager](vmware_datastore_cluster_manager_module#ansible-collections-community-vmware-vmware-datastore-cluster-manager-module) – Manage VMware vSphere datastore cluster’s members
* [vmware\_datastore\_info](vmware_datastore_info_module#ansible-collections-community-vmware-vmware-datastore-info-module) – Gather info about datastores available in given vCenter
* [vmware\_datastore\_maintenancemode](vmware_datastore_maintenancemode_module#ansible-collections-community-vmware-vmware-datastore-maintenancemode-module) – Place a datastore into maintenance mode
* [vmware\_deploy\_ovf](vmware_deploy_ovf_module#ansible-collections-community-vmware-vmware-deploy-ovf-module) – Deploys a VMware virtual machine from an OVF or OVA file
* [vmware\_dns\_config](vmware_dns_config_module#ansible-collections-community-vmware-vmware-dns-config-module) – Manage VMware ESXi DNS Configuration
* [vmware\_drs\_group](vmware_drs_group_module#ansible-collections-community-vmware-vmware-drs-group-module) – Creates vm/host group in a given cluster.
* [vmware\_drs\_group\_facts](vmware_drs_group_facts_module#ansible-collections-community-vmware-vmware-drs-group-facts-module) – Gathers facts about DRS VM/Host groups on the given cluster
* [vmware\_drs\_group\_info](vmware_drs_group_info_module#ansible-collections-community-vmware-vmware-drs-group-info-module) – Gathers info about DRS VM/Host groups on the given cluster
* [vmware\_drs\_group\_manager](vmware_drs_group_manager_module#ansible-collections-community-vmware-vmware-drs-group-manager-module) – Manage VMs and Hosts in DRS group.
* [vmware\_drs\_rule\_facts](vmware_drs_rule_facts_module#ansible-collections-community-vmware-vmware-drs-rule-facts-module) – Gathers facts about DRS rule on the given cluster
* [vmware\_drs\_rule\_info](vmware_drs_rule_info_module#ansible-collections-community-vmware-vmware-drs-rule-info-module) – Gathers info about DRS rule on the given cluster
* [vmware\_dvs\_host](vmware_dvs_host_module#ansible-collections-community-vmware-vmware-dvs-host-module) – Add or remove a host from distributed virtual switch
* [vmware\_dvs\_portgroup](vmware_dvs_portgroup_module#ansible-collections-community-vmware-vmware-dvs-portgroup-module) – Create or remove a Distributed vSwitch portgroup.
* [vmware\_dvs\_portgroup\_facts](vmware_dvs_portgroup_facts_module#ansible-collections-community-vmware-vmware-dvs-portgroup-facts-module) – Gathers facts DVS portgroup configurations
* [vmware\_dvs\_portgroup\_find](vmware_dvs_portgroup_find_module#ansible-collections-community-vmware-vmware-dvs-portgroup-find-module) – Find portgroup(s) in a VMware environment
* [vmware\_dvs\_portgroup\_info](vmware_dvs_portgroup_info_module#ansible-collections-community-vmware-vmware-dvs-portgroup-info-module) – Gathers info DVS portgroup configurations
* [vmware\_dvswitch](vmware_dvswitch_module#ansible-collections-community-vmware-vmware-dvswitch-module) – Create or remove a Distributed Switch
* [vmware\_dvswitch\_info](vmware_dvswitch_info_module#ansible-collections-community-vmware-vmware-dvswitch-info-module) – Gathers info dvswitch configurations
* [vmware\_dvswitch\_lacp](vmware_dvswitch_lacp_module#ansible-collections-community-vmware-vmware-dvswitch-lacp-module) – Manage LACP configuration on a Distributed Switch
* [vmware\_dvswitch\_nioc](vmware_dvswitch_nioc_module#ansible-collections-community-vmware-vmware-dvswitch-nioc-module) – Manage distributed switch Network IO Control
* [vmware\_dvswitch\_pvlans](vmware_dvswitch_pvlans_module#ansible-collections-community-vmware-vmware-dvswitch-pvlans-module) – Manage Private VLAN configuration of a Distributed Switch
* [vmware\_dvswitch\_uplink\_pg](vmware_dvswitch_uplink_pg_module#ansible-collections-community-vmware-vmware-dvswitch-uplink-pg-module) – Manage uplink portproup configuration of a Distributed Switch
* [vmware\_evc\_mode](vmware_evc_mode_module#ansible-collections-community-vmware-vmware-evc-mode-module) – Enable/Disable EVC mode on vCenter
* [vmware\_export\_ovf](vmware_export_ovf_module#ansible-collections-community-vmware-vmware-export-ovf-module) – Exports a VMware virtual machine to an OVF file, device files and a manifest file
* [vmware\_first\_class\_disk](vmware_first_class_disk_module#ansible-collections-community-vmware-vmware-first-class-disk-module) – Manage VMware vSphere First Class Disks
* [vmware\_folder\_info](vmware_folder_info_module#ansible-collections-community-vmware-vmware-folder-info-module) – Provides information about folders in a datacenter
* [vmware\_guest](vmware_guest_module#ansible-collections-community-vmware-vmware-guest-module) – Manages virtual machines in vCenter
* [vmware\_guest\_boot\_facts](vmware_guest_boot_facts_module#ansible-collections-community-vmware-vmware-guest-boot-facts-module) – Gather facts about boot options for the given virtual machine
* [vmware\_guest\_boot\_info](vmware_guest_boot_info_module#ansible-collections-community-vmware-vmware-guest-boot-info-module) – Gather info about boot options for the given virtual machine
* [vmware\_guest\_boot\_manager](vmware_guest_boot_manager_module#ansible-collections-community-vmware-vmware-guest-boot-manager-module) – Manage boot options for the given virtual machine
* [vmware\_guest\_controller](vmware_guest_controller_module#ansible-collections-community-vmware-vmware-guest-controller-module) – Manage disk or USB controllers related to virtual machine in given vCenter infrastructure
* [vmware\_guest\_cross\_vc\_clone](vmware_guest_cross_vc_clone_module#ansible-collections-community-vmware-vmware-guest-cross-vc-clone-module) – Cross-vCenter VM/template clone
* [vmware\_guest\_custom\_attribute\_defs](vmware_guest_custom_attribute_defs_module#ansible-collections-community-vmware-vmware-guest-custom-attribute-defs-module) – Manage custom attributes definitions for virtual machine from VMware
* [vmware\_guest\_custom\_attributes](vmware_guest_custom_attributes_module#ansible-collections-community-vmware-vmware-guest-custom-attributes-module) – Manage custom attributes from VMware for the given virtual machine
* [vmware\_guest\_customization\_facts](vmware_guest_customization_facts_module#ansible-collections-community-vmware-vmware-guest-customization-facts-module) – Gather facts about VM customization specifications
* [vmware\_guest\_customization\_info](vmware_guest_customization_info_module#ansible-collections-community-vmware-vmware-guest-customization-info-module) – Gather info about VM customization specifications
* [vmware\_guest\_disk](vmware_guest_disk_module#ansible-collections-community-vmware-vmware-guest-disk-module) – Manage disks related to virtual machine in given vCenter infrastructure
* [vmware\_guest\_disk\_facts](vmware_guest_disk_facts_module#ansible-collections-community-vmware-vmware-guest-disk-facts-module) – Gather facts about disks of given virtual machine
* [vmware\_guest\_disk\_info](vmware_guest_disk_info_module#ansible-collections-community-vmware-vmware-guest-disk-info-module) – Gather info about disks of given virtual machine
* [vmware\_guest\_file\_operation](vmware_guest_file_operation_module#ansible-collections-community-vmware-vmware-guest-file-operation-module) – Files operation in a VMware guest operating system without network
* [vmware\_guest\_find](vmware_guest_find_module#ansible-collections-community-vmware-vmware-guest-find-module) – Find the folder path(s) for a virtual machine by name or UUID
* [vmware\_guest\_info](vmware_guest_info_module#ansible-collections-community-vmware-vmware-guest-info-module) – Gather info about a single VM
* [vmware\_guest\_instant\_clone](vmware_guest_instant_clone_module#ansible-collections-community-vmware-vmware-guest-instant-clone-module) – Instant Clone VM
* [vmware\_guest\_move](vmware_guest_move_module#ansible-collections-community-vmware-vmware-guest-move-module) – Moves virtual machines in vCenter
* [vmware\_guest\_network](vmware_guest_network_module#ansible-collections-community-vmware-vmware-guest-network-module) – Manage network adapters of specified virtual machine in given vCenter infrastructure
* [vmware\_guest\_powerstate](vmware_guest_powerstate_module#ansible-collections-community-vmware-vmware-guest-powerstate-module) – Manages power states of virtual machines in vCenter
* [vmware\_guest\_register\_operation](vmware_guest_register_operation_module#ansible-collections-community-vmware-vmware-guest-register-operation-module) – VM inventory registration operation
* [vmware\_guest\_screenshot](vmware_guest_screenshot_module#ansible-collections-community-vmware-vmware-guest-screenshot-module) – Create a screenshot of the Virtual Machine console.
* [vmware\_guest\_sendkey](vmware_guest_sendkey_module#ansible-collections-community-vmware-vmware-guest-sendkey-module) – Send USB HID codes to the Virtual Machine’s keyboard.
* [vmware\_guest\_serial\_port](vmware_guest_serial_port_module#ansible-collections-community-vmware-vmware-guest-serial-port-module) – Manage serial ports on an existing VM
* [vmware\_guest\_snapshot](vmware_guest_snapshot_module#ansible-collections-community-vmware-vmware-guest-snapshot-module) – Manages virtual machines snapshots in vCenter
* [vmware\_guest\_snapshot\_info](vmware_guest_snapshot_info_module#ansible-collections-community-vmware-vmware-guest-snapshot-info-module) – Gather info about virtual machine’s snapshots in vCenter
* [vmware\_guest\_storage\_policy](vmware_guest_storage_policy_module#ansible-collections-community-vmware-vmware-guest-storage-policy-module) – Set VM Home and disk(s) storage policy profiles.
* [vmware\_guest\_tools\_info](vmware_guest_tools_info_module#ansible-collections-community-vmware-vmware-guest-tools-info-module) – Gather info about VMware tools installed in VM
* [vmware\_guest\_tools\_upgrade](vmware_guest_tools_upgrade_module#ansible-collections-community-vmware-vmware-guest-tools-upgrade-module) – Module to upgrade VMTools
* [vmware\_guest\_tools\_wait](vmware_guest_tools_wait_module#ansible-collections-community-vmware-vmware-guest-tools-wait-module) – Wait for VMware tools to become available
* [vmware\_guest\_video](vmware_guest_video_module#ansible-collections-community-vmware-vmware-guest-video-module) – Modify video card configurations of specified virtual machine in given vCenter infrastructure
* [vmware\_guest\_vnc](vmware_guest_vnc_module#ansible-collections-community-vmware-vmware-guest-vnc-module) – Manages VNC remote display on virtual machines in vCenter
* [vmware\_host](vmware_host_module#ansible-collections-community-vmware-vmware-host-module) – Add, remove, or move an ESXi host to, from, or within vCenter
* [vmware\_host\_acceptance](vmware_host_acceptance_module#ansible-collections-community-vmware-vmware-host-acceptance-module) – Manage the host acceptance level of an ESXi host
* [vmware\_host\_active\_directory](vmware_host_active_directory_module#ansible-collections-community-vmware-vmware-host-active-directory-module) – Joins an ESXi host system to an Active Directory domain or leaves it
* [vmware\_host\_auto\_start](vmware_host_auto_start_module#ansible-collections-community-vmware-vmware-host-auto-start-module) – Manage the auto power ON or OFF for vm on ESXi host
* [vmware\_host\_capability\_facts](vmware_host_capability_facts_module#ansible-collections-community-vmware-vmware-host-capability-facts-module) – Gathers facts about an ESXi host’s capability information
* [vmware\_host\_capability\_info](vmware_host_capability_info_module#ansible-collections-community-vmware-vmware-host-capability-info-module) – Gathers info about an ESXi host’s capability information
* [vmware\_host\_config\_facts](vmware_host_config_facts_module#ansible-collections-community-vmware-vmware-host-config-facts-module) – Gathers facts about an ESXi host’s advance configuration information
* [vmware\_host\_config\_info](vmware_host_config_info_module#ansible-collections-community-vmware-vmware-host-config-info-module) – Gathers info about an ESXi host’s advance configuration information
* [vmware\_host\_config\_manager](vmware_host_config_manager_module#ansible-collections-community-vmware-vmware-host-config-manager-module) – Manage advanced system settings of an ESXi host
* [vmware\_host\_custom\_attributes](vmware_host_custom_attributes_module#ansible-collections-community-vmware-vmware-host-custom-attributes-module) – Manage custom attributes from VMware for the given ESXi host
* [vmware\_host\_datastore](vmware_host_datastore_module#ansible-collections-community-vmware-vmware-host-datastore-module) – Manage a datastore on ESXi host
* [vmware\_host\_disk\_info](vmware_host_disk_info_module#ansible-collections-community-vmware-vmware-host-disk-info-module) – Gathers information about disks attached to given ESXi host/s.
* [vmware\_host\_dns](vmware_host_dns_module#ansible-collections-community-vmware-vmware-host-dns-module) – Manage DNS configuration of an ESXi host system
* [vmware\_host\_dns\_facts](vmware_host_dns_facts_module#ansible-collections-community-vmware-vmware-host-dns-facts-module) – Gathers facts about an ESXi host’s DNS configuration information
* [vmware\_host\_dns\_info](vmware_host_dns_info_module#ansible-collections-community-vmware-vmware-host-dns-info-module) – Gathers info about an ESXi host’s DNS configuration information
* [vmware\_host\_facts](vmware_host_facts_module#ansible-collections-community-vmware-vmware-host-facts-module) – Gathers facts about remote ESXi hostsystem
* [vmware\_host\_feature\_facts](vmware_host_feature_facts_module#ansible-collections-community-vmware-vmware-host-feature-facts-module) – Gathers facts about an ESXi host’s feature capability information
* [vmware\_host\_feature\_info](vmware_host_feature_info_module#ansible-collections-community-vmware-vmware-host-feature-info-module) – Gathers info about an ESXi host’s feature capability information
* [vmware\_host\_firewall\_facts](vmware_host_firewall_facts_module#ansible-collections-community-vmware-vmware-host-firewall-facts-module) – Gathers facts about an ESXi host’s firewall configuration information
* [vmware\_host\_firewall\_info](vmware_host_firewall_info_module#ansible-collections-community-vmware-vmware-host-firewall-info-module) – Gathers info about an ESXi host’s firewall configuration information
* [vmware\_host\_firewall\_manager](vmware_host_firewall_manager_module#ansible-collections-community-vmware-vmware-host-firewall-manager-module) – Manage firewall configurations about an ESXi host
* [vmware\_host\_hyperthreading](vmware_host_hyperthreading_module#ansible-collections-community-vmware-vmware-host-hyperthreading-module) – Enables/Disables Hyperthreading optimization for an ESXi host system
* [vmware\_host\_ipv6](vmware_host_ipv6_module#ansible-collections-community-vmware-vmware-host-ipv6-module) – Enables/Disables IPv6 support for an ESXi host system
* [vmware\_host\_iscsi](vmware_host_iscsi_module#ansible-collections-community-vmware-vmware-host-iscsi-module) – Manage the iSCSI configuration of ESXi host
* [vmware\_host\_iscsi\_info](vmware_host_iscsi_info_module#ansible-collections-community-vmware-vmware-host-iscsi-info-module) – Gather iSCSI configuration information of ESXi host
* [vmware\_host\_kernel\_manager](vmware_host_kernel_manager_module#ansible-collections-community-vmware-vmware-host-kernel-manager-module) – Manage kernel module options on ESXi hosts
* [vmware\_host\_lockdown](vmware_host_lockdown_module#ansible-collections-community-vmware-vmware-host-lockdown-module) – Manage administrator permission for the local administrative account for the ESXi host
* [vmware\_host\_logbundle](vmware_host_logbundle_module#ansible-collections-community-vmware-vmware-host-logbundle-module) – Fetch logbundle file from ESXi
* [vmware\_host\_logbundle\_info](vmware_host_logbundle_info_module#ansible-collections-community-vmware-vmware-host-logbundle-info-module) – Gathers manifest info for logbundle
* [vmware\_host\_ntp](vmware_host_ntp_module#ansible-collections-community-vmware-vmware-host-ntp-module) – Manage NTP server configuration of an ESXi host
* [vmware\_host\_ntp\_facts](vmware_host_ntp_facts_module#ansible-collections-community-vmware-vmware-host-ntp-facts-module) – Gathers facts about NTP configuration on an ESXi host
* [vmware\_host\_ntp\_info](vmware_host_ntp_info_module#ansible-collections-community-vmware-vmware-host-ntp-info-module) – Gathers info about NTP configuration on an ESXi host
* [vmware\_host\_package\_facts](vmware_host_package_facts_module#ansible-collections-community-vmware-vmware-host-package-facts-module) – Gathers facts about available packages on an ESXi host
* [vmware\_host\_package\_info](vmware_host_package_info_module#ansible-collections-community-vmware-vmware-host-package-info-module) – Gathers info about available packages on an ESXi host
* [vmware\_host\_passthrough](vmware_host_passthrough_module#ansible-collections-community-vmware-vmware-host-passthrough-module) – Manage PCI device passthrough settings on host
* [vmware\_host\_powermgmt\_policy](vmware_host_powermgmt_policy_module#ansible-collections-community-vmware-vmware-host-powermgmt-policy-module) – Manages the Power Management Policy of an ESXI host system
* [vmware\_host\_powerstate](vmware_host_powerstate_module#ansible-collections-community-vmware-vmware-host-powerstate-module) – Manages power states of host systems in vCenter
* [vmware\_host\_scanhba](vmware_host_scanhba_module#ansible-collections-community-vmware-vmware-host-scanhba-module) – Rescan host HBA’s and optionally refresh the storage system
* [vmware\_host\_scsidisk\_info](vmware_host_scsidisk_info_module#ansible-collections-community-vmware-vmware-host-scsidisk-info-module) – Gather information about SCSI disk attached to the given ESXi
* [vmware\_host\_service\_facts](vmware_host_service_facts_module#ansible-collections-community-vmware-vmware-host-service-facts-module) – Gathers facts about an ESXi host’s services
* [vmware\_host\_service\_info](vmware_host_service_info_module#ansible-collections-community-vmware-vmware-host-service-info-module) – Gathers info about an ESXi host’s services
* [vmware\_host\_service\_manager](vmware_host_service_manager_module#ansible-collections-community-vmware-vmware-host-service-manager-module) – Manage services on a given ESXi host
* [vmware\_host\_snmp](vmware_host_snmp_module#ansible-collections-community-vmware-vmware-host-snmp-module) – Configures SNMP on an ESXi host system
* [vmware\_host\_sriov](vmware_host_sriov_module#ansible-collections-community-vmware-vmware-host-sriov-module) – Manage SR-IOV settings on host
* [vmware\_host\_ssl\_facts](vmware_host_ssl_facts_module#ansible-collections-community-vmware-vmware-host-ssl-facts-module) – Gather facts of ESXi host system about SSL
* [vmware\_host\_ssl\_info](vmware_host_ssl_info_module#ansible-collections-community-vmware-vmware-host-ssl-info-module) – Gather info of ESXi host system about SSL
* [vmware\_host\_tcpip\_stacks](vmware_host_tcpip_stacks_module#ansible-collections-community-vmware-vmware-host-tcpip-stacks-module) – Manage the TCP/IP Stacks configuration of ESXi host
* [vmware\_host\_vmhba\_facts](vmware_host_vmhba_facts_module#ansible-collections-community-vmware-vmware-host-vmhba-facts-module) – Gathers facts about vmhbas available on the given ESXi host
* [vmware\_host\_vmhba\_info](vmware_host_vmhba_info_module#ansible-collections-community-vmware-vmware-host-vmhba-info-module) – Gathers info about vmhbas available on the given ESXi host
* [vmware\_host\_vmnic\_facts](vmware_host_vmnic_facts_module#ansible-collections-community-vmware-vmware-host-vmnic-facts-module) – Gathers facts about vmnics available on the given ESXi host
* [vmware\_host\_vmnic\_info](vmware_host_vmnic_info_module#ansible-collections-community-vmware-vmware-host-vmnic-info-module) – Gathers info about vmnics available on the given ESXi host
* [vmware\_local\_role\_facts](vmware_local_role_facts_module#ansible-collections-community-vmware-vmware-local-role-facts-module) – Gather facts about local roles on an ESXi host
* [vmware\_local\_role\_info](vmware_local_role_info_module#ansible-collections-community-vmware-vmware-local-role-info-module) – Gather info about local roles on an ESXi host
* [vmware\_local\_role\_manager](vmware_local_role_manager_module#ansible-collections-community-vmware-vmware-local-role-manager-module) – Manage local roles on an ESXi host
* [vmware\_local\_user\_facts](vmware_local_user_facts_module#ansible-collections-community-vmware-vmware-local-user-facts-module) – Gather facts about users on the given ESXi host
* [vmware\_local\_user\_info](vmware_local_user_info_module#ansible-collections-community-vmware-vmware-local-user-info-module) – Gather info about users on the given ESXi host
* [vmware\_local\_user\_manager](vmware_local_user_manager_module#ansible-collections-community-vmware-vmware-local-user-manager-module) – Manage local users on an ESXi host
* [vmware\_maintenancemode](vmware_maintenancemode_module#ansible-collections-community-vmware-vmware-maintenancemode-module) – Place a host into maintenance mode
* [vmware\_migrate\_vmk](vmware_migrate_vmk_module#ansible-collections-community-vmware-vmware-migrate-vmk-module) – Migrate a VMK interface from VSS to VDS
* [vmware\_object\_custom\_attributes\_info](vmware_object_custom_attributes_info_module#ansible-collections-community-vmware-vmware-object-custom-attributes-info-module) – Gather custom attributes of an object
* [vmware\_object\_rename](vmware_object_rename_module#ansible-collections-community-vmware-vmware-object-rename-module) – Renames VMware objects
* [vmware\_object\_role\_permission](vmware_object_role_permission_module#ansible-collections-community-vmware-vmware-object-role-permission-module) – Manage local roles on an ESXi host
* [vmware\_object\_role\_permission\_info](vmware_object_role_permission_info_module#ansible-collections-community-vmware-vmware-object-role-permission-info-module) – Gather information about object’s permissions
* [vmware\_portgroup](vmware_portgroup_module#ansible-collections-community-vmware-vmware-portgroup-module) – Create a VMware portgroup
* [vmware\_portgroup\_facts](vmware_portgroup_facts_module#ansible-collections-community-vmware-vmware-portgroup-facts-module) – Gathers facts about an ESXi host’s Port Group configuration
* [vmware\_portgroup\_info](vmware_portgroup_info_module#ansible-collections-community-vmware-vmware-portgroup-info-module) – Gathers info about an ESXi host’s Port Group configuration
* [vmware\_recommended\_datastore](vmware_recommended_datastore_module#ansible-collections-community-vmware-vmware-recommended-datastore-module) – Returns the recommended datastore from a SDRS-enabled datastore cluster
* [vmware\_resource\_pool](vmware_resource_pool_module#ansible-collections-community-vmware-vmware-resource-pool-module) – Add/remove resource pools to/from vCenter
* [vmware\_resource\_pool\_facts](vmware_resource_pool_facts_module#ansible-collections-community-vmware-vmware-resource-pool-facts-module) – Gathers facts about resource pool information
* [vmware\_resource\_pool\_info](vmware_resource_pool_info_module#ansible-collections-community-vmware-vmware-resource-pool-info-module) – Gathers info about resource pool information
* [vmware\_tag](vmware_tag_module#ansible-collections-community-vmware-vmware-tag-module) – Manage VMware tags
* [vmware\_tag\_info](vmware_tag_info_module#ansible-collections-community-vmware-vmware-tag-info-module) – Manage VMware tag info
* [vmware\_tag\_manager](vmware_tag_manager_module#ansible-collections-community-vmware-vmware-tag-manager-module) – Manage association of VMware tags with VMware objects
* [vmware\_target\_canonical\_facts](vmware_target_canonical_facts_module#ansible-collections-community-vmware-vmware-target-canonical-facts-module) – Return canonical (NAA) from an ESXi host system
* [vmware\_target\_canonical\_info](vmware_target_canonical_info_module#ansible-collections-community-vmware-vmware-target-canonical-info-module) – Return canonical (NAA) from an ESXi host system
* [vmware\_vc\_infraprofile\_info](vmware_vc_infraprofile_info_module#ansible-collections-community-vmware-vmware-vc-infraprofile-info-module) – List and Export VMware vCenter infra profile configs.
* [vmware\_vcenter\_settings](vmware_vcenter_settings_module#ansible-collections-community-vmware-vmware-vcenter-settings-module) – Configures general settings on a vCenter server
* [vmware\_vcenter\_settings\_info](vmware_vcenter_settings_info_module#ansible-collections-community-vmware-vmware-vcenter-settings-info-module) – Gather info vCenter settings
* [vmware\_vcenter\_statistics](vmware_vcenter_statistics_module#ansible-collections-community-vmware-vmware-vcenter-statistics-module) – Configures statistics on a vCenter server
* [vmware\_vm\_config\_option](vmware_vm_config_option_module#ansible-collections-community-vmware-vmware-vm-config-option-module) – Return supported guest ID list and VM recommended config option for specific guest OS
* [vmware\_vm\_host\_drs\_rule](vmware_vm_host_drs_rule_module#ansible-collections-community-vmware-vmware-vm-host-drs-rule-module) – Creates vm/host group in a given cluster
* [vmware\_vm\_info](vmware_vm_info_module#ansible-collections-community-vmware-vmware-vm-info-module) – Return basic info pertaining to a VMware machine guest
* [vmware\_vm\_shell](vmware_vm_shell_module#ansible-collections-community-vmware-vmware-vm-shell-module) – Run commands in a VMware guest operating system
* [vmware\_vm\_storage\_policy](vmware_vm_storage_policy_module#ansible-collections-community-vmware-vmware-vm-storage-policy-module) – Create vSphere storage policies
* [vmware\_vm\_storage\_policy\_info](vmware_vm_storage_policy_info_module#ansible-collections-community-vmware-vmware-vm-storage-policy-info-module) – Gather information about vSphere storage profile defined storage policy information.
* [vmware\_vm\_vm\_drs\_rule](vmware_vm_vm_drs_rule_module#ansible-collections-community-vmware-vmware-vm-vm-drs-rule-module) – Configure VMware DRS Affinity rule for virtual machines in the given cluster
* [vmware\_vm\_vss\_dvs\_migrate](vmware_vm_vss_dvs_migrate_module#ansible-collections-community-vmware-vmware-vm-vss-dvs-migrate-module) – Migrates a virtual machine from a standard vswitch to distributed
* [vmware\_vmkernel](vmware_vmkernel_module#ansible-collections-community-vmware-vmware-vmkernel-module) – Manages a VMware VMkernel Adapter of an ESXi host.
* [vmware\_vmkernel\_facts](vmware_vmkernel_facts_module#ansible-collections-community-vmware-vmware-vmkernel-facts-module) – Gathers VMKernel facts about an ESXi host
* [vmware\_vmkernel\_info](vmware_vmkernel_info_module#ansible-collections-community-vmware-vmware-vmkernel-info-module) – Gathers VMKernel info about an ESXi host
* [vmware\_vmkernel\_ip\_config](vmware_vmkernel_ip_config_module#ansible-collections-community-vmware-vmware-vmkernel-ip-config-module) – Configure the VMkernel IP Address
* [vmware\_vmotion](vmware_vmotion_module#ansible-collections-community-vmware-vmware-vmotion-module) – Move a virtual machine using vMotion, and/or its vmdks using storage vMotion.
* [vmware\_vsan\_cluster](vmware_vsan_cluster_module#ansible-collections-community-vmware-vmware-vsan-cluster-module) – Configure VSAN clustering on an ESXi host
* [vmware\_vsan\_health\_info](vmware_vsan_health_info_module#ansible-collections-community-vmware-vmware-vsan-health-info-module) – Gather information about a VMware vSAN cluster’s health
* [vmware\_vspan\_session](vmware_vspan_session_module#ansible-collections-community-vmware-vmware-vspan-session-module) – Create or remove a Port Mirroring session.
* [vmware\_vswitch](vmware_vswitch_module#ansible-collections-community-vmware-vmware-vswitch-module) – Manage a VMware Standard Switch to an ESXi host.
* [vmware\_vswitch\_facts](vmware_vswitch_facts_module#ansible-collections-community-vmware-vmware-vswitch-facts-module) – Gathers facts about an ESXi host’s vswitch configurations
* [vmware\_vswitch\_info](vmware_vswitch_info_module#ansible-collections-community-vmware-vmware-vswitch-info-module) – Gathers info about an ESXi host’s vswitch configurations
* [vsphere\_copy](vsphere_copy_module#ansible-collections-community-vmware-vsphere-copy-module) – Copy a file to a VMware datastore
* [vsphere\_file](vsphere_file_module#ansible-collections-community-vmware-vsphere-file-module) – Manage files on a vCenter datastore
See also
List of [collections](../../index#list-of-collections) with docs hosted here.
| programming_docs |
ansible community.vmware.vmware_host_dns_info – Gathers info about an ESXi host’s DNS configuration information community.vmware.vmware\_host\_dns\_info – Gathers info about an ESXi host’s DNS configuration information
==========================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_dns_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to gather information about an ESXi host’s DNS configuration information when ESXi hostname or Cluster name is given.
* All parameters and VMware object names are case sensitive.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster from which the ESXi host belong to. If `esxi_hostname` is not given, this parameter is required. |
| **esxi\_hostname** string | | ESXi hostname to gather information from. If `cluster_name` is not given, this parameter is required. |
| **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. |
| **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. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather DNS info about all ESXi Hosts in given Cluster
community.vmware.vmware_host_dns_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: cluster_name
delegate_to: localhost
- name: Gather DNS info about ESXi Host
community.vmware.vmware_host_dns_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **hosts\_dns\_info** dictionary | always | metadata about DNS config from given cluster / host system **Sample:** {'DC0\_C0\_H0': {'dhcp': True, 'domain\_name': 'localdomain', 'host\_name': 'localhost', 'ip\_address': ['8.8.8.8'], 'search\_domain': ['localdomain'], 'virtual\_nic\_device': 'vmk0'}} |
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_vmkernel_info – Gathers VMKernel info about an ESXi host community.vmware.vmware\_vmkernel\_info – Gathers VMKernel info about an ESXi host
==================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_vmkernel_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to gather VMKernel information about an ESXi host from given ESXi hostname or cluster name.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster. VMKernel information about each ESXi server will be returned for the given cluster. If `esxi_hostname` is not given, this parameter is required. |
| **esxi\_hostname** string | | ESXi hostname. VMKernel information about this ESXi server will be returned. If `cluster_name` is not given, this parameter is required. |
| **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. |
| **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. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather VMKernel info about all ESXi Host in given Cluster
community.vmware.vmware_vmkernel_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: cluster_name
delegate_to: localhost
register: cluster_host_vmks
- name: Gather VMKernel info about ESXi Host
community.vmware.vmware_vmkernel_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
delegate_to: localhost
register: host_vmks
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **host\_vmk\_info** dictionary | success | metadata about VMKernel present on given host system **Sample:** {'10.76.33.208': [{'device': 'vmk0', 'dhcp': True, 'enable\_ft': False, 'enable\_management': True, 'enable\_vmotion': False, 'enable\_vsan': False, 'ipv4\_address': '10.76.33.28', 'ipv4\_subnet\_mask': '255.255.255.0', 'key': 'key-vim.host.VirtualNic-vmk0', 'mac': '52:54:00:12:50:ce', 'mtu': 1500, 'portgroup': 'Management Network', 'stack': 'defaultTcpipStack'}]} |
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_vm_storage_policy_info – Gather information about vSphere storage profile defined storage policy information. community.vmware.vmware\_vm\_storage\_policy\_info – Gather information about vSphere storage profile defined storage policy information.
=========================================================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_vm_storage_policy_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Returns basic information on vSphere storage profiles.
* A vSphere storage profile defines storage policy information that describes storage requirements for virtual machines and storage capabilities of storage providers.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **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. |
| **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. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Get SPBM info
community.vmware.vmware_vm_storage_policy_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
delegate_to: localhost
register: profiles
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **spbm\_profiles** list / elements=string | success | list of dictionary of SPBM info **Sample:** [{'constraints\_sub\_profiles': [{'rule\_set\_info': [{'id': 'hostFailuresToTolerate', 'value': 1}, {'id': 'stripeWidth', 'value': 1}, {'id': 'forceProvisioning', 'value': False}, {'id': 'proportionalCapacity', 'value': 0}, {'id': 'cacheReservation', 'value': 0}], 'rule\_set\_name': 'VSAN sub-profile'}], 'description': 'Storage policy used as default for vSAN datastores', 'id': 'aa6d5a82-1c88-45da-85d3-3d74b91a5bad', 'name': 'vSAN Default Storage Policy'}] |
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_host_feature_facts – Gathers facts about an ESXi host’s feature capability information community.vmware.vmware\_host\_feature\_facts – Gathers facts about an ESXi host’s feature capability information
=================================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_feature_facts`.
* [DEPRECATED](#deprecated)
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
* [Status](#status)
DEPRECATED
----------
Removed in
major release after 2021-12-01
Why
Deprecated in favour of [community.vmware.vmware\_host\_feature\_info](vmware_host_feature_info_module#ansible-collections-community-vmware-vmware-host-feature-info-module) module.
Alternative
Use [community.vmware.vmware\_host\_feature\_info](vmware_host_feature_info_module#ansible-collections-community-vmware-vmware-host-feature-info-module) instead.
Synopsis
--------
* This module can be used to gather facts about an ESXi host’s feature capability information when ESXi hostname or Cluster name is given.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster from all host systems to be used for facts gathering. If `esxi_hostname` is not given, this parameter is required. |
| **esxi\_hostname** string | | ESXi hostname to gather facts from. If `cluster_name` is not given, this parameter is required. |
| **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. |
| **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. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather feature capability facts about all ESXi Hosts in given Cluster
community.vmware.vmware_host_feature_facts:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: cluster_name
delegate_to: localhost
register: all_cluster_hosts_facts
- name: Check if ESXi is vulnerable for Speculative Store Bypass Disable (SSBD) vulnerability
community.vmware.vmware_host_feature_facts:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
esxi_hostname: "{{ esxi_hostname }}"
register: features_set
- set_fact:
ssbd : "{{ item.value }}"
loop: "{{ features_set.host_feature_facts[esxi_hostname] |json_query(name) }}"
vars:
name: "[?key=='cpuid.SSBD']"
- assert:
that:
- ssbd|int == 1
when: ssbd is defined
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **hosts\_feature\_facts** dictionary | always | metadata about host's feature capability information **Sample:** {'10.76.33.226': [{'feature\_name': 'cpuid.3DNOW', 'key': 'cpuid.3DNOW', 'value': '0'}, {'feature\_name': 'cpuid.3DNOWPLUS', 'key': 'cpuid.3DNOWPLUS', 'value': '0'}]} |
Status
------
* This module will be removed in a major release after 2021-12-01. *[deprecated]*
* For more information see [DEPRECATED](#deprecated).
### Authors
* Abhijeet Kasurde (@Akasurde)
| programming_docs |
ansible community.vmware.vmware_dvs_host – Add or remove a host from distributed virtual switch community.vmware.vmware\_dvs\_host – Add or remove a host from distributed virtual switch
=========================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_dvs_host`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Manage a host system from distributed virtual switch.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **esxi\_hostname** string / required | | The ESXi hostname. |
| **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. |
| **lag\_uplinks** list / elements=dictionary added in 1.12.0 of community.vmware | | The ESXi hosts vmnics to use with specific LAGs. |
| | **lag** string / required | | Name of the LAG. |
| | **vmnics** list / elements=string | | The ESXi hosts vmnics to use with the LAG. |
| **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. |
| **state** string | **Choices:*** **present** ←
* absent
| If the host should be present or absent attached to the vSwitch. |
| **switch\_name** string / required | | The name of the Distributed vSwitch. |
| **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. |
| **vendor\_specific\_config** list / elements=dictionary | | List of key, value dictionaries for the Vendor Specific Configuration. |
| | **key** string / required | | Key of setting. |
| | **value** string / required | | Value of setting. |
| **vmnics** list / elements=string | | The ESXi hosts vmnics to use with the Distributed vSwitch. |
Notes
-----
Note
* Tested on vSphere 5.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Add Host to dVS
community.vmware.vmware_dvs_host:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
switch_name: dvSwitch
vmnics:
- vmnic0
- vmnic1
state: present
delegate_to: localhost
- name: Add vmnics to LAGs
community.vmware.vmware_dvs_host:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
switch_name: dvSwitch
lag_uplinks:
- lag: lag1
vmnics:
- vmnic0
- vmnic1
- lag: lag2
vmnics:
- vmnic2
- vmnic3
state: present
delegate_to: localhost
- name: Add Host to dVS/enable learnswitch (https://labs.vmware.com/flings/learnswitch)
community.vmware.vmware_dvs_host:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
switch_name: dvSwitch
vendor_specific_config:
- key: com.vmware.netoverlay.layer1
value: learnswitch
vmnics:
- vmnic0
- vmnic1
state: present
delegate_to: localhost
```
### Authors
* Joseph Callen (@jcpowermac)
* Abhijeet Kasurde (@Akasurde)
* Joseph Andreatta (@vmwjoseph)
ansible community.vmware.vmware_dns_config – Manage VMware ESXi DNS Configuration community.vmware.vmware\_dns\_config – Manage VMware ESXi DNS Configuration
===========================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_dns_config`.
* [DEPRECATED](#deprecated)
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Status](#status)
DEPRECATED
----------
Removed in
major release after 2022-06-01
Why
Will be replaced with new module [community.vmware.vmware\_host\_dns](vmware_host_dns_module#ansible-collections-community-vmware-vmware-host-dns-module).
Alternative
Use [community.vmware.vmware\_host\_dns](vmware_host_dns_module#ansible-collections-community-vmware-vmware-host-dns-module) instead.
Synopsis
--------
* Manage VMware ESXi DNS Configuration
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **change\_hostname\_to** string / required | | The hostname that an ESXi host should be changed to. |
| **dns\_servers** list / elements=string / required | | The DNS servers that the host should be configured to use. |
| **domainname** string / required | | The domain the ESXi host should be apart of. |
| **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. |
| **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. |
| **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 on vSphere 5.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Configure ESXi hostname and DNS servers
community.vmware.vmware_dns_config:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
change_hostname_to: esx01
domainname: foo.org
dns_servers:
- 8.8.8.8
- 8.8.4.4
delegate_to: localhost
```
Status
------
* This module will be removed in a major release after 2022-06-01. *[deprecated]*
* For more information see [DEPRECATED](#deprecated).
### Authors
* Joseph Callen (@jcpowermac)
ansible community.vmware.vmware_host_acceptance – Manage the host acceptance level of an ESXi host community.vmware.vmware\_host\_acceptance – Manage the host acceptance level of an ESXi host
============================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_acceptance`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to manage the host acceptance level of an ESXi host.
* The host acceptance level controls the acceptance level of each VIB on a ESXi host.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **acceptance\_level** string | **Choices:*** community
* partner
* vmware\_accepted
* vmware\_certified
| Name of acceptance level. If set to `partner`, then accept only partner and VMware signed and certified VIBs. If set to `vmware_certified`, then accept only VIBs that are signed and certified by VMware. If set to `vmware_accepted`, then accept VIBs that have been accepted by VMware. If set to `community`, then accept all VIBs, even those that are not signed. |
| **cluster\_name** string | | Name of the cluster. Acceptance level of all ESXi host system in the given cluster will be managed. If `esxi_hostname` is not given, this parameter is required. |
| **esxi\_hostname** string | | ESXi hostname. Acceptance level of this ESXi host system will be managed. If `cluster_name` is not given, this parameter is required. |
| **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. |
| **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. |
| **state** string | **Choices:*** **list** ←
* present
| Set or list acceptance level of the given ESXi host. If set to `list`, then will return current acceptance level of given host system/s. If set to `present`, then will set given acceptance level. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Set acceptance level to community for all ESXi Host in given Cluster
community.vmware.vmware_host_acceptance:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: cluster_name
acceptance_level: 'community'
state: present
delegate_to: localhost
register: cluster_acceptance_level
- name: Set acceptance level to vmware_accepted for the given ESXi Host
community.vmware.vmware_host_acceptance:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
acceptance_level: 'vmware_accepted'
state: present
delegate_to: localhost
register: host_acceptance_level
- name: Get acceptance level from the given ESXi Host
community.vmware.vmware_host_acceptance:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
state: list
delegate_to: localhost
register: host_acceptance_level
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **facts** dictionary | facts | dict with hostname as key and dict with acceptance level facts, error as value **Sample:** {'facts': {'localhost.localdomain': {'error': 'NA', 'level': 'vmware\_certified'}}} |
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_vm_shell – Run commands in a VMware guest operating system community.vmware.vmware\_vm\_shell – Run commands in a VMware guest operating system
====================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_vm_shell`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Module allows user to run common system administration commands in the guest operating system.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster** string | | The cluster hosting the virtual machine. If set, it will help to speed up virtual machine search. |
| **datacenter** string | | The datacenter hosting the virtual machine. If set, it will help to speed up virtual machine search. |
| **folder** string | | Destination folder, absolute or relative path to find an existing guest or create the new guest. The folder should include the datacenter. ESX's datacenter is ha-datacenter. Examples: folder: /ha-datacenter/vm folder: ha-datacenter/vm folder: /datacenter1/vm folder: datacenter1/vm folder: /datacenter1/vm/folder1 folder: datacenter1/vm/folder1 folder: /folder1/datacenter1/vm folder: folder1/datacenter1/vm folder: /folder1/datacenter1/vm/folder2 |
| **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. |
| **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. |
| **timeout** integer | **Default:**3600 | Timeout in seconds. If set to positive integers, then `wait_for_process` will honor this parameter and will exit after this timeout. |
| **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. |
| **vm\_id** string / required | | Name of the virtual machine to work with. |
| **vm\_id\_type** string | **Choices:*** uuid
* instance\_uuid
* dns\_name
* inventory\_path
* **vm\_name** ←
| The VMware identification method by which the virtual machine will be identified. |
| **vm\_password** string / required | | The password used to login-in to the virtual machine. |
| **vm\_shell** string / required | | The absolute path to the program to start. On Linux, shell is executed via bash. |
| **vm\_shell\_args** string | **Default:**" " | The argument to the program. The characters which must be escaped to the shell also be escaped on the command line provided. |
| **vm\_shell\_cwd** string | | The current working directory of the application from which it will be run. |
| **vm\_shell\_env** list / elements=string | | Comma separated list of environment variable, specified in the guest OS notation. |
| **vm\_username** string / required | | The user to login-in to the virtual machine. |
| **wait\_for\_process** boolean | **Choices:*** **no** ←
* yes
| If set to `True`, module will wait for process to complete in the given virtual machine. |
Notes
-----
Note
* Tested on vSphere 5.5, 6.0 and 6.5.
* Only the first match against vm\_id is used, even if there are multiple matches.
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Run command inside a virtual machine
community.vmware.vmware_vm_shell:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter }}"
folder: "/{{datacenter}}/vm"
vm_id: "{{ vm_name }}"
vm_username: root
vm_password: superSecret
vm_shell: /bin/echo
vm_shell_args: " $var >> myFile "
vm_shell_env:
- "PATH=/bin"
- "VAR=test"
vm_shell_cwd: "/tmp"
delegate_to: localhost
register: shell_command_output
- name: Run command inside a virtual machine with wait and timeout
community.vmware.vmware_vm_shell:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter }}"
folder: "/{{datacenter}}/vm"
vm_id: NameOfVM
vm_username: root
vm_password: superSecret
vm_shell: /bin/sleep
vm_shell_args: 100
wait_for_process: True
timeout: 2000
delegate_to: localhost
register: shell_command_with_wait_timeout
- name: Change user password in the guest machine
community.vmware.vmware_vm_shell:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter }}"
folder: "/{{datacenter}}/vm"
vm_id: "{{ vm_name }}"
vm_username: sample
vm_password: old_password
vm_shell: "/bin/echo"
vm_shell_args: "-e 'old_password\nnew_password\nnew_password' | passwd sample > /tmp/$$.txt 2>&1"
delegate_to: localhost
- name: Change hostname of guest machine
community.vmware.vmware_vm_shell:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter }}"
folder: "/{{datacenter}}/vm"
vm_id: "{{ vm_name }}"
vm_username: testUser
vm_password: SuperSecretPassword
vm_shell: "/usr/bin/hostnamectl"
vm_shell_args: "set-hostname new_hostname > /tmp/$$.txt 2>&1"
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **results** dictionary | on success | metadata about the new process after completion with wait\_for\_process **Sample:** {'cmd\_line': '"/bin/sleep" 1', 'end\_time': '2018-04-26T05:03:21+00:00', 'exit\_code': 0, 'name': 'sleep', 'owner': 'dev1', 'start\_time': '2018-04-26T05:03:19+00:00', 'uuid': '564db1e2-a3ff-3b0e-8b77-49c25570bb66'} |
### Authors
* Ritesh Khadgaray (@ritzk)
* Abhijeet Kasurde (@Akasurde)
| programming_docs |
ansible community.vmware.vmware_host_service_info – Gathers info about an ESXi host’s services community.vmware.vmware\_host\_service\_info – Gathers info about an ESXi host’s services
=========================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_service_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to gather information about an ESXi host’s services.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster. Service information about each ESXi server will be returned for given cluster. If `esxi_hostname` is not given, this parameter is required. |
| **esxi\_hostname** string | | ESXi hostname. Service information about this ESXi server will be returned. If `cluster_name` is not given, this parameter is required. |
| **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. |
| **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. |
| **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 on vSphere 6.5
* If source package name is not available then fact is populated as null.
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather info about all ESXi Host in given Cluster
community.vmware.vmware_host_service_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: cluster_name
delegate_to: localhost
register: cluster_host_services
- name: Gather info about ESXi Host
community.vmware.vmware_host_service_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
delegate_to: localhost
register: host_services
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **host\_service\_info** dictionary | always | dict with hostname as key and dict with host service config information **Sample:** {'10.76.33.226': [{'key': 'DCUI', 'label': 'Direct Console UI', 'policy': 'on', 'required': False, 'running': True, 'source\_package\_desc': 'This VIB contains all of the base functionality of vSphere ESXi.', 'source\_package\_name': 'esx-base', 'uninstallable': False}, {'key': 'TSM', 'label': 'ESXi Shell', 'policy': 'off', 'required': False, 'running': False, 'source\_package\_desc': 'This VIB contains all of the base functionality of vSphere ESXi.', 'source\_package\_name': 'esx-base', 'uninstallable': False}]} |
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_host_config_facts – Gathers facts about an ESXi host’s advance configuration information community.vmware.vmware\_host\_config\_facts – Gathers facts about an ESXi host’s advance configuration information
===================================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_config_facts`.
* [DEPRECATED](#deprecated)
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
* [Status](#status)
DEPRECATED
----------
Removed in
major release after 2021-12-01
Why
Deprecated in favour of [community.vmware.vmware\_host\_config\_info](vmware_host_config_info_module#ansible-collections-community-vmware-vmware-host-config-info-module) module.
Alternative
Use [community.vmware.vmware\_host\_config\_info](vmware_host_config_info_module#ansible-collections-community-vmware-vmware-host-config-info-module) instead.
Synopsis
--------
* This module can be used to gather facts about an ESXi host’s advance configuration information when ESXi hostname or Cluster name is given.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster from which the ESXi host belong to. If `esxi_hostname` is not given, this parameter is required. |
| **esxi\_hostname** string | | ESXi hostname to gather facts from. If `cluster_name` is not given, this parameter is required. |
| **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. |
| **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. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather facts about all ESXi Host in given Cluster
community.vmware.vmware_host_config_facts:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: cluster_name
delegate_to: localhost
- name: Gather facts about ESXi Host
community.vmware.vmware_host_config_facts:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **hosts\_facts** dictionary | always | dict with hostname as key and dict with host config facts **Sample:** {'10.76.33.226': {'Annotations.WelcomeMessage': '', 'BufferCache.FlushInterval': 30000, 'BufferCache.HardMaxDirty': 95, 'BufferCache.PerFileHardMaxDirty': 50, 'BufferCache.SoftMaxDirty': 15}} |
Status
------
* This module will be removed in a major release after 2021-12-01. *[deprecated]*
* For more information see [DEPRECATED](#deprecated).
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_guest_register_operation – VM inventory registration operation community.vmware.vmware\_guest\_register\_operation – VM inventory registration operation
=========================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_guest_register_operation`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module can register or unregister VMs to the inventory.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster** string | | Specify a cluster name to register VM. |
| **datacenter** string | **Default:**"ha-datacenter" | Destination datacenter for the register/unregister operation. This parameter is case sensitive. |
| **esxi\_hostname** string | | The ESXi hostname where the virtual machine will run. This parameter is case sensitive. |
| **folder** string | | Description folder, absolute path of the target folder. The folder should include the datacenter. ESX's datacenter is ha-datacenter. This parameter is case sensitive. Examples: folder: /ha-datacenter/vm folder: ha-datacenter/vm folder: /datacenter1/vm folder: datacenter1/vm folder: /datacenter1/vm/folder1 folder: datacenter1/vm/folder1 |
| **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. |
| **name** string / required | | Specify VM name to be registered in the inventory. |
| **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 |
| **path** string | | Specify the path of vmx file. Examples: [datastore1] vm/vm.vmx [datastore1] vm/vm.vmtx |
| **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. |
| **resource\_pool** string | | Specify a resource pool name to register VM. This parameter is case sensitive. Resource pool should be child of the selected host parent. |
| **state** string | **Choices:*** **present** ←
* absent
| Specify the state the virtual machine should be in. if set to `present`, register VM in inventory. if set to `absent`, unregister VM from inventory. |
| **template** boolean | **Choices:*** **no** ←
* yes
| Whether to register VM as a template. |
| **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 |
| **uuid** string | | UUID of the virtual machine to manage if known, this is VMware's unique identifier. If virtual machine does not exists, then this parameter is ignored. |
| **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
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Register VM to inventory
community.vmware.vmware_guest_register_operation:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter }}"
folder: "/vm"
esxi_hostname: "{{ esxi_hostname }}"
name: "{{ vm_name }}"
template: false
path: "[datastore1] vm/vm.vmx"
state: present
- name: Register VM in resource pool
community.vmware.vmware_guest_register_operation:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter }}"
folder: "/vm"
resource_pool: "{{ resource_pool }}"
name: "{{ vm_name }}"
template: false
path: "[datastore1] vm/vm.vmx"
state: present
- name: Register VM in Cluster
community.vmware.vmware_guest_register_operation:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter }}"
folder: "/vm"
cluster: "{{ cluster_name }}"
name: "{{ vm_name }}"
template: false
path: "[datastore1] vm/vm.vmx"
state: present
- name: UnRegister VM from inventory
community.vmware.vmware_guest_register_operation:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter }}"
folder: "/vm"
name: "{{ vm_name }}"
state: absent
```
### Authors
* sky-joker (@sky-joker)
ansible community.vmware.vmware_vspan_session – Create or remove a Port Mirroring session. community.vmware.vmware\_vspan\_session – Create or remove a Port Mirroring session.
====================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_vspan_session`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module can be used to create, delete or edit different kind of port mirroring sessions.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python > = 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **description** string | | The description for the session. |
| **destination\_port** string | | Destination port that received the mirrored packets. Also any port designated in the value of this property can not match the source port in any of the Distributed Port Mirroring session. |
| **destination\_vm** dictionary | | With this parameter it is possible, to add a NIC of a VM to a port mirroring session. |
| | **name** string | | Name of the VM. |
| | **nic\_label** string | | Label of the network interface card to use. |
| **enabled** boolean | **Choices:*** no
* **yes** ←
| Whether the session is enabled. |
| **encapsulation\_vlan\_id** integer | | VLAN ID used to encapsulate the mirrored traffic. |
| **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. |
| **mirrored\_packet\_length** integer | | An integer that describes how much of each frame to mirror. If unset, all of the frame would be mirrored. Setting this property to a smaller value is useful when the consumer will look only at the headers. The value cannot be less than 60. |
| **name** string / required | | Name of the session. |
| **normal\_traffic\_allowed** boolean | **Choices:*** no
* yes
| Whether or not destination ports can send and receive "normal" traffic. Setting this to false will make mirror ports be used solely for mirroring and not double as normal access ports. |
| **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. |
| **sampling\_rate** integer | | Sampling rate of the session. If its value is n, one of every n packets is mirrored. Valid values are between 1 to 65535. |
| **session\_type** string | **Choices:*** encapsulatedRemoteMirrorSource
* remoteMirrorDest
* remoteMirrorSource
* **dvPortMirror** ←
| Select the mirroring type. In `encapsulatedRemoteMirrorSource` session, Distributed Ports can be used as source entities, and IP address can be used as destination entities. In `remoteMirrorDest` session, VLAN IDs can be used as source entities, and Distributed Ports can be used as destination entities. In `remoteMirrorSource` session, Distributed Ports can be used as source entities, and uplink ports name can be used as destination entities. In `dvPortMirror` session, Distributed Ports can be used as both source and destination entities. |
| **source\_port\_received** string | | Source port for which received packets are mirrored. |
| **source\_port\_transmitted** string | | Source port for which transmitted packets are mirrored. |
| **source\_vm\_received** dictionary | | With this parameter it is possible, to add a NIC of a VM to a port mirroring session. |
| | **name** string | | Name of the VM. |
| | **nic\_label** string | | Label of the network interface card to use. |
| **source\_vm\_transmitted** dictionary | | With this parameter it is possible, to add a NIC of a VM to a port mirroring session. |
| | **name** string | | Name of the VM. |
| | **nic\_label** string | | Label of the network interface card to use. |
| **state** string / required | **Choices:*** present
* absent
| Create or remove the session. |
| **strip\_original\_vlan** boolean | **Choices:*** no
* yes
| Whether to strip the original VLAN tag. If false, the original VLAN tag will be preserved on the mirrored traffic. If `encapsulationVlanId` has been set and this property is false, the frames will be double tagged with the original VLAN ID as the inner tag. |
| **switch** string / required | | The name of the distributed vSwitch on which to add or remove the mirroring session.
aliases: switch\_name |
| **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 on vSphere 6.7
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Create distributed mirroring session.
community.vmware.vmware_vspan_session:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
switch_name: dvSwitch
state: present
name: Basic Session
enabled: True
description: "Example description"
source_port_transmitted: 817
source_port_received: 817
destination_port: 815
delegate_to: localhost
- name: Create remote destination mirroring session.
community.vmware.vmware_vspan_session:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
switch_name: dvSwitch
state: present
name: Remote Session
enabled: True
description: "Example description"
source_port_received: 105
destination_port: 815
session_type: "remoteMirrorDest"
delegate_to: localhost
- name: Create remote destination mirroring session.
community.vmware.vmware_vspan_session:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
switch_name: dvSwitch
state: absent
name: Remote Session
delegate_to: localhost
```
### Authors
* Peter Gyorgy (@gyorgypeter)
| programming_docs |
ansible community.vmware.vmware_host_dns – Manage DNS configuration of an ESXi host system community.vmware.vmware\_host\_dns – Manage DNS configuration of an ESXi host system
====================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_dns`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to configure DNS for the default TCP/IP stack on an ESXi host system.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster from which all host systems will be used. This parameter is required if `esxi_hostname` is not specified and you connect to a vCenter. Cannot be used when you connect directly to an ESXi host. |
| **device** string | | The VMkernel network adapter to obtain DNS settings from. Needs to get its IP through DHCP, a static network configuration combined with a dynamic DNS configuration doesn't work. The parameter is only required in case of `type` is set to `dhcp`. |
| **dns\_servers** list / elements=string | | A list of DNS servers to be used. The order of the DNS servers is important as they are used consecutively in order. |
| **domain** string | | The domain name to be used for the ESXi host. |
| **esxi\_hostname** string | | Name of the host system to work with. This parameter is required if `cluster_name` is not specified and you connect to a vCenter. Cannot be used when you connect directly to an ESXi host. |
| **host\_name** string | | The hostname to be used for the ESXi host. Cannot be used when configuring a complete cluster. |
| **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. |
| **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. |
| **search\_domains** list / elements=string | | A list of domains to be searched through by the resolver. |
| **type** string / required | **Choices:*** dhcp
* static
| Type of DNS assignment. Either `dhcp` or `static`. A VMkernel adapter needs to be set to DHCP if `type` is set to `dhcp`. |
| **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. |
| **verbose** boolean | **Choices:*** **no** ←
* yes
| Verbose output of the DNS server configuration change. Explains if an DNS server was added, removed, or if the DNS server sequence was changed. |
Notes
-----
Note
* This module is a replacement for the module `vmware_dns_config`
* Tested on vSphere 6.7
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Configure DNS for an ESXi host
community.vmware.vmware_host_dns:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
type: static
host_name: esx01
domain: example.local
dns_servers:
- 192.168.1.10
- 192.168.1.11
search_domains:
- subdomain.example.local
- example.local
delegate_to: localhost
- name: Configure DNS for all ESXi hosts of a cluster
community.vmware.vmware_host_dns:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: '{{ cluster_name }}'
type: static
domain: example.local
dns_servers:
- 192.168.1.10
- 192.168.1.11
search_domains:
- subdomain.example.local
- example.local
delegate_to: localhost
- name: Configure DNS via DHCP for an ESXi host
community.vmware.vmware_host_dns:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
type: dhcp
device: vmk0
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **dns\_config\_result** dictionary | always | metadata about host system's DNS configuration **Sample:** {'esx01.example.local': {'changed': True, 'dns\_servers': ['192.168.1.10', '192.168.1.11'], 'dns\_servers\_changed': ['192.168.1.12', '192.168.1.13'], 'dns\_servers\_previous': ['192.168.1.10', '192.168.1.11', '192.168.1.12', '192.168.1.13'], 'domain': 'example.local', 'host\_name': 'esx01', 'msg': 'DNS servers and Search domains changed', 'search\_domains': ['subdomain.example.local', 'example.local'], 'search\_domains\_changed': ['subdomain.example.local'], 'search\_domains\_previous': ['example.local']}} |
### Authors
* Christian Kotte (@ckotte)
* Mario Lenz (@mariolenz)
ansible community.vmware.vmware_guest_disk – Manage disks related to virtual machine in given vCenter infrastructure community.vmware.vmware\_guest\_disk – Manage disks related to virtual machine in given vCenter infrastructure
==============================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_guest_disk`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to add, remove and update disks belonging to given virtual machine.
* All parameters and VMware object names are case sensitive.
* This module is destructive in nature, please read documentation carefully before proceeding.
* Be careful while removing disk specified as this may lead to data loss.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **datacenter** string / required | | The datacenter name to which virtual machine belongs to. |
| **disk** list / elements=dictionary | **Default:**[] | A list of disks to add or remove. The virtual disk related information is provided using this list. All values and parameters are case sensitive. |
| | **autoselect\_datastore** boolean | **Choices:*** no
* yes
| Select the less used datastore. Specify only if `datastore` is not specified. |
| | **compatibility\_mode** string | **Choices:*** physicalMode
* virtualMode
| Compatibility mode for raw devices. Required for disk type 'rdm' |
| | **controller\_number** integer | **Choices:*** 0
* 1
* 2
* 3
| This parameter is used with `controller_type` for specifying controller bus number. |
| | **controller\_type** string | **Choices:*** buslogic
* lsilogic
* lsilogicsas
* paravirtual
* sata
* nvme
| This parameter is added for managing disks attaching other types of controllers, e.g., SATA or NVMe. If either `controller_type` or `scsi_type` is not specified, then use `paravirtual` type. |
| | **datastore** string | | Name of datastore or datastore cluster to be used for the disk. |
| | **destroy** boolean | **Choices:*** no
* **yes** ←
| If `state` is `absent`, make sure the disk file is deleted from the datastore. Added in version 2.10. |
| | **disk\_mode** string | **Choices:*** persistent
* independent\_persistent
* independent\_nonpersistent
| Type of disk mode. If not specified then use `persistent` mode for new disk. If set to 'persistent' mode, changes are immediately and permanently written to the virtual disk. If set to 'independent\_persistent' mode, same as persistent, but not affected by snapshots. If set to 'independent\_nonpersistent' mode, changes to virtual disk are made to a redo log and discarded at power off, but not affected by snapshots. |
| | **filename** string | | Existing disk image to be used. Filename must already exist on the datastore. Specify filename string in `[datastore_name] path/to/file.vmdk` format. Added in version 2.10. |
| | **iolimit** dictionary | | Section specifies the shares and limit for storage I/O resource. |
| | | **limit** integer | | Section specifies values for limit where the utilization of a virtual machine will not exceed, even if there are available resources. |
| | | **shares** dictionary | | Specifies different types of shares user can add for the given disk. |
| | | | **level** string | **Choices:*** low
* normal
* high
* custom
| Specifies different level for the shares section. |
| | | | **level\_value** integer | | Custom value when `level` is set as `custom`. |
| | **rdm\_path** string added in 1.12.0 of community.vmware | | Path of LUN for Raw Device Mapping required for disk type `rdm`. Only valid is `type` is set to `rdm`. |
| | **scsi\_controller** integer | **Choices:*** 0
* 1
* 2
* 3
| SCSI controller number. Only 4 SCSI controllers are allowed per VM. Care should be taken while specifying 'scsi\_controller' is 0 and 'unit\_number' as 0 as this disk may contain OS. |
| | **scsi\_type** string | **Choices:*** buslogic
* lsilogic
* lsilogicsas
* paravirtual
| Type of SCSI controller. This value is required only for the first occurrence of SCSI Controller. This value is ignored, if SCSI Controller is already present or `state` is `absent`. |
| | **shares** dictionary | | Section for iolimit section tells about what are all different types of shares user can add for disk. |
| | | **level** string | **Choices:*** low
* normal
* high
* custom
| Tells about different level for the shares section. |
| | | **level\_value** integer | | Custom value when `level` is set as `custom`. |
| | **sharing** boolean | **Choices:*** **no** ←
* yes
| This parameter is not available for Raw Device Mapping(RDM). The sharing mode of the virtual disk. Setting sharing means that multiple virtual machines can write to the virtual disk. Sharing can only be set if `type` is set to `eagerzeroedthick`. |
| | **size** string | | Disk storage size. If size specified then unit must be specified. There is no space allowed in between size number and unit. Only first occurrence in disk element will be considered, even if there are multiple size\* parameters available. |
| | **size\_gb** integer | | Disk storage size in gb. |
| | **size\_kb** integer | | Disk storage size in kb. |
| | **size\_mb** integer | | Disk storage size in mb. |
| | **size\_tb** integer | | Disk storage size in tb. |
| | **state** string | **Choices:*** **present** ←
* absent
| State of disk. If set to 'absent', disk will be removed permanently from virtual machine configuration and from VMware storage. If set to 'present', disk will be added if not present at given Controller and Unit Number. or disk exists with different size, disk size is increased, reducing disk size is not allowed. |
| | **type** string | **Choices:*** thin
* eagerzeroedthick
* thick
* rdm
| The type of disk, if not specified then use `thick` type for new disk, no eagerzero. The disk type `rdm` is added in version 1.13.0. |
| | **unit\_number** integer / required | | Disk Unit Number. Valid value range from 0 to 15, except 7 for SCSI Controller. Valid value range from 0 to 29 for SATA controller. Valid value range from 0 to 14 for NVME controller. |
| **folder** string | | Destination folder, absolute or relative path to find an existing guest. This is a required parameter, only if multiple VMs are found with same name. The folder should include the datacenter. ESX's datacenter is ha-datacenter Examples: folder: /ha-datacenter/vm folder: ha-datacenter/vm folder: /datacenter1/vm folder: datacenter1/vm folder: /datacenter1/vm/folder1 folder: datacenter1/vm/folder1 folder: /folder1/datacenter1/vm folder: folder1/datacenter1/vm folder: /folder1/datacenter1/vm/folder2 |
| **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. |
| **moid** string | | Managed Object ID of the instance to manage if known, this is a unique identifier only within a single vCenter instance. This is required if `name` or `uuid` is not supplied. |
| **name** string | | Name of the virtual machine. This is a required parameter, if parameter `uuid` or `moid` is not supplied. |
| **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. |
| **use\_instance\_uuid** boolean | **Choices:*** **no** ←
* yes
| Whether to use the VMware instance UUID rather than the BIOS UUID. |
| **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 |
| **uuid** string | | UUID of the instance to gather facts if known, this is VMware's unique identifier. This is a required parameter, if parameter `name` or `moid` is not supplied. |
| **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 on vSphere 6.0 and 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Add disks to virtual machine using UUID
community.vmware.vmware_guest_disk:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
uuid: 421e4592-c069-924d-ce20-7e7533fab926
disk:
- size_mb: 10
type: thin
datastore: datacluster0
state: present
scsi_controller: 1
unit_number: 1
scsi_type: 'paravirtual'
disk_mode: 'persistent'
- size_gb: 10
type: eagerzeroedthick
state: present
autoselect_datastore: True
scsi_controller: 2
scsi_type: 'buslogic'
unit_number: 12
disk_mode: 'independent_persistent'
- size: 10Gb
type: eagerzeroedthick
state: present
autoselect_datastore: True
scsi_controller: 2
scsi_type: 'buslogic'
unit_number: 1
disk_mode: 'independent_nonpersistent'
- filename: "[datastore1] path/to/existing/disk.vmdk"
delegate_to: localhost
register: disk_facts
- name: Add disks with specified shares to the virtual machine
community.vmware.vmware_guest_disk:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
disk:
- size_gb: 1
type: thin
datastore: datacluster0
state: present
scsi_controller: 1
unit_number: 1
disk_mode: 'independent_persistent'
shares:
level: custom
level_value: 1300
delegate_to: localhost
register: test_custom_shares
- name: Add physical raw device mapping to virtual machine using name
community.vmware.vmware_guest_disk:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
validate_certs: no
name: "Test_VM"
disk:
- type: rdm
state: present
scsi_controller: 1
unit_number: 5
rdm_path: /vmfs/devices/disks/naa.060000003b1234efb453
compatibility_mode: 'physicalMode'
- name: Add virtual raw device mapping to virtual machine using name and virtual mode
community.vmware.vmware_guest_disk:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
validate_certs: no
name: "Test_VM"
disk:
- type: rdm
state: present
scsi_controller: 1
unit_number: 5
rdm_path: /vmfs/devices/disks/naa.060000003b1234efb453
compatibility_mode: 'virtualMode'
disk_mode: 'persistent'
- name: create new disk with custom IO limits and shares in IO Limits
community.vmware.vmware_guest_disk:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
disk:
- size_gb: 1
type: thin
datastore: datacluster0
state: present
scsi_controller: 1
unit_number: 1
disk_mode: 'independent_persistent'
iolimit:
limit: 1506
shares:
level: custom
level_value: 1305
delegate_to: localhost
register: test_custom_IoLimit_shares
- name: Remove disks from virtual machine using name
community.vmware.vmware_guest_disk:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
name: VM_225
disk:
- state: absent
scsi_controller: 1
unit_number: 1
delegate_to: localhost
register: disk_facts
- name: Remove disk from virtual machine using moid
community.vmware.vmware_guest_disk:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
moid: vm-42
disk:
- state: absent
scsi_controller: 1
unit_number: 1
delegate_to: localhost
register: disk_facts
- name: Remove disk from virtual machine but keep the VMDK file on the datastore
community.vmware.vmware_guest_disk:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
name: VM_225
disk:
- state: absent
scsi_controller: 1
unit_number: 2
destroy: no
delegate_to: localhost
register: disk_facts
- name: Add disks to virtual machine using UUID to SATA and NVMe controller
community.vmware.vmware_guest_disk:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
validate_certs: no
uuid: 421e4592-c069-924d-ce20-7e7533fab926
disk:
- size_mb: 256
type: thin
datastore: datacluster0
state: present
controller_type: sata
controller_number: 1
unit_number: 1
disk_mode: 'persistent'
- size_gb: 1
state: present
autoselect_datastore: True
controller_type: nvme
controller_number: 2
unit_number: 3
disk_mode: 'independent_persistent'
delegate_to: localhost
register: disk_facts
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **disk\_status** dictionary | always | metadata about the virtual machine's disks after managing them **Sample:** {'0': {'backing\_datastore': 'datastore2', 'backing\_disk\_mode': 'persistent', 'backing\_eagerlyscrub': False, 'backing\_filename': '[datastore2] VM\_225/VM\_225.vmdk', 'backing\_thinprovisioned': False, 'backing\_uuid': '421e4592-c069-924d-ce20-7e7533fab926', 'backing\_writethrough': False, 'capacity\_in\_bytes': 10485760, 'capacity\_in\_kb': 10240, 'controller\_key': 1000, 'key': 2000, 'label': 'Hard disk 1', 'summary': '10,240 KB', 'unit\_number': 0}} |
### Authors
* Abhijeet Kasurde (@Akasurde) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#2c4d474d5f595e48490a0f1f1b170a0f191e170a0f1814175e4948444d580a0f181a174f4341)>
| programming_docs |
ansible community.vmware.vmware_host – Add, remove, or move an ESXi host to, from, or within vCenter community.vmware.vmware\_host – Add, remove, or move an ESXi host to, from, or within vCenter
=============================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to add, reconnect, or remove an ESXi host to or from vCenter.
* This module can also be used to move an ESXi host to a cluster or folder, or vice versa, within the same datacenter.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
* ssl
* socket
* hashlib
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **add\_connected** boolean | **Choices:*** no
* **yes** ←
| If set to `True`, then the host should be connected as soon as it is added. This parameter is ignored if state is set to a value other than `present`. |
| **cluster\_name** string | | Name of the cluster to add the host. If `folder` is not set, then this parameter is required. Aliases added in version 2.6.
aliases: cluster |
| **datacenter\_name** string / required | | Name of the datacenter to add the host. Aliases added in version 2.6.
aliases: datacenter |
| **esxi\_hostname** string / required | | ESXi hostname to manage. |
| **esxi\_password** string | | ESXi password. Required for adding a host. Optional for reconnect. Unused for removing. No longer a required parameter from version 2.5. |
| **esxi\_ssl\_thumbprint** string | **Default:**"" | Specifying the hostsystem certificate's thumbprint. Use following command to get hostsystem certificate's thumbprint - # openssl x509 -in /etc/vmware/ssl/rui.crt -fingerprint -sha1 -noout Only used if `fetch_thumbprint` isn't set to `true`.
aliases: ssl\_thumbprint |
| **esxi\_username** string | | ESXi username. Required for adding a host. Optional for reconnect. If both `esxi_username` and `esxi_password` are used Unused for removing. No longer a required parameter from version 2.5. |
| **fetch\_ssl\_thumbprint** boolean | **Choices:*** no
* **yes** ←
| Fetch the thumbprint of the host's SSL certificate. This basically disables the host certificate verification (check if it was signed by a recognized CA). Disable this option if you want to allow only hosts with valid certificates to be added to vCenter. If this option is set to `false` and the certificate can't be verified, an add or reconnect will fail. Unused when `esxi_ssl_thumbprint` is set. Optional for reconnect, but only used if `esxi_username` and `esxi_password` are used. Unused for removing. |
| **folder** string | | Name of the folder under which host to add. If `cluster_name` is not set, then this parameter is required. For example, if there is a datacenter 'dc1' under folder called 'Site1' then, this value will be '/Site1/dc1/host'. Here 'host' is an invisible folder under VMware Web Client. Another example, if there is a nested folder structure like '/myhosts/india/pune' under datacenter 'dc2', then `folder` value will be '/dc2/host/myhosts/india/pune'. Other Examples: '/Site2/dc2/Asia-Cluster/host' or '/dc3/Asia-Cluster/host'
aliases: folder\_name |
| **force\_connection** boolean | **Choices:*** no
* **yes** ←
| Force the connection if the host is already being managed by another vCenter server. |
| **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. |
| **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. |
| **reconnect\_disconnected** boolean | **Choices:*** no
* **yes** ←
| Reconnect disconnected hosts. This is only used if `state` is set to `present` and if the host already exists. |
| **state** string | **Choices:*** **present** ←
* absent
* add\_or\_reconnect
* reconnect
* disconnected
| If set to `present`, add the host if host is absent. If set to `present`, update the location of the host if host already exists. If set to `absent`, remove the host if host is present. If set to `absent`, do nothing if host already does not exists. If set to `add_or_reconnect`, add the host if it's absent else reconnect it and update the location. If set to `reconnect`, then reconnect the host if it's present and update the location. If set to `disconnected`, disconnect the host if the host already exists. |
| **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 on vSphere 5.5, 6.0, 6.5 and 6.7
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Add ESXi Host to vCenter
community.vmware.vmware_host:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter: datacenter_name
cluster: cluster_name
esxi_hostname: '{{ esxi_hostname }}'
esxi_username: '{{ esxi_username }}'
esxi_password: '{{ esxi_password }}'
state: present
delegate_to: localhost
- name: Add ESXi Host to vCenter under a specific folder
community.vmware.vmware_host:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter: datacenter_name
folder: '/Site2/Asia-Cluster/host'
esxi_hostname: '{{ esxi_hostname }}'
esxi_username: '{{ esxi_username }}'
esxi_password: '{{ esxi_password }}'
state: present
add_connected: True
delegate_to: localhost
- name: Reconnect ESXi Host (with username/password set)
community.vmware.vmware_host:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter: datacenter_name
cluster: cluster_name
esxi_hostname: '{{ esxi_hostname }}'
esxi_username: '{{ esxi_username }}'
esxi_password: '{{ esxi_password }}'
state: reconnect
delegate_to: localhost
- name: Reconnect ESXi Host (with default username/password)
community.vmware.vmware_host:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter: datacenter_name
cluster: cluster_name
esxi_hostname: '{{ esxi_hostname }}'
state: reconnect
delegate_to: localhost
- name: Add ESXi Host with SSL Thumbprint to vCenter
community.vmware.vmware_host:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter: datacenter_name
cluster: cluster_name
esxi_hostname: '{{ esxi_hostname }}'
esxi_username: '{{ esxi_username }}'
esxi_password: '{{ esxi_password }}'
esxi_ssl_thumbprint: "3C:A5:60:6F:7A:B7:C4:6C:48:28:3D:2F:A5:EC:A3:58:13:88:F6:DD"
state: present
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **result** string | on successful addition | metadata about the new host system added **Sample:** Host already connected to vCenter 'vcenter01' in cluster 'cluster01' |
### Authors
* Joseph Callen (@jcpowermac)
* Russell Teague (@mtnbikenc)
* Maxime de Roucy (@tchernomax)
* Christian Kotte (@ckotte)
ansible community.vmware.vmware_vm_vss_dvs_migrate – Migrates a virtual machine from a standard vswitch to distributed community.vmware.vmware\_vm\_vss\_dvs\_migrate – Migrates a virtual machine from a standard vswitch to distributed
==================================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_vm_vss_dvs_migrate`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Migrates a virtual machine from a standard vswitch to distributed
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **dvportgroup\_name** string / required | | Name of the portgroup to migrate to the virtual machine to |
| **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. |
| **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. |
| **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. |
| **vm\_name** string / required | | Name of the virtual machine to migrate to a dvSwitch |
Notes
-----
Note
* Tested on vSphere 5.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Migrate VCSA to vDS
community.vmware.vmware_vm_vss_dvs_migrate:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
vm_name: '{{ vm_name }}'
dvportgroup_name: '{{ distributed_portgroup_name }}'
delegate_to: localhost
```
### Authors
* Joseph Callen (@jcpowermac)
ansible community.vmware.vmware_portgroup_facts – Gathers facts about an ESXi host’s Port Group configuration community.vmware.vmware\_portgroup\_facts – Gathers facts about an ESXi host’s Port Group configuration
=======================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_portgroup_facts`.
* [DEPRECATED](#deprecated)
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
* [Status](#status)
DEPRECATED
----------
Removed in
major release after 2021-12-01
Why
Deprecated in favour of [community.vmware.vmware\_portgroup\_info](vmware_portgroup_info_module#ansible-collections-community-vmware-vmware-portgroup-info-module) module.
Alternative
Use [community.vmware.vmware\_portgroup\_info](vmware_portgroup_info_module#ansible-collections-community-vmware-vmware-portgroup-info-module) instead.
Synopsis
--------
* This module can be used to gather facts about an ESXi host’s Port Group configuration when ESXi hostname or Cluster name is given.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster. Facts will be returned for all hostsystem belonging to this cluster name. If `esxi_hostname` is not given, this parameter is required. |
| **esxi\_hostname** string | | ESXi hostname to gather facts from. If `cluster_name` is not given, this parameter is required. |
| **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. |
| **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 |
| **policies** boolean | **Choices:*** **no** ←
* yes
| Gather facts about Security, Traffic Shaping, as well as Teaming and failover. The property `ts` stands for Traffic Shaping and `lb` for Load Balancing. |
| **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. |
| **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 on vSphere 6.5
* The `vswitch_name` property is deprecated starting from Ansible v2.12
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather portgroup facts about all ESXi Host in given Cluster
community.vmware.vmware_portgroup_facts:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: '{{ cluster_name }}'
delegate_to: localhost
- name: Gather portgroup facts about ESXi Host system
community.vmware.vmware_portgroup_facts:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **hosts\_portgroup\_facts** dictionary | on success | metadata about host's portgroup configuration **Sample:** {'esx01': [{'failback': True, 'failover\_active': ['vmnic0', 'vmnic1'], 'failover\_standby': [], 'failure\_detection': 'link\_status\_only', 'lb': 'loadbalance\_srcid', 'notify': True, 'portgroup': 'Management Network', 'security': [False, False, False], 'ts': 'No override', 'vlan\_id': 0, 'vswitch': 'vSwitch0', 'vswitch\_name': 'vSwitch0'}, {'failback': True, 'failover\_active': ['vmnic2'], 'failover\_standby': ['vmnic3'], 'failure\_detection': 'No override', 'lb': 'No override', 'notify': True, 'portgroup': 'vMotion', 'security': [False, False, False], 'ts': 'No override', 'vlan\_id': 33, 'vswitch': 'vSwitch1', 'vswitch\_name': 'vSwitch1'}]} |
Status
------
* This module will be removed in a major release after 2021-12-01. *[deprecated]*
* For more information see [DEPRECATED](#deprecated).
### Authors
* Abhijeet Kasurde (@Akasurde)
* Christian Kotte (@ckotte)
| programming_docs |
ansible community.vmware.vmware_dvswitch_uplink_pg – Manage uplink portproup configuration of a Distributed Switch community.vmware.vmware\_dvswitch\_uplink\_pg – Manage uplink portproup configuration of a Distributed Switch
=============================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_dvswitch_uplink_pg`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to configure the uplink portgroup of a Distributed Switch.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **advanced** dictionary | **Default:**{"block\_override": true, "netflow\_override": false, "port\_config\_reset\_at\_disconnect": true, "traffic\_filter\_override": false, "vendor\_config\_override": false, "vlan\_override": false} | Dictionary which configures the advanced policy settings for the uplink portgroup.
aliases: port\_policy |
| | **block\_override** boolean | **Choices:*** no
* **yes** ←
| Indicates if the block policy can be changed per port. |
| | **netflow\_override** boolean | **Choices:*** **no** ←
* yes
| Indicates if the NetFlow policy can be changed per port. |
| | **port\_config\_reset\_at\_disconnect** boolean | **Choices:*** no
* **yes** ←
| Indicates if the configuration of a port is reset automatically after disconnect. |
| | **traffic\_filter\_override** boolean | **Choices:*** **no** ←
* yes
| Indicates if the traffic filter can be changed per port. |
| | **vendor\_config\_override** boolean | **Choices:*** **no** ←
* yes
| Indicates if the vendor config can be changed per port. |
| | **vlan\_override** boolean | **Choices:*** **no** ←
* yes
| Indicates if the vlan can be changed per port. |
| **block\_all\_ports** boolean | **Choices:*** **no** ←
* yes
| Indicates if all ports are blocked on the uplink portgroup. |
| **description** string | | The description of the uplink portgroup. |
| **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. |
| **lacp** dictionary | **Default:**{"mode": "passive", "status": "disabled"} | Dictionary which configures the LACP settings for the uplink portgroup. The options are only used if the LACP support mode is set to 'basic'. |
| | **mode** string | **Choices:*** active
* **passive** ←
| The negotiating state of the uplinks/ports. |
| | **status** string | **Choices:*** enabled
* **disabled** ←
| Indicates if LACP is enabled. |
| **name** string | | The name of the uplink portgroup. The current name will be used if not specified. |
| **netflow\_enabled** boolean | **Choices:*** **no** ←
* yes
| Indicates if NetFlow is enabled on the uplink portgroup. |
| **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. |
| **switch** string / required | | The name of the Distributed Switch.
aliases: dvswitch |
| **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. |
| **vlan\_trunk\_range** list / elements=string | **Default:**["0-4094"] | The VLAN trunk range that should be configured with the uplink portgroup. This can be a combination of multiple ranges and numbers, example: [ 2-3967, 4049-4092 ]. |
Notes
-----
Note
* Tested on vSphere 6.5 and 6.7
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Configure Uplink portgroup
community.vmware.vmware_dvswitch_uplink_pg:
hostname: '{{ inventory_hostname }}'
username: '{{ vcsa_username }}'
password: '{{ vcsa_password }}'
switch: dvSwitch
name: dvSwitch-DVUplinks
advanced:
port_config_reset_at_disconnect: True
block_override: True
vendor_config_override: False
vlan_override: False
netflow_override: False
traffic_filter_override: False
vlan_trunk_range:
- '0-4094'
netflow_enabled: False
block_all_ports: False
delegate_to: localhost
- name: Enabled LACP on Uplink portgroup
community.vmware.vmware_dvswitch_uplink_pg:
hostname: '{{ inventory_hostname }}'
username: '{{ vcsa_username }}'
password: '{{ vcsa_password }}'
switch: dvSwitch
lacp:
status: enabled
mode: active
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **result** string | always | information about performed operation **Sample:** {'adv\_block\_ports': True, 'adv\_netflow': False, 'adv\_reset\_at\_disconnect': True, 'adv\_traffic\_filtering': False, 'adv\_vendor\_conf': False, 'adv\_vlan': False, 'block\_all\_ports': False, 'changed': False, 'description': None, 'dvswitch': 'dvSwitch', 'lacp\_status': 'disabled', 'lacp\_status\_previous': 'enabled', 'name': 'dvSwitch-DVUplinks', 'netflow\_enabled': False, 'result': 'Uplink portgroup already configured properly', 'vlan\_trunk\_range': ['2-3967', '4049-4092']} |
### Authors
* Christian Kotte (@ckotte)
ansible community.vmware.vmware_maintenancemode – Place a host into maintenance mode community.vmware.vmware\_maintenancemode – Place a host into maintenance mode
=============================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_maintenancemode`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used for placing a ESXi host into maintenance mode.
* Support for VSAN compliant maintenance mode when selected.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **esxi\_hostname** string / required | | Name of the host as defined in vCenter. |
| **evacuate** boolean | **Choices:*** **no** ←
* yes
| If set to `True`, evacuate all powered off VMs. |
| **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. |
| **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. |
| **state** string | **Choices:*** **present** ←
* absent
| Enter or exit maintenance mode. |
| **timeout** integer | **Default:**0 | Specify a timeout for the operation. |
| **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. |
| **vsan** string | **Choices:*** ensureObjectAccessibility
* evacuateAllData
* noAction
| Specify which VSAN compliant mode to enter.
aliases: vsan\_mode |
Notes
-----
Note
* Tested on vSphere 5.5, 6.0 and 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Enter VSAN-Compliant Maintenance Mode
community.vmware.vmware_maintenancemode:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
esxi_hostname: "{{ esxi_hostname }}"
vsan: ensureObjectAccessibility
evacuate: true
timeout: 3600
state: present
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **hostname** string | always | Name of host in vCenter **Sample:** esxi.local.domain |
| **hostsystem** string | always | Name of vim reference **Sample:** 'vim.HostSystem:host-236' |
| **status** string | always | Action taken **Sample:** ENTER |
### Authors
* Jay Jahns (@jjahns) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#f993939891978adfdacacec2dfdacccbc2dfdacdc1c28f948e988b9cdfdacdcfc29a9694)>
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_category – Manage VMware categories community.vmware.vmware\_category – Manage VMware categories
============================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_category`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to create / delete / update VMware categories.
* Tag feature is introduced in vSphere 6 version, so this module is not supported in the earlier versions of vSphere.
* All variables and VMware object names are case sensitive.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
* vSphere Automation SDK
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **associable\_object\_types** list / elements=string | **Choices:*** All objects
* Cluster
* Content Library
* Datacenter
* Datastore
* Datastore Cluster
* Distributed Port Group
* Distributed Switch
* Folder
* Host
* Library item
* Network
* Host Network
* Opaque Network
* Resource Pool
* vApp
* Virtual Machine
| List of object types that can be associated with the given category. |
| **category\_cardinality** string | **Choices:*** **multiple** ←
* single
| The category cardinality. This parameter is ignored, when updating existing category. |
| **category\_description** string | **Default:**"" | The category description. This is required only if `state` is set to `present`. This parameter is ignored, when `state` is set to `absent`. |
| **category\_name** string / required | | The name of category to manage. |
| **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. |
| **new\_category\_name** string | | The new name for an existing category. This value is used while updating an existing category. |
| **password** 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.
aliases: pass, pwd |
| **port** integer | **Default:**443 | The port number of the vSphere vCenter. If the value is not specified in the task, the value of environment variable `VMWARE_PORT` will be used instead. |
| **protocol** string | **Choices:*** http
* **https** ←
| The connection to protocol. |
| **proxy\_host** string added in 1.12.0 of community.vmware | | 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 added in 1.12.0 of community.vmware | | 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. |
| **state** string | **Choices:*** **present** ←
* absent
| The state of category. If set to `present` and category does not exists, then category is created. If set to `present` and category exists, then category is updated. If set to `absent` and category exists, then category is deleted. If set to `absent` and category does not exists, no action is taken. Process of updating category only allows name, description change. |
| **username** 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.
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. |
Notes
-----
Note
* Tested on vSphere 6.5
Examples
--------
```
- name: Create a category
community.vmware.vmware_category:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
category_name: Sample_Cat_0001
category_description: Sample Description
category_cardinality: 'multiple'
state: present
- name: Rename category
community.vmware.vmware_category:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
category_name: Sample_Category_0001
new_category_name: Sample_Category_0002
state: present
- name: Update category description
community.vmware.vmware_category:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
category_name: Sample_Category_0001
category_description: Some fancy description
state: present
- name: Delete category
community.vmware.vmware_category:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
category_name: Sample_Category_0002
state: absent
- name: Create category with 2 associable object types
community.vmware.vmware_category:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
category_name: 'Sample_Category_0003'
category_description: 'sample description'
associable_object_types:
- Datastore
- Cluster
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **category\_results** dictionary | on success | dictionary of category metadata **Sample:** {'category\_id': 'urn:vmomi:InventoryServiceCategory:d7120bda-9fa5-4f92-9d71-aa1acff2e5a8:GLOBAL', 'msg': 'Category NewCat\_0001 updated.'} |
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_resource_pool_info – Gathers info about resource pool information community.vmware.vmware\_resource\_pool\_info – Gathers info about resource pool information
============================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_resource_pool_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to gather information about all resource configuration information.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **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. |
| **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. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather resource pool info about all resource pools available
community.vmware.vmware_resource_pool_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
register: rp_info
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **resource\_pool\_info** list / elements=string | on success | metadata about resource pool configuration **Sample:** [{'cpu\_allocation\_expandable\_reservation': False, 'cpu\_allocation\_limit': 4121, 'cpu\_allocation\_overhead\_limit': None, 'cpu\_allocation\_reservation': 4121, 'cpu\_allocation\_shares': 9000, 'cpu\_allocation\_shares\_level': 'custom', 'mem\_allocation\_expandable\_reservation': False, 'mem\_allocation\_limit': 961, 'mem\_allocation\_overhead\_limit': None, 'mem\_allocation\_reservation': 961, 'mem\_allocation\_shares': 9000, 'mem\_allocation\_shares\_level': 'custom', 'name': 'Resources', 'overall\_status': 'green', 'owner': 'DC0\_H0', 'runtime\_cpu\_max\_usage': 4121, 'runtime\_cpu\_overall\_usage': 0, 'runtime\_cpu\_reservation\_used': 0, 'runtime\_cpu\_reservation\_used\_vm': 0, 'runtime\_cpu\_unreserved\_for\_pool': 4121, 'runtime\_cpu\_unreserved\_for\_vm': 4121, 'runtime\_memory\_max\_usage': 1007681536, 'runtime\_memory\_overall\_usage': 0, 'runtime\_memory\_reservation\_used': 0, 'runtime\_memory\_reservation\_used\_vm': 0, 'runtime\_memory\_unreserved\_for\_pool': 1007681536, 'runtime\_memory\_unreserved\_for\_vm': 1007681536}] |
### Authors
* Abhijeet Kasurde (@Akasurde)
| programming_docs |
ansible community.vmware.vmware_vmkernel_ip_config – Configure the VMkernel IP Address community.vmware.vmware\_vmkernel\_ip\_config – Configure the VMkernel IP Address
=================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_vmkernel_ip_config`.
* [DEPRECATED](#deprecated)
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Status](#status)
DEPRECATED
----------
Removed in
major release after 2021-12-01
Why
Deprecated in favour of [community.vmware.vmware\_vmkernel](vmware_vmkernel_module#ansible-collections-community-vmware-vmware-vmkernel-module) module
Alternative
Use [community.vmware.vmware\_vmkernel](vmware_vmkernel_module#ansible-collections-community-vmware-vmware-vmkernel-module) instead.
Synopsis
--------
* Configure the VMkernel IP Address
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **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. |
| **ip\_address** string / required | | IP address to assign to VMkernel interface |
| **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. |
| **subnet\_mask** string / required | | Subnet Mask to assign to VMkernel interface |
| **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. |
| **vmk\_name** string / required | | VMkernel interface name |
Notes
-----
Note
* Tested on vSphere 5.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
# Example command from Ansible Playbook
- name: Configure IP address on ESX host
community.vmware.vmware_vmkernel_ip_config:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
vmk_name: vmk0
ip_address: 10.0.0.10
subnet_mask: 255.255.255.0
delegate_to: localhost
```
Status
------
* This module will be removed in a major release after 2021-12-01. *[deprecated]*
* For more information see [DEPRECATED](#deprecated).
### Authors
* Joseph Callen (@jcpowermac)
* Russell Teague (@mtnbikenc)
ansible community.vmware.vmware_resource_pool_facts – Gathers facts about resource pool information community.vmware.vmware\_resource\_pool\_facts – Gathers facts about resource pool information
==============================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_resource_pool_facts`.
* [DEPRECATED](#deprecated)
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
* [Status](#status)
DEPRECATED
----------
Removed in
major release after 2021-12-01
Why
Deprecated in favour of [community.vmware.vmware\_resource\_pool\_info](vmware_resource_pool_info_module#ansible-collections-community-vmware-vmware-resource-pool-info-module) module.
Alternative
Use [community.vmware.vmware\_resource\_pool\_info](vmware_resource_pool_info_module#ansible-collections-community-vmware-vmware-resource-pool-info-module) instead.
Synopsis
--------
* This module can be used to gather facts about all resource configuration information.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **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. |
| **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. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather resource pool facts about all resource pools available
community.vmware.vmware_resource_pool_facts:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
register: rp_facts
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **resource\_pool\_facts** list / elements=string | on success | metadata about resource pool configuration **Sample:** [{'cpu\_allocation\_expandable\_reservation': False, 'cpu\_allocation\_limit': 4121, 'cpu\_allocation\_overhead\_limit': None, 'cpu\_allocation\_reservation': 4121, 'cpu\_allocation\_shares': 9000, 'cpu\_allocation\_shares\_level': 'custom', 'mem\_allocation\_expandable\_reservation': False, 'mem\_allocation\_limit': 961, 'mem\_allocation\_overhead\_limit': None, 'mem\_allocation\_reservation': 961, 'mem\_allocation\_shares': 9000, 'mem\_allocation\_shares\_level': 'custom', 'name': 'Resources', 'overall\_status': 'green', 'owner': 'DC0\_H0', 'runtime\_cpu\_max\_usage': 4121, 'runtime\_cpu\_overall\_usage': 0, 'runtime\_cpu\_reservation\_used': 0, 'runtime\_cpu\_reservation\_used\_vm': 0, 'runtime\_cpu\_unreserved\_for\_pool': 4121, 'runtime\_cpu\_unreserved\_for\_vm': 4121, 'runtime\_memory\_max\_usage': 1007681536, 'runtime\_memory\_overall\_usage': 0, 'runtime\_memory\_reservation\_used': 0, 'runtime\_memory\_reservation\_used\_vm': 0, 'runtime\_memory\_unreserved\_for\_pool': 1007681536, 'runtime\_memory\_unreserved\_for\_vm': 1007681536}] |
Status
------
* This module will be removed in a major release after 2021-12-01. *[deprecated]*
* For more information see [DEPRECATED](#deprecated).
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_dvswitch_nioc – Manage distributed switch Network IO Control community.vmware.vmware\_dvswitch\_nioc – Manage distributed switch Network IO Control
======================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_dvswitch_nioc`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to manage distributed switch Network IO Control configurations.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **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. |
| **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. |
| **resources** list / elements=dictionary | | List of dicts containing. |
| | **limit** integer | **Default:**-1 | The maximum allowed usage for a traffic class belonging to this resource pool per host physical NIC. |
| | **name** string / required | **Choices:*** faultTolerance
* hbr
* iSCSI
* management
* nfs
* vdp
* virtualMachine
* vmotion
* vsan
| Resource name. |
| | **reservation** integer | | Ignored if NIOC version is set to version2 Amount of bandwidth resource that is guaranteed available to the host infrastructure traffic class. If the utilization is less than the reservation, the extra bandwidth is used for other host infrastructure traffic class types. Reservation is not allowed to exceed the value of limit, if limit is set. Unit is Mbits/sec. Ignored unless version is "version3". Amount of bandwidth resource that is guaranteed available to the host infrastructure traffic class. |
| | **shares** integer | | The number of shares allocated. Ignored unless `shares_level` is "custom". |
| | **shares\_level** string | **Choices:*** low
* normal
* high
* custom
| The allocation level The level is a simplified view of shares. Levels map to a pre-determined set of numeric values for shares. |
| **state** string | **Choices:*** **present** ←
* absent
| Enable or disable NIOC on the distributed switch. |
| **switch** string / required | | The name of the distributed switch.
aliases: dvswitch |
| **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. |
| **version** string | **Choices:*** version2
* version3
| Network IO control version. |
Notes
-----
Note
* Tested on vSphere 6.7
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Enable NIOC
community.vmware.vmware_dvswitch_nioc:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
switch: dvSwitch
version: version3
resources:
- name: vmotion
limit: -1
reservation: 128
shares_level: normal
- name: vsan
limit: -1
shares_level: custom
shares: 99
reservation: 256
state: present
delegate_to: localhost
- name: Disable NIOC
community.vmware.vmware_dvswitch_nioc:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
switch: dvSwitch
state: absent
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **dvswitch\_nioc\_status** string | success | result of the changes |
| **resources\_changed** list / elements=string | success | list of resources which were changed **Sample:** ['vmotion', 'vsan'] |
### Authors
* Joseph Andreatta (@vmwjoseph)
ansible community.vmware.vmware_host_kernel_manager – Manage kernel module options on ESXi hosts community.vmware.vmware\_host\_kernel\_manager – Manage kernel module options on ESXi hosts
===========================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_kernel_manager`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to manage kernel module options on ESXi hosts.
* All connected ESXi hosts in scope will be configured when specified.
* If a host is not connected at time of configuration, it will be marked as such in the output.
* Kernel module options may require a reboot to take effect which is not covered here.
* You can use [ansible.builtin.reboot](../../ansible/builtin/reboot_module#ansible-collections-ansible-builtin-reboot-module) or [community.vmware.vmware\_host\_powerstate](vmware_host_powerstate_module#ansible-collections-community-vmware-vmware-host-powerstate-module) module to reboot all ESXi host systems.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the VMware cluster to work on. All ESXi hosts in this cluster will be configured. This parameter is required if `esxi_hostname` is not specified. |
| **esxi\_hostname** string | | Name of the ESXi host to work on. This parameter is required if `cluster_name` is not specified. |
| **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. |
| **kernel\_module\_name** string / required | | Name of the kernel module to be configured. |
| **kernel\_module\_option** string / required | | Specified configurations will be applied to the given module. These values are specified in key=value pairs and separated by a space when there are multiple options. |
| **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. |
| **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 on vSphere 6.0
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Configure IPv6 to be off via tcpip4 kernel module
community.vmware.vmware_host_kernel_manager:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
kernel_module_name: "tcpip4"
kernel_module_option: "ipv6=0"
- name: Using cluster_name, configure vmw_psp_rr options
community.vmware.vmware_host_kernel_manager:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: '{{ virtual_cluster_name }}'
kernel_module_name: "vmw_psp_rr"
kernel_module_option: "maxPathsPerDevice=2"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **host\_kernel\_status** dictionary | success | dict with information on what was changed, by ESXi host in scope. **Sample:** {'results': {'myhost01.example.com': {'changed': True, 'configured\_options': 'ipv6=0', 'msg': 'Options have been changed on the kernel module', 'original\_options': 'ipv6=1'}}} |
### Authors
* Aaron Longchamps (@alongchamps)
| programming_docs |
ansible community.vmware.vmware_host_custom_attributes – Manage custom attributes from VMware for the given ESXi host community.vmware.vmware\_host\_custom\_attributes – Manage custom attributes from VMware for the given ESXi host
================================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_custom_attributes`.
New in version 1.11.0: of community.vmware
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to add, remove and update custom attributes for the given ESXi host.
Requirements
------------
The below requirements are needed on the host that executes this module.
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **attributes** list / elements=dictionary | **Default:**[] | A list of name and value of custom attributes that needs to be manage. Value of custom attribute is not required and will be ignored, if `state` is set to `absent`. |
| | **name** string / required | | Name of the attribute. |
| | **value** string | **Default:**"" | Value of the attribute. |
| **esxi\_hostname** string / required | | Name of the ESXi host to work with. This is a required parameter |
| **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. |
| **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. |
| **state** string | **Choices:*** **present** ←
* absent
| The action to take. If set to `present`, then custom attribute is added or updated. If set to `absent`, then custom attribute is removed. |
| **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 on vSphere 6.7
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Add ESXi host custom attributes
community.vmware.vmware_host_custom_attributes:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
esxi_hostname: host1
state: present
attributes:
- name: MyAttribute
value: MyValue
delegate_to: localhost
register: attributes
- name: Remove ESXi host Attribute
community.vmware.vmware_host_custom_attributes:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
esxi_hostname: host1
state: absent
attributes:
- name: MyAttribute
delegate_to: localhost
register: attributes
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **custom\_attributes** dictionary | changed | metadata about the ESXi host attributes **Sample:** {'mycustom': 'my\_custom\_value', 'mycustom\_2': 'my\_custom\_value\_2', 'sample\_1': 'sample\_1\_value', 'sample\_2': 'sample\_2\_value', 'sample\_3': 'sample\_3\_value'} |
### Authors
* Hunter Christain (@exp-hc)
ansible community.vmware.vmware_recommended_datastore – Returns the recommended datastore from a SDRS-enabled datastore cluster community.vmware.vmware\_recommended\_datastore – Returns the recommended datastore from a SDRS-enabled datastore cluster
=========================================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_recommended_datastore`.
New in version 1.11.0: of community.vmware
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module provides the recommended datastore name from a datastore cluster only if the SDRS is enabled for the specified datastore cluster
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 3
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **datacenter** string / required | | Name of the datacenter. |
| **datastore\_cluster** string / required | | Name of the datastore cluster. |
| **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. |
| **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. |
| **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 on vSphere 6.7 and 7.0.2
* Supports Check mode.
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Get recommended datastore from a Storage DRS-enabled datastore cluster
community.vmware.vmware_recommended_datastore:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
validate_certs: no
datastore_cluster: '{{ datastore_cluster_name }}'
datacenter: '{{ datacenter }}'
register: recommended_ds
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **recommended\_datastore** string | always | metadata about the recommended datastore **Sample:** {'recommended\_datastore': 'datastore-01'} |
### Authors
* Unknown (@MalfuncEddie)
* Alina Buzachis (@alinabuzachis)
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_host_passthrough – Manage PCI device passthrough settings on host community.vmware.vmware\_host\_passthrough – Manage PCI device passthrough settings on host
===========================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_passthrough`.
New in version 1.11.0: of community.vmware
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be managed PCI device passthrough settings on host.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 3.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster** string | | Name of the cluster from which all host systems will be used. This parameter is required if `esxi_hostname` is not specified.
aliases: cluster\_name |
| **devices** list / elements=dictionary / required | | List of PCI device name. |
| | **device\_name** string | | Name of PCI device to enable passthrough.
aliases: name |
| **esxi\_hostname** string | | Name of the host system to work with. This parameter is required if `cluster_name` is not specified. User can specify specific host from the cluster. |
| **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. |
| **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. |
| **state** string | **Choices:*** **present** ←
* absent
| If *state=present*, passthrough of PCI device will be enabled. If *state=absent*, passthrough of PCI device will be disabled. |
| **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
* Supports `check_mode`.
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Enable PCI device passthrough against the whole ESXi in a cluster
community.vmware.vmware_host_passthrough:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: false
cluster: "{{ ccr1 }}"
devices:
- device_name: "Dual Band Wireless AC 3165"
state: present
- name: Enable PCI device passthrough against one ESXi
community.vmware.vmware_host_passthrough:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: false
esxi_hostname: "{{ esxi1 }}"
devices:
- device_name: "Dual Band Wireless AC 3165"
state: present
- name: Disable PCI device passthrough against the whole ESXi in a cluster
community.vmware.vmware_host_passthrough:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: false
cluster: "{{ ccr1 }}"
devices:
- device_name: "Dual Band Wireless AC 3165"
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **passthrough\_configs** list / elements=dictionary | changed | list of that PCI devices have been enabled passthrough for each host system. **Sample:** [ { "esxi-01.example.com": [ { "device\_id": "0000:03:00.0", "device\_name": "Dual Band Wireless AC 3165", "passthruEnabled": true } ] }, { "esxi-02.example.com": [ { "device\_id": "0000:03:00.0", "device\_name": "Dual Band Wireless AC 3165", "passthruEnabled": true } ] } ] |
### Authors
* sky-joker (@sky-joker)
ansible community.vmware.vmware_host_service_manager – Manage services on a given ESXi host community.vmware.vmware\_host\_service\_manager – Manage services on a given ESXi host
======================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_service_manager`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module can be used to manage (start, stop, restart) services on a given ESXi host.
* If cluster\_name is provided, specified service will be managed on all ESXi host belonging to that cluster.
* If specific esxi\_hostname is provided, then specified service will be managed on given ESXi host only.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster. Service settings are applied to every ESXi host system/s in given cluster. If `esxi_hostname` is not given, this parameter is required. |
| **esxi\_hostname** string | | ESXi hostname. Service settings are applied to this ESXi host system. If `cluster_name` is not given, this parameter is required. |
| **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. |
| **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. |
| **service\_name** string / required | | Name of Service to be managed. This is a brief identifier for the service, for example, ntpd, vxsyslogd etc. This value should be a valid ESXi service name. |
| **service\_policy** string | **Choices:*** automatic
* off
* on
| Set of valid service policy strings. If set `on`, then service should be started when the host starts up. If set `automatic`, then service should run if and only if it has open firewall ports. If set `off`, then Service should not be started when the host starts up. |
| **state** string | **Choices:*** absent
* present
* restart
* **start** ←
* stop
* unchanged
| Desired state of service. State value 'start' and 'present' has same effect. State value 'stop' and 'absent' has same effect. State value `unchanged` is added in version 1.14.0 to allow defining startup policy without defining or changing service state. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Start ntpd service setting for all ESXi Host in given Cluster
community.vmware.vmware_host_service_manager:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: '{{ cluster_name }}'
service_name: ntpd
state: present
delegate_to: localhost
- name: Start ntpd setting for an ESXi Host
community.vmware.vmware_host_service_manager:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
service_name: ntpd
state: present
delegate_to: localhost
- name: Start ntpd setting for an ESXi Host with Service policy
community.vmware.vmware_host_service_manager:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
service_name: ntpd
service_policy: on
state: present
delegate_to: localhost
- name: Stop ntpd setting for an ESXi Host
community.vmware.vmware_host_service_manager:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
service_name: ntpd
state: absent
delegate_to: localhost
```
### Authors
* Abhijeet Kasurde (@Akasurde)
| programming_docs |
ansible community.vmware.vmware_guest_video – Modify video card configurations of specified virtual machine in given vCenter infrastructure community.vmware.vmware\_guest\_video – Modify video card configurations of specified virtual machine in given vCenter infrastructure
=====================================================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_guest_video`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module is used to reconfigure video card settings of given virtual machine.
* All parameters and VMware object names are case sensitive.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **datacenter** string | **Default:**"ha-datacenter" | The datacenter name to which virtual machine belongs to. This parameter is case sensitive. |
| **display\_number** integer | | The number of display. Valid value from 1 to 10. The maximum display number is 4 on vCenter 6.0, 6.5 web UI. |
| **enable\_3D** boolean | **Choices:*** no
* yes
| Enable 3D for guest operating systems on which VMware supports 3D. |
| **folder** string | | Destination folder, absolute or relative path to find an existing guest. This is a required parameter, only if multiple VMs are found with same name. The folder should include the datacenter. ESXi server's datacenter is ha-datacenter. Examples: folder: /ha-datacenter/vm folder: ha-datacenter/vm folder: /datacenter1/vm folder: datacenter1/vm folder: /datacenter1/vm/folder1 folder: datacenter1/vm/folder1 folder: /folder1/datacenter1/vm folder: folder1/datacenter1/vm folder: /folder1/datacenter1/vm/folder2 |
| **gather\_video\_facts** boolean | **Choices:*** **no** ←
* yes
| If set to `True`, return settings of the video card, other attributes are ignored. If set to `False`, will do reconfiguration and return video card settings. |
| **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. |
| **memory\_3D\_mb** integer | | The value of 3D Memory must be power of 2 and valid value is from 32 MB to 2048 MB. |
| **moid** string | | Managed Object ID of the instance to manage if known, this is a unique identifier only within a single vCenter instance. This is required if `name` or `uuid` is not supplied. |
| **name** string | | Name of the virtual machine. This is a required parameter, if parameter `uuid` or `moid` is not supplied. |
| **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. |
| **renderer\_3D** string | **Choices:*** automatic
* software
* hardware
| If set to `automatic`, selects the appropriate option (software or hardware) for this virtual machine automatically. If set to `software`, uses normal CPU processing for 3D calculations. If set to `hardware`, requires graphics hardware (GPU) for faster 3D calculations. |
| **use\_auto\_detect** boolean | **Choices:*** no
* yes
| If set to `True`, applies common video settings to the guest operating system, attributes `display_number` and `video_memory_mb` are ignored. If set to `False`, the number of display and the total video memory will be reconfigured using `display_number` and `video_memory_mb`. |
| **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 |
| **uuid** string | | UUID of the instance to gather facts if known, this is VMware's unique identifier. This is a required parameter, if parameter `name` or `moid` is not supplied. |
| **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. |
| **video\_memory\_mb** float | | Valid total MB of video memory range of virtual machine is from 1.172 MB to 256 MB on ESXi 6.7U1, from 1.172 MB to 128 MB on ESXi 6.7 and previous versions. For specific guest OS, supported minimum and maximum video memory are different, please be careful on setting this. |
Notes
-----
Note
* Tested on vSphere 6.0, 6.5 and 6.7
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Change video card settings of virtual machine
community.vmware.vmware_guest_video:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
name: test-vm
gather_video_facts: false
use_auto_detect: false
display_number: 2
video_memory_mb: 8.0
enable_3D: true
renderer_3D: automatic
memory_3D_mb: 512
delegate_to: localhost
register: video_facts
- name: Change video card settings of virtual machine using MoID
community.vmware.vmware_guest_video:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
moid: vm-42
gather_video_facts: false
use_auto_detect: false
display_number: 2
video_memory_mb: 8.0
enable_3D: true
renderer_3D: automatic
memory_3D_mb: 512
delegate_to: localhost
register: video_facts
- name: Gather video card settings of virtual machine
community.vmware.vmware_guest_video:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
name: test-vm
gather_video_facts: false
delegate_to: localhost
register: video_facts
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **video\_status** dictionary | always | metadata about the virtual machine's video card after managing them **Sample:** {'auto\_detect': False, 'display\_number': 2, 'enable\_3D\_support': True, 'memory\_3D': 524288, 'renderer\_3D': 'automatic', 'video\_memory': 8192} |
### Authors
* Diane Wang (@Tomorrow9) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#8aeee3ebe4effdaca9b9bdb1aca9bfb8b1aca9beb2b1fce7fdebf8efaca9bebcb1e9e5e7)>
ansible community.vmware.vmware_vswitch_info – Gathers info about an ESXi host’s vswitch configurations community.vmware.vmware\_vswitch\_info – Gathers info about an ESXi host’s vswitch configurations
=================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_vswitch_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to gather information about an ESXi host’s vswitch configurations when ESXi hostname or Cluster name is given.
* The vSphere Client shows the value for the number of ports as elastic from vSphere 5.5 and above.
* Other tools like esxcli might show the number of ports as 1536 or 5632.
* See <https://kb.vmware.com/s/article/2064511> for more details.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster. Info about vswitch belonging to every ESXi host systems under this cluster will be returned. If `esxi_hostname` is not given, this parameter is required. |
| **esxi\_hostname** string | | ESXi hostname to gather information from. If `cluster_name` is not given, this parameter is required. |
| **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. |
| **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. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather vswitch info about all ESXi Host in given Cluster
community.vmware.vmware_vswitch_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: '{{ cluster_name }}'
delegate_to: localhost
register: all_hosts_vswitch_info
- name: Gather firewall info about ESXi Host
community.vmware.vmware_vswitch_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
delegate_to: localhost
register: all_vswitch_info
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **hosts\_vswitch\_info** dictionary | on success | metadata about host's vswitch configuration **Sample:** {'10.76.33.218': {'vSwitch0': {'mtu': 1500, 'num\_ports': 128, 'pnics': ['vmnic0']}, 'vSwitch\_0011': {'mtu': 1500, 'num\_ports': 128, 'pnics': ['vmnic2', 'vmnic1']}}} |
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_host_scsidisk_info – Gather information about SCSI disk attached to the given ESXi community.vmware.vmware\_host\_scsidisk\_info – Gather information about SCSI disk attached to the given ESXi
=============================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_scsidisk_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to gather information about SCSI disk attached to the given ESXi.
Requirements
------------
The below requirements are needed on the host that executes this module.
* Python >= 2.7
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster from which all host systems will be used. SCSI disk information about each ESXi server will be returned for the given cluster. This parameter is required if *esxi\_hostname* is not specified. |
| **esxi\_hostname** string | | Name of the host system to work with. SCSI disk information about this ESXi server will be returned. This parameter is required if *cluster\_name* is not specified. |
| **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. |
| **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. |
| **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
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather information SCSI disk attached to the given ESXi
community.vmware.vmware_host_scsidisk_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
delegate_to: localhost
- name: Gather information of all host systems from the given cluster
community.vmware.vmware_host_scsidisk_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: '{{ cluster_name }}'
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **hosts\_scsidisk\_info** dictionary | always | metadata about host system SCSI disk information **Sample:** {'10.65.201.106': [{'block': 41943040, 'block\_size': 512, 'canonical\_name': 't10.ATA\_QEMU\_HARDDISK\_QM00001\_', 'device\_name': '/vmfs/devices/disks/t10.ATA\_QEMU\_HARDDISK\_QM00001\_', 'device\_path': '/vmfs/devices/disks/t10.ATA\_QEMU\_HARDDISK\_QM00001\_', 'device\_type': 'disk', 'display\_name': 'Local ATA Disk (t10.ATA\_QEMU\_HARDDISK\_QM00001\_)', 'key': 'key-vim.host.ScsiDisk-0100000000514d30303030312020202020202020202020202051454d552048', 'local\_disk': True, 'lun\_type': 'disk', 'model': 'QEMU HARDDISK ', 'perenniallyReserved': None, 'protocol\_endpoint': False, 'revision': '1.5.', 'scsi\_disk\_type': 'native512', 'scsi\_level': 5, 'serial\_number': 'unavailable', 'ssd': False, 'uuid': '0100000000514d30303030312020202020202020202020202051454d552048', 'vStorageSupport': 'vStorageUnsupported', 'vendor': 'ATA '}]} |
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_host_ssl_info – Gather info of ESXi host system about SSL community.vmware.vmware\_host\_ssl\_info – Gather info of ESXi host system about SSL
====================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_ssl_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to gather information of the SSL thumbprint information for a host.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster. SSL thumbprint information about all ESXi host system in the given cluster will be reported. If `esxi_hostname` is not given, this parameter is required. |
| **esxi\_hostname** string | | ESXi hostname. SSL thumbprint information of this ESXi host system will be reported. If `cluster_name` is not given, this parameter is required. |
| **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. |
| **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. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather SSL thumbprint information about all ESXi Hosts in given Cluster
community.vmware.vmware_host_ssl_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: '{{ cluster_name }}'
delegate_to: localhost
register: all_host_ssl_info
- name: Get SSL Thumbprint info about "{{ esxi_hostname }}"
community.vmware.vmware_host_ssl_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
esxi_hostname: '{{ esxi_hostname }}'
register: ssl_info
- set_fact:
ssl_thumbprint: "{{ ssl_info['host_ssl_info'][esxi_hostname]['ssl_thumbprints'][0] }}"
- debug:
msg: "{{ ssl_thumbprint }}"
- name: Add ESXi Host to vCenter
vmware_host:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter_name: '{{ datacenter_name }}'
cluster_name: '{{ cluster_name }}'
esxi_hostname: '{{ esxi_hostname }}'
esxi_username: '{{ esxi_username }}'
esxi_password: '{{ esxi_password }}'
esxi_ssl_thumbprint: '{{ ssl_thumbprint }}'
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **host\_ssl\_info** dictionary | info | dict with hostname as key and dict with SSL thumbprint related info **Sample:** {'10.76.33.215': {'owner\_tag': '', 'principal': 'vpxuser', 'ssl\_thumbprints': ['E3:E8:A9:20:8D:32:AE:59:C6:8D:A5:91:B0:20:EF:00:A2:7C:27:EE', 'F1:AC:DA:6E:D8:1E:37:36:4A:5C:07:E5:04:0B:87:C8:75:FB:42:01']}} |
### Authors
* Abhijeet Kasurde (@Akasurde)
| programming_docs |
ansible community.vmware.vmware_content_library_info – Gather information about VMWare Content Library community.vmware.vmware\_content\_library\_info – Gather information about VMWare Content Library
=================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_content_library_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Module to list the content libraries.
* Module to get information about specific content library.
* Content Library feature is introduced in vSphere 6.0 version, so this module is not supported in the earlier versions of vSphere.
* All variables and VMware object names are case sensitive.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
* vSphere Automation SDK
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **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. |
| **library\_id** string | | content library id for which details needs to be fetched. |
| **password** 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.
aliases: pass, pwd |
| **port** integer | **Default:**443 | The port number of the vSphere vCenter. If the value is not specified in the task, the value of environment variable `VMWARE_PORT` will be used instead. |
| **protocol** string | **Choices:*** http
* **https** ←
| The connection to protocol. |
| **proxy\_host** string added in 1.12.0 of community.vmware | | 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 added in 1.12.0 of community.vmware | | 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. |
| **username** 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.
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. |
Notes
-----
Note
* Tested on vSphere 6.5, 6.7
Examples
--------
```
- name: Get List of Content Libraries
community.vmware.vmware_content_library_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
delegate_to: localhost
- name: Get information about content library
community.vmware.vmware_content_library_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
library_id: '13b0f060-f4d3-4f84-b61f-0fe1b0c0a5a8'
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **content\_lib\_details** list / elements=string | on success | list of content library metadata **Sample:** [{'library\_creation\_time': '2019-07-02T11:50:52.242000', 'library\_description': 'new description', 'library\_id': '13b0f060-f4d3-4f84-b61f-0fe1b0c0a5a8', 'library\_name': 'demo-local-lib', 'library\_publish\_info': {'authentication\_method': 'NONE', 'persist\_json\_enabled': False, 'publish\_url': None, 'published': False, 'user\_name': None}, 'library\_server\_guid': '0fd5813b-aac7-4b92-9fb7-f18f16565613', 'library\_type': 'LOCAL', 'library\_version': '3'}] |
| **content\_libs** list / elements=string | on success | list of content libraries **Sample:** ['ded9c4d5-0dcd-4837-b1d8-af7398511e33', '36b72549-14ed-4b5f-94cb-6213fecacc02'] |
### Authors
* Pavan Bidkar (@pgbidkar)
ansible community.vmware.vmware_dvs_portgroup_facts – Gathers facts DVS portgroup configurations community.vmware.vmware\_dvs\_portgroup\_facts – Gathers facts DVS portgroup configurations
===========================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_dvs_portgroup_facts`.
* [DEPRECATED](#deprecated)
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
* [Status](#status)
DEPRECATED
----------
Removed in
major release after 2021-12-01
Why
Deprecated in favour of [community.vmware.vmware\_dvs\_portgroup\_info](vmware_dvs_portgroup_info_module#ansible-collections-community-vmware-vmware-dvs-portgroup-info-module) module.
Alternative
Use [community.vmware.vmware\_dvs\_portgroup\_info](vmware_dvs_portgroup_info_module#ansible-collections-community-vmware-vmware-dvs-portgroup-info-module) instead.
Synopsis
--------
* This module can be used to gather facts about DVS portgroup configurations.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **datacenter** string / required | | Name of the datacenter. |
| **dvswitch** string | | Name of a dvswitch to look for. |
| **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. |
| **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. |
| **show\_network\_policy** boolean | **Choices:*** no
* **yes** ←
| Show or hide network policies of DVS portgroup. |
| **show\_port\_policy** boolean | **Choices:*** no
* **yes** ←
| Show or hide port policies of DVS portgroup. |
| **show\_teaming\_policy** boolean | **Choices:*** no
* **yes** ←
| Show or hide teaming policies of DVS portgroup. |
| **show\_vlan\_info** boolean | **Choices:*** **no** ←
* yes
| Show or hide vlan information of the DVS portgroup. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Get facts about DVPG
community.vmware.vmware_dvs_portgroup_facts:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
register: dvpg_facts
- name: Get number of ports for portgroup 'dvpg_001' in 'dvs_001'
debug:
msg: "{{ item.num_ports }}"
with_items:
- "{{ dvpg_facts.dvs_portgroup_facts['dvs_001'] | json_query(query) }}"
vars:
query: "[?portgroup_name=='dvpg_001']"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **dvs\_portgroup\_facts** dictionary | on success | metadata about DVS portgroup configuration **Sample:** {'dvs\_0': [{'description': None, 'dvswitch\_name': 'dvs\_001', 'network\_policy': {'forged\_transmits': False, 'mac\_changes': False, 'promiscuous': False}, 'num\_ports': 8, 'port\_policy': {'block\_override': True, 'ipfix\_override': False, 'live\_port\_move': False, 'network\_rp\_override': False, 'port\_config\_reset\_at\_disconnect': True, 'security\_override': False, 'shaping\_override': False, 'traffic\_filter\_override': False, 'uplink\_teaming\_override': False, 'vendor\_config\_override': False, 'vlan\_override': False}, 'portgroup\_name': 'dvpg\_001', 'teaming\_policy': {'inbound\_policy': True, 'notify\_switches': True, 'policy': 'loadbalance\_srcid', 'rolling\_order': False}, 'type': 'earlyBinding', 'vlan\_info': {'pvlan': False, 'trunk': False, 'vlan\_id': 0}}]} |
Status
------
* This module will be removed in a major release after 2021-12-01. *[deprecated]*
* For more information see [DEPRECATED](#deprecated).
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_host_ntp_info – Gathers info about NTP configuration on an ESXi host community.vmware.vmware\_host\_ntp\_info – Gathers info about NTP configuration on an ESXi host
===============================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_ntp_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to gather information about NTP configurations on an ESXi host.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster. NTP config information about each ESXi server will be returned for the given cluster. If `esxi_hostname` is not given, this parameter is required. |
| **esxi\_hostname** string | | ESXi hostname. NTP config information about this ESXi server will be returned. If `cluster_name` is not given, this parameter is required. |
| **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. |
| **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. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather NTP info about all ESXi Host in the given Cluster
community.vmware.vmware_host_ntp_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: cluster_name
delegate_to: localhost
register: cluster_host_ntp
- name: Gather NTP info about ESXi Host
community.vmware.vmware_host_ntp_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
delegate_to: localhost
register: host_ntp
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **hosts\_ntp\_info** dictionary | hosts\_ntp\_info | dict with hostname as key and dict with NTP infos as value **Sample:** {'10.76.33.226': [{'ntp\_servers': [], 'time\_zone\_description': 'UTC', 'time\_zone\_gmt\_offset': 0, 'time\_zone\_identifier': 'UTC', 'time\_zone\_name': 'UTC'}]} |
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_guest_serial_port – Manage serial ports on an existing VM community.vmware.vmware\_guest\_serial\_port – Manage serial ports on an existing VM
====================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_guest_serial_port`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to manage serial ports on an existing VM
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **backings** list / elements=dictionary / required | | A list of backings for serial ports.
`backing_type` (str): is required to add or reconfigure or remove an existing serial port. |
| | **backing\_type** string / required | | Backing type is required for the serial ports to be added or reconfigured or removed.
aliases: type |
| | **device\_name** string | | Serial device absolutely path. Required when *backing\_type=device*. |
| | **direction** string | **Choices:*** **client** ←
* server
| The direction of the connection. Required when *backing\_type=network*. |
| | **endpoint** string | **Choices:*** **client** ←
* server
| When you use serial port pipe backing to connect a virtual machine to another process, you must define the endpoints. Required when *backing\_type=pipe*. |
| | **file\_path** string | | File path for the host file used in this backing. Fully qualified path is required, like <datastore\_name>/<file\_name>. Required when *backing\_type=file*. |
| | **no\_rx\_loss** boolean | **Choices:*** **no** ←
* yes
| Enables optimized data transfer over the pipe. Required when *backing\_type=pipe*. |
| | **pipe\_name** string | | Pipe name for the host pipe. Required when *backing\_type=pipe*. |
| | **service\_uri** string | | Identifies the local host or a system on the network, depending on the value of *direction*. If you use the virtual machine as a server, the URI identifies the host on which the virtual machine runs. In this case, the host name part of the URI should be empty, or it should specify the address of the local host. If you use the virtual machine as a client, the URI identifies the remote system on the network. Required when *backing\_type=network*. |
| | **state** string | **Choices:*** **present** ←
* absent
|
`state` is required to identify whether we are adding, modifying or removing the serial port. If `state` is set to `present`, a serial port will be added or modified. If `state` is set to `absent`, an existing serial port will be removed. If an existing serial port to modify or remove, `backing_type` and either of `service_uri` or `pipe_name` or `device_name` or `file_path` are required. |
| | **yield\_on\_poll** boolean | **Choices:*** no
* **yes** ←
| Enables CPU yield behavior. |
| **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. |
| **moid** string | | Managed Object ID of the instance to manage if known, this is a unique identifier only within a single vCenter instance. This is required if `name` or `uuid` is not supplied. |
| **name** string | | Name of the virtual machine. This is a required parameter, if parameter `uuid` or `moid` is not supplied. |
| **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. |
| **use\_instance\_uuid** boolean | **Choices:*** **no** ←
* yes
| Whether to use the VMware instance UUID rather than the BIOS UUID. |
| **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 |
| **uuid** string | | UUID of the instance to manage the serial ports, this is VMware's unique identifier. This is a required parameter, if parameter `name` or `moid` is not supplied. |
| **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
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
# Create serial ports
- name: Create multiple serial ports with Backing type - network, pipe, device and file
community.vmware.vmware_guest_serial_port:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
name: "test_vm1"
backings:
- type: 'network'
direction: 'client'
service_uri: 'tcp://6000'
yield_on_poll: True
- type: 'pipe'
pipe_name: 'serial_pipe'
endpoint: 'client'
- type: 'device'
device_name: '/dev/char/serial/uart0'
- type: 'file'
file_path: '[datastore1]/file1'
yield_on_poll: True
register: create_multiple_ports
# Modify existing serial port
- name: Modify Network backing type
community.vmware.vmware_guest_serial_port:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
name: '{{ name }}'
backings:
- type: 'network'
state: 'present'
direction: 'server'
service_uri: 'tcp://6000'
delegate_to: localhost
# Remove serial port
- name: Remove pipe backing type
community.vmware.vmware_guest_serial_port:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
name: '{{ name }}'
backings:
- type: 'pipe'
state: 'absent'
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **serial\_port\_data** dictionary | always | metadata about the virtual machine's serial ports after managing them **Sample:** [{'backing\_type': 'network', 'direction': 'client', 'service\_uri': 'tcp://6000'}, {'backing\_type': 'pipe', 'direction': 'server', 'pipe\_name': 'serial pipe'}] |
### Authors
* Anusha Hegde (@anusha94)
| programming_docs |
ansible community.vmware.vmware_host_auto_start – Manage the auto power ON or OFF for vm on ESXi host community.vmware.vmware\_host\_auto\_start – Manage the auto power ON or OFF for vm on ESXi host
================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_auto_start`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* In this module, can set up automatic startup and shutdown of virtual machines according to host startup or shutdown.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **esxi\_hostname** string / required | | ESXi hostname where the VM to set auto power on or off exists. |
| **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. |
| **moid** string | | Managed Object ID of the instance to manage if known, this is a unique identifier only within a single vCenter instance. This is required if `name` or `uuid` is not supplied. |
| **name** string | | VM name to set auto power on or off. This is not necessary if change only system default VM settings for autoStart config. |
| **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. |
| **power\_info** dictionary | **Default:**{"start\_action": "none", "start\_delay": -1, "start\_order": -1, "stop\_action": "systemDefault", "stop\_delay": -1, "wait\_for\_heartbeat": "systemDefault"} | Startup or shutdown settings of virtual machine. This setting will override the system defaults. |
| | **start\_action** string | **Choices:*** **none** ←
* powerOn
| Whether to start the virtual machine when the host startup. |
| | **start\_delay** integer | **Default:**-1 | Auto start delay in seconds of virtual machine. |
| | **start\_order** integer | **Default:**-1 | The autostart priority of virtual machine. Virtual machines with a lower number are powered on first. On host shutdown, the virtual machines are shut down in reverse order, meaning those with a higher number are powered off first. |
| | **stop\_action** string | **Choices:*** none
* **systemDefault** ←
* powerOff
* suspend
| Stop action executed on the virtual machine when the system stops of virtual machine. |
| | **stop\_delay** integer | **Default:**-1 | Auto stop delay in seconds of virtual machine. |
| | **wait\_for\_heartbeat** string | **Choices:*** no
* yes
* **systemDefault** ←
| Continue power on processing when VMware Tools started. |
| **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. |
| **system\_defaults** dictionary | | System defaults for auto-start or auto-stop config for virtual machine. |
| | **enabled** boolean | **Choices:*** **no** ←
* yes
| Enable automatically start or stop of virtual machines. |
| | **start\_delay** integer | **Default:**120 | Default auto start delay in seconds. |
| | **stop\_action** string | **Choices:*** none
* guestShutdown
* **powerOff** ←
* suspend
| Default stop action executed on the virtual machine when the system stops. |
| | **stop\_delay** integer | **Default:**120 | Default auto stop delay in seconds. |
| | **wait\_for\_heartbeat** boolean | **Choices:*** **no** ←
* yes
| Continue power on processing when VMware Tools started. If this parameter is enabled to powers on the next virtual machine without waiting for the delay to pass. However, the virtual machine must have VMware Tools installed. |
| **use\_instance\_uuid** boolean | **Choices:*** **no** ←
* yes
| Whether to use the VMware instance UUID rather than the BIOS UUID. |
| **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 |
| **uuid** string | | VM uuid to set auto power on or off, this is VMware's unique identifier. This is required if `name` is not supplied. This is not necessary if change only system default VM settings for autoStart config. |
| **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
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
---
- name: Update for system defaults config.
community.vmware.vmware_host_auto_start:
hostname: "{{ hostname }}"
username: "{{ username }}"
password: "{{ password }}"
esxi_hostname: "{{ esxi_hostname }}"
system_defaults:
enabled: true
start_delay: 100
stop_action: guestShutdown
- name: Update for powerInfo config of virtual machine.
community.vmware.vmware_host_auto_start:
hostname: "{{ hostname }}"
username: "{{ username }}"
password: "{{ password }}"
esxi_hostname: "{{ esxi_hostname }}"
name: "{{ vm_name }}"
power_info:
start_action: powerOn
start_delay: 10
start_order: 1
stop_action: powerOff
wait_for_heartbeat: true
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **power\_info\_config** dictionary | changed | Parameter return when virtual machine power info config is changed. **Sample:** { "start\_action": "powerOn", "start\_delay": -1, "start\_order": -1, "stop\_action": "systemDefault", "stop\_delay": -1, "wait\_for\_heartbeat": "systemDefault" } |
| **system\_defaults\_config** dictionary | changed | Parameter return when system defaults config is changed. **Sample:** { "enabled": true, "start\_delay": 120, "stop\_action": "powerOff", "stop\_delay": 120, "wait\_for\_heartbeat": false } |
### Authors
* sky-joker (@sky-joker)
ansible community.vmware.vmware_vm_inventory – VMware Guest inventory source community.vmware.vmware\_vm\_inventory – VMware Guest inventory source
======================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_vm_inventory`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Examples](#examples)
Synopsis
--------
* Get virtual machines as inventory hosts from VMware environment.
* Uses any file which ends with vmware.yml, vmware.yaml, vmware\_vm\_inventory.yml, or vmware\_vm\_inventory.yaml as a YAML configuration file.
Requirements
------------
The below requirements are needed on the local controller node that executes this inventory.
* Python >= 2.7
* PyVmomi
* requests >= 2.3
* vSphere Automation SDK - For tag feature
Parameters
----------
| Parameter | Choices/Defaults | Configuration | Comments |
| --- | --- | --- | --- |
| **cache** boolean | **Choices:*** **no** ←
* yes
| ini entries: [inventory]cache = no env:ANSIBLE\_INVENTORY\_CACHE | Toggle to enable/disable the caching of the inventory's source data, requires a cache plugin setup to work. |
| **cache\_connection** string | | ini entries: [defaults]fact\_caching\_connection = None [inventory]cache\_connection = None env:ANSIBLE\_CACHE\_PLUGIN\_CONNECTION env:ANSIBLE\_INVENTORY\_CACHE\_CONNECTION | Cache connection data or path, read cache plugin documentation for specifics. |
| **cache\_plugin** string | **Default:**"memory" | ini entries: [defaults]fact\_caching = memory [inventory]cache\_plugin = memory env:ANSIBLE\_CACHE\_PLUGIN env:ANSIBLE\_INVENTORY\_CACHE\_PLUGIN | Cache plugin to use for the inventory's source data. |
| **cache\_prefix** string | **Default:**"ansible\_inventory\_" | ini entries: [default]fact\_caching\_prefix = ansible\_inventory\_ [inventory]cache\_prefix = ansible\_inventory\_ env:ANSIBLE\_CACHE\_PLUGIN\_PREFIX env:ANSIBLE\_INVENTORY\_CACHE\_PLUGIN\_PREFIX | Prefix to use for cache plugin files/tables |
| **cache\_timeout** integer | **Default:**3600 | ini entries: [defaults]fact\_caching\_timeout = 3600 [inventory]cache\_timeout = 3600 env:ANSIBLE\_CACHE\_PLUGIN\_TIMEOUT env:ANSIBLE\_INVENTORY\_CACHE\_TIMEOUT | Cache duration in seconds |
| **compose** dictionary | **Default:**{} | | Create vars from jinja2 expressions. |
| **filters** list / elements=string | **Default:**[] | | This option allows client-side filtering hosts with jinja templating. When server-side filtering is introduced, it should be preferred over this. |
| **groups** dictionary | **Default:**{} | | Add hosts to group based on Jinja2 conditionals. |
| **hostname** string / required | | env:VMWARE\_HOST env:VMWARE\_SERVER | Name of vCenter or ESXi server. |
| **hostnames** list / elements=string | **Default:**["config.name + \"\_\" + config.uuid"] | | A list of templates in order of precedence to compose inventory\_hostname. Ignores template if resulted in an empty string or None value. You can use property specified in *properties* as variables in the template. |
| **keyed\_groups** list / elements=string | **Default:**[{"key": "config.guestId", "separator": ""}, {"key": "summary.runtime.powerState", "separator": ""}] | | Add hosts to group based on the values of a variable. |
| **leading\_separator** boolean added in 2.11 of ansible.builtin | **Choices:*** no
* **yes** ←
| | 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. |
| **password** string / required | | env:VMWARE\_PASSWORD | Password of vSphere user. Accepts vault encrypted variable. |
| **port** integer | **Default:**443 | env:VMWARE\_PORT | Port number used to connect to vCenter or ESXi Server. |
| **properties** list / elements=string | **Default:**["name", "config.cpuHotAddEnabled", "config.cpuHotRemoveEnabled", "config.instanceUuid", "config.hardware.numCPU", "config.template", "config.name", "config.uuid", "guest.hostName", "guest.ipAddress", "guest.guestId", "guest.guestState", "runtime.maxMemoryUsage", "customValue", "summary.runtime.powerState", "config.guestId"] | | Specify the list of VMware schema properties associated with the VM. These properties will be populated in hostvars of the given VM. Each value in the list can be a path to a specific property in VM object or a path to a collection of VM objects.
`config.name`, `config.uuid` are required properties if `hostnames` is set to default.
`config.guestId`, `summary.runtime.powerState` are required if `keyed_groups` is set to default. Please make sure that all the properties that are used in other parameters are included in this options. In addition to VM properties, the following are special values Use `customValue` to populate virtual machine's custom attributes. `customValue` is only supported by vCenter and not by ESXi. Use `all` to populate all the properties of the virtual machine. The value `all` is time consuming operation, do not use unless required absolutely. Please refer more VMware guest attributes which can be used as properties <https://github.com/ansible/ansible/blob/devel/docs/docsite/rst/scenario_guides/vmware_scenarios/vmware_inventory_vm_attributes.rst>
|
| **proxy\_host** string added in 1.12.0 of community.vmware | | env:VMWARE\_PROXY\_HOST | Address of a proxy that will receive all HTTPS requests and relay them. The format is a hostname or a IP. This feature depends on a version of pyvmomi>=v6.7.1.2018.12. |
| **proxy\_port** integer added in 1.12.0 of community.vmware | | env:VMWARE\_PROXY\_PORT | Port of the HTTP proxy that will receive all HTTPS requests and relay them. |
| **resources** list / elements=string added in 2.10 of community.vmware | **Default:**[] | | A list of resources to limit search scope. Each resource item is represented by exactly one `'vim_type_snake_case`:`list of resource names` pair and optional nested *resources*
Key name is based on snake case of a vim type name; e.g `host_system` correspond to `vim.HostSystem`
See [VIM Types](https://pubs.vmware.com/vi-sdk/visdk250/ReferenceGuide/index-mo_types.html)
|
| **strict** boolean | **Choices:*** **no** ←
* yes
| | If `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. |
| **use\_extra\_vars** boolean added in 2.11 of ansible.builtin | **Choices:*** **no** ←
* yes
| ini entries: [inventory\_plugins]use\_extra\_vars = no env:ANSIBLE\_INVENTORY\_USE\_EXTRA\_VARS | Merge extra vars into the available variables for composition (highest precedence). |
| **username** string / required | | env:VMWARE\_USER env:VMWARE\_USERNAME | Name of vSphere user. Accepts vault encrypted variable. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| env:VMWARE\_VALIDATE\_CERTS | Allows connection when SSL certificates are not valid. Set to `false` when certificates are not trusted. |
| **with\_nested\_properties** boolean | **Choices:*** no
* **yes** ←
| | This option transform flatten properties name to nested dictionary. From 1.10.0 and onwards, default value is set to `True`. |
| **with\_path** boolean | **Choices:*** **no** ←
* yes
| | Include virtual machines path. Set this option to a string value to replace root name from *'Datacenters'*. |
| **with\_sanitized\_property\_name** boolean | **Choices:*** **no** ←
* yes
| | This option allows property name sanitization to create safe property names for use in Ansible. Also, transforms property name to snake case. |
| **with\_tags** boolean | **Choices:*** **no** ←
* yes
| | Include tags and associated virtual machines. Requires 'vSphere Automation SDK' library to be installed on the given controller machine. Please refer following URLs for installation steps <https://code.vmware.com/web/sdk/7.0/vsphere-automation-python> |
Examples
--------
```
# Sample configuration file for VMware Guest dynamic inventory
plugin: community.vmware.vmware_vm_inventory
strict: False
hostname: 10.65.223.31
username: [email protected]
password: Esxi@123$%
validate_certs: False
with_tags: True
# Gather minimum set of properties for VMware guest
plugin: community.vmware.vmware_vm_inventory
strict: False
hostname: 10.65.223.31
username: [email protected]
password: Esxi@123$%
validate_certs: False
properties:
- 'name'
- 'guest.ipAddress'
- 'config.name'
- 'config.uuid'
# Create Groups based upon VMware Tools status
plugin: community.vmware.vmware_vm_inventory
strict: False
hostname: 10.65.223.31
username: [email protected]
password: Esxi@123$%
validate_certs: False
properties:
- 'name'
- 'config.name'
- 'guest.toolsStatus'
- 'guest.toolsRunningStatus'
hostnames:
- config.name
keyed_groups:
- key: guest.toolsStatus
separator: ''
- key: guest.toolsRunningStatus
separator: ''
# Filter VMs based upon condition
plugin: community.vmware.vmware_vm_inventory
strict: False
hostname: 10.65.223.31
username: [email protected]
password: Esxi@123$%
validate_certs: False
properties:
- 'runtime.powerState'
- 'config.name'
filters:
- runtime.powerState == "poweredOn"
hostnames:
- config.name
# Filter VM's based on OR conditions
plugin: community.vmware.vmware_vm_inventory
strict: False
hostname: 10.65.223.31
username: [email protected]
password: Esxi@123$%
validate_certs: False
properties:
- 'name'
- 'config.name'
- 'guest.ipAddress'
- 'guest.toolsStatus'
- 'guest.toolsRunningStatus'
- 'config.guestFullName'
- 'config.guestId'
hostnames:
- 'config.name'
filters:
- config.guestId == "rhel7_64Guest" or config.name == "rhel_20_04_empty"
# Filter VM's based on regex conditions
plugin: community.vmware.vmware_vm_inventory
strict: False
hostname: 10.65.223.31
username: [email protected]
password: Esxi@123$%
validate_certs: False
properties:
- 'config.name'
- 'config.guestId'
- 'guest.ipAddress'
- 'summary.runtime.powerState'
filters:
- guest.ipAddress is defined and (guest.ipAddress is match('192.168.*') or guest.ipAddress is match('192.169.*'))
# Using compose and groups
plugin: community.vmware.vmware_vm_inventory
strict: False
hostname: 10.65.223.31
username: [email protected]
password: Esxi@123$%
validate_certs: False
properties:
- 'name'
- 'config.name'
- 'guest.ipAddress'
compose:
# This will populate the IP address of virtual machine if available
# and will be used while communicating to the given virtual machine
ansible_host: 'guest.ipAddress'
composed_var: 'config.name'
# This will populate a host variable with a string value
ansible_user: "'admin'"
ansible_connection: "'ssh'"
groups:
VMs: True
hostnames:
- config.name
# Use Datacenter, Cluster and Folder value to list VMs
plugin: community.vmware.vmware_vm_inventory
strict: False
hostname: 10.65.200.241
username: [email protected]
password: Esxi@123$%
validate_certs: False
with_tags: True
resources:
- datacenter:
- Asia-Datacenter1
- Asia-Datacenter2
resources:
- compute_resource:
- Asia-Cluster1
resources:
- host_system:
- Asia-ESXI4
- folder:
- dev
- prod
# Use Category and it's relation with Tag
plugin: community.vmware.vmware_vm_inventory
strict: False
hostname: 10.65.201.128
username: [email protected]
password: Esxi@123$%
validate_certs: False
hostnames:
- 'config.name'
properties:
- 'config.name'
- 'config.guestId'
- 'guest.ipAddress'
- 'summary.runtime.powerState'
with_tags: True
keyed_groups:
- key: tag_category.OS
prefix: "vmware_tag_os_category_"
separator: ""
with_nested_properties: True
filters:
- "tag_category.OS is defined and 'Linux' in tag_category.OS"
# customizing hostnames based on VM's FQDN. The second hostnames template acts as a fallback mechanism.
plugin: community.vmware.vmware_vm_inventory
strict: False
hostname: 10.65.223.31
username: [email protected]
password: Esxi@123$%
validate_certs: False
hostnames:
- 'config.name+"."+guest.ipStack.0.dnsConfig.domainName'
- 'config.name'
properties:
- 'config.name'
- 'config.guestId'
- 'guest.hostName'
- 'guest.ipAddress'
- 'guest.guestFamily'
- 'guest.ipStack'
```
### Authors
* Abhijeet Kasurde (@Akasurde)
| programming_docs |
ansible community.vmware.vmware_vmkernel_facts – Gathers VMKernel facts about an ESXi host community.vmware.vmware\_vmkernel\_facts – Gathers VMKernel facts about an ESXi host
====================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_vmkernel_facts`.
* [DEPRECATED](#deprecated)
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
* [Status](#status)
DEPRECATED
----------
Removed in
major release after 2021-12-01
Why
Deprecated in favour of [community.vmware.vmware\_vmkernel\_info](vmware_vmkernel_info_module#ansible-collections-community-vmware-vmware-vmkernel-info-module) module.
Alternative
Use [community.vmware.vmware\_vmkernel\_info](vmware_vmkernel_info_module#ansible-collections-community-vmware-vmware-vmkernel-info-module) instead.
Synopsis
--------
* This module can be used to gather VMKernel facts about an ESXi host from given ESXi hostname or cluster name.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster. VMKernel facts about each ESXi server will be returned for the given cluster. If `esxi_hostname` is not given, this parameter is required. |
| **esxi\_hostname** string | | ESXi hostname. VMKernel facts about this ESXi server will be returned. If `cluster_name` is not given, this parameter is required. |
| **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. |
| **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. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather VMKernel facts about all ESXi Host in given Cluster
community.vmware.vmware_vmkernel_facts:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: cluster_name
delegate_to: localhost
register: cluster_host_vmks
- name: Gather VMKernel facts about ESXi Host
community.vmware.vmware_vmkernel_facts:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
delegate_to: localhost
register: host_vmks
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **host\_vmk\_facts** dictionary | success | metadata about VMKernel present on given host system **Sample:** {'10.76.33.208': [{'device': 'vmk0', 'dhcp': True, 'enable\_ft': False, 'enable\_management': True, 'enable\_vmotion': False, 'enable\_vsan': False, 'ipv4\_address': '10.76.33.28', 'ipv4\_subnet\_mask': '255.255.255.0', 'key': 'key-vim.host.VirtualNic-vmk0', 'mac': '52:54:00:12:50:ce', 'mtu': 1500, 'portgroup': 'Management Network', 'stack': 'defaultTcpipStack'}]} |
Status
------
* This module will be removed in a major release after 2021-12-01. *[deprecated]*
* For more information see [DEPRECATED](#deprecated).
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_drs_rule_facts – Gathers facts about DRS rule on the given cluster community.vmware.vmware\_drs\_rule\_facts – Gathers facts about DRS rule on the given cluster
=============================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_drs_rule_facts`.
* [DEPRECATED](#deprecated)
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
* [Status](#status)
DEPRECATED
----------
Removed in
major release after 2021-12-01
Why
Deprecated in favour of [community.vmware.vmware\_drs\_rule\_info](vmware_drs_rule_info_module#ansible-collections-community-vmware-vmware-drs-rule-info-module) module.
Alternative
Use [community.vmware.vmware\_drs\_rule\_info](vmware_drs_rule_info_module#ansible-collections-community-vmware-vmware-drs-rule-info-module) instead.
Synopsis
--------
* This module can be used to gather facts about DRS VM-VM and VM-HOST rules from the given cluster.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster. DRS facts for the given cluster will be returned. This is required parameter if `datacenter` parameter is not provided. |
| **datacenter** string | | Name of the datacenter. DRS facts for all the clusters from the given datacenter will be returned. This is required parameter if `cluster_name` parameter is not provided. |
| **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. |
| **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. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather DRS facts about given Cluster
community.vmware.vmware_drs_rule_facts:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: '{{ cluster_name }}'
delegate_to: localhost
register: cluster_drs_facts
- name: Gather DRS facts about all Clusters in given datacenter
community.vmware.vmware_drs_rule_facts:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter: '{{ datacenter_name }}'
delegate_to: localhost
register: datacenter_drs_facts
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **drs\_rule\_facts** dictionary | always | metadata about DRS rule from given cluster / datacenter **Sample:** {'DC0\_C0': [{'rule\_affinity': False, 'rule\_enabled': True, 'rule\_key': 1, 'rule\_mandatory': True, 'rule\_name': 'drs\_rule\_0001', 'rule\_type': 'vm\_vm\_rule', 'rule\_uuid': '52be5061-665a-68dc-3d25-85cd2d37e114', 'rule\_vms': ['VM\_65', 'VM\_146']}], 'DC1\_C1': [{'rule\_affine\_host\_group\_name': 'host\_group\_1', 'rule\_affine\_hosts': ['10.76.33.204'], 'rule\_anti\_affine\_host\_group\_name': None, 'rule\_anti\_affine\_hosts': [], 'rule\_enabled': True, 'rule\_key': 1, 'rule\_mandatory': False, 'rule\_name': 'vm\_host\_rule\_0001', 'rule\_type': 'vm\_host\_rule', 'rule\_uuid': '52687108-4d3a-76f2-d29c-b708c40dbe40', 'rule\_vm\_group\_name': 'test\_vm\_group\_1', 'rule\_vms': ['VM\_8916', 'VM\_4010']}]} |
Status
------
* This module will be removed in a major release after 2021-12-01. *[deprecated]*
* For more information see [DEPRECATED](#deprecated).
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_dvs_portgroup_info – Gathers info DVS portgroup configurations community.vmware.vmware\_dvs\_portgroup\_info – Gathers info DVS portgroup configurations
=========================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_dvs_portgroup_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to gather information about DVS portgroup configurations.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **datacenter** string / required | | Name of the datacenter. |
| **dvswitch** string | | Name of a dvswitch to look for. |
| **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. |
| **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. |
| **show\_mac\_learning** boolean added in 1.10.0 of community.vmware | **Choices:*** no
* **yes** ←
| Show or hide MAC learning information of the DVS portgroup. |
| **show\_network\_policy** boolean | **Choices:*** no
* **yes** ←
| Show or hide network policies of DVS portgroup. |
| **show\_port\_policy** boolean | **Choices:*** no
* **yes** ←
| Show or hide port policies of DVS portgroup. |
| **show\_teaming\_policy** boolean | **Choices:*** no
* **yes** ←
| Show or hide teaming policies of DVS portgroup. |
| **show\_uplinks** boolean added in 1.10.0 of community.vmware | **Choices:*** no
* **yes** ←
| Show or hide uplinks of DVS portgroup. |
| **show\_vlan\_info** boolean | **Choices:*** **no** ←
* yes
| Show or hide vlan information of the DVS portgroup. |
| **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 on vSphere 7.0
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Get info about DVPG
community.vmware.vmware_dvs_portgroup_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
register: dvpg_info
- name: Get number of ports for portgroup 'dvpg_001' in 'dvs_001'
debug:
msg: "{{ item.num_ports }}"
with_items:
- "{{ dvpg_info.dvs_portgroup_info['dvs_001'] | json_query(query) }}"
vars:
query: "[?portgroup_name=='dvpg_001']"
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **dvs\_portgroup\_info** dictionary | on success | metadata about DVS portgroup configuration **Sample:** {'dvs\_0': [{'description': None, 'dvswitch\_name': 'dvs\_001', 'network\_policy': {'forged\_transmits': False, 'mac\_changes': False, 'promiscuous': False}, 'num\_ports': 8, 'port\_policy': {'block\_override': True, 'ipfix\_override': False, 'live\_port\_move': False, 'network\_rp\_override': False, 'port\_config\_reset\_at\_disconnect': True, 'security\_override': False, 'shaping\_override': False, 'traffic\_filter\_override': False, 'uplink\_teaming\_override': False, 'vendor\_config\_override': False, 'vlan\_override': False}, 'portgroup\_name': 'dvpg\_001', 'teaming\_policy': {'inbound\_policy': True, 'notify\_switches': True, 'policy': 'loadbalance\_srcid', 'rolling\_order': False}, 'type': 'earlyBinding', 'vlan\_info': {'pvlan': False, 'trunk': False, 'vlan\_id': 0}}]} |
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_portgroup_info – Gathers info about an ESXi host’s Port Group configuration community.vmware.vmware\_portgroup\_info – Gathers info about an ESXi host’s Port Group configuration
=====================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_portgroup_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to gather information about an ESXi host’s Port Group configuration when ESXi hostname or Cluster name is given.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster. Info will be returned for all hostsystem belonging to this cluster name. If `esxi_hostname` is not given, this parameter is required. |
| **esxi\_hostname** string | | ESXi hostname to gather information from. If `cluster_name` is not given, this parameter is required. |
| **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. |
| **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 |
| **policies** boolean | **Choices:*** **no** ←
* yes
| Gather information about Security, Traffic Shaping, as well as Teaming and failover. The property `ts` stands for Traffic Shaping and `lb` for Load Balancing. |
| **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. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather portgroup info about all ESXi Host in given Cluster
community.vmware.vmware_portgroup_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: '{{ cluster_name }}'
delegate_to: localhost
- name: Gather portgroup info about ESXi Host system
community.vmware.vmware_portgroup_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **hosts\_portgroup\_info** dictionary | on success | metadata about host's portgroup configuration **Sample:** {'esx01': [{'failback': True, 'failover\_active': ['vmnic0', 'vmnic1'], 'failover\_standby': [], 'failure\_detection': 'link\_status\_only', 'lb': 'loadbalance\_srcid', 'notify': True, 'portgroup': 'Management Network', 'security': [False, False, False], 'ts': 'No override', 'vlan\_id': 0, 'vswitch': 'vSwitch0'}, {'failback': True, 'failover\_active': ['vmnic2'], 'failover\_standby': ['vmnic3'], 'failure\_detection': 'No override', 'lb': 'No override', 'notify': True, 'portgroup': 'vMotion', 'security': [False, False, False], 'ts': 'No override', 'vlan\_id': 33, 'vswitch': 'vSwitch1'}]} |
### Authors
* Abhijeet Kasurde (@Akasurde)
* Christian Kotte (@ckotte)
| programming_docs |
ansible community.vmware.vmware_host_logbundle_info – Gathers manifest info for logbundle community.vmware.vmware\_host\_logbundle\_info – Gathers manifest info for logbundle
====================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_logbundle_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to gather manifest information for logbundle from ESXi.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **esxi\_hostname** string / required | | Name of the host system to fetch the manifests for logbundle. |
| **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. |
| **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. |
| **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
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: fetch the manifests for logbundle from ESXi
community.vmware.vmware_host_logbundle_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
esxi_hostname: "{{ esxi_hostname }}"
register: fetch_manifests_result
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **manifests** list / elements=string | always | list of dictionary of manifest information for logbundle **Sample:** [{'enabled': 'true', 'group': 'System', 'id': 'System:Base', 'name': 'Base', 'vmOnly': 'false'}, {'enabled': 'false', 'group': 'System', 'id': 'System:BaseMinmal', 'name': 'BaseMinmal', 'vmOnly': 'false'}, {'enabled': 'true', 'group': 'Fcd', 'id': 'Fcd:Catalog', 'name': 'Catalog', 'vmOnly': 'false'}, {'enabled': 'false', 'group': 'VirtualMachines', 'id': 'VirtualMachines:CoreDumpHung', 'name': 'CoreDumpHung', 'vmOnly': 'true'}, {'enabled': 'true', 'group': 'System', 'id': 'System:CoreDumps', 'name': 'CoreDumps', 'vmOnly': 'false'}] |
### Authors
* sky-joker (@sky-joker)
ansible community.vmware.vmware_category_info – Gather info about VMware tag categories community.vmware.vmware\_category\_info – Gather info about VMware tag categories
=================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_category_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to gather information about VMware tag categories.
* Tag feature is introduced in vSphere 6 version, so this module is not supported in earlier versions of vSphere.
* All variables and VMware object names are case sensitive.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
* vSphere Automation SDK
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **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. |
| **password** 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.
aliases: pass, pwd |
| **port** integer | **Default:**443 | The port number of the vSphere vCenter. If the value is not specified in the task, the value of environment variable `VMWARE_PORT` will be used instead. |
| **protocol** string | **Choices:*** http
* **https** ←
| The connection to protocol. |
| **proxy\_host** string added in 1.12.0 of community.vmware | | 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 added in 1.12.0 of community.vmware | | 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. |
| **username** 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.
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. |
Notes
-----
Note
* Tested on vSphere 6.5
Examples
--------
```
- name: Gather info about tag categories
community.vmware.vmware_category_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
delegate_to: localhost
register: all_tag_category_info
- name: Gather category id from given tag category
community.vmware.vmware_category_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
delegate_to: localhost
register: tag_category_results
- set_fact:
category_id: "{{ item.category_id }}"
loop: "{{ tag_category_results.tag_category_info|json_query(query) }}"
vars:
query: "[?category_name==`Category0001`]"
- debug: var=category_id
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **tag\_category\_info** list / elements=string | always | metadata of tag categories **Sample:** [{'category\_associable\_types': [], 'category\_cardinality': 'MULTIPLE', 'category\_description': 'awesome description', 'category\_id': 'urn:vmomi:InventoryServiceCategory:e785088d-6981-4b1c-9fb8-1100c3e1f742:GLOBAL', 'category\_name': 'Category0001', 'category\_used\_by': []}, {'category\_associable\_types': ['VirtualMachine'], 'category\_cardinality': 'SINGLE', 'category\_description': 'another awesome description', 'category\_id': 'urn:vmomi:InventoryServiceCategory:ae5b7c6c-e622-4671-9b96-76e93adb70f2:GLOBAL', 'category\_name': 'template\_tag', 'category\_used\_by': []}] |
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_datastore_cluster_manager – Manage VMware vSphere datastore cluster’s members community.vmware.vmware\_datastore\_cluster\_manager – Manage VMware vSphere datastore cluster’s members
========================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_datastore_cluster_manager`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to add datastore in the datastore cluster.
* All parameters and VMware object values are case sensitive.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **datacenter\_name** string | | The name of the datacenter.
aliases: datacenter |
| **datastore\_cluster\_name** string / required | | The name of the datastore cluster.
aliases: datastore\_cluster |
| **datastores** list / elements=string / required | | A list of datastores to be manage. |
| **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. |
| **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. |
| **state** string | **Choices:*** **present** ←
* absent
| If set to *present*, datastores specified by *datastores* will be added to the given datastore cluster. If set to *absent*, datastores specified by *datastores* will be moved from the given datastore cluster to datstore folder of the parent datacenter. |
| **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 on vSphere 6.0, 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Add datastore to the given datastore cluster
community.vmware.vmware_datastore_cluster_manager:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter_name: '{{ datacenter_name }}'
datastore_cluster_name: '{{ datastore_cluster_name }}'
datastores:
- ds_001
- ds_002
- ds_003
state: present
delegate_to: localhost
- name: Move datastore from the given datastore cluster
community.vmware.vmware_datastore_cluster_manager:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter_name: '{{ datacenter_name }}'
datastore_cluster_name: '{{ datastore_cluster_name }}'
datastores:
- ds_001
state: absent
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **datastore\_cluster\_info** string | always | information about datastore cluster **Sample:** {'changed\_datastores': ['ds\_171\_1'], 'current\_datastores': [], 'msg': None, 'previous\_datastores': ['ds\_171\_1']} |
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_vcenter_settings – Configures general settings on a vCenter server community.vmware.vmware\_vcenter\_settings – Configures general settings on a vCenter server
============================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
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](../../../reference_appendices/common_return_values#common-return-values), 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)
| programming_docs |
ansible community.vmware.vmware_object_role_permission – Manage local roles on an ESXi host community.vmware.vmware\_object\_role\_permission – Manage local roles on an ESXi host
======================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_object_role_permission`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to manage object permissions on the given host.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **group** string | | The group to be assigned permission. Required if `principal` is not specified. |
| **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. |
| **object\_name** string / required | | The object name to assigned permission. |
| **object\_type** string | **Choices:*** **Folder** ←
* VirtualMachine
* Datacenter
* ResourcePool
* Datastore
* Network
* HostSystem
* ComputeResource
* ClusterComputeResource
* DistributedVirtualSwitch
| The object type being targeted. |
| **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. |
| **principal** string | | The user to be assigned permission. Required if `group` is not specified. If specifying domain user, required separator of domain uses backslash. |
| **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. |
| **recursive** boolean | **Choices:*** no
* **yes** ←
| Should the permissions be recursively applied. |
| **role** string / required | | The role to be assigned permission. User can also specify role name presented in Web UI. Supported added in 1.5.0. |
| **state** string | **Choices:*** **present** ←
* absent
| Indicate desired state of the object's permission. When `state=present`, the permission will be added if it doesn't already exist. When `state=absent`, the permission is removed if it exists. |
| **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 on ESXi 6.5, vSphere 6.7
* The ESXi login user must have the appropriate rights to administer permissions.
* Permissions for a distributed switch must be defined and managed on either the datacenter or a folder containing the switch.
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Assign user to VM folder
community.vmware.vmware_object_role_permission:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
role: Admin
principal: user_bob
object_name: services
state: present
delegate_to: localhost
- name: Remove user from VM folder
community.vmware.vmware_object_role_permission:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
role: Admin
principal: user_bob
object_name: services
state: absent
delegate_to: localhost
- name: Assign finance group to VM folder
community.vmware.vmware_object_role_permission:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
role: Limited Users
group: finance
object_name: Accounts
state: present
delegate_to: localhost
- name: Assign view_user Read Only permission at root folder
community.vmware.vmware_object_role_permission:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
role: ReadOnly
principal: view_user
object_name: rootFolder
state: present
delegate_to: localhost
- name: Assign domain user to VM folder
community.vmware.vmware_object_role_permission:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: false
role: Admin
principal: "vsphere.local\\domainuser"
object_name: services
state: present
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **changed** boolean | always | whether or not a change was made to the object's role |
### Authors
* Derek Rushing (@kryptsi)
* Joseph Andreatta (@vmwjoseph)
ansible community.vmware.vcenter_domain_user_group_info – Gather user or group information of a domain community.vmware.vcenter\_domain\_user\_group\_info – Gather user or group information of a domain
==================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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.vcenter_domain_user_group_info`.
New in version 1.6.0: of community.vmware
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to gather information about user or group of a domain.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **belongs\_to\_group** string | | If a group existing, returned contains only users or groups that directly belong to the specified group. |
| **belongs\_to\_user** string | | If a user existing, returned contains only groups that directly contain the specified user. |
| **domain** string | **Default:**"vsphere.local" | The *domain* to be specified searching. |
| **exact\_match** boolean | **Choices:*** **no** ←
* yes
| If *exact\_match* is `True`, it indicates the *search\_string* passed should match a user or group name exactly. |
| **find\_groups** boolean | **Choices:*** no
* **yes** ←
| If *find\_groups* is `True`, domain groups will be included in the result. |
| **find\_users** boolean | **Choices:*** no
* **yes** ←
| If *find\_users* is `True`, domain users will be included in the result. |
| **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. |
| **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. |
| **search\_string** string / required | | The *search\_string* is a string to be specified searching. Specify the domain user or group name to be searched. |
| **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
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather all domain user and group of vsphere.local
community.vmware.vcenter_domain_user_group_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: false
domain: vsphere.local
search_string: ''
register: gather_all_domain_user_group_result
- name: Gather all domain user and group included the administrator string
community.vmware.vcenter_domain_user_group_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: false
domain: vsphere.local
search_string: administrator
register: gather_domain_user_group_result
- name: Gather all domain user of vsphere.local
community.vmware.vcenter_domain_user_group_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: false
domain: vsphere.local
search_string: ''
find_users: true
find_groups: false
register: gather_all_domain_user_result
- name: Gather administrator user by exact match condition
community.vmware.vcenter_domain_user_group_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: false
domain: vsphere.local
search_string: "vsphere.local\\administrator"
exact_match: true
register: gather_administrator_user_exact_match_result
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **domain\_user\_groups** list / elements=string | success | list of domain user and group information **Sample:** [ { "fullName": "Administrator vsphere.local", "group": false, "principal": "Administrator" } ] |
### Authors
* sky-joker (@sky-joker)
ansible community.vmware.vmware_host_scanhba – Rescan host HBA’s and optionally refresh the storage system community.vmware.vmware\_host\_scanhba – Rescan host HBA’s and optionally refresh the storage system
====================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_scanhba`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can force a rescan of the hosts HBA subsystem which is needed when wanting to mount a new datastore.
* You could use this before using [community.vmware.vmware\_host\_datastore](vmware_host_datastore_module#ansible-collections-community-vmware-vmware-host-datastore-module) to mount a new datastore to ensure your device/volume is ready.
* You can also optionally force a Refresh of the Storage System in vCenter/ESXi Web Client.
* All parameters and VMware object names are case sensitive.
* You can supply an esxi\_hostname or a cluster\_name
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Cluster name to Rescan the storage subsystem on (this will run the rescan task on each host in the cluster). |
| **esxi\_hostname** string | | ESXi hostname to Rescan the storage subsystem on. |
| **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. |
| **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. |
| **refresh\_storage** boolean | **Choices:*** **no** ←
* yes
| Refresh the storage system in vCenter/ESXi Web Client for each host found |
| **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 on vSphere 6.0
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Recan HBA's for a given ESXi host and refresh storage system objects
community.vmware.vmware_host_scanhba:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ inventory_hostname }}'
refresh_storage: true
delegate_to: localhost
- name: Rescan HBA's for a given cluster - all found hosts will be scanned
community.vmware.vmware_host_scanhba:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ inventory_hostname }}'
refresh_storage: true
delegate_to: localhost
- name: Recan HBA's for a given ESXi host and don't refresh storage system objects
community.vmware.vmware_host_scanhba:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ inventory_hostname }}'
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **result** dictionary | always | return confirmation of requested host and updated / refreshed storage system **Sample:** {'esxi01.example.com': {'refreshed\_storage': 'true', 'rescaned\_hba': 'true'}} |
### Authors
* Michael Eaton (@michaeldeaton)
ansible community.vmware.vmware_category_facts – Gather facts about VMware tag categories community.vmware.vmware\_category\_facts – Gather facts about VMware tag categories
===================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_category_facts`.
* [DEPRECATED](#deprecated)
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
* [Status](#status)
DEPRECATED
----------
Removed in
major release after 2021-12-01
Why
Deprecated in favour of [community.vmware.vmware\_category\_info](vmware_category_info_module#ansible-collections-community-vmware-vmware-category-info-module) module.
Alternative
Use [community.vmware.vmware\_category\_info](vmware_category_info_module#ansible-collections-community-vmware-vmware-category-info-module) instead.
Synopsis
--------
* This module can be used to gather facts about VMware tag categories.
* Tag feature is introduced in vSphere 6 version, so this module is not supported in earlier versions of vSphere.
* All variables and VMware object names are case sensitive.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
* vSphere Automation SDK
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **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. |
| **password** 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.
aliases: pass, pwd |
| **port** integer | **Default:**443 | The port number of the vSphere vCenter. If the value is not specified in the task, the value of environment variable `VMWARE_PORT` will be used instead. |
| **protocol** string | **Choices:*** http
* **https** ←
| The connection to protocol. |
| **proxy\_host** string added in 1.12.0 of community.vmware | | 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 added in 1.12.0 of community.vmware | | 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. |
| **username** 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.
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. |
Notes
-----
Note
* Tested on vSphere 6.5
Examples
--------
```
- name: Gather facts about tag categories
community.vmware.vmware_category_facts:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
delegate_to: localhost
register: all_tag_category_facts
- name: Gather category id from given tag category
community.vmware.vmware_category_facts:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
delegate_to: localhost
register: tag_category_results
- set_fact:
category_id: "{{ item.category_id }}"
loop: "{{ tag_category_results.tag_category_facts|json_query(query) }}"
vars:
query: "[?category_name==`Category0001`]"
- debug: var=category_id
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **tag\_category\_facts** list / elements=string | always | metadata of tag categories **Sample:** [{'category\_associable\_types': [], 'category\_cardinality': 'MULTIPLE', 'category\_description': 'awesome description', 'category\_id': 'urn:vmomi:InventoryServiceCategory:e785088d-6981-4b1c-9fb8-1100c3e1f742:GLOBAL', 'category\_name': 'Category0001', 'category\_used\_by': []}, {'category\_associable\_types': ['VirtualMachine'], 'category\_cardinality': 'SINGLE', 'category\_description': 'another awesome description', 'category\_id': 'urn:vmomi:InventoryServiceCategory:ae5b7c6c-e622-4671-9b96-76e93adb70f2:GLOBAL', 'category\_name': 'template\_tag', 'category\_used\_by': []}] |
Status
------
* This module will be removed in a major release after 2021-12-01. *[deprecated]*
* For more information see [DEPRECATED](#deprecated).
### Authors
* Abhijeet Kasurde (@Akasurde)
| programming_docs |
ansible community.vmware.vmware_guest_boot_facts – Gather facts about boot options for the given virtual machine community.vmware.vmware\_guest\_boot\_facts – Gather facts about boot options for the given virtual machine
===========================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_guest_boot_facts`.
* [DEPRECATED](#deprecated)
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
* [Status](#status)
DEPRECATED
----------
Removed in
major release after 2021-12-01
Why
Deprecated in favour of [community.vmware.vmware\_guest\_boot\_info](vmware_guest_boot_info_module#ansible-collections-community-vmware-vmware-guest-boot-info-module) module.
Alternative
Use [community.vmware.vmware\_guest\_boot\_info](vmware_guest_boot_info_module#ansible-collections-community-vmware-vmware-guest-boot-info-module) instead.
Synopsis
--------
* Gather facts about boot options for the given virtual machine.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **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. |
| **moid** string | | Managed Object ID of the instance to manage if known, this is a unique identifier only within a single vCenter instance. This is required if `name` or `uuid` is not supplied. |
| **name** string | | Name of the VM to work with. This is required if `uuid` or `moid` parameter is not supplied. |
| **name\_match** string | **Choices:*** **first** ←
* last
| If multiple virtual machines matching the name, use the first or last found. |
| **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. |
| **use\_instance\_uuid** boolean | **Choices:*** **no** ←
* yes
| Whether to use the VMware instance UUID rather than the BIOS UUID. |
| **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 |
| **uuid** string | | UUID of the instance to manage if known, this is VMware's BIOS UUID by default. This is required if `name` or `moid` parameter is not supplied. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather facts about virtual machine's boot order and related parameters
community.vmware.vmware_guest_boot_facts:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
name: "{{ vm_name }}"
register: vm_boot_order_facts
- name: Gather facts about virtual machine's boot order using MoID
community.vmware.vmware_guest_boot_facts:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
moid: "vm-42"
register: vm_moid_boot_order_facts
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **vm\_boot\_facts** dictionary | always | metadata about boot order of virtual machine **Sample:** {'current\_boot\_delay': 2000, 'current\_boot\_firmware': 'bios', 'current\_boot\_order': ['floppy', 'disk', 'ethernet', 'cdrom'], 'current\_boot\_retry\_delay': 22300, 'current\_boot\_retry\_enabled': True, 'current\_enter\_bios\_setup': True, 'current\_secure\_boot\_enabled': False} |
Status
------
* This module will be removed in a major release after 2021-12-01. *[deprecated]*
* For more information see [DEPRECATED](#deprecated).
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_tag_info – Manage VMware tag info community.vmware.vmware\_tag\_info – Manage VMware tag info
===========================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_tag_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to collect information about VMware tags.
* Tag feature is introduced in vSphere 6 version, so this module is not supported in the earlier versions of vSphere.
* All variables and VMware object names are case sensitive.
* This module was called `vmware_tag_facts` before Ansible 2.9. The usage did not change.
* `tag_facts` will be deprecated in Ansible 2.14, since it does not return multiple tags with same name and different category id.
* Please use `tag_info` instead of `tag_facts`.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
* vSphere Automation SDK
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **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. |
| **password** 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.
aliases: pass, pwd |
| **port** integer | **Default:**443 | The port number of the vSphere vCenter. If the value is not specified in the task, the value of environment variable `VMWARE_PORT` will be used instead. |
| **protocol** string | **Choices:*** http
* **https** ←
| The connection to protocol. |
| **proxy\_host** string added in 1.12.0 of community.vmware | | 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 added in 1.12.0 of community.vmware | | 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. |
| **username** 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.
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. |
Notes
-----
Note
* Tested on vSphere 6.5
Examples
--------
```
- name: Get info about tag
community.vmware.vmware_tag_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
delegate_to: localhost
- name: Get category id from the given tag
community.vmware.vmware_tag_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
delegate_to: localhost
register: tag_details
- debug:
msg: "{{ tag_details.tag_facts['fedora_machines']['tag_category_id'] }}"
- name: Gather tag id from the given tag
community.vmware.vmware_tag_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
delegate_to: localhost
register: tag_results
- set_fact:
tag_id: "{{ item.tag_id }}"
loop: "{{ tag_results.tag_info|json_query(query) }}"
vars:
query: "[?tag_name==`tag0001`]"
- debug: var=tag_id
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **tag\_facts** dictionary | on success | dictionary of tag metadata **Sample:** {'Sample\_Tag\_0002': {'tag\_category\_id': 'urn:vmomi:InventoryServiceCategory:6de17f28-7694-43ec-a783-d09c141819ae:GLOBAL', 'tag\_description': 'Sample Description', 'tag\_id': 'urn:vmomi:InventoryServiceTag:a141f212-0f82-4f05-8eb3-c49647c904c5:GLOBAL', 'tag\_used\_by': []}, 'fedora\_machines': {'tag\_category\_id': 'urn:vmomi:InventoryServiceCategory:baa90bae-951b-4e87-af8c-be681a1ba30c:GLOBAL', 'tag\_description': '', 'tag\_id': 'urn:vmomi:InventoryServiceTag:7d27d182-3ecd-4200-9d72-410cc6398a8a:GLOBAL', 'tag\_used\_by': []}, 'ubuntu\_machines': {'tag\_category\_id': 'urn:vmomi:InventoryServiceCategory:89573410-29b4-4cac-87a4-127c084f3d50:GLOBAL', 'tag\_description': '', 'tag\_id': 'urn:vmomi:InventoryServiceTag:7f3516d5-a750-4cb9-8610-6747eb39965d:GLOBAL', 'tag\_used\_by': []}} |
| **tag\_info** list / elements=string | on success | list of tag metadata **Sample:** [{'tag\_category\_id': 'urn:vmomi:InventoryServiceCategory:6de17f28-7694-43ec-a783-d09c141819ae:GLOBAL', 'tag\_description': 'Sample Description', 'tag\_id': 'urn:vmomi:InventoryServiceTag:a141f212-0f82-4f05-8eb3-c49647c904c5:GLOBAL', 'tag\_name': 'Sample\_Tag\_0002', 'tag\_used\_by': []}, {'tag\_category\_id': 'urn:vmomi:InventoryServiceCategory:6de17f28-7694-43ec-a783-d09c141819ae:GLOBAL', 'tag\_description': '', 'tag\_id': 'urn:vmomi:InventoryServiceTag:7d27d182-3ecd-4200-9d72-410cc6398a8a:GLOBAL', 'tag\_name': 'Sample\_Tag\_0002', 'tag\_used\_by': []}, {'tag\_category\_id': 'urn:vmomi:InventoryServiceCategory:89573410-29b4-4cac-87a4-127c084f3d50:GLOBAL', 'tag\_description': '', 'tag\_id': 'urn:vmomi:InventoryServiceTag:7f3516d5-a750-4cb9-8610-6747eb39965d:GLOBAL', 'tag\_name': 'ubuntu\_machines', 'tag\_used\_by': []}] |
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_host_ssl_facts – Gather facts of ESXi host system about SSL community.vmware.vmware\_host\_ssl\_facts – Gather facts of ESXi host system about SSL
======================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_ssl_facts`.
* [DEPRECATED](#deprecated)
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
* [Status](#status)
DEPRECATED
----------
Removed in
major release after 2021-12-01
Why
Deprecated in favour of [community.vmware.vmware\_host\_ssl\_info](vmware_host_ssl_info_module#ansible-collections-community-vmware-vmware-host-ssl-info-module) module.
Alternative
Use [community.vmware.vmware\_host\_ssl\_info](vmware_host_ssl_info_module#ansible-collections-community-vmware-vmware-host-ssl-info-module) instead.
Synopsis
--------
* This module can be used to gather facts of the SSL thumbprint information for a host.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster. SSL thumbprint information about all ESXi host system in the given cluster will be reported. If `esxi_hostname` is not given, this parameter is required. |
| **esxi\_hostname** string | | ESXi hostname. SSL thumbprint information of this ESXi host system will be reported. If `cluster_name` is not given, this parameter is required. |
| **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. |
| **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. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather SSL thumbprint information about all ESXi Hosts in given Cluster
community.vmware.vmware_host_ssl_facts:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: '{{ cluster_name }}'
delegate_to: localhost
register: all_host_ssl_facts
- name: Get SSL Thumbprint info about "{{ esxi_hostname }}"
community.vmware.vmware_host_ssl_facts:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
esxi_hostname: '{{ esxi_hostname }}'
register: ssl_facts
- set_fact:
ssl_thumbprint: "{{ ssl_facts['host_ssl_facts'][esxi_hostname]['ssl_thumbprints'][0] }}"
- debug:
msg: "{{ ssl_thumbprint }}"
- name: Add ESXi Host to vCenter
vmware_host:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter_name: '{{ datacenter_name }}'
cluster_name: '{{ cluster_name }}'
esxi_hostname: '{{ esxi_hostname }}'
esxi_username: '{{ esxi_username }}'
esxi_password: '{{ esxi_password }}'
esxi_ssl_thumbprint: '{{ ssl_thumbprint }}'
state: present
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **host\_ssl\_facts** dictionary | facts | dict with hostname as key and dict with SSL thumbprint related facts **Sample:** {'10.76.33.215': {'owner\_tag': '', 'principal': 'vpxuser', 'ssl\_thumbprints': ['E3:E8:A9:20:8D:32:AE:59:C6:8D:A5:91:B0:20:EF:00:A2:7C:27:EE', 'F1:AC:DA:6E:D8:1E:37:36:4A:5C:07:E5:04:0B:87:C8:75:FB:42:01']}} |
Status
------
* This module will be removed in a major release after 2021-12-01. *[deprecated]*
* For more information see [DEPRECATED](#deprecated).
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_local_user_info – Gather info about users on the given ESXi host community.vmware.vmware\_local\_user\_info – Gather info about users on the given ESXi host
===========================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_local_user_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to gather information about users present on the given ESXi host system in VMware infrastructure.
* All variables and VMware object names are case sensitive.
* User must hold the ‘Authorization.ModifyPermissions’ privilege to invoke this module.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **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. |
| **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. |
| **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 on ESXi 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather info about all Users on given ESXi host system
community.vmware.vmware_local_user_info:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
delegate_to: localhost
register: all_user_info
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **local\_user\_info** dictionary | always | metadata about all local users **Sample:** [{'description': 'Administrator', 'group': False, 'role': 'admin', 'shell\_access': True, 'user\_id': 0, 'user\_name': 'root'}, {'description': 'DCUI User', 'group': False, 'role': 'admin', 'shell\_access': False, 'user\_id': 100, 'user\_name': 'dcui'}] |
### Authors
* Abhijeet Kasurde (@Akasurde)
* Christian Kotte (@ckotte)
| programming_docs |
ansible community.vmware.vmware_host_sriov – Manage SR-IOV settings on host community.vmware.vmware\_host\_sriov – Manage SR-IOV settings on host
=====================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_sriov`.
New in version 1.0.0: of community.vmware
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to configure, enable or disable SR-IOV functions on ESXi host.
* Module does not reboot the host after changes, but puts it in output “rebootRequired” state.
* User can specify an ESXi hostname or Cluster name. In case of cluster name, all ESXi hosts are updated.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster from which all host systems will be used. This parameter is required if `esxi_hostname` is not specified. |
| **esxi\_hostname** string | | Name of the host system to work with. This parameter is required if `cluster_name` is not specified. User can specify specific host from the cluster. |
| **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. |
| **num\_virt\_func** integer / required | | number of functions to activate on interface. 0 means SR-IOV disabled. number greater than 0 means SR-IOV enabled. |
| **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. |
| **sriov\_on** boolean | **Choices:*** no
* yes
| optional parameter, related to `num_virt_func`. SR-IOV can be enabled only if `num_virt_func` > 0. |
| **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. |
| **vmnic** string / required | | Interface name, like vmnic0. |
Notes
-----
Note
* Tested on vSphere 6.0
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: enable SR-IOV on vmnic0 with 8 functions
community.vmware.vmware_host_sriov:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
esxi_hostname: "{{ esxi1 }}"
vmnic: vmnic0
sriov_on: true
num_virt_func: 8
- name: enable SR-IOV on already enabled interface vmnic0
community.vmware.vmware_host_sriov:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
esxi_hostname: "{{ esxi1 }}"
vmnic: vmnic0
sriov_on: true
num_virt_func: 8
- name: enable SR-IOV on vmnic0 with big number of functions
community.vmware.vmware_host_sriov:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
esxi_hostname: "{{ esxi1 }}"
vmnic: vmnic0
sriov_on: true
num_virt_func: 100
ignore_errors: true
- name: disable SR-IOV on vmnic0
community.vmware.vmware_host_sriov:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
esxi_hostname: "{{ esxi1 }}"
vmnic: vmnic0
sriov_on: false
num_virt_func: 0
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **host\_sriov\_diff** dictionary | always | contains info about SR-IOV status on vmnic before, after and requested changes sometimes vCenter slowly update info, as result "after" contains same info as "before" need to run again in check\_mode or reboot host, as ESXi requested **Sample:** {'changed': True, 'diff': {'after': {'host\_test': {'maxVirtualFunctionSupported': 63, 'numVirtualFunction': 0, 'numVirtualFunctionRequested': 8, 'rebootRequired': True, 'sriovActive': False, 'sriovCapable': True, 'sriovEnabled': True}}, 'before': {'host\_test': {'maxVirtualFunctionSupported': 63, 'numVirtualFunction': 0, 'numVirtualFunctionRequested': 0, 'rebootRequired': False, 'sriovActive': False, 'sriovCapable': True, 'sriovEnabled': False}}, 'changes': {'host\_test': {'numVirtualFunction': 8, 'rebootRequired': True, 'sriovEnabled': True}}}} |
### Authors
* Viktor Tsymbalyuk (@victron)
ansible community.vmware.vmware_host_package_info – Gathers info about available packages on an ESXi host community.vmware.vmware\_host\_package\_info – Gathers info about available packages on an ESXi host
====================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_package_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to gather information about available packages and their status on an ESXi host.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster. Package information about each ESXi server will be returned for given cluster. If `esxi_hostname` is not given, this parameter is required. |
| **esxi\_hostname** string | | ESXi hostname. Package information about this ESXi server will be returned. If `cluster_name` is not given, this parameter is required. |
| **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. |
| **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. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather info about all ESXi Host in given Cluster
community.vmware.vmware_host_package_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: cluster_name
delegate_to: localhost
register: cluster_host_packages
- name: Gather info about ESXi Host
community.vmware.vmware_host_package_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
delegate_to: localhost
register: host_packages
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **hosts\_package\_info** dictionary | hosts\_package\_info | dict with hostname as key and dict with package information as value **Sample:** {'hosts\_package\_info': {'localhost.localdomain': []}} |
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_guest_customization_facts – Gather facts about VM customization specifications community.vmware.vmware\_guest\_customization\_facts – Gather facts about VM customization specifications
=========================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_guest_customization_facts`.
* [DEPRECATED](#deprecated)
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
* [Status](#status)
DEPRECATED
----------
Removed in
major release after 2021-12-01
Why
Deprecated in favour of [community.vmware.vmware\_guest\_customization\_info](vmware_guest_customization_info_module#ansible-collections-community-vmware-vmware-guest-customization-info-module) module.
Alternative
Use [community.vmware.vmware\_guest\_customization\_info](vmware_guest_customization_info_module#ansible-collections-community-vmware-vmware-guest-customization-info-module) instead.
Synopsis
--------
* This module can be used to gather facts about customization specifications.
* All parameters and VMware object names are case sensitive.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **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. |
| **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. |
| **spec\_name** string | | Name of customization specification to find. |
| **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 on vSphere 6.0 and 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather facts about all customization specification
community.vmware.vmware_guest_customization_facts:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
delegate_to: localhost
register: all_custom_spec_facts
- name: Gather facts about customization specification with the given name
community.vmware.vmware_guest_customization_facts:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
spec_name: custom_linux_spec
delegate_to: localhost
register: custom_spec_facts
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **custom\_spec\_facts** dictionary | always | metadata about the customization specification **Sample:** {'assignip-eee0d684-44b7-457c-8c55-2585590b0d99': {'change\_version': '1523438001', 'description': 'sample description', 'dns\_server\_list': [], 'dns\_suffix\_list': [], 'domain': 'None', 'hostname': 'sample1', 'hw\_clock\_utc': None, 'last\_updated\_time': '2018-04-11T09:13:21+00:00', 'name': 'sample', 'nic\_setting\_map': [{'dns\_domain': None, 'gateway': [], 'ip\_address': '192.168.10.10', 'net\_bios': None, 'nic\_dns\_server\_list': [], 'primary\_wins': None, 'secondry\_wins': None, 'subnet\_mask': '255.255.255.0'}], 'time\_zone': None, 'type': 'Linux'}} |
Status
------
* This module will be removed in a major release after 2021-12-01. *[deprecated]*
* For more information see [DEPRECATED](#deprecated).
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_vswitch – Manage a VMware Standard Switch to an ESXi host. community.vmware.vmware\_vswitch – Manage a VMware Standard Switch to an ESXi host.
===================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_vswitch`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to add, remove and update a VMware Standard Switch to an ESXi host.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **esxi\_hostname** string | | Manage the vSwitch using this ESXi host system.
aliases: host |
| **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. |
| **mtu** integer | **Default:**1500 | MTU to configure on vSwitch. |
| **nics** list / elements=string | **Default:**[] | A list of vmnic names or vmnic name to attach to vSwitch. Alias `nics` is added in version 2.4.
aliases: nic\_name |
| **number\_of\_ports** integer | **Default:**128 | Number of port to configure on vSwitch. |
| **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. |
| **state** string | **Choices:*** absent
* **present** ←
| Add or remove the switch. |
| **switch** string / required | | vSwitch name to add. Alias `switch` is added in version 2.4.
aliases: switch\_name |
| **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 on vSphere 5.5 and 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Add a VMware vSwitch
community.vmware.vmware_vswitch:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
switch: vswitch_name
nics: vmnic_name
mtu: 9000
delegate_to: localhost
- name: Add a VMware vSwitch without any physical NIC attached
community.vmware.vmware_vswitch:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
switch: vswitch_0001
mtu: 9000
delegate_to: localhost
- name: Add a VMware vSwitch with multiple NICs
community.vmware.vmware_vswitch:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
switch: vmware_vswitch_0004
nics:
- vmnic1
- vmnic2
mtu: 9000
delegate_to: localhost
- name: Add a VMware vSwitch to a specific host system
community.vmware.vmware_vswitch:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
esxi_hostname: DC0_H0
switch_name: vswitch_001
nic_name: vmnic0
mtu: 9000
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **result** string | always | information about performed operation **Sample:** vSwitch 'vSwitch\_1002' is created successfully |
### Authors
* Joseph Callen (@jcpowermac)
* Russell Teague (@mtnbikenc)
* Abhijeet Kasurde (@Akasurde) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#06676d677573746263202535313d202533343d2025323e3d7463626e6772202532303d65696b)>
| programming_docs |
ansible community.vmware.vmware_guest_cross_vc_clone – Cross-vCenter VM/template clone community.vmware.vmware\_guest\_cross\_vc\_clone – Cross-vCenter VM/template clone
==================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_guest_cross_vc_clone`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used for Cross-vCenter vm/template clone
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **destination\_datastore** string / required | | The name of the destination datastore or the datastore cluster. If datastore cluster name is specified, we will find the Storage DRS recommended datastore in that cluster. |
| **destination\_host** string / required | | The name of the destination host. |
| **destination\_resource\_pool** string | | Destination resource pool. If not provided, the destination host's parent's resource pool will be used. |
| **destination\_vcenter** string / required | | The hostname or IP address of the destination VCenter. |
| **destination\_vcenter\_password** string / required | | The password of the destination VCenter. |
| **destination\_vcenter\_port** integer | **Default:**443 | The port to establish connection in the destination VCenter. |
| **destination\_vcenter\_username** string / required | | The username of the destination VCenter. |
| **destination\_vcenter\_validate\_certs** boolean | **Choices:*** **no** ←
* yes
| Parameter to indicate if certification validation needs to be done on destination VCenter. |
| **destination\_vm\_folder** string / required | | Destination folder, absolute path to deploy the cloned vm. This parameter is case sensitive. Examples: folder: vm folder: ha-datacenter/vm folder: /datacenter1/vm |
| **destination\_vm\_name** string / required | | The name of the cloned VM. |
| **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. |
| **moid** string | | Managed Object ID of the vm/template instance to manage if known, this is a unique identifier only within a single vCenter instance. This is required if `name` or `uuid` is not supplied. |
| **name** string | | Name of the virtual machine or template. This is a required parameter, if parameter `uuid` or `moid` is not supplied. |
| **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. |
| **state** string | **Choices:*** **present** ←
* poweredon
| The state of Virtual Machine deployed. If set to `present` and VM does not exists, then VM is created. If set to `present` and VM exists, no action is taken. If set to `poweredon` and VM does not exists, then VM is created with powered on state. If set to `poweredon` and VM exists, no action is taken. |
| **use\_instance\_uuid** boolean | **Choices:*** **no** ←
* yes
| Whether to use the VMware instance UUID rather than the BIOS UUID. |
| **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 |
| **uuid** string | | UUID of the vm/template instance to clone from, this is VMware's unique identifier. This is a required parameter, if parameter `name` or `moid` is not supplied. |
| **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
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
# Clone template
- name: clone a template across VC
community.vmware.vmware_guest_cross_vc_clone:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
name: "test_vm1"
destination_vm_name: "cloned_vm_from_template"
destination_vcenter: '{{ destination_vcenter_hostname }}'
destination_vcenter_username: '{{ destination_vcenter_username }}'
destination_vcenter_password: '{{ destination_vcenter_password }}'
destination_vcenter_port: '{{ destination_vcenter_port }}'
destination_vcenter_validate_certs: '{{ destination_vcenter_validate_certs }}'
destination_host: '{{ destination_esxi }}'
destination_datastore: '{{ destination_datastore }}'
destination_vm_folder: '{{ destination_vm_folder }}'
state: present
register: cross_vc_clone_from_template
- name: clone a VM across VC
community.vmware.vmware_guest_cross_vc_clone:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: "{{ vcenter_password }}"
name: "test_vm1"
destination_vm_name: "cloned_vm_from_vm"
destination_vcenter: '{{ destination_vcenter_hostname }}'
destination_vcenter_username: '{{ destination_vcenter_username }}'
destination_vcenter_password: '{{ destination_vcenter_password }}'
destination_host: '{{ destination_esxi }}'
destination_datastore: '{{ destination_datastore }}'
destination_vm_folder: '{{ destination_vm_folder }}'
state: poweredon
register: cross_vc_clone_from_vm
- name: check_mode support
community.vmware.vmware_guest_cross_vc_clone:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: "{{ vcenter_password }}"
name: "test_vm1"
destination_vm_name: "cloned_vm_from_vm"
destination_vcenter: '{{ destination_vcenter_hostname }}'
destination_vcenter_username: '{{ destination_vcenter_username }}'
destination_vcenter_password: '{{ destination_vcenter_password }}'
destination_host: '{{ destination_esxi }}'
destination_datastore: '{{ destination_datastore }}'
destination_vm_folder: '{{ destination_vm_folder }}'
check_mode: true
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **vm\_info** dictionary | always | metadata about the virtual machine **Sample:** {'datastore': '', 'host': '', 'power\_on': '', 'vcenter': '', 'vm\_folder': '', 'vm\_name': ''} |
### Authors
* Anusha Hegde (@anusha94)
ansible community.vmware.vmware_content_deploy_ovf_template – Deploy Virtual Machine from ovf template stored in content library. community.vmware.vmware\_content\_deploy\_ovf\_template – Deploy Virtual Machine from ovf template stored in content library.
=============================================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_content_deploy_ovf_template`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Module to deploy virtual machine from ovf template in content library.
* All variables and VMware object names are case sensitive.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
* vSphere Automation SDK
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster** string | | Name of the cluster in datacenter in which to place deployed VM. |
| **datacenter** string / required | | Name of the datacenter, where VM to be deployed. |
| **datastore** string | | Name of the datastore to store deployed VM and disk. |
| **datastore\_cluster** string added in 1.9.0 of community.vmware | | Name of the datastore cluster housing a datastore to store deployed VM and disk. If datastore is not specified, the recommended datastore from this cluster will be used. |
| **folder** string | **Default:**"vm" | Name of the folder in datacenter in which to place deployed VM. |
| **host** string | | Name of the ESX Host in datacenter in which to place deployed VM. The host has to be a member of the cluster that contains the resource pool. |
| **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. |
| **library** string added in 1.5.0 of community.vmware | | The name of the content library from where the template resides.
aliases: content\_library, content\_library\_src |
| **log\_level** string added in 1.12.0 of community.vmware | **Choices:*** debug
* info
* **normal** ←
| The level of logging desired in this module. |
| **name** string / required | | The name of the VM to be deployed.
aliases: vm\_name |
| **password** 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.
aliases: pass, pwd |
| **port** integer | **Default:**443 | The port number of the vSphere vCenter. If the value is not specified in the task, the value of environment variable `VMWARE_PORT` will be used instead. |
| **protocol** string | **Choices:*** http
* **https** ←
| The connection to protocol. |
| **proxy\_host** string added in 1.12.0 of community.vmware | | 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 added in 1.12.0 of community.vmware | | 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. |
| **resource\_pool** string | | Name of the resourcepool in datacenter in which to place deployed VM. |
| **storage\_provisioning** string | **Choices:*** **thin** ←
* thick
* eagerZeroedThick
* eagerzeroedthick
| Default storage provisioning type to use for all sections of type vmw:StorageSection in the OVF descriptor. |
| **template** string / required | | The name of OVF template from which VM to be deployed.
aliases: ovf, ovf\_template, template\_src |
| **username** 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.
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. |
Notes
-----
Note
* Tested on vSphere 6.7
Examples
--------
```
- name: Deploy Virtual Machine from OVF template in content library
community.vmware.vmware_content_deploy_ovf_template:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
ovf_template: rhel_test_template
datastore: Shared_NFS_Volume
folder: vm
datacenter: Sample_DC_1
name: Sample_VM
resource_pool: test_rp
delegate_to: localhost
- name: Deploy Virtual Machine from OVF template in content library with eagerZeroedThick storage
vmware_content_deploy_ovf_template:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
ovf_template: rhel_test_template
datastore: Shared_NFS_Volume
folder: vm
datacenter: Sample_DC_1
name: Sample_VM
resource_pool: test_rp
storage_provisioning: eagerZeroedThick
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **vm\_deploy\_info** dictionary | on success | Virtual machine deployment message and vm\_id **Sample:** {'msg': "Deployed Virtual Machine 'Sample\_VM'.", 'vm\_id': 'vm-1009'} |
### Authors
* Lev Goncharv (@ultral)
ansible community.vmware.vmware_dvswitch_pvlans – Manage Private VLAN configuration of a Distributed Switch community.vmware.vmware\_dvswitch\_pvlans – Manage Private VLAN configuration of a Distributed Switch
=====================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_dvswitch_pvlans`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to configure Private VLANs (PVLANs) on a Distributed Switch.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **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. |
| **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. |
| **primary\_pvlans** list / elements=dictionary | **Default:**[] | A list of VLAN IDs that should be configured as Primary PVLANs. If `primary_pvlans` isn't specified, all PVLANs will be deleted if present. Each member of the list requires primary\_pvlan\_id (int) set. The secondary promiscuous PVLAN will be created automatically. If `secondary_pvlans` isn't specified, the primary PVLANs and each secondary promiscuous PVLAN will be created. Please see examples for more information. |
| **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. |
| **secondary\_pvlans** list / elements=dictionary | **Default:**[] | A list of VLAN IDs that should be configured as Secondary PVLANs.
`primary_pvlans` need to be specified to create any Secondary PVLAN. If `primary_pvlans` isn't specified, all PVLANs will be deleted if present. Each member of the list requires primary\_pvlan\_id (int), secondary\_pvlan\_id (int), and pvlan\_type (str) to be set. The type of the secondary PVLAN can be isolated or community. The secondary promiscuous PVLAN will be created automatically. Please see examples for more information. |
| **switch** string / required | | The name of the Distributed Switch.
aliases: dvswitch |
| **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 on vSphere 6.5 and 6.7
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Create PVLANs on a Distributed Switch
community.vmware.vmware_dvswitch_pvlans:
hostname: '{{ inventory_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
switch: dvSwitch
primary_pvlans:
- primary_pvlan_id: 1
- primary_pvlan_id: 4
secondary_pvlans:
- primary_pvlan_id: 1
secondary_pvlan_id: 2
pvlan_type: isolated
- primary_pvlan_id: 1
secondary_pvlan_id: 3
pvlan_type: community
- primary_pvlan_id: 4
secondary_pvlan_id: 5
pvlan_type: community
delegate_to: localhost
- name: Create primary PVLAN and secondary promiscuous PVLAN on a Distributed Switch
community.vmware.vmware_dvswitch_pvlans:
hostname: '{{ inventory_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
switch: dvSwitch
primary_pvlans:
- primary_pvlan_id: 1
delegate_to: localhost
- name: Remove all PVLANs from a Distributed Switch
community.vmware.vmware_dvswitch_pvlans:
hostname: '{{ inventory_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
switch: dvSwitch
primary_pvlans: []
secondary_pvlans: []
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **result** string | always | information about performed operation **Sample:** {'changed': True, 'dvswitch': 'dvSwitch', 'private\_vlans': [{'primary\_pvlan\_id': 1, 'pvlan\_type': 'promiscuous', 'secondary\_pvlan\_id': 1}, {'primary\_pvlan\_id': 1, 'pvlan\_type': 'isolated', 'secondary\_pvlan\_id': 2}, {'primary\_pvlan\_id': 1, 'pvlan\_type': 'community', 'secondary\_pvlan\_id': 3}], 'private\_vlans\_previous': [], 'result': 'All private VLANs added'} |
### Authors
* Christian Kotte (@ckotte)
| programming_docs |
ansible community.vmware.vmware_host_firewall_manager – Manage firewall configurations about an ESXi host community.vmware.vmware\_host\_firewall\_manager – Manage firewall configurations about an ESXi host
====================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_firewall_manager`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to manage firewall configurations about an ESXi host when ESXi hostname or Cluster name is given.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster. Firewall settings are applied to every ESXi host system in given cluster. If `esxi_hostname` is not given, this parameter is required. |
| **esxi\_hostname** string | | ESXi hostname. Firewall settings are applied to this ESXi host system. If `cluster_name` is not given, this parameter is required. |
| **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. |
| **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. |
| **rules** list / elements=dictionary | **Default:**[] | A list of Rule set which needs to be managed. Each member of list is rule set name and state to be set the rule. Both rule name and rule state are required parameters. Additional IPs and networks can also be specified Please see examples for more information. |
| **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 on vSphere 6.0, vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Enable vvold rule set for all ESXi Host in given Cluster
community.vmware.vmware_host_firewall_manager:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: cluster_name
rules:
- name: vvold
enabled: True
allowed_hosts:
all_ip: True
delegate_to: localhost
- name: Enable vvold rule set for an ESXi Host
community.vmware.vmware_host_firewall_manager:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
rules:
- name: vvold
enabled: True
allowed_hosts:
all_ip: True
delegate_to: localhost
- name: Manage multiple rule set for an ESXi Host
community.vmware.vmware_host_firewall_manager:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
rules:
- name: vvold
enabled: True
allowed_hosts:
all_ip: True
- name: CIMHttpServer
enabled: False
delegate_to: localhost
- name: Manage IP and network based firewall permissions for ESXi
community.vmware.vmware_host_firewall_manager:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
rules:
- name: gdbserver
enabled: True
allowed_hosts:
all_ip: False
ip_address:
- 192.168.20.10
- 192.168.20.11
- name: CIMHttpServer
enabled: True
allowed_hosts:
all_ip: False
ip_network:
- 192.168.100.0/24
- name: remoteSerialPort
enabled: True
allowed_hosts:
all_ip: False
ip_address:
- 192.168.100.11
ip_network:
- 192.168.200.0/24
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **rule\_set\_state** dictionary | success | dict with hostname as key and dict with firewall rule set facts as value **Sample:** {'rule\_set\_state': {'localhost.localdomain': {'CIMHttpServer': {'allowed\_hosts': {'current\_allowed\_all': True, 'current\_allowed\_ip': [], 'current\_allowed\_networks': [], 'desired\_allowed\_all': True, 'desired\_allowed\_ip': [], 'desired\_allowed\_networks': [], 'previous\_allowed\_all': True, 'previous\_allowed\_ip': [], 'previous\_allowed\_networks': []}, 'current\_state': False, 'desired\_state': False, 'previous\_state': True}, 'remoteSerialPort': {'allowed\_hosts': {'current\_allowed\_all': False, 'current\_allowed\_ip': ['192.168.100.11'], 'current\_allowed\_networks': ['192.168.200.0/24'], 'desired\_allowed\_all': False, 'desired\_allowed\_ip': ['192.168.100.11'], 'desired\_allowed\_networks': ['192.168.200.0/24'], 'previous\_allowed\_all': True, 'previous\_allowed\_ip': [], 'previous\_allowed\_networks': []}, 'current\_state': True, 'desired\_state': True, 'previous\_state': True}}}} |
### Authors
* Abhijeet Kasurde (@Akasurde)
* Aaron Longchamps (@alongchamps)
ansible community.vmware.vmware_host_config_manager – Manage advanced system settings of an ESXi host community.vmware.vmware\_host\_config\_manager – Manage advanced system settings of an ESXi host
================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_config_manager`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module can be used to manage advanced system settings of an ESXi host when ESXi hostname or Cluster name is given.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster. Settings are applied to every ESXi host in given cluster. If `esxi_hostname` is not given, this parameter is required. |
| **esxi\_hostname** string | | ESXi hostname. Settings are applied to this ESXi host. If `cluster_name` is not given, this parameter is required. |
| **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. |
| **options** dictionary | **Default:**{} | A dictionary of advanced system settings. Invalid options will cause module to error. Note that the list of advanced options (with description and values) can be found by running `vim-cmd hostsvc/advopt/options`. |
| **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. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Manage Log level setting for all ESXi hosts in given Cluster
community.vmware.vmware_host_config_manager:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: cluster_name
options:
'Config.HostAgent.log.level': 'info'
delegate_to: localhost
- name: Manage Log level setting for an ESXi host
community.vmware.vmware_host_config_manager:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
options:
'Config.HostAgent.log.level': 'verbose'
delegate_to: localhost
- name: Manage multiple settings for an ESXi host
community.vmware.vmware_host_config_manager:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
options:
'Config.HostAgent.log.level': 'verbose'
'Annotations.WelcomeMessage': 'Hello World'
'Config.HostAgent.plugins.solo.enableMob': false
delegate_to: localhost
```
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_drs_group – Creates vm/host group in a given cluster. community.vmware.vmware\_drs\_group – Creates vm/host group in a given cluster.
===============================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_drs_group`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to create VM/Host groups in a given cluster. Creates a vm group if `vms` is set. Creates a host group if `hosts` is set.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string / required | | Cluster to create vm/host group. |
| **datacenter** string | | Datacenter to search for given cluster. If not set, we use first cluster we encounter with `cluster_name`.
aliases: datacenter\_name |
| **group\_name** string / required | | The name of the group to create or remove. |
| **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. |
| **hosts** list / elements=string | | List of hosts to create in group. Required only if `vms` is not set. |
| **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. |
| **state** string | **Choices:*** **present** ←
* absent
| If set to `present` and the group doesn't exists then the group will be created. If set to `absent` and the group exists then the group will be deleted. |
| **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. |
| **vms** list / elements=string | | List of vms to create in group. Required only if `hosts` is not set. |
Notes
-----
Note
* Tested on vSphere 6.5, and 6.7
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
---
- name: "Create DRS VM group"
delegate_to: localhost
community.vmware.vmware_drs_group:
hostname: "{{ vcenter_hostname }}"
password: "{{ vcenter_password }}"
username: "{{ vcenter_username }}"
cluster_name: DC0_C0
datacenter_name: DC0
group_name: TEST_VM_01
vms:
- DC0_C0_RP0_VM0
- DC0_C0_RP0_VM1
state: present
- name: "Create DRS Host group"
delegate_to: localhost
community.vmware.vmware_drs_group:
hostname: "{{ vcenter_hostname }}"
password: "{{ vcenter_password }}"
username: "{{ vcenter_username }}"
cluster_name: DC0_C0
datacenter_name: DC0
group_name: TEST_HOST_01
hosts:
- DC0_C0_H0
- DC0_C0_H1
- DC0_C0_H2
state: present
- name: "Delete DRS Host group"
delegate_to: localhost
community.vmware.vmware_drs_group:
hostname: "{{ vcenter_hostname }}"
password: "{{ vcenter_password }}"
username: "{{ vcenter_username }}"
cluster_name: DC0_C0
datacenter_name: DC0
group_name: TEST_HOST_01
state: absent
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **drs\_group\_facts** dictionary | always | Metadata about DRS group created **Sample:** {'drs\_group\_facts': {'changed': True, 'failed': False, 'msg': 'Created host group TEST\_HOST\_01 successfully', 'result': {'DC0\_C0': [{'group\_name': 'TEST\_HOST\_01', 'hosts': ['DC0\_C0\_H0', 'DC0\_C0\_H1', 'DC0\_C0\_H2'], 'type': 'host'}]}}} |
### Authors
* Karsten Kaj Jakobsen (@karstenjakobsen)
ansible community.vmware.vmware_guest_info – Gather info about a single VM community.vmware.vmware\_guest\_info – Gather info about a single VM
====================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_guest_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Gather information about a single VM on a VMware ESX cluster.
* This module was called `vmware_guest_facts` before Ansible 2.9. The usage did not change.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **datacenter** string / required | | Destination datacenter for the deploy operation |
| **folder** string | | Destination folder, absolute or relative path to find an existing guest. This is required if name is supplied. The folder should include the datacenter. ESX's datacenter is ha-datacenter Examples: folder: /ha-datacenter/vm folder: ha-datacenter/vm folder: /datacenter1/vm folder: datacenter1/vm folder: /datacenter1/vm/folder1 folder: datacenter1/vm/folder1 folder: /folder1/datacenter1/vm folder: folder1/datacenter1/vm folder: /folder1/datacenter1/vm/folder2 |
| **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. |
| **moid** string | | Managed Object ID of the instance to manage if known, this is a unique identifier only within a single vCenter instance. This is required if `name` or `uuid` is not supplied. |
| **name** string | | Name of the VM to work with This is required if `uuid` or `moid` is not supplied. |
| **name\_match** string | **Choices:*** **first** ←
* last
| If multiple VMs matching the name, use the first or last found |
| **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. |
| **properties** list / elements=string | | Specify the properties to retrieve. If not specified, all properties are retrieved (deeply). Results are returned in a structure identical to the vsphere API. Example: properties: [ "config.hardware.memoryMB", "config.hardware.numCPU", "guest.disk", "overallStatus" ] Only valid when `schema` is `vsphere`. |
| **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. |
| **schema** string | **Choices:*** **summary** ←
* vsphere
| Specify the output schema desired. The 'summary' output schema is the legacy output from the module The 'vsphere' output schema is the vSphere API class definition which requires pyvmomi>6.7.1 |
| **tag\_details** boolean added in 1.4.0 of community.vmware | **Choices:*** **no** ←
* yes
| If set `True`, detail information about 'tags' returned. Without this flag, the 'tags' returns a list of tag names. With this flag, the 'tags' returns a list of dict about tag information with additional details like category name, category id, and tag id. This parameter is added to maintain backward compatability. |
| **tags** boolean | **Choices:*** **no** ←
* yes
| Whether to show tags or not. If set `True`, shows tags information. Returns a list of tag names. If set `False`, hides tags information. vSphere Automation SDK is required. |
| **use\_instance\_uuid** boolean | **Choices:*** **no** ←
* yes
| Whether to use the VMware instance UUID rather than the BIOS UUID. |
| **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 |
| **uuid** string | | UUID of the instance to manage if known, this is VMware's unique identifier. This is required if `name` or `moid` is not supplied. |
| **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 on vSphere 5.5, 6.7
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather info from standalone ESXi server having datacenter as 'ha-datacenter'
community.vmware.vmware_guest_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: ha-datacenter
uuid: 421e4592-c069-924d-ce20-7e7533fab926
delegate_to: localhost
register: info
- name: Gather some info from a guest using the vSphere API output schema
community.vmware.vmware_guest_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
name: "{{ vm_name }}"
schema: "vsphere"
properties: ["config.hardware.memoryMB", "guest.disk", "overallStatus"]
delegate_to: localhost
register: info
- name: Gather some information about a guest using MoID
community.vmware.vmware_guest_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
moid: vm-42
schema: "vsphere"
properties: ["config.hardware.memoryMB", "guest.disk", "overallStatus"]
delegate_to: localhost
register: vm_moid_info
- name: Gather Managed object ID (moid) from a guest using the vSphere API output schema for REST Calls
community.vmware.vmware_guest_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
name: "{{ vm_name }}"
schema: "vsphere"
properties:
- _moId
delegate_to: localhost
register: moid_info
- name: Gather detailed information about tags and category associated with the given VM
community.vmware.vmware_guest_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
name: "{{ vm_name }}"
tags: True
tag_details: True
register: detailed_tag_info
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **instance** dictionary | always | metadata about the virtual machine **Sample:** {'advanced\_settings': {}, 'annotation': '', 'current\_snapshot': None, 'customvalues': {}, 'guest\_consolidation\_needed': False, 'guest\_question': None, 'guest\_tools\_status': 'guestToolsNotRunning', 'guest\_tools\_version': '10247', 'hw\_cores\_per\_socket': 1, 'hw\_datastores': ['ds\_226\_3'], 'hw\_esxi\_host': '10.76.33.226', 'hw\_eth0': {'addresstype': 'assigned', 'ipaddresses': None, 'label': 'Network adapter 1', 'macaddress': '00:50:56:87:a5:9a', 'macaddress\_dash': '00-50-56-87-a5-9a', 'portgroup\_key': None, 'portgroup\_portkey': None, 'summary': 'VM Network'}, 'hw\_files': ['[ds\_226\_3] ubuntu\_t/ubuntu\_t.vmx', '[ds\_226\_3] ubuntu\_t/ubuntu\_t.nvram', '[ds\_226\_3] ubuntu\_t/ubuntu\_t.vmsd', '[ds\_226\_3] ubuntu\_t/vmware.log', '[ds\_226\_3] u0001/u0001.vmdk'], 'hw\_folder': '/DC0/vm/Discovered virtual machine', 'hw\_guest\_full\_name': None, 'hw\_guest\_ha\_state': None, 'hw\_guest\_id': None, 'hw\_interfaces': ['eth0'], 'hw\_is\_template': False, 'hw\_memtotal\_mb': 1024, 'hw\_name': 'ubuntu\_t', 'hw\_power\_status': 'poweredOff', 'hw\_processor\_count': 1, 'hw\_product\_uuid': '4207072c-edd8-3bd5-64dc-903fd3a0db04', 'hw\_version': 'vmx-13', 'instance\_uuid': '5007769d-add3-1e12-f1fe-225ae2a07caf', 'ipv4': None, 'ipv6': None, 'module\_hw': True, 'moid': 'vm-42', 'snapshots': [], 'tags': ['backup'], 'vimref': 'vim.VirtualMachine:vm-42', 'vnc': {}} |
### Authors
* Loic Blot (@nerzhul) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#96faf9fff5b0b5a2a0adf4faf9e2b0b5a5a1adb0b5a3a4adb0b5a2aeade3f8ffeebbf3eee6f3e4fff3f8f5f3b0b5a2a0adf0e4)>
| programming_docs |
ansible community.vmware.vsphere_copy – Copy a file to a VMware datastore community.vmware.vsphere\_copy – Copy a file to a VMware datastore
==================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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.vsphere_copy`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Upload files to a VMware datastore through a vCenter REST API.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **datacenter** string | | The datacenter on the vCenter server that holds the datastore. |
| **datastore** string / required | | The datastore to push files to. |
| **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.
aliases: host |
| **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 |
| **path** string / required | | The file to push to the datastore.
aliases: dest |
| **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. |
| **src** string / required | | The file to push to vCenter.
aliases: name |
| **timeout** integer | **Default:**10 | The timeout in seconds for the upload to the datastore. |
| **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: login |
| **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
* This module ought to be run from a system that can access the vCenter or the ESXi directly and has the file to transfer. It can be the normal remote target or you can change it either by using `transport: local` or using `delegate_to`.
* Tested on vSphere 5.5 and ESXi 6.7
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Copy file to datastore using delegate_to
community.vmware.vsphere_copy:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
src: /some/local/file
datacenter: DC1 Someplace
datastore: datastore1
path: some/remote/file
delegate_to: localhost
- name: Copy file to datastore when datacenter is inside folder called devel
community.vmware.vsphere_copy:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
src: /some/local/file
datacenter: devel/DC1
datastore: datastore1
path: some/remote/file
delegate_to: localhost
- name: Copy file to datastore using other_system
community.vmware.vsphere_copy:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
src: /other/local/file
datacenter: DC2 Someplace
datastore: datastore2
path: other/remote/file
delegate_to: other_system
```
### Authors
* Dag Wieers (@dagwieers)
ansible community.vmware.vmware_content_library_manager – Create, update and delete VMware content library community.vmware.vmware\_content\_library\_manager – Create, update and delete VMware content library
=====================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_content_library_manager`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Module to manage VMware content Library
* Content Library feature is introduced in vSphere 6.0 version, so this module is not supported in the earlier versions of vSphere.
* All variables and VMware object names are case sensitive.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
* vSphere Automation SDK
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **datastore\_name** string | | Name of the datastore on which backing content library is created. This is required only if *state* is set to `present`. This parameter is ignored, when *state* is set to `absent`. Currently only datastore backing creation is supported.
aliases: datastore |
| **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. |
| **library\_description** string | **Default:**"" | The content library description. This is required only if *state* is set to `present`. This parameter is ignored, when *state* is set to `absent`. Process of updating content library only allows description change. |
| **library\_name** string / required | | The name of VMware content library to manage. |
| **library\_type** string | **Choices:*** **local** ←
* subscribed
| The content library type. This is required only if *state* is set to `present`. This parameter is ignored, when *state* is set to `absent`. |
| **password** 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.
aliases: pass, pwd |
| **port** integer | **Default:**443 | The port number of the vSphere vCenter. If the value is not specified in the task, the value of environment variable `VMWARE_PORT` will be used instead. |
| **protocol** string | **Choices:*** http
* **https** ←
| The connection to protocol. |
| **proxy\_host** string added in 1.12.0 of community.vmware | | 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 added in 1.12.0 of community.vmware | | 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. |
| **ssl\_thumbprint** string added in 1.7.0 of community.vmware | | The SHA1 SSL thumbprint of the subscribed content library to subscribe to. This is required only if *library\_type* is set to `subscribed` and the library is https. This parameter is ignored, when *state* is set to `absent`. The information can be extracted using openssl using the following example: `echo | openssl s_client -connect test-library.com:443 |& openssl x509 -fingerprint -noout`
|
| **state** string | **Choices:*** **present** ←
* absent
| The state of content library. If set to `present` and library does not exists, then content library is created. If set to `present` and library exists, then content library is updated. If set to `absent` and library exists, then content library is deleted. If set to `absent` and library does not exists, no action is taken. |
| **subscription\_url** string added in 1.7.0 of community.vmware | | The url of the content library to subscribe to. This is required only if *library\_type* is set to `subscribed`. This parameter is ignored, when *state* is set to `absent`. |
| **update\_on\_demand** boolean added in 1.7.0 of community.vmware | **Choices:*** **no** ←
* yes
| Whether to download all content on demand. If set to `True`, all content will be downloaded on demand. If set to `False` content will be downloaded ahead of time. This is required only if *library\_type* is set to `subscribed`. This parameter is ignored, when *state* is set to `absent`. |
| **username** 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.
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. |
Notes
-----
Note
* Tested on vSphere 6.5, 6.7, and 7.0
Examples
--------
```
- name: Create Local Content Library
community.vmware.vmware_content_library_manager:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
library_name: test-content-lib
library_description: 'Library with Datastore Backing'
library_type: local
datastore_name: datastore
state: present
delegate_to: localhost
- name: Create Subscribed Content Library
community.vmware.vmware_content_library_manager:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
library_name: test-content-lib
library_description: 'Subscribed Library with Datastore Backing'
library_type: subscribed
datastore_name: datastore
subscription_url: 'https://library.url'
ssl_thumbprint: 'aa:bb:cc:dd:ee:ff:gg:hh:ii:jj:kk:ll:mm:nn:oo:pp:qq:rr:ss:tt'
update_on_demand: true
state: present
delegate_to: localhost
- name: Update Content Library
community.vmware.vmware_content_library_manager:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
library_name: test-content-lib
library_description: 'Library with Datastore Backing'
state: present
delegate_to: localhost
- name: Delete Content Library
community.vmware.vmware_content_library_manager:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
library_name: test-content-lib
state: absent
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **content\_library\_info** dictionary | on success | library creation success and library\_id **Sample:** {'library\_description': 'Test description', 'library\_id': 'd0b92fa9-7039-4f29-8e9c-0debfcb22b72', 'library\_type': 'LOCAL', 'msg': "Content Library 'demo-local-lib-4' created."} |
### Authors
* Pavan Bidkar (@pgbidkar)
ansible community.vmware.vmware_host_firewall_info – Gathers info about an ESXi host’s firewall configuration information community.vmware.vmware\_host\_firewall\_info – Gathers info about an ESXi host’s firewall configuration information
====================================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_firewall_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to gather information about an ESXi host’s firewall configuration information when ESXi hostname or Cluster name is given.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster from which the ESXi host belong to. If `esxi_hostname` is not given, this parameter is required. |
| **esxi\_hostname** string | | ESXi hostname to gather information from. If `cluster_name` is not given, this parameter is required. |
| **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. |
| **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. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather firewall info about all ESXi Host in given Cluster
community.vmware.vmware_host_firewall_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: cluster_name
delegate_to: localhost
- name: Gather firewall info about ESXi Host
community.vmware.vmware_host_firewall_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **hosts\_firewall\_info** dictionary | on success | metadata about host's firewall configuration **Sample:** {'esxi\_hostname\_0001': [{'allowed\_hosts': {'all\_ip': True, 'ip\_address': ['10.10.10.1'], 'ip\_network': ['11.111.112.0/22', '192.168.10.1/24']}, 'enabled': True, 'key': 'CIMHttpServer', 'rule': [{'direction': 'inbound', 'end\_port': None, 'port': 5988, 'port\_type': 'dst', 'protocol': 'tcp'}], 'service': 'sfcbd-watchdog'}]} |
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_dvs_portgroup – Create or remove a Distributed vSwitch portgroup. community.vmware.vmware\_dvs\_portgroup – Create or remove a Distributed vSwitch portgroup.
===========================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_dvs_portgroup`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Create or remove a Distributed vSwitch portgroup.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **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. |
| **mac\_learning** dictionary added in 1.10.0 of community.vmware | | Dictionary which configures MAC learning for portgroup. |
| | **allow\_unicast\_flooding** boolean | **Choices:*** no
* yes
| The flag to allow flooding of unlearned MAC for ingress traffic. |
| | **enabled** boolean | **Choices:*** no
* yes
| The flag to indicate if source MAC address learning is allowed. |
| | **limit** integer | | The maximum number of MAC addresses that can be learned. |
| | **limit\_policy** string | **Choices:*** allow
* drop
| The default switching policy after MAC limit is exceeded. |
| **network\_policy** dictionary | **Default:**{"forged\_transmits": false, "mac\_changes": false, "promiscuous": false} | Dictionary which configures the different security values for portgroup. |
| | **forged\_transmits** boolean | **Choices:*** **no** ←
* yes
| Indicates whether forged transmits are allowed. |
| | **mac\_changes** boolean | **Choices:*** **no** ←
* yes
| Indicates whether mac changes are allowed. |
| | **promiscuous** boolean | **Choices:*** **no** ←
* yes
| Indicates whether promiscuous mode is allowed. |
| **num\_ports** integer | | The number of ports the portgroup should contain. |
| **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. |
| **port\_allocation** string added in 1.10.0 of community.vmware | **Choices:*** elastic
* fixed
| Elastic port groups automatically increase or decrease the number of ports as needed. Only valid if *port\_binding* is set to `static`. Will be `elastic` if not specified and *port\_binding* is set to `static`. |
| **port\_binding** string added in 1.10.0 of community.vmware | **Choices:*** static
* ephemeral
| The type of port binding determines when ports in a port group are assigned to virtual machines. See VMware KB 1022312 <https://kb.vmware.com/s/article/1022312> for more details. |
| **port\_policy** dictionary | **Default:**{"block\_override": true, "ipfix\_override": false, "live\_port\_move": false, "network\_rp\_override": false, "port\_config\_reset\_at\_disconnect": true, "security\_override": false, "shaping\_override": false, "traffic\_filter\_override": false, "uplink\_teaming\_override": false, "vendor\_config\_override": false, "vlan\_override": false} | Dictionary which configures the advanced policy settings for the portgroup. |
| | **block\_override** boolean | **Choices:*** no
* **yes** ←
| Indicates if the block policy can be changed per port. |
| | **ipfix\_override** boolean | **Choices:*** **no** ←
* yes
| Indicates if the ipfix policy can be changed per port. |
| | **live\_port\_move** boolean | **Choices:*** **no** ←
* yes
| Indicates if a live port can be moved in or out of the portgroup. |
| | **network\_rp\_override** boolean | **Choices:*** **no** ←
* yes
| Indicates if the network resource pool can be changed per port. |
| | **port\_config\_reset\_at\_disconnect** boolean | **Choices:*** no
* **yes** ←
| Indicates if the configuration of a port is reset automatically after disconnect. |
| | **security\_override** boolean | **Choices:*** **no** ←
* yes
| Indicates if the security policy can be changed per port. |
| | **shaping\_override** boolean | **Choices:*** **no** ←
* yes
| Indicates if the shaping policy can be changed per port. |
| | **traffic\_filter\_override** boolean | **Choices:*** **no** ←
* yes
| Indicates if the traffic filter can be changed per port. |
| | **uplink\_teaming\_override** boolean | **Choices:*** **no** ←
* yes
| Indicates if the uplink teaming policy can be changed per port. |
| | **vendor\_config\_override** boolean | **Choices:*** **no** ←
* yes
| Indicates if the vendor config can be changed per port. |
| | **vlan\_override** boolean | **Choices:*** **no** ←
* yes
| Indicates if the vlan can be changed per port. |
| **portgroup\_name** string / required | | The name of the portgroup that is to be created or deleted. |
| **portgroup\_type** string | **Choices:*** earlyBinding
* lateBinding
* ephemeral
| See VMware KB 1022312 regarding portgroup types. Deprecated. Will be removed 2021-12-01. |
| **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. |
| **state** string / required | **Choices:*** present
* absent
| Determines if the portgroup should be present or not. |
| **switch\_name** string / required | | The name of the distributed vSwitch the port group should be created on. |
| **teaming\_policy** dictionary | **Default:**{"load\_balance\_policy": "loadbalance\_srcid", "notify\_switches": true, "rolling\_order": false} | Dictionary which configures the different teaming values for portgroup. |
| | **active\_uplinks** list / elements=string added in 1.10.0 of community.vmware | | List of active uplinks used for load balancing. |
| | **inbound\_policy** boolean | **Choices:*** no
* yes
| Indicate whether or not the teaming policy is applied to inbound frames as well. |
| | **load\_balance\_policy** string | **Choices:*** loadbalance\_ip
* loadbalance\_srcmac
* **loadbalance\_srcid** ←
* loadbalance\_loadbased
* failover\_explicit
| Network adapter teaming policy.
`loadbalance_loadbased` is available from version 2.6 and onwards. |
| | **notify\_switches** boolean | **Choices:*** no
* **yes** ←
| Indicate whether or not to notify the physical switch if a link fails. |
| | **rolling\_order** boolean | **Choices:*** **no** ←
* yes
| Indicate whether or not to use a rolling policy when restoring links. |
| | **standby\_uplinks** list / elements=string added in 1.10.0 of community.vmware | | List of standby uplinks used for failover. |
| **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. |
| **vlan\_id** string / required | | The VLAN ID that should be configured with the portgroup, use 0 for no VLAN. If `vlan_trunk` is configured to be *true*, this can be a combination of multiple ranges and numbers, example: 1-200, 205, 400-4094. The valid `vlan_id` range is from 0 to 4094. Overlapping ranges are allowed. If `vlan_private` is configured to be *true*, the corresponding private VLAN should already be configured in the distributed vSwitch. |
| **vlan\_private** boolean | **Choices:*** **no** ←
* yes
| Indicates whether this is for a private VLAN or not. Mutually exclusive with `vlan_trunk` parameter. |
| **vlan\_trunk** boolean | **Choices:*** **no** ←
* yes
| Indicates whether this is a VLAN trunk or not. Mutually exclusive with `vlan_private` parameter. |
Notes
-----
Note
* Tested on vSphere 7.0
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Create vlan portgroup
community.vmware.vmware_dvs_portgroup:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
portgroup_name: vlan-123-portrgoup
switch_name: dvSwitch
vlan_id: 123
num_ports: 120
port_binding: static
state: present
delegate_to: localhost
- name: Create vlan trunk portgroup
community.vmware.vmware_dvs_portgroup:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
portgroup_name: vlan-trunk-portrgoup
switch_name: dvSwitch
vlan_id: 1-1000, 1005, 1100-1200
vlan_trunk: True
num_ports: 120
port_binding: static
state: present
delegate_to: localhost
- name: Create private vlan portgroup
vmware_dvs_portgroup:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
portgroup_name: private-vlan-portrgoup
switch_name: dvSwitch
vlan_id: 1001
vlan_private: True
num_ports: 120
port_binding: static
state: present
delegate_to: localhost
- name: Create no-vlan portgroup
community.vmware.vmware_dvs_portgroup:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
portgroup_name: no-vlan-portrgoup
switch_name: dvSwitch
vlan_id: 0
num_ports: 120
port_binding: static
state: present
delegate_to: localhost
- name: Create vlan portgroup with all security and port policies
community.vmware.vmware_dvs_portgroup:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
portgroup_name: vlan-123-portrgoup
switch_name: dvSwitch
vlan_id: 123
num_ports: 120
port_binding: static
state: present
network_policy:
promiscuous: true
forged_transmits: true
mac_changes: true
port_policy:
block_override: true
ipfix_override: true
live_port_move: true
network_rp_override: true
port_config_reset_at_disconnect: true
security_override: true
shaping_override: true
traffic_filter_override: true
uplink_teaming_override: true
vendor_config_override: true
vlan_override: true
delegate_to: localhost
```
### Authors
* Joseph Callen (@jcpowermac)
* Philippe Dellaert (@pdellaert) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#2f5f474643465f5f4a090c1c1814090c1a1d14090c1b17144b4a43434e4a5d5b090c1b1914405d48)>
| programming_docs |
ansible community.vmware.vmware_host_feature_info – Gathers info about an ESXi host’s feature capability information community.vmware.vmware\_host\_feature\_info – Gathers info about an ESXi host’s feature capability information
===============================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_feature_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to gather information about an ESXi host’s feature capability information when ESXi hostname or Cluster name is given.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster from all host systems to be used for information gathering. If `esxi_hostname` is not given, this parameter is required. |
| **esxi\_hostname** string | | ESXi hostname to gather information from. If `cluster_name` is not given, this parameter is required. |
| **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. |
| **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. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather feature capability info about all ESXi Hosts in given Cluster
community.vmware.vmware_host_feature_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: '{{ cluster_name }}'
delegate_to: localhost
register: all_cluster_hosts_info
- name: Check if ESXi is vulnerable for Speculative Store Bypass Disable (SSBD) vulnerability
community.vmware.vmware_host_feature_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
esxi_hostname: "{{ esxi_hostname }}"
register: features_set
- set_fact:
ssbd : "{{ item.value }}"
loop: "{{ features_set.host_feature_info[esxi_hostname] |json_query(name) }}"
vars:
name: "[?key=='cpuid.SSBD']"
- assert:
that:
- ssbd|int == 1
when: ssbd is defined
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **hosts\_feature\_info** dictionary | always | metadata about host's feature capability information **Sample:** {'10.76.33.226': [{'feature\_name': 'cpuid.3DNOW', 'key': 'cpuid.3DNOW', 'value': '0'}, {'feature\_name': 'cpuid.3DNOWPLUS', 'key': 'cpuid.3DNOWPLUS', 'value': '0'}]} |
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_cfg_backup – Backup / Restore / Reset ESXi host configuration community.vmware.vmware\_cfg\_backup – Backup / Restore / Reset ESXi host configuration
=======================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_cfg_backup`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to perform various operations related to backup, restore and reset of ESXi host configuration.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi installed
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **dest** path | | The destination where the ESXi configuration bundle will be saved. The *dest* can be a folder or a file. If *dest* is a folder, the backup file will be saved in the folder with the default filename generated from the ESXi server. If *dest* is a file, the backup file will be saved with that filename. The file extension will always be .tgz. |
| **esxi\_hostname** string | | Name of ESXi server. This is required only if authentication against a vCenter is done. |
| **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. |
| **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. |
| **src** path | | The file containing the ESXi configuration that will be restored. |
| **state** string / required | **Choices:*** saved
* absent
* loaded
| If `saved`, the .tgz backup bundle will be saved in *dest*. If `absent`, the host configuration will be reset to default values. If `loaded`, the backup file in *src* will be loaded to the ESXi host rewriting the hosts settings. |
| **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 on ESXi 6.0
* Works only for ESXi hosts
* For configuration load or reset, the host will be switched automatically to maintenance mode.
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Save the ESXi configuration locally by authenticating directly against the ESXi host
community.vmware.vmware_cfg_backup:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
state: saved
dest: /tmp/
delegate_to: localhost
- name: Save the ESXi configuration locally by authenticating against the vCenter and selecting the ESXi host
community.vmware.vmware_cfg_backup:
hostname: '{{ vcenter_hostname }}'
esxi_hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
state: saved
dest: /tmp/
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **dest\_file** string | changed | The full path of where the file holding the ESXi configurations was stored **Sample:** /tmp/configBundle-esxi.host.domain.tgz |
### Authors
* Andreas Nafpliotis (@nafpliot-ibm)
ansible community.vmware.vmware_local_user_facts – Gather facts about users on the given ESXi host community.vmware.vmware\_local\_user\_facts – Gather facts about users on the given ESXi host
=============================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_local_user_facts`.
* [DEPRECATED](#deprecated)
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
* [Status](#status)
DEPRECATED
----------
Removed in
major release after 2021-12-01
Why
Deprecated in favour of [community.vmware.vmware\_local\_user\_info](vmware_local_user_info_module#ansible-collections-community-vmware-vmware-local-user-info-module) module.
Alternative
Use [community.vmware.vmware\_local\_user\_info](vmware_local_user_info_module#ansible-collections-community-vmware-vmware-local-user-info-module) instead.
Synopsis
--------
* This module can be used to gather facts about users present on the given ESXi host system in VMware infrastructure.
* All variables and VMware object names are case sensitive.
* User must hold the ‘Authorization.ModifyPermissions’ privilege to invoke this module.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **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. |
| **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. |
| **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 on ESXi 6.5
* The `full_name`, `principal`, and `user_group` properties are deprecated starting from Ansible v2.12
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather facts about all Users on given ESXi host system
community.vmware.vmware_local_user_facts:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
delegate_to: localhost
register: all_user_facts
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **local\_user\_facts** dictionary | always | metadata about all local users **Sample:** [{'description': 'Administrator', 'full\_name': 'Administrator', 'group': False, 'principal': 'root', 'role': 'admin', 'shell\_access': True, 'user\_group': False, 'user\_id': 0, 'user\_name': 'root'}, {'description': 'DCUI User', 'full\_name': 'DCUI User', 'group': False, 'principal': 'dcui', 'role': 'admin', 'shell\_access': False, 'user\_group': False, 'user\_id': 100, 'user\_name': 'dcui'}] |
Status
------
* This module will be removed in a major release after 2021-12-01. *[deprecated]*
* For more information see [DEPRECATED](#deprecated).
### Authors
* Abhijeet Kasurde (@Akasurde)
* Christian Kotte (@ckotte)
ansible community.vmware.vmware_guest_snapshot – Manages virtual machines snapshots in vCenter community.vmware.vmware\_guest\_snapshot – Manages virtual machines snapshots in vCenter
========================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_guest_snapshot`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to create, delete and update snapshot(s) of the given virtual machine.
* All parameters and VMware object names are case sensitive.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **datacenter** string / required | | Destination datacenter for the deploy operation. |
| **description** string | **Default:**"" | Define an arbitrary description to attach to snapshot. |
| **folder** string | | Destination folder, absolute or relative path to find an existing guest. This is required parameter, if `name` is supplied. The folder should include the datacenter. ESX's datacenter is ha-datacenter. Examples: folder: /ha-datacenter/vm folder: ha-datacenter/vm folder: /datacenter1/vm folder: datacenter1/vm folder: /datacenter1/vm/folder1 folder: datacenter1/vm/folder1 folder: /folder1/datacenter1/vm folder: folder1/datacenter1/vm folder: /folder1/datacenter1/vm/folder2 |
| **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. |
| **memory\_dump** boolean | **Choices:*** **no** ←
* yes
| If set to `true`, memory dump of virtual machine is also included in snapshot. Note that memory snapshots take time and resources, this will take longer time to create. If virtual machine does not provide capability to take memory snapshot, then this flag is set to `false`. |
| **moid** string | | Managed Object ID of the instance to manage if known, this is a unique identifier only within a single vCenter instance. This is required if `name` or `uuid` is not supplied. |
| **name** string | | Name of the virtual machine to work with. This is required parameter, if `uuid` or `moid` is not supplied. |
| **name\_match** string | **Choices:*** **first** ←
* last
| If multiple VMs matching the name, use the first or last found. |
| **new\_description** string | | Value to change the description of an existing snapshot to. |
| **new\_snapshot\_name** string | | Value to rename the existing snapshot to. |
| **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. |
| **quiesce** boolean | **Choices:*** **no** ←
* yes
| If set to `true` and virtual machine is powered on, it will quiesce the file system in virtual machine. Note that VMware Tools are required for this flag. If virtual machine is powered off or VMware Tools are not available, then this flag is set to `false`. If virtual machine does not provide capability to take quiesce snapshot, then this flag is set to `false`. |
| **remove\_children** boolean | **Choices:*** **no** ←
* yes
| If set to `true` and state is set to `absent`, then entire snapshot subtree is set for removal. |
| **snapshot\_name** string | | Sets the snapshot name to manage. This param is required only if state is not `remove_all`
|
| **state** string | **Choices:*** **present** ←
* absent
* revert
* remove\_all
| Manage snapshot(s) attached to a specific virtual machine. If set to `present` and snapshot absent, then will create a new snapshot with the given name. If set to `present` and snapshot present, then no changes are made. If set to `absent` and snapshot present, then snapshot with the given name is removed. If set to `absent` and snapshot absent, then no changes are made. If set to `revert` and snapshot present, then virtual machine state is reverted to the given snapshot. If set to `revert` and snapshot absent, then no changes are made. If set to `remove_all` and snapshot(s) present, then all snapshot(s) will be removed. If set to `remove_all` and snapshot(s) absent, then no changes are made. |
| **use\_instance\_uuid** boolean | **Choices:*** **no** ←
* yes
| Whether to use the VMware instance UUID rather than the BIOS UUID. |
| **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 |
| **uuid** string | | UUID of the instance to manage if known, this is VMware's BIOS UUID by default. This is required if `name` or `moid` parameter is not supplied. |
| **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 on vSphere 5.5, 6.0 and 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Create a snapshot
community.vmware.vmware_guest_snapshot:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
folder: "/{{ datacenter_name }}/vm/"
name: "{{ guest_name }}"
state: present
snapshot_name: snap1
description: snap1_description
delegate_to: localhost
- name: Remove a snapshot
community.vmware.vmware_guest_snapshot:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
folder: "/{{ datacenter_name }}/vm/"
name: "{{ guest_name }}"
state: absent
snapshot_name: snap1
delegate_to: localhost
- name: Revert to a snapshot
community.vmware.vmware_guest_snapshot:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
folder: "/{{ datacenter_name }}/vm/"
name: "{{ guest_name }}"
state: revert
snapshot_name: snap1
delegate_to: localhost
- name: Remove all snapshots of a VM
community.vmware.vmware_guest_snapshot:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
folder: "/{{ datacenter_name }}/vm/"
name: "{{ guest_name }}"
state: remove_all
delegate_to: localhost
- name: Remove all snapshots of a VM using MoID
community.vmware.vmware_guest_snapshot:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
folder: "/{{ datacenter_name }}/vm/"
moid: vm-42
state: remove_all
delegate_to: localhost
- name: Take snapshot of a VM using quiesce and memory flag on
community.vmware.vmware_guest_snapshot:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
folder: "/{{ datacenter_name }}/vm/"
name: "{{ guest_name }}"
state: present
snapshot_name: dummy_vm_snap_0001
quiesce: true
memory_dump: true
delegate_to: localhost
- name: Remove a snapshot and snapshot subtree
community.vmware.vmware_guest_snapshot:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
folder: "/{{ datacenter_name }}/vm/"
name: "{{ guest_name }}"
state: absent
remove_children: true
snapshot_name: snap1
delegate_to: localhost
- name: Rename a snapshot
community.vmware.vmware_guest_snapshot:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
folder: "/{{ datacenter_name }}/vm/"
name: "{{ guest_name }}"
state: present
snapshot_name: current_snap_name
new_snapshot_name: im_renamed
new_description: "{{ new_snapshot_description }}"
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **snapshot\_results** dictionary | always | metadata about the virtual machine snapshots **Sample:** {'current\_snapshot': {'creation\_time': '2019-04-09T14:40:26.617427+00:00', 'description': 'Snapshot 4 example', 'id': 4, 'name': 'snapshot4', 'state': 'poweredOff'}, 'snapshots': [{'creation\_time': '2019-04-09T14:38:24.667543+00:00', 'description': 'Snapshot 3 example', 'id': 3, 'name': 'snapshot3', 'state': 'poweredOff'}, {'creation\_time': '2019-04-09T14:40:26.617427+00:00', 'description': 'Snapshot 4 example', 'id': 4, 'name': 'snapshot4', 'state': 'poweredOff'}]} |
### Authors
* Loic Blot (@nerzhul) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#cda1a2a4aeebeef9fbf6afa1a2b9ebeefefaf6ebeef8fff6ebeef9f5f6b8a3a4b5e0a8b5bda8bfa4a8a3aea8ebeef9fbf6abbf)>
| programming_docs |
ansible community.vmware.vmware_vcenter_statistics – Configures statistics on a vCenter server community.vmware.vmware\_vcenter\_statistics – Configures statistics on a vCenter server
========================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_statistics`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to configure the vCenter server statistics.
* The remaining settings can be configured with the module `vmware_vcenter_settings`.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **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. |
| **interval\_past\_day** dictionary | | Settings for vCenter server past day statistic collection. |
| | **enabled** boolean | **Choices:*** no
* **yes** ←
| Past day statistics collection enabled. |
| | **interval\_minutes** integer | **Choices:*** 1
* 2
* 3
* 4
* 5
**Default:**5 | Interval duration in minutes. |
| | **level** integer | **Choices:*** 1
* 2
* 3
* 4
**Default:**1 | Statistics level. |
| | **save\_for\_days** integer | **Choices:*** 1
* 2
* 3
* 4
* 5
**Default:**1 | Save for value in days. |
| **interval\_past\_month** dictionary | | Settings for vCenter server past month statistic collection. |
| | **enabled** boolean | **Choices:*** no
* **yes** ←
| Past month statistics collection enabled. |
| | **interval\_hours** integer | **Choices:*** 2
**Default:**2 | Interval duration in hours. |
| | **level** integer | **Choices:*** 1
* 2
* 3
* 4
**Default:**1 | Statistics level. |
| | **save\_for\_months** integer | **Choices:*** 1
**Default:**1 | Save for value in months. |
| **interval\_past\_week** dictionary | | Settings for vCenter server past week statistic collection. |
| | **enabled** boolean | **Choices:*** no
* **yes** ←
| Past week statistics collection enabled. |
| | **interval\_minutes** integer | **Choices:*** 30
**Default:**30 | Interval duration in minutes. |
| | **level** integer | **Choices:*** 1
* 2
* 3
* 4
**Default:**1 | Statistics level. |
| | **save\_for\_weeks** integer | **Choices:*** 1
**Default:**1 | Save for value in weeks. |
| **interval\_past\_year** dictionary | | Settings for vCenter server past month statistic collection. |
| | **enabled** boolean | **Choices:*** no
* **yes** ←
| Past month statistics collection enabled. |
| | **interval\_days** integer | **Choices:*** 1
**Default:**1 | Interval duration in days. |
| | **level** integer | **Choices:*** 1
* 2
* 3
* 4
**Default:**1 | Statistics level. |
| | **save\_for\_years** integer | **Choices:*** 1
* 2
* 3
* 4
* 5
**Default:**1 | Save for value in years. |
| **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. |
| **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 statistics
community.vmware.vmware_vcenter_statistics:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
interval_past_day:
enabled: true
interval_minutes: 5
save_for_days: 1
level: 1
interval_past_week:
enabled: true
level: 1
interval_past_month:
enabled: true
level: 1
interval_past_year:
enabled: true
save_for_years: 1
level: 1
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **results** dictionary | always | metadata about vCenter statistics settings **Sample:** {'changed': False, 'msg': 'vCenter statistics already configured properly', 'past\_day\_enabled': True, 'past\_day\_interval': 5, 'past\_day\_level': 1, 'past\_day\_save\_for': 1, 'past\_month\_enabled': True, 'past\_month\_interval': 2, 'past\_month\_level': 1, 'past\_month\_save\_for': 1, 'past\_week\_enabled': True, 'past\_week\_interval': 30, 'past\_week\_level': 1, 'past\_week\_save\_for': 1, 'past\_year\_enabled': True, 'past\_year\_interval': 1, 'past\_year\_level': 1, 'past\_year\_save\_for': 1} |
### Authors
* Christian Kotte (@ckotte)
ansible community.vmware.vmware_tag – Manage VMware tags community.vmware.vmware\_tag – Manage VMware tags
=================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_tag`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to create / delete / update VMware tags.
* Tag feature is introduced in vSphere 6 version, so this module is not supported in the earlier versions of vSphere.
* All variables and VMware object names are case sensitive.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
* vSphere Automation SDK
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **category\_id** string / required | | The unique ID generated by vCenter should be used to. User can get this unique ID from facts module. |
| **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. |
| **password** 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.
aliases: pass, pwd |
| **port** integer | **Default:**443 | The port number of the vSphere vCenter. If the value is not specified in the task, the value of environment variable `VMWARE_PORT` will be used instead. |
| **protocol** string | **Choices:*** http
* **https** ←
| The connection to protocol. |
| **proxy\_host** string added in 1.12.0 of community.vmware | | 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 added in 1.12.0 of community.vmware | | 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. |
| **state** string | **Choices:*** **present** ←
* absent
| The state of tag. If set to `present` and tag does not exists, then tag is created. If set to `present` and tag exists, then tag is updated. If set to `absent` and tag exists, then tag is deleted. If set to `absent` and tag does not exists, no action is taken. |
| **tag\_description** string | **Default:**"" | The tag description. This is required only if `state` is set to `present`. This parameter is ignored, when `state` is set to `absent`. Process of updating tag only allows description change. |
| **tag\_name** string / required | | The name of tag to manage. |
| **username** 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.
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. |
Notes
-----
Note
* Tested on vSphere 6.5
Examples
--------
```
- name: Create a tag
community.vmware.vmware_tag:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
category_id: 'urn:vmomi:InventoryServiceCategory:e785088d-6981-4b1c-9fb8-1100c3e1f742:GLOBAL'
tag_name: Sample_Tag_0002
tag_description: Sample Description
state: present
delegate_to: localhost
- name: Update tag description
community.vmware.vmware_tag:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
tag_name: Sample_Tag_0002
tag_description: Some fancy description
state: present
delegate_to: localhost
- name: Delete tag
community.vmware.vmware_tag:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
tag_name: Sample_Tag_0002
state: absent
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **tag\_status** dictionary | on success | dictionary of tag metadata **Sample:** {'msg': "Tag 'Sample\_Tag\_0002' created.", 'tag\_id': 'urn:vmomi:InventoryServiceTag:bff91819-f529-43c9-80ca-1c9dfda09441:GLOBAL'} |
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_guest_storage_policy – Set VM Home and disk(s) storage policy profiles. community.vmware.vmware\_guest\_storage\_policy – Set VM Home and disk(s) storage policy profiles.
==================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_guest_storage_policy`.
New in version 1.9.0: of community.vmware
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to enforce storage policy profiles per disk and/or VM Home on a virtual machine.
Requirements
------------
The below requirements are needed on the host that executes this module.
* pyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **disk** list / elements=dictionary | | A list of disks with storage profile policies to enforce. All values and parameters are case sensitive. At least one of `disk` and `vm_home` are required parameters. |
| | **policy** string / required | | Name of the storage profile policy to enforce for the disk. |
| | **unit\_number** integer / required | | Disk Unit Number. Valid values range from 0 to 15. |
| **folder** string | | Destination folder, absolute or relative path to find an existing guest. This is a required parameter if multiple VMs are found with same name. The folder should include the datacenter. ESX's datacenter is ha-datacenter. Examples: folder: /ha-datacenter/vm folder: ha-datacenter/vm folder: /datacenter1/vm folder: datacenter1/vm folder: /datacenter1/vm/folder1 folder: datacenter1/vm/folder1 folder: /folder1/datacenter1/vm folder: folder1/datacenter1/vm folder: /folder1/datacenter1/vm/folder2 |
| **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. |
| **moid** string | | Managed Object ID of the instance to manage if known, this is a unique identifier only within a single vCenter instance. One of `name`, `uuid`, or `moid` are required to define the virtual machine. |
| **name** string | | Name of the virtual machine. One of `name`, `uuid`, or `moid` are required to define the virtual machine. |
| **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. |
| **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 |
| **uuid** string | | UUID of the virtual machine. One of `name`, `uuid`, or `moid` are required to define the virtual machine. |
| **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. |
| **vm\_home** string | | A storage profile policy to set on VM Home. All values and parameters are case sensitive. At least one of `disk` or `vm_home` are required parameters. |
Notes
-----
Note
* Tested on vSphere 6.0 and 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Enforce storepol1 policy for disk 0 and 1 using UUID
community.vmware.vmware_guest_storage_policy:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: no
uuid: cefd316c-fc19-45f3-a539-2cd03427a78d
disk:
- unit_number: 0
policy: storepol1
- unit_number: 1
policy: storepol1
delegate_to: localhost
register: policy_status
- name: Enforce storepol1 policy for VM Home using name
community.vmware.vmware_guest_storage_policy:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: no
name: hostname1
vm_home: storepol1
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **changed\_policies** dictionary | always | Dictionary containing the changed policies of disk (list of dictionaries) and vm\_home. **Sample:** {'disk': [{'policy': 'storepol1', 'unit\_number': 0}], 'vm\_home': 'storepol1'} |
| **msg** string | always | Informational message on the job result. **Sample:** Policies successfully set. |
### Authors
* Tyler Gates (@tgates81)
ansible community.vmware.vmware_guest_powerstate – Manages power states of virtual machines in vCenter community.vmware.vmware\_guest\_powerstate – Manages power states of virtual machines in vCenter
================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_guest_powerstate`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Power on / Power off / Restart a virtual machine.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **answer** list / elements=dictionary added in 1.11.0 of community.vmware | | A list of questions to answer, should one or more arise while waiting for the task to complete. Some common uses are to allow a cdrom to be changed even if locked, or to answer the question as to whether a VM was copied or moved. The *answer* can be used if *state* is `powered-on`. |
| | **question** string / required | | The message id, for example `msg.uuid.altered`. |
| | **response** string / required | | The choice key, for example `button.uuid.copiedTheVM`. |
| **datacenter** string added in 1.13.0 of community.vmware | **Default:**"ha-datacenter" | The *datacenter* where the VM you'd like to operate the power. This parameter is case sensitive. |
| **folder** string | | Destination folder, absolute or relative path to find an existing guest. The folder should include the datacenter. ESX's datacenter is ha-datacenter Examples: folder: /ha-datacenter/vm folder: ha-datacenter/vm folder: /datacenter1/vm folder: datacenter1/vm folder: /datacenter1/vm/folder1 folder: datacenter1/vm/folder1 folder: /folder1/datacenter1/vm folder: folder1/datacenter1/vm folder: /folder1/datacenter1/vm/folder2 |
| **force** boolean | **Choices:*** **no** ←
* yes
| Ignore warnings and complete the actions. This parameter is useful while forcing virtual machine state. |
| **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. |
| **moid** string | | Managed Object ID of the instance to manage if known, this is a unique identifier only within a single vCenter instance. This is required if `name` or `uuid` is not supplied. |
| **name** string | | Name of the virtual machine to work with. Virtual machine names in vCenter are not necessarily unique, which may be problematic, see `name_match`. |
| **name\_match** string | **Choices:*** **first** ←
* last
| If multiple virtual machines matching the name, use the first or last found. |
| **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. |
| **schedule\_task\_description** string | | Description of schedule task. Valid only if `scheduled_at` is specified. |
| **schedule\_task\_enabled** boolean | **Choices:*** no
* **yes** ←
| Flag to indicate whether the scheduled task is enabled or disabled. |
| **schedule\_task\_name** string | | Name of schedule task. Valid only if `scheduled_at` is specified. |
| **scheduled\_at** string | | Date and time in string format at which specified task needs to be performed. The required format for date and time - 'dd/mm/yyyy hh:mm'. Scheduling task requires vCenter server. A standalone ESXi server does not support this option. |
| **state** string | **Choices:*** powered-off
* powered-on
* reboot-guest
* restarted
* shutdown-guest
* suspended
* **present** ←
| Set the state of the virtual machine. |
| **state\_change\_timeout** integer | **Default:**0 | If the `state` is set to `shutdown-guest`, by default the module will return immediately after sending the shutdown signal. If this argument is set to a positive integer, the module will instead wait for the VM to reach the poweredoff state. The value sets a timeout in seconds for the module to wait for the state change. |
| **use\_instance\_uuid** boolean | **Choices:*** **no** ←
* yes
| Whether to use the VMware instance UUID rather than the BIOS UUID. |
| **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 |
| **uuid** string | | UUID of the instance to manage if known, this is VMware's unique identifier. This is required if `name` or `moid` is not supplied. |
| **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
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Set the state of a virtual machine to poweroff
community.vmware.vmware_guest_powerstate:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
folder: "/{{ datacenter_name }}/vm/my_folder"
name: "{{ guest_name }}"
state: powered-off
delegate_to: localhost
register: deploy
- name: Set the state of a virtual machine to poweron using MoID
community.vmware.vmware_guest_powerstate:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
folder: "/{{ datacenter_name }}/vm/my_folder"
moid: vm-42
state: powered-on
delegate_to: localhost
register: deploy
- name: Set the state of a virtual machine to poweroff at given scheduled time
community.vmware.vmware_guest_powerstate:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
folder: "/{{ datacenter_name }}/vm/my_folder"
name: "{{ guest_name }}"
state: powered-off
scheduled_at: "09/01/2018 10:18"
schedule_task_name: "task_00001"
schedule_task_description: "Sample task to poweroff VM"
schedule_task_enabled: True
delegate_to: localhost
register: deploy_at_schedule_datetime
- name: Wait for the virtual machine to shutdown
community.vmware.vmware_guest_powerstate:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
name: "{{ guest_name }}"
state: shutdown-guest
state_change_timeout: 200
delegate_to: localhost
register: deploy
- name: Automatically answer if a question locked a virtual machine
block:
- name: Power on a virtual machine without the answer param
vmware_guest_powerstate:
hostname: "{{ esxi_hostname }}"
username: "{{ esxi_username }}"
password: "{{ esxi_password }}"
validate_certs: false
folder: "{{ f1 }}"
name: "{{ vm_name }}"
state: powered-on
rescue:
- name: Power on a virtual machine with the answer param
vmware_guest_powerstate:
hostname: "{{ esxi_hostname }}"
username: "{{ esxi_username }}"
password: "{{ esxi_password }}"
validate_certs: false
folder: "{{ f1 }}"
name: "{{ vm_name }}"
answer:
- question: "msg.uuid.altered"
response: "button.uuid.copiedTheVM"
state: powered-on
```
### Authors
* Abhijeet Kasurde (@Akasurde) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#d7b6bcb6a4a2a5b3b2f1f4e4e0ecf1f4e2e5ecf1f4e3efeca5b2b3bfb6a3f1f4e3e1ecb4b8ba)>
| programming_docs |
ansible community.vmware.vmware_guest_instant_clone – Instant Clone VM community.vmware.vmware\_guest\_instant\_clone – Instant Clone VM
=================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_guest_instant_clone`.
New in version 1.9.0: of community.vmware
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used for Creating a powered-on Instant Clone of a virtual machine.
* All variables and VMware object names are case sensitive.
* [community.vmware.vmware\_guest](vmware_guest_module#ansible-collections-community-vmware-vmware-guest-module) module is needed for creating a VM with poweredon state which would be used as a parent VM.
* [community.vmware.vmware\_guest\_powerstate](vmware_guest_powerstate_module#ansible-collections-community-vmware-vmware-guest-powerstate-module) module is also needed to poweroff the instant cloned module.
* The powered off VM would in turn be deleted by again using [community.vmware.vmware\_guest](vmware_guest_module#ansible-collections-community-vmware-vmware-guest-module) module.
* Thus [community.vmware.vmware\_guest](vmware_guest_module#ansible-collections-community-vmware-vmware-guest-module) module is necessary for removing Instant Cloned VM when VMs being created in testing environment.
* Also GuestOS Customization has now been added with guestinfo\_vars parameter.
* The Parent VM must have The Guest customization Engine for instant Clone to customize Guest OS.
* Only Linux Os in Parent VM enable support for native vSphere Guest Customization for Instant Clone in vSphere 7.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **datacenter** string / required | | Name of the datacenter, where VM to be deployed. |
| **datastore** string / required | | The name of the datastore or the datastore cluster. If datastore cluster name is specified, module will find the Storage DRS recommended datastore in that cluster. |
| **folder** string | | Destination folder, absolute path to deploy the cloned vm. This parameter is case sensitive. Examples: folder: ha-datacenter/vm folder: /datacenter1/vm |
| **guestinfo\_vars** list / elements=dictionary added in 1.11.0 of community.vmware | | Provides GuestOS Customization functionality in instant cloned VM. A list of key value pairs that will be passed to the destination VM. These pairs should be used to provide user-defined customization to differentiate the destination VM from the source VM. |
| | **dns** string | | dns is used to set the dns in Instant Cloned Guest Operating System.. |
| | **domain** string | | domain is used to set A fully qualified domain name (FQDN) or complete domain name for Instant Cloned Guest operating System. |
| | **gateway** string | | netmask is used to set the netmask in Instant Cloned Guest Operating System. |
| | **hostname** string | | hostname is used to obtain the DNS(Domain Name System) name and set the Guest system's hostname. |
| | **ipaddress** string | | ipaddress is used to set the ipaddress in Instant Cloned Guest Operating System. |
| | **netmask** string | | netmask is used to set the netmask in Instant Cloned Guest Operating System. |
| **host** string / required | | Name of the ESX Host in datacenter in which to place cloned VM. The host has to be a member of the cluster that contains the resource pool. Required with *resource\_pool* to find resource pool details. This will be used as additional information when there are resource pools with same name.
aliases: esxi\_hostname |
| **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. |
| **moid** string | | Managed Object ID of the vm instance to manage if known, this is a unique identifier only within a single vCenter instance. This is required if `parent_vm` or `uuid` is not supplied. |
| **name** string / required | | Name of the Cloned virtual machine.
aliases: vm\_name |
| **parent\_vm** string | | Name of the parent virtual machine. This is a required parameter, if parameter `uuid` or `moid` is not supplied. |
| **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. |
| **resource\_pool** string | | Name of the resource pool in datacenter in which to place deployed VM. Required if *cluster* is not specified. For default or non-unique resource pool names, specify *host* and *cluster*.
`Resources` is the default name of resource pool. |
| **use\_instance\_uuid** boolean | **Choices:*** **no** ←
* yes
| Whether to use the VMware instance UUID rather than the BIOS UUID. |
| **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 |
| **uuid** string | | UUID of the vm instance to clone from, this is VMware's unique identifier. This is a required parameter, if parameter `parent_vm` or `moid` is not supplied. |
| **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. |
| **vm\_password** string | | The password used to login-in to the virtual machine. Only required when using guest customization feature. |
| **vm\_username** string | | The user to login-in to the virtual machine. Only required when using guest customization feature. |
| **wait\_vm\_tools** boolean added in 1.12.0 of community.vmware | **Choices:*** no
* **yes** ←
| Whether waiting until vm tools start after rebooting an instant clone vm. |
| **wait\_vm\_tools\_timeout** integer added in 1.12.0 of community.vmware | **Default:**300 | Define a timeout (in seconds) for *the wait\_vm\_tools* parameter. |
Notes
-----
Note
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Instant Clone a VM
community.vmware.vmware_guest_instant_clone:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: False
folder: "{{ f0 }}"
datastore: "{{ rw_datastore }}"
datacenter: "{{ dc1 }}"
host: "{{ esxi1 }}"
name: "{{ Clone_vm }}"
parent_vm: "{{ testvm_1 }}"
resource_pool: "{{ test_resource_001 }}"
register: vm_clone
delegate_to: localhost
- name: set state to poweroff the Cloned VM
community.vmware.vmware_guest_powerstate:
validate_certs: false
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
name: "cloned_vm_from_vm_cluster"
folder: "{{ f0 }}"
state: powered-off
register: poweroff_instant_clone_from_vm_when_cluster
delegate_to: localhost
- name: Clean VM
community.vmware.vmware_guest:
validate_certs: false
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
name: "cloned_vm_from_vm_cluster"
datacenter: "{{ dc1 }}"
state: absent
register: delete_instant_clone_from_vm_when_cluster
ignore_errors: true
delegate_to: localhost
- name: Instant Clone a VM with guest_customization
community.vmware.vmware_guest_instant_clone:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
vm_username: "root"
vm_password: "SuperSecret"
validate_certs: False
folder: "{{ f0 }}"
datastore: "{{ rw_datastore }}"
datacenter: "{{ dc1 }}"
host: "{{ esxi1 }}"
guestinfo_vars:
- hostname: "{{ guestinfo.ic.hostname }}"
ipaddress: "{{ guestinfo.ic.ipaddress }}"
netmask: "{{ guestinfo.ic.netmask }}"
gateway: "{{ guestinfo.ic.gateway }}"
dns: "{{ guestinfo.ic.dns }}"
domain: "{{ guestinfo.ic.domain }}"
name: "Instant_clone_guest_customize"
parent_vm: "test_vm1"
resource_pool: DC0_C0_RP1
register: Instant_cloned_guest_customize
delegate_to: localhost
- name: Instant Clone a VM when skipping optional params
community.vmware.vmware_guest_instant_clone:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: False
name: "{{ Clone_vm }}"
parent_vm: "{{ testvm_1 }}"
datacenter: "{{ dc1 }}"
datastore: "{{ rw_datastore }}"
host: "{{ esxi1 }}"
register: VM_clone_optional_arguments
delegate_to: localhost
- name: Instant clone in check mode
community.vmware.vmware_guest_instant_clone:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: False
folder: "{{ f0 }}"
datastore: "{{ rw_datastore }}"
datacenter: "{{ dc1 }}"
host: "{{ esx1 }}"
name: "{{ Clone_vm }}"
parent_vm: "{{ testvm_2 }}"
resource_pool: "{{ test_resource_001 }}"
check_mode: true
register: check_mode_clone
delegate_to: localhost
- debug:
var: check_mode_clone
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **vm\_info** dictionary | always | metadata about the virtual machine added instance\_uuid from version 1.12.0 **Sample:** {'datastore': '', 'host': '', 'instance\_uuid': '', 'vcenter': '', 'vm\_folder': '', 'vm\_name': ''} |
### Authors
* Anant Chopra (@Anant99-sys)
ansible community.vmware.vca_vapp – Manages vCloud Air vApp instances. community.vmware.vca\_vapp – Manages vCloud Air vApp instances.
===============================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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.vca_vapp`.
* [DEPRECATED](#deprecated)
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Status](#status)
DEPRECATED
----------
Removed in
major release after 2022-06-01
Why
Module depends upon deprecated version of Pyvcloud library.
Alternative
Use <https://github.com/vmware/ansible-module-vcloud-director> instead.
Synopsis
--------
* This module will actively managed vCloud Air vApp instances. Instances can be created and deleted as well as both deployed and undeployed.
Requirements
------------
The below requirements are needed on the host that executes this module.
* pyvcloud <= 18.2.2
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **api\_version** string | **Default:**"5.7" | The api version to be used with the vca |
| **gateway\_name** string | **Default:**"gateway" | The name of the gateway of the vdc where the rule should be added. |
| **host** string | | The authentication host to be used when service type is vcd. |
| **instance\_id** string | | The instance id in a vchs environment to be used for creating the vapp |
| **network\_mode** string | **Choices:*** **pool** ←
* dhcp
* static
| Configures the mode of the network connection. |
| **network\_name** string | | The name of the network that should be attached to the virtual machine in the vApp. The virtual network specified must already be created in the vCloud Air VDC. If the *state* is not 'absent' then the *network\_name* argument must be provided. |
| **operation** string | **Choices:*** **noop** ←
* poweron
* poweroff
* suspend
* shutdown
* reboot
* reset
| Specifies an operation to be performed on the vApp. |
| **org** string | | The org to login to for creating vapp, mostly set when the service\_type is vdc. |
| **password** string | | The vCloud Air password to use during authentication
aliases: pass, passwd |
| **service\_type** string | **Choices:*** **vca** ←
* vchs
* vcd
| The type of service we are authenticating against |
| **state** string | **Choices:*** **present** ←
* absent
* deployed
* undeployed
| Configures the state of the vApp. |
| **template\_name** string | | The name of the vApp template to use to create the vApp instance. If the *state* is not `absent` then the *template\_name* value must be provided. The *template\_name* must be previously uploaded to the catalog specified by *catalog\_name*
|
| **username** string | | The vCloud Air username to use during authentication
aliases: user |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If the certificates of the authentication is to be verified.
aliases: verify\_certs |
| **vapp\_name** string / required | | The name of the vCloud Air vApp instance |
| **vdc\_name** string | | The name of the virtual data center (VDC) where the vm should be created or contains the vAPP. |
| **vm\_cpus** string | | The number of vCPUs to configure for the VM in the vApp. If the *vm\_name* argument is provided, then this becomes a per VM setting otherwise it is applied to all VMs in the vApp. |
| **vm\_memory** string | | The amount of memory in MB to allocate to VMs in the vApp. If the *vm\_name* argument is provided, then this becomes a per VM setting otherwise it is applied to all VMs in the vApp. |
| **vm\_name** string | | The name of the virtual machine instance in the vApp to manage. |
Notes
-----
Note
* VMware sold their vCloud Air service in Q2 2017.
* VMware made significant changes to the pyvcloud interface around this time. The `vca_vapp` module relies on now deprecated code.
* Mileage with `vca_vapp` may vary as vCloud Director APIs advance.
* A viable alternative maybe <https://github.com/vmware/ansible-module-vcloud-director>
Examples
--------
```
- name: Creates a new vApp in a VCA instance
community.vmware.vca_vapp:
vapp_name: tower
state: present
template_name: 'Ubuntu Server 12.04 LTS (amd64 20150127)'
vdc_name: VDC1
instance_id: '<your instance id here>'
username: '<your username here>'
password: '<your password here>'
delegate_to: localhost
```
Status
------
* This module will be removed in a major release after 2022-06-01. *[deprecated]*
* For more information see [DEPRECATED](#deprecated).
### Authors
* Peter Sprygada (@privateip)
ansible community.vmware.vmware_guest_network – Manage network adapters of specified virtual machine in given vCenter infrastructure community.vmware.vmware\_guest\_network – Manage network adapters of specified virtual machine in given vCenter infrastructure
==============================================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_guest_network`.
New in version 1.0.0: of community.vmware
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module is used to add, reconfigure, remove network adapter of given virtual machine.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster** string | | Name of cluster where VM belongs to. |
| **connected** boolean | **Choices:*** no
* **yes** ←
| If NIC should be connected to the network. |
| **datacenter** string | **Default:**"ha-datacenter" | Datacenter the VM belongs to. |
| **device\_type** string | **Default:**"vmxnet3" | Type of virtual network device. Valid choices are - `e1000`, `e1000e`, `pcnet32`, `vmxnet2`, `vmxnet3` (default), `sriov`. |
| **directpath\_io** boolean | **Choices:*** **no** ←
* yes
| Enable Universal Pass-through (UPT). Only compatible with the `vmxnet3` device type. |
| **esxi\_hostname** string | | The hostname of the ESXi host where the VM belongs to. |
| **folder** string | | Folder location of given VM, this is only required when there's multiple VM's with the same name. |
| **force** boolean | **Choices:*** **no** ←
* yes
| Force adapter creation even if an existing adapter is attached to the same network. |
| **gather\_network\_info** boolean | **Choices:*** **no** ←
* yes
| Return information about current guest network adapters.
aliases: gather\_network\_facts |
| **guest\_control** boolean | **Choices:*** no
* **yes** ←
| Enables guest control over whether the connectable device is connected. |
| **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. |
| **label** string | | Alter the name of the network adapter. |
| **mac\_address** string | | MAC address of the NIC that should be altered, if a MAC address is not supplied a new nic will be created. Required when *state=absent*. |
| **moid** string | | Managed Object ID of the instance to manage if known, this is a unique identifier only within a single vCenter instance. Required if `uuid` or `name` is not supplied. |
| **name** string | | Name of virtual machine Required if `uuid` or `moid` is not supplied. |
| **network\_name** string | | Name of network in vSphere. |
| **networks** list / elements=dictionary | | This method will be deprecated, use loops in your playbook for multiple interfaces instead. A list of network adapters.
`mac` or `label` or `device_type` is required to reconfigure or remove an existing network adapter. If there are multiple network adapters with the same `device_type`, you should set `label` or `mac` to match one of them, or will apply changes on all network adapters with the `device_type` specified.
`mac`, `label`, `device_type` is the order of precedence from greatest to least if all set. |
| | **connected** boolean | **Choices:*** no
* yes
| Indicates that virtual network adapter connects to the associated virtual machine. |
| | **device\_type** string | | Valid virtual network device types are `e1000`, `e1000e`, `pcnet32`, `vmxnet2`, `vmxnet3` (default), `sriov`. Used to add new network adapter, reconfigure or remove the existing network adapter with this type. If `mac` and `label` not specified or not find network adapter by `mac` or `label` will use this parameter. |
| | **directpath\_io** boolean | **Choices:*** no
* yes
| If set, Universal Pass-Through (UPT or DirectPath I/O) will be enabled on the network adapter. UPT is only compatible for Vmxnet3 adapter. |
| | **dvswitch\_name** string | | Name of the distributed vSwitch. This value is required if multiple distributed portgroups exists with the same name. |
| | **label** string | | Label of the existing network adapter to be reconfigured or removed, e.g., "Network adapter 1". |
| | **mac** string | | MAC address of the existing network adapter to be reconfigured or removed. |
| | **manual\_mac** string | | Manual specified MAC address of the network adapter when creating, or reconfiguring. If not specified when creating new network adapter, mac address will be generated automatically. When reconfigure MAC address, VM should be in powered off state. |
| | **name** string | | Name of the portgroup or distributed virtual portgroup for this interface. When specifying distributed virtual portgroup make sure given `esxi_hostname` or `cluster` is associated with it. |
| | **start\_connected** boolean | **Choices:*** no
* yes
| Indicates that virtual network adapter starts with associated virtual machine powers on. |
| | **state** string | | State of the network adapter. If set to `present`, then will do reconfiguration for the specified network adapter. If set to `new`, then will add the specified network adapter. If set to `absent`, then will remove this network adapter. |
| | **vlan** integer | | VLAN number for this interface. |
| **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. |
| **start\_connected** boolean | **Choices:*** no
* **yes** ←
| If NIC should be connected to network on startup. |
| **state** string | **Choices:*** **present** ←
* absent
| NIC state. When `state=present`, a nic will be added if a mac address or label does not previously exists or is unset. When `state=absent`, the *mac\_address* parameter has to be set. |
| **switch** string | | Name of the (dv)switch for destination network, this is only required for dvswitches. |
| **use\_instance\_uuid** boolean | **Choices:*** **no** ←
* yes
| Whether to use the VMware instance UUID rather than the BIOS UUID. |
| **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 |
| **uuid** string | | vm uuid Required if `name` or `moid` is not supplied. |
| **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. |
| **vlan\_id** integer | | VLAN id associated with the network. |
| **wake\_onlan** boolean | **Choices:*** **no** ←
* yes
| Enable wake on LAN. |
Notes
-----
Note
* Tested on vSphere 6.0, 6.5 and 6.7
* For backwards compatibility network\_data is returned when using the gather\_network\_info and networks parameters
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: change network for 00:50:56:11:22:33 on vm01.domain.fake
community.vmware.vmware_guest_network:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
name: vm01.domain.fake
mac_address: 00:50:56:11:22:33
network_name: admin-network
state: present
- name: add a nic on network with vlan id 2001 for 422d000d-2000-ffff-0000-b00000000000
community.vmware.vmware_guest_network:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
uuid: 422d000d-2000-ffff-0000-b00000000000
vlan_id: 2001
- name: remove nic with mac 00:50:56:11:22:33 from vm01.domain.fake
community.vmware.vmware_guest_network:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
mac_address: 00:50:56:11:22:33
name: vm01.domain.fake
state: absent
- name: add multiple nics to vm01.domain.fake
community.vmware.vmware_guest_network:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
name: vm01.domain.fake
state: present
vlan_id: "{{ item.vlan_id | default(omit) }}"
network_name: "{{ item.network_name | default(omit) }}"
connected: "{{ item.connected | default(omit) }}"
loop:
- vlan_id: 2000
connected: false
- network_name: guest-net
connected: true
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **network\_data** dictionary | when using gather\_network\_info or networks parameters | For backwards compatibility, metadata about the virtual machine network adapters **Sample:** {'network\_data': {'0': {'allow\_guest\_ctl': True, 'connected': True, 'device\_type': 'vmxnet3', 'label': 'Network adapter 2', 'mac\_addr': '00:50:56:AA:AA:AA', 'mac\_address': '00:50:56:AA:AA:AA', 'name': 'admin-net', 'network\_name': 'admin-net', 'start\_connected': True, 'switch': 'vSwitch0', 'unit\_number': 8, 'vlan\_id': 10, 'wake\_onlan': False}, '1': {'allow\_guest\_ctl': True, 'connected': True, 'device\_type': 'vmxnet3', 'label': 'Network adapter 1', 'mac\_addr': '00:50:56:BB:BB:BB', 'mac\_address': '00:50:56:BB:BB:BB', 'name': 'guest-net', 'network\_name': 'guest-net', 'start\_connected': True, 'switch': 'vSwitch0', 'unit\_number': 7, 'vlan\_id': 10, 'wake\_onlan': True}}} |
| **network\_info** list / elements=string | always | metadata about the virtual machine network adapters **Sample:** {'network\_info': [{'allow\_guest\_ctl': True, 'connected': True, 'device\_type': 'vmxnet3', 'label': 'Network adapter 2', 'mac\_address': '00:50:56:AA:AA:AA', 'network\_name': 'admin-net', 'start\_connected': True, 'switch': 'vSwitch0', 'unit\_number': 8, 'vlan\_id': 10, 'wake\_onlan': False}, {'allow\_guest\_ctl': True, 'connected': True, 'device\_type': 'vmxnet3', 'label': 'Network adapter 1', 'mac\_address': '00:50:56:BB:BB:BB', 'network\_name': 'guest-net', 'start\_connected': True, 'switch': 'vSwitch0', 'unit\_number': 7, 'vlan\_id': 10, 'wake\_onlan': True}]} |
### Authors
* Diane Wang (@Tomorrow9) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#17737e76797260313424202c313422252c3134232f2c617a60766572313423212c74787a)>
| programming_docs |
ansible community.vmware.vsphere_file – Manage files on a vCenter datastore community.vmware.vsphere\_file – Manage files on a vCenter datastore
====================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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.vsphere_file`.
* [Synopsis](#synopsis)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Manage files on a vCenter datastore.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **datacenter** string / required | | The datacenter on the vCenter server that holds the datastore. |
| **datastore** string / required | | The datastore on the vCenter server to push files to. |
| **host** string / required | | The vCenter server on which the datastore is available.
aliases: hostname |
| **password** string / required | | The password to authenticate on the vCenter server. |
| **path** string / required | | The file or directory on the datastore on the vCenter server.
aliases: dest |
| **state** string | **Choices:*** absent
* directory
* **file** ←
* touch
| The state of or the action on the provided path. If `absent`, the file will be removed. If `directory`, the directory will be created. If `file`, more information of the (existing) file will be returned. If `touch`, an empty file will be created if the path does not exist. |
| **timeout** integer | **Default:**10 | The timeout in seconds for the upload to the datastore. |
| **username** string / required | | The user name to authenticate on the vCenter server. |
| **validate\_certs** boolean | **Choices:*** no
* **yes** ←
| If `false`, SSL certificates will not be validated. This should only be set to `false` when no other option exists. |
Notes
-----
Note
* The vSphere folder API does not allow to remove directory objects.
Examples
--------
```
- name: Create an empty file on a datastore
community.vmware.vsphere_file:
host: '{{ vhost }}'
username: '{{ vuser }}'
password: '{{ vpass }}'
datacenter: DC1 Someplace
datastore: datastore1
path: some/remote/file
state: touch
delegate_to: localhost
- name: Create a directory on a datastore
community.vmware.vsphere_file:
host: '{{ vhost }}'
username: '{{ vuser }}'
password: '{{ vpass }}'
datacenter: DC2 Someplace
datastore: datastore2
path: other/remote/file
state: directory
delegate_to: localhost
- name: Query a file on a datastore
community.vmware.vsphere_file:
host: '{{ vhost }}'
username: '{{ vuser }}'
password: '{{ vpass }}'
datacenter: DC1 Someplace
datastore: datastore1
path: some/remote/file
state: file
delegate_to: localhost
ignore_errors: true
- name: Delete a file on a datastore
community.vmware.vsphere_file:
host: '{{ vhost }}'
username: '{{ vuser }}'
password: '{{ vpass }}'
datacenter: DC2 Someplace
datastore: datastore2
path: other/remote/file
state: absent
delegate_to: localhost
```
### Authors
* Dag Wieers (@dagwieers)
ansible community.vmware.vmware_vcenter_settings_info – Gather info vCenter settings community.vmware.vmware\_vcenter\_settings\_info – Gather info vCenter settings
===============================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to gather information about vCenter settings.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **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. |
| **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. |
| **properties** list / elements=string | | Specify the properties to retrieve. Example: properties: [ "config.workflow.port" ] Only valid when `schema` is `vsphere`. |
| **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. |
| **schema** string | **Choices:*** **summary** ←
* vsphere
| Specify the output schema desired. The 'summary' output schema is the legacy output from the module. The 'vsphere' output schema is the vSphere API class definition which requires pyvmomi>6.7.1. |
| **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
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: "Gather info about vCenter settings"
community.vmware.vmware_vcenter_settings_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
register: vcenter_settings_info
- name: "Gather some info from vCenter using the vSphere API output schema"
community.vmware.vmware_vcenter_settings_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
schema: vsphere
properties:
- config.workflow.port
register: vcenter_settings_info_vsphere_api
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **vcenter\_config\_info** dictionary | success | dict of vCenter settings **Sample:** { "db\_event\_cleanup\_previous": true, "db\_event\_retention\_previous": 30, "db\_max\_connections\_previous": 50, "db\_task\_cleanup\_previous": true, "db\_task\_retention\_previous": 30, "directory\_query\_limit\_previous": true, "directory\_query\_limit\_size\_previous": 5000, "directory\_timeout\_previous": 60, "directory\_validation\_period\_previous": 1440, "directory\_validation\_previous": true, "logging\_options\_previous": "info", "mail\_sender\_previous": "", "mail\_server\_previous": "", "runtime\_managed\_address\_previous": "", "runtime\_server\_name\_previous": "vcenter.local", "runtime\_unique\_id\_previous": 48, "snmp\_1\_community\_previous": "public", "snmp\_1\_enabled\_previous": true, "snmp\_1\_url\_previous": "localhost", "snmp\_2\_community\_previous": "", "snmp\_2\_enabled\_previous": false, "snmp\_2\_url\_previous": "", "snmp\_3\_community\_previous": "", "snmp\_3\_enabled\_previous": false, "snmp\_3\_url\_previous": "", "snmp\_4\_community\_previous": "", "snmp\_4\_enabled\_previous": false, "snmp\_4\_url\_previous": "", "snmp\_receiver\_1\_port\_previous": 162, "snmp\_receiver\_2\_port\_previous": 162, "snmp\_receiver\_3\_port\_previous": 162, "snmp\_receiver\_4\_port\_previous": 162, "timeout\_long\_operations\_previous": 120, "timeout\_normal\_operations\_previous": 30 } |
### Authors
* sky-joker (@sky-joker)
ansible community.vmware.vmware_cluster_drs – Manage Distributed Resource Scheduler (DRS) on VMware vSphere clusters community.vmware.vmware\_cluster\_drs – Manage Distributed Resource Scheduler (DRS) on VMware vSphere clusters
==============================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_cluster_drs`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* Manages DRS on VMware vSphere clusters.
* All values and VMware object names are case sensitive.
Requirements
------------
The below requirements are needed on the host that executes this module.
* Tested on ESXi 5.5 and 6.5.
* PyVmomi installed.
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **advanced\_settings** dictionary | **Default:**{} | A dictionary of advanced DRS settings. |
| **cluster\_name** string / required | | The name of the cluster to be managed. |
| **datacenter** string / required | | The name of the datacenter.
aliases: datacenter\_name |
| **drs\_default\_vm\_behavior** string | **Choices:*** **fullyAutomated** ←
* manual
* partiallyAutomated
| Specifies the cluster-wide default DRS behavior for virtual machines. If set to `partiallyAutomated`, vCenter generates recommendations for virtual machine migration and for the placement with a host, then automatically implements placement recommendations at power on. If set to `manual`, then vCenter generates recommendations for virtual machine migration and for the placement with a host, but does not implement the recommendations automatically. If set to `fullyAutomated`, then vCenter automates both the migration of virtual machines and their placement with a host at power on. |
| **drs\_enable\_vm\_behavior\_overrides** boolean | **Choices:*** no
* **yes** ←
| Whether DRS Behavior overrides for individual virtual machines are enabled. If set to `True`, overrides `drs_default_vm_behavior`. |
| **drs\_vmotion\_rate** integer | **Choices:*** 1
* 2
* 3
* 4
* 5
**Default:**3 | Threshold for generated ClusterRecommendations. |
| **enable** boolean | **Choices:*** **no** ←
* yes
| Whether to enable DRS.
aliases: enable\_drs |
| **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. |
| **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. |
| **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
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Enable DRS
community.vmware.vmware_cluster_drs:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter_name: datacenter
cluster_name: cluster
enable: true
delegate_to: localhost
- name: Enable DRS and distribute a more even number of virtual machines across hosts for availability
community.vmware.vmware_cluster_drs:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter_name: datacenter
cluster_name: cluster
enable: true
advanced_settings:
'TryBalanceVmsPerHost': '1'
delegate_to: localhost
- name: Enable DRS and set default VM behavior to partially automated
community.vmware.vmware_cluster_drs:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter_name: DC0
cluster_name: "{{ cluster_name }}"
enable: True
drs_default_vm_behavior: partiallyAutomated
delegate_to: localhost
```
### Authors
* Joseph Callen (@jcpowermac)
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_object_role_permission_info – Gather information about object’s permissions community.vmware.vmware\_object\_role\_permission\_info – Gather information about object’s permissions
=======================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_object_role_permission_info`.
New in version 1.11.0: of community.vmware
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to gather object permissions on the given VMware object.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 3
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **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. |
| **moid** string | | Managed object ID for the given object. Mutually exclusive with *object\_name*.
aliases: object\_moid |
| **object\_name** string | | The object name to assigned permission. Mutually exclusive with *moid*. |
| **object\_type** string | **Choices:*** **Folder** ←
* VirtualMachine
* Datacenter
* ResourcePool
* Datastore
* Network
* HostSystem
* ComputeResource
* ClusterComputeResource
* DistributedVirtualSwitch
| The object type being targeted. |
| **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. |
| **principal** string added in 1.12.0 of community.vmware | | The optional name of an entity, such as a user, assigned permissions on an object. If provided, actual permissions on the specified object are returned for the principal, instead of roles. |
| **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. |
| **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 on ESXi 6.5, vSphere 6.7
* The ESXi login user must have the appropriate rights to administer permissions.
* Supports check mode.
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather role information about Datastore
community.vmware.vmware_object_role_permission_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: false
object_name: ds_200
object_type: Datastore
- name: Gather permissions on Datastore for a User
community.vmware.vmware_object_role_permission_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: false
principal: [email protected]
object_name: ds_200
object_type: Datastore
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **permission\_info** list / elements=string | always | information about object's permission **Sample:** [{'principal': 'VSPHERE.LOCAL\\vpxd-extension-12e0b667-892c-4694-8a5e-f13147e45dbd', 'propagate': True, 'role\_id': -1, 'role\_name': 'Admin'}] |
### Authors
* Abhijeet Kasurde (@Akasurde)
| programming_docs |
ansible community.vmware.vmware_vmotion – Move a virtual machine using vMotion, and/or its vmdks using storage vMotion. community.vmware.vmware\_vmotion – Move a virtual machine using vMotion, and/or its vmdks using storage vMotion.
================================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_vmotion`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* Using VMware vCenter, move a virtual machine using vMotion to a different host, and/or its vmdks to another datastore using storage vMotion.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* pyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **destination\_datacenter** string added in 1.11.0 of community.vmware | | Name of the destination datacenter the datastore is located on. Optional, required only when datastores are shared across datacenters. |
| **destination\_datastore** string | | Name of the destination datastore the virtual machine's vmdk should be moved on.
aliases: datastore |
| **destination\_host** string | | Name of the destination host the virtual machine should be running on. Version 2.6 onwards, this parameter is not a required parameter, unlike the previous versions.
aliases: destination |
| **destination\_resourcepool** string | | Name of the destination resource pool where the virtual machine should be running. Resource pool is required if vmotion is done between hosts which are part of different clusters or datacenters. if not passed, resource\_pool object will be retrived from host\_obj parent.
aliases: resource\_pool |
| **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. |
| **moid** string | | Managed Object ID of the instance to manage if known, this is a unique identifier only within a single vCenter instance. This is required if `vm_name` or `vm_uuid` is not supplied. |
| **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. |
| **use\_instance\_uuid** boolean | **Choices:*** **no** ←
* yes
| Whether to use the VMware instance UUID rather than the BIOS UUID. |
| **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. |
| **vm\_name** string | | Name of the VM to perform a vMotion on. This is required parameter, if `vm_uuid` is not set. Version 2.6 onwards, this parameter is not a required parameter, unlike the previous versions.
aliases: vm |
| **vm\_uuid** string | | UUID of the virtual machine to perform a vMotion operation on. This is a required parameter, if `vm_name` or `moid` is not set.
aliases: uuid |
Notes
-----
Note
* Tested on vSphere 6.0
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Perform vMotion of virtual machine
community.vmware.vmware_vmotion:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
vm_name: 'vm_name_as_per_vcenter'
destination_host: 'destination_host_as_per_vcenter'
delegate_to: localhost
- name: Perform vMotion of virtual machine
community.vmware.vmware_vmotion:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
moid: vm-42
destination_host: 'destination_host_as_per_vcenter'
delegate_to: localhost
- name: Perform vMotion of virtual machine to resource_pool
community.vmware.vmware_vmotion:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
moid: vm-42
destination_host: 'destination_host_as_per_vcenter'
destination_resourcepool: 'destination_resourcepool_as_per_vcenter'
delegate_to: localhost
- name: Perform storage vMotion of of virtual machine
community.vmware.vmware_vmotion:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
vm_name: 'vm_name_as_per_vcenter'
destination_datastore: 'destination_datastore_as_per_vcenter'
delegate_to: localhost
- name: Perform storage vMotion and host vMotion of virtual machine
community.vmware.vmware_vmotion:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
vm_name: 'vm_name_as_per_vcenter'
destination_host: 'destination_host_as_per_vcenter'
destination_datastore: 'destination_datastore_as_per_vcenter'
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **running\_host** string | changed or success | List the host the virtual machine is registered to **Sample:** host1.example.com |
### Authors
* Bede Carroll (@bedecarroll)
* Olivier Boukili (@oboukili)
ansible community.vmware.vmware_host_service_facts – Gathers facts about an ESXi host’s services community.vmware.vmware\_host\_service\_facts – Gathers facts about an ESXi host’s services
===========================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_service_facts`.
* [DEPRECATED](#deprecated)
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
* [Status](#status)
DEPRECATED
----------
Removed in
major release after 2021-12-01
Why
Deprecated in favour of [community.vmware.vmware\_host\_service\_info](vmware_host_service_info_module#ansible-collections-community-vmware-vmware-host-service-info-module) module.
Alternative
Use [community.vmware.vmware\_host\_service\_info](vmware_host_service_info_module#ansible-collections-community-vmware-vmware-host-service-info-module) instead.
Synopsis
--------
* This module can be used to gather facts about an ESXi host’s services.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster. Service facts about each ESXi server will be returned for given cluster. If `esxi_hostname` is not given, this parameter is required. |
| **esxi\_hostname** string | | ESXi hostname. Service facts about this ESXi server will be returned. If `cluster_name` is not given, this parameter is required. |
| **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. |
| **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. |
| **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 on vSphere 6.5
* If source package name is not available then fact is populated as null.
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather facts about all ESXi Host in given Cluster
community.vmware.vmware_host_service_facts:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: cluster_name
delegate_to: localhost
register: cluster_host_services
- name: Gather facts about ESXi Host
community.vmware.vmware_host_service_facts:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
delegate_to: localhost
register: host_services
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **host\_service\_facts** dictionary | always | dict with hostname as key and dict with host service config facts **Sample:** {'10.76.33.226': [{'key': 'DCUI', 'label': 'Direct Console UI', 'policy': 'on', 'required': False, 'running': True, 'source\_package\_desc': 'This VIB contains all of the base functionality of vSphere ESXi.', 'source\_package\_name': 'esx-base', 'uninstallable': False}, {'key': 'TSM', 'label': 'ESXi Shell', 'policy': 'off', 'required': False, 'running': False, 'source\_package\_desc': 'This VIB contains all of the base functionality of vSphere ESXi.', 'source\_package\_name': 'esx-base', 'uninstallable': False}]} |
Status
------
* This module will be removed in a major release after 2021-12-01. *[deprecated]*
* For more information see [DEPRECATED](#deprecated).
### Authors
* Abhijeet Kasurde (@Akasurde)
ansible community.vmware.vmware_guest_snapshot_info – Gather info about virtual machine’s snapshots in vCenter community.vmware.vmware\_guest\_snapshot\_info – Gather info about virtual machine’s snapshots in vCenter
=========================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_guest_snapshot_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to gather information about virtual machine’s snapshots.
* This module was called `vmware_guest_snapshot_facts` before Ansible 2.9. The usage did not change.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **datacenter** string / required | | Name of the datacenter. |
| **folder** string | | Destination folder, absolute or relative path to find an existing guest. This is required parameter, if `name` is supplied. The folder should include the datacenter. ESX's datacenter is ha-datacenter Examples: folder: /ha-datacenter/vm folder: ha-datacenter/vm folder: /datacenter1/vm folder: datacenter1/vm folder: /datacenter1/vm/folder1 folder: datacenter1/vm/folder1 folder: /folder1/datacenter1/vm folder: folder1/datacenter1/vm folder: /folder1/datacenter1/vm/folder2 |
| **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. |
| **moid** string | | Managed Object ID of the instance to manage if known, this is a unique identifier only within a single vCenter instance. This is required if `name` or `uuid` is not supplied. |
| **name** string | | Name of the VM to work with. This is required if `uuid` or `moid` is not supplied. |
| **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. |
| **use\_instance\_uuid** boolean | **Choices:*** **no** ←
* yes
| Whether to use the VMware instance UUID rather than the BIOS UUID. |
| **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 |
| **uuid** string | | UUID of the instance to manage if known, this is VMware's BIOS UUID by default. This is required if `name` or `moid` parameter is not supplied. The `folder` is ignored, if `uuid` is provided. |
| **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 on vSphere 6.0 and 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather snapshot information about the virtual machine in the given vCenter
community.vmware.vmware_guest_snapshot_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
folder: "/{{ datacenter_name }}/vm/"
name: "{{ guest_name }}"
delegate_to: localhost
register: snapshot_info
- name: Gather snapshot information about the virtual machine using MoID
community.vmware.vmware_guest_snapshot_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
moid: vm-42
delegate_to: localhost
register: snapshot_info
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **guest\_snapshots** dictionary | always | metadata about the snapshot information **Sample:** {'current\_snapshot': {'creation\_time': '2018-02-10T14:48:31.999459+00:00', 'description': '', 'id': 28, 'name': 'snap\_0003', 'quiesced': False, 'state': 'poweredOff'}, 'snapshots': [{'creation\_time': '2018-02-10T14:48:31.999459+00:00', 'description': '', 'id': 28, 'name': 'snap\_0003', 'quiesced': False, 'state': 'poweredOff'}]} |
### Authors
* Abhijeet Kasurde (@Akasurde)
| programming_docs |
ansible community.vmware.vmware_host_vmhba_info – Gathers info about vmhbas available on the given ESXi host community.vmware.vmware\_host\_vmhba\_info – Gathers info about vmhbas available on the given ESXi host
=======================================================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_host_vmhba_info`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to gather information about vmhbas available on the given ESXi host.
* If `cluster_name` is provided, then vmhba information about all hosts from given cluster will be returned.
* If `esxi_hostname` is provided, then vmhba information about given host system will be returned.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **cluster\_name** string | | Name of the cluster from which all host systems will be used. Vmhba information about each ESXi server will be returned for the given cluster. This parameter is required if `esxi_hostname` is not specified. |
| **esxi\_hostname** string | | Name of the host system to work with. Vmhba information about this ESXi server will be returned. This parameter is required if `cluster_name` is not specified. |
| **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. |
| **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. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Gather info about vmhbas of all ESXi Host in the given Cluster
community.vmware.vmware_host_vmhba_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: '{{ cluster_name }}'
delegate_to: localhost
register: cluster_host_vmhbas
- name: Gather info about vmhbas of an ESXi Host
community.vmware.vmware_host_vmhba_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
delegate_to: localhost
register: host_vmhbas
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **hosts\_vmhbas\_info** dictionary | hosts\_vmhbas\_info | dict with hostname as key and dict with vmhbas information as value. **Sample:** {'10.76.33.204': {'vmhba\_details': [{'adapter': 'HPE Smart Array P440ar', 'bus': 3, 'device': 'vmhba0', 'driver': 'nhpsa', 'location': '0000:03:00.0', 'model': 'Smart Array P440ar', 'node\_wwn': '50:01:43:80:37:18:9e:a0', 'status': 'unknown', 'type': 'SAS'}, {'adapter': 'QLogic Corp ISP2532-based 8Gb Fibre Channel to PCI Express HBA', 'bus': 5, 'device': 'vmhba1', 'driver': 'qlnativefc', 'location': '0000:05:00.0', 'model': 'ISP2532-based 8Gb Fibre Channel to PCI Express HBA', 'node\_wwn': '57:64:96:32:15:90:23:95:82', 'port\_type': 'unknown', 'port\_wwn': '57:64:96:32:15:90:23:95:82', 'speed': 8, 'status': 'online', 'type': 'Fibre Channel'}, {'adapter': 'QLogic Corp ISP2532-based 8Gb Fibre Channel to PCI Express HBA', 'bus': 8, 'device': 'vmhba2', 'driver': 'qlnativefc', 'location': '0000:08:00.0', 'model': 'ISP2532-based 8Gb Fibre Channel to PCI Express HBA', 'node\_wwn': '57:64:96:32:15:90:23:95:21', 'port\_type': 'unknown', 'port\_wwn': '57:64:96:32:15:90:23:95:21', 'speed': 8, 'status': 'online', 'type': 'Fibre Channel'}]}} |
### Authors
* Christian Kotte (@ckotte)
ansible community.vmware.vmware_vm_storage_policy – Create vSphere storage policies community.vmware.vmware\_vm\_storage\_policy – Create vSphere storage policies
==============================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_vm_storage_policy`.
New in version 1.0.0: of community.vmware
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* A vSphere storage policy defines metadata that describes storage requirements for virtual machines and storage capabilities of storage providers.
* Currently, only tag-based storage policy creation is supported.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.7
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **description** string | | Description of the storage policy to create or update. This parameter is ignored when `state=absent`. |
| **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. |
| **name** string / required | | Name of the storage policy to create, update, or delete. |
| **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. |
| **state** string | **Choices:*** absent
* **present** ←
| State of storage policy. If set to `present`, the storage policy is created. If set to `absent`, the storage policy is deleted. |
| **tag\_affinity** boolean | **Choices:*** no
* **yes** ←
| If set to `true`, the storage policy enforces that virtual machines require the existence of a tag for datastore placement. If set to `false`, the storage policy enforces that virtual machines require the absence of a tag for datastore placement. This parameter is ignored when `state=absent`. |
| **tag\_category** string | | Name of the pre-existing tag category to assign to the storage policy. This parameter is ignored when `state=absent`. This parameter is required when `state=present`. |
| **tag\_name** string | | Name of the pre-existing tag to assign to the storage policy. This parameter is ignored when `state=absent`. This parameter is required when `state=present`. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Create or update a vSphere tag-based storage policy
community.vmware.vmware_vm_storage_policy:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
name: "vSphere storage policy"
description: "vSphere storage performance policy"
tag_category: "performance_tier"
tag_name: "gold"
tag_affinity: true
state: "present"
delegate_to: localhost
- name: Remove a vSphere tag-based storage policy
community.vmware.vmware_vm_storage_policy:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
name: "vSphere storage policy"
state: "absent"
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **vmware\_vm\_storage\_policy** dictionary | success | dictionary of information for the storage policy **Sample:** {'vmware\_vm\_storage\_policy': {'description': 'Storage policy for gold-tier storage', 'id': 'aa6d5a82-1c88-45da-85d3-3d74b91a5bad', 'name': 'gold'}} |
### Authors
* Dustin Scott (@scottd018)
ansible community.vmware.vcenter_folder – Manage folders on given datacenter community.vmware.vcenter\_folder – Manage folders on given datacenter
=====================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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.vcenter_folder`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
* [Return Values](#return-values)
Synopsis
--------
* This module can be used to create, delete, move and rename folder on then given datacenter.
* This module is only supported for vCenter.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **datacenter** string / required | | Name of the datacenter.
aliases: datacenter\_name |
| **folder\_name** string / required | | Name of folder to be managed. This is case sensitive parameter. Folder name should be under 80 characters. This is a VMware restriction. |
| **folder\_type** string | **Choices:*** datastore
* host
* network
* **vm** ←
| This is type of folder. If set to `vm`, then 'VM and Template Folder' is created under datacenter. If set to `host`, then 'Host and Cluster Folder' is created under datacenter. If set to `datastore`, then 'Storage Folder' is created under datacenter. If set to `network`, then 'Network Folder' is created under datacenter. This parameter is required, if `state` is set to `present` and parent\_folder is absent. This option is ignored, if `parent_folder` is set. |
| **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. |
| **parent\_folder** string | | Name of the parent folder under which new folder needs to be created. This is case sensitive parameter. If user wants to create a folder under '/DC0/vm/vm\_folder', this value will be 'vm\_folder'. If user wants to create a folder under '/DC0/vm/folder1/folder2', this value will be 'folder1/folder2'. |
| **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. |
| **state** string | **Choices:*** **present** ←
* absent
| State of folder. If set to `present` without parent folder parameter, then folder with `folder_type` is created. If set to `present` with parent folder parameter, then folder in created under parent folder. `folder_type` is ignored. If set to `absent`, then folder is unregistered and destroyed. |
| **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 on vSphere 6.5
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Create a VM folder on given datacenter
community.vmware.vcenter_folder:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter_name: datacenter_name
folder_name: sample_vm_folder
folder_type: vm
state: present
register: vm_folder_creation_result
delegate_to: localhost
- name: Create a datastore folder on given datacenter
community.vmware.vcenter_folder:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter_name: datacenter_name
folder_name: sample_datastore_folder
folder_type: datastore
state: present
register: datastore_folder_creation_result
delegate_to: localhost
- name: Create a sub folder under VM folder on given datacenter
community.vmware.vcenter_folder:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter_name: datacenter_name
folder_name: sample_sub_folder
parent_folder: vm_folder
state: present
register: sub_folder_creation_result
delegate_to: localhost
- name: Delete a VM folder on given datacenter
community.vmware.vcenter_folder:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter_name: datacenter_name
folder_name: sample_vm_folder
folder_type: vm
state: absent
register: vm_folder_deletion_result
delegate_to: localhost
```
Return Values
-------------
Common return values are documented [here](../../../reference_appendices/common_return_values#common-return-values), the following are the fields unique to this module:
| Key | Returned | Description |
| --- | --- | --- |
| **result** complex | On success | The detail about the new folder |
| | **msg** string | success | string stating about result |
| | **path** string | success | the full path of the new folder |
### Authors
* Abhijeet Kasurde (@Akasurde)
* Christian Kotte (@ckotte) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#8eede6fce7fdfae7efe0a8adbab8b5e5e1fafaeba8adbdb9b5a8adbbbcb5a8adbab6b5e9e3f6a8adbab8b5eaeb)>
* Jan Meerkamp (@meerkampdvv)
ansible community.vmware.vmware_guest_tools_upgrade – Module to upgrade VMTools community.vmware.vmware\_guest\_tools\_upgrade – Module to upgrade VMTools
==========================================================================
Note
This plugin is part of the [community.vmware collection](https://galaxy.ansible.com/community/vmware) (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_guest_tools_upgrade`.
* [Synopsis](#synopsis)
* [Requirements](#requirements)
* [Parameters](#parameters)
* [Notes](#notes)
* [Examples](#examples)
Synopsis
--------
* This module upgrades the VMware Tools on Windows and Linux guests and reboots them.
Requirements
------------
The below requirements are needed on the host that executes this module.
* python >= 2.6
* PyVmomi
Parameters
----------
| Parameter | Choices/Defaults | Comments |
| --- | --- | --- |
| **datacenter** string / required | | Destination datacenter where the virtual machine exists. |
| **folder** string | | Destination folder, absolute or relative path to find an existing guest. This is required, if `name` is supplied. The folder should include the datacenter. ESX's datacenter is ha-datacenter Examples: folder: /ha-datacenter/vm folder: ha-datacenter/vm folder: /datacenter1/vm folder: datacenter1/vm folder: /datacenter1/vm/folder1 folder: datacenter1/vm/folder1 folder: /folder1/datacenter1/vm folder: folder1/datacenter1/vm folder: /folder1/datacenter1/vm/folder2 |
| **force\_upgrade** boolean | **Choices:*** **no** ←
* yes
| This flag overrides the guest operating system detection and forcibly upgrade VMware tools or open-vm-tools. This is useful when VMware tools is too old and unable to detect the 'guestFamily' value. Using this flag may sometime give unexpected results since module will override the default behaviour of 'guestFamily' detection. |
| **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. |
| **moid** string | | Managed Object ID of the instance to manage if known, this is a unique identifier only within a single vCenter instance. This is required if `name` or `uuid` is not supplied. |
| **name** string | | Name of the virtual machine to work with. This is required if `uuid` or `moid` is not supplied. |
| **name\_match** string | **Choices:*** **first** ←
* last
| If multiple virtual machines matching the name, use the first or last found. |
| **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. |
| **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 |
| **uuid** string | | UUID of the instance to manage if known, this is VMware's unique identifier. This is required if `name` or `moid` is not supplied. |
| **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
* In order to upgrade VMTools, please power on virtual machine before hand - either ‘manually’ or using module [community.vmware.vmware\_guest\_powerstate](vmware_guest_powerstate_module#ansible-collections-community-vmware-vmware-guest-powerstate-module).
* All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
```
- name: Get VM UUID
vmware_guest_facts:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter }}"
folder: "/{{datacenter}}/vm"
name: "{{ vm_name }}"
delegate_to: localhost
register: vm_facts
- name: Upgrade VMware Tools using uuid
community.vmware.vmware_guest_tools_upgrade:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
uuid: "{{ vm_facts.instance.hw_product_uuid }}"
delegate_to: localhost
- name: Upgrade VMware Tools using MoID
community.vmware.vmware_guest_tools_upgrade:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
moid: vm-42
delegate_to: localhost
```
### Authors
* Mike Klebolt (@MikeKlebolt) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#a0cdc9c3c8c1c5cc868394969bcbccc5c2cfccd4868393979b868395929b868394989bc3c5ced4d5d2d9ccc9cecb868394969bc3cfcd)>
| programming_docs |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.