code
stringlengths
2.5k
150k
kind
stringclasses
1 value
ansible dellemc.openmanage.dellemc_system_lockdown_mode – Configures system lockdown mode for iDRAC dellemc.openmanage.dellemc\_system\_lockdown\_mode – Configures system lockdown mode for iDRAC ============================================================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.dellemc_system_lockdown_mode`. New in version 1.0.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module is allows to Enable or Disable System lockdown Mode. Requirements ------------ The below requirements are needed on the host that executes this module. * omsdk * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **idrac\_ip** string / required | | iDRAC IP Address. | | **idrac\_password** string / required | | iDRAC user password. aliases: idrac\_pwd | | **idrac\_port** integer | **Default:**443 | iDRAC port. | | **idrac\_user** string / required | | iDRAC username. | | **lockdown\_mode** string / required | **Choices:*** Enabled * Disabled | Whether to Enable or Disable system lockdown mode. | | **share\_mnt** string | | Local mount path of the network share with read-write permission for ansible user. This option is mandatory for Network Share. | | **share\_name** string / required | | Network share or a local path. | | **share\_password** string | | Network share user password. This option is mandatory for CIFS Network Share. aliases: share\_pwd | | **share\_user** string | | Network share user in the format 'user@domain' or 'domain\user' if user is part of a domain else 'user'. This option is mandatory for CIFS Network Share. | Notes ----- Note * This module requires ‘Administrator’ privilege for *idrac\_user*. * Run this module from a system that has direct access to Dell EMC iDRAC. * This module does not support `check_mode`. Examples -------- ``` --- - name: Check System Lockdown Mode dellemc.openmanage.dellemc_system_lockdown_mode: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_password" share_name: "192.168.0.1:/share" share_mnt: "/mnt/share" lockdown_mode: "Disabled" ``` 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\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'MessageId': 'GEN1234', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **msg** string | always | Lockdown mode of the system is configured. **Sample:** Successfully completed the lockdown mode operations. | | **system\_lockdown\_status** dictionary | success | Storage configuration job and progress details from the iDRAC. **Sample:** {'Data': {'StatusCode': 200, 'body': {'@Message.ExtendedInfo': [{'Message': 'Successfully Completed Request', 'MessageArgs': [], '[email protected]': 0, 'MessageId': 'Base.1.0.Success', 'RelatedProperties': [], '[email protected]': 0, 'Resolution': 'None', 'Severity': 'OK'}]}}, 'Message': 'none', 'Status': 'Success', 'StatusCode': 200, 'retval': True} | ### Authors * Felix Stephen (@felixs88) ansible dellemc.openmanage.ome_groups – Manages static device groups on OpenManage Enterprise dellemc.openmanage.ome\_groups – Manages static device groups on OpenManage Enterprise ====================================================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.ome_groups`. New in version 3.5.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows to create, modify, and delete static device groups on OpenManage Enterprise. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **description** string | | Description for the device group. This is applicable only when *state* is `present`. | | **group\_id** list / elements=integer | | ID of the device group to be created, modified, or deleted. If *state* is absent, multiple IDs can be provided. This option is mutually exclusive with *name*. | | **hostname** string / required | | OpenManage Enterprise IP address or hostname. | | **name** list / elements=string | | Name of the device group to be created, modified, or deleted. If *state* is absent, multiple names can be provided. This option is case insensitive. This option is mutually exclusive with *group\_id*. | | **new\_name** string | | New name for the existing device group. This is applicable only when *state* is `present`. | | **parent\_group\_id** integer | | ID of the parent device group under which the device group to be created or modified. This is applicable only when *state* is `present`. This option is mutually exclusive with *parent\_group\_name*. | | **parent\_group\_name** string | **Default:**"Static Groups" | Name of the parent device group under which the device group to be created or modified. This is applicable only when *state* is `present`. `NOTE` If device group with such a name does not exist, device group with *parent\_group\_name* is created. This option is case insensitive. This option is mutually exclusive with *parent\_group\_id*. | | **password** string / required | | OpenManage Enterprise password. | | **port** integer | **Default:**443 | OpenManage Enterprise HTTPS port. | | **state** string | **Choices:*** **present** ← * absent | `present` allows to create or modify a device group. `absent` allows to delete a device group. | | **username** string / required | | OpenManage Enterprise username. | Notes ----- Note * This module manages only static device groups on Dell EMC OpenManage Enterprise. * If a device group with the name *parent\_group\_name* does not exist, a new device group with the same name is created. * Make sure the entered parent group is not the descendant of the provided group. * Run this module from a system that has direct access to Dell EMC OpenManage Enterprise. * This module supports `check_mode`. Examples -------- ``` --- - name: Create a new device group dellemc.openmanage.ome_groups: hostname: "192.168.0.1" username: "username" password: "password" name: "group 1" description: "Group 1 description" parent: "group parent 1" - name: Modify a device group using the group ID dellemc.openmanage.ome_groups: hostname: "192.168.0.1" username: "username" password: "password" group_id: 1234 description: "Group description updated" parent: "group parent 2" - name: Delete a device group using the device group name dellemc.openmanage.ome_groups: hostname: "192.168.0.1" username: "username" password: "password" state: absent name: "group 1" - name: Delete multiple device groups using the group IDs dellemc.openmanage.ome_groups: hostname: "192.168.0.1" username: "username" password: "password" state: absent group_id: - 1234 - 5678 ``` 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\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to update group 12345 with the provided parent 54321 because a group/parent relationship already exists.', 'MessageArgs': ['12345', '54321'], 'MessageId': 'CGRP9013', 'RelatedProperties': [], 'Resolution': 'Make sure the entered parent ID does not create a bidirectional relationship and retry the operation.', 'Severity': 'Warning'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **group\_ids** list / elements=integer | when *state* is `absent` | List of the deleted device group IDs. **Sample:** [1234, 5678] | | **group\_status** dictionary | success | Details of the device group operation status. **Sample:** {'CreatedBy': 'admin', 'CreationTime': '2021-01-01 10:10:10.100', 'DefinitionDescription': 'UserDefined', 'DefinitionId': 400, 'Description': 'my group description', 'GlobalStatus': 5000, 'HasAttributes': False, 'Id': 12123, 'IdOwner': 30, 'MembershipTypeId': 12, 'Name': 'group 1', 'ParentId': 12345, 'TypeId': 3000, 'UpdatedBy': '', 'UpdatedTime': '2021-01-01 11:11:10.100', 'Visible': True} | | **invalid\_groups** list / elements=string | when *state* is `absent` | List of the invalid device group IDs or names. **Sample:** [1234, 5678] | | **msg** string | always | Overall status of the device group operation. **Sample:** Successfully deleted the device group(s). | ### Authors * Jagadeesh N V(@jagadeeshnv) ansible dellemc.openmanage.idrac_system_info – Get the PowerEdge Server System Inventory dellemc.openmanage.idrac\_system\_info – Get the PowerEdge Server System Inventory ================================================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.idrac_system_info`. New in version 3.0.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Get the PowerEdge Server System Inventory. Requirements ------------ The below requirements are needed on the host that executes this module. * omsdk * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **idrac\_ip** string / required | | iDRAC IP Address. | | **idrac\_password** string / required | | iDRAC user password. aliases: idrac\_pwd | | **idrac\_port** integer | **Default:**443 | iDRAC port. | | **idrac\_user** string / required | | iDRAC username. | Notes ----- Note * Run this module from a system that has direct access to DellEMC iDRAC. * This module supports `check_mode`. Examples -------- ``` --- - name: Get System Inventory dellemc.openmanage.idrac_system_info: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_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 module: | Key | Returned | Description | | --- | --- | --- | | **error\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'MessageId': 'GEN1234', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **msg** string | always | Overall system inventory information status. **Sample:** Successfully fetched the system inventory details. | | **system\_info** dictionary | success | Details of the PowerEdge Server System Inventory. **Sample:** {'BIOS': [{'BIOSReleaseDate': '11/26/2019', 'FQDD': 'BIOS.Setup.1-1', 'InstanceID': 'DCIM:INSTALLED#741\_\_BIOS.Setup.1-1', 'Key': 'DCIM:INSTALLED#741\_\_BIOS.Setup.1-1', 'SMBIOSPresent': 'True', 'VersionString': '2.4.8'}]} | ### Authors * Rajeev Arakkal (@rajeevarakkal) ansible dellemc.openmanage.ome_application_network_address – Updates the network configuration on OpenManage Enterprise dellemc.openmanage.ome\_application\_network\_address – Updates the network configuration on OpenManage Enterprise ================================================================================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.ome_application_network_address`. New in version 2.1.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows the configuration of a DNS and an IPV4 or IPV6 network on OpenManage Enterprise. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **dns\_configuration** dictionary | | Domain Name System(DNS) settings. | | | **dns\_domain\_name** string | | Static DNS domain name This is applicable when *use\_dhcp\_for\_dns\_domain\_name* is false. | | | **dns\_name** string | | DNS name for *hostname* This is applicable when *register\_with\_dns* is true. | | | **register\_with\_dns** boolean | **Choices:*** no * yes | Register/Unregister *dns\_name* on the DNS Server. This option cannot be updated if vLAN configuration changes. | | | **use\_dhcp\_for\_dns\_domain\_name** boolean | **Choices:*** no * yes | Get the *dns\_domain\_name* using a DHCP server. | | **enable\_nic** boolean | **Choices:*** no * **yes** ← | Enable or disable Network Interface Card (NIC) configuration. | | **hostname** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular IP address or hostname. | | **interface\_name** string | | If there are multiple interfaces, network configuration changes can be applied to a single interface using the interface name of the NIC. If this option is not specified, Primary interface is chosen by default. | | **ipv4\_configuration** dictionary | | IPv4 network configuration. *Warning* Ensure that you have an alternate interface to access OpenManage Enterprise as these options can change the current IPv4 address for *hostname*. | | | **enable** boolean / required | **Choices:*** no * yes | Enable or disable access to the network using IPv4. | | | **enable\_dhcp** boolean | **Choices:*** no * yes | Enable or disable the automatic request to get an IPv4 address from the IPv4 Dynamic Host Configuration Protocol (DHCP) server If *enable\_dhcp* option is true, OpenManage Enterprise retrieves the IP configuration—IPv4 address, subnet mask, and gateway from a DHCP server on the existing network. | | | **static\_alternate\_dns\_server** string | | Static IPv4 DNS alternate server This option is applicable when *use\_dhcp\_for\_dns\_server\_names* is false. | | | **static\_gateway** string | | Static IPv4 gateway address This option is applicable when *enable\_dhcp* is false. | | | **static\_ip\_address** string | | Static IPv4 address This option is applicable when *enable\_dhcp* is false. | | | **static\_preferred\_dns\_server** string | | Static IPv4 DNS preferred server This option is applicable when *use\_dhcp\_for\_dns\_server\_names* is false. | | | **static\_subnet\_mask** string | | Static IPv4 subnet mask address This option is applicable when *enable\_dhcp* is false. | | | **use\_dhcp\_for\_dns\_server\_names** boolean | **Choices:*** no * yes | This option allows to automatically request and obtain a DNS server IPv4 address from the DHCP server. This option is applicable when *enable\_dhcp* is true. | | **ipv6\_configuration** dictionary | | IPv6 network configuration. *Warning* Ensure that you have an alternate interface to access OpenManage Enterprise as these options can change the current IPv6 address for *hostname*. | | | **enable** boolean / required | **Choices:*** no * yes | Enable or disable access to the network using the IPv6. | | | **enable\_auto\_configuration** boolean | **Choices:*** no * yes | Enable or disable the automatic request to get an IPv6 address from the IPv6 DHCP server or router advertisements(RA) If *enable\_auto\_configuration* is true, OME retrieves IP configuration-IPv6 address, prefix, and gateway, from a DHCPv6 server on the existing network | | | **static\_alternate\_dns\_server** string | | Static IPv6 DNS alternate server This option is applicable when *use\_dhcp\_for\_dns\_server\_names* is false. | | | **static\_gateway** string | | Static IPv6 gateway address This option is applicable when *enable\_auto\_configuration* is false. | | | **static\_ip\_address** string | | Static IPv6 address This option is applicable when *enable\_auto\_configuration* is false. | | | **static\_preferred\_dns\_server** string | | Static IPv6 DNS preferred server This option is applicable when *use\_dhcp\_for\_dns\_server\_names* is false. | | | **static\_prefix\_length** integer | | Static IPv6 prefix length This option is applicable when *enable\_auto\_configuration* is false. | | | **use\_dhcp\_for\_dns\_server\_names** boolean | **Choices:*** no * yes | This option allows to automatically request and obtain a DNS server IPv6 address from the DHCP server. This option is applicable when *enable\_auto\_configuration* is true | | **management\_vlan** dictionary | | vLAN configuration. These settings are applicable for OpenManage Enterprise Modular. | | | **enable\_vlan** boolean / required | **Choices:*** no * yes | Enable or disable vLAN for management. The vLAN configuration cannot be updated if the *register\_with\_dns* field under *dns\_configuration* is true. *WARNING* Ensure that the network cable is plugged to the correct port after the vLAN configuration changes have been made. If not, the configuration change may not be effective. | | | **vlan\_id** integer | | vLAN ID. This option is applicable when *enable\_vlan* is true. | | **password** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular password. | | **port** integer | **Default:**443 | OpenManage Enterprise or OpenManage Enterprise Modular HTTPS port. | | **reboot\_delay** integer | | The time in seconds, after which settings are applied. This option is not mandatory. | | **username** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular username. | Notes ----- Note * The configuration changes can only be applied to one interface at a time. * The system management consoles might be unreachable for some time after the configuration changes are applied. * This module does not support `check_mode`. Examples -------- ``` --- - name: IPv4 network configuration for primary interface dellemc.openmanage.ome_application_network_address: hostname: "192.168.0.1" username: "username" password: "password" enable_nic: true ipv4_configuration: enable: true enable_dhcp: false static_ip_address: 192.168.0.2 static_subnet_mask: 255.255.254.0 static_gateway: 192.168.0.3 use_dhcp_for_dns_server_names: false static_preferred_dns_server: 192.168.0.4 static_alternate_dns_server: 192.168.0.5 reboot_delay: 5 - name: IPv6 network configuration for primary interface dellemc.openmanage.ome_application_network_address: hostname: "192.168.0.1" username: "username" password: "password" ipv6_configuration: enable: true enable_auto_configuration: true static_ip_address: 2626:f2f2:f081:9:1c1c:f1f1:4747:1 static_prefix_length: 10 static_gateway: 2626:f2f2:f081:9:1c1c:f1f1:4747:2 use_dhcp_for_dns_server_names: true static_preferred_dns_server: 2626:f2f2:f081:9:1c1c:f1f1:4747:3 static_alternate_dns_server: 2626:f2f2:f081:9:1c1c:f1f1:4747:4 - name: Management vLAN configuration for primary interface dellemc.openmanage.ome_application_network_address: hostname: "192.168.0.1" username: "username" password: "password" management_vlan: enable_vlan: true vlan_id: 3344 dns_configuration: register_with_dns: false reboot_delay: 1 - name: DNS settings dellemc.openmanage.ome_application_network_address: hostname: "192.168.0.1" username: "username" password: "password" ipv4_configuration: enable: true use_dhcp_for_dns_server_names: false static_preferred_dns_server: 192.168.0.4 static_alternate_dns_server: 192.168.0.5 dns_configuration: register_with_dns: true use_dhcp_for_dns_domain_name: false dns_name: "MX-SVCTAG" dns_domain_name: "dnslocaldomain" - name: Disbale nic interface eth1 dellemc.openmanage.ome_application_network_address: hostname: "192.168.0.1" username: "username" password: "password" enable_nic: false interface_name: eth1 - name: Complete network settings for interface eth1 dellemc.openmanage.ome_application_network_address: hostname: "192.168.0.1" username: "username" password: "password" enable_nic: true interface_name: eth1 ipv4_configuration: enable: true enable_dhcp: false static_ip_address: 192.168.0.2 static_subnet_mask: 255.255.254.0 static_gateway: 192.168.0.3 use_dhcp_for_dns_server_names: false static_preferred_dns_server: 192.168.0.4 static_alternate_dns_server: 192.168.0.5 ipv6_configuration: enable: true enable_auto_configuration: true static_ip_address: 2626:f2f2:f081:9:1c1c:f1f1:4747:1 static_prefix_length: 10 static_gateway: ffff::2607:f2b1:f081:9 use_dhcp_for_dns_server_names: true static_preferred_dns_server: 2626:f2f2:f081:9:1c1c:f1f1:4747:3 static_alternate_dns_server: 2626:f2f2:f081:9:1c1c:f1f1:4747:4 dns_configuration: register_with_dns: true use_dhcp_for_dns_domain_name: false dns_name: "MX-SVCTAG" dns_domain_name: "dnslocaldomain" reboot_delay: 5 ``` 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\_info** dictionary | on HTTP error | Details of the HTTP error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to update the address configuration because a dependent field is missing for Use DHCP for DNS Domain Name, Enable DHCP for ipv4 or Enable Autoconfig for ipv6 settings for valid configuration .', 'MessageArgs': ['Use DHCP for DNS Domain Name, Enable DHCP for ipv4 or Enable Autoconfig for ipv6 settings for valid configuration'], 'MessageId': 'CAPP1304', 'RelatedProperties': [], 'Resolution': 'Make sure that all dependent fields contain valid content and retry the operation.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **job\_info** dictionary | on success | Details of the job to update in case OME version is >= 3.3. **Sample:** {'Builtin': False, 'CreatedBy': 'system', 'Editable': True, 'EndTime': None, 'Id': 14902, 'JobDescription': 'Generic OME runtime task', 'JobName': 'OMERealtime\_Task', 'JobStatus': {'Id': 2080, 'Name': 'New'}, 'JobType': {'Id': 207, 'Internal': True, 'Name': 'OMERealtime\_Task'}, 'LastRun': None, 'LastRunStatus': {'Id': 2080, 'Name': 'New'}, 'NextRun': None, 'Params': [{'JobId': 14902, 'Key': 'Nmcli\_Update', 'Value': '{"interfaceName":"eth0","profileName":"eth0","enableNIC":true, "ipv4Configuration":{"enable":true,"enableDHCP":true,"staticIPAddress":"", "staticSubnetMask":"","staticGateway":"","useDHCPForDNSServerNames":true, "staticPreferredDNSServer":"","staticAlternateDNSServer":""}, "ipv6Configuration":{"enable":false,"enableAutoConfiguration":true,"staticIPAddress":"", "staticPrefixLength":0,"staticGateway":"","useDHCPForDNSServerNames":false, "staticPreferredDNSServer":"","staticAlternateDNSServer":""}, "managementVLAN":{"enableVLAN":false,"id":0},"dnsConfiguration":{"registerWithDNS":false, "dnsName":"","useDHCPForDNSDomainName":false,"dnsDomainName":"","fqdndomainName":"", "ipv4CurrentPreferredDNSServer":"","ipv4CurrentAlternateDNSServer":"", "ipv6CurrentPreferredDNSServer":"","ipv6CurrentAlternateDNSServer":""}, "currentSettings":{"ipv4Address":[],"ipv4Gateway":"","ipv4Dns":[],"ipv4Domain":"", "ipv6Address":[],"ipv6LinkLocalAddress":"","ipv6Gateway":"","ipv6Dns":[], "ipv6Domain":""},"delay":0,"primaryInterface":true,"modifiedConfigs":{}}'}], 'Schedule': 'startnow', 'StartTime': None, 'State': 'Enabled', 'Targets': [], 'UpdatedBy': None, 'Visible': True} | | **msg** string | always | Overall status of the network address configuration change. **Sample:** Successfully updated network address configuration | | **network\_configuration** dictionary | on success | Updated application network address configuration. **Sample:** {'Delay': 0, 'DnsConfiguration': {'DnsDomainName': '', 'DnsName': 'MX-SVCTAG', 'RegisterWithDNS': False, 'UseDHCPForDNSDomainName': True}, 'EnableNIC': True, 'InterfaceName': 'eth0', 'Ipv4Configuration': {'Enable': True, 'EnableDHCP': False, 'StaticAlternateDNSServer': '', 'StaticGateway': '192.168.0.2', 'StaticIPAddress': '192.168.0.3', 'StaticPreferredDNSServer': '192.168.0.4', 'StaticSubnetMask': '255.255.254.0', 'UseDHCPForDNSServerNames': False}, 'Ipv6Configuration': {'Enable': True, 'EnableAutoConfiguration': True, 'StaticAlternateDNSServer': '', 'StaticGateway': '', 'StaticIPAddress': '', 'StaticPreferredDNSServer': '', 'StaticPrefixLength': 0, 'UseDHCPForDNSServerNames': True}, 'ManagementVLAN': {'EnableVLAN': False, 'Id': 1}, 'PrimaryInterface': True} | ### Authors * Jagadeesh N V(@jagadeeshnv)
programming_docs
ansible dellemc.openmanage.dellemc_get_system_inventory – Get the PowerEdge Server System Inventory dellemc.openmanage.dellemc\_get\_system\_inventory – Get the PowerEdge Server System Inventory ============================================================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.dellemc_get_system_inventory`. New in version 1.0.0: of dellemc.openmanage * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Status](#status) DEPRECATED ---------- Removed in major release after 2023-01-15 Why Replaced with [dellemc.openmanage.idrac\_system\_info](idrac_system_info_module#ansible-collections-dellemc-openmanage-idrac-system-info-module). Alternative Use [dellemc.openmanage.idrac\_system\_info](idrac_system_info_module#ansible-collections-dellemc-openmanage-idrac-system-info-module) instead. Synopsis -------- * Get the PowerEdge Server System Inventory. Requirements ------------ The below requirements are needed on the host that executes this module. * omsdk * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **idrac\_ip** string / required | | iDRAC IP Address. | | **idrac\_password** string / required | | iDRAC user password. aliases: idrac\_pwd | | **idrac\_port** integer | **Default:**443 | iDRAC port. | | **idrac\_user** string / required | | iDRAC username. | Notes ----- Note * Run this module from a system that has direct access to DellEMC iDRAC. * This module supports `check_mode`. Examples -------- ``` --- - name: Get System Inventory dellemc.openmanage.dellemc_get_system_inventory: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_password" ``` Status ------ * This module will be removed in a major release after 2023-01-15. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Rajeev Arakkal (@rajeevarakkal) ansible dellemc.openmanage.ome_discovery – Create, modify, or delete a discovery job on OpenManage Enterprise dellemc.openmanage.ome\_discovery – Create, modify, or delete a discovery job on OpenManage Enterprise ====================================================================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.ome_discovery`. New in version 3.3.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows to create, modify, or delete a discovery job. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.17 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **community\_string** boolean | **Choices:*** **no** ← * yes | Enable the use of SNMP community strings to receive SNMP traps using Application Settings in OpenManage Enterprise. This option is available only for the discovered iDRAC servers and MX7000 chassis. | | **cron** string | | Provide a cron expression based on Quartz cron format. | | **discovery\_config\_targets** list / elements=dictionary | | Provide the list of discovery targets. Each discovery target is a set of *network\_address\_detail*, *device\_types*, and one or more protocol credentials. This is mandatory when *state* is `present`. `WARNING` Modification of this field is not supported, this field is overwritten every time. Ensure to provide all the required details for this field. | | | **device\_types** list / elements=string / required | | Provide the type of devices to be discovered. The accepted types are SERVER, CHASSIS, NETWORK SWITCH, and STORAGE. A combination or all of the above can be provided. Supported protocols for each device type are: SERVER - *wsman*, *redfish*, *snmp*, *ipmi*, *ssh*, and *vmware*. CHASSIS - *wsman*, and *redfish*. NETWORK SWITCH - *snmp*. STORAGE - *storage*, and *snmp*. | | | **ipmi** dictionary | | Intelligent Platform Management Interface (IPMI) | | | | **kgkey** string | | KgKey for the IPMI protocol. | | | | **password** string / required | | Provide a password for the protocol. | | | | **retries** integer | **Default:**3 | Enter the number of repeated attempts required to discover a device. | | | | **timeout** integer | **Default:**60 | Enter the time in seconds after which a job must stop running. | | | | **username** string / required | | Provide a username for the protocol. | | | **network\_address\_detail** list / elements=string / required | | Provide the list of IP addresses, host names, or the range of IP addresses of the devices to be discovered or included. Sample Valid IP Range Formats 192.35.0.0 192.36.0.0-10.36.0.255 192.37.0.0/24 2345:f2b1:f083:135::5500/118 2345:f2b1:f083:135::a500-2607:f2b1:f083:135::a600 hostname.domain.tld hostname 2345:f2b1:f083:139::22a Sample Invalid IP Range Formats 192.35.0.\* 192.36.0.0-255 192.35.0.0/255.255.255.0 `NOTE` The range size for the number of IP addresses is limited to 16,385 (0x4001). `NOTE` Both IPv6 and IPv6 CIDR formats are supported. | | | **redfish** dictionary | | REDFISH protocol. | | | | **ca\_check** boolean | **Choices:*** **no** ← * yes | Enable the Certificate Authority (CA) check. | | | | **certificate\_data** string | | Provide certificate data for the CA check. | | | | **cn\_check** boolean | **Choices:*** **no** ← * yes | Enable the Common Name (CN) check. | | | | **domain** string | | Provide a domain for the protocol. | | | | **password** string / required | | Provide a password for the protocol. | | | | **port** integer | **Default:**443 | Enter the port number that the job must use to discover the devices. | | | | **retries** integer | **Default:**3 | Enter the number of repeated attempts required to discover a device. | | | | **timeout** integer | **Default:**60 | Enter the time in seconds after which a job must stop running. | | | | **username** string / required | | Provide a username for the protocol. | | | **snmp** dictionary | | Simple Network Management Protocol (SNMP). | | | | **community** string / required | | Community string for the SNMP protocol. | | | | **port** integer | **Default:**161 | Enter the port number that the job must use to discover the devices. | | | | **retries** integer | **Default:**3 | Enter the number of repeated attempts required to discover a device. | | | | **timeout** integer | **Default:**3 | Enter the time in seconds after which a job must stop running. | | | **ssh** dictionary | | Secure Shell (SSH). | | | | **check\_known\_hosts** boolean | **Choices:*** **no** ← * yes | Verify the known host key. | | | | **is\_sudo\_user** boolean | **Choices:*** **no** ← * yes | Use the SUDO option. | | | | **password** string / required | | Provide a password for the protocol. | | | | **port** integer | **Default:**22 | Enter the port number that the job must use to discover the devices. | | | | **retries** integer | **Default:**3 | Enter the number of repeated attempts required to discover a device. | | | | **timeout** integer | **Default:**60 | Enter the time in seconds after which a job must stop running. | | | | **username** string / required | | Provide a username for the protocol. | | | **storage** dictionary | | HTTPS Storage protocol. | | | | **ca\_check** boolean | **Choices:*** **no** ← * yes | Enable the Certificate Authority (CA) check. | | | | **certificate\_data** string | | Provide certificate data for the CA check. | | | | **cn\_check** boolean | **Choices:*** **no** ← * yes | Enable the Common Name (CN) check. | | | | **domain** string | | Provide a domain for the protocol. | | | | **password** string / required | | Provide a password for the protocol. | | | | **port** integer | **Default:**443 | Enter the port number that the job must use to discover the devices. | | | | **retries** integer | **Default:**3 | Enter the number of repeated attempts required to discover a device. | | | | **timeout** integer | **Default:**60 | Enter the time in seconds after which a job must stop running. | | | | **username** string / required | | Provide a username for the protocol. | | | **vmware** dictionary | | VMWARE protocol. | | | | **ca\_check** boolean | **Choices:*** **no** ← * yes | Enable the Certificate Authority (CA) check. | | | | **certificate\_data** string | | Provide certificate data for the CA check. | | | | **cn\_check** boolean | **Choices:*** **no** ← * yes | Enable the Common Name (CN) check. | | | | **domain** string | | Provide a domain for the protocol. | | | | **password** string / required | | Provide a password for the protocol. | | | | **port** integer | **Default:**443 | Enter the port number that the job must use to discover the devices. | | | | **retries** integer | **Default:**3 | Enter the number of repeated attempts required to discover a device. | | | | **timeout** integer | **Default:**60 | Enter the time in seconds after which a job must stop running. | | | | **username** string / required | | Provide a username for the protocol. | | | **wsman** dictionary | | Web Services-Management (WS-Man). | | | | **ca\_check** boolean | **Choices:*** **no** ← * yes | Enable the Certificate Authority (CA) check. | | | | **certificate\_data** string | | Provide certificate data for the CA check. | | | | **cn\_check** boolean | **Choices:*** **no** ← * yes | Enable the Common Name (CN) check. | | | | **domain** string | | Provide a domain for the protocol. | | | | **password** string / required | | Provide a password for the protocol. | | | | **port** integer | **Default:**443 | Enter the port number that the job must use to discover the devices. | | | | **retries** integer | **Default:**3 | Enter the number of repeated attempts required to discover a device. | | | | **timeout** integer | **Default:**60 | Enter the time in seconds after which a job must stop running. | | | | **username** string / required | | Provide a username for the protocol. | | **discovery\_id** integer | | ID of the discovery configuration group. This value is DiscoveryConfigGroupId in the return values under discovery\_status. It is mutually exclusive with *discovery\_job\_name*. | | **discovery\_job\_name** string | | Name of the discovery configuration job. It is mutually exclusive with *discovery\_id*. | | **email\_recipient** string | | Enter the email address to which notifications are to be sent about the discovery job status. Configure the SMTP settings to allow sending notifications to an email address. | | **hostname** string / required | | OpenManage Enterprise IP address or hostname. | | **ignore\_partial\_failure** boolean | **Choices:*** **no** ← * yes | Provides the option to ignore partial failures. Partial failures occur when there is a combination of both discovered and undiscovered IPs. If `False`, then the partial failure is not ignored, and the module will error out. If `True`, then the partial failure is ignored. This option is only applicable if *job\_wait* is `True`. | | **job\_wait** boolean | **Choices:*** no * **yes** ← | Provides the option to wait for job completion. This option is applicable when *state* is `present`. | | **job\_wait\_timeout** integer | **Default:**10800 | The maximum wait time of *job\_wait* in seconds. The job is tracked only for this duration. This option is applicable when *job\_wait* is `True`. | | **new\_name** string | | New name of the discovery configuration job. | | **password** string / required | | OpenManage Enterprise password. | | **port** integer | **Default:**443 | OpenManage Enterprise HTTPS port. | | **schedule** string | **Choices:*** **RunNow** ← * RunLater | Provides the option to schedule the discovery job. If `RunLater` is selected, then *cron* must be specified. | | **state** string | **Choices:*** **present** ← * absent | `present` creates a discovery job or modifies an existing discovery job. *discovery\_job\_name* is mandatory for the creation of a new discovery job. If multiple discoveries of the same *discovery\_job\_name* exist, then the new discovery job will not be created. `absent` deletes an existing discovery job(s) with the specified *discovery\_job\_name*. | | **trap\_destination** boolean | **Choices:*** **no** ← * yes | Enable OpenManage Enterprise to receive the incoming SNMP traps from the discovered devices. This is effective only for servers discovered by using their iDRAC interface. | | **username** string / required | | OpenManage Enterprise username. | Notes ----- Note * Run this module from a system that has direct access to Dell EMC OpenManage Enterprise. * This module does not support `check_mode`. * If *state* is `present`, then Idempotency is not supported. Examples -------- ``` --- - name: Discover servers in a range dellemc.openmanage.ome_discovery: hostname: "192.168.0.1" username: "username" password: "password" discovery_job_name: "Discovery_server_1" discovery_config_targets: - network_address_detail: - 192.96.24.1-192.96.24.255 device_types: - SERVER wsman: username: user password: password - name: Discover chassis in a range dellemc.openmanage.ome_discovery: hostname: "192.168.0.1" username: "username" password: "password" discovery_job_name: "Discovery_chassis_1" discovery_config_targets: - network_address_detail: - 192.96.24.1-192.96.24.255 device_types: - CHASSIS wsman: username: user password: password - name: Discover switches in a range dellemc.openmanage.ome_discovery: hostname: "192.168.0.1" username: "username" password: "password" discovery_job_name: "Discover_switch_1" discovery_config_targets: - network_address_detail: - 192.96.24.1-192.96.24.255 device_types: - NETWORK SWITCH snmp: community: snmp_creds - name: Discover storage in a range dellemc.openmanage.ome_discovery: hostname: "192.168.0.1" username: "username" password: "password" discovery_job_name: "Discover_storage_1" discovery_config_targets: - network_address_detail: - 192.96.24.1-192.96.24.255 device_types: - STORAGE storage: username: user password: password snmp: community: snmp_creds - name: Delete a discovery job dellemc.openmanage.ome_discovery: hostname: "192.168.0.1" username: "username" password: "password" state: "absent" discovery_job_name: "Discovery-123" - name: Schedule the discovery of multiple devices ignoring partial failure and enable trap to receive alerts dellemc.openmanage.ome_discovery: hostname: "192.168.0.1" username: "username" password: "password" state: "present" discovery_job_name: "Discovery-123" discovery_config_targets: - network_address_detail: - 192.96.24.1-192.96.24.255 - 192.96.0.0/24 - 192.96.26.108 device_types: - SERVER - CHASSIS - STORAGE - NETWORK SWITCH wsman: username: wsman_user password: wsman_pwd redfish: username: redfish_user password: redfish_pwd snmp: community: snmp_community - network_address_detail: - 192.96.25.1-192.96.25.255 - ipmihost - esxiserver - sshserver device_types: - SERVER ssh: username: ssh_user password: ssh_pwd vmware: username: vm_user password: vmware_pwd ipmi: username: ipmi_user password: ipmi_pwd schedule: RunLater cron: "0 0 9 ? * MON,WED,FRI *" ignore_partial_failure: True trap_destination: True community_string: True email_recipient: [email protected] - name: Discover servers with ca check enabled dellemc.openmanage.ome_discovery: hostname: "192.168.0.1" username: "username" password: "password" discovery_job_name: "Discovery_server_ca1" discovery_config_targets: - network_address_detail: - 192.96.24.108 device_types: - SERVER wsman: username: user password: password ca_check: True certificate_data: "{{ lookup('ansible.builtin.file', '/path/to/certificate_data_file') }}" - name: Discover chassis with ca check enabled data dellemc.openmanage.ome_discovery: hostname: "192.168.0.1" username: "username" password: "password" discovery_job_name: "Discovery_chassis_ca1" discovery_config_targets: - network_address_detail: - 192.96.24.108 device_types: - CHASSIS redfish: username: user password: password ca_check: True certificate_data: "-----BEGIN CERTIFICATE-----\r\n ABCDEFGHIJKLMNOPQRSTUVWXYZaqwertyuiopasdfghjklzxcvbnmasdasagasvv\r\n ABCDEFGHIJKLMNOPQRSTUVWXYZaqwertyuiopasdfghjklzxcvbnmasdasagasvv\r\n ABCDEFGHIJKLMNOPQRSTUVWXYZaqwertyuiopasdfghjklzxcvbnmasdasagasvv\r\n aqwertyuiopasdfghjklzxcvbnmasdasagasvv=\r\n -----END CERTIFICATE-----" ``` 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 | | --- | --- | --- | | **discovery\_ids** list / elements=string | when discoveries with duplicate name exist for *state* is `present` | IDs of the discoveries with duplicate names. **Sample:** [1234, 5678] | | **discovery\_status** dictionary | when *state* is `present` | Details of the discovery job created or modified. If *job\_wait* is true, Completed and Failed IPs are also listed. **Sample:** {'Completed': ['192.168.24.17', '192.168.24.20', '192.168.24.22'], 'DiscoveredDevicesByType': [{'Count': 3, 'DeviceType': 'SERVER'}], 'DiscoveryConfigDiscoveredDeviceCount': 3, 'DiscoveryConfigEmailRecipient': '[email protected]', 'DiscoveryConfigExpectedDeviceCount': 9, 'DiscoveryConfigGroupId': 125, 'Failed': ['192.168.24.15', '192.168.24.16', '192.168.24.18', '192.168.24.19', '192.168.24.21', 'host123'], 'JobDescription': 'D1', 'JobEnabled': True, 'JobEndTime': '2021-01-01 06:27:29.99', 'JobId': 12666, 'JobName': 'D1', 'JobNextRun': None, 'JobProgress': '100', 'JobSchedule': 'startnow', 'JobStartTime': '2021-01-01 06:24:10.071', 'JobStatusId': 2090, 'LastUpdateTime': '2021-01-01 06:27:30.001', 'UpdatedBy': 'admin'} | | **error\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'MessageId': 'GEN1234', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **msg** string | always | Overall status of the discovery operation. **Sample:** Successfully deleted 1 discovery job(s). | ### Authors * Jagadeesh N V (@jagadeeshnv) * Sajna Shetty (@Sajna-Shetty)
programming_docs
ansible dellemc.openmanage.ome_job_info – Get job details for a given job ID or an entire job queue on OpenMange Enterprise dellemc.openmanage.ome\_job\_info – Get job details for a given job ID or an entire job queue on OpenMange Enterprise ===================================================================================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.ome_job_info`. New in version 2.0.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module retrieves job details for a given job ID or an entire job queue on OpenMange Enterprise. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **hostname** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular IP address or hostname. | | **job\_id** integer | | Unique ID of the job. | | **password** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular password. | | **port** integer | **Default:**443 | OpenManage Enterprise or OpenManage Enterprise Modular HTTPS port. | | **system\_query\_options** dictionary | | Options for pagination of the output. | | | **filter** string | | Filter records by the values supported. | | | **skip** integer | | Number of records to skip. Default value is 0. | | | **top** integer | | Number of records to return. Default value is 100. | | **username** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular username. | Notes ----- Note * Run this module from a system that has direct access to DellEMC OpenManage Enterprise. * This module supports `check_mode`. Examples -------- ``` --- - name: Get all jobs details dellemc.openmanage.ome_job_info: hostname: "192.168.0.1" username: "username" password: "password" - name: Get job details for id dellemc.openmanage.ome_job_info: hostname: "192.168.0.1" username: "username" password: "password" job_id: 12345 - name: Get filtered job details dellemc.openmanage.ome_job_info: hostname: "192.168.0.1" username: "username" password: "password" system_query_options: top: 2 skip: 1 filter: "JobType/Id eq 8" ``` 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 | | --- | --- | --- | | **job\_info** dictionary | success | Details of the OpenManage Enterprise jobs. **Sample:** {'value': [{'Builtin': False, 'CreatedBy': 'system', 'Editable': True, 'EndTime': None, 'Id': 12345, 'JobDescription': 'Refresh Inventory for Device', 'JobName': 'Refresh Inventory for Device', 'JobStatus': {'Id': 2080, 'Name': 'New'}, 'JobType': {'Id': 8, 'Internal': False, 'Name': 'Inventory\_Task'}, 'LastRun': '2000-01-29 10:51:34.776', 'LastRunStatus': {'Id': 2060, 'Name': 'Completed'}, 'NextRun': None, 'Params': [], 'Schedule': '', 'StartTime': None, 'State': 'Enabled', 'Targets': [{'Data': "''", 'Id': 123123, 'JobId': 12345, 'TargetType': {'Id': 1000, 'Name': 'DEVICE'}}], 'UpdatedBy': None, 'Visible': True}]} | | **msg** string | always | Overall status of the job facts operation. **Sample:** Successfully fetched the job info | ### Authors * Jagadeesh N V(@jagadeeshnv) ansible dellemc.openmanage.ome_configuration_compliance_info – Device compliance report for devices managed in OpenManage Enterprise dellemc.openmanage.ome\_configuration\_compliance\_info – Device compliance report for devices managed in OpenManage Enterprise =============================================================================================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.ome_configuration_compliance_info`. New in version 3.2.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows the generation of a compliance report of a specific or all of devices in a configuration compliance baseline. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **baseline** string / required | | The name of the created baseline. A compliance report is generated even when the template is not associated with the baseline. | | **device\_id** integer | | The ID of the target device which is associated with the *baseline*. | | **device\_service\_tag** string | | The device service tag of the target device associated with the *baseline*. *device\_service\_tag* is mutually exclusive with *device\_id*. | | **hostname** string / required | | OpenManage Enterprise IP address or hostname. | | **password** string / required | | OpenManage Enterprise password. | | **port** integer | **Default:**443 | OpenManage Enterprise HTTPS port. | | **username** string / required | | OpenManage Enterprise username. | Notes ----- Note * Run this module from a system that has direct access to DellEMC OpenManage Enterprise. * This module supports `check_mode`. Examples -------- ``` --- - name: Retrieve the compliance report of all of the devices in the specified configuration compliance baseline. dellemc.openmanage.ome_configuration_compliance_info: hostname: "192.168.0.1" username: "username" password: "password" baseline: baseline_name - name: Retrieve the compliance report for a specific device associated with the baseline using the device ID. dellemc.openmanage.ome_configuration_compliance_info: hostname: "192.168.0.1" username: "username" password: "password" baseline: baseline_name device_id: 10001 - name: Retrieve the compliance report for a specific device associated with the baseline using the device service tag. dellemc.openmanage.ome_configuration_compliance_info: hostname: "192.168.0.1" username: "username" password: "password" baseline: baseline_name device_service_tag: 2HFGH3 ``` 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 | | --- | --- | --- | | **compliance\_info** dictionary | success | Returns the compliance report information. **Sample:** [{'ComplianceAttributeGroups': [{'Attributes': [], 'ComplianceReason': 'One or more attributes on the target device(s) does not match the compliance template.', 'ComplianceStatus': 2, 'ComplianceSubAttributeGroups': [{'Attributes': [{'AttributeId': 75369, 'ComplianceReason': 'Attribute has different value from template', 'ComplianceStatus': 3, 'CustomId': 0, 'Description': None, 'DisplayName': 'Workload Profile', 'ExpectedValue': 'HpcProfile', 'Value': 'NotAvailable'}], 'ComplianceReason': 'One or more attributes on the target device(s) does not match the compliance template.', 'ComplianceStatus': 2, 'ComplianceSubAttributeGroups': [], 'DisplayName': 'System Profile Settings', 'GroupNameId': 1}], 'DisplayName': 'BIOS', 'GroupNameId': 1}], 'ComplianceStatus': 'NONCOMPLIANT', 'DeviceName': 'WIN-PLOV8MPIP40', 'DeviceType': 1000, 'Id': 25011, 'InventoryTime': '2021-03-18 00:01:57.809771', 'Model': 'PowerEdge R7525', 'ServiceTag': 'JHMBX53'}] | | **error\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'MessageId': 'GEN1234', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **msg** string | on error | Over all compliance report status. **Sample:** Unable to complete the operation because the entered target baseline name 'baseline' is invalid. | ### Authors * Felix Stephen A (@felixs88) ansible dellemc.openmanage.ome_network_vlan – Create, modify & delete a VLAN dellemc.openmanage.ome\_network\_vlan – Create, modify & delete a VLAN ====================================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.ome_network_vlan`. New in version 2.1.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows to, * Create a VLAN on OpenManage Enterprise. * Modify or delete an existing VLAN on OpenManage Enterprise. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.17 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **description** string | | Short description of the VLAN to be created or modified. | | **hostname** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular IP address or hostname. | | **name** string / required | | Provide the *name* of the VLAN to be created, deleted or modified. | | **new\_name** string | | Provide the *name* of the VLAN to be modified. | | **password** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular password. | | **port** integer | **Default:**443 | OpenManage Enterprise or OpenManage Enterprise Modular HTTPS port. | | **state** string | **Choices:*** **present** ← * absent | `present` creates a new VLAN or modifies an existing VLAN. `absent` deletes an existing VLAN. *WARNING* Deleting a VLAN can impact the network infrastructure. | | **type** string | **Choices:*** General Purpose (Bronze) * General Purpose (Silver) * General Purpose (Gold) * General Purpose (Platinum) * Cluster Interconnect * Hypervisor Management * Storage - iSCSI * Storage - FCoE * Storage - Data Replication * VM Migration * VMWare FT Logging | Types of supported VLAN networks. For the description of each network type, use API [https://hostname/api/NetworkConfigurationService/NetworkTypes](#). | | **username** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular username. | | **vlan\_maximum** integer | | The maximum VLAN value of the range. A single value VLAN is created if the vlan\_maximum and vlan\_minmum values are the same. | | **vlan\_minimum** integer | | The minimum VLAN value of the range. | Notes ----- Note * Run this module from a system that has direct access to DellEMC OpenManage Enterprise. * This module supports `check_mode`. Examples -------- ``` --- - name: Create a VLAN range dellemc.openmanage.ome_network_vlan: hostname: "{{hostname}}" username: "{{username}}" password: "{{password}}" state: present name: "vlan1" description: "VLAN desc" type: "General Purpose (Bronze)" vlan_minimum: 35 vlan_maximum: 40 tags: create_vlan_range - name: Create a VLAN with a single value dellemc.openmanage.ome_network_vlan: hostname: "{{hostname}}" username: "{{username}}" password: "{{password}}" state: present name: "vlan2" description: "VLAN desc" type: "General Purpose (Bronze)" vlan_minimum: 127 vlan_maximum: 127 tags: create_vlan_single - name: Modify a VLAN dellemc.openmanage.ome_network_vlan: hostname: "{{hostname}}" username: "{{username}}" password: "{{password}}" state: present name: "vlan1" new_name: "vlan_gold1" description: "new description" type: "General Purpose (Gold)" vlan_minimum: 45 vlan_maximum: 50 tags: modify_vlan - name: Delete a VLAN dellemc.openmanage.ome_network_vlan: hostname: "{{hostname}}" username: "{{username}}" password: "{{password}}" state: "absent" name: "vlan1" tags: delete_vlan ``` 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\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'@Message.ExtendedInfo': [{'Message': 'Unable to create or update the network because the entered VLAN minimum 0 is not within a valid range ( 1 - 4000 or 4021 - 4094 ).', 'MessageArgs': ['0', '1', '4000', '4021', '4094'], 'MessageId': 'CTEM1043', 'RelatedProperties': [], 'Resolution': 'Enter a valid VLAN minimum as identified in the message and retry the operation.', 'Severity': 'Warning'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'} | | **msg** string | always | Overall status of the VLAN operation. **Sample:** Successfully created the VLAN. | | **vlan\_status** dictionary | when *state=present* | Details of the VLAN that is either created or modified. **Sample:** {'@odata.context': '/api/$metadata#NetworkConfigurationService.Network', '@odata.id': '/api/NetworkConfigurationService/Networks(1234)', '@odata.type': '#NetworkConfigurationService.Network', 'CreatedBy': 'admin', 'CreationTime': '2020-01-01 05:54:36.113', 'Description': 'VLAN description', 'Id': 1234, 'InternalRefNWUUId': '6d6effcc-eca4-44bd-be07-1234ab5cd67e', 'Name': 'vlan1', 'Type': 1, 'UpdatedBy': None, 'UpdatedTime': '2020-01-01 05:54:36.113', 'VlanMaximum': 130, 'VlanMinimum': 140} | ### Authors * Jagadeesh N V(@jagadeeshnv) ansible dellemc.openmanage.ome_smart_fabric – Create, modify or delete a fabric on OpenManage Enterprise Modular dellemc.openmanage.ome\_smart\_fabric – Create, modify or delete a fabric on OpenManage Enterprise Modular ========================================================================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.ome_smart_fabric`. New in version 2.1.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows to create a fabric, and modify or delete an existing fabric on OpenManage Enterprise Modular. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.17 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **description** string | | Provide a short description of the fabric to be created or modified. | | **fabric\_design** string | **Choices:*** 2xMX5108n\_Ethernet\_Switches\_in\_same\_chassis * 2xMX9116n\_Fabric\_Switching\_Engines\_in\_same\_chassis * 2xMX9116n\_Fabric\_Switching\_Engines\_in\_different\_chassis | Specify the fabric topology.See the use API <https://www.dell.com/support/manuals/en-in/poweredge-mx7000/omem_1_20_10_ug/smartfabric-network-topologies> to know why its topology. *fabric\_design* is mandatory for fabric creation. | | **hostname** string / required | | OpenManage Enterprise Modular IP address or hostname. | | **name** string / required | | Provide the *name* of the fabric to be created, deleted or modified. | | **new\_name** string | | Provide the *name* of the fabric to be modified. | | **override\_LLDP\_configuration** string | **Choices:*** Enabled * Disabled | Enable this configuration to allow Fabric Management Address to be included in LLDP messages. Notes: OpenManage Enterprise Modular 1.0 does not support this option. Some software networking solutions require a single management address to be transmitted by all Ethernet switches to represent the entire fabric. Enable this feature only when connecting to such a solution. | | **password** string / required | | OpenManage Enterprise Modular password. | | **port** integer | **Default:**443 | OpenManage Enterprise Modular HTTPS port. | | **primary\_switch\_service\_tag** string | | Service tag of the first switch. *primary\_switch\_service\_tag* is mandatory for fabric creation. *primary\_switch\_service\_tag* must belong to the model selected in *fabric\_design*. | | **secondary\_switch\_service\_tag** string | | Service tag of the second switch. *secondary\_switch\_service\_tag* is mandatory for fabric creation. *secondary\_switch\_service\_tag* must belong to the model selected in *fabric\_design*. | | **state** string | **Choices:*** **present** ← * absent | `present` creates a new fabric or modifies an existing fabric. `absent` deletes an existing fabric. Notes: The create, modify, or delete fabric operation takes around 15-20 minutes to complete. It is recommended not to start an another operation until the current operation is completed. | | **username** string / required | | OpenManage Enterprise Modular username. | Notes ----- Note * Run this module from a system that has direct access to DellEMC OpenManage Enterprise Modular. * This module supports `check_mode`. Examples -------- ``` --- - name: Create a fabric dellemc.openmanage.ome_smart_fabric: hostname: "192.168.0.1" username: "username" password: "password" state: present name: "fabric1" description: "fabric desc" fabric_design: "2xMX9116n_Fabric_Switching_Engines_in_different_chassis" primary_switch_service_tag: "SVTG123" secondary_switch_service_tag: "PXYT456" override_LLDP_configuration: "Enabled" - name: Modify a fabric dellemc.openmanage.ome_smart_fabric: hostname: "192.168.0.1" username: "username" password: "password" state: present name: "fabric1" new_name: "fabric_gold1" description: "new description" - name: Delete a fabric dellemc.openmanage.ome_smart_fabric: hostname: "192.168.0.1" username: "username" password: "password" state: "absent" name: "fabric1" ``` 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 | | --- | --- | --- | | **additional\_info** dictionary | when *state=present* and additional information present in response. | Additional details of the fabric operation. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Fabric update is successful. The OverrideLLDPConfiguration attribute is not provided in the payload, so it preserves the previous value.', 'MessageArgs': [], 'RelatedProperties': [], 'Resolution': 'Please update the Fabric with the OverrideLLDPConfiguration as Disabled or Enabled if necessary.', 'Severity': 'Informational'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **error\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to perform operation, because the fabric manager was not reachable.', 'MessageArgs': [], 'RelatedProperties': [], 'Resolution': 'Make sure of the following and retry the operation: 1) There is at least one advanced I/O Module in power-on mode. For example, MX9116n Ethernet Switch and MX5108n Ethernet Switch. However, if an advanced I/O Module is available in the power-on mode, make sure that the network profile is not set when the fabric manager is in the switch-over mode. 2) If the issue persists, wait for few minutes and retry the operation.', 'Severity': 'Warning'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **fabric\_id** string | success | Returns the ID when an fabric is created, modified or deleted. **Sample:** 1312cceb-c3dd-4348-95c1-d8541a17d776 | | **msg** string | always | Overall status of the fabric operation. **Sample:** Fabric creation operation is initiated. | ### Authors * Sajna Shetty(@Sajna-Shetty)
programming_docs
ansible dellemc.openmanage.ome_network_port_breakout – This module allows to automate the port portioning or port breakout to logical sub ports dellemc.openmanage.ome\_network\_port\_breakout – This module allows to automate the port portioning or port breakout to logical sub ports ========================================================================================================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.ome_network_port_breakout`. New in version 2.1.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows to automate breaking out of IOMs in fabric mode into logical sub ports. * The port breakout operation is only supported in OpenManage Enterprise Modular. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.17 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **breakout\_type** string / required | | The preferred breakout type. For example, 4X10GE. To revoke the default breakout configuration, enter 'HardwareDefault'. | | **hostname** string / required | | OpenManage Enterprise Modular IP address or hostname. | | **password** string / required | | OpenManage Enterprise Modular password. | | **port** integer | **Default:**443 | OpenManage Enterprise Modular HTTPS port. | | **target\_port** string / required | | The ID of the port in the switch to breakout. Enter the port ID in the format: service tag:port. For example, 2HB7NX2:ethernet1/1/13. | | **username** string / required | | OpenManage Enterprise Modular username. | Notes ----- Note * Run this module from a system that has direct access to DellEMC OpenManage Enterprise Modular. * This module supports `check_mode`. Examples -------- ``` --- - name: Port breakout configuration dellemc.openmanage.ome_network_port_breakout: hostname: "192.168.0.1" username: "username" password: "password" target_port: "2HB7NX2:phy-port1/1/11" breakout_type: "1X40GE" - name: Revoke the default breakout configuration dellemc.openmanage.ome_network_port_breakout: hostname: "192.168.0.1" username: "username" password: "password" target_port: "2HB7NX2:phy-port1/1/11" breakout_type: "HardwareDefault" ``` 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 | | --- | --- | --- | | **breakout\_status** dictionary | success | Details of the OpenManage Enterprise jobs. **Sample:** {'Builtin': False, 'CreatedBy': 'root', 'Editable': True, 'EndTime': None, 'Id': 11111, 'JobDescription': '', 'JobName': 'Breakout Port', 'JobStatus': {'Id': 1112, 'Name': 'New'}, 'JobType': {'Id': 3, 'Internal': False, 'Name': 'DeviceAction\_Task'}, 'LastRun': None, 'LastRunStatus': {'Id': 1113, 'Name': 'NotRun'}, 'NextRun': None, 'Params': [{'JobId': 11111, 'Key': 'operationName', 'Value': 'CONFIGURE\_PORT\_BREAK\_OUT'}, {'JobId': 11111, 'Key': 'interfaceId', 'Value': '2HB7NX2:phy-port1/1/11'}, {'JobId': 11111, 'Key': 'breakoutType', 'Value': '1X40GE'}], 'Schedule': 'startnow', 'StartTime': None, 'State': 'Enabled', 'Targets': [{'Data': '', 'Id': 11112, 'JobId': 34206, 'TargetType': {'Id': 1000, 'Name': 'DEVICE'}}], 'UpdatedBy': None, 'UserGenerated': True, 'Visible': True} | | **error\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'MessageId': 'GEN1234', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **msg** string | always | Overall status of the port configuration. **Sample:** Port breakout configuration job submitted successfully. | ### Authors * Felix Stephen (@felixs88) ansible dellemc.openmanage.ome_diagnostics – Export technical support logs(TSR) to network share location dellemc.openmanage.ome\_diagnostics – Export technical support logs(TSR) to network share location ================================================================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.ome_diagnostics`. New in version 3.6.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows to export SupportAssist collection logs from OpenManage Enterprise and OpenManage Enterprise Modular and application logs from OpenManage Enterprise Modular to a CIFS or NFS share. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.17 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **device\_group\_name** string | | Name of the device group to export `support_assist_collection` logs of all devices within the group. This is applicable for `support_assist_collection` logs. This option is not applicable for OpenManage Enterprise Modular. This option is mutually exclusive with *device\_ids* and *device\_service\_tags*. | | **device\_ids** list / elements=integer | | List of target device IDs. This is applicable for `support_assist_collection` logs. This option is mutually exclusive with *device\_service\_tags* and *device\_group\_name*. | | **device\_service\_tags** list / elements=string | | List of target identifier. This is applicable for `support_assist_collection` logs. This option is mutually exclusive with *device\_ids* and *device\_group\_name*. | | **hostname** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular IP address or hostname. | | **job\_wait** boolean | **Choices:*** no * **yes** ← | Whether to wait for the Job completion or not. The maximum wait time is *job\_wait\_timeout*. | | **job\_wait\_timeout** integer | **Default:**60 | The maximum wait time of *job\_wait* in minutes. This option is applicable *job\_wait* is true. | | **log\_selectors** list / elements=string | **Choices:*** OS\_LOGS * RAID\_LOGS | By default, the SupportAssist logs contains only hardware logs. To collect additional logs such as OS logs or RAID logs, specify these option in the choices list. If not provided the default hardware log will be exported. `OS_LOGS` to collect OS Logs. `RAID_LOGS` to collect RAID controller logs. This option is applicable only for `support_assist_collection` of *log\_type*. | | **log\_type** string | **Choices:*** application * **support\_assist\_collection** ← | `application` is applicable for OpenManage Enterprise Modular to export the application log bundle. `support_assist_collection` is applicable for one or more devices to export support assist logs. `support_assist_collection` supports both OpenManage Enterprise and OpenManage Enterprise Modular. `support_assist_collection` does not support export of `OS_LOGS` from OpenManage Enterprise. If tried to export, the tasks will complete with errors, and the module fails. | | **mask\_sensitive\_info** boolean | **Choices:*** **no** ← * yes | Select this option to mask the personal identification information such as IPAddress, DNS, alert destination, email, gateway, inet6, MacAddress, netmask etc. This option is applicable for `application` of *log\_type*. | | **password** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular password. | | **port** integer | **Default:**443 | OpenManage Enterprise or OpenManage Enterprise Modular HTTPS port. | | **share\_address** string / required | | Network share IP address. | | **share\_domain** string | | Network share domain name. This option is applicable for `CIFS` if *share\_type*. | | **share\_name** string / required | | Network share path. Filename is auto generated and should not be provided as part of *share\_name*. | | **share\_password** string | | Network share password This option is applicable for `CIFS` of *share\_type*. | | **share\_type** string / required | **Choices:*** NFS * CIFS | Network share type | | **share\_user** string | | Network share username. This option is applicable for `CIFS` of *share\_type*. | | **test\_connection** boolean | **Choices:*** **no** ← * yes | Test the availability of the network share location. *job\_wait* and *job\_wait\_timeout* options are not applicable for *test\_connection*. | | **username** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular username. | Examples -------- ``` --- - name: Export application log using CIFS share location dellemc.openmanage.ome_diagnostics: hostname: "192.168.0.1" username: "username" password: "password" share_type: CIFS share_address: "192.168.0.2" share_user: share_username share_password: share_password share_name: cifs_share log_type: application mask_sensitive_info: false test_connection: true - name: Export application log using NFS share location dellemc.openmanage.ome_diagnostics: hostname: "192.168.0.1" username: "username" password: "password" share_address: "192.168.0.3" share_type: NFS share_name: nfs_share log_type: application mask_sensitive_info: true test_connection: true - name: Export SupportAssist log using CIFS share location dellemc.openmanage.ome_diagnostics: hostname: "192.168.0.1" username: "username" password: "password" share_address: "192.168.0.3" share_user: share_username share_password: share_password share_name: cifs_share share_type: CIFS log_type: support_assist_collection device_ids: [10011, 10022] log_selectors: [OS_LOGS] test_connection: true - name: Export SupportAssist log using NFS share location dellemc.openmanage.ome_diagnostics: hostname: "192.168.0.1" username: "username" password: "password" share_address: "192.168.0.3" share_type: NFS share_name: nfs_share log_type: support_assist_collection device_group_name: group_name test_connection: 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 | | --- | --- | --- | | **error\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'MessageId': 'GEN1234', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **jog\_status** dictionary | success | Details of the export log operation status. **Sample:** {'Builtin': False, 'CreatedBy': 'root', 'Editable': True, 'EndTime': 'None', 'Id': 12778, 'JobDescription': 'Export device log', 'JobName': 'Export Log', 'JobStatus': {'Id': 2080, 'Name': 'New'}, 'JobType': {'Id': 18, 'Internal': False, 'Name': 'DebugLogs\_Task'}, 'LastRun': '2021-07-06 10:52:50.519', 'LastRunStatus': {'Id': 2060, 'Name': 'Completed'}, 'NextRun': 'None', 'Params': [{'JobId': 12778, 'Key': 'maskSensitiveInfo', 'Value': 'FALSE'}, {'JobId': 12778, 'Key': 'password', 'Value': 'tY86w7q92u0QzvykuF0gQQ'}, {'JobId': 12778, 'Key': 'userName', 'Value': 'administrator'}, {'JobId': 12778, 'Key': 'shareName', 'Value': 'iso'}, {'JobId': 12778, 'Key': 'OPERATION\_NAME', 'Value': 'EXTRACT\_LOGS'}, {'JobId': 12778, 'Key': 'shareType', 'Value': 'CIFS'}, {'JobId': 12778, 'Key': 'shareAddress', 'Value': '100.96.32.142'}], 'Schedule': 'startnow', 'StartTime': 'None', 'State': 'Enabled', 'Targets': [{'Data': '', 'Id': 10053, 'JobId': 12778, 'TargetType': {'Id': 1000, 'Name': 'DEVICE'}}], 'UpdatedBy': 'None', 'UserGenerated': True, 'Visible': True} | | **msg** string | always | Overall status of the export log. **Sample:** Export log job completed successfully. | ### Authors * Felix Stephen (@felixs88) ansible dellemc.openmanage.idrac_user – Configure settings for user accounts dellemc.openmanage.idrac\_user – Configure settings for user accounts ===================================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.idrac_user`. New in version 2.1.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows to perform the following, * Add a new user account. * Edit a user account. * Enable or Disable a user account. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **authentication\_protocol** string | **Choices:*** None * SHA * MD5 | This option allows to configure one of the following authentication protocol types to authenticate the iDRAC user. Secure Hash Algorithm `SHA`. Message Digest 5 `MD5`. An authentication protocol is not configured if `None` is selected. | | **enable** boolean | **Choices:*** no * yes | Provide the option to enable or disable a user from logging in to iDRAC. | | **idrac\_ip** string / required | | iDRAC IP Address. | | **idrac\_password** string / required | | iDRAC user password. aliases: idrac\_pwd | | **idrac\_port** integer | **Default:**443 | iDRAC port. | | **idrac\_user** string / required | | iDRAC username. | | **ipmi\_lan\_privilege** string | **Choices:*** Administrator * Operator * User * No Access | The Intelligent Platform Management Interface LAN privilege level assigned to the user. | | **ipmi\_serial\_privilege** string | **Choices:*** Administrator * Operator * User * No Access | The Intelligent Platform Management Interface Serial Port privilege level assigned to the user. This option is only applicable for rack and tower servers. | | **new\_user\_name** string | | Provide the *user\_name* for the account to be modified. | | **privacy\_protocol** string | **Choices:*** None * DES * AES | This option allows to configure one of the following privacy encryption protocols for the iDRAC user. Data Encryption Standard `DES`. Advanced Encryption Standard `AES`. A privacy protocol is not configured if `None` is selected. | | **privilege** string | **Choices:*** Administrator * ReadOnly * Operator * None | Following are the role-based privileges. A user with `Administrator` privilege can log in to iDRAC, and then configure iDRAC, configure users, clear logs, control and configure system, access virtual console, access virtual media, test alerts, and execute debug commands. A user with `Operator` privilege can log in to iDRAC, and then configure iDRAC, control and configure system, access virtual console, access virtual media, and execute debug commands. A user with `ReadOnly` privilege can only log in to iDRAC. A user with `None`, no privileges assigned. | | **protocol\_enable** boolean | **Choices:*** no * yes | Enables protocol for the iDRAC user. | | **sol\_enable** boolean | **Choices:*** no * yes | Enables Serial Over Lan (SOL) for an iDRAC user. | | **state** string | **Choices:*** **present** ← * absent | Select `present` to create or modify a user account. Select `absent` to remove a user account. Ensure Lifecycle Controller is available because the user operation uses the capabilities of Lifecycle Controller. | | **user\_name** string / required | | Provide the *user\_name* of the account to be created, deleted or modified. | | **user\_password** string | | Provide the password for the user account. The password can be changed when the user account is modified. To ensure security, the *user\_password* must be at least eight characters long and must contain lowercase and upper-case characters, numbers, and special characters. | Notes ----- Note * Run this module from a system that has direct access to DellEMC iDRAC. * This module supports `check_mode`. Examples -------- ``` --- - name: Configure a new iDRAC user dellemc.openmanage.idrac_user: idrac_ip: 198.162.0.1 idrac_user: idrac_user idrac_password: idrac_password state: present user_name: user_name user_password: user_password privilege: Administrator ipmi_lan_privilege: Administrator ipmi_serial_privilege: Administrator enable: true sol_enable: true protocol_enable: true authentication_protocol: SHA privacy_protocol: AES - name: Modify existing iDRAC user username and password dellemc.openmanage.idrac_user: idrac_ip: 198.162.0.1 idrac_user: idrac_user idrac_password: idrac_password state: present user_name: user_name new_user_name: new_user_name user_password: user_password - name: Delete existing iDRAC user account dellemc.openmanage.idrac_user: idrac_ip: 198.162.0.1 idrac_user: idrac_user idrac_password: idrac_password state: absent user_name: user_name ``` 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\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'MessageId': 'GEN1234', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **msg** string | always | Status of the iDRAC user configuration. **Sample:** Successfully created user account details. | | **status** dictionary | success | Configures the iDRAC users attributes. **Sample:** {'@Message.ExtendedInfo': [{'Message': 'Successfully Completed Request', 'MessageArgs': [], '[email protected]': 0, 'MessageId': 'Base.1.5.Success', 'RelatedProperties': [], '[email protected]': 0, 'Resolution': 'None', 'Severity': 'OK'}, {'Message': 'The operation successfully completed.', 'MessageArgs': [], '[email protected]': 0, 'MessageId': 'IDRAC.2.1.SYS413', 'RelatedProperties': [], '[email protected]': 0, 'Resolution': 'No response action is required.', 'Severity': 'Informational'}]} | ### Authors * Felix Stephen (@felixs88)
programming_docs
ansible dellemc.openmanage.idrac_lifecycle_controller_jobs – Delete the Lifecycle Controller Jobs dellemc.openmanage.idrac\_lifecycle\_controller\_jobs – Delete the Lifecycle Controller Jobs ============================================================================================ Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.idrac_lifecycle_controller_jobs`. New in version 2.1.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Delete a Lifecycle Controller job using its job ID or delete all jobs. Requirements ------------ The below requirements are needed on the host that executes this module. * omsdk * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **idrac\_ip** string / required | | iDRAC IP Address. | | **idrac\_password** string / required | | iDRAC user password. aliases: idrac\_pwd | | **idrac\_port** integer | **Default:**443 | iDRAC port. | | **idrac\_user** string / required | | iDRAC username. | | **job\_id** string | | Job ID of the specific job to be deleted. All the jobs in the job queue are deleted if this option is not specified. | Notes ----- Note * Run this module from a system that has direct access to DellEMC iDRAC. * This module does not support `check_mode`. Examples -------- ``` --- - name: Delete Lifecycle Controller job queue dellemc.openmanage.idrac_lifecycle_controller_jobs: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_password" idrac_port: 443 - name: Delete Lifecycle Controller job using a job ID dellemc.openmanage.idrac_lifecycle_controller_jobs: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_password" idrac_port: 443 job_id: "JID_801841929470" ``` 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\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'MessageId': 'GEN1234', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **msg** string | always | Status of the delete operation. **Sample:** Successfully deleted the job. | | **status** dictionary | success | Details of the delete operation. **Sample:** {'Message': 'The specified job was deleted', 'MessageID': 'SUP020', 'ReturnValue': '0'} | ### Authors * Felix Stephen (@felixs88) * Anooja Vardhineni (@anooja-vardhineni) ansible dellemc.openmanage.idrac_timezone_ntp – Configures time zone and NTP on iDRAC dellemc.openmanage.idrac\_timezone\_ntp – Configures time zone and NTP on iDRAC =============================================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.idrac_timezone_ntp`. New in version 2.1.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows to configure time zone and NTP on iDRAC. Requirements ------------ The below requirements are needed on the host that executes this module. * omsdk * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **enable\_ntp** string | **Choices:*** Enabled * Disabled | Allows to enable or disable NTP on iDRAC. | | **idrac\_ip** string / required | | iDRAC IP Address. | | **idrac\_password** string / required | | iDRAC user password. aliases: idrac\_pwd | | **idrac\_port** integer | **Default:**443 | iDRAC port. | | **idrac\_user** string / required | | iDRAC username. | | **ntp\_server\_1** string | | The IP address of the NTP server 1. | | **ntp\_server\_2** string | | The IP address of the NTP server 2. | | **ntp\_server\_3** string | | The IP address of the NTP server 3. | | **setup\_idrac\_timezone** string | | Allows to configure time zone on iDRAC. | | **share\_mnt** string | | Local mount path of the network share with read-write permission for ansible user. This option is mandatory for network shares. | | **share\_name** string / required | | Network share or a local path. | | **share\_password** string | | Network share user password. This option is mandatory for CIFS share. aliases: share\_pwd | | **share\_user** string | | Network share user name. Use the format 'user@domain' or 'domain\\user' if user is part of a domain. This option is mandatory for CIFS share. | Notes ----- Note * This module requires ‘Administrator’ privilege for *idrac\_user*. * Run this module from a system that has direct access to Dell EMC iDRAC. * This module supports `check_mode`. Examples -------- ``` --- - name: Configure time zone and NTP on iDRAC dellemc.openmanage.idrac_timezone_ntp: idrac_ip: "190.168.0.1" idrac_user: "user_name" idrac_password: "user_password" share_name: "user_name:/share" share_password: "share_password" share_user: "user_name" share_mnt: "/mnt/share" setup_idrac_timezone: "UTC" enable_ntp: Enabled ntp_server_1: "190.168.0.1" ntp_server_2: "190.168.0.2" ntp_server_3: "190.168.0.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 | | --- | --- | --- | | **error\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'MessageId': 'GEN1234', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **msg** string | always | Overall status of the timezone and ntp configuration. **Sample:** Successfully configured the iDRAC time settings. | | **timezone\_ntp\_status** dictionary | success | Job details of the time zone setting operation. **Sample:** {'@odata.context': '/redfish/v1/$metadata#DellJob.DellJob', '@odata.id': '/redfish/v1/Managers/iDRAC.Embedded.1/Jobs/JID\_861801613971', '@odata.type': '#DellJob.v1\_0\_0.DellJob', 'CompletionTime': '2020-04-06T19:06:01', 'Description': 'Job Instance', 'EndTime': None, 'Id': 'JID\_861801613971', 'JobState': 'Completed', 'JobType': 'ImportConfiguration', 'Message': 'Successfully imported and applied Server Configuration Profile.', 'MessageArgs': [], 'MessageId': 'SYS053', 'Name': 'Import Configuration', 'PercentComplete': 100, 'StartTime': 'TIME\_NOW', 'Status': 'Success', 'TargetSettingsURI': None, 'retval': True} | ### Authors * Felix Stephen (@felixs88) * Anooja Vardhineni (@anooja-vardhineni) ansible dellemc.openmanage.ome_device_group – Add devices to a static device group on OpenManage Enterprise dellemc.openmanage.ome\_device\_group – Add devices to a static device group on OpenManage Enterprise ===================================================================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.ome_device_group`. New in version 3.3.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows to add devices to a static device group on OpenManage Enterprise. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.5 * netaddr >= 0.7.19 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **device\_ids** list / elements=integer | | List of ID(s) of the device(s) to be added to the device group. *device\_ids* is mutually exclusive with *device\_service\_tags* and *ip\_addresses*. | | **device\_service\_tags** list / elements=string | | List of service tag(s) of the device(s) to be added to the device group. *device\_service\_tags* is mutually exclusive with *device\_ids* and *ip\_addresses*. | | **group\_id** integer | | ID of the static device group to which device(s) need to be added. *group\_id* is mutually exclusive with *name*. | | **hostname** string / required | | OpenManage Enterprise IP address or hostname. | | **ip\_addresses** list / elements=string | | List of IPs of the device(s) to be added to the device group. *ip\_addresses* is mutually exclusive with *device\_ids* and *device\_service\_tags*. Supported IP address range formats: - 192.35.0.1 - 10.36.0.0-192.36.0.255 - 192.37.0.0/24 - fe80::ffff:ffff:ffff:ffff - fe80::ffff:192.0.2.0/125 - fe80::ffff:ffff:ffff:1111-fe80::ffff:ffff:ffff:ffff `NOTE` Hostname is not supported. `NOTE` *ip\_addresses* requires python's netaddr packages to work on IP Addresses. `NOTE` This module reports success even if one of the IP addresses provided in the *ip\_addresses* list is available in OpenManage Enterprise.The module reports failure only if none of the IP addresses provided in the list are available in OpenManage Enterprise. | | **name** string | | Name of the static group to which device(s) need to be added. *name* is mutually exclusive with *group\_id*. | | **password** string / required | | OpenManage Enterprise password. | | **port** integer | **Default:**443 | OpenManage Enterprise HTTPS port. | | **state** string | **Choices:*** **present** ← * absent | `present` allows to add the device(s) to a static device group. `absent` currently, this feature is not supported. | | **username** string / required | | OpenManage Enterprise username. | Notes ----- Note * Run this module from a system that has direct access to Dell EMC OpenManage Enterprise. * This module supports `check_mode`. Examples -------- ``` --- - name: Add devices to a static device group by using the group name and device IDs dellemc.openmanage.ome_device_group: hostname: "192.168.0.1" username: "username" password: "password" name: "Storage Services" device_ids: - 11111 - 11112 - 11113 - name: Add devices to a static device group by using the group name and device service tags dellemc.openmanage.ome_device_group: hostname: "192.168.0.1" username: "username" password: "password" name: "Storage Services" device_service_tags: - GHRT2RL - KJHDF3S - LKIJNG6 - name: Add devices to a static device group by using the group ID and device service tags dellemc.openmanage.ome_device_group: hostname: "192.168.0.1" username: "username" password: "password" group_id: 12345 device_service_tags: - GHRT2RL - KJHDF3S - name: Add devices to a static device group by using the group name and IPv4 addresses dellemc.openmanage.ome_device_group: hostname: "192.168.0.1" username: "username" password: "password" name: "Storage Services" ip_addresses: - 192.35.0.1 - 192.35.0.5 - name: Add devices to a static device group by using the group ID and IPv6 addresses dellemc.openmanage.ome_device_group: hostname: "192.168.0.1" username: "username" password: "password" group_id: 12345 ip_addresses: - fe80::ffff:ffff:ffff:ffff - fe80::ffff:ffff:ffff:2222 - name: Add devices to a static device group by using the group ID and supported IPv4 and IPv6 address formats. dellemc.openmanage.ome_device_group: hostname: "192.168.0.1" username: "username" password: "password" group_id: 12345 ip_addresses: - 192.35.0.1 - 10.36.0.0-192.36.0.255 - 192.37.0.0/24 - fe80::ffff:ffff:ffff:ffff - ::ffff:192.0.2.0/125 - fe80::ffff:ffff:ffff:1111-fe80::ffff:ffff:ffff:ffff ``` 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\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'MessageId': 'GEN1234', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **group\_id** integer | success | ID of the group. **Sample:** 21078 | | **ip\_addresses\_added** list / elements=string | success | IP Addresses which are added to the device group. **Sample:** 21078 | | **msg** string | always | Overall status of the device group settings. **Sample:** Successfully added member(s) to the device group. | ### Authors * Felix Stephen (@felixs88) * Sajna Shetty(@Sajna-Shetty) ansible dellemc.openmanage.idrac_os_deployment – Boot to a network ISO image dellemc.openmanage.idrac\_os\_deployment – Boot to a network ISO image ====================================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.idrac_os_deployment`. New in version 2.1.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Boot to a network ISO image. Requirements ------------ The below requirements are needed on the host that executes this module. * omsdk * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **expose\_duration** integer | **Default:**1080 | It is the time taken in minutes for the ISO image file to be exposed as a local CD-ROM device to the host server. When the time expires, the ISO image gets automatically detached. | | **idrac\_ip** string / required | | iDRAC IP Address. | | **idrac\_password** string / required | | iDRAC user password. aliases: idrac\_pwd | | **idrac\_port** integer | **Default:**443 | iDRAC port. | | **idrac\_user** string / required | | iDRAC username. | | **iso\_image** string / required | | Network ISO name. | | **share\_name** string / required | | CIFS or NFS Network share. | | **share\_password** string | | Network share user password. This option is mandatory for CIFS Network Share. aliases: share\_pwd | | **share\_user** string | | Network share user in the format 'user@domain' or 'domain\\user' if user is part of a domain else 'user'. This option is mandatory for CIFS Network Share. | Notes ----- Note * Run this module from a system that has direct access to DellEMC iDRAC. * This module does not support `check_mode`. Examples -------- ``` --- - name: Boot to Network ISO dellemc.openmanage.idrac_os_deployment: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_password" share_name: "192.168.0.0:/nfsfileshare" iso_image: "unattended_os_image.iso" expose_duration: 180 ``` 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 | | --- | --- | --- | | **boot\_status** dictionary | always | Details of the boot to network ISO image operation. **Sample:** {'DeleteOnCompletion': 'false', 'InstanceID': 'DCIM\_OSDConcreteJob:1', 'JobName': 'BootToNetworkISO', 'JobStatus': 'Success', 'Message': 'The command was successful.', 'MessageID': 'OSD1', 'Name': 'BootToNetworkISO', 'Status': 'Success', 'file': '192.168.0.0:/nfsfileshare/unattended\_os\_image.iso', 'retval': True} | | **msg** string | on error | Over all device information status. **Sample:** Failed to boot to network iso | ### Authors * Felix Stephen (@felixs88) * Jagadeesh N V (@jagadeeshnv) ansible dellemc.openmanage.ome_firmware_baseline_compliance_info – Retrieves baseline compliance details on OpenManage Enterprise dellemc.openmanage.ome\_firmware\_baseline\_compliance\_info – Retrieves baseline compliance details on OpenManage Enterprise ============================================================================================================================= Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.ome_firmware_baseline_compliance_info`. New in version 2.0.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows to retrieve firmware compliance for a list of devices, or against a specified baseline on OpenManage Enterprise. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **baseline\_name** string | | Name of the baseline, for which the device compliance report is generated. This option is mandatory for generating baseline based device compliance report. *baseline\_name* is mutually exclusive with *device\_ids*, *device\_service\_tags* and *device\_group\_names*. | | **device\_group\_names** list / elements=string | | A list of group names for device based compliance report. Either *device\_ids*, *device\_service\_tags* or *device\_group\_names* is required to generate device based compliance report. *device\_group\_names* is mutually exclusive with *device\_ids*, *device\_service\_tags* and *baseline\_name*. Devices without reports are ignored. | | **device\_ids** list / elements=integer | | A list of unique identifier for device based compliance report. Either *device\_ids*, *device\_service\_tags* or *device\_group\_names* is required to generate device based compliance report. *device\_ids* is mutually exclusive with *device\_service\_tags*, *device\_group\_names* and *baseline\_name*. Devices without reports are ignored. | | **device\_service\_tags** list / elements=string | | A list of service tags for device based compliance report. Either *device\_ids*, *device\_service\_tags* or *device\_group\_names* is required to generate device based compliance report. *device\_service\_tags* is mutually exclusive with *device\_ids*, *device\_group\_names* and *baseline\_name*. Devices without reports are ignored. | | **hostname** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular IP address or hostname. | | **password** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular password. | | **port** integer | **Default:**443 | OpenManage Enterprise or OpenManage Enterprise Modular HTTPS port. | | **username** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular username. | Notes ----- Note * Run this module from a system that has direct access to DellEMC OpenManage Enterprise. * This module supports `check_mode`. Examples -------- ``` --- - name: Retrieves device based compliance report for specified device IDs dellemc.openmanage.ome_firmware_baseline_compliance_info: hostname: "192.168.0.1" username: "username" password: "password" device_ids: - 11111 - 22222 - name: Retrieves device based compliance report for specified service Tags dellemc.openmanage.ome_firmware_baseline_compliance_info: hostname: "192.168.0.1" username: "username" password: "password" device_service_tags: - MXL1234 - MXL4567 - name: Retrieves device based compliance report for specified group names dellemc.openmanage.ome_firmware_baseline_compliance_info: hostname: "192.168.0.1" username: "username" password: "password" device_group_names: - "group1" - "group2" - name: Retrieves device compliance report for a specified baseline dellemc.openmanage.ome_firmware_baseline_compliance_info: hostname: "192.168.0.1" username: "username" password: "password" baseline_name: "baseline_name" ``` 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 | | --- | --- | --- | | **baseline\_compliance\_info** dictionary | success | Details of the baseline compliance report. **Sample:** [{'CatalogId': 53, 'ComplianceSummary': {'ComplianceStatus': 'CRITICAL', 'NumberOfCritical': 2, 'NumberOfDowngrade': 0, 'NumberOfNormal': 0, 'NumberOfWarning': 0}, 'Description': '', 'DeviceComplianceReports': [{'ComplianceStatus': 'CRITICAL', 'ComponentComplianceReports': [{'ComplianceDependencies': [], 'ComplianceStatus': 'DOWNGRADE', 'Criticality': 'Ok', 'CurrentVersion': 'OSC\_1.1', 'Id': 1258, 'ImpactAssessment': '', 'Name': 'OS COLLECTOR 2.1', 'Path': 'FOLDER04118304M/2/Diagnostics\_Application\_JCCH7\_WN64\_4.0\_A00\_01.EXE', 'PrerequisiteInfo': '', 'RebootRequired': False, 'SourceName': 'DCIM:INSTALLED#802\_\_OSCollector.Embedded.1', 'TargetIdentifier': '101734', 'UniqueIdentifier': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'UpdateAction': 'DOWNGRADE', 'Uri': 'http://www.dell.com/support/home/us/en/19/Drivers/DriversDetails?driverId=XXXXX', 'Version': '4.0'}, {'ComplianceDependencies': [], 'ComplianceStatus': 'CRITICAL', 'Criticality': 'Recommended', 'CurrentVersion': 'DN02', 'Id': 1259, 'ImpactAssessment': '', 'Name': 'TOSHIBA AL14SE 1.8 TB 2.5 12Gb 10K 512n SAS HDD Drive', 'Path': 'FOLDER04086111M/1/SAS-Drive\_Firmware\_VDGFM\_WN64\_DN03\_A00.EXE', 'PrerequisiteInfo': '', 'RebootRequired': True, 'SourceName': 'DCIM:INSTALLED#304\_C\_Disk.Bay.1:Enclosure.Internal.0-1:RAID.Integrated.1-1', 'TargetIdentifier': '103730', 'UniqueIdentifier': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'UpdateAction': 'UPGRADE', 'Uri': 'http://www.dell.com/support/home/us/en/19/Drivers/DriversDetails?driverId=XXXXX', 'Version': 'DN03'}], 'DeviceId': 11603, 'DeviceModel': 'PowerEdge R630', 'DeviceName': None, 'DeviceTypeId': 1000, 'DeviceTypeName': 'CPGCGS', 'FirmwareStatus': 'Non-Compliant', 'Id': 194, 'RebootRequired': True, 'ServiceTag': 'MXL1234'}], 'DowngradeEnabled': True, 'Id': 53, 'Is64Bit': False, 'LastRun': '2019-09-27 05:08:16.301', 'Name': 'baseline1', 'RepositoryId': 43, 'RepositoryName': 'catalog2', 'RepositoryType': 'CIFS', 'Targets': [{'Id': 11603, 'Type': {'Id': 1000, 'Name': 'DEVICE'}}], 'TaskId': 11710, 'TaskStatusId': 0}] | | **error\_info** dictionary | on http error | Details of http error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to retrieve baseline list either because the device ID(s) entered are invalid', 'Resolution': 'Make sure the entered device ID(s) are valid and retry the operation.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **msg** string | on error | Overall baseline compliance report status. **Sample:** Failed to fetch the compliance baseline information. | ### Authors * Sajna Shetty(@Sajna-Shetty)
programming_docs
ansible dellemc.openmanage.ome_configuration_compliance_baseline – Create, modify, and delete a configuration compliance baseline and remediate non-compliant devices on OpenManage Enterprise dellemc.openmanage.ome\_configuration\_compliance\_baseline – Create, modify, and delete a configuration compliance baseline and remediate non-compliant devices on OpenManage Enterprise ========================================================================================================================================================================================= Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.ome_configuration_compliance_baseline`. New in version 3.2.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows to create, modify, and delete a configuration compliance baseline on OpenManage Enterprise. This module also allows to remediate devices that are non-compliant with the baseline by changing the attributes of devices to match with the associated baseline attributes. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **command** string | **Choices:*** **create** ← * modify * delete * remediate | `create` creates a configuration baseline from an existing compliance template.`create` supports `check_mode` or idempotency checking for only *names*. `modify` modifies an existing baseline.Only *names*, *description*, *device\_ids*, *device\_service\_tags*, and *device\_group\_names* can be modified *WARNING* When a baseline is modified, the provided *device\_ids*, *device\_group\_names*, and *device\_service\_tags* replaces the devices previously present in the baseline. `delete` deletes the list of configuration compliance baselines based on the baseline name. Invalid baseline names are ignored. `remediate` remediates devices that are non-compliant with the baseline by changing the attributes of devices to match with the associated baseline attributes. `remediate` is performed on all the non-compliant devices if either *device\_ids*, or *device\_service\_tags* is not provided. | | **description** string | | Description of the compliance baseline. This option is applicable when *command* is `create`, or `modify`. | | **device\_group\_names** list / elements=string | | Name of the target device group. This option is applicable when *command* is `create`, or `modify` and is mutually exclusive with *device\_ids* and *device\_service\_tag*. | | **device\_ids** list / elements=integer | | IDs of the target devices. This option is applicable when *command* is `create`, `modify`, or `remediate`, and is mutually exclusive with *device\_service\_tag* and *device\_group\_names*. | | **device\_service\_tags** list / elements=string | | Service tag of the target device. This option is applicable when *command* is `create`, `modify`, or `remediate` and is mutually exclusive with *device\_ids* and *device\_group\_names*. | | **hostname** string / required | | OpenManage Enterprise IP address or hostname. | | **job\_wait** boolean | **Choices:*** no * **yes** ← | Provides the option to wait for job completion. This option is applicable when *command* is `create`, `modify`, or `remediate`. | | **job\_wait\_timeout** integer | **Default:**10800 | The maximum wait time of *job\_wait* in seconds.The job will only be tracked for this duration. This option is applicable when *job\_wait* is `True`. | | **names** list / elements=string / required | | Name(s) of the configuration compliance baseline. This option is applicable when *command* is `create`, `modify`, or `delete`. Provide the list of configuration compliance baselines names that are supported when *command* is `delete`. | | **new\_name** string | | New name of the compliance baseline to be modified. This option is applicable when *command* is `modify`. | | **password** string / required | | OpenManage Enterprise password. | | **port** integer | **Default:**443 | OpenManage Enterprise HTTPS port. | | **template\_id** integer | | ID of the deployment template to be used for creating a compliance baseline. This option is applicable when *command* is `create` and is mutually exclusive with *template\_name*. | | **template\_name** string | | Name of the compliance template for creating the compliance baseline(s). Name of the deployment template to be used for creating a compliance baseline. This option is applicable when *command* is `create` and is mutually exclusive with *template\_id*. | | **username** string / required | | OpenManage Enterprise username. | Notes ----- Note * This module supports `check_mode`. * Ensure that the devices have the required licenses to perform the baseline compliance operations. Examples -------- ``` --- - name: Create a configuration compliance baseline using device IDs dellemc.openmanage.ome_configuration_compliance_baseline: hostname: "192.168.0.1" username: "username" password: "password" names: "baseline1" template_name: "template1" description: "description of baseline" device_ids: - 1111 - 2222 - name: Create a configuration compliance baseline using device service tags dellemc.openmanage.ome_configuration_compliance_baseline: hostname: "192.168.0.1" username: "username" password: "password" names: "baseline1" template_id: 1234 description: "description of baseline" device_service_tags: - "SVCTAG1" - "SVCTAG2" - name: Create a configuration compliance baseline using group names dellemc.openmanage.ome_configuration_compliance_baseline: hostname: "192.168.0.1" username: "username" password: "password" names: "baseline2" template_id: 2 job_wait_timeout: 1000 description: "description of baseline" device_group_names: - "Group1" - "Group2" - name: Delete the configuration compliance baselines dellemc.openmanage.ome_configuration_compliance_baseline: hostname: "192.168.0.1" username: "username" password: "password" command: delete names: - baseline1 - baseline2 - name: Modify a configuration compliance baseline using group names dellemc.openmanage.ome_configuration_compliance_baseline: hostname: "192.168.0.1" username: "username" password: "password" command: modify names: "baseline1" new_name: "baseline_update" template_name: "template2" description: "new description of baseline" job_wait_timeout: 1000 device_group_names: - Group1 - name: Remediate specific non-compliant devices to a configuration compliance baseline using device IDs dellemc.openmanage.ome_configuration_compliance_baseline: hostname: "192.168.0.1" username: "username" password: "password" command: "remediate" names: "baseline1" device_ids: - 1111 - name: Remediate specific non-compliant devices to a configuration compliance baseline using device service tags dellemc.openmanage.ome_configuration_compliance_baseline: hostname: "192.168.0.1" username: "username" password: "password" command: "remediate" names: "baseline1" device_service_tags: - "SVCTAG1" - "SVCTAG2" - name: Remediate all the non-compliant devices to a configuration compliance baseline dellemc.openmanage.ome_configuration_compliance_baseline: hostname: "192.168.0.1" username: "username" password: "password" command: "remediate" names: "baseline1" ``` 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 | | --- | --- | --- | | **compliance\_status** dictionary | when *command* is `create` or `modify` | Status of compliance baseline operation. **Sample:** {'BaselineTargets': [{'Id': 1111, 'Type': {'Id': 1000, 'Name': 'DEVICE'}}], 'ConfigComplianceSummary': {'ComplianceStatus': 'OK', 'NumberOfCritical': 0, 'NumberOfIncomplete': 0, 'NumberOfNormal': 0, 'NumberOfWarning': 0}, 'Description': None, 'Id': 13, 'LastRun': '2021-02-27 13:15:13.751', 'Name': 'baseline1', 'PercentageComplete': '100', 'TaskId': 26584, 'TaskStatus': 2070, 'TemplateId': 102, 'TemplateName': 'one', 'TemplateType': 2} | | **error\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'MessageId': 'GEN1234', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **incompatible\_devices** list / elements=string | when *device\_service\_tags* or *device\_ids* contains incompatible devices for `create` or `modify` | Details of the devices which cannot be used to perform baseline compliance operations **Sample:** [1234, 5678] | | **job\_id** integer | when *command* is `remediate` | Task ID created when *command* is `remediate`. **Sample:** 14123 | | **msg** string | always | Overall status of the configuration compliance baseline operation. **Sample:** Successfully created the configuration compliance baseline. | ### Authors * Sajna Shetty(@Sajna-Shetty) ansible dellemc.openmanage.idrac_bios – Configure the BIOS attributes dellemc.openmanage.idrac\_bios – Configure the BIOS attributes ============================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.idrac_bios`. New in version 2.1.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows to configure the BIOS attributes. Requirements ------------ The below requirements are needed on the host that executes this module. * omsdk * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **attributes** dictionary | | Dictionary of BIOS attributes and value pair. Attributes should be part of the Redfish Dell BIOS Attribute Registry. Use [https://idrac\_ip/redfish/v1/Systems/System.Embedded.1/Bios](#) to view the Redfish URI. If deprecated options are provided and the same is repeated in *attributes* then values in *attributes* will take precedence. *attributes* is mutually exclusive with *boot\_sources*. | | **boot\_mode** string | **Choices:*** Bios * Uefi | (deprecated)Sets boot mode to BIOS or UEFI. This option is deprecated, and will be removed in later version. Use *attributes* for configuring the BIOS attributes. *boot\_mode* is mutually exclusive with *boot\_sources*. | | **boot\_sequence** string | | (deprecated)Allows to set the boot sequence in BIOS boot mode or Secure UEFI boot mode by rearranging the boot entries in Fully Qualified Device Descriptor (FQDD). TThis option is deprecated, and will be removed in later version. Use *attributes* for configuring the BIOS attributes. *boot\_sequence* is mutually exclusive with *boot\_sources*. | | **boot\_sources** list / elements=raw | | List of boot devices to set the boot sources settings. *boot\_sources* is mutually exclusive with *attributes*, *boot\_sequence*, *onetime\_boot\_mode*, *secure\_boot\_mode*, *nvme\_mode*, *boot\_mode*. | | **idrac\_ip** string / required | | iDRAC IP Address. | | **idrac\_password** string / required | | iDRAC user password. aliases: idrac\_pwd | | **idrac\_port** integer | **Default:**443 | iDRAC port. | | **idrac\_user** string / required | | iDRAC username. | | **nvme\_mode** string | **Choices:*** NonRaid * Raid | (deprecated)Configures the NVME mode in the iDRAC 9 based PowerEdge Servers. This option is deprecated, and will be removed in later version. Use *attributes* for configuring the BIOS attributes. *nvme\_mode* is mutually exclusive with *boot\_sources*. | | **onetime\_boot\_mode** string | **Choices:*** Disabled * OneTimeBootSeq * OneTimeCustomBootSeqStr * OneTimeCustomHddSeqStr * OneTimeCustomUefiBootSeqStr * OneTimeHddSeq * OneTimeUefiBootSeq | (deprecated)Configures the one time boot mode setting. This option is deprecated, and will be removed in later version. Use *attributes* for configuring the BIOS attributes. *onetime\_boot\_mode* is mutually exclusive with *boot\_sources*. | | **secure\_boot\_mode** string | **Choices:*** AuditMode * DeployedMode * SetupMode * UserMode | (deprecated)Configures how the BIOS uses the Secure Boot Policy Objects in iDRAC 9 based PowerEdge Servers. This option is deprecated, and will be removed in later version. Use *attributes* for configuring the BIOS attributes. *secure\_boot\_mode* is mutually exclusive with *boot\_sources*. | | **share\_mnt** string | | Local mount path of the network share with read-write permission for ansible user. This option is mandatory for network shares. | | **share\_name** string | | Network share or a local path. | | **share\_password** string | | Network share user password. This option is mandatory for CIFS share. aliases: share\_pwd | | **share\_user** string | | Network share user name. Use the format 'user@domain' or 'domain\user' if user is part of a domain. This option is mandatory for CIFS share. | Notes ----- Note * This module requires ‘Administrator’ privilege for *idrac\_user*. * Run this module from a system that has direct access to DellEMC iDRAC. * This module supports `check_mode`. Examples -------- ``` --- - name: Configure generic attributes of the BIOS dellemc.openmanage.idrac_bios: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_password" attributes: BootMode : "Bios" OneTimeBootMode: "Enabled" BootSeqRetry: "Enabled" - name: Configure PXE generic attributes dellemc.openmanage.idrac_bios: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_password" attributes: PxeDev1EnDis: "Enabled" PxeDev1Protocol: "IPV4" PxeDev1VlanEnDis: "Enabled" PxeDev1VlanId: 1 PxeDev1Interface: "NIC.Embedded.1-1-1" PxeDev1VlanPriority: 2 - name: Configure boot sources dellemc.openmanage.idrac_bios: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_password" boot_sources: - Name : "NIC.Integrated.1-2-3" Enabled : true Index : 0 - name: Configure multiple boot sources dellemc.openmanage.idrac_bios: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_password" boot_sources: - Name : "NIC.Integrated.1-1-1" Enabled : true Index : 0 - Name : "NIC.Integrated.2-2-2" Enabled : true Index : 1 - Name : "NIC.Integrated.3-3-3" Enabled : true Index : 2 - name: Configure boot sources - Enabling dellemc.openmanage.idrac_bios: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_password" boot_sources: - Name : "NIC.Integrated.1-1-1" Enabled : true - name: Configure boot sources - Index dellemc.openmanage.idrac_bios: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_password" boot_sources: - Name : "NIC.Integrated.1-1-1" Index : 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 | | --- | --- | --- | | **error\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'MessageId': 'GEN1234', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **msg** dictionary | success | Configures the BIOS configuration attributes. **Sample:** {'@odata.context': '/redfish/v1/$metadata#DellJob.DellJob', '@odata.id': '/redfish/v1/Managers/iDRAC.Embedded.1/Jobs/JID\_873888162305', '@odata.type': '#DellJob.v1\_0\_0.DellJob', 'CompletionTime': '2020-04-20T18:50:20', 'Description': 'Job Instance', 'EndTime': None, 'Id': 'JID\_873888162305', 'JobState': 'Completed', 'JobType': 'ImportConfiguration', 'Message': 'Successfully imported and applied Server Configuration Profile.', 'MessageArgs': [], 'MessageId': 'SYS053', 'Name': 'Import Configuration', 'PercentComplete': 100, 'StartTime': 'TIME\_NOW', 'Status': 'Success', 'TargetSettingsURI': None, 'retval': True} | ### Authors * Felix Stephen (@felixs88) * Anooja Vardhineni (@anooja-vardhineni) ansible dellemc.openmanage.ome_identity_pool – Manages identity pool settings on OpenManage Enterprise dellemc.openmanage.ome\_identity\_pool – Manages identity pool settings on OpenManage Enterprise ================================================================================================ Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.ome_identity_pool`. New in version 2.1.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows to create, modify, or delete a single identity pool on OpenManage Enterprise. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ethernet\_settings** dictionary | | Applicable for creating and modifying an identity pool using Ethernet settings. *starting\_mac\_address* and *identity\_count* are required to create an identity pool. | | | **identity\_count** integer | | Number of MAC addresses. | | | **starting\_mac\_address** string | | Starting MAC address of the ethernet setting. | | **fc\_settings** dictionary | | Applicable for creating and modifying an identity pool using fibre channel(FC) settings. This option allows OpenManage Enterprise to generate a Worldwide port name (WWPN) and Worldwide node name (WWNN) address. The value 0x2001 is beginning to the starting address for the generation of a WWPN, and 0x2000 for a WWNN. *starting\_address* and *identity\_count* are required to create an identity pool. | | | **identity\_count** integer | | Number of MAC addresses.*identity\_count* is required to option to create FC settings. | | | **starting\_address** string | | Starting MAC Address of FC setting.*starting\_address* is required to option to create FC settings. | | **fcoe\_settings** dictionary | | Applicable for creating and modifying an identity pool using FCoE settings. *starting\_mac\_address* and *identity\_count* are required to create an identity pool. | | | **identity\_count** integer | | Number of MAC addresses. | | | **starting\_mac\_address** string | | Starting MAC Address of the FCoE setting. | | **hostname** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular IP address or hostname. | | **iscsi\_settings** dictionary | | Applicable for creating and modifying an identity pool using ISCSI settings. *starting\_mac\_address*, *identity\_count*, *iqn\_prefix*, *ip\_range* and *subnet\_mask* are required to create an identity pool. | | | **identity\_count** integer | | Number of MAC addresses. | | | **initiator\_config** dictionary | | Applicable for creating and modifying an identity pool using iSCSI Initiator settings. | | | | **iqn\_prefix** string | | IQN prefix addresses. | | | **initiator\_ip\_pool\_settings** dictionary | | Applicable for creating and modifying an identity pool using ISCSI Initiator IP pool settings. | | | | **gateway** string | | IP address of gateway. | | | | **ip\_range** string | | Range of non-multicast IP addresses. | | | | **primary\_dns\_server** string | | IP address of the primary DNS server. | | | | **secondary\_dns\_server** string | | IP address of the secondary DNS server. | | | | **subnet\_mask** string | | Subnet mask for *ip\_range*. | | | **starting\_mac\_address** string | | Starting MAC address of the iSCSI setting.This is required option for iSCSI setting. | | **new\_pool\_name** string | | After creating an identity pool, *pool\_name* can be changed to *new\_pool\_name*. This option is ignored when creating an identity pool. | | **password** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular password. | | **pool\_description** string | | Description of the identity pool. | | **pool\_name** string / required | | This option is mandatory for *state* when creating, modifying and deleting an identity pool. | | **port** integer | **Default:**443 | OpenManage Enterprise or OpenManage Enterprise Modular HTTPS port. | | **state** string | **Choices:*** **present** ← * absent | `present` modifies an existing identity pool. If the provided I (pool\_name) does not exist, it creates an identity pool. - `absent` deletes an existing identity pool. | | **username** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular username. | Notes ----- Note * Run this module from a system that has direct access to DellEMC OpenManage Enterprise. * This module does not support `check_mode`. Examples -------- ``` --- - name: Create an identity pool using ethernet, FCoE, iSCSI and FC settings dellemc.openmanage.ome_identity_pool: hostname: "192.168.0.1" username: "username" password: "password" state: present pool_name: "pool1" pool_description: "Identity pool with Ethernet, FCoE, iSCSI and FC settings" ethernet_settings: starting_mac_address: "50:50:50:50:50:00" identity_count: 60 fcoe_settings: starting_mac_address: "70:70:70:70:70:00" identity_count: 75 iscsi_settings: starting_mac_address: "60:60:60:60:60:00" identity_count: 30 initiator_config: iqn_prefix: "iqn.myprefix." initiator_ip_pool_settings: ip_range: "10.33.0.1-10.33.0.255" subnet_mask: "255.255.255.0" gateway: "192.168.4.1" primary_dns_server : "10.8.8.8" secondary_dns_server : "8.8.8.8" fc_settings: starting_address: "30:30:30:30:30:00" identity_count: 45 - name: Create an identity pool using only ethernet settings dellemc.openmanage.ome_identity_pool: hostname: "192.168.0.1" username: "username" password: "password" pool_name: "pool2" pool_description: "create identity pool with ethernet" ethernet_settings: starting_mac_address: "aa-bb-cc-dd-ee-aa" identity_count: 80 - name: Modify an identity pool dellemc.openmanage.ome_identity_pool: hostname: "192.168.0.1" username: "username" password: "password" pool_name: "pool2" new_pool_name: "pool3" pool_description: "modifying identity pool with ethernet and fcoe settings" ethernet_settings: starting_mac_address: "90-90-90-90-90-90" identity_count: 61 fcoe_settings: starting_mac_address: "aabb.ccdd.5050" identity_count: 77 - name: Modify an identity pool using iSCSI and FC settings dellemc.openmanage.ome_identity_pool: hostname: "{{hostname}}" username: "{{username}}" password: "{{password}}" pool_name: "pool_new" new_pool_name: "pool_new2" pool_description: "modifying identity pool with iscsi and fc settings" iscsi_settings: identity_count: 99 initiator_config: iqn_prefix: "iqn1.myprefix2." initiator_ip_pool_settings: gateway: "192.168.4.5" fc_settings: starting_address: "10:10:10:10:10:10" identity_count: 98 - name: Delete an identity pool dellemc.openmanage.ome_identity_pool: hostname: "192.168.0.1" username: "username" password: "password" state: "absent" pool_name: "pool2" ``` 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\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred: Ethernet-MAC Range overlap found (in this Identity Pool or in a different one) .', 'MessageArgs': ['Ethernet-MAC Range overlap found (in this Identity Pool or in a different one)"'], 'MessageId': 'CGEN6001', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **msg** string | always | Overall status of the identity pool operation. **Sample:** Successfully created an identity pool. | | **pool\_status** dictionary | success | Details of the user operation, when *state* is `present`. **Sample:** {'Id': 29, 'IsSuccessful': True, 'Issues': []} | ### Authors * Sajna Shetty(@Sajna-Shetty) * Deepak Joshi(@Dell-Deepak-Joshi))
programming_docs
ansible dellemc.openmanage.redfish_storage_volume – Manages the storage volume configuration dellemc.openmanage.redfish\_storage\_volume – Manages the storage volume configuration ====================================================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.redfish_storage_volume`. New in version 2.1.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows to create, modify, initialize, or delete a single storage volume. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **baseuri** string / required | | IP address of the target out-of-band controller. For example- <ipaddress>:<port>. | | **block\_size\_bytes** integer | | Block size in bytes.Only applicable when *state* is `present`. | | **capacity\_bytes** string | | Volume size in bytes. Only applicable when *state* is `present`. | | **command** string | **Choices:*** initialize | `initialize` initializes an existing storage volume for a specified *volume\_id*. | | **controller\_id** string | | Fully Qualified Device Descriptor (FQDD) of the storage controller. For example- RAID.Slot.1-1. This option is mandatory when *state* is `present` while creating a volume. | | **drives** list / elements=string | | FQDD of the Physical disks. For example- Disk.Bay.0:Enclosure.Internal.0-1:RAID.Slot.1-1. Only applicable when *state* is `present` when creating a new volume. | | **encrypted** boolean | **Choices:*** no * yes | Indicates whether volume is currently utilizing encryption or not. Only applicable when *state* is `present`. | | **encryption\_types** string | **Choices:*** NativeDriveEncryption * ControllerAssisted * SoftwareAssisted | The following encryption types can be selected. `ControllerAssisted` The volume is encrypted by the storage controller entity. `NativeDriveEncryption` The volume utilizes the native drive encryption capabilities of the drive hardware. `SoftwareAssisted` The volume is encrypted by the software running on the system or the operating system. Only applicable when *state* is `present`. | | **initialize\_type** string | **Choices:*** **Fast** ← * Slow | Initialization type of existing volume. Only applicable when *command* is `initialize`. | | **name** string | | Name of the volume to be created. Only applicable when *state* is `present`. | | **oem** dictionary | | Includes OEM extended payloads. Only applicable when *state* is *present*. | | **optimum\_io\_size\_bytes** integer | | Stripe size value must be in multiples of 64 \* 1024. Only applicable when *state* is `present`. | | **password** string / required | | Password of the target out-of-band controller. | | **state** string | **Choices:*** present * absent | `present` creates a storage volume for the specified I (controller\_id), or modifies the storage volume for the specified I (volume\_id). "Note: Modification of an existing volume properties depends on drive and controller capabilities". `absent` deletes the volume for the specified *volume\_id*. | | **username** string / required | | Username of the target out-of-band controller. | | **volume\_id** string | | FQDD of existing volume. For example- Disk.Virtual.4:RAID.Slot.1-1. This option is mandatory in the following scenarios, *state* is `present`, when updating a volume. *state* is `absent`, when deleting a volume. *command* is `initialize`, when initializing a volume. | | **volume\_type** string | **Choices:*** NonRedundant * Mirrored * StripedWithParity * SpannedMirrors * SpannedStripesWithParity | One of the following volume types must be selected to create a volume. `Mirrored` The volume is a mirrored device. `NonRedundant` The volume is a non-redundant storage device. `SpannedMirrors` The volume is a spanned set of mirrored devices. `SpannedStripesWithParity` The volume is a spanned set of devices which uses parity to retain redundant information. `StripedWithParity` The volume is a device which uses parity to retain redundant information. | Notes ----- Note * Run this module from a system that has direct access to Redfish APIs. * This module does not support `check_mode`. Examples -------- ``` --- - name: Create a volume with supported options dellemc.openmanage.redfish_storage_volume: baseuri: "192.168.0.1" username: "username" password: "password" state: "present" volume_type: "Mirrored" name: "VD0" controller_id: "RAID.Slot.1-1" drives: - Disk.Bay.5:Enclosure.Internal.0-1:RAID.Slot.1-1 - Disk.Bay.6:Enclosure.Internal.0-1:RAID.Slot.1-1 block_size_bytes: 512 capacity_bytes: 299439751168 optimum_io_size_bytes: 65536 encryption_types: NativeDriveEncryption encrypted: true - name: Create a volume with minimum options dellemc.openmanage.redfish_storage_volume: baseuri: "192.168.0.1" username: "username" password: "password" state: "present" controller_id: "RAID.Slot.1-1" volume_type: "NonRedundant" drives: - Disk.Bay.1:Enclosure.Internal.0-1:RAID.Slot.1-1 - name: Modify a volume's encryption type settings dellemc.openmanage.redfish_storage_volume: baseuri: "192.168.0.1" username: "username" password: "password" state: "present" volume_id: "Disk.Virtual.5:RAID.Slot.1-1" encryption_types: "ControllerAssisted" encrypted: true - name: Delete an existing volume dellemc.openmanage.redfish_storage_volume: baseuri: "192.168.0.1" username: "username" password: "password" state: "absent" volume_id: "Disk.Virtual.5:RAID.Slot.1-1" - name: Initialize an existing volume dellemc.openmanage.redfish_storage_volume: baseuri: "192.168.0.1" username: "username" password: "password" command: "initialize" volume_id: "Disk.Virtual.6:RAID.Slot.1-1" initialize_type: "Slow" ``` 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\_info** dictionary | on http error | Details of a http error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to perform configuration operations because a configuration job for the device already exists.', 'MessageArgs': [], '[email protected]': 0, 'MessageId': 'IDRAC.1.6.STOR023', 'RelatedProperties': [], '[email protected]': 0, 'Resolution': 'Wait for the current job for the device to complete or cancel the current job before attempting more configuration operations on the device.', 'Severity': 'Informational'}], 'code': 'Base.1.2.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information'}} | | **msg** string | always | Overall status of the storage configuration operation. **Sample:** Successfully submitted create volume task. | | **task** dictionary | success | Returns ID and URI of the created task. **Sample:** {'id': 'JID\_XXXXXXXXXXXXX', 'uri': '/redfish/v1/TaskService/Tasks/JID\_XXXXXXXXXXXXX'} | ### Authors * Sajna Shetty(@Sajna-Shetty) ansible dellemc.openmanage.idrac_server_config_profile – Export or Import iDRAC Server Configuration Profile (SCP) dellemc.openmanage.idrac\_server\_config\_profile – Export or Import iDRAC Server Configuration Profile (SCP) ============================================================================================================= Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.idrac_server_config_profile`. New in version 2.1.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Export the Server Configuration Profile (SCP) from the iDRAC or import from a network share (CIFS, NFS, HTTP, HTTPS) or a local file. Requirements ------------ The below requirements are needed on the host that executes this module. * omsdk * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **command** string | **Choices:*** import * **export** ← | If `import`, will perform SCP import operations. If `export`, will perform SCP export operations. | | **end\_host\_power\_state** string | **Choices:*** **On** ← * Off | This option is applicable for `import` command. If `On`, End host power state is on. If `Off`, End host power state is off. | | **export\_format** string | **Choices:*** JSON * **XML** ← | Specify the output file format. This option is applicable for `export` command. | | **export\_use** string | **Choices:*** **Default** ← * Clone * Replace | Specify the type of server configuration profile (SCP) to be exported. This option is applicable for `export` command. | | **idrac\_ip** string / required | | iDRAC IP Address. | | **idrac\_password** string / required | | iDRAC user password. aliases: idrac\_pwd | | **idrac\_port** integer | **Default:**443 | iDRAC port. | | **idrac\_user** string / required | | iDRAC username. | | **job\_wait** boolean / required | **Choices:*** no * yes | Whether to wait for job completion or not. | | **scp\_components** string | **Choices:*** **ALL** ← * IDRAC * BIOS * NIC * RAID | If `ALL`, this module exports or imports all components configurations from SCP file. If `IDRAC`, this module exports or imports iDRAC configuration from SCP file. If `BIOS`, this module exports or imports BIOS configuration from SCP file. If `NIC`, this module exports or imports NIC configuration from SCP file. If `RAID`, this module exports or imports RAID configuration from SCP file. | | **scp\_file** string | | Name of the server configuration profile (SCP) file. This option is mandatory if *command* is `import`. The default format <idrac\_ip>\_YYmmdd\_HHMMSS\_scp is used if this option is not specified for `import`. *export\_format* is used if the valid extension file is not provided for `import`. | | **share\_name** string / required | | Network share or local path. CIFS, NFS, HTTP, and HTTPS network share types are supported. OMSDK is not required if HTTP or HTTPS location is used for *share\_name*. | | **share\_password** string | | Network share user password. This option is mandatory for CIFS Network Share. aliases: share\_pwd | | **share\_user** string | | Network share user in the format 'user@domain' or 'domain\\user' if user is part of a domain else 'user'. This option is mandatory for CIFS Network Share. | | **shutdown\_type** string | **Choices:*** **Graceful** ← * Forced * NoReboot | This option is applicable for `import` command. If `Graceful`, it gracefully shuts down the server. If `Forced`, it forcefully shuts down the server. If `NoReboot`, it does not reboot the server. | Notes ----- Note * This module requires ‘Administrator’ privilege for *idrac\_user*. * Run this module from a system that has direct access to Dell EMC iDRAC. * This module does not support `check_mode`. Examples -------- ``` --- - name: Export SCP with IDRAC components in JSON format to a local path dellemc.openmanage.idrac_server_config_profile: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_password" share_name: "/scp_folder" scp_components: IDRAC scp_file: example_file export_format: JSON export_use: Clone job_wait: True - name: Import SCP with IDRAC components in JSON format from a local path dellemc.openmanage.idrac_server_config_profile: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_password" share_name: "/scp_folder" command: import scp_components: "IDRAC" scp_file: example_file.json shutdown_type: Graceful end_host_power_state: "On" job_wait: False - name: Export SCP with BIOS components in XML format to a NFS share path with auto-generated file name dellemc.openmanage.idrac_server_config_profile: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_password" share_name: "192.168.0.2:/share" scp_components: "BIOS" export_format: XML export_use: Default job_wait: True - name: Import SCP with BIOS components in XML format from a NFS share path dellemc.openmanage.idrac_server_config_profile: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_password" share_name: "192.168.0.2:/share" command: import scp_components: "BIOS" scp_file: 192.168.0.1_20210618_162856.xml shutdown_type: NoReboot end_host_power_state: "Off" job_wait: False - name: Export SCP with RAID components in XML format to a CIFS share path with share user domain name dellemc.openmanage.idrac_server_config_profile: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_password" share_name: "\\\\192.168.0.2\\share" share_user: share_username@domain share_password: share_password share_mnt: /mnt/cifs scp_file: example_file.xml scp_components: "RAID" export_format: XML export_use: Default job_wait: True - name: Import SCP with RAID components in XML format from a CIFS share path dellemc.openmanage.idrac_server_config_profile: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_password" share_name: "\\\\192.168.0.2\\share" share_user: share_username share_password: share_password share_mnt: /mnt/cifs command: import scp_components: "RAID" scp_file: example_file.xml shutdown_type: Forced end_host_power_state: "On" job_wait: True - name: Export SCP with ALL components in JSON format to a HTTP share path dellemc.openmanage.idrac_server_config_profile: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_password" share_name: "http://192.168.0.3/share" share_user: share_username share_password: share_password scp_file: example_file.json scp_components: ALL export_format: JSON job_wait: False - name: Import SCP with ALL components in JSON format from a HTTP share path dellemc.openmanage.idrac_server_config_profile: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_password" command: import share_name: "http://192.168.0.3/share" share_user: share_username share_password: share_password scp_file: example_file.json shutdown_type: Graceful end_host_power_state: "On" job_wait: True - name: Export SCP with ALL components in XML format to a HTTPS share path without SCP file name dellemc.openmanage.idrac_server_config_profile: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_password" share_name: "https://192.168.0.4/share" share_user: share_username share_password: share_password scp_components: ALL export_format: XML export_use: Replace job_wait: True - name: Import SCP with ALL components in XML format from a HTTPS share path dellemc.openmanage.idrac_server_config_profile: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_password" command: import share_name: "https://192.168.0.4/share" share_user: share_username share_password: share_password scp_file: 192.168.0.1_20160618_164647.xml shutdown_type: Graceful end_host_power_state: "On" job_wait: False ``` 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\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'MessageId': 'GEN1234', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **msg** string | always | Status of the import or export SCP job. **Sample:** Successfully imported the Server Configuration Profile | | **scp\_status** dictionary | success | SCP operation job and progress details from the iDRAC. **Sample:** {'Id': 'JID\_XXXXXXXXX', 'JobState': 'Completed', 'JobType': 'ImportConfiguration', 'Message': 'Successfully imported and applied Server Configuration Profile.', 'MessageArgs': [], 'MessageId': 'XXX123', 'Name': 'Import Configuration', 'PercentComplete': 100, 'StartTime': 'TIME\_NOW', 'Status': 'Success', 'TargetSettingsURI': None, 'retval': True} | ### Authors * Jagadeesh N V(@jagadeeshnv) ansible dellemc.openmanage.idrac_redfish_storage_controller – Configures the storage controller settings dellemc.openmanage.idrac\_redfish\_storage\_controller – Configures the storage controller settings =================================================================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.idrac_redfish_storage_controller`. New in version 2.1.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module configures the settings of the storage controller using Redfish. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **baseuri** string / required | | IP address of the target out-of-band controller. For example- <ipaddress>:<port>. | | **command** string | **Choices:*** ResetConfig * **AssignSpare** ← * SetControllerKey * RemoveControllerKey * ReKey | These actions may require a system reset, depending on the controller's capabilities. `ResetConfig` - Deletes all the virtual disks and unassigns all hot spares on physical disks. `AssignSpare` - Assigns a physical disk as a dedicated or global hot spare for a virtual disk. `SetControllerKey` - Sets the key on controllers, which is used to encrypt the drives in Local key Management(LKM). `RemoveControllerKey` - Erases the encryption key on the controller. `ReKey` - Resets the key on the controller. | | **controller\_id** string | | FQDD of the storage controller. For example- 'RAID.Slot.1-1'. This option is mandatory when *command* is `ResetConfig`, `SetControllerKey`, `RemoveControllerKey` and `ReKey`. | | **key** string | | A new security key passphrase that the encryption-capable controller uses to create the encryption key. The controller uses the encryption key to lock or unlock access to the Self Encryption Disk(SED). Only one encryption key can be created for each controller. This is mandatory when *command* is `SetControllerKey` or `ReKey`, and when *mode* is `LKM`. | | **key\_id** string | | This is a user supplied text label associated with the passphrase. This is mandatory when *command* is `SetControllerKey` or `ReKey`, and when *mode* is `LKM`. | | **mode** string | **Choices:*** **LKM** ← * SEKM | Encryption mode of the encryption-capable controller: 1 - Local Key Management (LKM), 2 - Security Enterprise Key Manager(SEKM). This option is applicable only when *command* is `ReKey`. `SEKM` requires secure enterprise key manager license on the iDRAC. | | **old\_key** string | | Security key passphrase used by the encryption-capable controller.. This option is mandatory when *command* is `ReKey` and *mode* is `LKM`. | | **password** string / required | | Password of the target out-of-band controller. | | **target** string | | Fully Qualified Device Descriptor (FQDD) of the target physical drive that is assigned as a spare. This is mandatory when *command* is `AssignSpare`. If *volume\_id* is not specified or empty, this physical drive will be assigned as a global hot spare. | | **username** string / required | | Username of the target out-of-band controller. | | **volume\_id** list / elements=string | | FQDD of the volumes to which a hot spare is assigned. Applicable if *command* is `AssignSpare`. To know the number of volumes to which a hot spare can be assigned, refer iDRAC Redfish API guide. | Notes ----- Note * Run this module from a system that has direct access to DellEMC iDRAC. * This module does not support `check_mode`. Examples -------- ``` --- - name: Assign dedicated hot spare dellemc.openmanage.idrac_redfish_storage_controller: baseuri: "192.168.0.1:443" username: "user_name" password: "user_password" volume_id: - "Disk.Virtual.0:RAID.Slot.1-1" target: "Disk.Bay.0:Enclosure.Internal.0-1:RAID.Slot.1-1" tags: - assign_dedicated_hot_spare - name: Assign global hot spare dellemc.openmanage.idrac_redfish_storage_controller: baseuri: "192.168.0.1:443" username: "user_name" password: "user_password" target: "Disk.Bay.0:Enclosure.Internal.0-1:RAID.Slot.1-1" tags: - assign_global_hot_spare - name: Set controller encryption key dellemc.openmanage.idrac_redfish_storage_controller: baseuri: "192.168.0.1:443" username: "user_name" password: "user_password" command: "SetControllerKey" controller_id: "RAID.Slot.1-1" key: "PassPhrase@123" key_id: "mykeyid123" tags: - set_controller_key - name: Rekey in LKM mode dellemc.openmanage.idrac_redfish_storage_controller: baseuri: "192.168.0.1:443" username: "user_name" password: "user_password" command: "ReKey" controller_id: "RAID.Slot.1-1" key: "NewPassPhrase@123" key_id: "newkeyid123" old_key: "OldPassPhrase@123" tags: - rekey_lkm - name: Rekey in SEKM mode dellemc.openmanage.idrac_redfish_storage_controller: baseuri: "192.168.0.1:443" username: "user_name" password: "user_password" command: "ReKey" controller_id: "RAID.Slot.1-1" mode: "SEKM" tags: - rekey_sekm - name: Remove controller key dellemc.openmanage.idrac_redfish_storage_controller: baseuri: "192.168.0.1:443" username: "user_name" password: "user_password" command: "RemoveControllerKey" controller_id: "RAID.Slot.1-1" tags: - remove_controller_key - name: Reset controller configuration dellemc.openmanage.idrac_redfish_storage_controller: baseuri: "192.168.0.1:443" username: "user_name" password: "user_password" command: "ResetConfig" controller_id: "RAID.Slot.1-1" tags: - reset_config ``` 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\_info** dictionary | on http error | Details of a http error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to run the method because the requested HTTP method is not allowed.', 'MessageArgs': [], '[email protected]': 0, 'MessageId': 'iDRAC.1.6.SYS402', 'RelatedProperties': [], '[email protected]': 0, 'Resolution': 'Enter a valid HTTP method and retry the operation. For information about valid methods, see the Redfish Users Guide available on the support site.', 'Severity': 'Informational'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information'}} | | **msg** string | always | Overall status of the storage controller configuration operation. **Sample:** Successfully submitted the job that performs the AssignSpare operation | | **task** dictionary | success | ID and URI resource of the job created. **Sample:** {'id': 'JID\_XXXXXXXXXXXXX', 'uri': '/redfish/v1/Managers/iDRAC.Embedded.1/Jobs/JID\_XXXXXXXXXXXXX'} | ### Authors * Jagadeesh N V (@jagadeeshnv)
programming_docs
ansible dellemc.openmanage.ome_firmware_catalog – Create, modify, or delete a firmware catalog on OpenManage Enterprise or OpenManage Enterprise Modular dellemc.openmanage.ome\_firmware\_catalog – Create, modify, or delete a firmware catalog on OpenManage Enterprise or OpenManage Enterprise Modular ================================================================================================================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.ome_firmware_catalog`. New in version 2.0.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows to create, modify, or delete a firmware catalog on OpenManage Enterprise or OpenManage Enterprise Modular. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **catalog\_description** string | | Description for the catalog. | | **catalog\_id** list / elements=integer added in 3.4.0 of dellemc.openmanage | | ID of the catalog. This option is mutually exclusive with *catalog\_name*. Provide the list of firmware catalog IDs that are supported when *state* is `absent`. | | **catalog\_name** list / elements=string | | Name of the firmware catalog to be created. This is option is mutually exclusive with *catalog\_id*. Provide the list of firmware catalog names that are supported when *state* is `absent`. | | **check\_certificate** boolean | **Choices:*** **no** ← * yes | The certificate warnings are ignored when *repository\_type* is HTTPS. If `True`. If not, certificate warnings are not ignored. | | **file\_name** string | | Catalog file name associated with the *source\_path*. This option is ignored when *repository\_type* is `DELL_ONLINE`. | | **hostname** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular IP address or hostname. | | **job\_wait** boolean added in 3.4.0 of dellemc.openmanage | **Choices:*** no * **yes** ← | Provides the option to wait for job completion. This option is applicable when *state* is `present`. | | **job\_wait\_timeout** integer added in 3.4.0 of dellemc.openmanage | **Default:**600 | The maximum wait time of *job\_wait* in seconds. The job is tracked only for this duration. This option is applicable when *job\_wait* is `True`. | | **new\_catalog\_name** string added in 3.4.0 of dellemc.openmanage | | New name of the firmware catalog. | | **password** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular password. | | **port** integer | **Default:**443 | OpenManage Enterprise or OpenManage Enterprise Modular HTTPS port. | | **repository\_domain** string | | Domain name of the repository. This option is ignored when *repository\_type* is `DELL_ONLINE`. | | **repository\_password** string | | Password to access the repository. This option is mandatory when *repository\_type* is CIFS. This option is ignored when *repository\_type* is `DELL_ONLINE`. `NOTE` The module always reports the changed status, when this is provided. | | **repository\_type** string | **Choices:*** NFS * CIFS * HTTP * HTTPS * DELL\_ONLINE | Type of repository. The supported types are NFS, CIFS, HTTP, HTTPS,and DELL\_ONLINE. | | **repository\_username** string | | User name of the repository where the catalog is stored. This option is mandatory when *repository\_type* is CIFS. This option is ignored when *repository\_type* is `DELL_ONLINE`. | | **source** string | | The IP address of the system where the firmware catalog is stored on the local network. By default, this option is set to downloads.dell.com when *repository\_type* is `DELL_ONLINE`. | | **source\_path** string | | Specify the complete path of the catalog file location without the file name. This is option ignored when *repository\_type* is `DELL_ONLINE`. | | **state** string added in 3.4.0 of dellemc.openmanage | **Choices:*** **present** ← * absent | `present` creates or modifies a catalog. `absent` deletes an existing catalog. | | **username** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular username. | Notes ----- Note * If *repository\_password* is provided, then the module always reports the changed status. * Run this module from a system that has direct access to DellEMC OpenManage Enterprise or OpenManage Enterprise Modular. * This module supports `check_mode`. Examples -------- ``` --- - name: Create a catalog from HTTPS repository dellemc.openmanage.ome_firmware_catalog: hostname: "192.168.0.1" username: "username" password: "password" catalog_name: "catalog_name" catalog_description: "catalog_description" repository_type: "HTTPS" source: "downloads.dell.com" source_path: "catalog" file_name: "catalog.gz" check_certificate: True - name: Create a catalog from HTTP repository dellemc.openmanage.ome_firmware_catalog: hostname: "192.168.0.1" username: "username" password: "password" catalog_name: "catalog_name" catalog_description: "catalog_description" repository_type: "HTTP" source: "downloads.dell.com" source_path: "catalog" file_name: "catalog.gz" - name: Create a catalog using CIFS share dellemc.openmanage.ome_firmware_catalog: hostname: "192.168.0.1" username: "username" password: "password" catalog_name: "catalog_name" catalog_description: "catalog_description" repository_type: "CIFS" source: "192.167.0.1" source_path: "cifs/R940" file_name: "catalog.gz" repository_username: "repository_username" repository_password: "repository_password" repository_domain: "repository_domain" - name: Create a catalog using NFS share dellemc.openmanage.ome_firmware_catalog: hostname: "192.168.0.1" username: "username" password: "password" catalog_name: "catalog_name" catalog_description: "catalog_description" repository_type: "NFS" source: "192.166.0.2" source_path: "/nfs/R940" file_name: "catalog.xml" - name: Create a catalog using repository from Dell.com dellemc.openmanage.ome_firmware_catalog: hostname: "192.168.0.1" username: "username" password: "password" catalog_name: "catalog_name" catalog_description: "catalog_description" repository_type: "DELL_ONLINE" check_certificate: True - name: Modify a catalog using a repository from CIFS share dellemc.openmanage.ome_firmware_catalog: hostname: "192.168.0.1" username: "username" password: "password" catalog_name: "catalog_name" catalog_description: "new catalog_description" repository_type: "CIFS" source: "192.167.0.2" source_path: "cifs/R941" file_name: "catalog1.gz" repository_username: "repository_username" repository_password: "repository_password" repository_domain: "repository_domain" - name: Modify a catalog using a repository from Dell.com dellemc.openmanage.ome_firmware_catalog: hostname: "192.168.0.1" username: "username" password: "password" catalog_id: 10 new_catalog_name: "new_catalog_name" repository_type: "DELL_ONLINE" catalog_description: "catalog_description" - name: Delete catalog using catalog name dellemc.openmanage.ome_firmware_catalog: hostname: "192.168.0.1" username: "username" password: "password" state: absent catalog_name: ["catalog_name1", "catalog_name2"] - name: Delete catalog using catalog id dellemc.openmanage.ome_firmware_catalog: hostname: "192.168.0.1" username: "username" password: "password" state: absent catalog_id: [11, 34] ``` 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 | | --- | --- | --- | | **associated\_baselines** list / elements=dictionary | When *state* is `absent` | IDs of the baselines associated with catalog. **Sample:** [{'BaselineId': 24, 'BaselineName': 'new'}, {'BaselineId': 25, 'BaselineName': 'c7'}, {'BaselineId': 27, 'BaselineName': 'c4'}] | | **catalog\_id** integer | When *state* is `absent` | IDs of the deleted catalog. **Sample:** 10123 | | **catalog\_status** dictionary | When *state* is `present` | Details of the catalog operation. **Sample:** {'AssociatedBaselines': [], 'BaseLocation': None, 'BundlesCount': 0, 'Filename': 'catalog.gz', 'Id': 0, 'LastUpdated': None, 'ManifestIdentifier': None, 'ManifestVersion': None, 'NextUpdate': None, 'PredecessorIdentifier': None, 'ReleaseDate': None, 'ReleaseIdentifier': None, 'Repository': {'CheckCertificate': True, 'Description': 'HTTPS Desc', 'DomainName': None, 'Id': None, 'Name': 'catalog4', 'Password': None, 'RepositoryType': 'HTTPS', 'Source': 'company.com', 'Username': None}, 'Schedule': None, 'SourcePath': 'catalog', 'Status': None, 'TaskId': 10094} | | **error\_info** dictionary | on http error | Details of the http error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to create or update the catalog because a repository with the same name already exists.', 'Resolution': 'Enter a different name and retry the operation.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **job\_id** integer | When catalog job is in a running state | Job ID of the catalog task. **Sample:** 10123 | | **msg** string | always | Overall status of the firmware catalog operation. **Sample:** Successfully triggered the job to create a catalog with Task ID : 10094 | ### Authors * Sajna Shetty(@Sajna-Shetty) * Jagadeesh N V(@jagadeeshnv) ansible dellemc.openmanage.ome_device_info – Retrieves the information of devices inventoried by OpenManage Enterprise dellemc.openmanage.ome\_device\_info – Retrieves the information of devices inventoried by OpenManage Enterprise ================================================================================================================ Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.ome_device_info`. New in version 2.0.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module retrieves the list of devices in the inventory of OpenManage Enterprise along with the details of each device. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **fact\_subset** string | **Choices:*** **basic\_inventory** ← * detailed\_inventory * subsystem\_health | `basic_inventory` returns the list of the devices. `detailed_inventory` returns the inventory details of specified devices. `subsystem_health` returns the health status of specified devices. | | **hostname** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular IP address or hostname. | | **password** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular password. | | **port** integer | **Default:**443 | OpenManage Enterprise or OpenManage Enterprise Modular HTTPS port. | | **system\_query\_options** dictionary | | *system\_query\_options* applicable for the choices of the fact\_subset. Either *device\_id* or *device\_service\_tag* is mandatory for `detailed_inventory` and `subsystem_health` or both can be applicable. | | | **device\_id** list / elements=integer | | A list of unique identifier is applicable for `detailed_inventory` and `subsystem_health`. | | | **device\_service\_tag** list / elements=string | | A list of service tags are applicable for `detailed_inventory` and `subsystem_health`. | | | **filter** string | | For `basic_inventory`, it filters the collection of devices. *filter* query format should be aligned with OData standards. | | | **inventory\_type** string | | For `detailed_inventory`, it returns details of the specified inventory type. | | **username** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular username. | Notes ----- Note * Run this module from a system that has direct access to DellEMC OpenManage Enterprise. * This module supports `check_mode`. Examples -------- ``` --- - name: Retrieve basic inventory of all devices dellemc.openmanage.ome_device_info: hostname: "192.168.0.1" username: "username" password: "password" - name: Retrieve basic inventory for devices identified by IDs 33333 or 11111 using filtering dellemc.openmanage.ome_device_info: hostname: "192.168.0.1" username: "username" password: "password" fact_subset: "basic_inventory" system_query_options: filter: "Id eq 33333 or Id eq 11111" - name: Retrieve inventory details of specified devices identified by IDs 11111 and 22222 dellemc.openmanage.ome_device_info: hostname: "192.168.0.1" username: "username" password: "password" fact_subset: "detailed_inventory" system_query_options: device_id: - 11111 - 22222 - name: Retrieve inventory details of specified devices identified by service tags MXL1234 and MXL4567 dellemc.openmanage.ome_device_info: hostname: "192.168.0.1" username: "username" password: "password" fact_subset: "detailed_inventory" system_query_options: device_service_tag: - MXL1234 - MXL4567 - name: Retrieve details of specified inventory type of specified devices identified by ID and service tags dellemc.openmanage.ome_device_info: hostname: "192.168.0.1" username: "username" password: "password" fact_subset: "detailed_inventory" system_query_options: device_id: - 11111 device_service_tag: - MXL1234 - MXL4567 inventory_type: "serverDeviceCards" - name: Retrieve subsystem health of specified devices identified by service tags dellemc.openmanage.ome_device_info: hostname: "192.168.0.1" username: "username" password: "password" fact_subset: "subsystem_health" system_query_options: device_service_tag: - MXL1234 - MXL4567 ``` 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 | | --- | --- | --- | | **device\_info** dictionary | success | Returns the information collected from the Device. **Sample:** {'value': [{'Actions': None, 'AssetTag': None, 'ChassisServiceTag': None, 'ConnectionState': True, 'DeviceManagement': [{'DnsName': 'dnsname.host.com', 'InstrumentationName': 'MX-12345', 'MacAddress': '11:10:11:10:11:10', 'ManagementId': 12345, 'ManagementProfile': [{'HasCreds': 0, 'ManagementId': 12345, 'ManagementProfileId': 12345, 'ManagementURL': 'https://192.168.0.1:443', 'Status': 1000, 'StatusDateTime': '2019-01-21 06:30:08.501'}], 'ManagementType': 2, 'NetworkAddress': '192.168.0.1'}], 'DeviceName': 'MX-0003I', 'DeviceServiceTag': 'MXL1234', 'DeviceSubscription': None, 'LastInventoryTime': '2019-01-21 06:30:08.501', 'LastStatusTime': '2019-01-21 06:30:02.492', 'ManagedState': 3000, 'Model': 'PowerEdge MX7000', 'PowerState': 17, 'SlotConfiguration': {}, 'Status': 4000, 'SystemId': 2031, 'Type': 2000}]} | | **msg** string | on error | Over all device information status. **Sample:** Failed to fetch the device information | ### Authors * Sajna Shetty(@Sajna-Shetty) ansible dellemc.openmanage.dellemc_idrac_storage_volume – Configures the RAID configuration attributes dellemc.openmanage.dellemc\_idrac\_storage\_volume – Configures the RAID configuration attributes ================================================================================================= Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.dellemc_idrac_storage_volume`. New in version 2.0.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module is responsible for configuring the RAID attributes. Requirements ------------ The below requirements are needed on the host that executes this module. * omsdk * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **capacity** float | | Virtual disk size in GB. | | **controller\_id** string | | Fully Qualified Device Descriptor (FQDD) of the storage controller, for example 'RAID.Integrated.1-1'. Controller FQDD is required for `create` RAID configuration. | | **disk\_cache\_policy** string | **Choices:*** **Default** ← * Enabled * Disabled | Disk Cache Policy. | | **idrac\_ip** string / required | | iDRAC IP Address. | | **idrac\_password** string / required | | iDRAC user password. aliases: idrac\_pwd | | **idrac\_port** integer | **Default:**443 | iDRAC port. | | **idrac\_user** string / required | | iDRAC username. | | **media\_type** string | **Choices:*** HDD * SSD | Media type. | | **number\_dedicated\_hot\_spare** integer | **Default:**0 | Number of Dedicated Hot Spare. | | **protocol** string | **Choices:*** SAS * SATA | Bus protocol. | | **raid\_init\_operation** string | **Choices:*** None * Fast | This option represents initialization configuration operation to be performed on the virtual disk. | | **raid\_reset\_config** string | **Choices:*** True * False **Default:**"no" | This option represents whether a reset config operation needs to be performed on the RAID controller. Reset Config operation deletes all the virtual disks present on the RAID controller. | | **read\_cache\_policy** string | **Choices:*** **NoReadAhead** ← * ReadAhead * AdaptiveReadAhead | Read cache policy. | | **span\_depth** integer | **Default:**1 | Number of spans in the RAID configuration. *span\_depth* is required for `create` and its value depends on *volume\_type*. | | **span\_length** integer | **Default:**1 | Number of disks in a span. *span\_length* is required for `create` and its value depends on *volume\_type*. | | **state** string | **Choices:*** create * delete * **view** ← | `create`, performs create volume operation. `delete`, performs remove volume operation. `view`, returns storage view. | | **stripe\_size** integer | **Default:**65536 | Stripe size value to be provided in multiples of 64 \* 1024. | | **volume\_id** string | | Fully Qualified Device Descriptor (FQDD) of the virtual disk, for example 'Disk.virtual.0:RAID.Slot.1-1'. This option is used to get the virtual disk information. | | **volume\_type** string | **Choices:*** **RAID 0** ← * RAID 1 * RAID 5 * RAID 6 * RAID 10 * RAID 50 * RAID 60 | Provide the the required RAID level. | | **volumes** list / elements=dictionary | | A list of virtual disk specific iDRAC attributes. This is applicable for `create` and `delete` operations. For `create` operation, name and drives are applicable options, other volume options can also be specified. The drives is a required option for `create` operation and accepts either location (list of drive slot) or id (list of drive fqdd). For `delete` operation, only name option is applicable. See the examples for more details. | | **write\_cache\_policy** string | **Choices:*** **WriteThrough** ← * WriteBack * WriteBackForce | Write cache policy. | Notes ----- Note * Run this module from a system that has direct access to DellEMC iDRAC. * This module supports `check_mode`. Examples -------- ``` --- - name: Create single volume dellemc.openmanage.dellemc_idrac_storage_volume: idrac_ip: "192.168.0.1" idrac_user: "username" idrac_password: "password" state: "create" controller_id: "RAID.Slot.1-1" volumes: - drives: location: [5] - name: Create multiple volume dellemc.openmanage.dellemc_idrac_storage_volume: idrac_ip: "192.168.0.1" idrac_user: "username" idrac_password: "password" raid_reset_config: "True" state: "create" controller_id: "RAID.Slot.1-1" volume_type: "RAID 1" span_depth: 1 span_length: 2 number_dedicated_hot_spare: 1 disk_cache_policy: "Enabled" write_cache_policy: "WriteBackForce" read_cache_policy: "ReadAhead" stripe_size: 65536 capacity: 100 raid_init_operation: "Fast" volumes: - name: "volume_1" drives: id: ["Disk.Bay.1:Enclosure.Internal.0-1:RAID.Slot.1-1", "Disk.Bay.2:Enclosure.Internal.0-1:RAID.Slot.1-1"] - name: "volume_2" volume_type: "RAID 5" span_length: 3 span_depth: 1 drives: location: [7,3,5] disk_cache_policy: "Disabled" write_cache_policy: "WriteBack" read_cache_policy: "NoReadAhead" stripe_size: 131072 capacity: "200" raid_init_operation: "None" - name: View all volume details dellemc.openmanage.dellemc_idrac_storage_volume: idrac_ip: "192.168.0.1" idrac_user: "username" idrac_password: "password" state: "view" - name: View specific volume details dellemc.openmanage.dellemc_idrac_storage_volume: idrac_ip: "192.168.0.1" idrac_user: "username" idrac_password: "password" state: "view" controller_id: "RAID.Slot.1-1" volume_id: "Disk.Virtual.0:RAID.Slot.1-1" - name: Delete single volume dellemc.openmanage.dellemc_idrac_storage_volume: idrac_ip: "192.168.0.1" idrac_user: "username" idrac_password: "password" state: "delete" volumes: - name: "volume_1" - name: Delete multiple volume dellemc.openmanage.dellemc_idrac_storage_volume: idrac_ip: "192.168.0.1" idrac_user: "username" idrac_password: "password" state: "delete" volumes: - name: "volume_1" - name: "volume_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 | | --- | --- | --- | | **msg** string | always | Overall status of the storage configuration operation. **Sample:** Successfully completed the view storage volume operation | | **storage\_status** dictionary | success | Storage configuration job and progress details from the iDRAC. **Sample:** {'Id': 'JID\_XXXXXXXXX', 'JobState': 'Completed', 'JobType': 'ImportConfiguration', 'Message': 'Successfully imported and applied Server Configuration Profile.', 'MessageId': 'XXX123', 'Name': 'Import Configuration', 'PercentComplete': 100, 'StartTime': 'TIME\_NOW', 'Status': 'Success', 'TargetSettingsURI': None, 'retval': True} | ### Authors * Felix Stephen (@felixs88)
programming_docs
ansible dellemc.openmanage.ome_firmware – Firmware update of PowerEdge devices and its components through OpenManage Enterprise dellemc.openmanage.ome\_firmware – Firmware update of PowerEdge devices and its components through OpenManage Enterprise ======================================================================================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.ome_firmware`. New in version 2.0.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module updates the firmware of PowerEdge devices and all its components through OpenManage Enterprise. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **baseline\_name** string | | Enter the baseline name to update the firmware of all the devices or groups of devices against the available compliance report. The firmware update can also be done by providing the baseline name and the path to the single DUP file. To update multiple baselines at once, provide the baseline names separated by commas. *baseline\_names* is mutually exclusive with *device\_group\_names*, *device\_id* and *device\_service\_tag*. | | **device\_group\_names** list / elements=string | | Enter the name of the group to update the firmware of all the devices within the group. *device\_group\_names* is mutually exclusive with *device\_id* and *device\_service\_tag*. | | **device\_id** list / elements=integer | | List of targeted device ids. Either *device\_id* or *device\_service\_tag* can be used individually or together. *device\_id* is mutually exclusive with *device\_group\_names*. | | **device\_service\_tag** list / elements=string | | List of targeted device service tags. Either *device\_id* or *device\_service\_tag* can be used individually or together. *device\_service\_tag* is mutually exclusive with *device\_group\_names*. | | **dup\_file** string | | Executable file to apply on the targets. | | **hostname** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular IP address or hostname. | | **password** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular password. | | **port** integer | **Default:**443 | OpenManage Enterprise or OpenManage Enterprise Modular HTTPS port. | | **username** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular username. | Notes ----- Note * Run this module from a system that has direct access to DellEMC OpenManage Enterprise. * This module does not support `check_mode`. Examples -------- ``` --- - name: Update firmware from DUP file using device ids dellemc.openmanage.ome_firmware: hostname: "192.168.0.1" username: "username" password: "password" device_id: - 11111 - 22222 dup_file: "/path/Chassis-System-Management_Firmware_6N9WN_WN64_1.00.01_A00.EXE" - name: Update firmware from a DUP file using a device service tags dellemc.openmanage.ome_firmware: hostname: "192.168.0.1" username: "username" password: "password" device_service_tag: - KLBR111 - KLBR222 dup_file: "/path/Network_Firmware_NTRW0_WN64_14.07.07_A00-00_01.EXE" - name: Update firmware from a DUP file using a device group names dellemc.openmanage.ome_firmware: hostname: "192.168.0.1" username: "username" password: "password" device_group_names: - servers dup_file: "/path/BIOS_87V69_WN64_2.4.7.EXE" - name: Update firmware using baseline name dellemc.openmanage.ome_firmware: hostname: "192.168.0.1" username: "username" password: "password" baseline_name: baseline_devices - name: Update firmware from a DUP file using a baseline names dellemc.openmanage.ome_firmware: hostname: "192.168.0.1" username: "username" password: "password" baseline_name: "baseline_devices, baseline_groups" dup_file: "/path/BIOS_87V69_WN64_2.4.7.EXE" ``` 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\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'MessageId': 'GEN1234', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **msg** string | always | Overall firmware update status. **Sample:** Successfully submitted the firmware update job. | | **update\_status** dictionary | success | Firmware Update job and progress details from the OME. **Sample:** {'Builtin': False, 'CreatedBy': 'user', 'Editable': True, 'EndTime': 'None', 'Id': 11117, 'JobDescription': 'dup test', 'JobName': 'Firmware Update Task', 'JobStatus': {'Id': 1111, 'Name': 'New'}, 'JobType': {'Id': 5, 'Internal': False, 'Name': 'Update\_Task'}, 'LastRun': 'None', 'LastRunStatus': {'Id': 1111, 'Name': 'NotRun'}, 'NextRun': 'None', 'Params': [{'JobId': 11111, 'Key': 'signVerify', 'Value': 'true'}, {'JobId': 11112, 'Key': 'stagingValue', 'Value': 'false'}, {'JobId': 11113, 'Key': 'complianceUpdate', 'Value': 'false'}, {'JobId': 11114, 'Key': 'operationName', 'Value': 'INSTALL\_FIRMWARE'}], 'Schedule': 'startnow', 'StartTime': 'None', 'State': 'Enabled', 'Targets': [{'Data': 'DCIM:INSTALLED#701\_\_NIC.Mezzanine.1A-1-1=1111111111111', 'Id': 11115, 'JobId': 11116, 'TargetType': {'Id': 1000, 'Name': 'DEVICE'}}], 'UpdatedBy': 'None', 'Visible': True} | ### Authors * Felix Stephen (@felixs88) ansible dellemc.openmanage.ome_application_network_webserver – Updates the Web server configuration on OpenManage Enterprise dellemc.openmanage.ome\_application\_network\_webserver – Updates the Web server configuration on OpenManage Enterprise ======================================================================================================================= Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.ome_application_network_webserver`. New in version 2.1.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows to configure a network web server on OpenManage Enterprise. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **hostname** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular IP address or hostname. | | **password** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular password. | | **port** integer | **Default:**443 | OpenManage Enterprise or OpenManage Enterprise Modular HTTPS port. | | **username** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular username. | | **webserver\_port** integer | | Port number used by OpenManage Enterprise to establish a secure server connection. *WARNING* A change in port number results in a loss of connectivity in the current session for more than a minute. | | **webserver\_timeout** integer | | The duration in minutes after which a web user interface session is automatically disconnected. If a change is made to the session timeout, it will only take effect after the next log in. | Notes ----- Note * Run this module from a system that has direct access to DellEMC OpenManage Enterprise. * This module supports `check_mode`. Examples -------- ``` --- - name: Update web server port and session time out dellemc.openmanage.ome_application_network_webserver: hostname: "192.168.0.1" username: "username" password: "password" webserver_port: 9443 webserver_timeout: 20 - name: Update session time out dellemc.openmanage.ome_application_network_webserver: hostname: "192.168.0.1" username: "username" password: "password" webserver_timeout: 30 - name: Update web server port dellemc.openmanage.ome_application_network_webserver: hostname: "192.168.0.1" username: "username" password: "password" webserver_port: 8443 ``` 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\_info** dictionary | on HTTP error | Details of the HTTP error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to complete the request because the input value for PortNumber is missing or an invalid value is entered.', 'MessageArgs': ['PortNumber'], 'MessageId': 'CGEN6002', 'RelatedProperties': [], 'Resolution': 'Enter a valid value and retry the operation.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **msg** string | always | Overall status of the network web server configuration change. **Sample:** Successfully updated network web server configuration. | | **webserver\_configuration** dictionary | success | Updated application network web server configuration. **Sample:** {'EnableWebServer': True, 'PortNumber': 443, 'TimeOut': 20} | ### Authors * Jagadeesh N V(@jagadeeshnv) ansible dellemc.openmanage.idrac_reset – Reset iDRAC dellemc.openmanage.idrac\_reset – Reset iDRAC ============================================= Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.idrac_reset`. New in version 2.1.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module resets iDRAC. * iDRAC is not accessible for some time after running this module. It is recommended to wait for some time, before trying to connect to iDRAC. Requirements ------------ The below requirements are needed on the host that executes this module. * omsdk * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **idrac\_ip** string / required | | iDRAC IP Address. | | **idrac\_password** string / required | | iDRAC user password. aliases: idrac\_pwd | | **idrac\_port** integer | **Default:**443 | iDRAC port. | | **idrac\_user** string / required | | iDRAC username. | Notes ----- Note * Run this module from a system that has direct access to DellEMC iDRAC. * This module supports `check_mode`. Examples -------- ``` --- - name: Reset iDRAC dellemc.openmanage.idrac_reset: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_password" idrac_port: 443 ``` 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\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'MessageId': 'GEN1234', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **msg** string | always | Status of the iDRAC reset operation. **Sample:** Successfully performed iDRAC reset. | | **reset\_status** dictionary | always | Details of iDRAC reset operation. **Sample:** {'idracreset': {'Data': {'StatusCode': 204}, 'Message': 'none', 'Status': 'Success', 'StatusCode': 204, 'retval': True}} | ### Authors * Felix Stephen (@felixs88) * Anooja Vardhineni (@anooja-vardhineni) ansible dellemc.openmanage.idrac_lifecycle_controller_logs – Export Lifecycle Controller logs to a network share or local path. dellemc.openmanage.idrac\_lifecycle\_controller\_logs – Export Lifecycle Controller logs to a network share or local path. ========================================================================================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.idrac_lifecycle_controller_logs`. New in version 2.1.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Export Lifecycle Controller logs to a given network share or local path. Requirements ------------ The below requirements are needed on the host that executes this module. * omsdk * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **idrac\_ip** string / required | | iDRAC IP Address. | | **idrac\_password** string / required | | iDRAC user password. aliases: idrac\_pwd | | **idrac\_port** integer | **Default:**443 | iDRAC port. | | **idrac\_user** string / required | | iDRAC username. | | **job\_wait** boolean | **Choices:*** no * **yes** ← | Whether to wait for the running job completion or not. | | **share\_name** string / required | | Network share or local path. CIFS, NFS network share types are supported. | | **share\_password** string | | Network share user password. This option is mandatory for CIFS Network Share. aliases: share\_pwd | | **share\_user** string | | Network share user in the format 'user@domain' or 'domain\user' if user is part of a domain else 'user'. This option is mandatory for CIFS Network Share. | Notes ----- Note * This module requires ‘Administrator’ privilege for *idrac\_user*. * Exporting data to a local share is supported only on iDRAC9-based PowerEdge Servers and later. * Run this module from a system that has direct access to Dell EMC iDRAC. * This module does not support `check_mode`. Examples -------- ``` --- - name: Export lifecycle controller logs to NFS share. dellemc.openmanage.idrac_lifecycle_controller_logs: idrac_ip: "190.168.0.1" idrac_user: "user_name" idrac_password: "user_password" share_name: "192.168.0.0:/nfsfileshare" - name: Export lifecycle controller logs to CIFS share. dellemc.openmanage.idrac_lifecycle_controller_logs: idrac_ip: "190.168.0.1" idrac_user: "user_name" idrac_password: "user_password" share_name: "\\\\192.168.0.2\\share" share_user: "share_user_name" share_password: "share_user_pwd" - name: Export lifecycle controller logs to LOCAL path. dellemc.openmanage.idrac_lifecycle_controller_logs: idrac_ip: "190.168.0.1" idrac_user: "user_name" idrac_password: "user_password" share_name: "/example/export_lc" ``` 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\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'MessageId': 'GEN1234', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **lc\_logs\_status** dictionary | success | Status of the export operation along with job details and file path. **Sample:** {'ElapsedTimeSinceCompletion': '0', 'InstanceID': 'JID\_274774785395', 'JobStartTime': 'NA', 'JobStatus': 'Completed', 'JobUntilTime': 'NA', 'Message': 'LCL Export was successful', 'MessageArguments': 'NA', 'MessageID': 'LC022', 'Name': 'LC Export', 'PercentComplete': '100', 'Status': 'Success', 'file': '192.168.0.0:/nfsfileshare/190.168.0.1\_20210728\_133437\_LC\_Log.log', 'retval': True} | | **msg** string | always | Status of the export lifecycle controller logs job. **Sample:** Successfully exported the lifecycle controller logs. | ### Authors * Rajeev Arakkal (@rajeevarakkal) * Anooja Vardhineni (@anooja-vardhineni) ansible dellemc.openmanage.ome_powerstate – Performs the power management operations on OpenManage Enterprise dellemc.openmanage.ome\_powerstate – Performs the power management operations on OpenManage Enterprise ====================================================================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.ome_powerstate`. New in version 2.1.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module performs the supported power management operations on OpenManage Enterprise. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **device\_id** integer | | Targeted device id. *device\_id* is mutually exclusive with *device\_service\_tag*. | | **device\_service\_tag** string | | Targeted device service tag. *device\_service\_tag* is mutually exclusive with *device\_id*. | | **hostname** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular IP address or hostname. | | **password** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular password. | | **port** integer | **Default:**443 | OpenManage Enterprise or OpenManage Enterprise Modular HTTPS port. | | **power\_state** string / required | **Choices:*** on * off * coldboot * warmboot * shutdown | Desired end power state. | | **username** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular username. | Notes ----- Note * Run this module from a system that has direct access to DellEMC OpenManage Enterprise. * This module supports `check_mode`. Examples -------- ``` --- - name: Power state operation based on device id dellemc.openmanage.ome_powerstate: hostname: "192.168.0.1" username: "username" password: "password" device_id: 11111 power_state: "off" - name: Power state operation based on device service tag dellemc.openmanage.ome_powerstate: hostname: "192.168.0.1" username: "username" password: "password" device_service_tag: "KLBR111" power_state: "on" - name: Power state operation based on list of device ids dellemc.openmanage.ome_powerstate: hostname: "192.168.0.1" username: "username" password: "password" device_id: "{{ item.device_id }}" power_state: "{{ item.state }}" with_items: - { "device_id": 11111, "state": "on" } - { "device_id": 22222, "state": "off" } - name: Power state operation based on list of device service tags dellemc.openmanage.ome_powerstate: hostname: "192.168.0.1" username: "username" password: "password" device_service_tag: "{{ item.service_tag }}" power_state: "{{ item.state }}" with_items: - { "service_tag": "KLBR111", "state": "on" } - { "service_tag": "KLBR222", "state": "off" } ``` 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 | | --- | --- | --- | | **job\_status** dictionary | success | Power state operation job and progress details from the OME. **Sample:** {'Builtin': False, 'CreatedBy': 'user', 'Editable': True, 'EndTime': None, 'Id': 11111, 'JobDescription': 'DeviceAction\_Task', 'JobName': 'DeviceAction\_Task\_PowerState', 'JobStatus': {'Id': 1111, 'Name': 'New'}, 'JobType': {'Id': 1, 'Internal': False, 'Name': 'DeviceAction\_Task'}, 'LastRun': '2019-04-01 06:39:02.69', 'LastRunStatus': {'Id': 1112, 'Name': 'Running'}, 'NextRun': None, 'Params': [{'JobId': 11111, 'Key': 'powerState', 'Value': '2'}, {'JobId': 11111, 'Key': 'operationName', 'Value': 'POWER\_CONTROL'}], 'Schedule': '', 'StartTime': None, 'State': 'Enabled', 'Targets': [{'Data': '', 'Id': 11112, 'JobId': 11111, 'TargetType': {'Id': 1000, 'Name': 'DEVICE'}}], 'UpdatedBy': None, 'Visible': True} | | **msg** string | always | Overall power state operation job status. **Sample:** Power State operation job submitted successfully. | ### Authors * Felix Stephen (@felixs88)
programming_docs
ansible dellemc.openmanage.ome_template_identity_pool – Attach or detach an identity pool to a requested template on OpenManage Enterprise dellemc.openmanage.ome\_template\_identity\_pool – Attach or detach an identity pool to a requested template on OpenManage Enterprise ===================================================================================================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.ome_template_identity_pool`. New in version 2.0.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows to- - Attach an identity pool to a requested template on OpenManage Enterprise. - Detach an identity pool from a requested template on OpenManage Enterprise. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **hostname** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular IP address or hostname. | | **identity\_pool\_name** string | | Name of the identity pool. - To attach an identity pool to a template, provide the name of the identity pool. - This option is not applicable when detaching an identity pool from a template. | | **password** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular password. | | **port** integer | **Default:**443 | OpenManage Enterprise or OpenManage Enterprise Modular HTTPS port. | | **template\_name** string / required | | Name of the template to which an identity pool is attached or detached. | | **username** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular username. | Notes ----- Note * Run this module from a system that has direct access to DellEMC OpenManage Enterprise. * This module does not support `check_mode`. Examples -------- ``` --- - name: Attach an identity pool to a template dellemc.openmanage.ome_template_identity_pool: hostname: "192.168.0.1" username: "username" password: "password" template_name: template_name identity_pool_name: identity_pool_name - name: Detach an identity pool from a template dellemc.openmanage.ome_template_identity_pool: hostname: "192.168.0.1" username: "username" password: "password" template_name: template_name ``` 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\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'MessageId': 'GEN1234', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **msg** string | always | Overall identity pool status of the attach or detach operation. **Sample:** Successfully attached identity pool to template. | ### Authors * Felix Stephen (@felixs88) ansible dellemc.openmanage.ome_template_info – Retrieves template details from OpenManage Enterprise dellemc.openmanage.ome\_template\_info – Retrieves template details from OpenManage Enterprise ============================================================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.ome_template_info`. New in version 2.0.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module retrieves the list and details of all the templates on OpenManage Enterprise. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **hostname** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular IP address or hostname. | | **password** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular password. | | **port** integer | **Default:**443 | OpenManage Enterprise or OpenManage Enterprise Modular HTTPS port. | | **system\_query\_options** dictionary | | Options for pagination of the output. | | | **filter** string | | Filter records by the supported values. | | **template\_id** integer | | Unique Id of the template. | | **username** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular username. | Notes ----- Note * Run this module from a system that has direct access to DellEMC OpenManage Enterprise. * This module supports `check_mode`. Examples -------- ``` --- - name: Retrieve basic details of all templates dellemc.openmanage.ome_template_info: hostname: "192.168.0.1" username: "username" password: "password" - name: Retrieve details of a specific template identified by its template ID dellemc.openmanage.ome_template_info: hostname: "192.168.0.1" username: "username" password: "password" template_id: 1 - name: Get filtered template info based on name dellemc.openmanage.ome_template_info: hostname: "192.168.0.1" username: "username" password: "password" system_query_options: filter: "Name eq 'new template'" ``` 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 | on error | Overall template facts status. **Sample:** Failed to fetch the template facts | | **template\_info** dictionary | success | Details of the templates. **Sample:** {'192.168.0.1': {'CreatedBy': 'system', 'CreationTime': '1970-01-31 00:00:56.372144', 'Description': 'Tune workload for Performance Optimized Virtualization', 'HasIdentityAttributes': False, 'Id': 1, 'IdentityPoolId': 0, 'IsBuiltIn': True, 'IsPersistencePolicyValid': False, 'IsStatelessAvailable': False, 'LastUpdatedBy': None, 'LastUpdatedTime': '1970-01-31 00:00:56.372144', 'Name': 'iDRAC Enable Performance Profile for Virtualization', 'SourceDeviceId': 0, 'Status': 0, 'TaskId': 0, 'TypeId': 2, 'ViewTypeId': 4}} | ### Authors * Sajna Shetty(@Sajna-Shetty) ansible dellemc.openmanage.ome_network_vlan_info – Retrieves the information about networks VLAN(s) present in OpenManage Enterprise dellemc.openmanage.ome\_network\_vlan\_info – Retrieves the information about networks VLAN(s) present in OpenManage Enterprise =============================================================================================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.ome_network_vlan_info`. New in version 2.1.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows to retrieve the following. - A list of all the network VLANs with their detailed information. - Information about a specific network VLAN using VLAN *id* or VLAN *name*. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **hostname** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular IP address or hostname. | | **id** integer | | A unique identifier of the network VLAN available in the device. *id* and *name* are mutually exclusive. | | **name** string | | A unique name of the network VLAN available in the device. *name* and *id* are mutually exclusive. | | **password** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular password. | | **port** integer | **Default:**443 | OpenManage Enterprise or OpenManage Enterprise Modular HTTPS port. | | **username** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular username. | Notes ----- Note * Run this module from a system that has direct access to DellEMC OpenManage Enterprise. * This module supports `check_mode`. Examples -------- ``` --- - name: Retrieve information about all network VLANs(s) available in the device dellemc.openmanage.ome_network_vlan_info: hostname: "192.168.0.1" username: "username" password: "password" - name: Retrieve information about a network VLAN using the VLAN ID dellemc.openmanage.ome_network_vlan_info: hostname: "192.168.0.1" username: "username" password: "password" id: 12345 - name: Retrieve information about a network VLAN using the VLAN name dellemc.openmanage.ome_network_vlan_info: hostname: "192.168.0.1" username: "username" password: "password" name: "Network VLAN - 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 | | --- | --- | --- | | **error\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'MessageId': 'GEN1234', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **msg** string | success | Detailed information of the network VLAN(s). **Sample:** {'msg': 'Successfully retrieved the network VLAN information.', 'network\_vlan\_info': [{'CreatedBy': 'admin', 'CreationTime': '2020-09-02 18:48:42.129', 'Description': 'Description of Logical Network - 1', 'Id': 20057, 'InternalRefNWUUId': '42b9903d-93f8-4184-adcf-0772e4492f71', 'Name': 'Network VLAN - 1', 'Type': {'Description': 'This is the network for general purpose traffic. QOS Priority : Bronze.', 'Id': 1, 'Name': 'General Purpose (Bronze)', 'NetworkTrafficType': 'Ethernet', 'QosType': {'Id': 4, 'Name': 'Bronze'}, 'VendorCode': 'GeneralPurpose'}, 'UpdatedBy': None, 'UpdatedTime': '2020-09-02 18:48:42.129', 'VlanMaximum': 111, 'VlanMinimum': 111}, {'CreatedBy': 'admin', 'CreationTime': '2020-09-02 18:49:11.507', 'Description': 'Description of Logical Network - 2', 'Id': 20058, 'InternalRefNWUUId': 'e46ccb3f-ef57-4617-ac76-46c56594005c', 'Name': 'Network VLAN - 2', 'Type': {'Description': 'This is the network for general purpose traffic. QOS Priority : Silver.', 'Id': 2, 'Name': 'General Purpose (Silver)', 'NetworkTrafficType': 'Ethernet', 'QosType': {'Id': 3, 'Name': 'Silver'}, 'VendorCode': 'GeneralPurpose'}, 'UpdatedBy': None, 'UpdatedTime': '2020-09-02 18:49:11.507', 'VlanMaximum': 112, 'VlanMinimum': 112}]} | ### Authors * Deepak Joshi(@deepakjoshishri) ansible dellemc.openmanage.ome_template – Create, modify, deploy, delete, export, import and clone a template on OpenManage Enterprise dellemc.openmanage.ome\_template – Create, modify, deploy, delete, export, import and clone a template on OpenManage Enterprise =============================================================================================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.ome_template`. New in version 2.0.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module creates, modifies, deploys, deletes, exports, imports and clones a template on OpenManage Enterprise. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **attributes** dictionary | | Payload data for the template operations. All the variables in this option are added as payload for `create`, `modify`, `deploy`, `import`, and `clone` operations. It takes the following attributes. Attributes: List of dictionaries of attributes (if any) to be modified in the deployment template. This is applicable when *command* is `deploy` and `modify`. Name: Name of the template. This is mandatory when *command* is `create`, `import`, `clone`, and optional when *command* is `modify`. Description: Description for the template. This is applicable when *command* is `create` or `modify`. Fqdds: This allows to create a template using components from a specified reference server. One or more, of the following values must be specified in a comma-separated string: iDRAC, System, BIOS, NIC, LifeCycleController, RAID, and EventFilters. If none of the values are specified, the default value 'All' is selected. This is applicable when I (command) is `create`. Options: Options to control device shutdown or end power state post template deployment. This is applicable for `deploy` operation. Schedule: Provides options to schedule the deployment task immediately, or at a specified time. This is applicable when *command* is `deploy`. NetworkBootIsoModel: Payload to specify the ISO deployment details. This is applicable when *command* is `deploy`. Content: The XML content of template. This is applicable when *command* is `import`. Type: Template type ID, indicating the type of device for which configuration is supported, such as chassis and servers. This is applicable when *command* is `import`. TypeId: Template type ID, indicating the type of device for which configuration is supported, such as chassis and servers. This is applicable when *command* is `create`. Refer OpenManage Enterprise API Reference Guide for more details. | | **command** string | **Choices:*** **create** ← * modify * deploy * delete * export * import * clone | `create` creates a new template. `modify` modifies an existing template. `deploy` creates a template-deployment job. `delete` deletes an existing template. `export` exports an existing template. `import` creates a template from a specified configuration text in SCP XML format. `clone` creates a clone of a existing template. aliases: state | | **device\_group\_names** list / elements=string | **Default:**[] | Specify the list of groups when I (command) is `deploy`. Provide at least one of the mandatory options *device\_id*, *device\_service\_tag*, or *device\_group\_names*. | | **device\_id** list / elements=integer | **Default:**[] | Specify the list of targeted device ID(s) when *command* is `deploy`. When I (command) is `create`, specify the ID of a single device. Either *device\_id* or *device\_service\_tag* is mandatory or both can be applicable. | | **device\_service\_tag** list / elements=string | **Default:**[] | Specify the list of targeted device service tags when I (command) is `deploy`. When *command* is `create`, specify the service tag of a single device. Either *device\_id* or *device\_service\_tag* is mandatory or both can be applicable. | | **hostname** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular IP address or hostname. | | **password** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular password. | | **port** integer | **Default:**443 | OpenManage Enterprise or OpenManage Enterprise Modular HTTPS port. | | **template\_id** integer | | ID of the existing template. This option is applicable when *command* is `modify`, `deploy`, `delete` and `export`. This option is mutually exclusive with *template\_name*. | | **template\_name** string | | Name of the existing template. This option is applicable when *command* is `modify`, `deploy`, `delete` and `export`. This option is mutually exclusive with *template\_id*. | | **template\_view\_type** string | **Choices:*** **Deployment** ← * Compliance * Inventory * Sample * None | Select the type of view of the OME template. This is applicable when *command* is `create`,`clone` and `import`. | | **username** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular username. | Notes ----- Note * Run this module from a system that has direct access to DellEMC OpenManage Enterprise. * This module does not support `check_mode`. Examples -------- ``` --- - name: Create a template from a reference device dellemc.openmanage.ome_template: hostname: "192.168.0.1" username: "username" password: "password" device_id: 25123 attributes: Name: "New Template" Description: "New Template description" - name: Modify template name, description, and attribute value dellemc.openmanage.ome_template: hostname: "192.168.0.1" username: "username" password: "password" command: "modify" template_id: 12 attributes: Name: "New Custom Template" Description: "Custom Template Description" # Attributes to be modified in the template. # For information on any attribute id, use API /TemplateService/Templates(Id)/Views(Id)/AttributeViewDetails # This section is optional Attributes: - Id: 1234 Value: "Test Attribute" IsIgnored: false - name: Deploy template on multiple devices dellemc.openmanage.ome_template: hostname: "192.168.0.1" username: "username" password: "password" command: "deploy" template_id: 12 device_id: - 12765 - 10173 device_service_tag: - 'SVTG123' - 'SVTG456' - name: Deploy template on groups dellemc.openmanage.ome_template: hostname: "192.168.0.1" username: "username" password: "password" command: "deploy" template_id: 12 device_group_names: - server_group_1 - server_group_2 - name: Deploy template on multiple devices along with the attributes values to be modified on the target devices dellemc.openmanage.ome_template: hostname: "192.168.0.1" username: "username" password: "password" command: "deploy" template_id: 12 device_id: - 12765 - 10173 device_service_tag: - 'SVTG123' attributes: # Device specific attributes to be modified during deployment. # For information on any attribute id, use API /TemplateService/Templates(Id)/Views(Id)/AttributeViewDetails # This section is optional Attributes: # specific device where attribute to be modified at deployment run-time. # The DeviceId should be mentioned above in the 'device_id' section. # Service tags not allowed. - DeviceId: 12765 Attributes: - Id : 15645 Value : "0.0.0.0" IsIgnored : false - DeviceId: 10173 Attributes: - Id : 18968, Value : "hostname-1" IsIgnored : false - name: Deploy template and Operating System (OS) on multiple devices dellemc.openmanage.ome_template: hostname: "192.168.0.1" username: "username" password: "password" command: "deploy" template_id: 12 device_id: - 12765 device_service_tag: - 'SVTG123' attributes: # Include this to install OS on the devices. # This section is optional NetworkBootIsoModel: BootToNetwork: true ShareType: "NFS" IsoTimeout: 1 # allowable values(1,2,4,8,16) in hours IsoPath: "/home/iso_path/filename.iso" ShareDetail: IpAddress: "192.168.0.2" ShareName: "sharename" User: "share_user" Password: "share_password" Options: EndHostPowerState: 1 ShutdownType: 0 TimeToWaitBeforeShutdown: 300 Schedule: RunLater: true RunNow: false - name: "Deploy template on multiple devices and changes the device-level attributes. After the template is deployed, install OS using its image" dellemc.openmanage.ome_template: hostname: "192.168.0.1" username: "username" password: "password" command: "deploy" template_id: 12 device_id: - 12765 - 10173 device_service_tag: - 'SVTG123' - 'SVTG456' attributes: Attributes: - DeviceId: 12765 Attributes: - Id : 15645 Value : "0.0.0.0" IsIgnored : false - DeviceId: 10173 Attributes: - Id : 18968, Value : "hostname-1" IsIgnored : false NetworkBootIsoModel: BootToNetwork: true ShareType: "NFS" IsoTimeout: 1 # allowable values(1,2,4,8,16) in hours IsoPath: "/home/iso_path/filename.iso" ShareDetail: IpAddress: "192.168.0.2" ShareName: "sharename" User: "share_user" Password: "share_password" Options: EndHostPowerState: 1 ShutdownType: 0 TimeToWaitBeforeShutdown: 300 Schedule: RunLater: true RunNow: false - name: Delete template dellemc.openmanage.ome_template: hostname: "192.168.0.1" username: "username" password: "password" command: "delete" template_id: 12 - name: Export a template dellemc.openmanage.ome_template: hostname: "192.168.0.1" username: "username" password: "password" command: "export" template_id: 12 # Start of example to export template to a local xml file - name: Export template to a local xml file dellemc.openmanage.ome_template: hostname: "192.168.0.1" username: "username" password: "password" command: "export" template_name: "my_template" register: result - name: Save template into a file ansible.builtin.copy: content: "{{ result.Content}}" dest: "/path/to/exported_template.xml" # End of example to export template to a local xml file - name: Clone a template dellemc.openmanage.ome_template: hostname: "192.168.0.1" username: "username" password: "password" command: "clone" template_id: 12 attributes: Name: "New Cloned Template Name" - name: Import template from XML content dellemc.openmanage.ome_template: hostname: "192.168.0.1" username: "username" password: "password" command: "import" attributes: Name: "Imported Template Name" # Template Type from TemplateService/TemplateTypes Type: 2 # xml string content Content: "<SystemConfiguration Model=\"PowerEdge R940\" ServiceTag=\"SVCTAG1\" TimeStamp=\"Tue Sep 24 09:20:57.872551 2019\">\n<Component FQDD=\"AHCI.Slot.6-1\">\n<Attribute Name=\"RAIDresetConfig\">True</Attribute>\n<Attribute Name=\"RAIDforeignConfig\">Clear</Attribute>\n </Component>\n<Component FQDD=\"Disk.Direct.0-0:AHCI.Slot.6-1\">\n<Attribute Name=\"RAIDPDState\">Ready </Attribute>\n<Attribute Name=\"RAIDHotSpareStatus\">No</Attribute>\n</Component>\n <Component FQDD=\"Disk.Direct.1-1:AHCI.Slot.6-1\">\n<Attribute Name=\"RAIDPDState\">Ready</Attribute>\n <Attribute Name=\"RAIDHotSpareStatus\">No</Attribute>\n</Component>\n</SystemConfiguration>\n" - name: Import template from local XML file dellemc.openmanage.ome_template: hostname: "192.168.0.1" username: "username" password: "password" command: "import" attributes: Name: "Imported Template Name" Type: 2 Content: "{{ lookup('ansible.builtin.file.', '/path/to/xmlfile') }}" ``` 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** string | success, when *command* is `export` | XML content of the exported template. This content can be written to a xml file. **Sample:** <SystemConfiguration Model="PowerEdge R940" ServiceTag="DG22TR2" TimeStamp="Tue Sep 24 09:20:57.872551 2019"> <Component FQDD="AHCI.Slot.6-1"> <Attribute Name="RAIDresetConfig">True</Attribute> <Attribute Name="RAIDforeignConfig">Clear</Attribute> </Component> <Component FQDD="Disk.Direct.0-0:AHCI.Slot.6-1"> <Attribute Name="RAIDPDState">Ready</Attribute> <Attribute Name="RAIDHotSpareStatus">No</Attribute> </Component> <Component FQDD="Disk.Direct.1-1:AHCI.Slot.6-1"> <Attribute Name="RAIDPDState">Ready </Attribute> <Attribute Name="RAIDHotSpareStatus">No</Attribute> </Component> </SystemConfiguration> | | **error\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'MessageId': 'GEN1234', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **msg** string | always | Overall status of the template operation. **Sample:** Successfully created a template with ID 23 | | **return\_id** integer | success, when *command* is `create`, `modify`, `import`, `clone` and `deploy` | ID of the template for `create`, `modify`, `import` and `clone` or task created in case of `deploy`. **Sample:** 12 | | **TemplateId** integer | success, when *command* is `export` | ID of the template for `export`. **Sample:** 13 | ### Authors * Jagadeesh N V (@jagadeeshnv)
programming_docs
ansible dellemc.openmanage.ome_application_network_proxy – Updates the proxy configuration on OpenManage Enterprise dellemc.openmanage.ome\_application\_network\_proxy – Updates the proxy configuration on OpenManage Enterprise ============================================================================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.ome_application_network_proxy`. New in version 2.1.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows to configure a network proxy on OpenManage Enterprise. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **enable\_authentication** boolean | **Choices:*** no * yes | Enable or disable proxy authentication. If *enable\_authentication* is true, *proxy\_username* and *proxy\_password* must be provided. If *enable\_authentication* is false, the proxy username and password are set to its default values. | | **enable\_proxy** boolean / required | **Choices:*** no * yes | Enables or disables the HTTP proxy configuration. If *enable proxy* is false, then the HTTP proxy configuration is set to its default value. | | **hostname** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular IP address or hostname. | | **ip\_address** string | | Proxy server address. This option is mandatory when *enable\_proxy* is true. | | **password** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular password. | | **port** integer | **Default:**443 | OpenManage Enterprise or OpenManage Enterprise Modular HTTPS port. | | **proxy\_password** string | | Proxy server password. This option is mandatory when *enable\_authentication* is true. | | **proxy\_port** integer | | Proxy server's port number. This option is mandatory when *enable\_proxy* is true. | | **proxy\_username** string | | Proxy server username. This option is mandatory when *enable\_authentication* is true. | | **username** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular username. | Notes ----- Note * Run this module from a system that has direct access to DellEMC OpenManage Enterprise. * This module does not support `check_mode`. Examples -------- ``` --- - name: Update proxy configuration and enable authentication dellemc.openmanage.ome_application_network_proxy: hostname: "192.168.0.1" username: "username" password: "password" enable_proxy: true ip_address: "192.168.0.2" proxy_port: 444 enable_authentication: true proxy_username: "proxy_username" proxy_password: "proxy_password" - name: Reset proxy authentication dellemc.openmanage.ome_application_network_proxy: hostname: "192.168.0.1" username: "username" password: "password" enable_proxy: true ip_address: "192.168.0.2" proxy_port: 444 enable_authentication: false - name: Reset proxy configuration dellemc.openmanage.ome_application_network_proxy: hostname: "192.168.0.1" username: "username" password: "password" enable_proxy: false ``` 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\_info** dictionary | on HTTP error | Details of the HTTP error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to complete the request because the input value for PortNumber is missing or an invalid value is entered.', 'MessageArgs': ['PortNumber'], 'MessageId': 'CGEN6002', 'RelatedProperties': [], 'Resolution': 'Enter a valid value and retry the operation.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **msg** string | always | Overall status of the network proxy configuration change. **Sample:** Successfully updated network proxy configuration. | | **proxy\_configuration** dictionary | success | Updated application network proxy configuration. **Sample:** {'EnableAuthentication': True, 'EnableProxy': True, 'IpAddress': '192.168.0.2', 'Password': None, 'PortNumber': 444, 'Username': 'root'} | ### Authors * Sajna Shetty(@Sajna-Shetty) ansible dellemc.openmanage.ome_template_network_vlan – Set tagged and untagged vlans to native network card supported by a template on OpenManage Enterprise dellemc.openmanage.ome\_template\_network\_vlan – Set tagged and untagged vlans to native network card supported by a template on OpenManage Enterprise ======================================================================================================================================================= Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.ome_template_network_vlan`. New in version 2.0.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows to set tagged and untagged vlans to native network card supported by a template on OpenManage Enterprise. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **hostname** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular IP address or hostname. | | **nic\_identifier** string / required | | Display name of NIC port in the template for VLAN configuration. | | **password** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular password. | | **port** integer | **Default:**443 | OpenManage Enterprise or OpenManage Enterprise Modular HTTPS port. | | **propagate\_vlan** boolean added in 3.4.0 of dellemc.openmanage | **Choices:*** no * **yes** ← | To deploy the modified VLAN settings immediately without rebooting the server. This option will be applied only when there are changes to the VLAN configuration. | | **tagged\_networks** list / elements=dictionary | | List of tagged VLANs and their corresponding NIC ports. | | | **port** integer / required | | NIC port number of the tagged VLAN | | | **tagged\_network\_ids** list / elements=integer | | List of IDs of the tagged VLANs Enter [] to remove the tagged VLAN from a port. List of *tagged\_network\_ids* is combined with list of *tagged\_network\_names* when adding tagged VLANs to a port. To get the VLAN network ID use the API [https://hostname/api/NetworkConfigurationService/Networks](#) | | | **tagged\_network\_names** list / elements=string | | List of names of tagged VLANs Enter [] to remove the tagged VLAN from a port. List of *tagged\_network\_names* is combined with list of *tagged\_network\_ids* when adding tagged VLANs to a port. | | **template\_id** integer | | Id of the template. It is mutually exclusive with *template\_name*. | | **template\_name** string | | Name of the template. It is mutually exclusive with *template\_id*. | | **untagged\_networks** list / elements=dictionary | | List of untagged networks and their corresponding NIC ports. | | | **port** integer / required | | NIC port number of the untagged VLAN. | | | **untagged\_network\_id** integer | | ID of the untagged VLAN Enter 0 to clear the untagged VLAN from the port. This option is mutually exclusive with *untagged\_network\_name* To get the VLAN network ID use the API [https://hostname/api/NetworkConfigurationService/Networks](#) | | | **untagged\_network\_name** string | | name of the vlan for untagging provide 0 for clearing the untagging for this *port* This parameter is mutually exclusive with *untagged\_network\_id* | | **username** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular username. | Notes ----- Note * Run this module from a system that has direct access to DellEMC OpenManage Enterprise. * This module does not support `check_mode`. Examples -------- ``` --- - name: Add tagged or untagged VLANs to a template using VLAN ID and name dellemc.openmanage.ome_template_network_vlan: hostname: "192.168.0.1" username: "username" password: "password" template_id: 78 nic_identifier: NIC Slot 4 untagged_networks: - port: 1 untagged_network_id: 127656 - port: 2 untagged_network_name: vlan2 tagged_networks: - port: 1 tagged_network_ids: - 12767 - 12768 - port: 4 tagged_network_ids: - 12767 - 12768 tagged_network_names: - vlan3 - port: 2 tagged_network_names: - vlan4 - vlan1 - name: Clear the tagged and untagged VLANs from a template dellemc.openmanage.ome_template_network_vlan: hostname: "192.168.0.1" username: "username" password: "password" template_id: 78 nic_identifier: NIC Slot 4 untagged_networks: # For removing the untagged VLANs for the port 1 and 2 - port: 1 untagged_network_id: 0 - port: 2 untagged_network_name: 0 tagged_networks: # For removing the tagged VLANs for port 1, 4 and 2 - port: 1 tagged_network_ids: [] - port: 4 tagged_network_ids: [] tagged_network_names: [] - port: 2 tagged_network_names: [] ``` 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\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to complete the request because TemplateId does not exist or is not applicable for the resource URI.', 'MessageArgs': ['TemplateId'], 'MessageId': 'CGEN1004', 'RelatedProperties': [], 'Resolution': "Check the request resource URI. Refer to the OpenManage Enterprise-Modular User's Guide for more information about resource URI and its properties.", 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **msg** string | always | Overall status of the template vlan operation. **Sample:** Successfully applied the network settings to template | ### Authors * Jagadeesh N V(@jagadeeshnv) ansible dellemc.openmanage.idrac_firmware_info – Get Firmware Inventory dellemc.openmanage.idrac\_firmware\_info – Get Firmware Inventory ================================================================= Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.idrac_firmware_info`. New in version 3.0.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Get Firmware Inventory. Requirements ------------ The below requirements are needed on the host that executes this module. * omsdk * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **idrac\_ip** string / required | | iDRAC IP Address. | | **idrac\_password** string / required | | iDRAC user password. aliases: idrac\_pwd | | **idrac\_port** integer | **Default:**443 | iDRAC port. | | **idrac\_user** string / required | | iDRAC username. | Notes ----- Note * Run this module from a system that has direct access to DellEMC iDRAC. * This module supports `check_mode`. Examples -------- ``` --- - name: Get Installed Firmware Inventory dellemc.openmanage.idrac_firmware_info: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_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 module: | Key | Returned | Description | | --- | --- | --- | | **error\_info** dictionary | on HTTP error | Details of the HTTP Error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to process the request because an error occurred.', 'MessageArgs': [], 'MessageId': 'GEN1234', 'RelatedProperties': [], 'Resolution': 'Retry the operation. If the issue persists, contact your system administrator.', 'Severity': 'Critical'}], 'code': 'Base.1.0.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **firmware\_info** dictionary | success | Details of the firmware. **Sample:** {'Firmware': [{'BuildNumber': '0', 'Classifications': '10', 'ComponentID': '102573', 'ComponentType': 'FRMW', 'DeviceID': None, 'ElementName': 'Power Supply.Slot.1', 'FQDD': 'PSU.Slot.1', 'HashValue': None, 'IdentityInfoType': 'OrgID:ComponentType:ComponentID', 'IdentityInfoValue': 'DCIM:firmware:102573', 'InstallationDate': '2018-11-22T03:58:23Z', 'InstanceID': 'DCIM:INSTALLED#0x15\_\_PSU.Slot.1', 'IsEntity': 'true', 'Key': 'DCIM:INSTALLED#0x15\_\_PSU.Slot.1', 'MajorVersion': '0', 'MinorVersion': '3', 'RevisionNumber': '67', 'RevisionString': None, 'Status': 'Installed', 'SubDeviceID': None, 'SubVendorID': None, 'Updateable': 'true', 'VendorID': None, 'VersionString': '00.3D.67', 'impactsTPMmeasurements': 'false'}]} | | **msg** string | always | Fetching the firmware inventory details. **Sample:** Successfully fetched the firmware inventory details. | ### Authors * Rajeev Arakkal (@rajeevarakkal) ansible dellemc.openmanage.ome_user – Create, modify or delete a user on OpenManage Enterprise dellemc.openmanage.ome\_user – Create, modify or delete a user on OpenManage Enterprise ======================================================================================= Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.ome_user`. New in version 2.0.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module creates, modifies or deletes a user on OpenManage Enterprise. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **attributes** dictionary | **Default:**{} | Payload data for the user operations. It can take the following attributes for `present`. UserTypeId, DirectoryServiceId, Description, Name, Password, UserName, RoleId, Locked, Enabled. OME will throw error if required parameter is not provided for operation. Refer OpenManage Enterprise API Reference Guide for more details. | | **hostname** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular IP address or hostname. | | **name** string | | Unique Name of the user to be deleted. Either *user\_id* or *name* is mandatory for `absent` operation. | | **password** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular password. | | **port** integer | **Default:**443 | OpenManage Enterprise or OpenManage Enterprise Modular HTTPS port. | | **state** string | **Choices:*** **present** ← * absent | `present` creates a user in case the *UserName* provided inside *attributes* does not exist. `present` modifies a user in case the *UserName* provided inside *attributes* exists. `absent` deletes an existing user. | | **user\_id** integer | | Unique ID of the user to be deleted. Either *user\_id* or *name* is mandatory for `absent` operation. | | **username** string / required | | OpenManage Enterprise or OpenManage Enterprise Modular username. | Notes ----- Note * Run this module from a system that has direct access to DellEMC OpenManage Enterprise. * This module does not support `check_mode`. Examples -------- ``` --- - name: Create user with required parameters dellemc.openmanage.ome_user: hostname: "192.168.0.1" username: "username" password: "password" attributes: UserName: "user1" Password: "UserPassword" RoleId: "10" Enabled: True - name: Create user with all parameters dellemc.openmanage.ome_user: hostname: "192.168.0.1" username: "username" password: "password" attributes: UserName: "user2" Description: "user2 description" Password: "UserPassword" RoleId: "10" Enabled: True DirectoryServiceId: 0 UserTypeId: 1 Locked: False Name: "user2" - name: Modify existing user dellemc.openmanage.ome_user: hostname: "192.168.0.1" username: "username" password: "password" state: "present" attributes: UserName: "user3" RoleId: "10" Enabled: True Description: "Modify user Description" - name: Delete existing user using id dellemc.openmanage.ome_user: hostname: "192.168.0.1" username: "username" password: "password" state: "absent" user_id: 1234 - name: Delete existing user using name dellemc.openmanage.ome_user: hostname: "192.168.0.1" username: "username" password: "password" state: "absent" name: "name" ``` 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 | Overall status of the user operation. **Sample:** Successfully created a User | | **user\_status** dictionary | When *state* is `present`. | Details of the user operation, when *state* is `present`. **Sample:** {'Description': 'Test user creation', 'DirectoryServiceId': 0, 'Enabled': True, 'Id': '61546', 'IsBuiltin': False, 'Locked': False, 'Name': 'test', 'Password': None, 'PlainTextPassword': None, 'RoleId': '10', 'UserName': 'test', 'UserTypeId': 1} | ### Authors * Sajna Shetty(@Sajna-Shetty)
programming_docs
ansible dellemc.openmanage.redfish_firmware – To perform a component firmware update using the image file available on the local or remote system dellemc.openmanage.redfish\_firmware – To perform a component firmware update using the image file available on the local or remote system ========================================================================================================================================== Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.redfish_firmware`. New in version 2.1.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows the firmware update of only one component at a time. If the module is run for more than one component, an error message is returned. * Depending on the component, the firmware update is applied after an automatic or manual reboot. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7.5 * urllib3 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **baseuri** string / required | | IP address of the target out-of-band controller. For example- <ipaddress>:<port>. | | **image\_uri** string / required | | Firmware Image location URI or local path. For example- [http://<web\_address>/components.exe](#) or /home/firmware\_repo/component.exe. | | **password** string / required | | Password of the target out-of-band controller. | | **transfer\_protocol** string | **Choices:*** CIFS * FTP * **HTTP** ← * HTTPS * NSF * OEM * SCP * SFTP * TFTP | Protocol used to transfer the firmware image file. Applicable for URI based update. | | **username** string / required | | Username of the target out-of-band controller. | Notes ----- Note * Run this module from a system that has direct access to Redfish APIs. * This module does not support `check_mode`. Examples -------- ``` --- - name: Update the firmware from a single executable file available in a HTTP protocol dellemc.openmanage.redfish_firmware: baseuri: "192.168.0.1" username: "user_name" password: "user_password" image_uri: "http://192.168.0.2/firmware_repo/component.exe" transfer_protocol: "HTTP" - name: Update the firmware from a single executable file available in a local path dellemc.openmanage.redfish_firmware: baseuri: "192.168.0.1" username: "user_name" password: "user_password" image_uri: "/home/firmware_repo/component.exe" ``` 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\_info** dictionary | on http error | Details of http error. **Sample:** {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to complete the operation because the JSON data format entered is invalid.', 'Resolution': 'Do the following and the retry the operation: 1) Enter the correct JSON data format and retry the operation. 2) Make sure that no syntax error is present in JSON data format. 3) Make sure that a duplicate key is not present in JSON data format.', 'Severity': 'Critical'}, {'Message': 'The request body submitted was malformed JSON and could not be parsed by the receiving service.', 'Resolution': 'Ensure that the request body is valid JSON and resubmit the request.', 'Severity': 'Critical'}], 'code': 'Base.1.2.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information.'}} | | **msg** string | always | Overall status of the firmware update task. **Sample:** Successfully submitted the firmware update task. | | **task** dictionary | success | Returns ID and URI of the created task. **Sample:** {'id': 'JID\_XXXXXXXXXXXX', 'uri': '/redfish/v1/TaskService/Tasks/JID\_XXXXXXXXXXXX'} | ### Authors * Felix Stephen (@felixs88) ansible dellemc.openmanage.idrac_firmware – Firmware update from a repository on a network share (CIFS, NFS, HTTP, HTTPS, FTP) dellemc.openmanage.idrac\_firmware – Firmware update from a repository on a network share (CIFS, NFS, HTTP, HTTPS, FTP) ======================================================================================================================= Note This plugin is part of the [dellemc.openmanage collection](https://galaxy.ansible.com/dellemc/openmanage) (version 3.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.openmanage`. To use it in a playbook, specify: `dellemc.openmanage.idrac_firmware`. New in version 2.1.0: of dellemc.openmanage * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Update the Firmware by connecting to a network share (CIFS, NFS, HTTP, HTTPS, FTP) that contains a catalog of available updates. * Network share should contain a valid repository of Update Packages (DUPs) and a catalog file describing the DUPs. * All applicable updates contained in the repository are applied to the system. * This feature is available only with iDRAC Enterprise License. Requirements ------------ The below requirements are needed on the host that executes this module. * omsdk * python >= 2.7.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **apply\_update** boolean | **Choices:*** no * **yes** ← | If *apply\_update* is set to `True`, then the packages are applied. If *apply\_update* is set to `False`, no updates are applied, and a catalog report of packages is generated and returned. | | **catalog\_file\_name** string | **Default:**"Catalog.xml" | Catalog file name relative to the *share\_name*. | | **idrac\_ip** string / required | | iDRAC IP Address. | | **idrac\_password** string / required | | iDRAC user password. aliases: idrac\_pwd | | **idrac\_port** integer | **Default:**443 | iDRAC port. | | **idrac\_user** string / required | | iDRAC username. | | **ignore\_cert\_warning** boolean | **Choices:*** no * **yes** ← | Specifies if certificate warnings are ignored when HTTPS share is used. If `True` option is set, then the certificate warnings are ignored. | | **job\_wait** boolean | **Choices:*** no * **yes** ← | Whether to wait for job completion or not. | | **reboot** boolean | **Choices:*** **no** ← * yes | Provides the option to apply the update packages immediately or in the next reboot. If *reboot* is set to `True`, then the packages are applied immediately. If *reboot* is set to `False`, then the packages are staged and applied in the next reboot. Packages that do not require a reboot are applied immediately irrespective of I (reboot). | | **share\_mnt** string | | Local mount path of the network share with read-write permission for ansible user. This option is not applicable for HTTP, HTTPS, and FTP shares. | | **share\_name** string / required | | Network share path of update repository. CIFS, NFS, HTTP, HTTPS and FTP share types are supported. | | **share\_password** string | | Network share user password. This option is mandatory for CIFS Network Share. aliases: share\_pwd | | **share\_user** string | | Network share user in the format 'user@domain' or 'domain\\user' if user is part of a domain else 'user'. This option is mandatory for CIFS Network Share. | Notes ----- Note * Run this module from a system that has direct access to DellEMC iDRAC. * This module supports `check_mode`. Examples -------- ``` --- - name: Update firmware from repository on a NFS Share dellemc.openmanage.idrac_firmware: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_password" share_name: "192.168.0.0:/share" reboot: True job_wait: True apply_update: True catalog_file_name: "Catalog.xml" - name: Update firmware from repository on a CIFS Share dellemc.openmanage.idrac_firmware: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_password" share_name: "full_cifs_path" share_user: "share_user" share_password: "share_password" reboot: True job_wait: True apply_update: True catalog_file_name: "Catalog.xml" - name: Update firmware from repository on a HTTP dellemc.openmanage.idrac_firmware: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_password" share_name: "http://downloads.dell.com" reboot: True job_wait: True apply_update: True - name: Update firmware from repository on a HTTPS dellemc.openmanage.idrac_firmware: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_password" share_name: "https://downloads.dell.com" reboot: True job_wait: True apply_update: True - name: Update firmware from repository on a FTP dellemc.openmanage.idrac_firmware: idrac_ip: "192.168.0.1" idrac_user: "user_name" idrac_password: "user_password" share_name: "ftp://ftp.dell.com" reboot: True job_wait: True apply_update: 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 | | --- | --- | --- | | **msg** string | always | Overall firmware update status. **Sample:** Successfully updated the firmware. | | **update\_status** dictionary | success | Firmware Update job and progress details from the iDRAC. **Sample:** {'InstanceID': 'JID\_XXXXXXXXXXXX', 'JobStartTime': 'NA', 'JobState': 'Completed', 'Message': 'Job completed successfully.', 'MessageId': 'REDXXX', 'Name': 'Repository Update', 'Status': 'Success'} | ### Authors * Rajeev Arakkal (@rajeevarakkal) * Felix Stephen (@felixs88) ansible Dellemc.Os6 Dellemc.Os6 =========== Collection version 1.0.7 Plugin Index ------------ These are the plugins in the dellemc.os6 collection ### Cliconf Plugins * [os6](os6_cliconf#ansible-collections-dellemc-os6-os6-cliconf) – Use os6 cliconf to run command on Dell OS6 platform ### Modules * [os6\_command](os6_command_module#ansible-collections-dellemc-os6-os6-command-module) – Run commands on devices running Dell EMC OS6 * [os6\_config](os6_config_module#ansible-collections-dellemc-os6-os6-config-module) – Manage Dell EMC OS6 configuration sections * [os6\_facts](os6_facts_module#ansible-collections-dellemc-os6-os6-facts-module) – Collect facts from devices running Dell EMC OS6 See also List of [collections](../../index#list-of-collections) with docs hosted here. ansible dellemc.os6.os6_facts – Collect facts from devices running Dell EMC OS6 dellemc.os6.os6\_facts – Collect facts from devices running Dell EMC OS6 ======================================================================== Note This plugin is part of the [dellemc.os6 collection](https://galaxy.ansible.com/dellemc/os6) (version 1.0.7). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.os6`. To use it in a playbook, specify: `dellemc.os6.os6_facts`. * [Synopsis](#synopsis) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Collects a base set of device facts from a remote device that is running OS6. This module prepends all of the base network fact keys with `ansible_net_<fact>`. The facts module will always collect a base set of facts from the device and can enable or disable collection of additional facts. Note This module has a corresponding [action plugin](../../../plugins/action#action-plugins). Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **gather\_subset** list / elements=string | **Default:**["!config"] | When supplied, this argument will restrict the facts collected to a given subset. Possible values for this argument include all, hardware, config, and interfaces. Can specify a list of values to include a larger subset. Values can also be used with an initial `M(!`) to specify that a specific subset should not be collected. | | **provider** dictionary | | A dict object containing connection details. | | | **auth\_pass** string | | Specifies the password to use if required to enter privileged mode on the remote device. If *authorize* is false, then this argument does nothing. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_AUTH_PASS` will be used instead. | | | **authorize** boolean | **Choices:*** no * yes | Instructs the module to enter privileged mode on the remote device before sending any commands. If not specified, the device will attempt to execute all commands in non-privileged mode. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_AUTHORIZE` will be used instead. | | | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. | | | **password** string | | Password to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. | | | **port** integer | | Specifies the port to use when building the connection to the remote device. | | | **ssh\_keyfile** path | | Path to an ssh key used to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. | | | **timeout** integer | | Specifies idle timeout (in seconds) for the connection. Useful if the console freezes before continuing. For example when saving configurations. | | | **username** string | | User to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. | Notes ----- Note * For more information on using Ansible to manage Dell EMC Network devices see <https://www.ansible.com/ansible-dell-networking>. Examples -------- ``` # Collect all facts from the device - os6_facts: gather_subset: all # Collect only the config and default facts - os6_facts: gather_subset: - config # Do not collect hardware facts - os6_facts: gather_subset: - "!interfaces" ``` 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\_net\_config** string | When config is configured. | The current active config from the device. | | **ansible\_net\_gather\_subset** list / elements=string | always. | The list of fact subsets collected from the device. | | **ansible\_net\_hostname** string | always. | The configured hostname of the device. | | **ansible\_net\_image** string | always | The image file that the device is running. | | **ansible\_net\_interfaces** dictionary | When interfaces is configured. | A hash of all interfaces running on the system. | | **ansible\_net\_memfree\_mb** integer | When hardware is configured. | The available free memory on the remote device in MB. | | **ansible\_net\_memtotal\_mb** integer | When hardware is configured. | The total memory on the remote device in MB. | | **ansible\_net\_model** string | always. | The model name returned from the device. | | **ansible\_net\_neighbors** dictionary | When interfaces is configured. | The list of LLDP neighbors from the remote device. | | **ansible\_net\_serialnum** string | always. | The serial number of the remote device. | | **ansible\_net\_version** string | always. | The operating system version running on the remote device. | ### Authors * Abirami N (@abirami-n) ansible dellemc.os6.os6_config – Manage Dell EMC OS6 configuration sections dellemc.os6.os6\_config – Manage Dell EMC OS6 configuration sections ==================================================================== Note This plugin is part of the [dellemc.os6 collection](https://galaxy.ansible.com/dellemc/os6) (version 1.0.7). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.os6`. To use it in a playbook, specify: `dellemc.os6.os6_config`. * [Synopsis](#synopsis) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * OS6 configurations use a simple block indent file syntax for segmenting configuration into sections. This module provides an implementation for working with OS6 configuration sections in a deterministic way. Note This module has a corresponding [action plugin](../../../plugins/action#action-plugins). Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **after** list / elements=string | | The ordered set of commands to append to the end of the command stack if a change needs to be made. Just like with *before* this allows the playbook designer to append a set of commands to be executed after the command set. | | **backup** boolean | **Choices:*** **no** ← * yes | This argument will cause the module to create a full backup of the current `running-config` from the remote device before any changes are made. If the `backup_options` value is not given, the backup file is written to the `backup` folder in the playbook root directory. If the directory does not exist, it is created. | | **backup\_options** dictionary | | This is a dict object containing configurable options related to backup file path. The value of this option is read only when `backup` is set to *yes*, if `backup` is set to *no* this option will be silently ignored. | | | **dir\_path** path | | This option provides the path ending with directory name in which the backup configuration file will be stored. If the directory does not exist it will be first created and the filename is either the value of `filename` or default filename as described in `filename` options description. If the path value is not given in that case a *backup* directory will be created in the current working directory and backup configuration will be copied in `filename` within *backup* directory. | | | **filename** string | | The filename to be used to store the backup configuration. If the the filename is not given it will be generated based on the hostname, current time and date in format defined by <hostname>\_config.<current-date>@<current-time> | | **before** list / elements=string | | The ordered set of commands to push on to the command stack if a change needs to be made. This allows the playbook designer the opportunity to perform configuration commands prior to pushing any changes without affecting how the set of commands are matched against the system. | | **config** string | | The module, by default, will connect to the remote device and retrieve the current running-config to use as a base for comparing against the contents of source. There are times when it is not desirable to have the task get the current running-config for every task in a playbook. The *config* argument allows the implementer to pass in the configuration to use as the base config for comparison. | | **lines** list / elements=string | | The ordered set of commands that should be configured in the section. The commands must be the exact same commands as found in the device running-config. Be sure to note the configuration command syntax as some commands are automatically modified by the device config parser. This argument is mutually exclusive with *src*. aliases: commands | | **match** string | **Choices:*** **line** ← * strict * exact * none | Instructs the module on the way to perform the matching of the set of commands against the current device config. If match is set to *line*, commands are matched line by line. If match is set to *strict*, command lines are matched with respect to position. If match is set to *exact*, command lines must be an equal match. Finally, if match is set to *none*, the module will not attempt to compare the source configuration with the running configuration on the remote device. | | **parents** list / elements=string | | The ordered set of parents that uniquely identify the section or hierarchy the commands should be checked against. If the parents argument is omitted, the commands are checked against the set of top level or global commands. | | **provider** dictionary | | A dict object containing connection details. | | | **auth\_pass** string | | Specifies the password to use if required to enter privileged mode on the remote device. If *authorize* is false, then this argument does nothing. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_AUTH_PASS` will be used instead. | | | **authorize** boolean | **Choices:*** no * yes | Instructs the module to enter privileged mode on the remote device before sending any commands. If not specified, the device will attempt to execute all commands in non-privileged mode. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_AUTHORIZE` will be used instead. | | | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. | | | **password** string | | Password to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. | | | **port** integer | | Specifies the port to use when building the connection to the remote device. | | | **ssh\_keyfile** path | | Path to an ssh key used to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. | | | **timeout** integer | | Specifies idle timeout (in seconds) for the connection. Useful if the console freezes before continuing. For example when saving configurations. | | | **username** string | | User to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. | | **replace** string | **Choices:*** **line** ← * block | Instructs the module on the way to perform the configuration on the device. If the replace argument is set to *line* then the modified lines are pushed to the device in configuration mode. If the replace argument is set to *block* then the entire command block is pushed to the device in configuration mode if any line is not correct. | | **save** boolean | **Choices:*** **no** ← * yes | The `save` argument instructs the module to save the running- config to the startup-config at the conclusion of the module running. If check mode is specified, this argument is ignored. | | **src** path | | Specifies the source path to the file that contains the configuration or configuration template to load. The path to the source file can either be the full path on the Ansible control host or a relative path from the playbook or role root directory. This argument is mutually exclusive with *lines*. | | **update** string | **Choices:*** **merge** ← * check | The *update* argument controls how the configuration statements are processed on the remote device. Valid choices for the *update* argument are *merge* and *check*. When you set this argument to *merge*, the configuration changes merge with the current device running configuration. When you set this argument to *check* the configuration updates are determined but not actually configured on the remote device. | Notes ----- Note * For more information on using Ansible to manage Dell EMC Network devices see <https://www.ansible.com/ansible-dell-networking>. Examples -------- ``` - os6_config: lines: ['hostname {{ inventory_hostname }}'] - os6_config: lines: - 10 permit ip 1.1.1.1 any log - 20 permit ip 2.2.2.2 any log - 30 permit ip 3.3.3.3 any log - 40 permit ip 4.4.4.4 any log - 50 permit ip 5.5.5.5 any log parents: ['ip access-list test'] before: ['no ip access-list test'] match: exact - os6_config: lines: - 10 permit ip 1.1.1.1 any log - 20 permit ip 2.2.2.2 any log - 30 permit ip 3.3.3.3 any log - 40 permit ip 4.4.4.4 any log parents: ['ip access-list test'] before: ['no ip access-list test'] replace: block - os6_config: lines: ['hostname {{ inventory_hostname }}'] backup: yes backup_options: filename: backup.cfg dir_path: /home/user ``` 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\_path** string | when backup is yes | The full path to the backup file **Sample:** /playbooks/ansible/backup/os6\_config.2017-07-16@22:28:34 | | **commands** list / elements=string | always | The set of commands that will be pushed to the remote device **Sample:** ['interface Te1/0/1', 'no shutdown', 'exit'] | | **saved** boolean | When not check\_mode. | Returns whether the configuration is saved to the startup configuration or not. **Sample:** True | | **updates** list / elements=string | always | The set of commands that will be pushed to the remote device. **Sample:** ['interface Te1/0/1', 'no shutdown', 'exit'] | ### Authors * Abirami N (@abirami-n)
programming_docs
ansible dellemc.os6.os6 – Use os6 cliconf to run command on Dell OS6 platform dellemc.os6.os6 – Use os6 cliconf to run command on Dell OS6 platform ===================================================================== Note This plugin is part of the [dellemc.os6 collection](https://galaxy.ansible.com/dellemc/os6) (version 1.0.7). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.os6`. To use it in a playbook, specify: `dellemc.os6.os6`. Synopsis -------- * This os6 plugin provides low level abstraction apis for sending and receiving CLI commands from Dell OS6 network devices. ansible dellemc.os6.os6_command – Run commands on devices running Dell EMC OS6 dellemc.os6.os6\_command – Run commands on devices running Dell EMC OS6 ======================================================================= Note This plugin is part of the [dellemc.os6 collection](https://galaxy.ansible.com/dellemc/os6) (version 1.0.7). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.os6`. To use it in a playbook, specify: `dellemc.os6.os6_command`. * [Synopsis](#synopsis) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Sends arbitrary commands to a OS6 device and returns the results read from the device. This module includes an argument that will cause the module to wait for a specific condition before returning or timing out if the condition is not met. * This module does not support running commands in configuration mode. Please use M(dellemc\_os6\_os6\_config) to configure OS6 devices. Note This module has a corresponding [action plugin](../../../plugins/action#action-plugins). Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **commands** list / elements=string / required | | List of commands to send to the remote os6 device over the configured provider. The resulting output from the command is returned. If the *wait\_for* argument is provided, the module is not returned until the condition is satisfied or the number of retries has expired. | | **interval** integer | **Default:**1 | Configures the interval in seconds to wait between retries of the command. If the command does not pass the specified conditions, the interval indicates how long to wait before trying the command again. | | **match** string | **Choices:*** **all** ← * any | The *match* argument is used in conjunction with the *wait\_for* argument to specify the match policy. Valid values are `all` or `any`. If the value is set to `all` then all conditionals in the wait\_for must be satisfied. If the value is set to `any` then only one of the values must be satisfied. | | **provider** dictionary | | A dict object containing connection details. | | | **auth\_pass** string | | Specifies the password to use if required to enter privileged mode on the remote device. If *authorize* is false, then this argument does nothing. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_AUTH_PASS` will be used instead. | | | **authorize** boolean | **Choices:*** no * yes | Instructs the module to enter privileged mode on the remote device before sending any commands. If not specified, the device will attempt to execute all commands in non-privileged mode. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_AUTHORIZE` will be used instead. | | | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. | | | **password** string | | Password to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. | | | **port** integer | | Specifies the port to use when building the connection to the remote device. | | | **ssh\_keyfile** path | | Path to an ssh key used to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. | | | **timeout** integer | | Specifies idle timeout (in seconds) for the connection. Useful if the console freezes before continuing. For example when saving configurations. | | | **username** string | | User to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. | | **retries** integer | **Default:**10 | Specifies the number of retries a command should be tried before it is considered failed. The command is run on the target device every retry and evaluated against the *wait\_for* conditions. | | **wait\_for** list / elements=string | | List of conditions to evaluate against the output of the command. The task will wait for each condition to be true before moving forward. If the conditional is not true within the configured number of *retries*, the task fails. See examples. | Notes ----- Note * For more information on using Ansible to manage Dell EMC Network devices see <https://www.ansible.com/ansible-dell-networking>. Examples -------- ``` tasks: - name: run show version on remote devices os6_command: commands: show version - name: run show version and check to see if output contains Dell os6_command: commands: show version wait_for: result[0] contains Dell - name: run multiple commands on remote nodes os6_command: commands: - show version - show interfaces - name: run multiple commands and evaluate the output os6_command: commands: - show version - show interfaces wait_for: - result[0] contains Dell - result[1] contains Access ``` 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 | | --- | --- | --- | | **failed\_conditions** list / elements=string | failed | The list of conditionals that have failed **Sample:** ['...', '...'] | | **stdout** list / elements=string | always apart from low level errors (such as action plugin) | The set of responses from the commands **Sample:** ['...', '...'] | | **stdout\_lines** list / elements=string | always apart from low level errors (such as action plugin) | The value of stdout split into a list **Sample:** [['...', '...'], ['...'], ['...']] | | **warnings** list / elements=string | always | The list of warnings (if any) generated by module based on arguments **Sample:** ['...', '...'] | ### Authors * Abirami N (@abirami-n) ansible Dellemc.Os9 Dellemc.Os9 =========== Collection version 1.0.4 Plugin Index ------------ These are the plugins in the dellemc.os9 collection ### Cliconf Plugins * [os9](os9_cliconf#ansible-collections-dellemc-os9-os9-cliconf) – Use os9 cliconf to run command on Dell OS9 platform ### Modules * [os9\_command](os9_command_module#ansible-collections-dellemc-os9-os9-command-module) – Run commands on remote devices running Dell OS9 * [os9\_config](os9_config_module#ansible-collections-dellemc-os9-os9-config-module) – Manage Dell EMC Networking OS9 configuration sections * [os9\_facts](os9_facts_module#ansible-collections-dellemc-os9-os9-facts-module) – Collect facts from remote devices running Dell EMC Networking OS9 See also List of [collections](../../index#list-of-collections) with docs hosted here. ansible dellemc.os9.os9 – Use os9 cliconf to run command on Dell OS9 platform dellemc.os9.os9 – Use os9 cliconf to run command on Dell OS9 platform ===================================================================== Note This plugin is part of the [dellemc.os9 collection](https://galaxy.ansible.com/dellemc/os9) (version 1.0.4). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.os9`. To use it in a playbook, specify: `dellemc.os9.os9`. Synopsis -------- * This os9 plugin provides low level abstraction apis for sending and receiving CLI commands from Dell OS9 network devices. ansible dellemc.os9.os9_config – Manage Dell EMC Networking OS9 configuration sections dellemc.os9.os9\_config – Manage Dell EMC Networking OS9 configuration sections =============================================================================== Note This plugin is part of the [dellemc.os9 collection](https://galaxy.ansible.com/dellemc/os9) (version 1.0.4). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.os9`. To use it in a playbook, specify: `dellemc.os9.os9_config`. * [Synopsis](#synopsis) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * OS9 configurations use a simple block indent file syntax for segmenting configuration into sections. This module provides an implementation for working with OS9 configuration sections in a deterministic way. Note This module has a corresponding [action plugin](../../../plugins/action#action-plugins). Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **after** list / elements=string | | The ordered set of commands to append to the end of the command stack if a change needs to be made. Just like with *before* this allows the playbook designer to append a set of commands to be executed after the command set. | | **backup** boolean | **Choices:*** **no** ← * yes | This argument will cause the module to create a full backup of the current `running-config` from the remote device before any changes are made. If the `backup_options` value is not given, the backup file is written to the `backup` folder in the playbook root directory. If the directory does not exist, it is created. | | **backup\_options** dictionary | | This is a dict object containing configurable options related to backup file path. The value of this option is read only when `backup` is set to *yes*, if `backup` is set to *no* this option will be silently ignored. | | | **dir\_path** path | | This option provides the path ending with directory name in which the backup configuration file will be stored. If the directory does not exist it will be first created and the filename is either the value of `filename` or default filename as described in `filename` options description. If the path value is not given in that case a *backup* directory will be created in the current working directory and backup configuration will be copied in `filename` within *backup* directory. | | | **filename** string | | The filename to be used to store the backup configuration. If the the filename is not given it will be generated based on the hostname, current time and date in format defined by <hostname>\_config.<current-date>@<current-time> | | **before** list / elements=string | | The ordered set of commands to push on to the command stack if a change needs to be made. This allows the playbook designer the opportunity to perform configuration commands prior to pushing any changes without affecting how the set of commands are matched against the system. | | **config** string | | The module, by default, will connect to the remote device and retrieve the current running-config to use as a base for comparing against the contents of source. There are times when it is not desirable to have the task get the current running-config for every task in a playbook. The *config* argument allows the implementer to pass in the configuration to use as the base config for comparison. | | **lines** list / elements=string | | The ordered set of commands that should be configured in the section. The commands must be the exact same commands as found in the device running-config. Be sure to note the configuration command syntax as some commands are automatically modified by the device config parser. This argument is mutually exclusive with *src*. aliases: commands | | **match** string | **Choices:*** **line** ← * strict * exact * none | Instructs the module on the way to perform the matching of the set of commands against the current device config. If match is set to *line*, commands are matched line by line. If match is set to *strict*, command lines are matched with respect to position. If match is set to *exact*, command lines must be an equal match. Finally, if match is set to *none*, the module will not attempt to compare the source configuration with the running configuration on the remote device. | | **parents** list / elements=string | | The ordered set of parents that uniquely identify the section or hierarchy the commands should be checked against. If the parents argument is omitted, the commands are checked against the set of top level or global commands. | | **provider** dictionary | | A dict object containing connection details. | | | **auth\_pass** string | | Specifies the password to use if required to enter privileged mode on the remote device. If *authorize* is false, then this argument does nothing. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_AUTH_PASS` will be used instead. | | | **authorize** boolean | **Choices:*** no * yes | Instructs the module to enter privileged mode on the remote device before sending any commands. If not specified, the device will attempt to execute all commands in non-privileged mode. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_AUTHORIZE` will be used instead. | | | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. | | | **password** string | | Password to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. | | | **port** integer | | Specifies the port to use when building the connection to the remote device. | | | **ssh\_keyfile** path | | Path to an ssh key used to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. | | | **timeout** integer | | Specifies idle timeout (in seconds) for the connection. Useful if the console freezes before continuing. For example when saving configurations. | | | **username** string | | User to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. | | **replace** string | **Choices:*** **line** ← * block | Instructs the module on the way to perform the configuration on the device. If the replace argument is set to *line* then the modified lines are pushed to the device in configuration mode. If the replace argument is set to *block* then the entire command block is pushed to the device in configuration mode if any line is not correct. | | **save** boolean | **Choices:*** **no** ← * yes | The `save` argument instructs the module to save the running- config to the startup-config at the conclusion of the module running. If check mode is specified, this argument is ignored. | | **src** path | | Specifies the source path to the file that contains the configuration or configuration template to load. The path to the source file can either be the full path on the Ansible control host or a relative path from the playbook or role root directory. This argument is mutually exclusive with *lines*. | | **update** string | **Choices:*** **merge** ← * check | The *update* argument controls how the configuration statements are processed on the remote device. Valid choices for the *update* argument are *merge* and *check*. When you set this argument to *merge*, the configuration changes merge with the current device running configuration. When you set this argument to *check* the configuration updates are determined but not actually configured on the remote device. | Notes ----- Note * This module requires Dell OS9 version 9.10.0.1P13 or above. * This module requires to increase the ssh connection rate limit. Use the following command *ip ssh connection-rate-limit 60* to configure the same. This can also be done with the M(os9\_config) module. * For more information on using Ansible to manage Dell EMC Network devices see <https://www.ansible.com/ansible-dell-networking>. Examples -------- ``` - os9_config: lines: ['hostname {{ inventory_hostname }}'] provider: "{{ cli }}" - os9_config: lines: - 10 permit ip host 1.1.1.1 any log - 20 permit ip host 2.2.2.2 any log - 30 permit ip host 3.3.3.3 any log - 40 permit ip host 4.4.4.4 any log - 50 permit ip host 5.5.5.5 any log parents: ['ip access-list extended test'] before: ['no ip access-list extended test'] match: exact - os9_config: lines: - 10 permit ip host 1.1.1.1 any log - 20 permit ip host 2.2.2.2 any log - 30 permit ip host 3.3.3.3 any log - 40 permit ip host 4.4.4.4 any log parents: ['ip access-list extended test'] before: ['no ip access-list extended test'] replace: block - os9_config: lines: ['hostname {{ inventory_hostname }}'] provider: "{{ cli }}" backup: yes backup_options: filename: backup.cfg dir_path: /home/user ``` 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\_path** string | when backup is yes | The full path to the backup file **Sample:** /playbooks/ansible/backup/os9\_config.2016-07-16@22:28:34 | | **commands** list / elements=string | always | The set of commands that will be pushed to the remote device **Sample:** ['hostname foo', 'router bgp 1', 'bgp router-id 1.1.1.1'] | | **saved** boolean | When not check\_mode. | Returns whether the configuration is saved to the startup configuration or not. **Sample:** True | | **updates** list / elements=string | always | The set of commands that will be pushed to the remote device. **Sample:** ['hostname foo', 'router bgp 1', 'bgp router-id 1.1.1.1'] | ### Authors * Dhivya P (@dhivyap) ansible dellemc.os9.os9_command – Run commands on remote devices running Dell OS9 dellemc.os9.os9\_command – Run commands on remote devices running Dell OS9 ========================================================================== Note This plugin is part of the [dellemc.os9 collection](https://galaxy.ansible.com/dellemc/os9) (version 1.0.4). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.os9`. To use it in a playbook, specify: `dellemc.os9.os9_command`. * [Synopsis](#synopsis) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Sends arbitrary commands to a Dell OS9 node and returns the results read from the device. This module includes an argument that will cause the module to wait for a specific condition before returning or timing out if the condition is not met. * This module does not support running commands in configuration mode. Please use M(dellemc\_os9\_os9\_config) to configure Dell OS9 devices. Note This module has a corresponding [action plugin](../../../plugins/action#action-plugins). Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **commands** list / elements=string / required | | List of commands to send to the remote os9 device over the configured provider. The resulting output from the command is returned. If the *wait\_for* argument is provided, the module is not returned until the condition is satisfied or the number of retries has expired. | | **interval** integer | **Default:**1 | Configures the interval in seconds to wait between retries of the command. If the command does not pass the specified conditions, the interval indicates how long to wait before trying the command again. | | **match** string | **Choices:*** **all** ← * any | The *match* argument is used in conjunction with the *wait\_for* argument to specify the match policy. Valid values are `all` or `any`. If the value is set to `all` then all conditionals in the wait\_for must be satisfied. If the value is set to `any` then only one of the values must be satisfied. | | **provider** dictionary | | A dict object containing connection details. | | | **auth\_pass** string | | Specifies the password to use if required to enter privileged mode on the remote device. If *authorize* is false, then this argument does nothing. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_AUTH_PASS` will be used instead. | | | **authorize** boolean | **Choices:*** no * yes | Instructs the module to enter privileged mode on the remote device before sending any commands. If not specified, the device will attempt to execute all commands in non-privileged mode. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_AUTHORIZE` will be used instead. | | | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. | | | **password** string | | Password to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. | | | **port** integer | | Specifies the port to use when building the connection to the remote device. | | | **ssh\_keyfile** path | | Path to an ssh key used to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. | | | **timeout** integer | | Specifies idle timeout (in seconds) for the connection. Useful if the console freezes before continuing. For example when saving configurations. | | | **username** string | | User to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. | | **retries** integer | **Default:**10 | Specifies the number of retries a command should be tried before it is considered failed. The command is run on the target device every retry and evaluated against the *wait\_for* conditions. | | **wait\_for** list / elements=string | | List of conditions to evaluate against the output of the command. The task will wait for each condition to be true before moving forward. If the conditional is not true within the configured number of *retries*, the task fails. See examples. | Notes ----- Note * This module requires Dell OS9 version 9.10.0.1P13 or above. * This module requires to increase the ssh connection rate limit. Use the following command *ip ssh connection-rate-limit 60* to configure the same. This can be done via M(os9\_config) module as well. * For more information on using Ansible to manage Dell EMC Network devices see <https://www.ansible.com/ansible-dell-networking>. Examples -------- ``` tasks: - name: run show version on remote devices os9_command: commands: show version - name: run show version and check to see if output contains OS9 os9_command: commands: show version wait_for: result[0] contains OS9 - name: run multiple commands on remote nodes os9_command: commands: - show version - show interfaces - name: run multiple commands and evaluate the output os9_command: commands: - show version - show interfaces wait_for: - result[0] contains OS9 - result[1] contains Loopback ``` 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 | | --- | --- | --- | | **failed\_conditions** list / elements=string | failed | The list of conditionals that have failed **Sample:** ['...', '...'] | | **stdout** list / elements=string | always apart from low level errors (such as action plugin) | The set of responses from the commands **Sample:** ['...', '...'] | | **stdout\_lines** list / elements=string | always apart from low level errors (such as action plugin) | The value of stdout split into a list **Sample:** [['...', '...'], ['...'], ['...']] | | **warnings** list / elements=string | always | The list of warnings (if any) generated by module based on arguments **Sample:** ['...', '...'] | ### Authors * Dhivya P (@dhivyap)
programming_docs
ansible dellemc.os9.os9_facts – Collect facts from remote devices running Dell EMC Networking OS9 dellemc.os9.os9\_facts – Collect facts from remote devices running Dell EMC Networking OS9 ========================================================================================== Note This plugin is part of the [dellemc.os9 collection](https://galaxy.ansible.com/dellemc/os9) (version 1.0.4). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install dellemc.os9`. To use it in a playbook, specify: `dellemc.os9.os9_facts`. * [Synopsis](#synopsis) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Collects a base set of device facts from a remote device that is running OS9. This module prepends all of the base network fact keys with `ansible_net_<fact>`. The facts module will always collect a base set of facts from the device and can enable or disable collection of additional facts. Note This module has a corresponding [action plugin](../../../plugins/action#action-plugins). Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **gather\_subset** list / elements=string | **Default:**["!config"] | When supplied, this argument will restrict the facts collected to a given subset. Possible values for this argument include all, hardware, config, and interfaces. Can specify a list of values to include a larger subset. Values can also be used with an initial `M(!`) to specify that a specific subset should not be collected. | | **provider** dictionary | | A dict object containing connection details. | | | **auth\_pass** string | | Specifies the password to use if required to enter privileged mode on the remote device. If *authorize* is false, then this argument does nothing. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_AUTH_PASS` will be used instead. | | | **authorize** boolean | **Choices:*** no * yes | Instructs the module to enter privileged mode on the remote device before sending any commands. If not specified, the device will attempt to execute all commands in non-privileged mode. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_AUTHORIZE` will be used instead. | | | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. | | | **password** string | | Password to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. | | | **port** integer | | Specifies the port to use when building the connection to the remote device. | | | **ssh\_keyfile** path | | Path to an ssh key used to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. | | | **timeout** integer | | Specifies idle timeout (in seconds) for the connection. Useful if the console freezes before continuing. For example when saving configurations. | | | **username** string | | User to authenticate the SSH session to the remote device. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. | Notes ----- Note * This module requires OS9 version 9.10.0.1P13 or above. * This module requires an increase of the SSH connection rate limit. Use the following command *ip ssh connection-rate-limit 60* to configure the same. This can be also be done with the M(os9\_config) module. * For more information on using Ansible to manage Dell EMC Network devices see <https://www.ansible.com/ansible-dell-networking>. Examples -------- ``` # Collect all facts from the device - os9_facts: gather_subset: all # Collect only the config and default facts - os9_facts: gather_subset: - config # Do not collect hardware facts - os9_facts: gather_subset: - "!hardware" ``` 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\_net\_all\_ipv4\_addresses** list / elements=string | when interfaces is configured | All IPv4 addresses configured on the device | | **ansible\_net\_all\_ipv6\_addresses** list / elements=string | when interfaces is configured | All IPv6 addresses configured on the device | | **ansible\_net\_config** string | when config is configured | The current active config from the device | | **ansible\_net\_filesystems** list / elements=string | when hardware is configured | All file system names available on the device | | **ansible\_net\_gather\_subset** list / elements=string | always | The list of fact subsets collected from the device | | **ansible\_net\_hostname** string | always | The configured hostname of the device | | **ansible\_net\_image** string | always | The image file the device is running | | **ansible\_net\_interfaces** dictionary | when interfaces is configured | A hash of all interfaces running on the system | | **ansible\_net\_memfree\_mb** integer | when hardware is configured | The available free memory on the remote device in Mb | | **ansible\_net\_memtotal\_mb** integer | when hardware is configured | The total memory on the remote device in Mb | | **ansible\_net\_model** string | always | The model name returned from the device | | **ansible\_net\_neighbors** dictionary | when interfaces is configured | The list of LLDP neighbors from the remote device | | **ansible\_net\_serialnum** string | always | The serial number of the remote device | | **ansible\_net\_servicetags** list / elements=string | always | The servicetags from remote device | | **ansible\_net\_version** string | always | The operating system version running on the remote device | ### Authors * Dhivya P (@dhivyap) ansible Collections in the Containers Namespace Collections in the Containers Namespace ======================================= These are the collections with docs hosted on [docs.ansible.com](https://docs.ansible.com/) in the **containers** namespace. * [containers.podman](podman/index#plugins-in-containers-podman) ansible containers.podman.podman_container_info – Gather facts about containers using podman containers.podman.podman\_container\_info – Gather facts about containers using podman ====================================================================================== Note This plugin is part of the [containers.podman collection](https://galaxy.ansible.com/containers/podman) (version 1.8.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 containers.podman`. To use it in a playbook, specify: `containers.podman.podman_container_info`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Gather facts about containers using `podman` Requirements ------------ The below requirements are needed on the host that executes this module. * Podman installed on host Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **executable** string | **Default:**"podman" | Path to `podman` executable if it is not in the `$PATH` on the machine running `podman` | | **name** list / elements=string | | List of container names to gather facts about. If no name is given return facts about all containers. | Notes ----- Note * Podman may require elevated privileges in order to run properly. Examples -------- ``` - name: Gather facts for all containers containers.podman.podman_container_info: - name: Gather facts on a specific container containers.podman.podman_container_info: name: web1 - name: Gather facts on several containers containers.podman.podman_container_info: name: - redis - web1 ``` 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 | | --- | --- | --- | | **containers** list / elements=dictionary | always | Facts from all or specificed containers **Sample:** [{'AppArmorProfile': '', 'Args': ['--single-child', '--', 'kolla\_start'], 'BoundingCaps': ['CAP\_CHOWN', 'CAP\_DAC\_OVERRIDE', 'CAP\_FSETID', 'CAP\_FOWNER', 'CAP\_MKNOD', 'CAP\_NET\_RAW', 'CAP\_SETGID', 'CAP\_SETUID', 'CAP\_SETFCAP', 'CAP\_SETPCAP', 'CAP\_NET\_BIND\_SERVICE', 'CAP\_SYS\_CHROOT', 'CAP\_KILL', 'CAP\_AUDIT\_WRITE'], 'Config': {'Annotations': {'io.kubernetes.cri-o.ContainerType': 'sandbox', 'io.kubernetes.cri-o.TTY': 'false', 'io.podman.annotations.autoremove': 'FALSE', 'io.podman.annotations.init': 'FALSE', 'io.podman.annotations.privileged': 'FALSE', 'io.podman.annotations.publish-all': 'FALSE'}, 'AttachStderr': False, 'AttachStdin': False, 'AttachStdout': False, 'Cmd': ['kolla\_start'], 'Domainname': '', 'Entrypoint': 'dumb-init --single-child --', 'Env': ['PATH=/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'TERM=xterm', 'HOSTNAME=', 'container=oci', 'KOLLA\_INSTALL\_METATYPE=rdo', 'KOLLA\_BASE\_DISTRO=centos', 'KOLLA\_INSTALL\_TYPE=binary', 'KOLLA\_DISTRO\_PYTHON\_VERSION=2.7', 'KOLLA\_BASE\_ARCH=x86\_64'], 'Hostname': 'c5c39e813703', 'Image': 'docker.io/tripleomaster/centos-haproxy:latest', 'Labels': {'build-date': '20190919', 'kolla\_version': '8.1.0', 'name': 'haproxy', 'org.label-schema.build-date': '20190801', 'org.label-schema.license': 'GPLv2', 'org.label-schema.name': 'CentOS Base Image', 'org.label-schema.schema-version': '1.0', 'org.label-schema.vendor': 'CentOS'}, 'OnBuild': None, 'OpenStdin': False, 'StdinOnce': False, 'StopSignal': 15, 'Tty': False, 'User': '', 'Volumes': None, 'WorkingDir': '/'}, 'Created': '2019-10-01T12:51:00.233106443Z', 'Dependencies': [], 'Driver': 'overlay', 'EffectiveCaps': ['CAP\_CHOWN', 'CAP\_DAC\_OVERRIDE', 'CAP\_FSETID', 'CAP\_FOWNER', 'CAP\_MKNOD', 'CAP\_NET\_RAW', 'CAP\_SETGID', 'CAP\_SETUID', 'CAP\_SETFCAP', 'CAP\_SETPCAP', 'CAP\_NET\_BIND\_SERVICE', 'CAP\_SYS\_CHROOT', 'CAP\_KILL', 'CAP\_AUDIT\_WRITE'], 'ExecIDs': [], 'ExitCommand': ['/usr/bin/podman', '--root', '/var/lib/containers/storage', '--runroot', '/var/run/containers/storage', '--log-level', 'error', '--cgroup-manager', 'systemd', '--tmpdir', '/var/run/libpod', '--runtime', 'runc', '--storage-driver', 'overlay', '--events-backend', 'journald', 'container', 'cleanup', 'c9e813703f9b80a6ea2ad665aa9946435934e478a0c5322da835f3883872f'], 'GraphDriver': {'Name': 'overlay'}, 'HostConfig': {'AutoRemove': False, 'Binds': [], 'BlkioDeviceReadBps': None, 'BlkioDeviceReadIOps': None, 'BlkioDeviceWriteBps': None, 'BlkioDeviceWriteIOps': None, 'BlkioWeight': 0, 'BlkioWeightDevice': None, 'CapAdd': [], 'CapDrop': [], 'Cgroup': '', 'CgroupParent': '', 'ConsoleSize': [0, 0], 'ContainerIDFile': '', 'CpuCount': 0, 'CpuPercent': 0, 'CpuPeriod': 0, 'CpuQuota': 0, 'CpuRealtimePeriod': 0, 'CpuRealtimeRuntime': 0, 'CpuShares': 0, 'CpusetCpus': '', 'CpusetMems': '', 'Devices': [], 'DiskQuota': 0, 'Dns': [], 'DnsOptions': [], 'DnsSearch': [], 'ExtraHosts': [], 'GroupAdd': [], 'IOMaximumBandwidth': 0, 'IOMaximumIOps': 0, 'IpcMode': '', 'Isolation': '', 'KernelMemory': 0, 'Links': None, 'LogConfig': {'Config': None, 'Type': 'k8s-file'}, 'Memory': 0, 'MemoryReservation': 0, 'MemorySwap': 0, 'MemorySwappiness': -1, 'NanoCpus': 0, 'NetworkMode': 'default', 'OomKillDisable': False, 'OomScoreAdj': 0, 'PidMode': '', 'PidsLimit': 0, 'PortBindings': {}, 'Privileged': False, 'PublishAllPorts': False, 'ReadonlyRootfs': False, 'RestartPolicy': {'MaximumRetryCount': 0, 'Name': ''}, 'Runtime': 'oci', 'SecurityOpt': [], 'ShmSize': 65536000, 'Tmpfs': {}, 'UTSMode': '', 'Ulimits': [{'Hard': 1048576, 'Name': 'RLIMIT\_NOFILE', 'Soft': 1048576}, {'Hard': 1048576, 'Name': 'RLIMIT\_NPROC', 'Soft': 1048576}], 'UsernsMode': '', 'VolumeDriver': '', 'VolumesFrom': None}, 'HostnamePath': '', 'HostsPath': '', 'Id': 'c5c39f9b80a6ea2ad665aa9946435934e478a0c5322da835f3883872f', 'Image': '0e267acda67d0ebd643e900d820a91b961d859743039e620191ca1', 'ImageName': 'docker.io/tripleomaster/centos-haproxy:latest', 'IsInfra': False, 'MountLabel': 'system\_u:object\_r:svirt\_sandbox\_file\_t:s0:c78,c866', 'Mounts': [], 'Name': 'haproxy', 'Namespace': '', 'NetworkSettings': {'Bridge': '', 'EndpointID': '', 'Gateway': '', 'GlobalIPv6Address': '', 'GlobalIPv6PrefixLen': 0, 'HairpinMode': False, 'IPAddress': '', 'IPPrefixLen': 0, 'IPv6Gateway': '', 'LinkLocalIPv6Address': '', 'LinkLocalIPv6PrefixLen': 0, 'MacAddress': '', 'Ports': [], 'SandboxID': '', 'SandboxKey': '', 'SecondaryIPAddresses': None, 'SecondaryIPv6Addresses': None}, 'OCIRuntime': 'runc', 'Path': 'dumb-init', 'Pod': '', 'ProcessLabel': 'system\_u:system\_r:svirt\_lxc\_net\_t:s0:c785,c866', 'ResolvConfPath': '', 'RestartCount': 0, 'Rootfs': '', 'State': {'Dead': False, 'Error': '', 'ExitCode': 0, 'FinishedAt': '0001-01-01T00:00:00Z', 'Healthcheck': {'FailingStreak': 0, 'Log': None, 'Status': ''}, 'OOMKilled': False, 'OciVersion': '1.0.1-dev', 'Paused': False, 'Pid': 0, 'Restarting': False, 'Running': False, 'StartedAt': '0001-01-01T00:00:00Z', 'Status': 'configured'}}] | ### Authors * Sagi Shnaidman (@sshnaidm) * Emilien Macchi (@EmilienM) ansible containers.podman.podman_export – Export a podman container containers.podman.podman\_export – Export a podman container ============================================================ Note This plugin is part of the [containers.podman collection](https://galaxy.ansible.com/containers/podman) (version 1.8.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 containers.podman`. To use it in a playbook, specify: `containers.podman.podman_export`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Examples](#examples) Synopsis -------- * podman export exports the filesystem of a container and saves it as a tarball on the local machine Requirements ------------ The below requirements are needed on the host that executes this module. * Podman installed on host Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **container** string / required | | Container to export. | | **dest** string / required | | Path to export container to. | | **executable** string | **Default:**"podman" | Path to `podman` executable if it is not in the `$PATH` on the machine running `podman` | | **force** boolean | **Choices:*** no * **yes** ← | Force saving to file even if it exists. | Examples -------- ``` # What modules does for example - containers.podman.podman_export: dest: /path/to/tar/file container: container-name ``` ### Authors * Sagi Shnaidman (@sshnaidm) ansible containers.podman.podman_login – Login to a container registry using podman containers.podman.podman\_login – Login to a container registry using podman ============================================================================ Note This plugin is part of the [containers.podman collection](https://galaxy.ansible.com/containers/podman) (version 1.8.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 containers.podman`. To use it in a playbook, specify: `containers.podman.podman_login`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Examples](#examples) Synopsis -------- * Login to a container registry server using the podman login command If the registry is not specified, the first registry under `[registries.search]` from `registries.conf `will be used. The path of the authentication file can be overridden by the user by setting the `authfile` flag. The default path used is `${XDG_RUNTIME_DIR}/containers/auth.json`. Requirements ------------ The below requirements are needed on the host that executes this module. * Podman installed on host Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **authfile** path | | Path of the authentication file. Default is ``${XDG\_RUNTIME\_DIR}/containers/auth.json`` You can also override the default path of the authentication file by setting the ``REGISTRY\_AUTH\_FILE`` environment variable. ``export REGISTRY\_AUTH\_FILE=path`` | | **certdir** path | | Use certificates at path (\*.crt, \*.cert, \*.key) to connect to the registry. Default certificates directory is /etc/containers/certs.d. | | **executable** string | **Default:**"podman" | Path to `podman` executable if it is not in the `$PATH` on the machine running `podman` | | **password** string / required | | Password for the registry server. | | **registry** string | | Registry server. If the registry is not specified, the first registry under `[registries.search]` from `registries.conf` will be used. | | **tlsverify** boolean | **Choices:*** no * yes | Require HTTPS and verify certificates when contacting registries. If explicitly set to true, then TLS verification will be used. If set to false, then TLS verification will not be used. If not specified, TLS verification will be used unless the target registry is listed as an insecure registry in registries.conf. | | **username** string / required | | Username for the registry server. | Examples -------- ``` - name: Login to default registry and create ${XDG_RUNTIME_DIR}/containers/auth.json containers.podman.podman_login: username: user password: 'p4ssw0rd' - name: Login to default registry and create ${XDG_RUNTIME_DIR}/containers/auth.json containers.podman.podman_login: username: user password: 'p4ssw0rd' registry: quay.io ``` ### Authors * Jason Hiatt (@jthiatt) ansible containers.podman.podman – Interact with an existing podman container containers.podman.podman – Interact with an existing podman container ===================================================================== Note This plugin is part of the [containers.podman collection](https://galaxy.ansible.com/containers/podman) (version 1.8.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 containers.podman`. To use it in a playbook, specify: `containers.podman.podman`. * [Synopsis](#synopsis) * [Parameters](#parameters) Synopsis -------- * Run commands or put/fetch files to an existing container using podman tool. Parameters ---------- | Parameter | Choices/Defaults | Configuration | Comments | | --- | --- | --- | --- | | **podman\_executable** string | **Default:**"podman" | env:ANSIBLE\_PODMAN\_EXECUTABLE var: ansible\_podman\_executable | Executable for podman command. | | **podman\_extra\_args** string | **Default:**"" | ini entries: [defaults]podman\_extra\_args = env:ANSIBLE\_PODMAN\_EXTRA\_ARGS var: ansible\_podman\_extra\_args | Extra arguments to pass to the podman command line. | | **remote\_addr** string | **Default:**"inventory\_hostname" | var: ansible\_host | The ID of the container you want to access. | | **remote\_user** string | | ini entries: [defaults]remote\_user = None env:ANSIBLE\_REMOTE\_USER var: ansible\_user | User specified via name or UID which is used to execute commands inside the container. If you specify the user via UID, you must set `ANSIBLE_REMOTE_TMP` to a path that exits inside the container and is writable by Ansible. | ### Authors * Tomas Tomecek ([[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#a6d2d2c9cbc3c5c3cd808595919d808593949d8085929e9dd4c3c2cec7d2808592909dc5c9cb))
programming_docs
ansible containers.podman.podman_network_info – Gather info about podman networks containers.podman.podman\_network\_info – Gather info about podman networks =========================================================================== Note This plugin is part of the [containers.podman collection](https://galaxy.ansible.com/containers/podman) (version 1.8.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 containers.podman`. To use it in a playbook, specify: `containers.podman.podman_network_info`. New in version 1.0.0: of containers.podman * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Gather info about podman networks with podman inspect command. Requirements ------------ The below requirements are needed on the host that executes this module. * Podman installed on host Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **executable** string | **Default:**"podman" | Path to `podman` executable if it is not in the `$PATH` on the machine running `podman` | | **name** string | | Name of the network | Examples -------- ``` - name: Gather info about all present networks containers.podman.podman_network_info: - name: Gather info about specific network containers.podman.podman_network_info: name: podman ``` 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 | | --- | --- | --- | | **networks** list / elements=string | always | Facts from all or specified networks **Sample:** [{'cniVersion': '0.4.0', 'name': 'podman', 'plugins': [{'bridge': 'cni-podman0', 'ipMasq': True, 'ipam': {'ranges': [[{'gateway': '10.88.0.1', 'subnet': '10.88.0.0/16'}]], 'routes': [{'dst': '0.0.0.0/0'}], 'type': 'host-local'}, 'isGateway': True, 'type': 'bridge'}, {'capabilities': {'portMappings': True}, 'type': 'portmap'}, {'backend': 'iptables', 'type': 'firewall'}]}] | ### Authors * Sagi Shnaidman (@sshnaidm) ansible Containers.Podman Containers.Podman ================= Collection version 1.8.1 Plugin Index ------------ These are the plugins in the containers.podman collection ### Connection Plugins * [buildah](buildah_connection#ansible-collections-containers-podman-buildah-connection) – Interact with an existing buildah container * [podman](podman_connection#ansible-collections-containers-podman-podman-connection) – Interact with an existing podman container ### Modules * [podman\_container](podman_container_module#ansible-collections-containers-podman-podman-container-module) – Manage podman containers * [podman\_container\_info](podman_container_info_module#ansible-collections-containers-podman-podman-container-info-module) – Gather facts about containers using podman * [podman\_containers](podman_containers_module#ansible-collections-containers-podman-podman-containers-module) – Manage podman containers in a batch * [podman\_export](podman_export_module#ansible-collections-containers-podman-podman-export-module) – Export a podman container * [podman\_image](podman_image_module#ansible-collections-containers-podman-podman-image-module) – Pull images for use by podman * [podman\_image\_info](podman_image_info_module#ansible-collections-containers-podman-podman-image-info-module) – Gather info about images using podman * [podman\_import](podman_import_module#ansible-collections-containers-podman-podman-import-module) – Import Podman container from a tar file. * [podman\_load](podman_load_module#ansible-collections-containers-podman-podman-load-module) – Load image from a tar file. * [podman\_login](podman_login_module#ansible-collections-containers-podman-podman-login-module) – Login to a container registry using podman * [podman\_login\_info](podman_login_info_module#ansible-collections-containers-podman-podman-login-info-module) – Return the logged-in user if any for a given registry * [podman\_logout](podman_logout_module#ansible-collections-containers-podman-podman-logout-module) – Log out of a container registry using podman * [podman\_network](podman_network_module#ansible-collections-containers-podman-podman-network-module) – Manage podman networks * [podman\_network\_info](podman_network_info_module#ansible-collections-containers-podman-podman-network-info-module) – Gather info about podman networks * [podman\_play](podman_play_module#ansible-collections-containers-podman-podman-play-module) – Play kubernetes YAML file using podman * [podman\_pod](podman_pod_module#ansible-collections-containers-podman-podman-pod-module) – Manage Podman pods * [podman\_pod\_info](podman_pod_info_module#ansible-collections-containers-podman-podman-pod-info-module) – Gather info about podman pods * [podman\_save](podman_save_module#ansible-collections-containers-podman-podman-save-module) – Saves podman image to tar file * [podman\_secret](podman_secret_module#ansible-collections-containers-podman-podman-secret-module) – Manage podman secrets * [podman\_volume](podman_volume_module#ansible-collections-containers-podman-podman-volume-module) – Manage Podman volumes * [podman\_volume\_info](podman_volume_info_module#ansible-collections-containers-podman-podman-volume-info-module) – Gather info about podman volumes See also List of [collections](../../index#list-of-collections) with docs hosted here. ansible containers.podman.podman_containers – Manage podman containers in a batch containers.podman.podman\_containers – Manage podman containers in a batch ========================================================================== Note This plugin is part of the [containers.podman collection](https://galaxy.ansible.com/containers/podman) (version 1.8.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 containers.podman`. To use it in a playbook, specify: `containers.podman.podman_containers`. New in version 1.4.0: of containers.podman * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Examples](#examples) Synopsis -------- * Manage groups of podman containers Requirements ------------ The below requirements are needed on the host that executes this module. * podman Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **containers** list / elements=dictionary / required | | List of dictionaries with data for running containers for podman\_container module. | | **debug** boolean | **Choices:*** **no** ← * yes | Return additional information which can be helpful for investigations. | Examples -------- ``` - name: Run three containers at once podman_containers: containers: - name: alpine image: alpine command: sleep 1d - name: web image: nginx - name: test image: python:3-alpine command: python -V ``` ### Authors * Sagi Shnaidman (@sshnaidm) ansible containers.podman.podman_network – Manage podman networks containers.podman.podman\_network – Manage podman networks ========================================================== Note This plugin is part of the [containers.podman collection](https://galaxy.ansible.com/containers/podman) (version 1.8.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 containers.podman`. To use it in a playbook, specify: `containers.podman.podman_network`. New in version 1.0.0: of containers.podman * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Manage podman networks with podman network command. Requirements ------------ The below requirements are needed on the host that executes this module. * podman Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **debug** boolean | **Choices:*** **no** ← * yes | Return additional information which can be helpful for investigations. | | **disable\_dns** boolean | **Choices:*** no * yes | disable dns plugin (default "false") | | **driver** string | | Driver to manage the network (default "bridge") | | **executable** string | **Default:**"podman" | Path to `podman` executable if it is not in the `$PATH` on the machine running `podman` | | **gateway** string | | IPv4 or IPv6 gateway for the subnet | | **internal** boolean | **Choices:*** no * yes | Restrict external access from this network (default "false") | | **ip\_range** string | | Allocate container IP from range | | **ipv6** boolean | **Choices:*** no * yes | Enable IPv6 (Dual Stack) networking. You must pass a IPv6 subnet. The subnet option must be used with the ipv6 option. | | **macvlan** string | | Create a Macvlan connection based on this device | | **name** string / required | | Name of the network | | **opt** dictionary | | Add network options. Currently 'vlan' and 'mtu' are supported. | | | **mtu** integer | | MTU size for bridge network interface. | | | **vlan** integer | | VLAN tag for bridge which enables vlan\_filtering. | | **recreate** boolean | **Choices:*** **no** ← * yes | Recreate network even if exists. | | **state** string | **Choices:*** **present** ← * absent | State of network, default 'present' | | **subnet** string | | Subnet in CIDR format | Examples -------- ``` - name: Create a podman network containers.podman.podman_network: name: podman_network become: true - name: Create internal podman network containers.podman.podman_network: name: podman_internal internal: true ip_range: 192.168.22.128/25 subnet: 192.168.22.0/24 gateway: 192.168.22.1 become: 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** list / elements=string | always | Facts from created or updated networks **Sample:** [{'cniVersion': '0.4.0', 'name': 'podman', 'plugins': [{'bridge': 'cni-podman0', 'ipMasq': True, 'ipam': {'ranges': [[{'gateway': '10.88.0.1', 'subnet': '10.88.0.0/16'}]], 'routes': [{'dst': '0.0.0.0/0'}], 'type': 'host-local'}, 'isGateway': True, 'type': 'bridge'}, {'capabilities': {'portMappings': True}, 'type': 'portmap'}, {'backend': 'iptables', 'type': 'firewall'}]}] | ### Authors * Sagi Shnaidman (@sshnaidm) ansible containers.podman.podman_volume_info – Gather info about podman volumes containers.podman.podman\_volume\_info – Gather info about podman volumes ========================================================================= Note This plugin is part of the [containers.podman collection](https://galaxy.ansible.com/containers/podman) (version 1.8.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 containers.podman`. To use it in a playbook, specify: `containers.podman.podman_volume_info`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Gather info about podman volumes with podman inspect command. Requirements ------------ The below requirements are needed on the host that executes this module. * Podman installed on host Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **executable** string | **Default:**"podman" | Path to `podman` executable if it is not in the `$PATH` on the machine running `podman` | | **name** string | | Name of the volume | Examples -------- ``` - name: Gather info about all present volumes podman_volume_info: - name: Gather info about specific volume podman_volume_info: name: specific_volume ``` 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 | | --- | --- | --- | | **volumes** list / elements=string | always | Facts from all or specified volumes **Sample:** [{'driver': 'local', 'labels': {}, 'mountPoint': '/home/ansible/.local/share/testvolume/\_data', 'name': 'testvolume', 'options': {}, 'scope': 'local'}] | ### Authors * Sagi Shnaidman (@sshnaidm) ansible containers.podman.podman_image – Pull images for use by podman containers.podman.podman\_image – Pull images for use by podman =============================================================== Note This plugin is part of the [containers.podman collection](https://galaxy.ansible.com/containers/podman) (version 1.8.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 containers.podman`. To use it in a playbook, specify: `containers.podman.podman_image`. * [Synopsis](#synopsis) * [Parameters](#parameters) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Build, pull, or push images using Podman. Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **auth\_file** path | | Path to file containing authorization credentials to the remote registry. aliases: authfile | | **build** dictionary | | Arguments that control image build. aliases: build\_args, buildargs | | | **annotation** dictionary | | Dictionary of key=value pairs to add to the image. Only works with OCI images. Ignored for Docker containers. | | | **cache** boolean | **Choices:*** no * **yes** ← | Whether or not to use cached layers when building an image | | | **extra\_args** string | | Extra args to pass to build, if executed. Does not idempotently check for new build args. | | | **force\_rm** boolean | **Choices:*** **no** ← * yes | Always remove intermediate containers after a build, even if the build is unsuccessful. | | | **format** string | **Choices:*** docker * **oci** ← | Format of the built image. | | | **rm** boolean | **Choices:*** no * **yes** ← | Remove intermediate containers after a successful build | | | **volume** list / elements=string | | Specify multiple volume / mount options to mount one or more mounts to a container. | | **ca\_cert\_dir** path | | Path to directory containing TLS certificates and keys to use. | | **executable** string | **Default:**"podman" | Path to `podman` executable if it is not in the `$PATH` on the machine running `podman`. | | **force** boolean | **Choices:*** **no** ← * yes | Whether or not to force push or pull an image. When building, force the build even if the image already exists. | | **name** string / required | | Name of the image to pull, push, or delete. It may contain a tag using the format `image:tag`. | | **password** string | | Password to use when authenticating to remote registries. | | **path** string | | Path to directory containing the build file. | | **pull** boolean | **Choices:*** no * **yes** ← | Whether or not to pull the image. | | **push** boolean | **Choices:*** **no** ← * yes | Whether or not to push an image. | | **push\_args** dictionary | | Arguments that control pushing images. | | | **compress** boolean | **Choices:*** no * yes | Compress tarball image layers when pushing to a directory using the 'dir' transport. | | | **dest** string | | Path or URL where image will be pushed. aliases: destination | | | **format** string | **Choices:*** oci * v2s1 * v2s2 | Manifest type to use when pushing an image using the 'dir' transport (default is manifest type of source). | | | **remove\_signatures** boolean | **Choices:*** no * yes | Discard any pre-existing signatures in the image | | | **sign\_by** string | | Path to a key file to use to sign the image. | | | **transport** string | **Choices:*** dir * docker-archive * docker-daemon * oci-archive * ostree | Transport to use when pushing in image. If no transport is set, will attempt to push to a remote registry. | | **state** string | **Choices:*** **present** ← * absent * build | Whether an image should be present, absent, or built. | | **tag** string | **Default:**"latest" | Tag of the image to pull, push, or delete. | | **username** string | | username to use when authenticating to remote registries. | | **validate\_certs** boolean | **Choices:*** no * yes | Require HTTPS and validate certificates when pulling or pushing. Also used during build if a pull or push is necessary. aliases: tlsverify, tls\_verify | Examples -------- ``` - name: Pull an image containers.podman.podman_image: name: quay.io/bitnami/wildfly - name: Remove an image containers.podman.podman_image: name: quay.io/bitnami/wildfly state: absent - name: Pull a specific version of an image containers.podman.podman_image: name: redis tag: 4 - name: Build a basic OCI image containers.podman.podman_image: name: nginx path: /path/to/build/dir - name: Build a basic OCI image with advanced parameters containers.podman.podman_image: name: nginx path: /path/to/build/dir build: cache: no force_rm: yes format: oci annotation: app: nginx function: proxy info: Load balancer for my cool app - name: Build a Docker formatted image containers.podman.podman_image: name: nginx path: /path/to/build/dir build: format: docker - name: Build and push an image using existing credentials containers.podman.podman_image: name: nginx path: /path/to/build/dir push: yes push_args: dest: quay.io/acme - name: Build and push an image using an auth file containers.podman.podman_image: name: nginx push: yes auth_file: /etc/containers/auth.json push_args: dest: quay.io/acme - name: Build and push an image using username and password containers.podman.podman_image: name: nginx push: yes username: bugs password: "{{ vault_registry_password }}" push_args: dest: quay.io/acme - name: Build and push an image to multiple registries containers.podman.podman_image: name: "{{ item }}" path: /path/to/build/dir push: yes auth_file: /etc/containers/auth.json loop: - quay.io/acme/nginx - docker.io/acme/nginx - name: Build and push an image to multiple registries with separate parameters containers.podman.podman_image: name: "{{ item.name }}" tag: "{{ item.tag }}" path: /path/to/build/dir push: yes auth_file: /etc/containers/auth.json push_args: dest: "{{ item.dest }}" loop: - name: nginx tag: 4 dest: docker.io/acme - name: nginx tag: 3 dest: docker.io/acme ``` 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 | | --- | --- | --- | | **image** dictionary | success | Image inspection results for the image that was pulled, pushed, or built. **Sample:** [{'Annotations': {}, 'Architecture': 'amd64', 'Author': '', 'Comment': 'from Bitnami with love', 'ContainerConfig': {'Cmd': ['/run.sh'], 'Entrypoint': ['/app-entrypoint.sh'], 'Env': ['PATH=/opt/bitnami/java/bin:/opt/bitnami/wildfly/bin:/opt/bitnami/nami/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'IMAGE\_OS=debian-9', 'NAMI\_VERSION=1.0.0-1', 'GPG\_KEY\_SERVERS\_LIST=ha.pool.sks-keyservers.net', 'TINI\_VERSION=v0.13.2', 'TINI\_GPG\_KEY=595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7', 'GOSU\_VERSION=1.10', 'GOSU\_GPG\_KEY=B42F6819007F00F88E364FD4036A9C25BF357DD4', 'BITNAMI\_IMAGE\_VERSION=16.0.0-debian-9-r27', 'BITNAMI\_PKG\_CHMOD=-R g+rwX', 'BITNAMI\_PKG\_EXTRA\_DIRS=/home/wildfly', 'HOME=/', 'BITNAMI\_APP\_NAME=wildfly', 'NAMI\_PREFIX=/.nami', 'WILDFLY\_HOME=/home/wildfly', 'WILDFLY\_JAVA\_HOME=', 'WILDFLY\_JAVA\_OPTS=', 'WILDFLY\_MANAGEMENT\_HTTP\_PORT\_NUMBER=9990', 'WILDFLY\_PASSWORD=bitnami', 'WILDFLY\_PUBLIC\_CONSOLE=true', 'WILDFLY\_SERVER\_AJP\_PORT\_NUMBER=8009', 'WILDFLY\_SERVER\_HTTP\_PORT\_NUMBER=8080', 'WILDFLY\_SERVER\_INTERFACE=0.0.0.0', 'WILDFLY\_USERNAME=user', 'WILDFLY\_WILDFLY\_HOME=/home/wildfly', 'WILDFLY\_WILDFLY\_OPTS=-Dwildfly.as.deployment.ondemand=false'], 'ExposedPorts': {'8080/tcp': {}, '9990/tcp': {}}, 'Labels': {'maintainer': 'Bitnami <[email protected]>'}, 'User': '1001'}, 'Created': '2019-04-10T05:48:03.553887623Z', 'Digest': 'sha256:5a8ab28e314c2222de3feaf6dac94a0436a37fc08979d2722c99d2bef2619a9b', 'GraphDriver': {'Data': {'LowerDir': '/var/lib/containers/storage/overlay/142c1beadf1bb09fbd929465ec98c9dca3256638220450efb4214727d0d0680e/diff:/var/lib/containers/s', 'MergedDir': '/var/lib/containers/storage/overlay/9aa10191f5bddb59e28508e721fdeb43505e5b395845fa99723ed787878dbfea/merged', 'UpperDir': '/var/lib/containers/storage/overlay/9aa10191f5bddb59e28508e721fdeb43505e5b395845fa99723ed787878dbfea/diff', 'WorkDir': '/var/lib/containers/storage/overlay/9aa10191f5bddb59e28508e721fdeb43505e5b395845fa99723ed787878dbfea/work'}, 'Name': 'overlay'}, 'History': [{'comment': 'from Bitnami with love', 'created': '2019-04-09T22:27:40.659377677Z'}, {'created': '2019-04-09T22:38:53.86336555Z', 'created\_by': '/bin/sh -c #(nop) LABEL maintainer=Bitnami <[email protected]>', 'empty\_layer': True}, {'created': '2019-04-09T22:38:54.022778765Z', 'created\_by': '/bin/sh -c #(nop) ENV IMAGE\_OS=debian-9', 'empty\_layer': True}], 'Id': 'ace34da54e4af2145e1ad277005adb235a214e4dfe1114c2db9ab460b840f785', 'Labels': {'maintainer': 'Bitnami <[email protected]>'}, 'ManifestType': 'application/vnd.docker.distribution.manifest.v1+prettyjws', 'Os': 'linux', 'Parent': '', 'RepoDigests': ['quay.io/bitnami/wildfly@sha256:5a8ab28e314c2222de3feaf6dac94a0436a37fc08979d2722c99d2bef2619a9b'], 'RepoTags': ['quay.io/bitnami/wildfly:latest'], 'RootFS': {'Layers': ['', '', '', '', '', '', '', '', '', '', '', ''], 'Type': 'layers'}, 'Size': 466180019, 'User': '1001', 'Version': '18.09.3', 'VirtualSize': 466180019}] | ### Authors * Sam Doran (@samdoran)
programming_docs
ansible containers.podman.podman_save – Saves podman image to tar file containers.podman.podman\_save – Saves podman image to tar file =============================================================== Note This plugin is part of the [containers.podman collection](https://galaxy.ansible.com/containers/podman) (version 1.8.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 containers.podman`. To use it in a playbook, specify: `containers.podman.podman_save`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Examples](#examples) Synopsis -------- * podman save saves an image to either docker-archive, oci-archive, oci-dir (directory with oci manifest type), or docker-dir (directory with v2s2 manifest type) on the local machine, default is docker-archive. Requirements ------------ The below requirements are needed on the host that executes this module. * Podman installed on host Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **compress** boolean | **Choices:*** no * yes | Compress tarball image layers when pushing to a directory using the 'dir' transport. (default is same compression type, compressed or uncompressed, as source) | | **dest** string / required | | Destination file to write image to. aliases: path | | **executable** string | **Default:**"podman" | Path to `podman` executable if it is not in the `$PATH` on the machine running `podman` | | **force** boolean | **Choices:*** no * **yes** ← | Force saving to file even if it exists. | | **format** string | **Choices:*** docker-archive * oci-archive * oci-dir * docker-dir | Save image to docker-archive, oci-archive (see containers-transports(5)), oci-dir (oci transport), or docker-dir (dir transport with v2s2 manifest type). | | **image** string / required | | Image to save. | | **multi\_image\_archive** boolean | **Choices:*** no * yes | Allow for creating archives with more than one image. Additional names will be interpreted as images instead of tags. Only supported for docker-archive. | Examples -------- ``` # What modules does for example - containers.podman.podman_save: dest: /path/to/tar/file compress: true format: oci-dir ``` ### Authors * Sagi Shnaidman (@sshnaidm) ansible containers.podman.podman_image_info – Gather info about images using podman containers.podman.podman\_image\_info – Gather info about images using podman ============================================================================= Note This plugin is part of the [containers.podman collection](https://galaxy.ansible.com/containers/podman) (version 1.8.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 containers.podman`. To use it in a playbook, specify: `containers.podman.podman_image_info`. * [Synopsis](#synopsis) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Gather info about images using `podman` Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **executable** string | **Default:**"podman" | Path to `podman` executable if it is not in the `$PATH` on the machine running `podman` | | **name** list / elements=string | | List of tags or UID to gather info about. If no name is given return info about all images. | Notes ----- Note * Podman may required elevated privileges in order to run properly. Examples -------- ``` - name: Gather info for all images containers.podman.podman_image_info: - name: Gather info on a specific image containers.podman.podman_image_info: name: nginx - name: Gather info on several images containers.podman.podman_image_info: name: - redis - quay.io/bitnami/wildfly ``` 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 | | --- | --- | --- | | **images** dictionary | always | info from all or specified images **Sample:** [{'Annotations': {}, 'Architecture': 'amd64', 'Author': '', 'Comment': 'from Bitnami with love', 'ContainerConfig': {'Cmd': ['nami', 'start', '--foreground', 'wildfly'], 'Entrypoint': ['/app-entrypoint.sh'], 'Env': ['PATH=/opt/bitnami/java/bin:/opt/bitnami/wildfly/bin:/opt/bitnami/nami/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'IMAGE\_OS=debian-9', 'NAMI\_VERSION=0.0.9-0', 'GPG\_KEY\_SERVERS\_LIST=ha.pool.sks-keyservers.net hkp://p80.pool.sks-keyservers.net:80 keyserver.ubuntu.com hkp://keyserver.ubuntu.com:80 pgp.mit.edu', 'TINI\_VERSION=v0.13.2', 'TINI\_GPG\_KEY=595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7', 'GOSU\_VERSION=1.10', 'GOSU\_GPG\_KEY=B42F6819007F00F88E364FD4036A9C25BF357DD4', 'BITNAMI\_IMAGE\_VERSION=14.0.1-debian-9-r12', 'BITNAMI\_APP\_NAME=wildfly', 'WILDFLY\_JAVA\_HOME=', 'WILDFLY\_JAVA\_OPTS=', 'WILDFLY\_MANAGEMENT\_HTTP\_PORT\_NUMBER=9990', 'WILDFLY\_PASSWORD=bitnami', 'WILDFLY\_PUBLIC\_CONSOLE=true', 'WILDFLY\_SERVER\_AJP\_PORT\_NUMBER=8009', 'WILDFLY\_SERVER\_HTTP\_PORT\_NUMBER=8080', 'WILDFLY\_SERVER\_INTERFACE=0.0.0.0', 'WILDFLY\_USERNAME=user', 'WILDFLY\_WILDFLY\_HOME=/home/wildfly', 'WILDFLY\_WILDFLY\_OPTS=-Dwildfly.as.deployment.ondemand=false'], 'ExposedPorts': {'8080/tcp': {}, '9990/tcp': {}}, 'Labels': {'maintainer': 'Bitnami <[email protected]>'}}, 'Created': '2018-09-25T04:07:45.934395523Z', 'Digest': 'sha256:5c7d8e2dd66dcf4a152a4032a1d3c5a33458c67e1c1335edd8d18d738892356b', 'GraphDriver': {'Data': {'LowerDir': '/var/lib/containers/storage/overlay/a9dbf5616cc16919a8ac0dfc60aff87a72b5be52994c4649fcc91a089a12931f/diff:/var/lib/containers/storage/overlay/67129bd46022122a7d8b7acb490092af6c7ce244ce4fbd7d9e2d2b7f5979e090/diff:/var/lib/containers/storage/overlay/7c51242c4c5db5c74afda76d7fdbeab6965d8b21804bb3fc597dee09c770b0ca/diff:/var/lib/containers/storage/overlay/f97315dc58a9c002ba0cabccb9933d4b0d2113733d204188c88d72f75569b57b/diff:/var/lib/containers/storage/overlay/1dbde2dd497ddde2b467727125b900958a051a72561e58d29abe3d660dcaa9a7/diff:/var/lib/containers/storage/overlay/4aad9d80f30c3f0608f58173558b7554d84dee4dc4479672926eca29f75e6e33/diff:/var/lib/containers/storage/overlay/6751fc9b6868254870c062d75a511543fc8cfda2ce6262f4945f107449219632/diff:/var/lib/containers/storage/overlay/a27034d79081347421dd24d7e9e776c18271cd9a6e51053cb39af4d3d9c400e8/diff:/var/lib/containers/storage/overlay/537cf0045ed9cd7989f7944e7393019c81b16c1799a2198d8348cd182665397f/diff:/var/lib/containers/storage/overlay/27578615c5ae352af4e8449862d61aaf5c11b105a7d5905af55bd01b0c656d6e/diff:/var/lib/containers/storage/overlay/566542742840fe3034b3596f7cb9e62a6274c95a69f368f9e713746f8712c0b6/diff', 'MergedDir': '/var/lib/containers/storage/overlay/72bb96d6c53ad57a0b1e44cab226a6251598accbead40b23fac89c19ad8c25ca/merged', 'UpperDir': '/var/lib/containers/storage/overlay/72bb96d6c53ad57a0b1e44cab226a6251598accbead40b23fac89c19ad8c25ca/diff', 'WorkDir': '/var/lib/containers/storage/overlay/72bb96d6c53ad57a0b1e44cab226a6251598accbead40b23fac89c19ad8c25ca/work'}, 'Name': 'overlay'}, 'Id': 'bcacbdf7a119c0fa934661ca8af839e625ce6540d9ceb6827cdd389f823d49e0', 'Labels': {'maintainer': 'Bitnami <[email protected]>'}, 'ManifestType': 'application/vnd.docker.distribution.manifest.v1+prettyjws', 'Os': 'linux', 'Parent': '', 'RepoDigests': ['quay.io/bitnami/wildfly@sha256:5c7d8e2dd66dcf4a152a4032a1d3c5a33458c67e1c1335edd8d18d738892356b'], 'RepoTags': ['quay.io/bitnami/wildfly:latest'], 'RootFS': {'Layers': ['sha256:75391df2c87e076b0c2f72d20c95c57dc8be7ee684cc07273416cce622b43367', 'sha256:7dd303f041039bfe8f0833092673ac35f93137d10e0fbc4302021ea65ad57731', 'sha256:720d9edf0cd2a9bb56b88b80be9070dbfaad359514c70094c65066963fed485d', 'sha256:6a567ecbf97725501a634fcb486271999aa4591b633b4ae9932a46b40f5aaf47', 'sha256:59e9a6db8f178f3da868614564faabb2820cdfb69be32e63a4405d6f7772f68c', 'sha256:310a82ccb092cd650215ab375da8943d235a263af9a029b8ac26a281446c04db', 'sha256:36cb91cf4513543a8f0953fed785747ea18b675bc2677f3839889cfca0aac79e'], 'Type': 'layers'}, 'Size': 569919342, 'User': '', 'Version': '17.06.0-ce', 'VirtualSize': 569919342}] | ### Authors * Sam Doran (@samdoran) ansible containers.podman.podman_secret – Manage podman secrets containers.podman.podman\_secret – Manage podman secrets ======================================================== Note This plugin is part of the [containers.podman collection](https://galaxy.ansible.com/containers/podman) (version 1.8.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 containers.podman`. To use it in a playbook, specify: `containers.podman.podman_secret`. New in version 1.7.0: of containers.podman * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Examples](#examples) Synopsis -------- * Manage podman secrets Requirements ------------ The below requirements are needed on the host that executes this module. * podman Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **data** string | | The value of the secret. Required when `state` is `present`. | | **executable** string | **Default:**"podman" | Path to `podman` executable if it is not in the `$PATH` on the machine running `podman` | | **force** boolean | **Choices:*** **no** ← * yes | Use it when `state` is `present` to remove and recreate an existing secret. | | **name** string / required | | The name of the secret. | | **state** string | **Choices:*** absent * **present** ← | Whether to create or remove the named secret. | Examples -------- ``` - name: Create secret containers.podman.podman_secret: state: present name: mysecret data: "my super secret content" - name: Create container that uses the secret containers.podman.podman_container: name: showmysecret image: docker.io/alpine:3.14 secrets: - mysecret detach: false command: cat /run/secrets/mysecret register: container - name: Output secret data debug: msg: '{{ container.stdout }}' - name: Remove secret containers.podman.podman_secret: state: absent name: mysecret ``` ### Authors * Aliaksandr Mianzhynski (@amenzhinsky) ansible containers.podman.podman_pod_info – Gather info about podman pods containers.podman.podman\_pod\_info – Gather info about podman pods =================================================================== Note This plugin is part of the [containers.podman collection](https://galaxy.ansible.com/containers/podman) (version 1.8.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 containers.podman`. To use it in a playbook, specify: `containers.podman.podman_pod_info`. New in version 1.0.0: of containers.podman * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Gather info about podman pods with podman inspect command. Requirements ------------ The below requirements are needed on the host that executes this module. * Podman installed on host Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **executable** string | **Default:**"podman" | Path to `podman` executable if it is not in the `$PATH` on the machine running `podman` | | **name** string | | Name of the pod | Examples -------- ``` - name: Gather info about all present pods containers.podman.podman_pod_info: - name: Gather info about specific pods containers.podman.podman_pod_info: name: special_pod ``` 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 | | --- | --- | --- | | **pods** list / elements=string | always | Facts from all or specified pods **Sample:** [{'Config': {'cgroupParent': '/libpod\_parent', 'created': '2020-07-13T20:29:12.572282186+03:00', 'hostname': 'pod1host', 'id': 'd9cb6dbb0....', 'infraConfig': {'infraPortBindings': [{'containerPort': 7111, 'hostIP': '', 'hostPort': 7777, 'protocol': 'tcp'}], 'makeInfraContainer': True}, 'labels': {}, 'lockID': 682, 'name': 'pod1', 'sharesCgroup': True, 'sharesIpc': True, 'sharesNet': True, 'sharesUts': True}, 'Containers': [{'id': 'ad46737bf....', 'state': 'configured'}], 'State': {'cgroupPath': '/libpod\_parent/d9cb6dbb0....', 'infraContainerID': 'ad46737bf....', 'status': 'Created'}}] | ### Authors * Sagi Shnaidman (@sshnaidm) ansible containers.podman.podman_container – Manage podman containers containers.podman.podman\_container – Manage podman containers ============================================================== Note This plugin is part of the [containers.podman collection](https://galaxy.ansible.com/containers/podman) (version 1.8.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 containers.podman`. To use it in a playbook, specify: `containers.podman.podman_container`. New in version 1.0.0: of containers.podman * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Start, stop, restart and manage Podman containers Requirements ------------ The below requirements are needed on the host that executes this module. * podman Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **annotation** dictionary | | Add an annotation to the container. The format is key value, multiple times. | | **authfile** path | | Path of the authentication file. Default is ``${XDG\_RUNTIME\_DIR}/containers/auth.json`` (Not available for remote commands) You can also override the default path of the authentication file by setting the ``REGISTRY\_AUTH\_FILE`` environment variable. ``export REGISTRY\_AUTH\_FILE=path`` | | **blkio\_weight** integer | | Block IO weight (relative weight) accepts a weight value between 10 and 1000 | | **blkio\_weight\_device** dictionary | | Block IO weight (relative device weight, format DEVICE\_NAME[:]WEIGHT). | | **cap\_add** list / elements=string | | List of capabilities to add to the container. aliases: capabilities | | **cap\_drop** list / elements=string | | List of capabilities to drop from the container. | | **cgroup\_parent** path | | Path to cgroups under which the cgroup for the container will be created. If the path is not absolute, the path is considered to be relative to the cgroups path of the init process. Cgroups will be created if they do not already exist. | | **cgroupns** string | | Path to cgroups under which the cgroup for the container will be created. | | **cgroups** string | | Determines whether the container will create CGroups. Valid values are enabled and disabled, which the default being enabled. The disabled option will force the container to not create CGroups, and thus conflicts with CGroup options cgroupns and cgroup-parent. | | **cidfile** path | | Write the container ID to the file | | **cmd\_args** list / elements=string | | Any additional command options you want to pass to podman command, cmd\_args - ['--other-param', 'value'] Be aware module doesn't support idempotency if this is set. | | **command** raw | | Override command of container. Can be a string or a list. | | **conmon\_pidfile** path | | Write the pid of the conmon process to a file. conmon runs in a separate process than Podman, so this is necessary when using systemd to restart Podman containers. | | **cpu\_period** integer | | Limit the CPU real-time period in microseconds | | **cpu\_rt\_period** integer | | Limit the CPU real-time period in microseconds. Limit the container's Real Time CPU usage. This flag tell the kernel to restrict the container's Real Time CPU usage to the period you specify. | | **cpu\_rt\_runtime** integer | | Limit the CPU real-time runtime in microseconds. This flag tells the kernel to limit the amount of time in a given CPU period Real Time tasks may consume. | | **cpu\_shares** integer | | CPU shares (relative weight) | | **cpus** string | | Number of CPUs. The default is 0.0 which means no limit. | | **cpuset\_cpus** string | | CPUs in which to allow execution (0-3, 0,1) | | **cpuset\_mems** string | | Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems. | | **debug** boolean | **Choices:*** **no** ← * yes | Return additional information which can be helpful for investigations. | | **detach** boolean | **Choices:*** no * **yes** ← | Run container in detach mode | | **detach\_keys** string | | Override the key sequence for detaching a container. Format is a single character or ctrl-value | | **device** list / elements=string | | Add a host device to the container. The format is <device-on-host>[:<device-on-container>][:<permissions>] (e.g. device /dev/sdc:/dev/xvdc:rwm) | | **device\_read\_bps** list / elements=string | | Limit read rate (bytes per second) from a device (e.g. device-read-bps /dev/sda:1mb) | | **device\_read\_iops** list / elements=string | | Limit read rate (IO per second) from a device (e.g. device-read-iops /dev/sda:1000) | | **device\_write\_bps** list / elements=string | | Limit write rate (bytes per second) to a device (e.g. device-write-bps /dev/sda:1mb) | | **device\_write\_iops** list / elements=string | | Limit write rate (IO per second) to a device (e.g. device-write-iops /dev/sda:1000) | | **dns** list / elements=string | | Set custom DNS servers aliases: dns\_servers | | **dns\_option** string | | Set custom DNS options aliases: dns\_opts | | **dns\_search** string | | Set custom DNS search domains (Use dns\_search with '' if you don't wish to set the search domain) aliases: dns\_search\_domains | | **entrypoint** string | | Overwrite the default ENTRYPOINT of the image | | **env** dictionary | | Set environment variables. This option allows you to specify arbitrary environment variables that are available for the process that will be launched inside of the container. | | **env\_file** path | | Read in a line delimited file of environment variables. Doesn't support idempotency. If users changes the file with environment variables it's on them to recreate the container. | | **env\_host** boolean | **Choices:*** no * yes | Use all current host environment variables in container. Defaults to false. | | **etc\_hosts** dictionary | | Dict of host-to-IP mappings, where each host name is a key in the dictionary. Each host name will be added to the container's ``/etc/hosts`` file. aliases: add\_hosts | | **executable** string | **Default:**"podman" | Path to `podman` executable if it is not in the `$PATH` on the machine running `podman` | | **expose** list / elements=string | | Expose a port, or a range of ports (e.g. expose "3300-3310") to set up port redirection on the host system. aliases: exposed, exposed\_ports | | **force\_restart** boolean | **Choices:*** **no** ← * yes | Force restart of container. aliases: restart | | **generate\_systemd** dictionary | **Default:**{} | Generate systemd unit file for container. | | | **container\_prefix** string | | Set the systemd unit name prefix for containers. The default is "container". | | | **names** boolean | **Choices:*** no * **yes** ← | Use names of the containers for the start, stop, and description in the unit file. Default is true. | | | **no\_header** boolean | **Choices:*** **no** ← * yes | Do not generate the header including meta data such as the Podman version and the timestamp. From podman version 3.1.0. | | | **path** string | | Specify a path to the directory where unit files will be generated. If it doesn't exist, the directory will be created. | | | **pod\_prefix** string | | Set the systemd unit name prefix for pods. The default is "pod". | | | **restart\_policy** string | **Choices:*** no * on-success * on-failure * on-abnormal * on-watchdog * on-abort * always | Specify a restart policy for the service. The restart-policy must be one of "no", "on-success", "on-failure", "on-abnormal", "on-watchdog", "on-abort", or "always". The default policy is "on-failure". | | | **separator** string | | Set the systemd unit name separator between the name/id of a container/pod and the prefix. The default is "-" (dash). | | | **time** integer | | Override the default stop timeout for the container with the given value. | | **gidmap** list / elements=string | | Run the container in a new user namespace using the supplied mapping. | | **group\_add** list / elements=string | | Add additional groups to run as aliases: groups | | **healthcheck** string | | Set or alter a healthcheck command for a container. | | **healthcheck\_interval** string | | Set an interval for the healthchecks (a value of disable results in no automatic timer setup) (default "30s") | | **healthcheck\_retries** integer | | The number of retries allowed before a healthcheck is considered to be unhealthy. The default value is 3. | | **healthcheck\_start\_period** string | | The initialization time needed for a container to bootstrap. The value can be expressed in time format like 2m3s. The default value is 0s | | **healthcheck\_timeout** string | | The maximum time allowed to complete the healthcheck before an interval is considered failed. Like start-period, the value can be expressed in a time format such as 1m22s. The default value is 30s | | **hostname** string | | Container host name. Sets the container host name that is available inside the container. | | **http\_proxy** boolean | **Choices:*** no * yes | By default proxy environment variables are passed into the container if set for the podman process. This can be disabled by setting the http\_proxy option to false. The environment variables passed in include http\_proxy, https\_proxy, ftp\_proxy, no\_proxy, and also the upper case versions of those. Defaults to true | | **image** string | | Repository path (or image name) and tag used to create the container. If an image is not found, the image will be pulled from the registry. If no tag is included, `latest` will be used. Can also be an image ID. If this is the case, the image is assumed to be available locally. | | **image\_strict** boolean | **Choices:*** **no** ← * yes | Whether to compare images in idempotency by taking into account a full name with registry and namespaces. | | **image\_volume** string | **Choices:*** bind * tmpfs * ignore | Tells podman how to handle the builtin image volumes. The options are bind, tmpfs, or ignore (default bind) | | **init** boolean | **Choices:*** no * yes | Run an init inside the container that forwards signals and reaps processes. The default is false. | | **init\_path** string | | Path to the container-init binary. | | **interactive** boolean | **Choices:*** no * yes | Keep STDIN open even if not attached. The default is false. When set to true, keep stdin open even if not attached. The default is false. | | **ip** string | | Specify a static IP address for the container, for example '10.88.64.128'. Can only be used if no additional CNI networks to join were specified via 'network:', and if the container is not joining another container's network namespace via 'network container:<name|id>'. The address must be within the default CNI network's pool (default 10.88.0.0/16). | | **ipc** string | | Default is to create a private IPC namespace (POSIX SysV IPC) for the container aliases: ipc\_mode | | **kernel\_memory** string | | Kernel memory limit (format <number>[<unit>], where unit = b, k, m or g) Note - idempotency is supported for integers only. | | **label** dictionary | | Add metadata to a container, pass dictionary of label names and values aliases: labels | | **label\_file** string | | Read in a line delimited file of labels | | **log\_driver** string | **Choices:*** k8s-file * journald * json-file | Logging driver. Used to set the log driver for the container. For example log\_driver "k8s-file". | | **log\_level** string | **Choices:*** debug * info * warn * error * fatal * panic | Logging level for Podman. Log messages above specified level ("debug"|"info"|"warn"|"error"|"fatal"|"panic") (default "error") | | **log\_opt** dictionary | | Logging driver specific options. Used to set the path to the container log file. aliases: log\_options | | | **max\_size** string | | Specify a max size of the log file (e.g 10mb). | | | **path** string | | Specify a path to the log file (e.g. /var/log/container/mycontainer.json). | | | **tag** string | | Specify a custom log tag for the container. | | **mac\_address** string | | Specify a MAC address for the container, for example '92:d0:c6:0a:29:33'. Don't forget that it must be unique within one Ethernet network. | | **memory** string | | Memory limit (format 10k, where unit = b, k, m or g) Note - idempotency is supported for integers only. | | **memory\_reservation** string | | Memory soft limit (format 100m, where unit = b, k, m or g) Note - idempotency is supported for integers only. | | **memory\_swap** string | | A limit value equal to memory plus swap. Must be used with the -m (--memory) flag. The swap LIMIT should always be larger than -m (--memory) value. By default, the swap LIMIT will be set to double the value of --memory Note - idempotency is supported for integers only. | | **memory\_swappiness** integer | | Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100. | | **mount** string | | Attach a filesystem mount to the container. bind or tmpfs For example mount "type=bind,source=/path/on/host,destination=/path/in/container" | | **name** string / required | | Name of the container | | **network** list / elements=string | | Set the Network mode for the container \* bridge create a network stack on the default bridge \* none no networking \* container:<name|id> reuse another container's network stack \* host use the podman host network stack. \* <network-name>|<network-id> connect to a user-defined network \* ns:<path> path to a network namespace to join \* slirp4netns use slirp4netns to create a user network stack. This is the default for rootless containers aliases: net, network\_mode | | **no\_hosts** boolean | **Choices:*** no * yes | Do not create /etc/hosts for the container Default is false. | | **oom\_kill\_disable** boolean | **Choices:*** no * yes | Whether to disable OOM Killer for the container or not. Default is false. | | **oom\_score\_adj** integer | | Tune the host's OOM preferences for containers (accepts -1000 to 1000) | | **pid** string | | Set the PID mode for the container aliases: pid\_mode | | **pids\_limit** string | | Tune the container's PIDs limit. Set -1 to have unlimited PIDs for the container. | | **pod** string | | Run container in an existing pod. If you want podman to make the pod for you, preference the pod name with "new:" | | **privileged** boolean | **Choices:*** no * yes | Give extended privileges to this container. The default is false. | | **publish** list / elements=string | | Publish a container's port, or range of ports, to the host. Format - ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort | containerPort In case of only containerPort is set, the hostPort will chosen randomly by Podman. aliases: ports, published, published\_ports | | **publish\_all** boolean | **Choices:*** no * yes | Publish all exposed ports to random ports on the host interfaces. The default is false. | | **read\_only** boolean | **Choices:*** no * yes | Mount the container's root filesystem as read only. Default is false | | **read\_only\_tmpfs** boolean | **Choices:*** no * yes | If container is running in --read-only mode, then mount a read-write tmpfs on /run, /tmp, and /var/tmp. The default is true | | **recreate** boolean | **Choices:*** **no** ← * yes | Use with present and started states to force the re-creation of an existing container. | | **restart\_policy** string | | Restart policy to follow when containers exit. Restart policy will not take effect if a container is stopped via the podman kill or podman stop commands. Valid values are \* no - Do not restart containers on exit \* on-failure[:max\_retries] - Restart containers when they exit with a non-0 exit code, retrying indefinitely or until the optional max\_retries count is hit \* always - Restart containers when they exit, regardless of status, retrying indefinitely | | **rm** boolean | **Choices:*** no * yes | Automatically remove the container when it exits. The default is false. aliases: remove, auto\_remove | | **rootfs** boolean | **Choices:*** no * yes | If true, the first argument refers to an exploded container on the file system. The default is false. | | **secrets** list / elements=string | | Add the named secrets into the container at /run/secrets. | | **security\_opt** list / elements=string | | Security Options. For example security\_opt "seccomp=unconfined" | | **shm\_size** string | | Size of /dev/shm. The format is <number><unit>. number must be greater than 0. Unit is optional and can be b (bytes), k (kilobytes), m(megabytes), or g (gigabytes). If you omit the unit, the system uses bytes. If you omit the size entirely, the system uses 64m | | **sig\_proxy** boolean | **Choices:*** no * yes | Proxy signals sent to the podman run command to the container process. SIGCHLD, SIGSTOP, and SIGKILL are not proxied. The default is true. | | **state** string | **Choices:*** absent * present * stopped * **started** ← * created | *absent* - A container matching the specified name will be stopped and removed. *present* - Asserts the existence of a container matching the name and any provided configuration parameters. If no container matches the name, a container will be created. If a container matches the name but the provided configuration does not match, the container will be updated, if it can be. If it cannot be updated, it will be removed and re-created with the requested config. Image version will be taken into account when comparing configuration. Use the recreate option to force the re-creation of the matching container. *started* - Asserts there is a running container matching the name and any provided configuration. If no container matches the name, a container will be created and started. Use recreate to always re-create a matching container, even if it is running. Use force\_restart to force a matching container to be stopped and restarted. *stopped* - Asserts that the container is first *present*, and then if the container is running moves it to a stopped state. *created* - Asserts that the container exists with given configuration. If container doesn't exist, the module creates it and leaves it in 'created' state. If configuration doesn't match or 'recreate' option is set, the container will be recreated | | **stop\_signal** integer | | Signal to stop a container. Default is SIGTERM. | | **stop\_timeout** integer | | Timeout (in seconds) to stop a container. Default is 10. | | **subgidname** string | | Run the container in a new user namespace using the map with 'name' in the /etc/subgid file. | | **subuidname** string | | Run the container in a new user namespace using the map with 'name' in the /etc/subuid file. | | **sysctl** dictionary | | Configure namespaced kernel parameters at runtime | | **systemd** string | | Run container in systemd mode. The default is true. | | **timezone** string | | Set timezone in container. This flag takes area-based timezones, GMT time, as well as local, which sets the timezone in the container to match the host machine. See /usr/share/zoneinfo/ for valid timezones. Remote connections use local containers.conf for defaults. | | **tmpfs** dictionary | | Create a tmpfs mount. For example tmpfs "/tmp" "rw,size=787448k,mode=1777" | | **tty** boolean | **Choices:*** no * yes | Allocate a pseudo-TTY. The default is false. | | **uidmap** list / elements=string | | Run the container in a new user namespace using the supplied mapping. | | **ulimit** list / elements=string | | Ulimit options aliases: ulimits | | **user** string | | Sets the username or UID used and optionally the groupname or GID for the specified command. | | **userns** string | | Set the user namespace mode for the container. It defaults to the PODMAN\_USERNS environment variable. An empty value means user namespaces are disabled. aliases: userns\_mode | | **uts** string | | Set the UTS mode for the container | | **volume** list / elements=string | | Create a bind mount. If you specify, volume /HOST-DIR:/CONTAINER-DIR, podman bind mounts /HOST-DIR in the host to /CONTAINER-DIR in the podman container. aliases: volumes | | **volumes\_from** list / elements=string | | Mount volumes from the specified container(s). | | **workdir** string | | Working directory inside the container. The default working directory for running binaries within a container is the root directory (/). aliases: working\_dir | Examples -------- ``` - name: Run container containers.podman.podman_container: name: container image: quay.io/bitnami/wildfly state: started - name: Create a data container containers.podman.podman_container: name: mydata image: busybox volume: - /tmp/data - name: Re-create a redis container with systemd service file generated in /tmp/ containers.podman.podman_container: name: myredis image: redis command: redis-server --appendonly yes state: present recreate: yes expose: - 6379 volumes_from: - mydata generate_systemd: path: /tmp/ restart_policy: always time: 120 names: true container_prefix: ainer - name: Restart a container containers.podman.podman_container: name: myapplication image: redis state: started restart: yes etc_hosts: other: "127.0.0.1" restart_policy: "no" device: "/dev/sda:/dev/xvda:rwm" ports: - "8080:9000" - "127.0.0.1:8081:9001/udp" env: SECRET_KEY: "ssssh" BOOLEAN_KEY: "yes" - name: Container present containers.podman.podman_container: name: mycontainer state: present image: ubuntu:14.04 command: "sleep 1d" - name: Stop a container containers.podman.podman_container: name: mycontainer state: stopped - name: Start 4 load-balanced containers containers.podman.podman_container: name: "container{{ item }}" recreate: yes image: someuser/anotherappimage command: sleep 1d with_sequence: count=4 - name: remove container containers.podman.podman_container: name: ohno state: absent - name: Writing output containers.podman.podman_container: name: myservice image: busybox log_options: path=/var/log/container/mycontainer.json log_driver: k8s-file ``` 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** dictionary | always | Facts representing the current state of the container. Matches the podman inspection output. Note that facts are part of the registered vars since Ansible 2.8. For compatibility reasons, the facts are also accessible directly as `podman_container`. Note that the returned fact will be removed in Ansible 2.12. Empty if `state` is *absent*. **Sample:** { "AppArmorProfile": "", "Args": [ "sh" ], "BoundingCaps": [ "CAP\_CHOWN", ... ], "Config": { "Annotations": { "io.kubernetes.cri-o.ContainerType": "sandbox", "io.kubernetes.cri-o.TTY": "false" }, "AttachStderr": false, "AttachStdin": false, "AttachStdout": false, "Cmd": [ "sh" ], "Domainname": "", "Entrypoint": "", "Env": [ "PATH=/usr/sbin:/usr/bin:/sbin:/bin", "TERM=xterm", "HOSTNAME=", "container=podman" ], "Hostname": "", "Image": "docker.io/library/busybox:latest", "Labels": null, "OpenStdin": false, "StdinOnce": false, "StopSignal": 15, "Tty": false, "User": { "gid": 0, "uid": 0 }, "Volumes": null, "WorkingDir": "/" }, "ConmonPidFile": "...", "Created": "2019-06-17T19:13:09.873858307+03:00", "Dependencies": [], "Driver": "overlay", "EffectiveCaps": [ "CAP\_CHOWN", ... ], "ExecIDs": [], "ExitCommand": [ "/usr/bin/podman", "--root", ... ], "GraphDriver": { ... }, "HostConfig": { ... }, "HostnamePath": "...", "HostsPath": "...", "ID": "...", "Image": "...", "ImageName": "docker.io/library/busybox:latest", "IsInfra": false, "LogPath": "/tmp/container/mycontainer.json", "MountLabel": "system\_u:object\_r:container\_file\_t:s0:c282,c782", "Mounts": [ ... ], "Name": "myservice", "Namespace": "", "NetworkSettings": { "Bridge": "", ... }, "Path": "sh", "ProcessLabel": "system\_u:system\_r:container\_t:s0:c282,c782", "ResolvConfPath": "...", "RestartCount": 0, "Rootfs": "", "State": { "Dead": false, "Error": "", "ExitCode": 0, "FinishedAt": "2019-06-17T19:13:10.157518963+03:00", "Healthcheck": { "FailingStreak": 0, "Log": null, "Status": "" }, "OOMKilled": false, "OciVersion": "1.0.1-dev", "Paused": false, "Pid": 4083, "Restarting": false, "Running": false, "StartedAt": "2019-06-17T19:13:10.152479729+03:00", "Status": "exited" }, "StaticDir": "..." ... } | ### Authors * Sagi Shnaidman (@sshnaidm)
programming_docs
ansible containers.podman.podman_login_info – Return the logged-in user if any for a given registry containers.podman.podman\_login\_info – Return the logged-in user if any for a given registry ============================================================================================= Note This plugin is part of the [containers.podman collection](https://galaxy.ansible.com/containers/podman) (version 1.8.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 containers.podman`. To use it in a playbook, specify: `containers.podman.podman_login_info`. New in version 1.0.0: of containers.podman * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Return the logged-in user if any for a given registry. Requirements ------------ The below requirements are needed on the host that executes this module. * Podman installed on host Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **authfile** path | | Path of the authentication file. Default is ``${XDG\_RUNTIME\_DIR}/containers/auth.json`` (Not available for remote commands) You can also override the default path of the authentication file by setting the ``REGISTRY\_AUTH\_FILE`` environment variable. ``export REGISTRY\_AUTH\_FILE=path`` | | **executable** string | **Default:**"podman" | Path to `podman` executable if it is not in the `$PATH` on the machine running `podman` | | **registry** string / required | | Registry server. | Examples -------- ``` - name: Return the logged-in user for docker hub registry containers.podman.podman_login_info: registry: docker.io - name: Return the logged-in user for quay.io registry containers.podman.podman_login_info: registry: quay.io ``` 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 | | --- | --- | --- | | **login** dictionary | always | Logged in user for a registry **Sample:** {'logged\_in': True, 'registry': 'docker.io', 'username': 'clelange'} | ### Authors * Clemens Lange (@clelange) ansible containers.podman.podman_pod – Manage Podman pods containers.podman.podman\_pod – Manage Podman pods ================================================== Note This plugin is part of the [containers.podman collection](https://galaxy.ansible.com/containers/podman) (version 1.8.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 containers.podman`. To use it in a playbook, specify: `containers.podman.podman_pod`. New in version 1.0.0: of containers.podman * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Manage podman pods. Requirements ------------ The below requirements are needed on the host that executes this module. * podman Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **add\_host** list / elements=string | | Add a host to the /etc/hosts file shared between all containers in the pod. | | **cgroup\_parent** string | | Path to cgroups under which the cgroup for the pod will be created. If the path is not absolute, he path is considered to be relative to the cgroups path of the init process. Cgroups will be created if they do not already exist. | | **debug** boolean | **Choices:*** **no** ← * yes | Return additional information which can be helpful for investigations. | | **dns** list / elements=string | | Set custom DNS servers in the /etc/resolv.conf file that will be shared between all containers in the pod. A special option, "none" is allowed which disables creation of /etc/resolv.conf for the pod. | | **dns\_opt** list / elements=string | | Set custom DNS options in the /etc/resolv.conf file that will be shared between all containers in the pod. | | **dns\_search** list / elements=string | | Set custom DNS search domains in the /etc/resolv.conf file that will be shared between all containers in the pod. | | **executable** string | **Default:**"podman" | Path to `podman` executable if it is not in the `$PATH` on the machine running `podman` | | **generate\_systemd** dictionary | **Default:**{} | Generate systemd unit file for container. | | | **container\_prefix** string | | Set the systemd unit name prefix for containers. The default is "container". | | | **names** boolean | **Choices:*** no * **yes** ← | Use names of the containers for the start, stop, and description in the unit file. Default is true. | | | **no\_header** boolean | **Choices:*** **no** ← * yes | Do not generate the header including meta data such as the Podman version and the timestamp. From podman version 3.1.0. | | | **path** string | | Specify a path to the directory where unit files will be generated. If it doesn't exist, the directory will be created. | | | **pod\_prefix** string | | Set the systemd unit name prefix for pods. The default is "pod". | | | **restart\_policy** string | **Choices:*** no * on-success * on-failure * on-abnormal * on-watchdog * on-abort * always | Specify a restart policy for the service. The restart-policy must be one of "no", "on-success", "on-failure", "on-abnormal", "on-watchdog", "on-abort", or "always". The default policy is "on-failure". | | | **separator** string | | Set the systemd unit name separator between the name/id of a container/pod and the prefix. The default is "-" (dash). | | | **time** integer | | Override the default stop timeout for the container with the given value. | | **hostname** string | | Set a hostname to the pod | | **infra** boolean | **Choices:*** no * yes | Create an infra container and associate it with the pod. An infra container is a lightweight container used to coordinate the shared kernel namespace of a pod. Default is true. | | **infra\_command** string | | The command that will be run to start the infra container. Default is "/pause". | | **infra\_conmon\_pidfile** string | | Write the pid of the infra container's conmon process to a file. As conmon runs in a separate process than Podman, this is necessary when using systemd to manage Podman containers and pods. | | **infra\_image** string | | The image that will be created for the infra container. Default is "k8s.gcr.io/pause:3.1". | | **infra\_name** string | | The name that will be used for the pod's infra container. | | **ip** string | | Set a static IP for the pod's shared network. | | **label** dictionary | | Add metadata to a pod, pass dictionary of label keys and values. | | **label\_file** string | | Read in a line delimited file of labels. | | **mac\_address** string | | Set a static MAC address for the pod's shared network. | | **name** string / required | | Assign a name to the pod. | | **network** string | | Set network mode for the pod. Supported values are bridge (the default), host (do not create a network namespace, all containers in the pod will use the host's network), or a comma-separated list of the names of CNI networks the pod should join. | | **no\_hosts** boolean | **Choices:*** no * yes | Disable creation of /etc/hosts for the pod. | | **pod\_id\_file** string | | Write the pod ID to the file. | | **publish** list / elements=string | | Publish a port or range of ports from the pod to the host. aliases: ports | | **recreate** boolean | **Choices:*** **no** ← * yes | Use with present and started states to force the re-creation of an existing pod. | | **share** string | | A comma delimited list of kernel namespaces to share. If none or "" is specified, no namespaces will be shared. The namespaces to choose from are ipc, net, pid, user, uts. | | **state** string | **Choices:*** **created** ← * killed * restarted * absent * started * stopped * paused * unpaused | This variable is set for state | Examples -------- ``` # What modules does for example - podman_pod: name: pod1 state: started ports: - 4444:5555 ``` 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 | | --- | --- | --- | | **pod** dictionary | always | Pod inspection results for the given pod built. **Sample:** {'Config': {'cgroupParent': '/libpod\_parent', 'created': '2020-06-14T15:16:12.230818767+03:00', 'hostname': 'newpod', 'id': 'a5a5c6cdf8c72272fc5c33f787e8d7501e2fa0c1e92b2b602860defdafeeec58', 'infraConfig': {'infraPortBindings': None, 'makeInfraContainer': True}, 'labels': {}, 'lockID': 515, 'name': 'newpod', 'sharesCgroup': True, 'sharesIpc': True, 'sharesNet': True, 'sharesUts': True}, 'Containers': [{'id': 'dc70a947c7ae15198ec38b3c817587584085dee3919cbeb9969e3ab77ba10fd2', 'state': 'configured'}], 'State': {'cgroupPath': '/libpod\_parent/a5a5c6cdf8c72272fc5c33f787e8d7501e2fa0c1e92b2b602860defdafeeec58', 'infraContainerID': 'dc70a947c7ae15198ec38b3c817587584085dee3919cbeb9969e3ab77ba10fd2', 'status': 'Created'}} | ### Authors * Sagi Shnaidman (@sshnaidm) ansible containers.podman.podman_load – Load image from a tar file. containers.podman.podman\_load – Load image from a tar file. ============================================================ Note This plugin is part of the [containers.podman collection](https://galaxy.ansible.com/containers/podman) (version 1.8.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 containers.podman`. To use it in a playbook, specify: `containers.podman.podman_load`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * podman load loads an image from either an oci-archive or a docker-archive stored on the local machine into container storage. podman load is used for loading from the archive generated by podman save, that includes the image parent layers. Requirements ------------ The below requirements are needed on the host that executes this module. * Podman installed on host Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **executable** string | **Default:**"podman" | Path to `podman` executable if it is not in the `$PATH` on the machine running `podman` | | **input** string / required | | Path to image file to load. aliases: path | Examples -------- ``` # What modules does for example - containers.podman.podman_load: input: /path/to/tar/file ``` 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 | | --- | --- | --- | | **image** dictionary | always | info from loaded image **Sample:** [{'Annotations': {}, 'Architecture': 'amd64', 'Author': '', 'Comment': 'from Bitnami with love', 'ContainerConfig': {'Cmd': ['nami', 'start', '--foreground', 'wildfly'], 'Entrypoint': ['/app-entrypoint.sh'], 'Env': ['PATH=/opt/bitnami/java/bin:/opt/bitnami/wildfly/bin:/opt/bitnami/nami/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'IMAGE\_OS=debian-9', 'NAMI\_VERSION=0.0.9-0', 'GPG\_KEY\_SERVERS\_LIST=ha.pool.sks-keyservers.net hkp://p80.pool.sks-keyservers.net:80 keyserver.ubuntu.com hkp://keyserver.ubuntu.com:80 pgp.mit.edu', 'TINI\_VERSION=v0.13.2', 'TINI\_GPG\_KEY=595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7', 'GOSU\_VERSION=1.10', 'GOSU\_GPG\_KEY=B42F6819007F00F88E364FD4036A9C25BF357DD4', 'BITNAMI\_IMAGE\_VERSION=14.0.1-debian-9-r12', 'BITNAMI\_APP\_NAME=wildfly', 'WILDFLY\_JAVA\_HOME=', 'WILDFLY\_JAVA\_OPTS=', 'WILDFLY\_MANAGEMENT\_HTTP\_PORT\_NUMBER=9990', 'WILDFLY\_PASSWORD=bitnami', 'WILDFLY\_PUBLIC\_CONSOLE=true', 'WILDFLY\_SERVER\_AJP\_PORT\_NUMBER=8009', 'WILDFLY\_SERVER\_HTTP\_PORT\_NUMBER=8080', 'WILDFLY\_SERVER\_INTERFACE=0.0.0.0', 'WILDFLY\_USERNAME=user', 'WILDFLY\_WILDFLY\_HOME=/home/wildfly', 'WILDFLY\_WILDFLY\_OPTS=-Dwildfly.as.deployment.ondemand=false'], 'ExposedPorts': {'8080/tcp': {}, '9990/tcp': {}}, 'Labels': {'maintainer': 'Bitnami <[email protected]>'}}, 'Created': '2018-09-25T04:07:45.934395523Z', 'Digest': 'sha256:5c7d8e2dd66dcf4a152a4032a1d3c5a33458c67e1c1335edd8d18d738892356b', 'GraphDriver': {'Data': {'LowerDir': '/var/lib/containers/storage/overlay/a9dbf5616cc16919a8ac0dfc60aff87a72b5be52994c4649fcc91a089a12931f/diff:/var/lib/containers/storage/overlay/67129bd46022122a7d8b7acb490092af6c7ce244ce4fbd7d9e2d2b7f5979e090/diff:/var/lib/containers/storage/overlay/7c51242c4c5db5c74afda76d7fdbeab6965d8b21804bb3fc597dee09c770b0ca/diff:/var/lib/containers/storage/overlay/f97315dc58a9c002ba0cabccb9933d4b0d2113733d204188c88d72f75569b57b/diff:/var/lib/containers/storage/overlay/1dbde2dd497ddde2b467727125b900958a051a72561e58d29abe3d660dcaa9a7/diff:/var/lib/containers/storage/overlay/4aad9d80f30c3f0608f58173558b7554d84dee4dc4479672926eca29f75e6e33/diff:/var/lib/containers/storage/overlay/6751fc9b6868254870c062d75a511543fc8cfda2ce6262f4945f107449219632/diff:/var/lib/containers/storage/overlay/a27034d79081347421dd24d7e9e776c18271cd9a6e51053cb39af4d3d9c400e8/diff:/var/lib/containers/storage/overlay/537cf0045ed9cd7989f7944e7393019c81b16c1799a2198d8348cd182665397f/diff:/var/lib/containers/storage/overlay/27578615c5ae352af4e8449862d61aaf5c11b105a7d5905af55bd01b0c656d6e/diff:/var/lib/containers/storage/overlay/566542742840fe3034b3596f7cb9e62a6274c95a69f368f9e713746f8712c0b6/diff', 'MergedDir': '/var/lib/containers/storage/overlay/72bb96d6c53ad57a0b1e44cab226a6251598accbead40b23fac89c19ad8c25ca/merged', 'UpperDir': '/var/lib/containers/storage/overlay/72bb96d6c53ad57a0b1e44cab226a6251598accbead40b23fac89c19ad8c25ca/diff', 'WorkDir': '/var/lib/containers/storage/overlay/72bb96d6c53ad57a0b1e44cab226a6251598accbead40b23fac89c19ad8c25ca/work'}, 'Name': 'overlay'}, 'Id': 'bcacbdf7a119c0fa934661ca8af839e625ce6540d9ceb6827cdd389f823d49e0', 'Labels': {'maintainer': 'Bitnami <[email protected]>'}, 'ManifestType': 'application/vnd.docker.distribution.manifest.v1+prettyjws', 'Os': 'linux', 'Parent': '', 'RepoDigests': ['quay.io/bitnami/wildfly@sha256:5c7d8e2dd66dcf4a152a4032a1d3c5a33458c67e1c1335edd8d18d738892356b'], 'RepoTags': ['quay.io/bitnami/wildfly:latest'], 'RootFS': {'Layers': ['sha256:75391df2c87e076b0c2f72d20c95c57dc8be7ee684cc07273416cce622b43367', 'sha256:7dd303f041039bfe8f0833092673ac35f93137d10e0fbc4302021ea65ad57731', 'sha256:720d9edf0cd2a9bb56b88b80be9070dbfaad359514c70094c65066963fed485d', 'sha256:6a567ecbf97725501a634fcb486271999aa4591b633b4ae9932a46b40f5aaf47', 'sha256:59e9a6db8f178f3da868614564faabb2820cdfb69be32e63a4405d6f7772f68c', 'sha256:310a82ccb092cd650215ab375da8943d235a263af9a029b8ac26a281446c04db', 'sha256:36cb91cf4513543a8f0953fed785747ea18b675bc2677f3839889cfca0aac79e'], 'Type': 'layers'}, 'Size': 569919342, 'User': '', 'Version': '17.06.0-ce', 'VirtualSize': 569919342}] | ### Authors * Sagi Shnaidman (@sshnaidm) ansible containers.podman.podman_play – Play kubernetes YAML file using podman containers.podman.podman\_play – Play kubernetes YAML file using podman ======================================================================= Note This plugin is part of the [containers.podman collection](https://galaxy.ansible.com/containers/podman) (version 1.8.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 containers.podman`. To use it in a playbook, specify: `containers.podman.podman_play`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Examples](#examples) Synopsis -------- * The module reads in a structured file of Kubernetes YAML. It will then recreate the pod and containers described in the YAML. Requirements ------------ The below requirements are needed on the host that executes this module. * Podman installed on host Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **authfile** path | | Path of the authentication file. Default is ${XDG\_RUNTIME\_DIR}/containers/auth.json, which is set using podman login. If the authorization state is not found there, $HOME/.docker/config.json is checked, which is set using docker login. Note - You can also override the default path of the authentication file by setting the REGISTRY\_AUTH\_FILE environment variable. export REGISTRY\_AUTH\_FILE=path | | **cert\_dir** path | | Use certificates at path (\*.crt, \*.cert, \*.key) to connect to the registry. Default certificates directory is /etc/containers/certs.d. (This option is not available with the remote Podman client) | | **configmap** list / elements=path | | Use Kubernetes configmap YAML at path to provide a source for environment variable values within the containers of the pod. Note - The configmap option can be used multiple times to pass multiple Kubernetes configmap YAMLs | | **debug** boolean | **Choices:*** no * yes | Enable debug for the module. | | **executable** string | **Default:**"podman" | Name of executable to run, by default 'podman' | | **kube\_file** path / required | | Path to file with YAML configuration for a Pod. | | **log\_driver** string | | Set logging driver for all created containers. | | **log\_level** string | **Choices:*** debug * info * warn * error * fatal * panic | Set logging level for podman calls. Log messages above specified level ("debug"|"info"|"warn"|"error"|"fatal"|"panic") (default "error") | | **network** list / elements=string | | List of the names of CNI networks the pod should join. | | **password** string | | The username and password to use to authenticate with the registry if required. | | **quiet** boolean | **Choices:*** no * yes | Hide image pulls logs from output. | | **recreate** boolean | **Choices:*** no * yes | If pod already exists, delete it and run the new one. | | **seccomp\_profile\_root** path | | Directory path for seccomp profiles (default is "/var/lib/kubelet/seccomp"). This option is not available with the remote Podman client | | **state** string / required | **Choices:*** created * started * absent | Start the pod after creating it, or to leave it created only. | | **tls\_verify** boolean | **Choices:*** no * yes | Require HTTPS and verify certificates when contacting registries (default is true). If explicitly set to true, then TLS verification will be used. If set to false, then TLS verification will not be used. If not specified, TLS verification will be used unless the target registry is listed as an insecure registry in registries.conf. | | **username** string | | The username and password to use to authenticate with the registry if required. | Examples -------- ``` - name: Play kube file containers.podman.podman_play: kube_file: ~/kube.yaml ``` ### Authors * Sagi Shnaidman (@sshnaidm)
programming_docs
ansible containers.podman.podman_volume – Manage Podman volumes containers.podman.podman\_volume – Manage Podman volumes ======================================================== Note This plugin is part of the [containers.podman collection](https://galaxy.ansible.com/containers/podman) (version 1.8.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 containers.podman`. To use it in a playbook, specify: `containers.podman.podman_volume`. New in version 1.1.0: of containers.podman * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Manage Podman volumes Requirements ------------ The below requirements are needed on the host that executes this module. * podman Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **debug** boolean | **Choices:*** **no** ← * yes | Return additional information which can be helpful for investigations. | | **driver** string | | Specify volume driver name (default local). | | **executable** string | **Default:**"podman" | Path to `podman` executable if it is not in the `$PATH` on the machine running `podman` | | **label** dictionary | | Add metadata to a pod volume (e.g., label com.example.key=value). | | **name** string / required | | Name of volume. | | **options** list / elements=string | | Set driver specific options. For example 'device=tpmfs', 'type=tmpfs'. UID and GID idempotency is not supported due to changes in podman. | | **recreate** boolean | **Choices:*** **no** ← * yes | Recreate volume even if exists. | | **state** string | **Choices:*** **present** ← * absent | State of volume, default 'present' | Examples -------- ``` # What modules does for example - podman_volume: state: present name: volume1 label: key: value key2: value2 options: - "device=/dev/loop1" - "type=ext4" ``` 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 | | --- | --- | --- | | **volume** dictionary | always | Volume inspection results if exists. **Sample:** {'CreatedAt': '2020-06-05T16:38:55.277628769+03:00', 'Driver': 'local', 'Labels': {'key.com': 'value', 'key.org': 'value2'}, 'Mountpoint': '/home/user/.local/share/containers/storage/volumes/test/\_data', 'Name': 'test', 'Options': {}, 'Scope': 'local'} | ### Authors * Sagi Shnaidman (@sshnaidm) ansible containers.podman.buildah – Interact with an existing buildah container containers.podman.buildah – Interact with an existing buildah container ======================================================================= Note This plugin is part of the [containers.podman collection](https://galaxy.ansible.com/containers/podman) (version 1.8.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 containers.podman`. To use it in a playbook, specify: `containers.podman.buildah`. * [Synopsis](#synopsis) * [Parameters](#parameters) Synopsis -------- * Run commands or put/fetch files to an existing container using buildah tool. Parameters ---------- | Parameter | Choices/Defaults | Configuration | Comments | | --- | --- | --- | --- | | **remote\_addr** string | **Default:**"inventory\_hostname" | var: ansible\_host | The ID of the container you want to access. | | **remote\_user** string | | ini entries: [defaults]remote\_user = None env:ANSIBLE\_REMOTE\_USER var: ansible\_user | User specified via name or ID which is used to execute commands inside the container. | ### Authors * Tomas Tomecek ([[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#ee9a9a81838b8d8b85c8cdddd9d5c8cddbdcd5c8cddad6d59c8b8a868f9ac8cddad8d58d8183)) ansible containers.podman.podman_logout – Log out of a container registry using podman containers.podman.podman\_logout – Log out of a container registry using podman =============================================================================== Note This plugin is part of the [containers.podman collection](https://galaxy.ansible.com/containers/podman) (version 1.8.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 containers.podman`. To use it in a playbook, specify: `containers.podman.podman_logout`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Examples](#examples) Synopsis -------- * Log out of a container registry server using the podman logout command by deleting the cached credentials stored in the `auth.json` file. If the registry is not specified, the first registry under `[registries.search]` from `registries.conf `will be used. The path of the authentication file can be overridden by the user by setting the `authfile` flag. The default path used is `${XDG_RUNTIME_DIR}/containers/auth.json`. All the cached credentials can be removed by setting the `all` flag. Warning - podman will use credentials in `${HOME}/.docker/config.json` to authenticate in case they are not found in the default `authfile`. However, the logout command will only removed credentials in the `authfile` specified. Requirements ------------ The below requirements are needed on the host that executes this module. * Podman installed on host Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **all** boolean | **Choices:*** no * yes | Remove the cached credentials for all registries in the auth file. | | **authfile** path | | Path of the authentication file. Default is ``${XDG\_RUNTIME\_DIR}/containers/auth.json`` You can also override the default path of the authentication file by setting the ``REGISTRY\_AUTH\_FILE`` environment variable. ``export REGISTRY\_AUTH\_FILE=path`` | | **executable** string | **Default:**"podman" | Path to `podman` executable if it is not in the `$PATH` on the machine running `podman` | | **ignore\_docker\_credentials** boolean | **Choices:*** no * yes | Credentials created using other tools such as `docker login` are not removed unless the corresponding `authfile` is explicitly specified. Since podman also uses existing credentials in these files by default (for docker e.g. `${HOME}/.docker/config.json`), module execution will fail if a docker login exists for the registry specified in any `authfile` is used by podman. This can be ignored by setting `ignore\_docker\_credentials` to `yes` - the credentials will be kept and `changed` will be false. This option cannot be used together with `all` since in this case podman will not check for existing `authfiles` created by other tools. | | **registry** string | | Registry server. If the registry is not specified, the first registry under `[registries.search]` from `registries.conf` will be used. | Examples -------- ``` - name: Log out of default registry podman_logout: - name: Log out of quay.io podman_logout: registry: quay.io - name: Log out of all registries in auth file podman_logout: all: yes - name: Log out of all registries in specified auth file podman_logout: authfile: $HOME/.docker/config.json all: yes ``` ### Authors * Clemens Lange (@clelange) ansible containers.podman.podman_import – Import Podman container from a tar file. containers.podman.podman\_import – Import Podman container from a tar file. =========================================================================== Note This plugin is part of the [containers.podman collection](https://galaxy.ansible.com/containers/podman) (version 1.8.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 containers.podman`. To use it in a playbook, specify: `containers.podman.podman_import`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * podman import imports a tarball (.tar, .tar.gz, .tgz, .bzip, .tar.xz, .txz) and saves it as a filesystem image. Requirements ------------ The below requirements are needed on the host that executes this module. * Podman installed on host Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **change** list / elements=dictionary | | Set changes as list of key-value pairs, see example. | | **commit\_message** string | | Set commit message for imported image | | **executable** string | **Default:**"podman" | Path to `podman` executable if it is not in the `$PATH` on the machine running `podman` | | **src** string / required | | Path to image file to load. | Examples -------- ``` # What modules does for example - containers.podman.podman_import: src: /path/to/tar/file change: - "CMD": /bin/bash - "User": root commit_message: "Importing image" ``` 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 | | --- | --- | --- | | **image** dictionary | always | info from loaded image **Sample:** {'Annotations': {}, 'Architecture': 'amd64', 'Author': '', 'Comment': 'imported from tarball', 'Config': {}, 'Created': '2021-09-07T04:45:38.749977105+03:00', 'Digest': 'sha256:8730c75be86a718929a658db4663d487e562d66762....', 'GraphDriver': {'Data': {'UpperDir': '/home/...34/diff', 'WorkDir': '/home/.../work'}, 'Name': 'overlay'}, 'History': [{'comment': 'imported from tarball', 'created': '2021-09-07T04:45:38.749977105+03:00', 'created\_by': '/bin/sh -c #(nop) ADD file:091... in /'}], 'Id': 'cbc6d73c4d232db6e8441df96af81855f62c74157b5db80a1d5...', 'Labels': None, 'ManifestType': 'application/vnd.oci.image.manifest.v1+json', 'NamesHistory': None, 'Os': 'linux', 'Parent': '', 'RepoDigests': [], 'RepoTags': [], 'RootFS': {'Layers': ['sha256:....'], 'Type': 'layers'}, 'Size': 5882449, 'User': '', 'Version': '', 'VirtualSize': 5882449} | ### Authors * Sagi Shnaidman (@sshnaidm) ansible Collections in the Junipernetworks Namespace Collections in the Junipernetworks Namespace ============================================ These are the collections with docs hosted on [docs.ansible.com](https://docs.ansible.com/) in the **junipernetworks** namespace. * [junipernetworks.junos](junos/index#plugins-in-junipernetworks-junos) ansible junipernetworks.junos.junos_static_route – (deprecated, removed after 2022-06-01) Manage static IP routes on Juniper JUNOS network devices junipernetworks.junos.junos\_static\_route – (deprecated, removed after 2022-06-01) Manage static IP routes on Juniper JUNOS network devices ============================================================================================================================================ Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_static_route`. New in version 1.0.0: of junipernetworks.junos * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in major release after 2022-06-01 Why Updated modules released with more functionality Alternative Use [junipernetworks.junos.junos\_static\_routes](junos_static_routes_module#ansible-collections-junipernetworks-junos-junos-static-routes-module) instead. Synopsis -------- * This module provides declarative management of static IP routes on Juniper JUNOS network devices. 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. * ncclient (>=v0.5.2) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **active** boolean | **Choices:*** no * **yes** ← | Specifies whether or not the configuration is active or deactivated | | **address** string | | Network address with prefix of the static route. aliases: prefix | | **aggregate** list / elements=dictionary | | List of static route definitions | | | **active** boolean | **Choices:*** no * yes | Specifies whether or not the configuration is active or deactivated | | | **address** string / required | | Network address with prefix of the static route. | | | **next\_hop** string | | Next hop IP of the static route. | | | **preference** integer | | Global admin preference of the static route. aliases: admin\_distance | | | **qualified\_next\_hop** string | | Qualified next hop IP of the static route. Qualified next hops allow to associate preference with a particular next-hop address. | | | **qualified\_preference** integer | | Assign preference for qualified next hop. | | | **state** string | **Choices:*** present * absent | State of the static route configuration. | | **next\_hop** string | | Next hop IP of the static route. | | **preference** integer | | Global admin preference of the static route. aliases: admin\_distance | | **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli` or `connection: netconf`. For more information please see the [Junos OS Platform Options guide](../network/user_guide/platform_junos). A dict object containing connection details. | | | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. | | | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. | | | **port** integer | | Specifies the port to use when building the connection to the remote device. The port value will default to the well known SSH port of 22 (for `transport=cli`) or port 830 (for `transport=netconf`) device. | | | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. | | | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. | | | **transport** string | **Choices:*** cli * **netconf** ← | Configures the transport connection to use when connecting to the remote device. | | | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. | | **qualified\_next\_hop** string | | Qualified next hop IP of the static route. Qualified next hops allow to associate preference with a particular next-hop address. | | **qualified\_preference** integer | | Assign preference for qualified next hop. | | **state** string | **Choices:*** **present** ← * absent | State of the static route configuration. | Notes ----- Note * This module requires the netconf system service be enabled on the remote device being managed. * Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. * Recommended connection is `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). * This module also works with `local` connections for legacy playbooks. * For information on using CLI and netconf see the [Junos OS Platform Options guide](../../../network/user_guide/platform_junos#junos-platform-options) * For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide) * For more information on using Ansible to manage Juniper network devices see <https://www.ansible.com/ansible-juniper>. Examples -------- ``` - name: configure static route junipernetworks.junos.junos_static_route: address: 192.168.2.0/24 next_hop: 10.0.0.1 preference: 10 qualified_next_hop: 10.0.0.2 qualified_preference: 3 state: present - name: delete static route junipernetworks.junos.junos_static_route: address: 192.168.2.0/24 state: absent - name: deactivate static route configuration junipernetworks.junos.junos_static_route: address: 192.168.2.0/24 next_hop: 10.0.0.1 preference: 10 qualified_next_hop: 10.0.0.2 qualified_preference: 3 state: present active: false - name: activate static route configuration junipernetworks.junos.junos_static_route: address: 192.168.2.0/24 next_hop: 10.0.0.1 preference: 10 qualified_next_hop: 10.0.0.2 qualified_preference: 3 state: present active: true - name: Configure static route using aggregate junipernetworks.junos.junos_static_route: aggregate: - {address: 4.4.4.0/24, next_hop: 3.3.3.3, qualified_next_hop: 5.5.5.5, qualified_preference: 30} - {address: 5.5.5.0/24, next_hop: 6.6.6.6, qualified_next_hop: 7.7.7.7, qualified_preference: 12} preference: 10 - name: Delete static route using aggregate junipernetworks.junos.junos_static_route: aggregate: - address: 4.4.4.0/24 - address: 5.5.5.0/24 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 | | --- | --- | --- | | **diff.prepared** string | when configuration is changed and diff option is enabled. | Configuration difference before and after applying change. **Sample:** [edit routing-options static] route 2.2.2.0/24 { ... } + route 4.4.4.0/24 { next-hop 3.3.3.3; qualified-next-hop 5.5.5.5 { + preference 30; } + preference 10; + } | Status ------ * This module will be removed in a major release after 2022-06-01. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Ganesh Nalawade (@ganeshrn) ansible junipernetworks.junos.junos_ospf_interfaces – OSPF Interfaces Resource Module. junipernetworks.junos.junos\_ospf\_interfaces – OSPF Interfaces Resource Module. ================================================================================ Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_ospf_interfaces`. New in version 1.3.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module manages OSPF(v2/v3) configuration of interfaces on devices running Juniper JUNOS. 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. * ncclient (>=v0.6.4) * xmltodict (>=0.12.0) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **config** list / elements=dictionary | | A list of OSPF configuration for interfaces. | | | **address\_family** list / elements=dictionary | | OSPF settings on the interfaces in address-family context. | | | | **afi** string / required | **Choices:*** ipv4 * ipv6 | Address Family Identifier (AFI) for OSPF settings on the interfaces. | | | | **processes** dictionary | | Interfaces configuration for an OSPF process. | | | | | **area** dictionary | | Specify the area-id | | | | | | **area\_id** string | | Specify area id. | | | | | **authentication** dictionary | | Specify authentication type | | | | | | **md5** dictionary | | Specify md5 based authentication. | | | | | | | **key\_id** string | | Specify md5 key-id | | | | | | | **key\_value** string | | Specify key value | | | | | | | **start\_time** string | | Specify start time for key transmission | | | | | | **simple\_password** string | | Specify password for authentication. | | | | | **bandwidth\_based\_metrics** list / elements=dictionary | | Specify list of bandwidth based metrics | | | | | | **bandwidth** string | **Choices:*** 1g * 10g | BW to apply metric to. | | | | | | **metric** integer | | Specify metric | | | | | **dead\_interval** integer | | Dead interval (seconds). | | | | | **demand\_circuit** boolean | **Choices:*** no * yes | Interface functions as a demand circuit. | | | | | **flood\_reduction** boolean | **Choices:*** no * yes | Enable flood reduction. | | | | | **hello\_interval** integer | | Hello interval (seconds). | | | | | **interface\_type** string | **Choices:*** nbma * p2mp * p2p | Specify type of interface | | | | | **ipsec\_sa** string | | IPSec security association name | | | | | **metric** integer | | Metric applied to the interface. | | | | | **mtu** integer | | Maximum OSPF packet size | | | | | **no\_advertise\_adjacency\_segment** boolean | **Choices:*** no * yes | Do not advertise an adjacency segment for this interface. | | | | | **no\_eligible\_backup** boolean | **Choices:*** no * yes | Not eligible to backup traffic from protected interfaces. | | | | | **no\_eligible\_remote\_backup** boolean | **Choices:*** no * yes | Not eligible for Remote-LFA backup traffic from protected interfaces. | | | | | **no\_interface\_state\_traps** boolean | **Choices:*** no * yes | Do not send interface state change traps. | | | | | **no\_neighbor\_down\_notification** boolean | **Choices:*** no * yes | Don't inform other protocols about neighbor down events. | | | | | **node\_link\_protection** string | | Protect interface from both link and node faults. | | | | | **poll\_interval** integer | | Poll interval (seconds). | | | | | **priority** integer | | Priority for the interface. | | | | | **retransmit\_interval** integer | | Retransmit interval (seconds). | | | | | **secondary** boolean | **Choices:*** no * yes | Treat interface as secondary | | | | | **te\_metric** integer | | Traffic engineering metric applied to the interface. | | | | | **transit\_delay** integer | | Transit delay (seconds). | | | **name** string / required | | Name/Identifier of the interface. | | | **router\_id** string / required | | The OSPFv3 router id. | | **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the Junos device by executing the command **show protocols ospf**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result | | **state** string | **Choices:*** **merged** ← * replaced * overridden * deleted * parsed * gathered * rendered | The state the configuration should be left in. | Notes ----- Note * This module requires the netconf system service be enabled on the device being managed. * This module works with connection `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). * Tested against JunOS v18.4R1 Examples -------- ``` # Using merged # # Before state # ------------ # # admin# show protocols ospf - name: Merge Junos OSPF interfaces config junipernetworks.junos.junos_ospf_interfaces: config: - router_id: '10.200.16.75' name: 'ge-0/0/2.0' address_family: - afi: 'ipv4' processes: area: area_id: '0.0.0.2' priority: 3 metric: 5 state: merged # After state # ----------- # # admin# show protocols ospf # area 0.0.0.2 { # interface ge-0/0/2.0 { # metric 5; # priority 3; # } # } # Using replaced # # Before state # ------------ # # admin# show protocols ospf # area 0.0.0.2 { # interface ge-0/0/2.0 { # metric 5; # priority 3; # } # } - name: Replace Junos OSPF interfaces config junipernetworks.junos.junos_ospf_interfaces: config: - router_id: '10.200.16.75' name: 'ge-0/0/2.0' address_family: - afi: 'ipv4' processes: area: area_id: '0.0.0.1' priority: 6 metric: 6 state: replaced # After state # ----------- # # admin# show protocols ospf # area 0.0.0.1 { # interface ge-0/0/2.0 { # metric 6; # priority 6; # } # } # Using overridden # # Before state # ------------ # # admin# show protocols ospf # area 0.0.0.3 { # interface ge-0/0/3.0 { # metric 5; # priority 3; # } # } # area 0.0.0.2 { # interface ge-0/0/2.0 { # metric 5; # priority 3; # } # } - name: Override Junos OSPF interfaces config junipernetworks.junos.junos_ospf_interfaces: config: - router_id: '10.200.16.75' name: 'ge-0/0/1.0' address_family: - afi: 'ipv4' processes: area: area_id: '0.0.0.1' priority: 3 metric: 5 state: overridden # After state # ----------- # # admin# show protocols ospf # area 0.0.0.1 { # interface ge-0/0/1.0 { # metric 5; # priority 3; # } # } # # Using deleted # # Before state # ------------ # # admin# show protocols ospf # area 0.0.0.1 { # interface ge-0/0/1.0 { # metric 5; # priority 3; # } # } - name: Delete Junos OSPF interfaces config junipernetworks.junos.junos_ospf_interfaces: config: - router_id: '10.200.16.75' name: 'ge-0/0/1.0' state: deleted # After state # ----------- # # admin# show protocols ospf # Using gathered # # Before state # ------------ # # admin# show protocols ospf # area 0.0.0.3 { # interface ge-0/0/3.0 { # metric 5; # priority 3; # } # } # area 0.0.0.2 { # interface ge-0/0/2.0 { # metric 5; # priority 3; # } # } - name: Gather Junos OSPF interfaces config junipernetworks.junos.junos_ospf_interfaces: config: state: gathered # # # ------------------------- # Module Execution Result # ------------------------- # # "gathered": [ # { # "address_family": [ # { # "afi": "ipv4", # "processes": { # "area": { # "area_id": "0.0.0.3" # }, # "metric": 5, # "priority": 3 # } # } # ], # "name": "ge-0/0/3.0", # "router_id": "10.200.16.75" # }, # { # "address_family": [ # { # "afi": "ipv4", # "processes": { # "area": { # "area_id": "0.0.0.2" # }, # "metric": 5, # "priority": 3 # } # } # ], # "name": "ge-0/0/2.0", # "router_id": "10.200.16.75" # } # ] # # Using rendered # # - name: Render the commands for provided configuration junipernetworks.junos.junos_ospf_interfaces: config: - router_id: '10.200.16.75' name: 'ge-0/0/2.0' address_family: - afi: 'ipv4' processes: area: area_id: '0.0.0.2' priority: 3 metric: 5 state: rendered # # # ------------------------- # Module Execution Result # ------------------------- # # # "rendered": " # <nc:protocols # xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> # <nc:ospf> # <nc:area> # <nc:name>0.0.0.2</nc:name> # <nc:interface> # <nc:name>ge-0/0/2.0</nc:name> # <nc:priority>3</nc:priority> # <nc:metric>5</nc:metric> # </nc:interface> # </nc:area> # </nc:ospf> # </nc:protocols>" # # Using parsed # parsed.cfg # ------------ # <?xml version="1.0" encoding="UTF-8"?> # <rpc-reply message-id="urn:uuid:0cadb4e8-5bba-47f4-986e-72906227007f"> # <configuration changed-seconds="1590139550" changed-localtime="2020-05-22 09:25:50 UTC"> # <protocols> # <ospf> # <area> # <name>0.0.0.2</name> # <stub> # <default-metric>200</default-metric> # </stub> # <interface> # <name>ge-0/0/2.0</name> # <metric>5</metric> # <priority>3</priority> # </interface> # </area> # </ospf> # </protocols> # <routing-options> # <router-id>10.200.16.75</router-id> # </routing-options> # </configuration> # </rpc-reply> - name: Parsed the device configuration to get output commands junipernetworks.junos.junos_ospf_interfaces: running_config: "{{ lookup('file', './parsed.cfg') }}" state: parsed # # # ------------------------- # Module Execution Result # ------------------------- # # # "parsed": [ # { # "address_family": [ # { # "afi": "ipv4", # "processes": { # "area": { # "area_id": "0.0.0.2" # }, # "metric": 5, # "priority": 3 # } # } # ], # "name": "ge-0/0/2.0", # "router_id": "10.200.16.75" # } # ] # ``` 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 | | --- | --- | --- | | **after** dictionary | when changed | The resulting configuration model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **before** dictionary | always | The configuration prior to the model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['<nc:protocols xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:ospf> <nc:area> <nc:name>0.0.0.3</nc:name> <nc:interface> <nc:name>ge-0/0/3.0</nc:name> <nc:priority>3</nc:priority> <nc:metric>5</nc:metric> </nc:interface> </nc:area> <nc:area> <nc:name>0.0.0.2</nc:name> <nc:interface> <nc:name>ge-0/0/2.0</nc:name> <nc:priority>3</nc:priority> <nc:metric>5</nc:metric> </nc:interface> </nc:area> </nc:ospf> </nc:protocols>", " <nc:routing-options xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:router-id>10.200.16.75</nc:router-id> <nc:router-id>10.200.16.75</nc:router-id> </nc:routing-options>', 'xml 2', 'xml 3'] | ### Authors * Rohit Thakur (@rohitthakur2590)
programming_docs
ansible junipernetworks.junos.junos_command – Run arbitrary commands on an Juniper JUNOS device junipernetworks.junos.junos\_command – Run arbitrary commands on an Juniper JUNOS device ======================================================================================== Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_command`. New in version 1.0.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Sends an arbitrary set of commands to an JUNOS node and returns the results read from the device. This module includes an argument that will cause the module to wait for a specific condition before returning or timing out if the condition is not met. 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. * jxmlease * ncclient (>=v0.5.2) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **commands** list / elements=string | | The commands to send to the remote junos device over the configured provider. The resulting output from the command is returned. If the *wait\_for* argument is provided, the module is not returned until the condition is satisfied or the number of *retries* has been exceeded. | | **display** string | **Choices:*** text * json * xml * set | Encoding scheme to use when serializing output from the device. This handles how to properly understand the output and apply the conditionals path to the result set. For *rpcs* argument default display is `xml` and for *commands* argument default display is `text`. Value `set` is applicable only for fetching configuration from device. aliases: format, output | | **interval** integer | **Default:**1 | Configures the interval in seconds to wait between retries of the command. If the command does not pass the specified conditional, the interval indicates how to long to wait before trying the command again. | | **match** string | **Choices:*** any * **all** ← | The *match* argument is used in conjunction with the *wait\_for* argument to specify the match policy. Valid values are `all` or `any`. If the value is set to `all` then all conditionals in the *wait\_for* must be satisfied. If the value is set to `any` then only one of the values must be satisfied. | | **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli` or `connection: netconf`. For more information please see the [Junos OS Platform Options guide](../network/user_guide/platform_junos). A dict object containing connection details. | | | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. | | | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. | | | **port** integer | | Specifies the port to use when building the connection to the remote device. The port value will default to the well known SSH port of 22 (for `transport=cli`) or port 830 (for `transport=netconf`) device. | | | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. | | | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. | | | **transport** string | **Choices:*** cli * **netconf** ← | Configures the transport connection to use when connecting to the remote device. | | | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. | | **retries** integer | **Default:**10 | Specifies the number of retries a command should be tried before it is considered failed. The command is run on the target device every retry and evaluated against the *wait\_for* conditionals. | | **rpcs** list / elements=string | | The `rpcs` argument accepts a list of RPCs to be executed over a netconf session and the results from the RPC execution is return to the playbook via the modules results dictionary. | | **wait\_for** list / elements=string | | Specifies what to evaluate from the output of the command and what conditionals to apply. This argument will cause the task to wait for a particular conditional to be true before moving forward. If the conditional is not true by the configured retries, the task fails. See examples. aliases: waitfor | Notes ----- Note * This module requires the netconf system service be enabled on the remote device being managed. * Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. * Recommended connection is `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). * This module also works with `network_cli` connections and with `local` connections for legacy playbooks. * For information on using CLI and netconf see the [Junos OS Platform Options guide](../../../network/user_guide/platform_junos#junos-platform-options) * For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide) * For more information on using Ansible to manage Juniper network devices see <https://www.ansible.com/ansible-juniper>. Examples -------- ``` - name: run show version on remote devices junipernetworks.junos.junos_command: commands: show version - name: run show version and check to see if output contains Juniper junipernetworks.junos.junos_command: commands: show version wait_for: result[0] contains Juniper - name: run multiple commands on remote nodes junipernetworks.junos.junos_command: commands: - show version - show interfaces - name: run multiple commands and evaluate the output junipernetworks.junos.junos_command: commands: - show version - show interfaces wait_for: - result[0] contains Juniper - result[1] contains Loopback0 - name: run commands and specify the output format junipernetworks.junos.junos_command: commands: show version display: json - name: run rpc on the remote device junipernetworks.junos.junos_command: commands: show configuration display: set - name: run rpc on the remote device junipernetworks.junos.junos_command: rpcs: get-software-information ``` 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 | | --- | --- | --- | | **failed\_conditions** list / elements=string | failed | The list of conditionals that have failed **Sample:** ['...', '...'] | | **output** list / elements=string | If the *display* is in `xml` format. | The set of transformed xml to json format from the commands responses **Sample:** ['...', '...'] | | **stdout** list / elements=string | always apart from low level errors (such as action plugin) | The set of responses from the commands **Sample:** ['...', '...'] | | **stdout\_lines** list / elements=string | always apart from low level errors (such as action plugin) | The value of stdout split into a list **Sample:** [['...', '...'], ['...'], ['...']] | ### Authors * Peter Sprygada (@privateip) ansible junipernetworks.junos.junos_ntp_global – Manage NTP configuration on Junos devices. junipernetworks.junos.junos\_ntp\_global – Manage NTP configuration on Junos devices. ===================================================================================== Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_ntp_global`. New in version 2.6.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module manages NTP configuration on devices running Junos. 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. * ncclient (>=v0.6.4) * xmltodict (>=0.12.0) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **config** dictionary | | A dictionary of NTP configuration. | | | **authentication\_keys** list / elements=dictionary | | NTP authentication key. | | | | **algorithm** string | **Choices:*** md5 * sha1 * sha256 | Authentication key type. | | | | **id** integer | | Authentication key number. | | | | **key** string | | Authentication key value. | | | **boot\_server** string | | Server to query during boot sequence. | | | **broadcast\_client** boolean | **Choices:*** no * yes | Listen to broadcast NTP. | | | **broadcasts** list / elements=dictionary | | Broadcast parameters. | | | | **address** string | | Broadcast or multicast address to use. | | | | **key** string | | Authentication key. | | | | **routing\_instance\_name** string | | Routing intance name in which interface has address in broadcast subnet. | | | | **ttl** integer | | TTL value to transmit. | | | | **version** integer | | NTP version to use. | | | **interval\_range** integer | | Set the minpoll and maxpoll interval range. | | | **multicast\_client** string | | Listen to multicast NTP address. | | | **peers** list / elements=dictionary | | NTP Peers. | | | | **key\_id** integer | | Key-id to be used while communicating. | | | | **peer** string | | Hostname/IP address of the NTP Peer. | | | | **prefer** boolean | **Choices:*** no * yes | Prefer this peer. | | | | **version** integer | | NTP version to use. | | | **servers** list / elements=dictionary | | NTP Servers. | | | | **key\_id** integer | | Key-id to be used while communicating. | | | | **prefer** boolean | **Choices:*** no * yes | Prefer this peer\_serv. | | | | **routing\_instance** string | | Routing instance through which server is reachable. | | | | **server** string | | IP address or hostname of the server. | | | | **version** integer | | NTP version to use. | | | **source\_addresses** list / elements=dictionary | | Source-Address parameters. | | | | **routing\_instance** string | | Routing intance name in which source address is defined. | | | | **source\_address** string | | Use specified address as source address. | | | **threshold** dictionary | | Set the maximum threshold(sec) allowed for NTP adjustment. | | | | **action** string | **Choices:*** accept * reject | Select actions for NTP abnormal adjustment. | | | | **value** integer | | The maximum value(sec) allowed for NTP adjustment. | | | **trusted\_keys** list / elements=dictionary | | List of trusted authentication keys. | | | | **key\_id** integer | | Trusted-Key number. | | **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the Junos device by executing the command **show system syslog**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result. | | **state** string | **Choices:*** **merged** ← * replaced * deleted * overridden * parsed * gathered * rendered | The state the configuration should be left in. The states *replaced* and *overridden* have identical behaviour for this module. Refer to examples for more details. | Notes ----- Note * This module requires the netconf system service be enabled on the device being managed. * This module works with connection `netconf`. * See [the Junos OS Platform Options](../../../network/user_guide/platform_junos). * Tested against JunOS v18.4R1 Examples -------- ``` # Using merged # # Before state # ------------ # # vagrant@vsrx# show system ntp # # [edit] # vagrant@vsrx# show routing-instances # rt1 { # description rt1; # } # rt2 { - name: Merge provided NTP configuration into running configuration. junipernetworks.junos.junos_ntp_global: config: boot_server: '78.46.194.186' broadcasts: - address: '172.16.255.255' key: '50' ttl: 200 version: 3 routing_instance_name: 'rt1' - address: '192.16.255.255' key: '50' ttl: 200 version: 3 routing_instance_name: 'rt2' broadcast_client: true interval_range: 2 multicast_client: "224.0.0.1" peers: - peer: "78.44.194.186" - peer: "172.44.194.186" key_id: 10000 prefer: true version: 3 servers: - server: "48.46.194.186" key_id: 34 prefer: true version: 2 routing_instance: 'rt1' - server: "48.45.194.186" key_id: 34 prefer: true version: 2 source_addresses: - source_address: "172.45.194.186" routing_instance: 'rt1' - source_address: "171.45.194.186" routing_instance: 'rt2' threshold: value: 300 action: "accept" trusted_keys: - key_id: 3000 - key_id: 2000 state: merged # # ------------------------- # Module Execution Result # ------------------------- # "after": { # "boot_server": "78.46.194.186", # "broadcast_client": true, # "broadcasts": [ # { # "address": "172.16.255.255", # "key": "50", # "routing_instance_name": "rt1", # "ttl": 200, # "version": 3 # }, # { # "address": "192.16.255.255", # "key": "50", # "routing_instance_name": "rt2", # "ttl": 200, # "version": 3 # } # ], # "interval_range": 2, # "multicast_client": "224.0.0.1", # "peers": [ # { # "peer": "78.44.194.186" # }, # { # "key_id": 10000, # "peer": "172.44.194.186", # "prefer": true, # "version": 3 # } # ], # "servers": [ # { # "key_id": 34, # "prefer": true, # "routing_instance": "rt1", # "server": "48.46.194.186", # "version": 2 # }, # { # "key_id": 34, # "prefer": true, # "server": "48.45.194.186", # "version": 2 # } # ], # "source_addresses": [ # { # "routing_instance": "rt1", # "source_address": "172.45.194.186" # }, # { # "routing_instance": "rt2", # "source_address": "171.45.194.186" # } # ], # "threshold": { # "action": "accept", # "value": 300 # }, # "trusted_keys": [ # {"key_id": 2000}, # {"key_id": 3000} # ] # }, # "before": {}, # "changed": true, # "commands": [ # "<nc:system xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">" # "<nc:ntp><nc:boot-server>78.46.194.186</nc:boot-server><nc:broadcast>" # "<nc:name>172.16.255.255</nc:name><nc:key>50</nc:key><nc:routing-instance-name>rt1</nc:routing-instance-name>" # "<nc:ttl>200</nc:ttl><nc:version>3</nc:version></nc:broadcast><nc:broadcast><nc:name>192.16.255.255</nc:name>" # "<nc:key>50</nc:key><nc:routing-instance-name>rt2</nc:routing-instance-name><nc:ttl>200</nc:ttl>" # "<nc:version>3</nc:version></nc:broadcast><nc:broadcast-client/><nc:interval-range>2</nc:interval-range>" # "<nc:multicast-client>224.0.0.1</nc:multicast-client><nc:peer><nc:name>78.44.194.186</nc:name></nc:peer>" # "<nc:peer><nc:name>172.44.194.186</nc:name><nc:key>10000</nc:key><nc:prefer/><nc:version>3</nc:version>" # "</nc:peer><nc:server><nc:name>48.46.194.186</nc:name><nc:key>34</nc:key><nc:routing-instance>rt1</nc:routing-instance>" # "<nc:prefer/><nc:version>2</nc:version></nc:server><nc:server><nc:name>48.45.194.186</nc:name><nc:key>34</nc:key>" # "<nc:prefer/><nc:version>2</nc:version></nc:server><nc:source-address><nc:name>172.45.194.186</nc:name>" # "<nc:routing-instance>rt1</nc:routing-instance></nc:source-address><nc:source-address>" # "<nc:name>171.45.194.186</nc:name><nc:routing-instance>rt2</nc:routing-instance></nc:source-address>" # "<nc:threshold><nc:value>300</nc:value><nc:action>accept</nc:action></nc:threshold>" # "<nc:trusted-key>3000</nc:trusted-key><nc:trusted-key>2000</nc:trusted-key></nc:ntp></nc:system>" # ] # After state # ----------- # # vagrant@vsrx# show system ntp # boot-server 78.46.194.186; # interval-range 2; # peer 78.44.194.186; # peer 172.44.194.186 key 10000 version 3 prefer; ## SECRET-DATA # server 48.46.194.186 key 34 version 2 prefer routing-instance rt1; ## SECRET-DATA # server 48.45.194.186 key 34 version 2 prefer; ## SECRET-DATA # broadcast 172.16.255.255 routing-instance-name rt1 key 50 version 3 ttl 200; # broadcast 192.16.255.255 routing-instance-name rt2 key 50 version 3 ttl 200; # broadcast-client; # multicast-client 224.0.0.1; # trusted-key [ 3000 2000 ]; # threshold 300 action accept; # source-address 172.45.194.186 routing-instance rt1; # source-address 171.45.194.186 routing-instance rt2; # # # Using Replaced # Before state # ------------ # # vagrant@vsrx# show system ntp # boot-server 78.46.194.186; # interval-range 2; # peer 78.44.194.186; # peer 172.44.194.186 key 10000 version 3 prefer; ## SECRET-DATA # server 48.46.194.186 key 34 version 2 prefer routing-instance rt1; ## SECRET-DATA # server 48.45.194.186 key 34 version 2 prefer; ## SECRET-DATA # broadcast 172.16.255.255 routing-instance-name rt1 key 50 version 3 ttl 200; # broadcast 192.16.255.255 routing-instance-name rt2 key 50 version 3 ttl 200; # broadcast-client; # multicast-client 224.0.0.1; # trusted-key [ 3000 2000 ]; # threshold 300 action accept; # source-address 172.45.194.186 routing-instance rt1; # source-address 171.45.194.186 routing-instance rt2; - name: Replaced running ntp global configuration with provided configuration junipernetworks.junos.junos_ntp_global: config: authentication_keys: - id: 2 algorithm: 'md5' key: 'asdfghd' - id: 5 algorithm: 'sha1' key: 'aasdad' servers: - server: "48.46.194.186" key_id: 34 prefer: true version: 2 routing_instance: 'rt1' - server: "48.45.194.186" key_id: 34 prefer: true version: 2 state: replaced # # ------------------------- # Module Execution Result # ------------------------- # "after": { # "authentication_keys": [ # { # "algorithm": "md5", # "id": 2, # "key": "$9$03aAB1hreW7NbO1rvMLVbgoJ" # }, # { # "algorithm": "sha1", # "id": 5, # "key": "$9$DXiHmf5F/A0ZUjq.P3n" # } # ], # "servers": [ # { # "key_id": 34, # "prefer": true, # "routing_instance": "rt1", # "server": "48.46.194.186", # "version": 2 # }, # { # "key_id": 34, # "prefer": true, # "server": "48.45.194.186", # "version": 2 # } # ] # }, # "before": { # "boot_server": "78.46.194.186", # "broadcast_client": true, # "broadcasts": [ # { # "address": "172.16.255.255", # "key": "50", # "routing_instance_name": "rt1", # "ttl": 200, # "version": 3 # }, # { # "address": "192.16.255.255", # "key": "50", # "routing_instance_name": "rt2", # "ttl": 200, # "version": 3 # } # ], # "interval_range": 2, # "multicast_client": "224.0.0.1", # "peers": [ # { # "peer": "78.44.194.186" # }, # { # "key_id": 10000, # "peer": "172.44.194.186", # "prefer": true, # "version": 3 # } # ], # "servers": [ # { # "key_id": 34, # "prefer": true, # "routing_instance": "rt1", # "server": "48.46.194.186", # "version": 2 # }, # { # "key_id": 34, # "prefer": true, # "server": "48.45.194.186", # "version": 2 # } # ], # "source_addresses": [ # { # "routing_instance": "rt1", # "source_address": "172.45.194.186" # }, # { # "routing_instance": "rt2", # "source_address": "171.45.194.186" # } # ], # "threshold": { # "action": "accept", # "value": 300 # }, # "trusted_keys": [ # {"key_id": 2000}, # {"key_id": 3000} # ] # }, # "changed": true, # "commands": [ # "<nc:system xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> # "<nc:ntp delete="delete"/><nc:ntp><nc:authentication-key><nc:name>2</nc:name><nc:type>md5</nc:type> # "<nc:value>asdfghd</nc:value></nc:authentication-key><nc:authentication-key><nc:name>5</nc:name> # "<nc:type>sha1</nc:type><nc:value>aasdad</nc:value></nc:authentication-key><nc:server> # "<nc:name>48.46.194.186</nc:name><nc:key>34</nc:key><nc:routing-instance>rt1</nc:routing-instance> # "<nc:prefer/><nc:version>2</nc:version></nc:server><nc:server><nc:name>48.45.194.186</nc:name> # "<nc:key>34</nc:key><nc:prefer/><nc:version>2</nc:version></nc:server></nc:ntp></nc:system>" # ] # After state # ----------- # # vagrant@vsrx# show system ntp # authentication-key 2 type md5 value "$9$03aAB1hreW7NbO1rvMLVbgoJ"; ## SECRET-DATA # authentication-key 5 type sha1 value "$9$DXiHmf5F/A0ZUjq.P3n"; ## SECRET-DATA # server 48.46.194.186 key 34 version 2 prefer routing-instance rt1; ## SECRET-DATA # server 48.45.194.186 key 34 version 2 prefer; ## SECRET-DATA # Using overridden # # Before state # ------------ # # vagrant@vsrx# show system ntp # boot-server 78.46.194.186; # interval-range 2; # peer 78.44.194.186; # peer 172.44.194.186 key 10000 version 3 prefer; ## SECRET-DATA # server 48.46.194.186 key 34 version 2 prefer routing-instance rt1; ## SECRET-DATA # server 48.45.194.186 key 34 version 2 prefer; ## SECRET-DATA # broadcast 172.16.255.255 routing-instance-name rt1 key 50 version 3 ttl 200; # broadcast 192.16.255.255 routing-instance-name rt2 key 50 version 3 ttl 200; # broadcast-client; # multicast-client 224.0.0.1; # trusted-key [ 3000 2000 ]; # threshold 300 action accept; # source-address 172.45.194.186 routing-instance rt1; # source-address 171.45.194.186 routing-instance rt2; - name: Override running ntp global configuration with provided configuration junipernetworks.junos.junos_ntp_global: config: authentication_keys: - id: 2 algorithm: 'md5' key: 'asdfghd' - id: 5 algorithm: 'sha1' key: 'aasdad' servers: - server: "48.46.194.186" key_id: 34 prefer: true version: 2 routing_instance: 'rt1' - server: "48.45.194.186" key_id: 34 prefer: true version: 2 state: overridden # # ------------------------- # Module Execution Result # ------------------------- # "after": { # "authentication_keys": [ # { # "algorithm": "md5", # "id": 2, # "key": "$9$03aAB1hreW7NbO1rvMLVbgoJ" # }, # { # "algorithm": "sha1", # "id": 5, # "key": "$9$DXiHmf5F/A0ZUjq.P3n" # } # ], # "servers": [ # { # "key_id": 34, # "prefer": true, # "routing_instance": "rt1", # "server": "48.46.194.186", # "version": 2 # }, # { # "key_id": 34, # "prefer": true, # "server": "48.45.194.186", # "version": 2 # } # ] # }, # "before": { # "boot_server": "78.46.194.186", # "broadcast_client": true, # "broadcasts": [ # { # "address": "172.16.255.255", # "key": "50", # "routing_instance_name": "rt1", # "ttl": 200, # "version": 3 # }, # { # "address": "192.16.255.255", # "key": "50", # "routing_instance_name": "rt2", # "ttl": 200, # "version": 3 # } # ], # "interval_range": 2, # "multicast_client": "224.0.0.1", # "peers": [ # { # "peer": "78.44.194.186" # }, # { # "key_id": 10000, # "peer": "172.44.194.186", # "prefer": true, # "version": 3 # } # ], # "servers": [ # { # "key_id": 34, # "prefer": true, # "routing_instance": "rt1", # "server": "48.46.194.186", # "version": 2 # }, # { # "key_id": 34, # "prefer": true, # "server": "48.45.194.186", # "version": 2 # } # ], # "source_addresses": [ # { # "routing_instance": "rt1", # "source_address": "172.45.194.186" # }, # { # "routing_instance": "rt2", # "source_address": "171.45.194.186" # } # ], # "threshold": { # "action": "accept", # "value": 300 # }, # "trusted_keys": [ # {"key_id": 2000}, # {"key_id": 3000} # ] # }, # "changed": true, # "commands": [ # "<nc:system xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> # "<nc:ntp delete="delete"/><nc:ntp><nc:authentication-key><nc:name>2</nc:name><nc:type>md5</nc:type> # "<nc:value>asdfghd</nc:value></nc:authentication-key><nc:authentication-key><nc:name>5</nc:name> # "<nc:type>sha1</nc:type><nc:value>aasdad</nc:value></nc:authentication-key><nc:server> # "<nc:name>48.46.194.186</nc:name><nc:key>34</nc:key><nc:routing-instance>rt1</nc:routing-instance> # "<nc:prefer/><nc:version>2</nc:version></nc:server><nc:server><nc:name>48.45.194.186</nc:name> # "<nc:key>34</nc:key><nc:prefer/><nc:version>2</nc:version></nc:server></nc:ntp></nc:system>" # ] # After state # ----------- # # vagrant@vsrx# show system ntp # authentication-key 2 type md5 value "$9$03aAB1hreW7NbO1rvMLVbgoJ"; ## SECRET-DATA # authentication-key 5 type sha1 value "$9$DXiHmf5F/A0ZUjq.P3n"; ## SECRET-DATA # server 48.46.194.186 key 34 version 2 prefer routing-instance rt1; ## SECRET-DATA # server 48.45.194.186 key 34 version 2 prefer; ## SECRET-DATA # # Using deleted # # Before state # ------------ # # vagrant@vsrx# show system ntp # authentication-key 2 type md5 value "$9$03aAB1hreW7NbO1rvMLVbgoJ"; ## SECRET-DATA # authentication-key 5 type sha1 value "$9$DXiHmf5F/A0ZUjq.P3n"; ## SECRET-DATA # server 48.46.194.186 key 34 version 2 prefer routing-instance rt1; ## SECRET-DATA # server 48.45.194.186 key 34 version 2 prefer; ## SECRET-DATA # - name: Delete running NTP global configuration junipernetworks.junos.junos_ntp_global: config: state: deleted # # ------------------------- # Module Execution Result # ------------------------- # "after": {}, # "before": { # "authentication_keys": [ # { # "algorithm": "md5", # "id": 2, # "key": "$9$03aAB1hreW7NbO1rvMLVbgoJ" # }, # { # "algorithm": "sha1", # "id": 5, # "key": "$9$DXiHmf5F/A0ZUjq.P3n" # } # ], # "servers": [ # { # "key_id": 34, # "prefer": true, # "routing_instance": "rt1", # "server": "48.46.194.186", # "version": 2 # }, # { # "key_id": 34, # "prefer": true, # "server": "48.45.194.186", # "version": 2 # } # ] # }, # "changed": true, # "commands": [ # "<nc:system xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">" # "<nc:ntp delete="delete"/></nc:system>" # ] # After state # ----------- # # vagrant@vsrx# show system ntp # # [edit] # Using gathered # # Before state # ------------ # # vagrant@vsrx# show system ntp # boot-server 78.46.194.186; # interval-range 2; # peer 78.44.194.186; # peer 172.44.194.186 key 10000 version 3 prefer; ## SECRET-DATA # server 48.46.194.186 key 34 version 2 prefer routing-instance rt1; ## SECRET-DATA # server 48.45.194.186 key 34 version 2 prefer; ## SECRET-DATA # broadcast 172.16.255.255 routing-instance-name rt1 key 50 version 3 ttl 200; # broadcast 192.16.255.255 routing-instance-name rt2 key 50 version 3 ttl 200; # broadcast-client; # multicast-client 224.0.0.1; # trusted-key [ 3000 2000 ]; # threshold 300 action accept; # source-address 172.45.194.186 routing-instance rt1; # source-address 171.45.194.186 routing-instance rt2; - name: Gather running NTP global configuration junipernetworks.junos.junos_ntp_global: state: gathered # # ------------------------- # Module Execution Result # ------------------------- # "gathered": { # "boot_server": "78.46.194.186", # "broadcast_client": true, # "broadcasts": [ # { # "address": "172.16.255.255", # "key": "50", # "routing_instance_name": "rt1", # "ttl": 200, # "version": 3 # }, # { # "address": "192.16.255.255", # "key": "50", # "routing_instance_name": "rt2", # "ttl": 200, # "version": 3 # } # ], # "interval_range": 2, # "multicast_client": "224.0.0.1", # "peers": [ # { # "peer": "78.44.194.186" # }, # { # "key_id": 10000, # "peer": "172.44.194.186", # "prefer": true, # "version": 3 # } # ], # "servers": [ # { # "key_id": 34, # "prefer": true, # "routing_instance": "rt1", # "server": "48.46.194.186", # "version": 2 # }, # { # "key_id": 34, # "prefer": true, # "server": "48.45.194.186", # "version": 2 # } # ], # "source_addresses": [ # { # "routing_instance": "rt1", # "source_address": "172.45.194.186" # }, # { # "routing_instance": "rt2", # "source_address": "171.45.194.186" # } # ], # "threshold": { # "action": "accept", # "value": 300 # }, # "trusted_keys": [ # {"key_id": 2000}, # {"key_id": 3000} # ] # }, # "changed": false, # Using rendered # # Before state # ------------ # - name: Render xml for provided facts. junipernetworks.junos.junos_ntp_global: config: boot_server: '78.46.194.186' broadcasts: - address: '172.16.255.255' key: '50' ttl: 200 version: 3 routing_instance_name: 'rt1' - address: '192.16.255.255' key: '50' ttl: 200 version: 3 routing_instance_name: 'rt2' broadcast_client: true interval_range: 2 multicast_client: "224.0.0.1" peers: - peer: "78.44.194.186" - peer: "172.44.194.186" key_id: 10000 prefer: true version: 3 servers: - server: "48.46.194.186" key_id: 34 prefer: true version: 2 routing_instance: 'rt1' - server: "48.45.194.186" key_id: 34 prefer: true version: 2 source_addresses: - source_address: "172.45.194.186" routing_instance: 'rt1' - source_address: "171.45.194.186" routing_instance: 'rt2' threshold: value: 300 action: "accept" trusted_keys: - 3000 - 2000 state: rendered # # ------------------------- # Module Execution Result # ------------------------- # "rendered": [ # "<nc:system xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">" # "<nc:ntp><nc:boot-server>78.46.194.186</nc:boot-server><nc:broadcast><nc:name>172.16.255.255</nc:name>" # "<nc:key>50</nc:key><nc:routing-instance-name>rt1</nc:routing-instance-name><nc:ttl>200</nc:ttl>" # "<nc:version>3</nc:version></nc:broadcast><nc:broadcast><nc:name>192.16.255.255</nc:name>" # "<nc:key>50</nc:key><nc:routing-instance-name>rt2</nc:routing-instance-name>" # "<nc:ttl>200</nc:ttl><nc:version>3</nc:version></nc:broadcast><nc:broadcast-client/>" # "<nc:interval-range>2</nc:interval-range><nc:multicast-client>224.0.0.1</nc:multicast-client><nc:peer>" # "<nc:name>78.44.194.186</nc:name></nc:peer><nc:peer><nc:name>172.44.194.186</nc:name>" # "<nc:key>10000</nc:key><nc:prefer/><nc:version>3</nc:version></nc:peer><nc:server>" # "<nc:name>48.46.194.186</nc:name><nc:key>34</nc:key><nc:routing-instance>rt1</nc:routing-instance>" # "<nc:prefer/><nc:version>2</nc:version></nc:server><nc:server><nc:name>48.45.194.186</nc:name>" # "<nc:key>34</nc:key><nc:prefer/><nc:version>2</nc:version></nc:server><nc:source-address>" # "<nc:name>172.45.194.186</nc:name><nc:routing-instance>rt1</nc:routing-instance></nc:source-address>" # "<nc:source-address><nc:name>171.45.194.186</nc:name><nc:routing-instance>rt2</nc:routing-instance>" # "</nc:source-address><nc:threshold><nc:value>300</nc:value><nc:action>accept</nc:action></nc:threshold>" # "<nc:trusted-key>3000</nc:trusted-key><nc:trusted-key>2000</nc:trusted-key></nc:ntp></nc:system>" # ] # # Using parsed # parsed.cfg # ------------ # <?xml version="1.0" encoding="UTF-8"?> # <rpc-reply message-id="urn:uuid:0cadb4e8-5bba-47f4-986e-72906227007f"> # <configuration changed-seconds="1590139550" changed-localtime="2020-05-22 09:25:50 UTC"> # <version>18.4R1-S2.4</version> # <system xmlns="http://yang.juniper.net/junos-es/conf/system"> # <ntp> # <authentication-key> # <name>2</name> # <type>md5</type> # <value>$9$GxDjqfT3CA0UjfzF6u0RhS</value> # </authentication-key> # <authentication-key> # <name>5</name> # <type>sha1</type> # <value>$9$ZsUDk.mT3/toJGiHqQz</value> # </authentication-key> # </ntp> # </system> # </configuration> # </rpc-reply> # - name: Parse NTP global running config junipernetworks.junos.junos_ntp_global: running_config: "{{ lookup('file', './parsed.cfg') }}" state: parsed # # # ------------------------- # Module Execution Result # ------------------------- # # # "parsed": { # "authentication_keys": [ # { # "algorithm": "md5", # "id": 2, # "key": "$9$GxDjqfT3CA0UjfzF6u0RhS" # }, # { # "algorithm": "sha1", # "id": 5, # "key": "$9$ZsUDk.mT3/toJGiHqQz" # } # ] # } # # ``` 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 | | --- | --- | --- | | **after** dictionary | when changed | The resulting configuration model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **before** dictionary | always | The configuration prior to the model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['<nc:name>78.44.194.186</nc:name></nc:peer><nc:peer><nc:name>172.44.194.186</nc:name>', 'xml 2', 'xml 3'] | ### Authors * Rohit Thakur (@rohitthakur2590)
programming_docs
ansible junipernetworks.junos.junos_vrf – Manage the VRF definitions on Juniper JUNOS devices junipernetworks.junos.junos\_vrf – Manage the VRF definitions on Juniper JUNOS devices ====================================================================================== Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_vrf`. New in version 1.0.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module provides declarative management of VRF definitions on Juniper JUNOS devices. It allows playbooks to manage individual or the entire VRF collection. 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. * ncclient (>=v0.5.2) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **active** boolean | **Choices:*** no * **yes** ← | Specifies whether or not the configuration is active or deactivated | | **aggregate** list / elements=dictionary | | The set of VRF definition objects to be configured on the remote JUNOS device. Ths list entries can either be the VRF name or a hash of VRF definitions and attributes. This argument is mutually exclusive with the `name` argument. | | | **active** boolean | **Choices:*** no * yes | Specifies whether or not the configuration is active or deactivated | | | **description** string | | Provides a short description of the VRF definition in the current active configuration. The VRF definition value accepts alphanumeric characters used to provide additional information about the VRF. | | | **interfaces** list / elements=string | | Identifies the set of interfaces that should be configured in the VRF. Interfaces must be routed interfaces in order to be placed into a VRF. | | | **name** string / required | | The name of the VRF definition to be managed on the remote IOS device. The VRF definition name is an ASCII string name used to uniquely identify the VRF. This argument is mutually exclusive with the `aggregate` argument | | | **rd** list / elements=string | | The router-distinguisher value uniquely identifies the VRF to routing processes on the remote IOS system. The RD value takes the form of `A:B` where `A` and `B` are both numeric values. | | | **state** string | **Choices:*** present * absent | Configures the state of the VRF definition as it relates to the device operational configuration. When set to *present*, the VRF should be configured in the device active configuration and when set to *absent* the VRF should not be in the device active configuration | | | **table\_label** boolean | **Choices:*** no * yes | Causes JUNOS to allocate a VPN label per VRF rather than per VPN FEC. This allows for forwarding of traffic to directly connected subnets, COS Egress filtering etc. | | | **target** list / elements=string | | It configures VRF target community configuration. The target value takes the form of `target:A:B` where `A` and `B` are both numeric values. | | **description** string | | Provides a short description of the VRF definition in the current active configuration. The VRF definition value accepts alphanumeric characters used to provide additional information about the VRF. | | **interfaces** list / elements=string | | Identifies the set of interfaces that should be configured in the VRF. Interfaces must be routed interfaces in order to be placed into a VRF. | | **name** string | | The name of the VRF definition to be managed on the remote IOS device. The VRF definition name is an ASCII string name used to uniquely identify the VRF. This argument is mutually exclusive with the `aggregate` argument | | **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli` or `connection: netconf`. For more information please see the [Junos OS Platform Options guide](../network/user_guide/platform_junos). A dict object containing connection details. | | | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. | | | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. | | | **port** integer | | Specifies the port to use when building the connection to the remote device. The port value will default to the well known SSH port of 22 (for `transport=cli`) or port 830 (for `transport=netconf`) device. | | | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. | | | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. | | | **transport** string | **Choices:*** cli * **netconf** ← | Configures the transport connection to use when connecting to the remote device. | | | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. | | **rd** list / elements=string | | The router-distinguisher value uniquely identifies the VRF to routing processes on the remote IOS system. The RD value takes the form of `A:B` where `A` and `B` are both numeric values. | | **state** string | **Choices:*** **present** ← * absent | Configures the state of the VRF definition as it relates to the device operational configuration. When set to *present*, the VRF should be configured in the device active configuration and when set to *absent* the VRF should not be in the device active configuration | | **table\_label** boolean | **Choices:*** no * **yes** ← | Causes JUNOS to allocate a VPN label per VRF rather than per VPN FEC. This allows for forwarding of traffic to directly connected subnets, COS Egress filtering etc. | | **target** list / elements=string | | It configures VRF target community configuration. The target value takes the form of `target:A:B` where `A` and `B` are both numeric values. | Notes ----- Note * This module requires the netconf system service be enabled on the remote device being managed. * Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. * Recommended connection is `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). * This module also works with `local` connections for legacy playbooks. * For information on using CLI and netconf see the [Junos OS Platform Options guide](../../../network/user_guide/platform_junos#junos-platform-options) * For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide) * For more information on using Ansible to manage Juniper network devices see <https://www.ansible.com/ansible-juniper>. Examples -------- ``` - name: Configure vrf configuration junipernetworks.junos.junos_vrf: name: test-1 description: test-vrf-1 interfaces: - ge-0/0/3 - ge-0/0/2 rd: 192.0.2.1:10 target: target:65514:113 state: present - name: Remove vrf configuration junipernetworks.junos.junos_vrf: name: test-1 description: test-vrf-1 interfaces: - ge-0/0/3 - ge-0/0/2 rd: 192.0.2.1:10 target: target:65514:113 state: absent - name: Deactivate vrf configuration junipernetworks.junos.junos_vrf: name: test-1 description: test-vrf-1 interfaces: - ge-0/0/3 - ge-0/0/2 rd: 192.0.2.1:10 target: target:65514:113 active: false - name: Activate vrf configuration junipernetworks.junos.junos_vrf: name: test-1 description: test-vrf-1 interfaces: - ge-0/0/3 - ge-0/0/2 rd: 192.0.2.1:10 target: target:65514:113 active: true - name: Create vrf using aggregate junipernetworks.junos.junos_vrf: aggregate: - name: test-1 description: test-vrf-1 interfaces: - ge-0/0/3 - ge-0/0/2 rd: 192.0.2.1:10 target: target:65514:113 - name: test-2 description: test-vrf-2 interfaces: - ge-0/0/4 - ge-0/0/5 rd: 192.0.2.2:10 target: target:65515:114 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 | | --- | --- | --- | | **diff.prepared** string | when configuration is changed and diff option is enabled. | Configuration difference before and after applying change. **Sample:** [edit routing-instances] + test-1 { + description test-vrf-1; + instance-type vrf; + interface ge-0/0/2.0; + interface ge-0/0/3.0; + route-distinguisher 192.0.2.1:10; + vrf-target target:65514:113; + } | ### Authors * Ganesh Nalawade (@ganeshrn) ansible junipernetworks.junos.junos_static_routes – Static routes resource module junipernetworks.junos.junos\_static\_routes – Static routes resource module =========================================================================== Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_static_routes`. New in version 1.0.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module provides declarative management of static routes on Juniper JUNOS devices 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. * ncclient (>=v0.6.4) * xmltodict (>=0.12) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **config** list / elements=dictionary | | A dictionary of static routes options | | | **address\_families** list / elements=dictionary | | Address family to use for the static routes | | | | **afi** string / required | **Choices:*** ipv4 * ipv6 | afi to use for the static routes | | | | **routes** list / elements=dictionary | | Static route configuration | | | | | **dest** string | | Static route destination including prefix | | | | | **metric** integer | | Metric value for the static route | | | | | **next\_hop** list / elements=dictionary | | Next hop to destination | | | | | | **forward\_router\_address** string | | List of next hops | | | **vrf** string | | Virtual Routing and Forwarding (VRF) name | | **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the Junos device by executing the command **show routing-options**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result | | **state** string | **Choices:*** **merged** ← * replaced * overridden * deleted * gathered * rendered * parsed | The state the configuration should be left in | Notes ----- Note * This module requires the netconf system service be enabled on the device being managed. * This module works with connection `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). * Tested against JunOS v18.4R1 Examples -------- ``` # Using deleted # Before state # ------------ # # admin# show routing-options # static { # route 192.168.47.0/24 next-hop 172.16.1.2; # route 192.168.16.0/24 next-hop 172.16.1.2; # route 10.200.16.75/24 next-hop 10.200.16.2; # } - name: Delete provided configuration (default operation is merge) junipernetworks.junos.junos_static_routes: config: - address_families: - afi: ipv4 routes: - dest: 10.200.16.75/24 next_hop: - forward_router_address: 10.200.16.2 state: deleted # After state: # ------------ # # admin# show routing-options # static { # route 192.168.47.0/24 next-hop 172.16.1.2; # route 192.168.16.0/24 next-hop 172.16.1.2; # } # Using merged # Before state # ------------ # # admin# show routing-options # static { # route 192.168.47.0/24 next-hop 172.16.1.2; # route 192.168.16.0/24 next-hop 172.16.1.2; # } - name: Merge provided configuration with device configuration (default operation is merge) junipernetworks.junos.junos_static_routes: config: - address_families: - afi: ipv4 routes: - dest: 10.200.16.75/24 next_hop: - forward_router_address: 10.200.16.2 state: merged # After state: # ------------ # # admin# show routing-options # static { # route 192.168.47.0/24 next-hop 172.16.1.2; # route 192.168.16.0/24 next-hop 172.16.1.2; # route 10.200.16.75/24 next-hop 10.200.16.2; # } # Using overridden # Before state # ------------ # # admin# show routing-options # static { # route 192.168.47.0/24 next-hop 172.16.1.2; # route 192.168.16.0/24 next-hop 172.16.0.1; # } - name: Override provided configuration with device configuration (default operation is merge) junipernetworks.junos.junos_static_routes: config: - address_families: - afi: ipv4 routes: - dest: 10.200.16.75/24 next_hop: - forward_router_address: 10.200.16.2 state: overridden # After state: # ------------ # # admin# show routing-options # static { # route 10.200.16.75/24 next-hop 10.200.16.2; # } # Using replaced # Before state # ------------ # # admin# show routing-options # static { # route 192.168.47.0/24 next-hop 172.16.1.2; # route 192.168.16.0/24 next-hop 172.16.1.2; # } - name: Replace provided configuration with device configuration (default operation is merge) junipernetworks.junos.junos_static_routes: config: - address_families: - afi: ipv4 routes: - dest: 192.168.47.0/24 next_hop: - forward_router_address: 10.200.16.2 state: replaced # After state: # ------------ # # admin# show routing-options # static { # route 192.168.47.0/24 next-hop 10.200.16.2; # route 192.168.16.0/24 next-hop 172.16.1.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 | | --- | --- | --- | | **after** string | when changed | The resulting configuration model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **before** string | always | The configuration prior to the model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['command 1', 'command 2', 'command 3'] | ### Authors * Daniel Mellado (@dmellado) ansible Junipernetworks.Junos Junipernetworks.Junos ===================== Collection version 2.6.0 Plugin Index ------------ These are the plugins in the junipernetworks.junos collection ### Cliconf Plugins * [junos](junos_cliconf#ansible-collections-junipernetworks-junos-junos-cliconf) – Use junos cliconf to run command on Juniper Junos OS platform ### Modules * [junos\_acl\_interfaces](junos_acl_interfaces_module#ansible-collections-junipernetworks-junos-junos-acl-interfaces-module) – ACL interfaces resource module * [junos\_acls](junos_acls_module#ansible-collections-junipernetworks-junos-junos-acls-module) – ACLs resource module * [junos\_banner](junos_banner_module#ansible-collections-junipernetworks-junos-junos-banner-module) – Manage multiline banners on Juniper JUNOS devices * [junos\_bgp\_address\_family](junos_bgp_address_family_module#ansible-collections-junipernetworks-junos-junos-bgp-address-family-module) – Manage BGP Address Family attributes of interfaces on Junos devices. * [junos\_bgp\_global](junos_bgp_global_module#ansible-collections-junipernetworks-junos-junos-bgp-global-module) – Manages BGP Global configuration on devices running Juniper JUNOS. * [junos\_command](junos_command_module#ansible-collections-junipernetworks-junos-junos-command-module) – Run arbitrary commands on an Juniper JUNOS device * [junos\_config](junos_config_module#ansible-collections-junipernetworks-junos-junos-config-module) – Manage configuration on devices running Juniper JUNOS * [junos\_facts](junos_facts_module#ansible-collections-junipernetworks-junos-junos-facts-module) – Collect facts from remote devices running Juniper Junos * [junos\_interface](junos_interface_module#ansible-collections-junipernetworks-junos-junos-interface-module) – (deprecated, removed after 2022-06-01) Manage Interface on Juniper JUNOS network devices * [junos\_interfaces](junos_interfaces_module#ansible-collections-junipernetworks-junos-junos-interfaces-module) – Junos Interfaces resource module * [junos\_l2\_interface](junos_l2_interface_module#ansible-collections-junipernetworks-junos-junos-l2-interface-module) – (deprecated, removed after 2022-06-01) Manage L2 Interface on Juniper JUNOS network devices * [junos\_l2\_interfaces](junos_l2_interfaces_module#ansible-collections-junipernetworks-junos-junos-l2-interfaces-module) – L2 interfaces resource module * [junos\_l3\_interface](junos_l3_interface_module#ansible-collections-junipernetworks-junos-junos-l3-interface-module) – (deprecated, removed after 2022-06-01) Manage L3 interfaces on Juniper JUNOS network devices * [junos\_l3\_interfaces](junos_l3_interfaces_module#ansible-collections-junipernetworks-junos-junos-l3-interfaces-module) – L3 interfaces resource module * [junos\_lacp](junos_lacp_module#ansible-collections-junipernetworks-junos-junos-lacp-module) – Global Link Aggregation Control Protocol (LACP) Junos resource module * [junos\_lacp\_interfaces](junos_lacp_interfaces_module#ansible-collections-junipernetworks-junos-junos-lacp-interfaces-module) – LACP interfaces resource module * [junos\_lag\_interfaces](junos_lag_interfaces_module#ansible-collections-junipernetworks-junos-junos-lag-interfaces-module) – Link Aggregation Juniper JUNOS resource module * [junos\_linkagg](junos_linkagg_module#ansible-collections-junipernetworks-junos-junos-linkagg-module) – (deprecated, removed after 2022-06-01) Manage link aggregation groups on Juniper JUNOS network devices * [junos\_lldp](junos_lldp_module#ansible-collections-junipernetworks-junos-junos-lldp-module) – (deprecated, removed after 2022-06-01) Manage LLDP configuration on Juniper JUNOS network devices * [junos\_lldp\_global](junos_lldp_global_module#ansible-collections-junipernetworks-junos-junos-lldp-global-module) – LLDP resource module * [junos\_lldp\_interface](junos_lldp_interface_module#ansible-collections-junipernetworks-junos-junos-lldp-interface-module) – (deprecated, removed after 2022-06-01) Manage LLDP interfaces configuration on Juniper JUNOS network devices * [junos\_lldp\_interfaces](junos_lldp_interfaces_module#ansible-collections-junipernetworks-junos-junos-lldp-interfaces-module) – LLDP interfaces resource module * [junos\_logging](junos_logging_module#ansible-collections-junipernetworks-junos-junos-logging-module) – Manage logging on network devices * [junos\_logging\_global](junos_logging_global_module#ansible-collections-junipernetworks-junos-junos-logging-global-module) – Manage logging configuration on Junos devices. * [junos\_netconf](junos_netconf_module#ansible-collections-junipernetworks-junos-junos-netconf-module) – Configures the Junos Netconf system service * [junos\_ntp\_global](junos_ntp_global_module#ansible-collections-junipernetworks-junos-junos-ntp-global-module) – Manage NTP configuration on Junos devices. * [junos\_ospf\_interfaces](junos_ospf_interfaces_module#ansible-collections-junipernetworks-junos-junos-ospf-interfaces-module) – OSPF Interfaces Resource Module. * [junos\_ospfv2](junos_ospfv2_module#ansible-collections-junipernetworks-junos-junos-ospfv2-module) – OSPFv2 resource module * [junos\_ospfv3](junos_ospfv3_module#ansible-collections-junipernetworks-junos-junos-ospfv3-module) – OSPFv3 resource module * [junos\_package](junos_package_module#ansible-collections-junipernetworks-junos-junos-package-module) – Installs packages on remote devices running Junos * [junos\_ping](junos_ping_module#ansible-collections-junipernetworks-junos-junos-ping-module) – Tests reachability using ping from devices running Juniper JUNOS * [junos\_prefix\_lists](junos_prefix_lists_module#ansible-collections-junipernetworks-junos-junos-prefix-lists-module) – Manage prefix-lists attributes of interfaces on Junos devices. * [junos\_routing\_instances](junos_routing_instances_module#ansible-collections-junipernetworks-junos-junos-routing-instances-module) – Manage routing instances on Junos devices. * [junos\_rpc](junos_rpc_module#ansible-collections-junipernetworks-junos-junos-rpc-module) – Runs an arbitrary RPC over NetConf on an Juniper JUNOS device * [junos\_scp](junos_scp_module#ansible-collections-junipernetworks-junos-junos-scp-module) – Transfer files from or to remote devices running Junos * [junos\_static\_route](junos_static_route_module#ansible-collections-junipernetworks-junos-junos-static-route-module) – (deprecated, removed after 2022-06-01) Manage static IP routes on Juniper JUNOS network devices * [junos\_static\_routes](junos_static_routes_module#ansible-collections-junipernetworks-junos-junos-static-routes-module) – Static routes resource module * [junos\_system](junos_system_module#ansible-collections-junipernetworks-junos-junos-system-module) – Manage the system attributes on Juniper JUNOS devices * [junos\_user](junos_user_module#ansible-collections-junipernetworks-junos-junos-user-module) – Manage local user accounts on Juniper JUNOS devices * [junos\_vlan](junos_vlan_module#ansible-collections-junipernetworks-junos-junos-vlan-module) – (deprecated, removed after 2022-06-01) Manage VLANs on Juniper JUNOS network devices * [junos\_vlans](junos_vlans_module#ansible-collections-junipernetworks-junos-junos-vlans-module) – VLANs resource module * [junos\_vrf](junos_vrf_module#ansible-collections-junipernetworks-junos-junos-vrf-module) – Manage the VRF definitions on Juniper JUNOS devices ### Netconf Plugins * [junos](junos_netconf#ansible-collections-junipernetworks-junos-junos-netconf) – Use junos netconf plugin to run netconf commands on Juniper JUNOS platform See also List of [collections](../../index#list-of-collections) with docs hosted here.
programming_docs
ansible junipernetworks.junos.junos_lag_interfaces – Link Aggregation Juniper JUNOS resource module junipernetworks.junos.junos\_lag\_interfaces – Link Aggregation Juniper JUNOS resource module ============================================================================================= Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_lag_interfaces`. New in version 1.0.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module manages properties of Link Aggregation Group on Juniper JUNOS devices. 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. * ncclient (>=v0.6.4) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **config** list / elements=dictionary | | A list of link aggregation group configurations. | | | **link\_protection** boolean | **Choices:*** no * yes | This boolean option indicates if link protection should be enabled for the LAG interface. If value is `True` link protection is enabled on LAG and if value is `False` link protection is disabled. | | | **members** list / elements=dictionary | | List of member interfaces of the link aggregation group. The value can be single interface or list of interfaces. | | | | **link\_type** string | **Choices:*** primary * backup | The value of this options configures the member link as either `primary` or `backup`. Value `primary` configures primary interface for link-protection mode and `backup` configures backup interface for link-protection mode. | | | | **member** string | | Name of the member interface. | | | **mode** string | **Choices:*** active * passive | LAG mode. A value of `passive` will enable LACP in `passive` mode that is it will respond to LACP packets and `active` configures the link to initiate transmission of LACP packets. | | | **name** string / required | | Name of the link aggregation group (LAG). | | **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the Junos device by executing the command **show interfaces**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result | | **state** string | **Choices:*** **merged** ← * replaced * overridden * deleted * gathered * rendered * parsed | The state of the configuration after module completion | Notes ----- Note * This module requires the netconf system service be enabled on the remote device being managed. * Tested against vSRX JUNOS version 18.4R1. * This module works with connection `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). Examples -------- ``` # Using merged # Before state: # ------------- # user@junos01# show interfaces # ge-0/0/1 { # description "Ansible configured interface 1"; # ether-options { # 802.3ad ae0; # } # } # ge-0/0/2 { # description "Ansible configured interface 2"; # ether-options { # 802.3ad ae0; # } # } # ae0 { # description "lag interface"; # } # ae1 { # description "lag interface 1"; # } - name: "Delete LAG attributes of given interfaces (Note: This won't delete the interface itself)" junipernetworks.junos.junos_lag_interfaces: config: - name: ae0 - name: ae1 state: deleted # After state: # ------------- # user@junos01# show interfaces # ge-0/0/1 { # description "Ansible configured interface 1"; # } # ge-0/0/2 { # description "Ansible configured interface 2"; # } # Using merged # Before state: # ------------- # user@junos01# show interfaces # ge-0/0/1 { # description "Ansible configured interface 1"; # } # ge-0/0/2 { # description "Ansible configured interface 2"; # } - name: Merge provided configuration with device configuration junipernetworks.junos.junos_lag_interfaces: config: - name: ae0 members: - member: ge-0/0/1 link_type: primary - member: ge-0/0/2 link_type: backup state: merged # After state: # ------------- # user@junos01# show interfaces # ge-0/0/1 { # description "Ansible configured interface 1"; # ether-options { # 802.3ad { # ae0; # primary; # } # } # } # ge-0/0/2 { # description "Ansible configured interface 2"; # ether-options { # 802.3ad { # ae0; # backup; # } # } # } # Using merged # Before state: # ------------- # user@junos01# show interfaces # ge-0/0/1 { # description "Ansible configured interface 1"; # ether-options { # 802.3ad ae0; # } # } # ge-0/0/2 { # description "Ansible configured interface 2"; # ether-options { # 802.3ad ae0; # } # } # ae0 { # description "lag interface"; # } # ae3 { # description "lag interface 3"; # } - name: Overrides all device LAG configuration with provided configuration junipernetworks.junos.junos_lag_interfaces: config: - name: ae0 members: - member: ge-0/0/2 - name: ae1 members: - member: ge-0/0/1 mode: passive state: overridden # After state: # ------------- # user@junos01# show interfaces # ge-0/0/1 { # description "Ansible configured interface 1"; # ether-options { # 802.3ad ae1; # } # } # ge-0/0/2 { # description "Ansible configured interface 2"; # ether-options { # 802.3ad ae0; # } # } # ae0 { # description "lag interface"; # } # ae1 { # aggregated-ether-options { # lacp { # active; # } # } # } # Using merged # Before state: # ------------- # user@junos01# show interfaces # ge-0/0/1 { # description "Ansible configured interface 1"; # } # ge-0/0/2 { # description "Ansible configured interface 2"; # } # ge-0/0/3 { # description "Ansible configured interface 3"; # } - name: Replace device LAG configuration with provided configuration junipernetworks.junos.junos_lag_interfaces: config: - name: ae0 members: - member: ge-0/0/1 mode: active state: replaced # After state: # ------------- # user@junos01# show interfaces # ge-0/0/1 { # description "Ansible configured interface 1"; # ether-options { # 802.3ad ae0; # } # } # ge-0/0/2 { # description "Ansible configured interface 2"; # } # ae0 { # aggregated-ether-options { # lacp { # active; # } # } # } # ge-0/0/3 { # description "Ansible configured interface 3"; # } # Using gathered # Before state: # ------------ # # ansible@cm123456tr21# show interfaces # ge-0/0/1 { # ether-options { # 802.3ad ae1; # } # } # ge-0/0/2 { # ether-options { # 802.3ad ae1; # } # } # ge-0/0/3 { # ether-options { # 802.3ad { # ae2; # primary; # } # } # } # ge-0/0/4 { # ether-options { # 802.3ad { # ae2; # backup; # } # } # } # ge-1/0/0 { # unit 0 { # family inet { # address 192.168.100.1/24; # address 10.200.16.20/24; # } # family inet6; # } # } # ge-2/0/0 { # unit 0 { # family inet { # address 192.168.100.2/24; # address 10.200.16.21/24; # } # family inet6; # } # } # ge-3/0/0 { # unit 0 { # family inet { # address 192.168.100.3/24; # address 10.200.16.22/24; # } # family inet6; # } # } # ae1 { # description "Configured by Ansible"; # aggregated-ether-options { # lacp { # active; # } # } # } # ae2 { # description "Configured by Ansible"; # aggregated-ether-options { # link-protection; # lacp { # passive; # } # } # } # em1 { # description TEST; # } # fxp0 { # description ANSIBLE; # speed 1g; # link-mode automatic; # unit 0 { # family inet { # address 10.8.38.38/24; # } # } # } - name: Gather junos lag interfaces as in given arguments junipernetworks.junos.junos_lag_interfaces: state: gathered # Task Output (redacted) # ----------------------- # # "gathered": [ # { # "members": [ # { # "member": "ge-0/0/1" # }, # { # "member": "ge-0/0/2" # } # ], # "mode": "active", # "name": "ae1" # }, # { # "link_protection": true, # "members": [ # { # "link_type": "primary", # "member": "ge-0/0/3" # }, # { # "link_type": "backup", # "member": "ge-0/0/4" # } # ], # "mode": "passive", # "name": "ae2" # } # ] # After state: # ------------ # # ansible@cm123456tr21# show interfaces # ge-0/0/1 { # ether-options { # 802.3ad ae1; # } # } # ge-0/0/2 { # ether-options { # 802.3ad ae1; # } # } # ge-0/0/3 { # ether-options { # 802.3ad { # ae2; # primary; # } # } # } # ge-0/0/4 { # ether-options { # 802.3ad { # ae2; # backup; # } # } # } # ge-1/0/0 { # unit 0 { # family inet { # address 192.168.100.1/24; # address 10.200.16.20/24; # } # family inet6; # } # } # ge-2/0/0 { # unit 0 { # family inet { # address 192.168.100.2/24; # address 10.200.16.21/24; # } # family inet6; # } # } # ge-3/0/0 { # unit 0 { # family inet { # address 192.168.100.3/24; # address 10.200.16.22/24; # } # family inet6; # } # } # ae1 { # description "Configured by Ansible"; # aggregated-ether-options { # lacp { # active; # } # } # } # ae2 { # description "Configured by Ansible"; # aggregated-ether-options { # link-protection; # lacp { # passive; # } # } # } # em1 { # description TEST; # } # fxp0 { # description ANSIBLE; # speed 1g; # link-mode automatic; # unit 0 { # family inet { # address 10.8.38.38/24; # } # } # } # Using parsed # parsed.cfg # ------------ # # <?xml version="1.0" encoding="UTF-8"?> # <rpc-reply message-id="urn:uuid:0cadb4e8-5bba-47f4-986e-72906227007f"> # <configuration changed-seconds="1590139550" changed-localtime="2020-05-22 09:25:50 UTC"> # <interfaces> # <interface> # <name>ge-0/0/1</name> # <ether-options> # <ieee-802.3ad> # <bundle>ae1</bundle> # </ieee-802.3ad> # </ether-options> # </interface> # <interface> # <name>ge-0/0/2</name> # <ether-options> # <ieee-802.3ad> # <bundle>ae1</bundle> # </ieee-802.3ad> # </ether-options> # </interface> # <interface> # <name>ge-0/0/3</name> # <ether-options> # <ieee-802.3ad> # <bundle>ae2</bundle> # <primary/> # </ieee-802.3ad> # </ether-options> # </interface> # <interface> # <name>ge-0/0/4</name> # <ether-options> # <ieee-802.3ad> # <bundle>ae2</bundle> # <backup/> # </ieee-802.3ad> # </ether-options> # </interface> # <interface> # <name>ge-1/0/0</name> # <unit> # <name>0</name> # <family> # <inet> # <address> # <name>192.168.100.1/24</name> # </address> # <address> # <name>10.200.16.20/24</name> # </address> # </inet> # <inet6> # </inet6> # </family> # </unit> # </interface> # <interface> # <name>ge-2/0/0</name> # <unit> # <name>0</name> # <family> # <inet> # <address> # <name>192.168.100.2/24</name> # </address> # <address> # <name>10.200.16.21/24</name> # </address> # </inet> # <inet6> # </inet6> # </family> # </unit> # </interface> # <interface> # <name>ge-3/0/0</name> # <unit> # <name>0</name> # <family> # <inet> # <address> # <name>192.168.100.3/24</name> # </address> # <address> # <name>10.200.16.22/24</name> # </address> # </inet> # <inet6> # </inet6> # </family> # </unit> # </interface> # <interface> # <name>ae1</name> # <description>Configured by Ansible</description> # <aggregated-ether-options> # <lacp> # <active/> # </lacp> # </aggregated-ether-options> # </interface> # <interface> # <name>ae2</name> # <description>Configured by Ansible</description> # <aggregated-ether-options> # <link-protection> # </link-protection> # <lacp> # <passive/> # </lacp> # </aggregated-ether-options> # </interface> # <interface> # <name>em1</name> # <description>TEST</description> # </interface> # <interface> # <name>fxp0</name> # <description>ANSIBLE</description> # <speed>1g</speed> # <link-mode>automatic</link-mode> # <unit> # <name>0</name> # <family> # <inet> # <address> # <name>10.8.38.38/24</name> # </address> # </inet> # </family> # </unit> # </interface> # </interfaces> # </configuration> # </rpc-reply> # - name: Convert interfaces config to argspec without connecting to the appliance # junipernetworks.junos.junos_lag_interfaces: # running_config: "{{ lookup('file', './parsed.cfg') }}" # state: parsed # Task Output (redacted) # ----------------------- # "parsed": [ # { # "members": [ # { # "member": "ge-0/0/1" # }, # { # "member": "ge-0/0/2" # } # ], # "mode": "active", # "name": "ae1" # }, # { # "link_protection": true, # "members": [ # { # "link_type": "primary", # "member": "ge-0/0/3" # }, # { # "link_type": "backup", # "member": "ge-0/0/4" # } # ], # "mode": "passive", # "name": "ae2" # } # ] # Using rendered - name: Render platform specific xml from task input using rendered state junipernetworks.junos.junos_lag_interfaces: config: - name: ae1 members: - member: ge-0/0/1 - member: ge-0/0/2 mode: active - name: ae2 link_protection: true members: - member: ge-0/0/3 link_type: primary - member: ge-0/0/4 link_type: backup mode: passive # Task Output (redacted) # ----------------------- # "rendered": "<nc:interfaces # xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> # <nc:interface> # <nc:name>ae1</nc:name> # <nc:aggregated-ether-options> # <nc:lacp> # <nc:active/> # </nc:lacp> # </nc:aggregated-ether-options> # </nc:interface> # <nc:interface> # <nc:name>ge-0/0/1</nc:name> # <nc:ether-options> # <nc:ieee-802.3ad> # <nc:bundle>ae1</nc:bundle> # </nc:ieee-802.3ad> # </nc:ether-options> # </nc:interface> # <nc:interface> # <nc:name>ge-0/0/2</nc:name> # <nc:ether-options> # <nc:ieee-802.3ad> # <nc:bundle>ae1</nc:bundle> # </nc:ieee-802.3ad> # </nc:ether-options> # </nc:interface> # <nc:interface> # <nc:name>ae2</nc:name> # <nc:aggregated-ether-options> # <nc:lacp> # <nc:passive/> # </nc:lacp> # <nc:link-protection/> # </nc:aggregated-ether-options> # </nc:interface> # <nc:interface> # <nc:name>ge-0/0/3</nc:name> # <nc:ether-options> # <nc:ieee-802.3ad> # <nc:bundle>ae2</nc:bundle> # <nc:primary/> # </nc:ieee-802.3ad> # </nc:ether-options> # </nc:interface> # <nc:interface> # <nc:name>ge-0/0/4</nc:name> # <nc:ether-options> # <nc:ieee-802.3ad> # <nc:bundle>ae2</nc:bundle> # <nc:backup/> # </nc:ieee-802.3ad> # </nc:ether-options> # </nc:interface> # </nc:interfaces>" ``` 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 | | --- | --- | --- | | **after** list / elements=string | when changed | The configuration as structured data after module completion. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **before** list / elements=string | always | The configuration as structured data prior to module invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **xml** list / elements=string | always | The set of xml rpc payload pushed to the remote device. **Sample:** ['<nc:interfaces xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:interface> <nc:name>ae1</nc:name> <nc:aggregated-ether-options> <nc:lacp> <nc:active/> </nc:lacp> </nc:aggregated-ether-options> </nc:interface> <nc:interface> <nc:name>ge-0/0/1</nc:name> <nc:ether-options> <nc:ieee-802.3ad> <nc:bundle>ae1</nc:bundle> </nc:ieee-802.3ad> </nc:ether-options> </nc:interface> <nc:interface> <nc:name>ge-0/0/2</nc:name> <nc:ether-options> <nc:ieee-802.3ad> <nc:bundle>ae1</nc:bundle> </nc:ieee-802.3ad> </nc:ether-options> </nc:interface> <nc:interface> <nc:name>ae2</nc:name> <nc:aggregated-ether-options> <nc:lacp> <nc:passive/> </nc:lacp> <nc:link-protection/> </nc:aggregated-ether-options> </nc:interface> <nc:interface> <nc:name>ge-0/0/3</nc:name> <nc:ether-options> <nc:ieee-802.3ad> <nc:bundle>ae2</nc:bundle> <nc:primary/> </nc:ieee-802.3ad> </nc:ether-options> </nc:interface> <nc:interface> <nc:name>ge-0/0/4</nc:name> <nc:ether-options> <nc:ieee-802.3ad> <nc:bundle>ae2</nc:bundle> <nc:backup/> </nc:ieee-802.3ad> </nc:ether-options> </nc:interface> </nc:interfaces>', 'xml 2', 'xml 3'] | ### Authors * Ganesh Nalawade (@ganeshrn)
programming_docs
ansible junipernetworks.junos.junos_interfaces – Junos Interfaces resource module junipernetworks.junos.junos\_interfaces – Junos Interfaces resource module ========================================================================== Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_interfaces`. New in version 1.0.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module manages the interfaces on Juniper Junos OS network devices. 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. * ncclient (>=v0.6.4) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **config** list / elements=dictionary | | The provided configuration | | | **description** string | | Interface description. | | | **duplex** string | **Choices:*** automatic * full-duplex * half-duplex | Interface link status. Applicable for Ethernet interfaces only, either in half duplex, full duplex or in automatic state which negotiates the duplex automatically. | | | **enabled** boolean | **Choices:*** no * **yes** ← | Administrative state of the interface. Set the value to `true` to administratively enabled the interface or `false` to disable it. | | | **hold\_time** dictionary | | The hold time for given interface name. | | | | **down** integer | | The link down hold time in milliseconds. | | | | **up** integer | | The link up hold time in milliseconds. | | | **mtu** integer | | MTU for a specific interface. Applicable for Ethernet interfaces only. | | | **name** string / required | | Full name of interface, e.g. ge-0/0/0. | | | **speed** string | | Interface link speed. Applicable for Ethernet interfaces only. | | **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the Junos device by executing the command **show interfaces**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result. | | **state** string | **Choices:*** **merged** ← * replaced * overridden * deleted * gathered * parsed * rendered | The state of the configuration after module completion | Notes ----- Note * This module requires the netconf system service be enabled on the remote device being managed. * Tested against vSRX JUNOS version 18.4R1. * This module works with connection `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). Examples -------- ``` # Using deleted # Before state: # ------------- # user@junos01# show interfaces # ge-0/0/1 { # description "Configured by Ansible-1"; # speed 1g; # mtu 1800 # } # ge-0/0/2 { # description "Configured by Ansible-2"; # ether-options { # auto-negotiation; # } # } - name: "Delete given options for the interface (Note: This won't delete the interface itself if any other values are configured for interface)" junipernetworks.junos.junos_interfaces: config: - name: ge-0/0/1 description: Configured by Ansible-1 speed: 1g mtu: 1800 - name: ge-0/0/2 description: Configured by Ansible -2 state: deleted # After state: # ------------ # user@junos01# show interfaces # ge-0/0/2 { # ether-options { # auto-negotiation; # } # } # Using merged # Before state: # ------------- # user@junos01# show interfaces # ge-0/0/1 { # description "test interface"; # speed 1g; # } - name: Merge provided configuration with device configuration (default operation is merge) junipernetworks.junos.junos_interfaces: config: - name: ge-0/0/1 description: Configured by Ansible-1 enabled: true mtu: 1800 - name: ge-0/0/2 description: Configured by Ansible-2 enabled: false state: merged # After state: # ------------ # user@junos01# show interfaces # ge-0/0/1 { # description "Configured by Ansible-1"; # speed 1g; # mtu 1800 # } # ge-0/0/2 { # disable; # description "Configured by Ansible-2"; # } # Using overridden # Before state: # ------------- # user@junos01# show interfaces # ge-0/0/1 { # description "Configured by Ansible-1"; # speed 1g; # mtu 1800 # } # ge-0/0/2 { # disable; # description "Configured by Ansible-2"; # ether-options { # auto-negotiation; # } # } # ge-0/0/11 { # description "Configured by Ansible-11"; # } - name: Override device configuration of all interfaces with provided configuration junipernetworks.junos.junos_interfaces: config: - name: ge-0/0/2 description: Configured by Ansible-2 enabled: false mtu: 2800 - name: ge-0/0/3 description: Configured by Ansible-3 state: overridden # After state: # ------------ # user@junos01# show interfaces # ge-0/0/2 { # disable; # description "Configured by Ansible-2"; # mtu 2800 # } # ge-0/0/3 { # description "Configured by Ansible-3"; # } # Using replaced # Before state: # ------------- # user@junos01# show interfaces # ge-0/0/1 { # description "Configured by Ansible-1"; # speed 1g; # mtu 1800 # } # ge-0/0/2 { # disable; # mtu 1800; # speed 1g; # description "Configured by Ansible-2"; # ether-options { # auto-negotiation; # } # } # ge-0/0/11 { # description "Configured by Ansible-11"; # } - name: Replaces device configuration of listed interfaces with provided configuration junipernetworks.junos.junos_interfaces: config: - name: ge-0/0/2 description: Configured by Ansible-2 enabled: false mtu: 2800 - name: ge-0/0/3 description: Configured by Ansible-3 state: replaced # After state: # ------------ # user@junos01# show interfaces # ge-0/0/1 { # description "Configured by Ansible-1"; # speed 1g; # mtu 1800 # } # ge-0/0/2 { # disable; # description "Configured by Ansible-2"; # mtu 2800 # } # ge-0/0/3 { # description "Configured by Ansible-3"; # } # ge-0/0/11 { # description "Configured by Ansible-11"; # } # Using gathered # Before state: # ------------ # # user@junos01# show interfaces # gr-0/0/0 { # description "test gre interface"; # } # fxp0 { # unit 0 { # family inet { # dhcp; # } # } # } # pp0 { # unit 0 { # pppoe-options { # idle-timeout 100; # access-concentrator ispl.com; # service-name "[email protected]"; # auto-reconnect 100; # client; # ## Warning: missing mandatory statement(s): 'underlying-interface' # } # } # } # - name: Gather junos interfaces as in given arguments junipernetworks.junos.junos_interfaces: state: gathered # Task Output (redacted) # ----------------------- # # "gathered": [ # { # "description": "test gre interface", # "enabled": true, # "name": "gr-0/0/0" # }, # { # "enabled": true, # "name": "fxp0" # }, # { # "enabled": true, # "name": "pp0" # } # ] # After state: # ------------ # # user@junos01# show interfaces # gr-0/0/0 { # description "test gre interface"; # } # fxp0 { # unit 0 { # family inet { # dhcp; # } # } # } # pp0 { # unit 0 { # pppoe-options { # idle-timeout 100; # access-concentrator ispl.com; # service-name "[email protected]"; # auto-reconnect 100; # client; # ## Warning: missing mandatory statement(s): 'underlying-interface' # } # } # } # Using parsed # parsed.cfg # ------------ # # <?xml version="1.0" encoding="UTF-8"?> # <rpc-reply message-id="urn:uuid:0cadb4e8-5bba-47f4-986e-72906227007f"> # <configuration changed-seconds="1590139550" changed-localtime="2020-05-22 09:25:50 UTC"> # <interfaces> # <interface> # <name>ge-0/0/1</name> # <description>Configured by Ansible</description> # <disable/> # <speed>100m</speed> # <mtu>1024</mtu> # <hold-time> # <up>2000</up> # <down>2200</down> # </hold-time> # <link-mode>full-duplex</link-mode> # <unit> # <name>0</name> # <family> # <ethernet-switching> # <interface-mode>access</interface-mode> # <vlan> # <members>vlan100</members> # </vlan> # </ethernet-switching> # </family> # </unit> # </interface> # </interfaces> # </configuration> # </rpc-reply> # - name: Convert interfaces config to argspec without connecting to the appliance # junipernetworks.junos.junos_interfaces: # running_config: "{{ lookup('file', './parsed.cfg') }}" # state: parsed # Task Output (redacted) # ----------------------- # "parsed": [ # { # "description": "Configured by Ansible", # "duplex": "full-duplex", # "enabled": false, # "hold_time": { # "down": 2200, # "up": 2000 # }, # "mtu": 1024, # "name": "ge-0/0/1", # "speed": "100m" # } # ] # # Using rendered - name: Render platform specific xml from task input using rendered state junipernetworks.junos.junos_interfaces: config: - name: ge-0/0/2 description: Configured by Ansibull mtu: 2048 speed: 20m hold_time: up: 3200 down: 3200 state: rendered # Task Output (redacted) # ----------------------- # "rendered": <nc:interfaces # xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> # <nc:interface> # <nc:name>ge-0/0/2</nc:name> # <nc:description>Configured by Ansibull</nc:description> # <nc:speed>20m</nc:speed> # <nc:mtu>2048</nc:mtu> # <nc:hold-time> # <nc:up>3200</nc:up> # <nc:down>3200</nc:down> # </nc:hold-time> # </nc:interface> # </nc:interfaces>" ``` 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 | | --- | --- | --- | | **after** list / elements=string | when changed | The configuration as structured data after module completion. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **before** list / elements=string | always | The configuration as structured data prior to module invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **xml** list / elements=string | always | The set of xml rpc payload pushed to the remote device. **Sample:** ['<?xml version="1.0" encoding="UTF-8"?> <rpc-reply message-id="urn:uuid:0cadb4e8-5bba-47f4-986e-72906227007f"> <configuration changed-seconds="1590139550" changed-localtime="2020-05-22 09:25:50 UTC"> <interfaces> <interface> <name>ge-0/0/1</name> <description>Configured by Ansible</description> <disable/> <speed>100m</speed> <mtu>1024</mtu> <hold-time> <up>2000</up> <down>2200</down> </hold-time> <link-mode>full-duplex</link-mode> <unit> <name>0</name> <family> <ethernet-switching> <interface-mode>access</interface-mode> <vlan> <members>vlan100</members> </vlan> </ethernet-switching> </family> </unit> </interface> </interfaces> </configuration> </rpc-reply>', 'xml 2', 'xml 3'] | ### Authors * Ganesh Nalawade (@ganeshrn) ansible junipernetworks.junos.junos_system – Manage the system attributes on Juniper JUNOS devices junipernetworks.junos.junos\_system – Manage the system attributes on Juniper JUNOS devices =========================================================================================== Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_system`. New in version 1.0.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module provides declarative management of node system attributes on Juniper JUNOS devices. It provides an option to configure host system parameters or remove those parameters from the device active configuration. 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. * ncclient (>=v0.5.2) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **active** boolean | **Choices:*** no * **yes** ← | Specifies whether or not the configuration is active or deactivated | | **domain\_name** string | | Configure the IP domain name on the remote device to the provided value. Value should be in the dotted name form and will be appended to the `hostname` to create a fully-qualified domain name. | | **domain\_search** list / elements=string | | Provides the list of domain suffixes to append to the hostname for the purpose of doing name resolution. This argument accepts a list of names and will be reconciled with the current active configuration on the running node. | | **hostname** string | | Configure the device hostname parameter. This option takes an ASCII string value. | | **name\_servers** list / elements=string | | List of DNS name servers by IP address to use to perform name resolution lookups. This argument accepts either a list of DNS servers See examples. | | **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli` or `connection: netconf`. For more information please see the [Junos OS Platform Options guide](../network/user_guide/platform_junos). A dict object containing connection details. | | | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. | | | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. | | | **port** integer | | Specifies the port to use when building the connection to the remote device. The port value will default to the well known SSH port of 22 (for `transport=cli`) or port 830 (for `transport=netconf`) device. | | | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. | | | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. | | | **transport** string | **Choices:*** cli * **netconf** ← | Configures the transport connection to use when connecting to the remote device. | | | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. | | **state** string | **Choices:*** **present** ← * absent | State of the configuration values in the device's current active configuration. When set to *present*, the values should be configured in the device active configuration and when set to *absent* the values should not be in the device active configuration | Notes ----- Note * This module requires the netconf system service be enabled on the remote device being managed. * Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. * Recommended connection is `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). * This module also works with `local` connections for legacy playbooks. * For information on using CLI and netconf see the [Junos OS Platform Options guide](../../../network/user_guide/platform_junos#junos-platform-options) * For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide) * For more information on using Ansible to manage Juniper network devices see <https://www.ansible.com/ansible-juniper>. Examples -------- ``` - name: configure hostname and domain name junipernetworks.junos.junos_system: hostname: junos01 domain_name: test.example.com domain-search: - ansible.com - redhat.com - juniper.net - name: remove configuration junipernetworks.junos.junos_system: state: absent - name: configure name servers junipernetworks.junos.junos_system: name_servers: - 8.8.8.8 - 8.8.4.4 ``` 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 | | --- | --- | --- | | **diff.prepared** string | when configuration is changed and diff option is enabled. | Configuration difference before and after applying change. **Sample:** [edit system] + host-name test; + domain-name ansible.com; + domain-search redhat.com; [edit system name-server] 172.26.1.1 { ... } + 8.8.8.8; | ### Authors * Ganesh Nalawade (@ganeshrn) ansible junipernetworks.junos.junos_lacp – Global Link Aggregation Control Protocol (LACP) Junos resource module junipernetworks.junos.junos\_lacp – Global Link Aggregation Control Protocol (LACP) Junos resource module ========================================================================================================= Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_lacp`. New in version 1.0.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module provides declarative management of global LACP on Juniper Junos network devices. 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. * ncclient (>=v0.6.4) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **config** dictionary | | A dictionary of LACP global options | | | **link\_protection** string | **Choices:*** revertive * non-revertive | Enable LACP link-protection for the system. If the value is set to `non-revertive` it will not revert links when a better priority link comes up. By default the link will be reverted. | | | **system\_priority** integer | | LACP priority for the system. | | **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the Junos device by executing the command **show chassis aggregated-devices ethernet lacp**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result | | **state** string | **Choices:*** **merged** ← * replaced * deleted * gathered * rendered * parsed | The state of the configuration after module completion | Notes ----- Note * This module requires the netconf system service be enabled on the remote device being managed. * Tested against vSRX JUNOS version 18.1R1. * This module works with connection `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). Examples -------- ``` # Using deleted # Before state: # ------------- # user@junos01# show chassis aggregated-devices ethernet lacp # system-priority 63; # link-protection { # non-revertive; # } - name: Delete global LACP attributes junipernetworks.junos.junos_lacp: state: deleted # After state: # ------------ # user@junos01# show chassis aggregated-devices ethernet lacp # # Using merged # Before state: # ------------- # user@junos01# show chassis aggregated-devices ethernet lacp # - name: Merge global LACP attributes junipernetworks.junos.junos_lacp: config: system_priority: 63 link_protection: revertive state: merged # After state: # ------------ # user@junos01# show chassis aggregated-devices ethernet lacp # system-priority 63; # link-protection { # non-revertive; # } # Using replaced # Before state: # ------------- # user@junos01# show chassis aggregated-devices ethernet lacp # system-priority 63; # link-protection { # non-revertive; # } - name: Replace global LACP attributes junipernetworks.junos.junos_lacp: config: system_priority: 30 link_protection: non-revertive state: replaced # After state: # ------------ # user@junos01# show chassis aggregated-devices ethernet lacp # system-priority 30; # link-protection; # # Using gathered # Before state: # ------------ # # ansible@cm123456tr21# show chassis aggregated-devices ethernet lacp # system-priority 63; # link-protection; - name: Gather junos lacp as in given arguments junipernetworks.junos.junos_lacp: state: gathered # Task Output (redacted) # ----------------------- # # "gathered": { # "link_protection": "revertive", # "system_priority": 63 # } # After state: # ------------ # # ansible@cm123456tr21# show chassis aggregated-devices ethernet lacp # system-priority 63; # link-protection; # Using rendered - name: Render platform specific xml from task input using rendered state junipernetworks.junos.junos_lacp: config: system_priority: 63 link_protection: revertive state: rendered # Task Output (redacted) # ----------------------- # "rendered": "<nc:chassis # xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> # <nc:aggregated-devices> # <nc:ethernet> # <nc:lacp> # <nc:system-priority>63</nc:system-priority> # <nc:link-protection> # <nc:non-revertive delete="delete"/> # </nc:link-protection> # </nc:lacp> # </nc:ethernet> # </nc:aggregated-devices> # </nc:chassis> # # Using parsed # parsed.cfg # ------------ # # <?xml version="1.0" encoding="UTF-8"?> # <rpc-reply message-id="urn:uuid:0cadb4e8-5bba-47f4-986e-72906227007f"> # <configuration changed-seconds="1590139550" changed-localtime="2020-05-22 09:25:50 UTC"> # <chassis> # <aggregated-devices> # <ethernet> # <lacp> # <system-priority>63</system-priority> # <link-protection> # </link-protection> # </lacp> # </ethernet> # </aggregated-devices> # </chassis> # </configuration> # </rpc-reply> # - name: Convert lacp config to argspec without connecting to the appliance # junipernetworks.junos.junos_lacp: # running_config: "{{ lookup('file', './parsed.cfg') }}" # state: parsed # Task Output (redacted) # ----------------------- # "parsed": { # "link_protection": "revertive", # "system_priority": 63 # } ``` 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 | | --- | --- | --- | | **after** dictionary | when changed | The configuration as structured data after module completion. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **before** dictionary | always | The configuration as structured data prior to module invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **xml** list / elements=string | always | The set of xml rpc payload pushed to the remote device. **Sample:** ['<nc:chassis xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:aggregated-devices> <nc:ethernet> <nc:lacp> <nc:system-priority>63</nc:system-priority> <nc:link-protection> <nc:non-revertive delete="delete"/> </nc:link-protection> </nc:lacp> </nc:ethernet> </nc:aggregated-devices> </nc:chassis>', 'xml 2', 'xml 3'] | ### Authors * Ganesh Nalawade (@ganeshrn)
programming_docs
ansible junipernetworks.junos.junos_interface – (deprecated, removed after 2022-06-01) Manage Interface on Juniper JUNOS network devices junipernetworks.junos.junos\_interface – (deprecated, removed after 2022-06-01) Manage Interface on Juniper JUNOS network devices ================================================================================================================================= Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_interface`. New in version 1.0.0: of junipernetworks.junos * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in major release after 2022-06-01 Why Updated modules released with more functionality Alternative Use [junipernetworks.junos.junos\_interfaces](junos_interfaces_module#ansible-collections-junipernetworks-junos-junos-interfaces-module) instead. Synopsis -------- * This module provides declarative management of Interfaces on Juniper JUNOS network devices. 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. * ncclient (>=v0.5.2) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **active** boolean | **Choices:*** no * **yes** ← | Specifies whether or not the configuration is active or deactivated | | **aggregate** list / elements=dictionary | | List of Interfaces definitions. | | | **active** boolean | **Choices:*** no * yes | Specifies whether or not the configuration is active or deactivated | | | **delay** integer | | Time in seconds to wait before checking for the operational state on remote device. This wait is applicable for operational state argument which are *state* with values `up`/`down`, *tx\_rate* and *rx\_rate*. | | | **description** string | | Description of Interface. | | | **duplex** string | **Choices:*** full * half * auto | Interface link status. | | | **enabled** boolean | **Choices:*** no * yes | Configure interface link status. | | | **mtu** integer | | Maximum size of transmit packet. | | | **name** string / required | | Name of the Interface. | | | **neighbors** list / elements=dictionary | | Check the operational state of given interface `name` for LLDP neighbor. The following suboptions are available. | | | | **host** string | | LLDP neighbor host for given interface `name`. | | | | **port** string | | LLDP neighbor port to which given interface `name` is connected. | | | **rx\_rate** string | | Receiver rate in bits per second (bps). This is state check parameter only. Supports conditionals, see [Conditionals in Networking Modules](../network/user_guide/network_working_with_command_output) | | | **speed** string | | Interface link speed. | | | **state** string | **Choices:*** present * absent * up * down | State of the Interface configuration, `up` indicates present and operationally up and `down` indicates present and operationally `down` | | | **tx\_rate** string | | Transmit rate in bits per second (bps). This is state check parameter only. Supports conditionals, see [Conditionals in Networking Modules](../network/user_guide/network_working_with_command_output) | | **delay** integer | **Default:**10 | Time in seconds to wait before checking for the operational state on remote device. This wait is applicable for operational state argument which are *state* with values `up`/`down`, *tx\_rate* and *rx\_rate*. | | **description** string | | Description of Interface. | | **duplex** string | **Choices:*** full * half * auto | Interface link status. | | **enabled** boolean | **Choices:*** no * **yes** ← | Configure interface link status. | | **mtu** integer | | Maximum size of transmit packet. | | **name** string | | Name of the Interface. | | **neighbors** list / elements=dictionary | | Check the operational state of given interface `name` for LLDP neighbor. The following suboptions are available. | | | **host** string | | LLDP neighbor host for given interface `name`. | | | **port** string | | LLDP neighbor port to which given interface `name` is connected. | | **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli` or `connection: netconf`. For more information please see the [Junos OS Platform Options guide](../network/user_guide/platform_junos). A dict object containing connection details. | | | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. | | | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. | | | **port** integer | | Specifies the port to use when building the connection to the remote device. The port value will default to the well known SSH port of 22 (for `transport=cli`) or port 830 (for `transport=netconf`) device. | | | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. | | | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. | | | **transport** string | **Choices:*** cli * **netconf** ← | Configures the transport connection to use when connecting to the remote device. | | | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. | | **rx\_rate** string | | Receiver rate in bits per second (bps). This is state check parameter only. Supports conditionals, see [Conditionals in Networking Modules](../network/user_guide/network_working_with_command_output) | | **speed** string | | Interface link speed. | | **state** string | **Choices:*** **present** ← * absent * up * down | State of the Interface configuration, `up` indicates present and operationally up and `down` indicates present and operationally `down` | | **tx\_rate** string | | Transmit rate in bits per second (bps). This is state check parameter only. Supports conditionals, see [Conditionals in Networking Modules](../network/user_guide/network_working_with_command_output) | Notes ----- Note * This module requires the netconf system service be enabled on the remote device being managed. * Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. * Recommended connection is `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). * This module also works with `local` connections for legacy playbooks. * For information on using CLI and netconf see the [Junos OS Platform Options guide](../../../network/user_guide/platform_junos#junos-platform-options) * For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide) * For more information on using Ansible to manage Juniper network devices see <https://www.ansible.com/ansible-juniper>. Examples -------- ``` - name: configure interface junipernetworks.junos.junos_interface: name: ge-0/0/1 description: test-interface - name: remove interface junipernetworks.junos.junos_interface: name: ge-0/0/1 state: absent - name: make interface down junipernetworks.junos.junos_interface: name: ge-0/0/1 enabled: false - name: make interface up junipernetworks.junos.junos_interface: name: ge-0/0/1 enabled: true - name: Deactivate interface config junipernetworks.junos.junos_interface: name: ge-0/0/1 state: present active: false - name: Activate interface config junipernetworks.junos.junos_interface: name: ge-0/0/1 state: present active: true - name: Configure interface speed, mtu, duplex junipernetworks.junos.junos_interface: name: ge-0/0/1 state: present speed: 1g mtu: 256 duplex: full - name: Create interface using aggregate junipernetworks.junos.junos_interface: aggregate: - name: ge-0/0/1 description: test-interface-1 - name: ge-0/0/2 description: test-interface-2 speed: 1g duplex: full mtu: 512 - name: Delete interface using aggregate junipernetworks.junos.junos_interface: aggregate: - name: ge-0/0/1 - name: ge-0/0/2 state: absent - name: Check intent arguments junipernetworks.junos.junos_interface: name: '{{ name }}' state: up tx_rate: ge(0) rx_rate: le(0) - name: Check neighbor intent junipernetworks.junos.junos_interface: name: xe-0/1/1 neighbors: - port: Ethernet1/0/1 host: netdev - name: Config + intent junipernetworks.junos.junos_interface: name: '{{ name }}' enabled: false state: down ``` 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 | | --- | --- | --- | | **diff.prepared** string | when configuration is changed and diff option is enabled. | Configuration difference before and after applying change. **Sample:** [edit interfaces] + ge-0/0/1 { + description test-interface; + } | Status ------ * This module will be removed in a major release after 2022-06-01. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Ganesh Nalawade (@ganeshrn) ansible junipernetworks.junos.junos_scp – Transfer files from or to remote devices running Junos junipernetworks.junos.junos\_scp – Transfer files from or to remote devices running Junos ========================================================================================= Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_scp`. New in version 1.0.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module transfers files via SCP from or to remote devices running Junos. 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. * junos-eznc * ncclient (>=v0.5.2) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **dest** path | **Default:**"." | The `dest` argument specifies the path in which to receive the files. | | **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli` or `connection: netconf`. For more information please see the [Junos OS Platform Options guide](../network/user_guide/platform_junos). A dict object containing connection details. | | | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. | | | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. | | | **port** integer | | Specifies the port to use when building the connection to the remote device. The port value will default to the well known SSH port of 22 (for `transport=cli`) or port 830 (for `transport=netconf`) device. | | | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. | | | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. | | | **transport** string | **Choices:*** cli * **netconf** ← | Configures the transport connection to use when connecting to the remote device. | | | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. | | **recursive** boolean | **Choices:*** **no** ← * yes | The `recursive` argument enables recursive transfer of files and directories. | | **remote\_src** boolean | **Choices:*** **no** ← * yes | The `remote_src` argument enables the download of files (*scp get*) from the remote device. The default behavior is to upload files (*scp put*) to the remote device. | | **src** list / elements=path / required | | The `src` argument takes a single path, or a list of paths to be transferred. The argument `recursive` must be `true` to transfer directories. | | **ssh\_config** path | | The `ssh_config` argument is path to the SSH configuration file. This can be used to load SSH information from a configuration file. If this option is not given by default ~/.ssh/config is queried. | | **ssh\_private\_key\_file** path | | The `ssh_private_key_file` argument is path to the SSH private key file. This can be used if you need to provide a private key rather than loading the key into the ssh-key-ring/environment | Notes ----- Note * This module requires the netconf system service be enabled on the remote device being managed. * Tested against vMX JUNOS version 17.3R1.10. * Works with `local` connections only. * Since this module uses junos-eznc to establish connection with junos device the netconf configuration parameters needs to be passed using module options for example `ssh_config` unlike other junos modules that uses `netconf` connection type. * For information on using CLI and netconf see the [Junos OS Platform Options guide](../../../network/user_guide/platform_junos#junos-platform-options) * For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide) * For more information on using Ansible to manage Juniper network devices see <https://www.ansible.com/ansible-juniper>. Examples -------- ``` # the required set of connection arguments have been purposely left off # the examples for brevity - name: upload local file to home directory on remote device junipernetworks.junos.junos_scp: src: test.tgz - name: upload local file to tmp directory on remote device junipernetworks.junos.junos_scp: src: test.tgz dest: /tmp/ - name: download file from remote device junipernetworks.junos.junos_scp: src: test.tgz remote_src: true - name: ssh config file path for jumphost config junipernetworks.junos.junos_scp: src: test.tgz remote_src: true ssh_config: /home/user/customsshconfig ``` 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 | always true | ### Authors * Christian Giese (@GIC-de) ansible junipernetworks.junos.junos_lldp_interfaces – LLDP interfaces resource module junipernetworks.junos.junos\_lldp\_interfaces – LLDP interfaces resource module =============================================================================== Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_lldp_interfaces`. New in version 1.0.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Parameters](#parameters) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module manages link layer discovery protocol (LLDP) attributes of interfaces on Juniper JUNOS devices. Note This module has a corresponding [action plugin](../../../plugins/action#action-plugins). Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **config** list / elements=dictionary | | The list of link layer discovery protocol interface attribute configurations | | | **enabled** boolean | **Choices:*** no * yes | This is a boolean value to control disabling of LLDP on the interface `name` | | | **name** string / required | | Name of the interface LLDP needs to be configured on. | | **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the Junos device by executing the command **show protocols lldp**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result | | **state** string | **Choices:*** **merged** ← * replaced * overridden * deleted * gathered * rendered * parsed | The state of the configuration after module completion. | Examples -------- ``` # Using merged # Before state: # ------------- # user@junos01# # show protocols lldp # management-address 10.1.1.1; # advertisement-interval 10000; - name: Merge provided configuration with device configuration junipernetworks.junos.junos_lldp_interfaces: config: - name: ge-0/0/1 - name: ge-0/0/2 enabled: false state: merged # After state: # ------------- # user@junos01# show protocols lldp # management-address 10.1.1.1; # advertisement-interval 10000; # interface ge-0/0/1; # interface ge-0/0/2 { # disable; # } # Using replaced # Before state: # ------------- # user@junos01# show protocols lldp # management-address 10.1.1.1; # advertisement-interval 10000; # interface ge-0/0/1; # interface ge-0/0/2 { # disable; # } - name: Replace provided configuration with device configuration junipernetworks.junos.junos_lldp_interfaces: config: - name: ge-0/0/2 disable: false - name: ge-0/0/3 enabled: false state: replaced # After state: # ------------- # user@junos01# show protocols lldp # management-address 10.1.1.1; # advertisement-interval 10000; # interface ge-0/0/1; # interface ge-0/0/2; # interface ge-0/0/3 { # disable; # } # Using overridden # Before state: # ------------- # user@junos01# show protocols lldp # management-address 10.1.1.1; # advertisement-interval 10000; # interface ge-0/0/1; # interface ge-0/0/2 { # disable; # } - name: Override provided configuration with device configuration junipernetworks.junos.junos_lldp_interfaces: config: - name: ge-0/0/2 enabled: false state: overridden # After state: # ------------- # user@junos01# show protocols lldp # management-address 10.1.1.1; # advertisement-interval 10000; # interface ge-0/0/2 { # disable; # } # Using deleted # Before state: # ------------- # user@junos01# show protocols lldp # management-address 10.1.1.1; # advertisement-interval 10000; # interface ge-0/0/1; # interface ge-0/0/2; # interface ge-0/0/3 { # disable; # } - name: Delete lldp interface configuration (this will not delete other lldp configuration) junipernetworks.junos.junos_lldp_interfaces: config: - name: ge-0/0/1 - name: ge-0/0/3 state: deleted # After state: # ------------- # user@junos01# show protocols lldp # management-address 10.1.1.1; # advertisement-interval 10000; # interface ge-0/0/2; # interface ge-0/0/1; # Using gathered # Before state: # ------------ # #ansible@cm123456tr21# show protocols lldp # interface ge-0/0/1; # interface ge-0/0/2 { # disable; # } - name: Gather junos lldp interfaces as in given arguments junipernetworks.junos.junos_lldp_interfaces: state: gathered # Task Output (redacted) # ----------------------- # # "gathered": [ # { # "name": "ge-0/0/1" # }, # { # "enabled": false, # "name": "ge-0/0/2" # } # ] # After state: # ------------ # #ansible@cm123456tr21# show protocols lldp # interface ge-0/0/1; # interface ge-0/0/2 { # disable; # } # Using rendered - name: Render platform specific xml from task input using rendered state junipernetworks.junos.junos_lldp_interfaces: config: - name: ge-0/0/1 - name: ge-0/0/2 enabled: false state: rendered # Task Output (redacted) # ----------------------- # "rendered": "<nc:protocols # xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> # <nc:lldp> # <nc:interface> # <nc:name>ge-0/0/1</nc:name> # <nc:disable delete="delete"/> # </nc:interface> # <nc:interface> # <nc:name>ge-0/0/2</nc:name> # <nc:disable/> # </nc:interface> # </nc:lldp> # </nc:protocols>" # Using parsed # parsed.cfg # ------------ # # <?xml version="1.0" encoding="UTF-8"?> # <rpc-reply message-id="urn:uuid:0cadb4e8-5bba-47f4-986e-72906227007f"> # <configuration changed-seconds="1590139550" changed-localtime="2020-05-22 09:25:50 UTC"> # <protocols> # <ospf> # <area> # <name>0.0.0.0</name> # <interface> # <name>ge-0/0/0.0</name> # </interface> # </area> # </ospf> # <lldp> # <interface> # <name>ge-0/0/1</name> # </interface> # <interface> # <name>ge-0/0/2</name> # <disable/> # </interface> # </lldp> # </protocols> # </configuration> # </rpc-reply> # - name: Convert lldp interfaces config to argspec without connecting to the appliance # junipernetworks.junos.junos_lldp_interfaces: # running_config: "{{ lookup('file', './parsed.cfg') }}" # state: parsed # Task Output (redacted) # ----------------------- # "parsed": [ # { # "name": "ge-0/0/1" # }, # { # "enabled": false, # "name": "ge-0/0/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 | | --- | --- | --- | | **after** list / elements=string | when changed | The configuration as structured data after module completion. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **before** list / elements=string | always | The configuration as structured data prior to module invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['<nc:protocols xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:lldp> <nc:interface> <nc:name>ge-0/0/1</nc:name> <nc:disable delete="delete"/> </nc:interface> <nc:interface> <nc:name>ge-0/0/2</nc:name> <nc:disable/> </nc:interface> </nc:lldp> </nc:protocols>', 'xml 2', 'xml 3'] | ### Authors * Ganesh Nalawade (@ganeshrn)
programming_docs
ansible junipernetworks.junos.junos – Use junos netconf plugin to run netconf commands on Juniper JUNOS platform junipernetworks.junos.junos – Use junos netconf plugin to run netconf commands on Juniper JUNOS platform ======================================================================================================== Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos`. New in version 1.0.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Parameters](#parameters) Synopsis -------- * This junos plugin provides low level abstraction apis for sending and receiving netconf commands from Juniper JUNOS network devices. Parameters ---------- | Parameter | Choices/Defaults | Configuration | Comments | | --- | --- | --- | --- | | **ncclient\_device\_handler** string | **Default:**"junos" | | Specifies the ncclient device handler name for Juniper junos network os. To identify the ncclient device handler name refer ncclient library documentation. | ### Authors * Ansible Networking Team ansible junipernetworks.junos.junos_lldp_global – LLDP resource module junipernetworks.junos.junos\_lldp\_global – LLDP resource module ================================================================ Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_lldp_global`. New in version 1.0.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module manages link layer discovery protocol (LLDP) attributes on Juniper JUNOS devices. 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. * ncclient (>=v0.6.4) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **config** dictionary | | The list of link layer discovery protocol attribute configurations | | | **address** string | | This argument sets the management address from LLDP. | | | **enabled** boolean | **Choices:*** no * yes | This argument is a boolean value to enabled or disable LLDP. | | | **hold\_multiplier** integer | | Specify the number of seconds that LLDP information is held before it is discarded. The multiplier value is used in combination with the `interval` value. | | | **interval** integer | | Frequency at which LLDP advertisements are sent (in seconds). | | | **transmit\_delay** integer | | Specify the number of seconds the device waits before sending advertisements to neighbors after a change is made in local system. | | **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the Junos device by executing the command **show protocols lldp**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result | | **state** string | **Choices:*** **merged** ← * replaced * deleted * gathered * rendered * parsed | The state of the configuration after module completion. | Notes ----- Note * This module requires the netconf system service be enabled on the remote device being managed. * Tested against vSRX JUNOS version 18.4R1. * This module works with connection `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). Examples -------- ``` # Using merged # Before state: # ------------- # user@junos01# # show protocols lldp # - name: Merge provided configuration with device configuration junipernetworks.junos.junos_lldp_global: config: interval: 10000 address: 10.1.1.1 transmit_delay: 400 hold_multiplier: 10 state: merged # After state: # ------------- # user@junos01# show protocols lldp # management-address 10.1.1.1; # advertisement-interval 10000; # transmit-delay 400; # hold-multiplier 10; # Using replaced # Before state: # ------------- # user@junos01# show protocols lldp # management-address 10.1.1.1; # advertisement-interval 10000; # transmit-delay 400; # hold-multiplier 10; - name: Replace provided configuration with device configuration junipernetworks.junos.junos_lldp_global: config: address: 20.2.2.2 hold_multiplier: 30 enabled: false state: replaced # After state: # ------------- # user@junos01# show protocols lldp # disable; # management-address 20.2.2.2; # hold-multiplier 30; # Using deleted # Before state: # ------------- # user@junos01# show protocols lldp # management-address 20.2.2.2; # hold-multiplier 30; - name: Delete lldp configuration (this will by default remove all lldp configuration) junipernetworks.junos.junos_lldp_global: state: deleted # After state: # ------------- # user@junos01# # show protocols lldp # # # Using gathered # Before state: # ------------ # # ansible@cm123456tr21# show protocols lldp # management-address 10.1.1.1; # advertisement-interval 10000; # transmit-delay 400; # hold-multiplier 10; # interface ge-0/0/1; # interface ge-0/0/2 { # disable; # } - name: Gather junos lldp_global as in given arguments junipernetworks.junos.junos_lldp_global: state: gathered # Task Output (redacted) # ----------------------- # # "gathered": { # "address": "10.1.1.1", # "hold_multiplier": 10, # "interval": 10000, # "transmit_delay": 400 # } # After state: # ------------ # # ansible@cm123456tr21# show protocols lldp # management-address 10.1.1.1; # advertisement-interval 10000; # transmit-delay 400; # hold-multiplier 10; # interface ge-0/0/1; # interface ge-0/0/2 { # disable; # } # Using rendered - name: Render platform specific xml from task input using rendered state junipernetworks.junos.junos_lldp_global: config: interval: 10000 address: 10.1.1.1 transmit_delay: 400 hold_multiplier: 10 state: rendered # Task Output (redacted) # ----------------------- # "rendered": "<nc:protocols # xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> # <nc:lldp> # <nc:management-address>10.1.1.1</nc:management-address> # <nc:advertisement-interval>10000</nc:advertisement-interval> # <nc:transmit-delay>400</nc:transmit-delay> # <nc:hold-multiplier>10</nc:hold-multiplier> # <nc:disable delete="delete"/> # </nc:lldp> # </nc:protocols>" # # parsed.cfg # ------------ # # <?xml version="1.0" encoding="UTF-8"?> # <rpc-reply message-id="urn:uuid:0cadb4e8-5bba-47f4-986e-72906227007f"> # <configuration changed-seconds="1590139550" changed-localtime="2020-05-22 09:25:50 UTC"> # <protocols> # <ospf> # <area> # <name>0.0.0.0</name> # <interface> # <name>ge-0/0/0.0</name> # </interface> # </area> # </ospf> # <lldp> # <management-address>10.1.1.1</management-address> # <advertisement-interval>10000</advertisement-interval> # <transmit-delay>400</transmit-delay> # <hold-multiplier>10</hold-multiplier> # <interface> # <name>ge-0/0/1</name> # </interface> # <interface> # <name>ge-0/0/2</name> # <disable/> # </interface> # </lldp> # </protocols> # </configuration> # </rpc-reply> # - name: Convert lldp global config to argspec without connecting to the appliance # junipernetworks.junos.junos_lldp_global: # running_config: "{{ lookup('file', './parsed.cfg') }}" # state: parsed # Task Output (redacted) # ----------------------- # "parsed": { # "address": "10.1.1.1", # "hold_multiplier": 10, # "interval": 10000, # "transmit_delay": 400 # } ``` 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 | | --- | --- | --- | | **after** dictionary | when changed | The configuration as structured data after module completion. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **before** dictionary | always | The configuration as structured data prior to module invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['<nc:protocols xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:lldp> <nc:management-address>10.1.1.1</nc:management-address> <nc:advertisement-interval>10000</nc:advertisement-interval> <nc:transmit-delay>400</nc:transmit-delay> <nc:hold-multiplier>10</nc:hold-multiplier> <nc:disable delete="delete"/> </nc:lldp> </nc:protocols>', 'xml 2', 'xml 3'] | ### Authors * Ganesh Nalawade (@ganeshrn) ansible junipernetworks.junos.junos_facts – Collect facts from remote devices running Juniper Junos junipernetworks.junos.junos\_facts – Collect facts from remote devices running Juniper Junos ============================================================================================ Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_facts`. New in version 1.0.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) Synopsis -------- * Collects fact information from a remote device running the Junos operating system. By default, the module will collect basic fact information from the device to be included with the hostvars. Additional fact information can be collected based on the configured set of arguments. 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. * ncclient (>=v0.5.2) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **available\_network\_resources** boolean | **Choices:*** **no** ← * yes | When 'True' a list of network resources for which resource modules are available will be provided. | | **config\_format** string | **Choices:*** xml * **text** ← * set * json | The *config\_format* argument specifies the format of the configuration when serializing output from the device. This argument is applicable only when `config` value is present in *gather\_subset*. The *config\_format* should be supported by the junos version running on device. This value is not applicable while fetching old style facts that is when `ofacts` value is present in value if *gather\_subset* value. This option is valid only for `gather_subset` values. | | **gather\_network\_resources** list / elements=string | | When supplied, this argument will restrict the facts collected to a given subset. Possible values for this argument include all and the resources like interfaces, vlans etc. Can specify a list of values to include a larger subset. Values can also be used with an initial `!` to specify that a specific subset should not be collected. Valid subsets are 'all', 'interfaces', 'lacp', 'lacp\_interfaces', 'lag\_interfaces', 'l2\_interfaces', 'l3\_interfaces', 'lldp\_global', 'lldp\_interfaces', 'vlans'. | | **gather\_subset** list / elements=string | **Default:**["!config"] | When supplied, this argument will restrict the facts collected to a given subset. Possible values for this argument include all, hardware, config, and interfaces. Can specify a list of values to include a larger subset. Values can also be used with an initial `!` to specify that a specific subset should not be collected. To maintain backward compatibility old style facts can be retrieved by explicitly adding `ofacts` to value, this requires junos-eznc to be installed as a prerequisite. Valid value of gather\_subset are default, hardware, config, interfaces, ofacts. If `ofacts` is present in the list it fetches the old style facts (fact keys without 'ansible\_' prefix) and it requires junos-eznc library to be installed on control node and the device login credentials must be given in `provider` option. | | **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli` or `connection: netconf`. For more information please see the [Junos OS Platform Options guide](../network/user_guide/platform_junos). A dict object containing connection details. | | | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. | | | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. | | | **port** integer | | Specifies the port to use when building the connection to the remote device. The port value will default to the well known SSH port of 22 (for `transport=cli`) or port 830 (for `transport=netconf`) device. | | | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. | | | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. | | | **transport** string | **Choices:*** cli * **netconf** ← | Configures the transport connection to use when connecting to the remote device. | | | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. | Notes ----- Note * Ensure *config\_format* used to retrieve configuration from device is supported by junos version running on device. * With *config\_format = json*, configuration in the results will be a dictionary(and not a JSON string) * This module requires the netconf system service be enabled on the remote device being managed. * Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. * Recommended connection is `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). * This module also works with `local` connections for legacy playbooks. * Fetching old style facts requires junos-eznc library to be installed on control node and the device login credentials must be given in provider option. * For information on using CLI and netconf see the [Junos OS Platform Options guide](../../../network/user_guide/platform_junos#junos-platform-options) * For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide) * For more information on using Ansible to manage Juniper network devices see <https://www.ansible.com/ansible-juniper>. Examples -------- ``` - name: collect default set of facts junipernetworks.junos.junos_facts: - name: collect default set of facts and configuration junipernetworks.junos.junos_facts: gather_subset: config - name: Gather legacy and resource facts junipernetworks.junos.junos_facts: gather_subset: all gather_network_resources: all ``` ### Authors * Nathaniel Case (@Qalthos) ansible junipernetworks.junos.junos_lacp_interfaces – LACP interfaces resource module junipernetworks.junos.junos\_lacp\_interfaces – LACP interfaces resource module =============================================================================== Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_lacp_interfaces`. New in version 1.0.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Parameters](#parameters) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module manages Link Aggregation Control Protocol (LACP) attributes of interfaces on Juniper JUNOS devices. Note This module has a corresponding [action plugin](../../../plugins/action#action-plugins). Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **config** list / elements=dictionary | | The list of dictionaries of LACP interfaces options. | | | **force\_up** boolean | **Choices:*** no * yes | This is a boolean argument to control if the port should be up in absence of received link Aggregation Control Protocol Data Unit (LACPDUS). This value is applicable for member interfaces only. | | | **name** string | | Name Identifier of the interface or link aggregation group. | | | **period** string | **Choices:*** fast * slow | Timer interval for periodic transmission of LACP packets. If the value is set to `fast` the packets are received every second and if the value is `slow` the packets are received every 30 seconds. This value is applicable for aggregate interface only. | | | **port\_priority** integer | | Priority of the member port. This value is applicable for member interfaces only. Refer to vendor documentation for valid values. | | | **sync\_reset** string | **Choices:*** disable * enable | The argument notifies minimum-link failure out of sync to peer. If the value is `disable` it disables minimum-link failure handling at LACP level and if value is `enable` it enables minimum-link failure handling at LACP level. This value is applicable for aggregate interface only. | | | **system** dictionary | | This dict object contains configurable options related to LACP system parameters for the link aggregation group. This value is applicable for aggregate interface only. | | | | **mac** dictionary | | Specifies the system ID to use in LACP negotiations for the bundle, encoded as a MAC address. | | | | | **address** string | | The system ID to use in LACP negotiations. | | | | **priority** integer | | Specifies the system priority to use in LACP negotiations for the bundle. Refer to vendor documentation for valid values. | | **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the Junos device by executing the command **show interface**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result. | | **state** string | **Choices:*** **merged** ← * replaced * overridden * deleted * gathered * parsed * rendered | The state of the configuration after module completion. | Examples -------- ``` # Using merged # Before state: # ------------- # user@junos01# show interfaces # ge-0/0/2 { # ether-options { # 802.3ad ae4; # } # } # ge-0/0/3 { # ether-options { # 802.3ad ae0; # } # } # ae0 { # description "lag interface merged"; # aggregated-ether-options { # lacp { # passive; # } # } # } # ae4 { # description "test aggregate interface"; # aggregated-ether-options { # lacp { # passive; # link-protection; # } # } # } - name: Merge provided configuration with device configuration junipernetworks.junos.junos_lacp_interfaces: config: - name: ae0 period: fast sync_reset: enable system: priority: 100 mac: address: 00:00:00:00:00:02 - name: ge-0/0/3 port_priority: 100 force_up: true state: merged # After state: # ------------- # user@junos01# show interfaces # ge-0/0/2 { # ether-options { # 802.3ad ae4; # } # } # ge-0/0/3 { # ether-options { # 802.3ad { # lacp { # force-up; # port-priority 100; # } # ae0; # } # } # } # ae0 { # description "lag interface merged"; # aggregated-ether-options { # lacp { # passive; # periodic fast; # sync-reset enable; # system-priority 100; # system-id 00:00:00:00:00:02; # } # } # } # ae4 { # description "test aggregate interface"; # aggregated-ether-options { # lacp { # passive; # link-protection; # } # } # } # Using replaced # Before state: # ------------- # user@junos01# show interfaces # ge-0/0/2 { # ether-options { # 802.3ad ae4; # } # } # ge-0/0/3 { # ether-options { # 802.3ad { # lacp { # force-up; # port-priority 100; # } # ae0; # } # } # } # ae0 { # description "lag interface merged"; # aggregated-ether-options { # lacp { # passive; # periodic fast; # sync-reset enable; # system-priority 100; # system-id 00:00:00:00:00:02; # } # } # } # ae4 { # description "test aggregate interface"; # aggregated-ether-options { # lacp { # passive; # link-protection; # } # } # } - name: Replace device LACP interfaces configuration with provided configuration junipernetworks.junos.junos_lacp_interfaces: config: - name: ae0 period: slow state: replaced # After state: # ------------- # user@junos01# show interfaces # ge-0/0/2 { # ether-options { # 802.3ad ae4; # } # } # ge-0/0/3 { # ether-options { # 802.3ad { # lacp { # force-up; # port-priority 100; # } # ae0; # } # } # } # ae0 { # description "lag interface merged"; # aggregated-ether-options { # lacp { # passive; # periodic slow; # } # } # } # ae4 { # description "test aggregate interface"; # aggregated-ether-options { # lacp { # passive; # link-protection; # } # } # } # Using overridden # Before state: # ------------- # user@junos01# show interfaces # ge-0/0/2 { # ether-options { # 802.3ad ae4; # } # } # ge-0/0/3 { # ether-options { # 802.3ad { # lacp { # force-up; # port-priority 100; # } # ae0; # } # } # } # ae0 { # description "lag interface merged"; # aggregated-ether-options { # lacp { # passive; # periodic slow; # } # } # } # ae4 { # description "test aggregate interface"; # aggregated-ether-options { # lacp { # passive; # link-protection; # } # } # } - name: Overrides all device LACP interfaces configuration with provided configuration junipernetworks.junos.junos_lacp_interfaces: config: - name: ae0 system: priority: 300 mac: address: 00:00:00:00:00:03 - name: ge-0/0/2 port_priority: 200 force_up: false state: overridden # After state: # ------------- # user@junos01# show interfaces # ge-0/0/2 { # ether-options { # 802.3ad { # lacp { # port-priority 200; # } # ae4; # } # } # } # ge-0/0/3 { # ether-options { # 802.3ad { # lacp { # force-up; # port-priority 100; # } # ae0; # } # } # } # ae0 { # description "lag interface merged"; # aggregated-ether-options { # lacp { # passive; # system-priority 300; # system-id 00:00:00:00:00:03; # } # } # } # ae4 { # description "test aggregate interface"; # aggregated-ether-options { # lacp { # passive; # link-protection; # } # } # } # Using deleted # Before state: # ------------- # user@junos01# show interfaces # ge-0/0/2 { # ether-options { # 802.3ad { # lacp { # port-priority 200; # } # ae4; # } # } # } # ge-0/0/3 { # ether-options { # 802.3ad { # lacp { # force-up; # port-priority 100; # } # ae0; # } # } # } # ae0 { # description "lag interface merged"; # aggregated-ether-options { # lacp { # passive; # system-priority 300; # system-id 00:00:00:00:00:03; # } # } # } # ae4 { # description "test aggregate interface"; # aggregated-ether-options { # lacp { # passive; # link-protection; # } # } # } - name: "Delete LACP interfaces attributes of given interfaces (Note: This won't delete the interface itself)" junipernetworks.junos.junos_lacp_interfaces: config: - name: ae0 - name: ge-0/0/3 - name: ge-0/0/2 state: deleted # After state: # ------------- # user@junos01# show interfaces # ge-0/0/2 { # ether-options { # 802.3ad ae4; # } # } # ge-0/0/3 { # ether-options { # 802.3ad ae0; # } # } # ae0 { # description "lag interface merged"; # aggregated-ether-options { # lacp { # passive; # } # } # } # ae4 { # description "test aggregate interface"; # aggregated-ether-options { # lacp { # passive; # link-protection; # } # } # } # Using gathered # Before state: # ------------ # # user@junos01# show interfaces # ansible@cm123456tr21# show interfaces # ge-0/0/1 { # ether-options { # 802.3ad { # lacp { # force-up; # port-priority 100; # } # ae1; # } # } # } # ge-0/0/2 { # ether-options { # 802.3ad ae1; # } # } # ge-0/0/3 { # ether-options { # 802.3ad ae2; # } # } # ge-0/0/4 { # ether-options { # 802.3ad ae2; # } # } # ge-1/0/0 { # unit 0 { # family inet { # address 192.168.100.1/24; # address 10.200.16.20/24; # } # family inet6; # } # } # ge-2/0/0 { # unit 0 { # family inet { # address 192.168.100.2/24; # address 10.200.16.21/24; # } # family inet6; # } # } # ge-3/0/0 { # unit 0 { # family inet { # address 192.168.100.3/24; # address 10.200.16.22/24; # } # family inet6; # } # } # ae1 { # description "Configured by Ansible"; # aggregated-ether-options { # lacp { # periodic fast; # sync-reset enable; # system-priority 100; # system-id 00:00:00:00:00:02; # } # } # } # ae2 { # description "Configured by Ansible"; # } # em1 { # description TEST; # } # fxp0 { # description ANSIBLE; # speed 1g; # link-mode automatic; # unit 0 { # family inet { # address 10.8.38.38/24; # } # } # } - name: Gather junos lacp interfaces as in given arguments junipernetworks.junos.junos_lacp_interfaces: state: gathered # Task Output (redacted) # ----------------------- # # "gathered": [ # { # "force_up": true, # "name": "ge-0/0/1", # "port_priority": 100 # }, # { # "name": "ae1", # "period": "fast", # "sync_reset": "enable", # "system": { # "mac": { # "address": "00:00:00:00:00:02" # }, # "priority": 100 # } # } # ] # After state: # ------------ # # ansible@cm123456tr21# show interfaces # ge-0/0/1 { # ether-options { # 802.3ad { # lacp { # force-up; # port-priority 100; # } # ae1; # } # } # } # ge-0/0/2 { # ether-options { # 802.3ad ae1; # } # } # ge-0/0/3 { # ether-options { # 802.3ad ae2; # } # } # ge-0/0/4 { # ether-options { # 802.3ad ae2; # } # } # ge-1/0/0 { # unit 0 { # family inet { # address 192.168.100.1/24; # address 10.200.16.20/24; # } # family inet6; # } # } # ge-2/0/0 { # unit 0 { # family inet { # address 192.168.100.2/24; # address 10.200.16.21/24; # } # family inet6; # } # } # ge-3/0/0 { # unit 0 { # family inet { # address 192.168.100.3/24; # address 10.200.16.22/24; # } # family inet6; # } # } # ae1 { # description "Configured by Ansible"; # aggregated-ether-options { # lacp { # periodic fast; # sync-reset enable; # system-priority 100; # system-id 00:00:00:00:00:02; # } # } # } # ae2 { # description "Configured by Ansible"; # } # em1 { # description TEST; # } # fxp0 { # description ANSIBLE; # speed 1g; # link-mode automatic; # unit 0 { # family inet { # address 10.8.38.38/24; # } # } # } # Using parsed # parsed.cfg # ------------ # # <?xml version="1.0" encoding="UTF-8"?> # <rpc-reply message-id="urn:uuid:0cadb4e8-5bba-47f4-986e-72906227007f"> # <configuration changed-seconds="1590139550" changed-localtime="2020-05-22 09:25:50 UTC"> # <interfaces> # <interface> # <name>ge-0/0/1</name> # <ether-options> # <ieee-802.3ad> # <lacp> # <force-up/> # <port-priority>100</port-priority> # </lacp> # <bundle>ae1</bundle> # </ieee-802.3ad> # </ether-options> # </interface> # <interface> # <name>ge-0/0/2</name> # <ether-options> # <ieee-802.3ad> # <bundle>ae1</bundle> # </ieee-802.3ad> # </ether-options> # </interface> # <interface> # <name>ge-0/0/3</name> # <ether-options> # <ieee-802.3ad> # <bundle>ae2</bundle> # </ieee-802.3ad> # </ether-options> # </interface> # <interface> # <name>ge-0/0/4</name> # <ether-options> # <ieee-802.3ad> # <bundle>ae2</bundle> # </ieee-802.3ad> # </ether-options> # </interface> # <interface> # <name>ge-1/0/0</name> # <unit> # <name>0</name> # <family> # <inet> # <address> # <name>192.168.100.1/24</name> # </address> # <address> # <name>10.200.16.20/24</name> # </address> # </inet> # <inet6> # </inet6> # </family> # </unit> # </interface> # <interface> # <name>ge-2/0/0</name> # <unit> # <name>0</name> # <family> # <inet> # <address> # <name>192.168.100.2/24</name> # </address> # <address> # <name>10.200.16.21/24</name> # </address> # </inet> # <inet6> # </inet6> # </family> # </unit> # </interface> # <interface> # <name>ge-3/0/0</name> # <unit> # <name>0</name> # <family> # <inet> # <address> # <name>192.168.100.3/24</name> # </address> # <address> # <name>10.200.16.22/24</name> # </address> # </inet> # <inet6> # </inet6> # </family> # </unit> # </interface> # <interface> # <name>ae1</name> # <description>Configured by Ansible</description> # <aggregated-ether-options> # <lacp> # <periodic>fast</periodic> # <sync-reset>enable</sync-reset> # <system-priority>100</system-priority> # <system-id>00:00:00:00:00:02</system-id> # </lacp> # </aggregated-ether-options> # </interface> # <interface> # <name>ae2</name> # <description>Configured by Ansible</description> # </interface> # <interface> # <name>em1</name> # <description>TEST</description> # </interface> # <interface> # <name>fxp0</name> # <description>ANSIBLE</description> # <speed>1g</speed> # <link-mode>automatic</link-mode> # <unit> # <name>0</name> # <family> # <inet> # <address> # <name>10.8.38.38/24</name> # </address> # </inet> # </family> # </unit> # </interface> # </interfaces> # </configuration> # </rpc-reply> # - name: Convert interfaces config to argspec without connecting to the appliance # junipernetworks.junos.junos_lacp_interfaces: # running_config: "{{ lookup('file', './parsed.cfg') }}" # state: parsed # Task Output (redacted) # ----------------------- # "parsed": [ # { # "force_up": true, # "name": "ge-0/0/1", # "port_priority": 100 # }, # { # "name": "ae1", # "period": "fast", # "sync_reset": "enable", # "system": { # "mac": { # "address": "00:00:00:00:00:02" # }, # "priority": 100 # } # } # ] # Using rendered - name: Render platform specific xml from task input using rendered state junipernetworks.junos.junos_lacp_interfaces: config: - name: ae1 period: fast sync_reset: enable system: priority: 100 mac: address: 00:00:00:00:00:02 - name: ge-0/0/1 port_priority: 100 force_up: true state: rendered # Task Output (redacted) # ----------------------- # "rendered": "<nc:interfaces # xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> # <nc:interface> # <nc:name>ae1</nc:name> # <nc:aggregated-ether-options> # <nc:lacp> # <nc:periodic>fast</nc:periodic> # <nc:sync-reset>enable</nc:sync-reset> # <nc:system-id>00:00:00:00:00:02</nc:system-id> # <nc:system-priority>100</nc:system-priority> # </nc:lacp> # </nc:aggregated-ether-options> # </nc:interface> # <nc:interface> # <nc:name>ge-0/0/1</nc:name> # <nc:ether-options> # <nc:ieee-802.3ad> # <nc:lacp> # <nc:port-priority>100</nc:port-priority> # <nc:force-up/> # </nc:lacp> # </nc:ieee-802.3ad> # </nc:ether-options> # </nc:interface> # </nc:interfaces>" ``` 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 | | --- | --- | --- | | **after** list / elements=string | when changed | The configuration as structured data after module completion. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **before** list / elements=string | always | The configuration as structured data prior to module invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['<nc:interfaces xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:interface> <nc:name>ae1</nc:name> <nc:aggregated-ether-options> <nc:lacp> <nc:periodic>fast</nc:periodic> <nc:sync-reset>enable</nc:sync-reset> <nc:system-id>00:00:00:00:00:02</nc:system-id> <nc:system-priority>100</nc:system-priority> </nc:lacp> </nc:aggregated-ether-options> </nc:interface> <nc:interface> <nc:name>ge-0/0/1</nc:name> <nc:ether-options> <nc:ieee-802.3ad> <nc:lacp> <nc:port-priority>100</nc:port-priority> <nc:force-up/> </nc:lacp> </nc:ieee-802.3ad> </nc:ether-options> </nc:interface> </nc:interfaces>', 'xml 2', 'xml 3'] | ### Authors * Ganesh Nalawade (@ganeshrn)
programming_docs
ansible junipernetworks.junos.junos_acls – ACLs resource module junipernetworks.junos.junos\_acls – ACLs resource module ======================================================== Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_acls`. New in version 1.0.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module provides declarative management of acls/filters on Juniper JUNOS devices 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. * ncclient (>=v0.6.4) * xmltodict (>=0.12.0) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **config** list / elements=dictionary | | A dictionary of acls options | | | **acls** list / elements=dictionary | | List of Access Control Lists (ACLs). | | | | **aces** list / elements=dictionary | | List of Access Control Entries (ACEs) for this Access Control List (ACL). | | | | | **destination** dictionary | | Specifies the destination for the filter | | | | | | **address** raw | | Match IP destination address | | | | | | **port\_protocol** dictionary | | Specify the destination port or protocol. | | | | | | | **eq** string | | Match only packets on a given port number. | | | | | | | **range** dictionary | | Match only packets in the range of port numbers | | | | | | | | **end** integer | | Specify the end of the port range | | | | | | | | **start** integer | | Specify the start of the port range | | | | | | **prefix\_list** list / elements=dictionary | | Match IP destination prefixes in named list | | | | | | | **name** string | | Name of the list | | | | | **grant** string | **Choices:*** permit * deny | Action to take after matching condition (allow, discard/reject) | | | | | **name** string / required | | Filter term name | | | | | **protocol** string | | Specify the protocol to match. Refer to vendor documentation for valid values. | | | | | **protocol\_options** dictionary | | All possible suboptions for the protocol chosen. | | | | | | **icmp** dictionary | | ICMP protocol options. | | | | | | | **dod\_host\_prohibited** boolean | **Choices:*** no * yes | Host prohibited | | | | | | | **dod\_net\_prohibited** boolean | **Choices:*** no * yes | Net prohibited | | | | | | | **echo** boolean | **Choices:*** no * yes | Echo (ping) | | | | | | | **echo\_reply** boolean | **Choices:*** no * yes | Echo reply | | | | | | | **host\_redirect** boolean | **Choices:*** no * yes | Host redirect | | | | | | | **host\_tos\_redirect** boolean | **Choices:*** no * yes | Host redirect for TOS | | | | | | | **host\_tos\_unreachable** boolean | **Choices:*** no * yes | Host unreachable for TOS | | | | | | | **host\_unknown** boolean | **Choices:*** no * yes | Host unknown | | | | | | | **host\_unreachable** boolean | **Choices:*** no * yes | Host unreachable | | | | | | | **net\_redirect** boolean | **Choices:*** no * yes | Network redirect | | | | | | | **net\_tos\_redirect** boolean | **Choices:*** no * yes | Net redirect for TOS | | | | | | | **network\_unknown** boolean | **Choices:*** no * yes | Network unknown | | | | | | | **port\_unreachable** boolean | **Choices:*** no * yes | Port unreachable | | | | | | | **protocol\_unreachable** boolean | **Choices:*** no * yes | Protocol unreachable | | | | | | | **reassembly\_timeout** boolean | **Choices:*** no * yes | Reassembly timeout | | | | | | | **redirect** boolean | **Choices:*** no * yes | All redirects | | | | | | | **router\_advertisement** boolean | **Choices:*** no * yes | Router discovery advertisements | | | | | | | **router\_solicitation** boolean | **Choices:*** no * yes | Router discovery solicitations | | | | | | | **source\_route\_failed** boolean | **Choices:*** no * yes | Source route failed | | | | | | | **time\_exceeded** boolean | **Choices:*** no * yes | All time exceeded. | | | | | | | **ttl\_exceeded** boolean | **Choices:*** no * yes | TTL exceeded | | | | | **source** dictionary | | Specifies the source for the filter | | | | | | **address** raw | | IP source address to use for the filter | | | | | | **port\_protocol** dictionary | | Specify the source port or protocol. | | | | | | | **eq** string | | Match only packets on a given port number. | | | | | | | **range** dictionary | | Match only packets in the range of port numbers | | | | | | | | **end** integer | | Specify the end of the port range | | | | | | | | **start** integer | | Specify the start of the port range | | | | | | **prefix\_list** list / elements=dictionary | | IP source prefix list to use for the filter | | | | | | | **name** string | | Name of the list | | | | **name** string / required | | Name to use for the acl filter | | | **afi** string / required | **Choices:*** ipv4 * ipv6 | Protocol family to use by the acl filter | | **state** string | **Choices:*** **merged** ← * replaced * overridden * deleted * gathered | The state the configuration should be left in | Notes ----- Note * This module requires the netconf system service be enabled on the device being managed. * This module works with connection `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). * Tested against JunOS v18.4R1 Examples -------- ``` # Using merged # Before state: # ------------- # # admin# show firewall - name: Merge JUNOS acl junipernetworks.junos.junos_acls: config: - afi: ipv4 acls: - name: allow_ssh_acl aces: - name: ssh_rule source: port_protocol: eq: ssh protocol: tcp state: merged # After state: # ------------- # admin# show firewall # family inet { # filter allow_ssh_acl { # term ssh_rule { # from { # protocol tcp; # source-port ssh; # } # } # } # } ``` 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 | | --- | --- | --- | | **after** list / elements=string | when changed | The resulting configuration model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **before** list / elements=string | always | The configuration prior to the model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['command 1', 'command 2', 'command 3'] | ### Authors * Daniel Mellado (@dmellado) ansible junipernetworks.junos.junos_user – Manage local user accounts on Juniper JUNOS devices junipernetworks.junos.junos\_user – Manage local user accounts on Juniper JUNOS devices ======================================================================================= Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_user`. New in version 1.0.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module manages locally configured user accounts on remote network devices running the JUNOS operating system. It provides a set of arguments for creating, removing and updating locally defined accounts 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. * ncclient (>=v0.5.2) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **active** boolean | **Choices:*** no * **yes** ← | Specifies whether or not the configuration is active or deactivated | | **aggregate** list / elements=dictionary | | The `aggregate` argument defines a list of users to be configured on the remote device. The list of users will be compared against the current users and only changes will be added or removed from the device configuration. This argument is mutually exclusive with the name argument. aliases: users, collection | | | **active** boolean | **Choices:*** no * yes | Specifies whether or not the configuration is active or deactivated | | | **encrypted\_password** string | | The `encrypted_password` argument set already hashed password for the user account on the remote system. | | | **full\_name** string | | The `full_name` argument provides the full name of the user account to be created on the remote device. This argument accepts any text string value. | | | **name** string / required | | The `name` argument defines the username of the user to be created on the system. This argument must follow appropriate usernaming conventions for the target device running JUNOS. This argument is mutually exclusive with the `aggregate` argument. | | | **purge** boolean | **Choices:*** **no** ← * yes | The `purge` argument instructs the module to consider the users definition absolute. It will remove any previously configured users on the device with the exception of the current defined set of aggregate. | | | **role** string | **Choices:*** operator * read-only * super-user * unauthorized | The `role` argument defines the role of the user account on the remote system. User accounts can have more than one role configured. | | | **sshkey** string | | The `sshkey` argument defines the public SSH key to be configured for the user account on the remote system. This argument must be a valid SSH key | | | **state** string | **Choices:*** present * absent | The `state` argument configures the state of the user definitions as it relates to the device operational configuration. When set to *present*, the user should be configured in the device active configuration and when set to *absent* the user should not be in the device active configuration | | **encrypted\_password** string | | The `encrypted_password` argument set already hashed password for the user account on the remote system. | | **full\_name** string | | The `full_name` argument provides the full name of the user account to be created on the remote device. This argument accepts any text string value. | | **name** string | | The `name` argument defines the username of the user to be created on the system. This argument must follow appropriate usernaming conventions for the target device running JUNOS. This argument is mutually exclusive with the `aggregate` argument. | | **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli` or `connection: netconf`. For more information please see the [Junos OS Platform Options guide](../network/user_guide/platform_junos). A dict object containing connection details. | | | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. | | | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. | | | **port** integer | | Specifies the port to use when building the connection to the remote device. The port value will default to the well known SSH port of 22 (for `transport=cli`) or port 830 (for `transport=netconf`) device. | | | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. | | | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. | | | **transport** string | **Choices:*** cli * **netconf** ← | Configures the transport connection to use when connecting to the remote device. | | | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. | | **purge** boolean | **Choices:*** **no** ← * yes | The `purge` argument instructs the module to consider the users definition absolute. It will remove any previously configured users on the device with the exception of the current defined set of aggregate. | | **role** string | **Choices:*** operator * read-only * super-user * unauthorized | The `role` argument defines the role of the user account on the remote system. User accounts can have more than one role configured. | | **sshkey** string | | The `sshkey` argument defines the public SSH key to be configured for the user account on the remote system. This argument must be a valid SSH key | | **state** string | **Choices:*** **present** ← * absent | The `state` argument configures the state of the user definitions as it relates to the device operational configuration. When set to *present*, the user should be configured in the device active configuration and when set to *absent* the user should not be in the device active configuration | Notes ----- Note * This module requires the netconf system service be enabled on the remote device being managed. * Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. * Recommended connection is `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). * This module also works with `local` connections for legacy playbooks. * For information on using CLI and netconf see the [Junos OS Platform Options guide](../../../network/user_guide/platform_junos#junos-platform-options) * For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide) * For more information on using Ansible to manage Juniper network devices see <https://www.ansible.com/ansible-juniper>. Examples -------- ``` - name: create new user account junipernetworks.junos.junos_user: name: ansible role: super-user sshkey: "{{ lookup('file', '~/.ssh/ansible.pub') }}" state: present - name: remove a user account junipernetworks.junos.junos_user: name: ansible state: absent - name: remove all user accounts except ansible junipernetworks.junos.junos_user: aggregate: - name: ansible purge: yes - name: set user password junipernetworks.junos.junos_user: name: ansible role: super-user encrypted_password: "{{ 'my-password' | password_hash('sha512') }}" state: present - name: Create list of users junipernetworks.junos.junos_user: aggregate: - {name: test_user1, full_name: test_user2, role: operator, state: present} - {name: test_user2, full_name: test_user2, role: read-only, state: present} - name: Delete list of users junipernetworks.junos.junos_user: aggregate: - {name: test_user1, full_name: test_user2, role: operator, state: absent} - {name: test_user2, full_name: test_user2, role: read-only, 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 | | --- | --- | --- | | **diff.prepared** string | when configuration is changed and diff option is enabled. | Configuration difference before and after applying change. **Sample:** [edit system login] + user test-user { + uid 2005; + class read-only; + } | ### Authors * Peter Sprygada (@privateip) ansible junipernetworks.junos.junos_config – Manage configuration on devices running Juniper JUNOS junipernetworks.junos.junos\_config – Manage configuration on devices running Juniper JUNOS =========================================================================================== Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_config`. New in version 1.0.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module provides an implementation for working with the active configuration running on Juniper JUNOS devices. It provides a set of arguments for loading configuration, performing rollback operations and zeroing the active configuration on the device. 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. * ncclient (>=v0.5.2) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **backup** boolean | **Choices:*** **no** ← * yes | This argument will cause the module to create a full backup of the current `running-config` from the remote device before any changes are made. If the `backup_options` value is not given, the backup file is written to the `backup` folder in the playbook root directory or role root directory, if playbook is part of an ansible role. If the directory does not exist, it is created. | | **backup\_options** dictionary | | This is a dict object containing configurable options related to backup file path. The value of this option is read only when `backup` is set to *yes*, if `backup` is set to *no* this option will be silently ignored. | | | **backup\_format** string | **Choices:*** xml * **set** ← * text * json | This argument specifies the format of the configuration the backup file will be stored as. If the argument is not specified, the module will use the 'set' format. | | | **dir\_path** path | | This option provides the path ending with directory name in which the backup configuration file will be stored. If the directory does not exist it will be first created and the filename is either the value of `filename` or default filename as described in `filename` options description. If the path value is not given in that case a *backup* directory will be created in the current working directory and backup configuration will be copied in `filename` within *backup* directory. | | | **filename** string | | The filename to be used to store the backup configuration. If the filename is not given it will be generated based on the hostname, current time and date in format defined by <hostname>\_config.<current-date>@<current-time> | | **check\_commit** boolean | **Choices:*** **no** ← * yes | This argument will check correctness of syntax; do not apply changes. Note that this argument can be used to confirm verified configuration done via commit confirmed operation | | **comment** string | **Default:**"configured by junos\_config" | The `comment` argument specifies a text string to be used when committing the configuration. If the `confirm` argument is set to False, this argument is silently ignored. | | **confirm** integer | **Default:**0 | The `confirm` argument will configure a time out value in minutes for the commit to be confirmed before it is automatically rolled back. If the `confirm` argument is set to False, this argument is silently ignored. If the value for this argument is set to 0, the commit is confirmed immediately. | | **confirm\_commit** boolean | **Choices:*** **no** ← * yes | This argument will execute commit operation on remote device. It can be used to confirm a previous commit. | | **lines** list / elements=string | | This argument takes a list of `set` or `delete` configuration lines to push into the remote device. Each line must start with either `set` or `delete`. This argument is mutually exclusive with the *src* argument. aliases: commands | | **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli` or `connection: netconf`. For more information please see the [Junos OS Platform Options guide](../network/user_guide/platform_junos). A dict object containing connection details. | | | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. | | | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. | | | **port** integer | | Specifies the port to use when building the connection to the remote device. The port value will default to the well known SSH port of 22 (for `transport=cli`) or port 830 (for `transport=netconf`) device. | | | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. | | | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. | | | **transport** string | **Choices:*** cli * **netconf** ← | Configures the transport connection to use when connecting to the remote device. | | | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. | | **replace** boolean | **Choices:*** no * yes | The `replace` argument will instruct the remote device to replace the current configuration hierarchy with the one specified in the corresponding hierarchy of the source configuration loaded from this module. Note this argument should be considered deprecated. To achieve the equivalent, set the *update* argument to `replace`. This argument will be removed in a future release. The `replace` and `update` argument is mutually exclusive. | | **rollback** integer | | The `rollback` argument instructs the module to rollback the current configuration to the identifier specified in the argument. If the specified rollback identifier does not exist on the remote device, the module will fail. To rollback to the most recent commit, set the `rollback` argument to 0. | | **src** path | | The *src* argument provides a path to the configuration file to load into the remote system. The path can either be a full system path to the configuration file if the value starts with / or relative to the root of the implemented role or playbook. This argument is mutually exclusive with the *lines* argument. | | **src\_format** string | **Choices:*** xml * set * text * json | The *src\_format* argument specifies the format of the configuration found int *src*. If the *src\_format* argument is not provided, the module will attempt to determine the format of the configuration file specified in *src*. | | **update** string | **Choices:*** **merge** ← * override * replace * update | This argument will decide how to load the configuration data particularly when the candidate configuration and loaded configuration contain conflicting statements. Following are accepted values. `merge` combines the data in the loaded configuration with the candidate configuration. If statements in the loaded configuration conflict with statements in the candidate configuration, the loaded statements replace the candidate ones. `override` discards the entire candidate configuration and replaces it with the loaded configuration. `replace` substitutes each hierarchy level in the loaded configuration for the corresponding level. `update` is similar to the override option. The new configuration completely replaces the existing configuration. The difference comes when the configuration is later committed. This option performs a 'diff' between the new candidate configuration and the existing committed configuration. It then only notifies system processes responsible for the changed portions of the configuration, and only marks the actual configuration changes as 'changed'. | | **zeroize** boolean | **Choices:*** **no** ← * yes | The `zeroize` argument is used to completely sanitize the remote device configuration back to initial defaults. This argument will effectively remove all current configuration statements on the remote device. | Notes ----- Note * This module requires the netconf system service be enabled on the remote device being managed. * Abbreviated commands are NOT idempotent, see L(Network FAQ,../network/user\_guide/faq.html * Loading JSON-formatted configuration *json* is supported starting in Junos OS Release 16.1 onwards. * Update `override` not currently compatible with `set` notation. * Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. * Recommended connection is `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). * This module also works with `local` connections for legacy playbooks. * For information on using CLI and netconf see the [Junos OS Platform Options guide](../../../network/user_guide/platform_junos#junos-platform-options) * For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide) * For more information on using Ansible to manage Juniper network devices see <https://www.ansible.com/ansible-juniper>. Examples -------- ``` - name: load configure file into device junipernetworks.junos.junos_config: src: srx.cfg comment: update config - name: load configure lines into device junipernetworks.junos.junos_config: lines: - set interfaces ge-0/0/1 unit 0 description "Test interface" - set vlans vlan01 description "Test vlan" comment: update config - name: Set routed VLAN interface (RVI) IPv4 address junipernetworks.junos.junos_config: lines: - set vlans vlan01 vlan-id 1 - set interfaces irb unit 10 family inet address 10.0.0.1/24 - set vlans vlan01 l3-interface irb.10 - name: Check correctness of commit configuration junipernetworks.junos.junos_config: check_commit: yes - name: rollback the configuration to id 10 junipernetworks.junos.junos_config: rollback: 10 - name: zero out the current configuration junipernetworks.junos.junos_config: zeroize: yes - name: Set VLAN access and trunking junipernetworks.junos.junos_config: lines: - set vlans vlan02 vlan-id 6 - set interfaces ge-0/0/6.0 family ethernet-switching interface-mode access vlan members vlan02 - set interfaces ge-0/0/6.0 family ethernet-switching interface-mode trunk vlan members vlan02 - name: confirm a previous commit junipernetworks.junos.junos_config: confirm_commit: yes - name: for idempotency, use full-form commands junipernetworks.junos.junos_config: lines: # - set int ge-0/0/1 unit 0 desc "Test interface" - set interfaces ge-0/0/1 unit 0 description "Test interface" - name: configurable backup path junipernetworks.junos.junos_config: src: srx.cfg backup: yes backup_options: filename: backup.cfg dir_path: /home/user ``` 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\_path** string | when backup is yes | The full path to the backup file **Sample:** /playbooks/ansible/backup/config.2016-07-16@22:28:34 | | **date** string | when backup is yes | The date extracted from the backup file name **Sample:** 2016-07-16 | | **filename** string | when backup is yes and filename is not specified in backup options | The name of the backup file **Sample:** junos01\_config.2016-07-16@22:28:34 | | **shortname** string | when backup is yes and filename is not specified in backup options | The full path to the backup file excluding the timestamp **Sample:** /playbooks/ansible/backup/junos01\_config | | **time** string | when backup is yes | The time extracted from the backup file name **Sample:** 22:28:34 | ### Authors * Peter Sprygada (@privateip)
programming_docs
ansible junipernetworks.junos.junos_l3_interface – (deprecated, removed after 2022-06-01) Manage L3 interfaces on Juniper JUNOS network devices junipernetworks.junos.junos\_l3\_interface – (deprecated, removed after 2022-06-01) Manage L3 interfaces on Juniper JUNOS network devices ========================================================================================================================================= Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_l3_interface`. New in version 1.0.0: of junipernetworks.junos * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in major release after 2022-06-01 Why Updated modules released with more functionality Alternative Use [junipernetworks.junos.junos\_l3\_interfaces](junos_l3_interfaces_module#ansible-collections-junipernetworks-junos-junos-l3-interfaces-module) instead. Synopsis -------- * This module provides declarative management of L3 interfaces on Juniper JUNOS network devices. 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. * ncclient (>=v0.5.2) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **active** boolean | **Choices:*** no * **yes** ← | Specifies whether or not the configuration is active or deactivated | | **aggregate** list / elements=dictionary | | List of L3 interfaces definitions | | | **active** boolean | **Choices:*** no * yes | Specifies whether or not the configuration is active or deactivated | | | **filter6\_input** string | | The name of input filter for ipv6. | | | **filter6\_output** string | | The name of output filter for ipv6. | | | **filter\_input** string | | The name of input filter. | | | **filter\_output** string | | The name of output filter. | | | **ipv4** string | | IPv4 of the L3 interface. | | | **ipv6** string | | IPv6 of the L3 interface. | | | **name** string / required | | Name of the L3 interface. | | | **state** string | **Choices:*** present * absent | State of the L3 interface configuration. | | | **unit** integer | **Default:**0 | Logical interface number. | | **filter6\_input** string | | The name of input filter for ipv6. | | **filter6\_output** string | | The name of output filter for ipv6. | | **filter\_input** string | | The name of input filter. | | **filter\_output** string | | The name of output filter. | | **ipv4** string | | IPv4 of the L3 interface. | | **ipv6** string | | IPv6 of the L3 interface. | | **name** string | | Name of the L3 interface. | | **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli` or `connection: netconf`. For more information please see the [Junos OS Platform Options guide](../network/user_guide/platform_junos). A dict object containing connection details. | | | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. | | | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. | | | **port** integer | | Specifies the port to use when building the connection to the remote device. The port value will default to the well known SSH port of 22 (for `transport=cli`) or port 830 (for `transport=netconf`) device. | | | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. | | | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. | | | **transport** string | **Choices:*** cli * **netconf** ← | Configures the transport connection to use when connecting to the remote device. | | | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. | | **state** string | **Choices:*** **present** ← * absent | State of the L3 interface configuration. | | **unit** integer | **Default:**0 | Logical interface number. | Notes ----- Note * This module requires the netconf system service be enabled on the remote device being managed. * Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. * Recommended connection is `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). * This module also works with `local` connections for legacy playbooks. * For information on using CLI and netconf see the [Junos OS Platform Options guide](../../../network/user_guide/platform_junos#junos-platform-options) * For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide) * For more information on using Ansible to manage Juniper network devices see <https://www.ansible.com/ansible-juniper>. Examples -------- ``` - name: Set ge-0/0/1 IPv4 address junipernetworks.junos.junos_l3_interface: name: ge-0/0/1 ipv4: 192.168.0.1 - name: Remove ge-0/0/1 IPv4 address junipernetworks.junos.junos_l3_interface: name: ge-0/0/1 state: absent - name: Set ipv4 address using aggregate junipernetworks.junos.junos_l3_interface: aggregate: - name: ge-0/0/1 ipv4: 192.0.2.1 - name: ge-0/0/2 ipv4: 192.0.2.2 ipv6: fd5d:12c9:2201:2::2 - name: Delete ipv4 address using aggregate junipernetworks.junos.junos_l3_interface: aggregate: - name: ge-0/0/1 ipv4: 192.0.2.1 - name: ge-0/0/2 ipv4: 192.0.2.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 | | --- | --- | --- | | **diff** string | when configuration is changed and diff option is enabled. | Configuration difference before and after applying change. **Sample:** [edit interfaces ge-0/0/1 unit 0 family inet] + address 192.0.2.1/32; [edit interfaces ge-0/0/1 unit 0 family inet6] + address fd5d:12c9:2201:1::1/128; | Status ------ * This module will be removed in a major release after 2022-06-01. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Ganesh Nalawade (@ganeshrn) ansible junipernetworks.junos.junos_ospfv3 – OSPFv3 resource module junipernetworks.junos.junos\_ospfv3 – OSPFv3 resource module ============================================================ Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_ospfv3`. New in version 1.2.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module manages global OSPFv3 configuration on devices running Juniper JUNOS. 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. * ncclient (>=v0.6.4) * xmltodict (>=0.12.0) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **config** list / elements=dictionary | | A list of OSPFv3 process configuration. | | | **areas** list / elements=dictionary | | A list of OSPFv3 areas' configuration. | | | | **area\_id** string / required | | The Area ID as an integer or IP Address. | | | | **area\_range** string | | Configure an address range for the area. | | | | **interfaces** list / elements=dictionary | | List of interfaces in this area. | | | | | **authentication** dictionary | | Specify authentication type | | | | | | **type** dictionary | | Type of authentication to use. | | | | | **bandwidth\_based\_metrics** list / elements=dictionary | | Specify list of bandwidth based metrics | | | | | | **bandwidth** string | **Choices:*** 1g * 10g | BW to apply metric to. | | | | | | **metric** integer | | Specify metric | | | | | **flood\_reduction** boolean | **Choices:*** no * yes | Enable flood reduction. | | | | | **metric** integer | | Metric applied to the interface. | | | | | **name** string / required | | Name of the interface. | | | | | **passive** boolean | **Choices:*** no * yes | Specify passive | | | | | **priority** integer | | Priority for the interface. | | | | | **timers** dictionary | | Specify timers | | | | | | **dead\_interval** integer | | Dead interval (seconds). | | | | | | **hello\_interval** integer | | Hello interval (seconds). | | | | | | **poll\_interval** integer | | Poll interval (seconds). | | | | | | **retransmit\_interval** integer | | Retransmit interval (seconds). | | | | | | **transit\_delay** integer | | Transit delay (seconds). | | | | **stub** dictionary | | Settings for configuring the area as a stub. | | | | | **default\_metric** integer | | Metric for the default route in this area. | | | | | **set** boolean | **Choices:*** no * yes | Configure the area as a stub. | | | **external\_preference** integer | | Preference of external routes. | | | **overload** dictionary | | Specify time for overload mode reset | | | | **timeout** integer | | Time after which overload mode is reset (seconds). | | | **preference** integer | | Preference of internal routes. | | | **prefix\_export\_limit** integer | | Maximum number of external prefixes that can be exported. | | | **reference\_bandwidth** string | **Choices:*** 1g * 10g | Bandwidth for calculating metric defaults. | | | **rfc1583compatibility** boolean | **Choices:*** no * yes | Set RFC1583 compatibility | | | **router\_id** string | | The OSPFv3 router id. This option is DEPRECATED and will be replaced with router\_id attribute of junos\_routing\_options resource\_module. This attribute will be removed after 2024-01-01. | | | **spf\_options** dictionary | | Configure options for SPF. | | | | **delay** integer | | Time to wait before running an SPF (seconds). | | | | **holddown** integer | | Time to hold down before running an SPF (seconds). | | | | **rapid\_runs** integer | | Number of maximum rapid SPF runs before holddown (seconds). | | **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the Junos device by executing the command B(show protocols ospf. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result | | **state** string | **Choices:*** **merged** ← * replaced * overridden * deleted * gathered * rendered * parsed | The state the configuration should be left in. | Notes ----- Note * This module requires the netconf system service be enabled on the device being managed. * This module works with connection `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). * Tested against JunOS v18.4R1 Examples -------- ``` # Using merged # # Before state # ------------ # # admin# show protocols ospf3 - name: Merge Junos OSPFv3 config junipernetworks.junos.junos_ospfv3: config: - areas: - area_id: 0.0.0.100 stub: default_metric: 200 set: true interfaces: - name: so-0/0/0.0 priority: 3 metric: 5 state: merged # After state # ----------- # # adimn# show protocols ospf3 # area 0.0.0.100 { # stub default-metric 200; # interface so-0/0/0.0 { # metric 5; # priority 3; # } # } # Using replaced # # Before state # ------------ # # adimn# show protocols ospf3 # area 0.0.0.100 { # stub default-metric 200; # interface so-0/0/0.0 { # metric 5; # priority 3; # } # } - name: Replace Junos OSPFv3 config junipernetworks.junos.junos_ospfv3: config: - areas: - area_id: 0.0.0.100 interfaces: - name: so-0/0/0.0 state: replaced # After state # ----------- # # admin# show protocols ospf3 # area 0.0.0.100 { # interface so-0/0/0.0; # } # Using overridden # # Before state # ------------ # # admin# show protocols ospf3 # area 0.0.0.100 { # interface so-0/0/0.0; # } - name: Override Junos OSPFv3 config junipernetworks.junos.junos_ospfv3: config: - areas: - area_id: 0.0.0.100 stub: default_metric: 200 set: true interfaces: - name: so-0/0/0.0 priority: 3 metric: 5 flood_reduction: true passive: true - area_id: 0.0.0.200 interfaces: - name: ge-1/1/0.0 - name: ge-2/2/0.0 state: overridden # After state # ----------- # # admin# show protocols ospf3 # area 0.0.0.100 { # stub default-metric 200; # interface so-0/0/0.0 { # passive; # metric 5; # priority 3; # flood-reduction; # } # } # area 0.0.0.200 { # interface ge-1/1/0.0; # interface ge-2/2/0.0; # } # # Using deleted # # Before state # ------------ # # adimn# show protocols ospf3 # area 0.0.0.100 { # stub default-metric 200; # interface so-0/0/0.0 { # metric 5; # priority 3; # } # } - name: Delete Junos OSPFv3 config junipernetworks.junos.junos_ospfv3: config: - areas: - area_id: 0.0.0.100 interfaces: - name: so-0/0/0.0 state: deleted # After state # ----------- # # admin# show protocols ospf3 # Using gathered # # Before state # ------------ # # adimn# show protocols ospf3 # area 0.0.0.100 { # stub default-metric 200; # interface so-0/0/0.0 { # passive; # metric 5; # priority 3; # flood-reduction; # } # } # area 0.0.0.200 { # interface ge-1/1/0.0; # interface ge-2/2/0.0; # } - name: Gather Junos OSPFv3 config junipernetworks.junos.junos_ospfv3: config: state: gathered # # # ------------------------- # Module Execution Result # ------------------------- # # "gathered": { # "areas": [ # { # "area_id": "0.0.0.100", # "interfaces": [ # { # "flood_reduction": true, # "metric": 5, # "name": "so-0/0/0.0", # "passive": true, # "priority": 3 # } # ], # "stub": { # "default_metric": 200, # "set": true # } # }, # { # "area_id": "0.0.0.200", # "interfaces": [ # { # "name": "ge-1/1/0.0" # }, # { # "name": "ge-2/2/0.0" # } # ] # } # ], # } # # Using rendered # # - name: Render the commands for provided configuration junipernetworks.junos.junos_ospfv3: config: - areas: - area_id: 0.0.0.100 stub: default_metric: 200 set: true interfaces: - name: so-0/0/0.0 priority: 3 metric: 5 flood_reduction: true passive: true - area_id: 0.0.0.200 interfaces: - name: ge-1/1/0.0 - name: ge-2/2/0.0 state: rendered # # # ------------------------- # Module Execution Result # ------------------------- # # # "rendered": " # <nc:protocols # xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> # <nc:ospf3> # <nc:area> # <nc:name>0.0.0.100</nc:name> # <nc:interface> # <nc:name>so-0/0/0.0</nc:name> # <nc:priority>3</nc:priority> # <nc:flood-reduction/> # <nc:metric>5</nc:metric> # <nc:passive/> # </nc:interface> # <nc:stub> # <nc:default-metric>200</nc:default-metric> # </nc:stub> # </nc:area> # <nc:area> # <nc:name>0.0.0.200</nc:name> # <nc:interface> # <nc:name>ge-1/1/0.0</nc:name> # </nc:interface> # <nc:interface> # <nc:name>ge-2/2/0.0</nc:name> # </nc:interface> # </nc:area> # </nc:ospf3> # </nc:protocols>" # # Using parsed # parsed.cfg # ------------ # <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/18.4R1/junos"> # <data> # <configuration xmlns="http://xml.juniper.net/xnm/1.1/xnm" # junos:commit-seconds="1601355317" junos:commit-localtime="2020-09-29 04:55:17 UTC" junos:commit-user="rohit"> # <version>18.4R1-S2.4</version> # <interfaces> # <interface> # <name>ge-0/0/0</name> # <description>Configured by Ansi-Team</description> # </interface> # <interface> # <name>gr-0/0/0</name> # <description>Configured Manually</description> # </interface> # <interface> # <name>fxp0</name> # <unit> # <name>0</name> # <family> # <inet> # <dhcp> # </dhcp> # </inet> # </family> # </unit> # </interface> # </interfaces> # <protocols> # <ospf3> # <area> # <name>0.0.0.100</name> # <stub> # <default-metric>200</default-metric> # </stub> # <interface> # <name>so-0/0/0.0</name> # <passive> # </passive> # <metric>5</metric> # <priority>3</priority> # <flood-reduction/> # </interface> # </area> # <area> # <name>0.0.0.200</name> # <interface> # <name>ge-1/1/0.0</name> # </interface> # <interface> # <name>ge-2/2/0.0</name> # </interface> # </area> # </ospf3> # </protocols> # <routing-options> # <router-id>10.200.16.75</router-id> # </routing-options> # </configuration> # <database-status-information> # <database-status> # <user>rohit</user> # <terminal>pts/0</terminal> # <pid>38210</pid> # <start-time junos:seconds="1601354977">2020-09-29 04:49:37 UTC</start-time> # <idle-time junos:seconds="546">00:09:06</idle-time> # <edit-path>[edit]</edit-path> # </database-status> # </database-status-information> # </data> # </rpc-reply> - name: Parsed the device configuration to get output commands junipernetworks.junos.junos_ospfv3: running_config: "{{ lookup('file', './parsed.cfg') }}" state: parsed # # # ------------------------- # Module Execution Result # ------------------------- # # # "parsed": [ # { # "areas": [ # { # "area_id": "0.0.0.100", # "interfaces": [ # { # "flood_reduction": true, # "metric": 5, # "name": "so-0/0/0.0", # "passive": true, # "priority": 3 # } # ], # "stub": { # "default_metric": 200, # "set": true # } # }, # { # "area_id": "0.0.0.200", # "interfaces": [ # { # "name": "ge-1/1/0.0" # }, # { # "name": "ge-2/2/0.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 | | --- | --- | --- | | **after** dictionary | when changed | The resulting configuration model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **before** dictionary | always | The configuration prior to the model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['<nc:protocols xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:ospf3 delete="delete"/> <nc:ospf3> <nc:area> <nc:name>0.0.0.100</nc:name> <nc:interface> <nc:name>so-0/0/0.0</nc:name> <nc:priority>3</nc:priority> <nc:flood-reduction/> <nc:metric>5</nc:metric> <nc:passive/> </nc:interface> <nc:stub> <nc:default-metric>200</nc:default-metric> </nc:stub> </nc:area> <nc:area> <nc:name>0.0.0.200</nc:name> <nc:interface> <nc:name>ge-1/1/0.0</nc:name> </nc:interface> <nc:interface> <nc:name>ge-2/2/0.0</nc:name> </nc:interface> </nc:area> </nc:ospf3> </nc:protocols>", " <nc:routing-options xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:router-id delete="delete"/> <nc:router-id>10.200.16.75</nc:router-id> </nc:routing-options>', 'xml 2', 'xml 3'] | ### Authors * Rohit Thakur (@rohitthakur2590)
programming_docs
ansible junipernetworks.junos.junos_lldp – (deprecated, removed after 2022-06-01) Manage LLDP configuration on Juniper JUNOS network devices junipernetworks.junos.junos\_lldp – (deprecated, removed after 2022-06-01) Manage LLDP configuration on Juniper JUNOS network devices ===================================================================================================================================== Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_lldp`. New in version 1.0.0: of junipernetworks.junos * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in major release after 2022-06-01 Why Updated modules released with more functionality Alternative Use [junipernetworks.junos.junos\_lldp\_global](junos_lldp_global_module#ansible-collections-junipernetworks-junos-junos-lldp-global-module) instead. Synopsis -------- * This module provides declarative management of LLDP service on Juniper JUNOS network devices. 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. * ncclient (>=v0.5.2) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **active** boolean | **Choices:*** no * **yes** ← | Specifies whether or not the configuration is active or deactivated | | **hold\_multiplier** integer | | Specify the number of seconds that LLDP information is held before it is discarded. The multiplier value is used in combination with the `interval` value. | | **interval** integer | | Frequency at which LLDP advertisements are sent (in seconds). | | **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli` or `connection: netconf`. For more information please see the [Junos OS Platform Options guide](../network/user_guide/platform_junos). A dict object containing connection details. | | | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. | | | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. | | | **port** integer | | Specifies the port to use when building the connection to the remote device. The port value will default to the well known SSH port of 22 (for `transport=cli`) or port 830 (for `transport=netconf`) device. | | | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. | | | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. | | | **transport** string | **Choices:*** cli * **netconf** ← | Configures the transport connection to use when connecting to the remote device. | | | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. | | **state** string | **Choices:*** **present** ← * absent * enabled * disabled | Value of `present` ensures given LLDP configuration is present on device and LLDP is enabled, for value of `absent` LLDP configuration is deleted and LLDP is in disabled state. Value `enabled` ensures LLDP protocol is enabled and LLDP configuration if any is configured on remote device, for value of `disabled` it ensures LLDP protocol is disabled any LLDP configuration if any is still present. | | **transmit\_delay** integer | | Specify the number of seconds the device waits before sending advertisements to neighbors after a change is made in local system. | Notes ----- Note * This module requires the netconf system service be enabled on the remote device being managed. * Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. * Recommended connection is `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). * This module also works with `local` connections for legacy playbooks. * For information on using CLI and netconf see the [Junos OS Platform Options guide](../../../network/user_guide/platform_junos#junos-platform-options) * For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide) * For more information on using Ansible to manage Juniper network devices see <https://www.ansible.com/ansible-juniper>. Examples -------- ``` - name: Enable LLDP service junipernetworks.junos.junos_lldp: state: enabled - name: Disable LLDP service junipernetworks.junos.junos_lldp: state: disabled - name: Set LLDP parameters junipernetworks.junos.junos_lldp: interval: 10 hold_multiplier: 5 transmit_delay: 30 state: present - name: Delete LLDP parameters junipernetworks.junos.junos_lldp: interval: 10 hold_multiplier: 5 transmit_delay: 30 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 | | --- | --- | --- | | **diff.prepared** string | when configuration is changed and diff option is enabled. | Configuration difference before and after applying change. **Sample:** [edit] + protocols { + lldp { + disable; + } + } | Status ------ * This module will be removed in a major release after 2022-06-01. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Ganesh Nalawade (@ganeshrn) ansible junipernetworks.junos.junos_linkagg – (deprecated, removed after 2022-06-01) Manage link aggregation groups on Juniper JUNOS network devices junipernetworks.junos.junos\_linkagg – (deprecated, removed after 2022-06-01) Manage link aggregation groups on Juniper JUNOS network devices ============================================================================================================================================= Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_linkagg`. New in version 1.0.0: of junipernetworks.junos * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in major release after 2022-06-01 Why Updated modules released with more functionality Alternative Use [junipernetworks.junos.junos\_lag\_interfaces](junos_lag_interfaces_module#ansible-collections-junipernetworks-junos-junos-lag-interfaces-module) instead. Synopsis -------- * This module provides declarative management of link aggregation groups on Juniper JUNOS network devices. 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. * ncclient (>=v0.5.2) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **active** boolean | **Choices:*** no * **yes** ← | Specifies whether or not the configuration is active or deactivated | | **aggregate** list / elements=dictionary | | List of link aggregation definitions. | | | **active** boolean | **Choices:*** no * yes | Specifies whether or not the configuration is active or deactivated | | | **description** string | | Description of Interface. | | | **device\_count** integer | | Number of aggregated ethernet devices that can be configured. Acceptable integer value is between 1 and 128. | | | **members** list / elements=string | | List of members interfaces of the link aggregation group. The value can be single interface or list of interfaces. | | | **min\_links** integer | | Minimum members that should be up before bringing up the link aggregation group. | | | **mode** string | **Choices:*** on * off * active * passive | Mode of the link aggregation group. A value of `on` will enable LACP in `passive` mode. `active` configures the link to actively information about the state of the link, or it can be configured in `passive` mode ie. send link state information only when received them from another link. A value of `off` will disable LACP. | | | **name** string / required | | Name of the link aggregation group. | | | **state** string | **Choices:*** present * absent * up * down | State of the link aggregation group. | | **description** string | | Description of Interface. | | **device\_count** integer | | Number of aggregated ethernet devices that can be configured. Acceptable integer value is between 1 and 128. | | **members** list / elements=string | | List of members interfaces of the link aggregation group. The value can be single interface or list of interfaces. | | **min\_links** integer | | Minimum members that should be up before bringing up the link aggregation group. | | **mode** string | **Choices:*** **on** ← * off * active * passive | Mode of the link aggregation group. A value of `on` will enable LACP in `passive` mode. `active` configures the link to actively information about the state of the link, or it can be configured in `passive` mode ie. send link state information only when received them from another link. A value of `off` will disable LACP. | | **name** string | | Name of the link aggregation group. | | **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli` or `connection: netconf`. For more information please see the [Junos OS Platform Options guide](../network/user_guide/platform_junos). A dict object containing connection details. | | | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. | | | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. | | | **port** integer | | Specifies the port to use when building the connection to the remote device. The port value will default to the well known SSH port of 22 (for `transport=cli`) or port 830 (for `transport=netconf`) device. | | | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. | | | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. | | | **transport** string | **Choices:*** cli * **netconf** ← | Configures the transport connection to use when connecting to the remote device. | | | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. | | **state** string | **Choices:*** **present** ← * absent * up * down | State of the link aggregation group. | Notes ----- Note * This module requires the netconf system service be enabled on the remote device being managed. * Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. * Recommended connection is `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). * This module also works with `local` connections for legacy playbooks. * For information on using CLI and netconf see the [Junos OS Platform Options guide](../../../network/user_guide/platform_junos#junos-platform-options) * For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide) * For more information on using Ansible to manage Juniper network devices see <https://www.ansible.com/ansible-juniper>. Examples -------- ``` - name: configure link aggregation junipernetworks.junos.junos_linkagg: name: ae11 members: - ge-0/0/5 - ge-0/0/6 - ge-0/0/7 lacp: active device_count: 4 state: present - name: delete link aggregation junipernetworks.junos.junos_linkagg: name: ae11 members: - ge-0/0/5 - ge-0/0/6 - ge-0/0/7 lacp: active device_count: 4 state: delete - name: deactivate link aggregation junipernetworks.junos.junos_linkagg: name: ae11 members: - ge-0/0/5 - ge-0/0/6 - ge-0/0/7 lacp: active device_count: 4 state: present active: false - name: Activate link aggregation junipernetworks.junos.junos_linkagg: name: ae11 members: - ge-0/0/5 - ge-0/0/6 - ge-0/0/7 lacp: active device_count: 4 state: present active: true - name: Disable link aggregation junipernetworks.junos.junos_linkagg: name: ae11 state: down - name: Enable link aggregation junipernetworks.junos.junos_linkagg: name: ae11 state: up ``` 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 | | --- | --- | --- | | **diff** string | when configuration is changed and diff option is enabled. | Configuration difference before and after applying change. **Sample:** [edit interfaces] + ge-0/0/6 { + ether-options { + 802.3ad ae0; + } + } [edit interfaces ge-0/0/7] + ether-options { + 802.3ad ae0; + } [edit interfaces] + ae0 { + description "configured by junos\_linkagg"; + aggregated-ether-options { + lacp { + active; + } + } + } | Status ------ * This module will be removed in a major release after 2022-06-01. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Ganesh Nalawade (@ganeshrn) ansible junipernetworks.junos.junos – Use junos cliconf to run command on Juniper Junos OS platform junipernetworks.junos.junos – Use junos cliconf to run command on Juniper Junos OS platform =========================================================================================== Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos`. New in version 1.0.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Parameters](#parameters) Synopsis -------- * This junos plugin provides low level abstraction apis for sending and receiving CLI commands from Juniper Junos OS network devices. Parameters ---------- | Parameter | Choices/Defaults | Configuration | Comments | | --- | --- | --- | --- | | **config\_commands** list / elements=string added in 2.0.0 of junipernetworks.junos | **Default:**[] | var: ansible\_junos\_config\_commands | Specifies a list of commands that can make configuration changes to the target device. When `ansible\_network\_single\_user\_mode` is enabled, if a command sent to the device is present in this list, the existing cache is invalidated. | ### Authors * Ansible Networking Team ansible junipernetworks.junos.junos_prefix_lists – Manage prefix-lists attributes of interfaces on Junos devices. junipernetworks.junos.junos\_prefix\_lists – Manage prefix-lists attributes of interfaces on Junos devices. =========================================================================================================== Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_prefix_lists`. New in version 2.1.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Manage prefix-lists attributes of interfaces on Junos network devices. 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. * ncclient (>=v0.6.4) * xmltodict (>=0.12.0) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **config** list / elements=dictionary | | The provided link BGP address family dictionary. | | | **address\_prefixes** list / elements=string | | Specify address prefixes. | | | **dynamic\_db** boolean | **Choices:*** no * yes | Enable object to exist in dynamic DB. | | | **name** string / required | | Specify the name of the prefix-list. | | **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the Junos device by executing the command **show policy-options**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result | | **state** string | **Choices:*** **merged** ← * replaced * overridden * deleted * parsed * gathered * rendered | The state the configuration should be left in. | Notes ----- Note * This module requires the netconf system service be enabled on the device being managed. * This module works with connection `netconf`. * See [the Junos OS Platform Options](../../../network/user_guide/platform_junos). * Tested against JunOS v18.4R1 Examples -------- ``` # Using merged # # Before state # ------------ # # vagrant@vsrx# show policy-options # # [edit] - name: Merge Junos prefix lists junipernetworks.junos.junos_prefix_lists: config: - name: Internal address_prefixes: - 172.16.1.32 - 172.16.3.32 - name: Test1 dynamic_db: true - name: Test2 address_prefixes: - 172.16.2.32 - 172.16.7.32 - 172.16.9.32 state: merged # # ------------------------- # Module Execution Result # ------------------------- # # "before": [] # "commands": [ # "<nc:policy-options xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> # "<nc:prefix-list><nc:name>Internal</nc:name><nc:prefix-list-item><nc:name>172.16.1.32</nc:name>" # "</nc:prefix-list-item><nc:prefix-list-item><nc:name>172.16.3.32</nc:name>" # "</nc:prefix-list-item></nc:prefix-list><nc:prefix-list><nc:name>Test1</nc:name>" # "<nc:dynamic-db/></nc:prefix-list><nc:prefix-list><nc:name>Test2</nc:name>" # "<nc:prefix-list-item><nc:name>172.16.2.32</nc:name></nc:prefix-list-item>" # "<nc:prefix-list-item><nc:name>172.16.7.32</nc:name></nc:prefix-list-item>" # "<nc:prefix-list-item><nc:name>172.16.9.32</nc:name></nc:prefix-list-item>" # "</nc:prefix-list></nc:policy-options>" # ] # # "after": [ # { # "address_prefixes": [ # "172.16.1.32/32", # "172.16.3.32/32" # ], # "name": "Internal" # }, # { # "dynamic_db": true, # "name": "Test1" # }, # { # "address_prefixes": [ # "172.16.2.32/32", # "172.16.7.32/32", # "172.16.9.32/32" # ], # "name": "Test2" # } # ] # After state # ----------- # # vagrant@vsrx# show policy-options # prefix-list Internal { # 172.16.1.32/32; # 172.16.3.32/32; # } # prefix-list Test1 { # dynamic-db; # } # prefix-list Test2 { # 172.16.2.32/32; # 172.16.7.32/32; # 172.16.9.32/32; # } # # Using gathered # # Before state # ------------ # # vagrant@vsrx# show policy-options # prefix-list Internal { # 172.16.1.32/32; # 172.16.3.32/32; # } # prefix-list Test1 { # dynamic-db; # } # prefix-list Test2 { # 172.16.2.32/32; # 172.16.7.32/32; # 172.16.9.32/32; # } - name: Gather Junos prefix-lists junipernetworks.junos.junos_prefix_lists: state: gathered # # # ------------------------- # Module Execution Result # ------------------------- # # "gathered": [ # { # "address_prefixes": [ # "172.16.1.32/32", # "172.16.3.32/32" # ], # "name": "Internal" # }, # { # "dynamic_db": true, # "name": "Test1" # }, # { # "address_prefixes": [ # "172.16.2.32/32", # "172.16.7.32/32", # "172.16.9.32/32" # ], # "name": "Test2" # } # ] # # Using replaced # # Before state # ------------ # # vagrant@vsrx# show policy-options # prefix-list Internal { # 172.16.1.32/32; # 172.16.3.32/32; # } # prefix-list Test1 { # dynamic-db; # } # prefix-list Test2 { # 172.16.2.32/32; # 172.16.7.32/32; # 172.16.9.32/32; # } - name: Replace existing Junos prefix-lists configuration with provided config junipernetworks.junos.junos_prefix_lists: config: - name: Test2 address_prefixes: - 172.16.4.32 - 172.16.8.32 - 172.16.9.32" state: replaced # ------------------------- # Module Execution Result # ------------------------- # # "before": [ # { # "address_prefixes": [ # "172.16.1.32/32", # "172.16.3.32/32" # ], # "name": "Internal" # }, # { # "dynamic_db": true, # "name": "Test1" # }, # { # "address_prefixes": [ # "172.16.2.32/32", # "172.16.7.32/32", # "172.16.9.32/32" # ], # "name": "Test2" # } # ] # "commands": [ # "<nc:policy-options xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> # "<nc:prefix-list delete="delete"><nc:name>Test2</nc:name></nc:prefix-list>" # "<nc:prefix-list><nc:name>Test2</nc:name><nc:prefix-list-item><nc:name>172.16.4.32</nc:name>" # "</nc:prefix-list-item><nc:prefix-list-item><nc:name>172.16.8.32</nc:name>" # "</nc:prefix-list-item><nc:prefix-list-item><nc:name>172.16.9.32</nc:name>" # "</nc:prefix-list-item></nc:prefix-list></nc:policy-options>" # ] # # "after": [ # { # "address_prefixes": [ # "172.16.1.32/32", # "172.16.3.32/32" # ], # "name": "Internal" # }, # { # "dynamic_db": true, # "name": "Test1" # }, # { # "address_prefixes": [ # "172.16.4.32/32", # "172.16.8.32/32", # "172.16.9.32/32" # ], # "name": "Test2" # } # ] # After state # ----------- # # vagrant@vsrx# show policy-options # prefix-list Internal { # 172.16.1.32/32; # 172.16.3.32/32; # } # prefix-list Test1 { # dynamic-db; # } # prefix-list Test2 { # 172.16.4.32/32; # 172.16.8.32/32; # 172.16.9.32/32; # } # Using overridden # # Before state # ------------ # # vagrant@vsrx# show policy-options # prefix-list Internal { # 172.16.1.32/32; # 172.16.3.32/32; # } # prefix-list Test1 { # dynamic-db; # } # prefix-list Test2 { # 172.16.4.32/32; # 172.16.8.32/32; # 172.16.9.32/32; # } - name: Override Junos prefix-lists configuration with provided configuration junipernetworks.junos.junos_prefix_lists: config: - name: Test2 address_prefixes: - 172.16.4.32/28 - 172.16.8.32/28 - 172.16.9.32/28 state: overridden # ------------------------- # Module Execution Result # ------------------------- # # "before": [ # { # "address_prefixes": [ # "172.16.1.32/32", # "172.16.3.32/32" # ], # "name": "Internal" # }, # { # "dynamic_db": true, # "name": "Test1" # }, # { # "address_prefixes": [ # "172.16.4.32/32", # "172.16.8.32/32", # "172.16.9.32/32" # ], # "name": "Test2" # } # ] # "commands": [ # "<nc:policy-options xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> # "<nc:prefix-list delete="delete"><nc:name>Internal</nc:name>" # "</nc:prefix-list><nc:prefix-list delete="delete"><nc:name>Test1</nc:name>" # "</nc:prefix-list><nc:prefix-list delete="delete"><nc:name>Test2</nc:name>" # "</nc:prefix-list><nc:prefix-list><nc:name>Test2</nc:name><nc:prefix-list-item>" # "<nc:name>172.16.4.32/28</nc:name></nc:prefix-list-item><nc:prefix-list-item>" # "<nc:name>172.16.8.32/28</nc:name></nc:prefix-list-item><nc:prefix-list-item>" # "<nc:name>172.16.9.32/28</nc:name></nc:prefix-list-item></nc:prefix-list></nc:policy-options>" # ] # # "after": [ # { # "address_prefixes": [ # "172.16.4.32/28", # "172.16.8.32/28", # "172.16.9.32/28" # ], # "name": "Test2" # } # ] # After state # ----------- # # vagrant@vsrx# show policy-options # prefix-list Test2 { # 172.16.4.32/28; # 172.16.8.32/28; # 172.16.9.32/28; # } # Using deleted # # Before state # ------------ # # vagrant@vsrx# show policy-options # prefix-list Internal { # 172.16.1.32/32; # 172.16.3.32/32; # } # prefix-list Test1 { # dynamic-db; # } # prefix-list Test2 { # 172.16.2.32/32; # 172.16.7.32/32; # 172.16.9.32/32; # } - name: Delete provided prefix-lists junipernetworks.junos.junos_prefix_lists: config: - name: "Test1" - name: "Test2" state: deleted # ------------------------ # Module Execution Results # ------------------------ # # "before": [ # { # "address_prefixes": [ # "172.16.1.32/32", # "172.16.3.32/32" # ], # "name": "Internal" # }, # { # "dynamic_db": true, # "name": "Test1" # }, # { # "address_prefixes": [ # "172.16.2.32/32", # "172.16.7.32/32", # "172.16.9.32/32" # ], # "name": "Test2" # } # ] # "commands": [ # "<nc:policy-options xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> # "<nc:prefix-list delete="delete"><nc:name>Test1</nc:name></nc:prefix-list>" # "<nc:prefix-list delete="delete"><nc:name>Test2</nc:name></nc:prefix-list></nc:policy-options>" # ] # # "after": [ # { # "address_prefixes": [ # "172.16.1.32/32", # "172.16.3.32/32" # ], # "name": "Internal" # } # ] # After state # ----------- # # vagrant@vsrx# show policy-options # prefix-list Internal { # 172.16.1.32/32; # 172.16.3.32/32; # } # # Using deleted without specifying config # # Before state # ------------ # # vagrant@vsrx# show policy-options # prefix-list Internal { # 172.16.1.32/32; # 172.16.3.32/32; # } # prefix-list Test1 { # dynamic-db; # } # prefix-list Test2 { # 172.16.2.32/32; # 172.16.7.32/32; # 172.16.9.32/32; # } - name: Delete complete Junos prefix-lists configuration junipernetworks.junos.junos_prefix_lists: state: deleted # ------------------------ # Module Execution Results # ------------------------ # # "before": [ # { # "address_prefixes": [ # "172.16.1.32/32", # "172.16.3.32/32" # ], # "name": "Internal" # }, # { # "dynamic_db": true, # "name": "Test1" # }, # { # "address_prefixes": [ # "172.16.2.32/32", # "172.16.7.32/32", # "172.16.9.32/32" # ], # "name": "Test2" # } # ] # "commands": ["<nc:policy-options xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> # "<nc:prefix-list delete="delete"/></nc:policy-options>" # ] # # "after": [] # After state # ----------- # # vagrant@vsrx# show policy-options # # [edit] # # Using parsed # parsed.cfg # ------------ # <?xml version="1.0" encoding="UTF-8"?> # <rpc-reply message-id="urn:uuid:0cadb4e8-5bba-47f4-986e-72906227007f"> # <configuration changed-seconds="1590139550" changed-localtime="2020-05-22 09:25:50 UTC"> # <version>18.4R1-S2.4</version> # <policy-options> # <prefix-list> # <name>64510</name> # </prefix-list> # <prefix-list> # <name>64500</name> # <dynamic-db/> # <prefix-list-item> # <name>172.16.1.16/28</name> # </prefix-list-item> # <prefix-list-item> # <name>172.16.1.32/28</name> # </prefix-list-item> # </prefix-list> # </policy-options> # </configuration> # </rpc-reply> - name: Parse running prefix-lists configuration junipernetworks.junos.junos_prefix_lists: running_config: "{{ lookup('file', './parsed.cfg') }}" state: parsed # # # ------------------------- # Module Execution Result # ------------------------- # # # "parsed": [ # { # "name": "64510" # }, # { # "address_prefixes": [ # "172.16.1.16/28", # "172.16.1.32/28" # ], # "dynamic_db": true, # "name": "64500" # } # ] # # # Using rendered # - name: Render the xml for provided configuration junipernetworks.junos.junos_prefix_lists: config: - name: Internal address_prefixes: - 172.16.1.32 - 172.16.3.32 - name: Test1 dynamic_db: true - name: Test2 address_prefixes: - 172.16.2.32 - 172.16.7.32 - 172.16.9.32 state: rendered # # # ------------------------- # Module Execution Result # ------------------------- # # # "rendered": "<nc:policy-options xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> # "<nc:prefix-list><nc:name>Internal</nc:name><nc:prefix-list-item><nc:name>172.16.1.32</nc:name>" # "</nc:prefix-list-item><nc:prefix-list-item><nc:name>172.16.3.32</nc:name></nc:prefix-list-item>" # "</nc:prefix-list><nc:prefix-list><nc:name>Test1</nc:name><nc:dynamic-db/></nc:prefix-list>" # "<nc:prefix-list><nc:name>Test2</nc:name><nc:prefix-list-item><nc:name>172.16.2.32</nc:name>" # "</nc:prefix-list-item><nc:prefix-list-item><nc:name>172.16.7.32</nc:name></nc:prefix-list-item>" # "<nc:prefix-list-item><nc:name>172.16.9.32</nc:name></nc:prefix-list-item>" # "</nc:prefix-list></nc:policy-options>" ``` 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 | | --- | --- | --- | | **after** list / elements=string | when changed | The resulting configuration model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **before** list / elements=string | always | The configuration prior to the model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['<nc:policy-options xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> "<nc:prefix-list delete="delete"/></nc:policy-options>"', 'xml 2', 'command 3'] | ### Authors * Rohit Thakur (@rohitthakur2590)
programming_docs
ansible junipernetworks.junos.junos_lldp_interface – (deprecated, removed after 2022-06-01) Manage LLDP interfaces configuration on Juniper JUNOS network devices junipernetworks.junos.junos\_lldp\_interface – (deprecated, removed after 2022-06-01) Manage LLDP interfaces configuration on Juniper JUNOS network devices =========================================================================================================================================================== Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_lldp_interface`. New in version 1.0.0: of junipernetworks.junos * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in major release after 2022-06-01 Why Updated modules released with more functionality Alternative Use [junipernetworks.junos.junos\_lldp\_interfaces](junos_lldp_interfaces_module#ansible-collections-junipernetworks-junos-junos-lldp-interfaces-module) instead. Synopsis -------- * This module provides declarative management of LLDP interfaces configuration on Juniper JUNOS network devices. 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. * ncclient (>=v0.5.2) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **active** boolean | **Choices:*** no * **yes** ← | Specifies whether or not the configuration is active or deactivated | | **name** string | | Name of the interface LLDP should be configured on. | | **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli` or `connection: netconf`. For more information please see the [Junos OS Platform Options guide](../network/user_guide/platform_junos). A dict object containing connection details. | | | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. | | | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. | | | **port** integer | | Specifies the port to use when building the connection to the remote device. The port value will default to the well known SSH port of 22 (for `transport=cli`) or port 830 (for `transport=netconf`) device. | | | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. | | | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. | | | **transport** string | **Choices:*** cli * **netconf** ← | Configures the transport connection to use when connecting to the remote device. | | | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. | | **state** string | **Choices:*** **present** ← * absent * enabled * disabled | Value of `present` ensures given LLDP configured on given *interfaces* and is enabled, for value of `absent` LLDP configuration on given *interfaces* deleted. Value `enabled` ensures LLDP protocol is enabled on given *interfaces* and for value of `disabled` it ensures LLDP is disabled on given *interfaces*. | Notes ----- Note * This module requires the netconf system service be enabled on the remote device being managed. * Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. * Recommended connection is `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). * This module also works with `local` connections for legacy playbooks. * For information on using CLI and netconf see the [Junos OS Platform Options guide](../../../network/user_guide/platform_junos#junos-platform-options) * For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide) * For more information on using Ansible to manage Juniper network devices see <https://www.ansible.com/ansible-juniper>. Examples -------- ``` - name: Configure LLDP on specific interfaces junipernetworks.junos.junos_lldp_interface: name: ge-0/0/5 state: present - name: Disable LLDP on specific interfaces junipernetworks.junos.junos_lldp_interface: name: ge-0/0/5 state: disabled - name: Enable LLDP on specific interfaces junipernetworks.junos.junos_lldp_interface: name: ge-0/0/5 state: enabled - name: Delete LLDP configuration on specific interfaces junipernetworks.junos.junos_lldp_interface: name: ge-0/0/5 state: present - name: Deactivate LLDP on specific interfaces junipernetworks.junos.junos_lldp_interface: name: ge-0/0/5 state: present active: false - name: Activate LLDP on specific interfaces junipernetworks.junos.junos_lldp_interface: name: ge-0/0/5 state: present active: 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 | | --- | --- | --- | | **diff.prepared** string | when configuration is changed and diff option is enabled. | Configuration difference before and after applying change. **Sample:** [edit protocols lldp] + interface ge-0/0/5; | Status ------ * This module will be removed in a major release after 2022-06-01. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Ganesh Nalawade (@ganeshrn) ansible junipernetworks.junos.junos_l2_interfaces – L2 interfaces resource module junipernetworks.junos.junos\_l2\_interfaces – L2 interfaces resource module =========================================================================== Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_l2_interfaces`. New in version 1.0.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module provides declarative management of a Layer-2 interface on Juniper JUNOS devices. 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. * ncclient (>=v0.6.4) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **config** list / elements=dictionary | | A dictionary of Layer-2 interface options | | | **access** dictionary | | Configure the interface as a Layer 2 access mode. | | | | **vlan** string | | Configure the access VLAN ID. | | | **enhanced\_layer** boolean | **Choices:*** no * yes | True if your device has Enhanced Layer 2 Software (ELS). If the l2 configuration is under `interface-mode` the value is True else if the l2 configuration is under `port-mode` value is False | | | **name** string / required | | Full name of interface, e.g. ge-0/0/1. | | | **trunk** dictionary | | Configure the interface as a Layer 2 trunk mode. | | | | **allowed\_vlans** list / elements=string | | List of VLANs to be configured in trunk port. It's used as the VLAN range to ADD or REMOVE from the trunk. | | | | **native\_vlan** string | | Native VLAN to be configured in trunk port. It is used as the trunk native VLAN ID. | | | **unit** integer | | Logical interface number. Value of `unit` should be of type integer. | | **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the Junos device by executing the command **show interfaces**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result. | | **state** string | **Choices:*** **merged** ← * replaced * overridden * deleted * gathered * parsed * rendered | The state of the configuration after module completion | Notes ----- Note * This module requires the netconf system service be enabled on the remote device being managed. * Tested against vSRX JUNOS version 18.4R1. * This module works with connection `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). Examples -------- ``` # Using deleted # Before state: # ------------- # # ansible@junos01# show interfaces # ge-0/0/1 { # description "L2 interface"; # speed 1g; # unit 0 { # family ethernet-switching { # interface-mode access; # vlan { # members vlan30; # } # } # } #} #ge-0/0/2 { # description "non L2 interface"; # unit 0 { # family inet { # address 192.168.56.14/24; # } # } - name: "Delete L2 attributes of given interfaces (Note: This won't delete the interface itself)." junipernetworks.junos.junos_l2_interfaces: config: - name: ge-0/0/1 - name: ge-0/0/2 state: deleted # After state: # ------------ # # ansible@junos01# show interfaces # ge-0/0/1 { # description "L2 interface"; # speed 1g; # } #ge-0/0/2 { # description "non L2 interface"; # unit 0 { # family inet { # address 192.168.56.14/24; # } # } # Using merged # Before state: # ------------- # ansible@junos01# show interfaces # ge-0/0/3 { # description "test interface"; # speed 1g; #} # ge-0/0/4 { # description interface-trunk; # native-vlan-id 100; # unit 0 { # family ethernet-switching { # interface-mode trunk; # vlan { # members [ vlan40 ]; # } # } # } # } - name: Merge provided configuration with device configuration (default operation is merge) junipernetworks.junos.junos_l2_interfaces: config: - name: ge-0/0/3 access: vlan: v101 - name: ge-0/0/4 trunk: allowed_vlans: - vlan30 native_vlan: 50 state: merged # After state: # ------------ # user@junos01# show interfaces # ge-0/0/3 { # description "test interface"; # speed 1g; # unit 0 { # family ethernet-switching { # interface-mode access; # vlan { # members v101; # } # } # } # } # ge-0/0/4 { # description interface-trunk; # native-vlan-id 50; # unit 0 { # family ethernet-switching { # interface-mode trunk; # vlan { # members [ vlan40 vlan30 ]; # } # } # } # } # Using overridden # Before state: # ------------- # ansible@junos01# show interfaces # ge-0/0/3 { # description "test interface"; # speed 1g; #} # ge-0/0/4 { # description interface-trunk; # native-vlan-id 100; # unit 0 { # family ethernet-switching { # interface-mode trunk; # vlan { # members [ vlan40 ]; # } # } # } # } # ge-0/0/5 { # description "Configured by Ansible-11"; # unit 0 { # family ethernet-switching { # interface-mode access; # vlan { # members v101; # } # } # } # } - name: Override provided configuration with device configuration junipernetworks.junos.junos_l2_interfaces: config: - name: ge-0/0/3 access: vlan: v101 - name: ge-0/0/4 trunk: allowed_vlans: - vlan30 native_vlan: 50 state: overridden # After state: # ------------ # user@junos01# show interfaces # ge-0/0/3 { # unit 0 { # family ethernet-switching { # interface-mode access; # vlan { # members v101; # } # } # } # } # ge-0/0/4 { # description interface-trunk; # native-vlan-id 50; # unit 0 { # family ethernet-switching { # interface-mode trunk; # vlan { # members [ vlan30 ]; # } # } # } # } # Using replaced # Before state: # ------------- # ansible@junos01# show interfaces # ge-0/0/3 { # description "test interface"; # speed 1g; #} # ge-0/0/4 { # description interface-trunk; # native-vlan-id 100; # unit 0 { # family ethernet-switching { # interface-mode trunk; # vlan { # members [ vlan40 ]; # } # } # } # } - name: Replace provided configuration with device configuration junipernetworks.junos.junos_l2_interfaces: config: - name: ge-0/0/3 access: vlan: v101 - name: ge-0/0/4 trunk: allowed_vlans: - vlan30 native_vlan: 50 state: replaced # After state: # ------------ # user@junos01# show interfaces # ge-0/0/3 { # unit 0 { # family ethernet-switching { # interface-mode access; # vlan { # members v101; # } # } # } # } # ge-0/0/4 { # description interface-trunk; # native-vlan-id 50; # unit 0 { # family ethernet-switching { # interface-mode trunk; # vlan { # members [ vlan30 ]; # } # } # } # } # Using gathered # Before state: # ------------ # # user@junos01# show interfaces # ge-0/0/1 { # description "Configured by Ansible"; # disable; # speed 100m; # mtu 1024; # hold-time up 2000 down 2200; # link-mode full-duplex; # unit 0 { # family ethernet-switching { # interface-mode access; # vlan { # members vlan100; # } # } # } # } # ge-0/0/2 { # description "Configured by Ansible"; # native-vlan-id 400; # speed 10m; # mtu 2048; # hold-time up 3000 down 3200; # unit 0 { # family ethernet-switching { # interface-mode trunk; # vlan { # members [ vlan200 vlan300 ]; # } # } # } # } # em1 { # description TEST; # } # fxp0 { # description ANSIBLE; # speed 1g; # link-mode automatic; # unit 0 { # family inet { # address 10.8.38.38/24; # } # } # } - name: Gather junos layer 2 interfaces as in given arguments junipernetworks.junos.junos_l2_interfaces: state: gathered # Task Output (redacted) # ----------------------- # # "gathered": [ # { # "access": { # "vlan": "vlan100" # }, # "enhanced_layer": true, # "name": "ge-0/0/1", # "unit": 0 # }, # { # "enhanced_layer": true, # "name": "ge-0/0/2", # "trunk": { # "allowed_vlans": [ # "vlan200", # "vlan300" # ], # "native_vlan": "400" # }, # "unit": 0 # } # ] # After state: # ------------ # # user@junos01# show interfaces # ge-0/0/1 { # description "Configured by Ansible"; # disable; # speed 100m; # mtu 1024; # hold-time up 2000 down 2200; # link-mode full-duplex; # unit 0 { # family ethernet-switching { # interface-mode access; # vlan { # members vlan100; # } # } # } # } # ge-0/0/2 { # description "Configured by Ansible"; # native-vlan-id 400; # speed 10m; # mtu 2048; # hold-time up 3000 down 3200; # unit 0 { # family ethernet-switching { # interface-mode trunk; # vlan { # members [ vlan200 vlan300 ]; # } # } # } # } # em1 { # description TEST; # } # fxp0 { # description ANSIBLE; # speed 1g; # link-mode automatic; # unit 0 { # family inet { # address 10.8.38.38/24; # } # } # } # Using parsed # parsed.cfg # ------------ # # <?xml version="1.0" encoding="UTF-8"?> # <rpc-reply message-id="urn:uuid:0cadb4e8-5bba-47f4-986e-72906227007f"> # <configuration changed-seconds="1590139550" changed-localtime="2020-05-22 09:25:50 UTC"> # <interfaces> # <interface> # <name>ge-0/0/1</name> # <description>Configured by Ansible</description> # <disable/> # <speed>100m</speed> # <mtu>1024</mtu> # <hold-time> # <up>2000</up> # <down>2200</down> # </hold-time> # <link-mode>full-duplex</link-mode> # <unit> # <name>0</name> # <family> # <ethernet-switching> # <interface-mode>access</interface-mode> # <vlan> # <members>vlan100</members> # </vlan> # </ethernet-switching> # </family> # </unit> # </interface> # </interfaces> # </configuration> # </rpc-reply> # - name: Convert interfaces config to argspec without connecting to the appliance # junipernetworks.junos.junos_l2_interfaces: # running_config: "{{ lookup('file', './parsed.cfg') }}" # state: parsed # Task Output (redacted) # ----------------------- # "parsed": [ # { # "access": { # "vlan": "vlan100" # }, # "enhanced_layer": true, # "name": "ge-0/0/1", # "unit": 0 # }, # { # "enhanced_layer": true, # "name": "ge-0/0/2", # "trunk": { # "allowed_vlans": [ # "vlan200", # "vlan300" # ], # "native_vlan": "400" # }, # "unit": 0 # } # ] # # Using rendered - name: Render platform specific xml from task input using rendered state junipernetworks.junos.junos_l2_interfaces: config: - name: ge-0/0/1 access: vlan: vlan100 - name: ge-0/0/2 trunk: allowed_vlans: - vlan200 - vlan300 native_vlan: '400' state: rendered # Task Output (redacted) # ----------------------- # "rendered": "<nc:interfaces # xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> # <nc:interface> # <nc:name>ge-0/0/1</nc:name> # <nc:unit> # <nc:name>0</nc:name> # <nc:family> # <nc:ethernet-switching> # <nc:interface-mode>access</nc:interface-mode> # <nc:vlan> # <nc:members>vlan100</nc:members> # </nc:vlan> # </nc:ethernet-switching> # </nc:family> # </nc:unit> # </nc:interface> # <nc:interface> # <nc:name>ge-0/0/2</nc:name> # <nc:unit> # <nc:name>0</nc:name> # <nc:family> # <nc:ethernet-switching> # <nc:interface-mode>trunk</nc:interface-mode> # <nc:vlan> # <nc:members>vlan200</nc:members> # <nc:members>vlan300</nc:members> # </nc:vlan> # </nc:ethernet-switching> # </nc:family> # </nc:unit> # <nc:native-vlan-id>400</nc:native-vlan-id> # </nc:interface> # </nc:interfaces>" ``` 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 | | --- | --- | --- | | **after** list / elements=string | when changed | The configuration as structured data after module completion. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **before** list / elements=string | always | The configuration as structured data prior to module invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['<nc:interfaces xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:interface> <nc:name>ge-0/0/1</nc:name> <nc:unit> <nc:name>0</nc:name> <nc:family> <nc:ethernet-switching> <nc:interface-mode>access</nc:interface-mode> <nc:vlan> <nc:members>vlan100</nc:members> </nc:vlan> </nc:ethernet-switching> </nc:family> </nc:unit> </nc:interface> <nc:interface> <nc:name>ge-0/0/2</nc:name> <nc:unit> <nc:name>0</nc:name> <nc:family> <nc:ethernet-switching> <nc:interface-mode>trunk</nc:interface-mode> <nc:vlan> <nc:members>vlan200</nc:members> <nc:members>vlan300</nc:members> </nc:vlan> </nc:ethernet-switching> </nc:family> </nc:unit> <nc:native-vlan-id>400</nc:native-vlan-id> </nc:interface> </nc:interfaces>', 'xml 2', 'xml 3'] | ### Authors * Ganesh Nalawade (@ganeshrn)
programming_docs
ansible junipernetworks.junos.junos_netconf – Configures the Junos Netconf system service junipernetworks.junos.junos\_netconf – Configures the Junos Netconf system service ================================================================================== Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_netconf`. New in version 1.0.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module provides an abstraction that enables and configures the netconf system service running on Junos devices. This module can be used to easily enable the Netconf API. Netconf provides a programmatic interface for working with configuration and state resources as defined in RFC 6242. If the `netconf_port` is not mentioned in the task by default netconf will be enabled on port 830 only. Note This module has a corresponding [action plugin](../../../plugins/action#action-plugins). Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **netconf\_port** integer | **Default:**830 | This argument specifies the port the netconf service should listen on for SSH connections. The default port as defined in RFC 6242 is 830. aliases: listens\_on | | **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli` or `connection: netconf`. For more information please see the [Junos OS Platform Options guide](../network/user_guide/platform_junos). A dict object containing connection details. | | | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. | | | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. | | | **port** integer | | Specifies the port to use when building the connection to the remote device. The port value will default to the well known SSH port of 22 (for `transport=cli`) or port 830 (for `transport=netconf`) device. | | | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. | | | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. | | | **transport** string | **Choices:*** cli * **netconf** ← | Configures the transport connection to use when connecting to the remote device. | | | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. | | **state** string | **Choices:*** **present** ← * absent | Specifies the state of the `junos_netconf` resource on the remote device. If the *state* argument is set to *present* the netconf service will be configured. If the *state* argument is set to *absent* the netconf service will be removed from the configuration. | Notes ----- Note * Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. * Recommended connection is `network_cli`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). * This module also works with `local` connections for legacy playbooks. * If `netconf_port` value is not mentioned in task by default it will be enabled on port 830 only. Although `netconf_port` value can be from 1 through 65535, avoid configuring access on a port that is normally assigned for another service. This practice avoids potential resource conflicts. * For information on using CLI and netconf see the [Junos OS Platform Options guide](../../../network/user_guide/platform_junos#junos-platform-options) * For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide) * For more information on using Ansible to manage Juniper network devices see <https://www.ansible.com/ansible-juniper>. Examples -------- ``` - name: enable netconf service on port 830 junipernetworks.junos.junos_netconf: listens_on: 830 state: present - name: disable netconf service junipernetworks.junos.junos_netconf: 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 | | --- | --- | --- | | **commands** string | when changed is True | Returns the command sent to the remote device **Sample:** set system services netconf ssh port 830 | ### Authors * Peter Sprygada (@privateip) ansible junipernetworks.junos.junos_routing_instances – Manage routing instances on Junos devices. junipernetworks.junos.junos\_routing\_instances – Manage routing instances on Junos devices. ============================================================================================ Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_routing_instances`. New in version 2.1.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Manage routing instances on Junos network devices. 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. * ncclient (>=v0.6.4) * xmltodict (>=0.12.0) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **config** list / elements=dictionary | | The provided Routing instance configuration list. | | | **connector\_id\_advertise** boolean | **Choices:*** no * yes | Advertise connector-id attribute. | | | **description** string | | Specify text description of routing instance. | | | **egress\_protection** dictionary | | Egress instance protection dictionary. | | | | **context\_identifier** string | | Specify context identifier. | | | | **protector** boolean | **Choices:*** no * yes | Enable Edge Protector functionality for this VPN. | | | **instance\_role** string | **Choices:*** access * nni | Primary role of L2Backhaul-vpn router. | | | **interfaces** list / elements=dictionary | | Interface name for this routing instance. | | | | **name** string | | Specify name of the interface. | | | | **protect\_interface** string | | Specify name of the protected interface. | | | **l2vpn\_id** string | | Layer-2 vpn-id for this instance. | | | **name** string | | Specify routing instance name. | | | **no\_irb\_layer\_2\_copy** boolean | **Choices:*** no * yes | Disable transmission of layer-2 copy of packets of irb routing-interface. | | | **no\_local\_switching** boolean | **Choices:*** no * yes | Disable vlan id normalization for interfaces. | | | **no\_normalization** boolean | **Choices:*** no * yes | Disable vlan id normalization for interfaces. | | | **no\_vrf\_advertise** boolean | **Choices:*** no * yes | Disable vlan id normalization for interfaces. | | | **no\_vrf\_propagate\_ttl** boolean | **Choices:*** no * yes | Disable TTL propagation from IP to MPLS (on push) and MPLS to IP (on pop). | | | **qualified\_bum\_pruning\_mode** boolean | **Choices:*** no * yes | Enable BUM pruning for VPLS instance. | | | **route\_distinguisher** string | | Route distinguisher for this instance | | | **routing\_interface** list / elements=string | | Routing interface name for this routing-instance. | | | **type** string | **Choices:*** evpn * evpn-vpws * forwarding * l2backhaul-vpn * l2vpn * layer2-control * mpls-forwarding * mpls-internet-multicast * no-forwarding * virtual-router * vpls * vrf | Specify instance type. | | | **vrf\_exports** list / elements=string | | Export policy for VRF instance RIBs. | | | **vrf\_imports** list / elements=string | | Import policy for VRF instance RIBs. | | **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the Junos device by executing the command **show routing-instances**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result | | **state** string | **Choices:*** **merged** ← * replaced * overridden * deleted * parsed * gathered * rendered | The state the configuration should be left in. | Notes ----- Note * This module requires the netconf system service be enabled on the device being managed. * This module works with connection `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). * Tested against JunOS v18.4R1 Examples -------- ``` # Using merged # # Before state # ------------ # # admin# show routing-instances # # [edit] # vagrant@vsrx# show policy-options # policy-statement test-policy { # term t1 { # then reject; # } # } # policy-statement test-policy-1 { # term t1 { # then reject; # } # } - name: Merge Junos BGP address family configuration junipernetworks.junos.junos_routing_instances: config: - name: "test" type: "vrf" route_distinguisher: "10.58.255.1:37" vrf_imports: - "test-policy" vrf_exports: - "test-policy" - "test-policy-1" interfaces: - name: "sp-0/0/0.0" - name: "gr-0/0/0.0" connector_id_advertise: true - name: "forwardinst" type: "forwarding" description: "Configured by Ansible Content Team" state: merged # # ------------------------- # Module Execution Result # ------------------------- # # After state # ----------- # # admin# show routing-instances # forwardinst { # description "Configured by Ansible Content Team"; # instance-type forwarding; # } # test { # instance-type vrf; # interface gr-0/0/0.0; ## 'gr-0/0/0.0' is not defined # interface sp-0/0/0.0; ## 'sp-0/0/0.0' is not defined # route-distinguisher 10.58.255.1:37; # vrf-import test-policy; # vrf-export [ test-policy test-policy-1 ]; # connector-id-advertise; # } # # Using gathered # # Before state # ------------ # # admin# show routing-instances # # [edit] # admin# show routing-instances # forwardinst { # description "Configured by Ansible Content Team"; # instance-type forwarding; # } # test { # instance-type vrf; # interface gr-0/0/0.0; ## 'gr-0/0/0.0' is not defined # interface sp-0/0/0.0; ## 'sp-0/0/0.0' is not defined # route-distinguisher 10.58.255.1:37; # vrf-import test-policy; # vrf-export [ test-policy test-policy-1 ]; # connector-id-advertise; # } - name: Gather Junos routing-instances junipernetworks.junos.junos_routing_instances: state: gathered # # # ------------------------- # Module Execution Result # ------------------------- # # "gathered": [ # { # "description": "Configured by Ansible Content Team", # "name": "forwardinst", # "type": "forwarding" # }, # { # "connector_id_advertise": true, # "interfaces": [ # { # "name": "gr-0/0/0.0" # }, # { # "name": "sp-0/0/0.0" # } # ], # "name": "test", # "route_distinguisher": "10.58.255.1:37", # "type": "vrf", # "vrf_exports": [ # "test-policy", # "test-policy-1" # ], # "vrf_imports": [ # "test-policy" # ] # } # ] # # Using replaced # # Before state # ------------ # # admin# show routing-instances # forwardinst { # description "Configured by Ansible Content Team"; # instance-type forwarding; # } # test { # instance-type vrf; # interface gr-0/0/0.0; ## 'gr-0/0/0.0' is not defined # interface sp-0/0/0.0; ## 'sp-0/0/0.0' is not defined # route-distinguisher 10.58.255.1:37; # vrf-import test-policy; # vrf-export [ test-policy test-policy-1 ]; # connector-id-advertise; # } - name: Replace existing Junos routing instance config with provided config junipernetworks.junos.junos_routing_instances: config: address_family: - name: "test" type: "vrf" route_distinguisher: "10.57.255.1:37" vrf_imports: - "test-policy" vrf_exports: - "test-policy" interfaces: - name: "sp-0/0/0.0" - name: "gr-0/0/0.0" connector_id_advertise: false description: "Configured by Ansible Content Team" state: replaced # After state # ----------- # # admin@vsrx# show routing-instances # forwardinst { # description "Configured by Ansible Content Team"; # instance-type forwarding; # } # test { # description "Configured by Ansible Content Team"; # instance-type vrf; # interface gr-0/0/0.0; ## 'gr-0/0/0.0' is not defined # interface sp-0/0/0.0; ## 'sp-0/0/0.0' is not defined # route-distinguisher 10.57.255.1:37; # vrf-import test-policy; # vrf-export test-policy; # } # Using overridden # # Before state # ------------ # # admin@vsrx# show routing-instances # forwardinst { # description "Configured by Ansible Content Team"; # instance-type forwarding; # } # test { # description "Configured by Ansible Content Team"; # instance-type vrf; # interface gr-0/0/0.0; ## 'gr-0/0/0.0' is not defined # interface sp-0/0/0.0; ## 'sp-0/0/0.0' is not defined # route-distinguisher 10.57.255.1:37; # vrf-import test-policy; # vrf-export test-policy; # } - name: Override Junos routing-instances configuration junipernetworks.junos.junos_routing_instances: config: - name: "test" type: "vrf" route_distinguisher: "10.58.255.1:37" vrf_imports: - "test-policy" vrf_exports: - "test-policy" - "test-policy-1" interfaces: - name: "sp-0/0/0.0" - name: "gr-0/0/0.0" connector_id_advertise: true - name: "forwardinst" type: "forwarding" description: "Configured by Ansible Content Team" - name: "vtest1" type: "virtual-router" state: overridden # After state # ----------- # # admin@vsrx# show routing-instances # forwardinst { # description "Configured by Ansible Content Team"; # instance-type forwarding; # } # test { # instance-type vrf; # interface gr-0/0/0.0; ## 'gr-0/0/0.0' is not defined # interface sp-0/0/0.0; ## 'sp-0/0/0.0' is not defined # route-distinguisher 10.58.255.1:37; # vrf-import test-policy; # vrf-export [ test-policy test-policy-1 ]; # connector-id-advertise; # } # vtest1 { # instance-type virtual-router; # } # Using deleted # # Before state # ------------ # # admin@vsrx# show routing-instances # forwardinst { # description "Configured by Ansible Content Team"; # instance-type forwarding; # } # test { # instance-type vrf; # interface gr-0/0/0.0; ## 'gr-0/0/0.0' is not defined # interface sp-0/0/0.0; ## 'sp-0/0/0.0' is not defined # route-distinguisher 10.58.255.1:37; # vrf-import test-policy; # vrf-export [ test-policy test-policy-1 ]; # connector-id-advertise; # } - name: Delete provided junos routing-instamce junipernetworks.junos.junos_routing_instances: config: - name: "test" state: deleted # After state # ----------- # # admin@vsrx# show routing-instances # forwardinst { # description "Configured by Ansible Content Team"; # instance-type forwarding; # } # Using deleted without config # # Before state # ------------ # # admin@vsrx# show routing-instances # forwardinst { # description "Configured by Ansible Content Team"; # instance-type forwarding; # } # test { # instance-type vrf; # interface gr-0/0/0.0; ## 'gr-0/0/0.0' is not defined # interface sp-0/0/0.0; ## 'sp-0/0/0.0' is not defined # route-distinguisher 10.58.255.1:37; # vrf-import test-policy; # vrf-export [ test-policy test-policy-1 ]; # connector-id-advertise; # } # vtest1 { # instance-type virtual-router; # } - name: Delete complete Junos routing-instances config junipernetworks.junos.junos_routing_instances: config: state: deleted # After state # ----------- # # admin@vsrx# show routing-instances # # [edit] - name: Gather Junos BGP address family config junipernetworks.junos.junos_routing_instances: config: state: gathered # # # ------------------------- # Module Execution Result # ------------------------- # # "gathered": { # "address_family": [ # { # "af_type": [ # { # "accepted_prefix_limit": { # "idle_timeout_value": 2001, # "limit_threshold": 98, # "maximum": 20 # }, # "damping": true, # "defer_initial_multipath_build": { # "maximum_delay": 2 # }, # "type": "signaling" # } # ], # "afi": "evpn" # }, # { # "af_type": [ # { # "accepted_prefix_limit": { # "idle_timeout_value": 2000, # "limit_threshold": 99, # "maximum": 20 # }, # "damping": true, # "defer_initial_multipath_build": { # "maximum_delay": 2 # }, # "delay_route_advertisements": { # "max_delay_route_age": 20, # "max_delay_routing_uptime": 32000, # "min_delay_inbound_convergence": 32000, # "min_delay_routing_uptime": 23000 # }, # "graceful_restart_forwarding_state_bit": "from-fib", # "type": "any" # }, # { # "legacy_redirect_ip_action": { # "receive": true, # "send": true # }, # "loops": 4, # "no_install": true, # "output_queue_priority_expedited": true, # "secondary_independent_resolution": true, # "type": "flow" # }, # { # "entropy_label": { # "no_next_hop_validation": true # }, # "explicit_null": { # "connected_only": true # }, # "per_group_label": true, # "per_prefix_label": true, # "prefix_limit": { # "forever": true, # "limit_threshold": 99, # "maximum": 20 # }, # "resolve_vpn": true, # "rib": "inet.3", # "route_refresh_priority_priority": 3, # "type": "labeled-unicast" # }, # { # "extended_nexthop": true, # "extended_nexthop_color": true, # "local_ipv4_address": "9.9.9.9", # "type": "unicast" # } # ], # "afi": "inet" # } # ] # } # # Using parsed # parsed.cfg # ------------ # <?xml version="1.0" encoding="UTF-8"?> # <rpc-reply message-id="urn:uuid:0cadb4e8-5bba-47f4-986e-72906227007f"> # <configuration changed-seconds="1590139550" changed-localtime="2020-05-22 09:25:50 UTC"> # <version>18.4R1-S2.4</version> # <routing-instances> # <instance> # <name>forwardinst</name> # <description>Configured by Ansible Content Team</description> # <instance-type>forwarding</instance-type> # </instance> # <instance> # <name>test</name> # <instance-type>vrf</instance-type> # <interface> # <name>gr-0/0/0.0</name> # </interface> # <interface> # <name>sp-0/0/0.0</name> # </interface> # <route-distinguisher> # <rd-type>10.58.255.1:37</rd-type> # </route-distinguisher> # <vrf-import>test-policy</vrf-import> # <vrf-export>test-policy</vrf-export> # <vrf-export>test-policy-1</vrf-export> # <connector-id-advertise/> # </instance> # </routing-instances> # </configuration> # </rpc-reply> - name: Parse routing instance running config junipernetworks.junos.junos_routing_instances: running_config: "{{ lookup('file', './parsed.cfg') }}" state: parsed # # # ------------------------- # Module Execution Result # ------------------------- # # # "parsed": [ # { # "description": "Configured by Ansible Content Team", # "name": "forwardinst", # "type": "forwarding" # }, # { # "connector_id_advertise": true, # "interfaces": [ # { # "name": "gr-0/0/0.0" # }, # { # "name": "sp-0/0/0.0" # } # ], # "name": "test", # "route_distinguisher": "10.58.255.1:37", # "type": "vrf", # "vrf_exports": [ # "test-policy", # "test-policy-1" # ], # "vrf_imports": [ # "test-policy" # ] # } # ] # # # Using rendered # # - name: Render the xml for provided configuration junipernetworks.junos.junos_routing_instances: config: - name: "test" type: "vrf" route_distinguisher: "10.58.255.1:37" vrf_imports: - "test-policy" vrf_exports: - "test-policy" - "test-policy-1" interfaces: - name: "sp-0/0/0.0" - name: "gr-0/0/0.0" connector_id_advertise: true - name: "forwardinst" type: "forwarding" description: "Configured by Ansible Content Team" state: rendered # # # ------------------------- # Module Execution Result # ------------------------- # # # "rendered": "<nc:routing-instances xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> # <nc:instance><nc:name>test</nc:name><nc:connector-id-advertise/><nc:instance-type>vrf</nc:instance-type> # <nc:interface><nc:name>sp-0/0/0.0</nc:name></nc:interface><nc:interface><nc:name>gr-0/0/0.0</nc:name></nc:interface> # <nc:route-distinguisher><nc:rd-type>10.58.255.1:37</nc:rd-type></nc:route-distinguisher> # <nc:vrf-import>test-policy</nc:vrf-import><nc:vrf-export>test-policy</nc:vrf-export> # <nc:vrf-export>test-policy-1</nc:vrf-export></nc:instance> # <nc:instance><nc:name>forwardinst</nc:name><nc:description>Configured by Ansible Content Team</nc:description> # <nc:instance-type>forwarding</nc:instance-type></nc:instance></nc:routing-instances>" ``` 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 | | --- | --- | --- | | **after** list / elements=string | when changed | The resulting configuration model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **before** list / elements=string | always | The configuration prior to the model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['<nc:routing-instances xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:instance> <nc:name>test</nc:name> <nc:connector-id-advertise/> <nc:instance-type>vrf</nc:instance-type> <nc:interface> <nc:name>sp-0/0/0.0</nc:name> </nc:interface> <nc:interface> <nc:name>gr-0/0/0.0</nc:name> </nc:interface> <nc:route-distinguisher> <nc:rd-type>10.58.255.1:37</nc:rd-type> </nc:route-distinguisher> <nc:vrf-import>test-policy</nc:vrf-import> <nc:vrf-export>test-policy</nc:vrf-export> <nc:vrf-export>test-policy-1</nc:vrf-export> </nc:instance> </routing-instances> </configuration> </rpc-reply>', 'xml2', 'xml 3'] | ### Authors * Rohit Thakur (@rohitthakur2590)
programming_docs
ansible junipernetworks.junos.junos_ping – Tests reachability using ping from devices running Juniper JUNOS junipernetworks.junos.junos\_ping – Tests reachability using ping from devices running Juniper JUNOS ==================================================================================================== Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_ping`. New in version 1.0.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Tests reachability using ping from devices running Juniper JUNOS to a remote destination. * Tested against Junos (17.3R1.10) * For a general purpose network module, see the [ansible.netcommon.net\_ping](../../ansible/netcommon/net_ping_module#ansible-collections-ansible-netcommon-net-ping-module) module. * For Windows targets, use the [ansible.windows.win\_ping](../../ansible/windows/win_ping_module#ansible-collections-ansible-windows-win-ping-module) module instead. * For targets running Python, use the [ansible.builtin.ping](../../ansible/builtin/ping_module#ansible-collections-ansible-builtin-ping-module) module instead. Note This module has a corresponding [action plugin](../../../plugins/action#action-plugins). Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **count** integer | **Default:**5 | Number of packets to send to check reachability. | | **dest** string / required | | The IP Address or hostname (resolvable by the device) of the remote node. | | **df\_bit** boolean | **Choices:*** **no** ← * yes | Determines whether to set the DF bit. | | **interface** string | | The source interface to use while sending the ping packet(s). | | **interval** integer | | Determines the interval (in seconds) between consecutive pings. | | **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli` or `connection: netconf`. For more information please see the [Junos OS Platform Options guide](../network/user_guide/platform_junos). A dict object containing connection details. | | | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. | | | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. | | | **port** integer | | Specifies the port to use when building the connection to the remote device. The port value will default to the well known SSH port of 22 (for `transport=cli`) or port 830 (for `transport=netconf`) device. | | | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. | | | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. | | | **transport** string | **Choices:*** cli * **netconf** ← | Configures the transport connection to use when connecting to the remote device. | | | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. | | **rapid** boolean | **Choices:*** **no** ← * yes | Determines whether to send the packets rapidly. | | **size** integer | | Determines the size (in bytes) of the ping packet(s). | | **source** string | | The IP Address to use while sending the ping packet(s). | | **state** string | **Choices:*** absent * **present** ← | Determines if the expected result is success or fail. | | **ttl** integer | | The time-to-live value for the ICMP packet(s). | Notes ----- Note * For a general purpose network module, see the ansible.netcommon..net\_ping module. * For Windows targets, use the [ansible.windows.win\_ping](../../ansible/windows/win_ping_module#ansible-collections-ansible-windows-win-ping-module) module instead. * For targets running Python, use the [ansible.builtin.ping](../../ansible/builtin/ping_module#ansible-collections-ansible-builtin-ping-module) module instead. * This module works only with connection `network_cli`. * For information on using CLI and netconf see the [Junos OS Platform Options guide](../../../network/user_guide/platform_junos#junos-platform-options) * For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide) * For more information on using Ansible to manage Juniper network devices see <https://www.ansible.com/ansible-juniper>. Examples -------- ``` - name: Test reachability to 10.10.10.10 junipernetworks.junos.junos_ping: dest: 10.10.10.10 - name: Test reachability to 10.20.20.20 using source and size set junipernetworks.junos.junos_ping: dest: 10.20.20.20 size: 1024 ttl: 128 - name: Test unreachability to 10.30.30.30 using interval junipernetworks.junos.junos_ping: dest: 10.30.30.30 interval: 3 state: absent - name: Test reachability to 10.40.40.40 setting count and interface junipernetworks.junos.junos_ping: dest: 10.40.40.40 interface: fxp0 count: 20 size: 512 - name: Test reachability to 10.50.50.50 using do-not-fragment and rapid junipernetworks.junos.junos_ping: dest: 10.50.50.50 df_bit: True rapid: 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 | | --- | --- | --- | | **commands** list / elements=string | always | List of commands sent. **Sample:** ['ping 10.8.38.44 count 10 source 10.8.38.38 ttl 128'] | | **packet\_loss** string | always | Percentage of packets lost. **Sample:** 0% | | **packets\_rx** integer | always | Packets successfully received. **Sample:** 20 | | **packets\_tx** integer | always | Packets successfully transmitted. **Sample:** 20 | | **rtt** dictionary | when ping succeeds | The round trip time (RTT) stats. **Sample:** {'avg': 2, 'max': 8, 'min': 1, 'stddev': 24} | ### Authors * Nilashish Chakraborty (@NilashishC) ansible junipernetworks.junos.junos_rpc – Runs an arbitrary RPC over NetConf on an Juniper JUNOS device junipernetworks.junos.junos\_rpc – Runs an arbitrary RPC over NetConf on an Juniper JUNOS device ================================================================================================ Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_rpc`. New in version 1.0.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Sends a request to the remote device running JUNOS to execute the specified RPC using the NetConf transport. The reply is then returned to the playbook in the `xml` key. If an alternate output format is requested, the reply is transformed to the requested output. 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. * ncclient (>=v0.5.2) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **args** dictionary | | The `args` argument provides a set of arguments for the RPC call and are encoded in the request message. This argument accepts a set of key=value arguments. | | **attrs** dictionary | | The `attrs` arguments defines a list of attributes and their values to set for the RPC call. This accepts a dictionary of key-values. | | **output** string | **Choices:*** **xml** ← * json * text | The `output` argument specifies the desired output of the return data. This argument accepts one of `xml`, `text`, or `json`. For `json`, the JUNOS device must be running a version of software that supports native JSON output. | | **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli` or `connection: netconf`. For more information please see the [Junos OS Platform Options guide](../network/user_guide/platform_junos). A dict object containing connection details. | | | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. | | | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. | | | **port** integer | | Specifies the port to use when building the connection to the remote device. The port value will default to the well known SSH port of 22 (for `transport=cli`) or port 830 (for `transport=netconf`) device. | | | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. | | | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. | | | **transport** string | **Choices:*** cli * **netconf** ← | Configures the transport connection to use when connecting to the remote device. | | | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. | | **rpc** string / required | | The `rpc` argument specifies the RPC call to send to the remote devices to be executed. The RPC Reply message is parsed and the contents are returned to the playbook. | Notes ----- Note * This module requires the netconf system service be enabled on the remote device being managed. * Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. * Recommended connection is `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). * This module also works with `local` connections for legacy playbooks. * For information on using CLI and netconf see the [Junos OS Platform Options guide](../../../network/user_guide/platform_junos#junos-platform-options) * For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide) * For more information on using Ansible to manage Juniper network devices see <https://www.ansible.com/ansible-juniper>. Examples -------- ``` - name: collect interface information using rpc junipernetworks.junos.junos_rpc: rpc: get-interface-information args: interface-name: em0 media: true - name: get system information junipernetworks.junos.junos_rpc: rpc: get-system-information - name: load configuration junipernetworks.junos.junos_rpc: rpc: load-configuration attrs: action: override url: /tmp/config.conf ``` 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 | The rpc rely converted to the output format. | | **output\_lines** list / elements=string | always | The text output split into lines for readability. | | **xml** string | always | The xml return string from the rpc request. | ### Authors * Peter Sprygada (@privateip) ansible junipernetworks.junos.junos_ospfv2 – OSPFv2 resource module junipernetworks.junos.junos\_ospfv2 – OSPFv2 resource module ============================================================ Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_ospfv2`. New in version 1.0.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module manages global OSPFv2 configuration on devices running Juniper JUNOS. 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. * ncclient (>=v0.6.4) * xmltodict (>=0.12.0) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **config** list / elements=dictionary | | A list of OSPFv2 process configuration. | | | **areas** list / elements=dictionary | | A list of OSPFv2 areas' configuration. | | | | **area\_id** string / required | | The Area ID as an integer or IP Address. | | | | **area\_range** string | | Configure an address range for the area. | | | | **interfaces** list / elements=dictionary | | List of interfaces in this area. | | | | | **authentication** dictionary | | Specify authentication type | | | | | | **type** dictionary | | Type of authentication to use. | | | | | **bandwidth\_based\_metrics** list / elements=dictionary | | Specify list of bandwidth based metrics | | | | | | **bandwidth** string | **Choices:*** 1g * 10g | BW to apply metric to. | | | | | | **metric** integer | | Specify metric | | | | | **flood\_reduction** boolean | **Choices:*** no * yes | Enable flood reduction. | | | | | **metric** integer | | Metric applied to the interface. | | | | | **name** string / required | | Name of the interface. | | | | | **passive** boolean | **Choices:*** no * yes | Specify passive | | | | | **priority** integer | | Priority for the interface. | | | | | **timers** dictionary | | Specify timers | | | | | | **dead\_interval** integer | | Dead interval (seconds). | | | | | | **hello\_interval** integer | | Hello interval (seconds). | | | | | | **poll\_interval** integer | | Poll interval (seconds). | | | | | | **retransmit\_interval** integer | | Retransmit interval (seconds). | | | | | | **transit\_delay** integer | | Transit delay (seconds). | | | | **stub** dictionary | | Settings for configuring the area as a stub. | | | | | **default\_metric** integer | | Metric for the default route in this area. | | | | | **set** boolean | **Choices:*** no * yes | Configure the area as a stub. | | | **external\_preference** integer | | Preference of external routes. | | | **overload** dictionary | | Specify time for overload mode reset | | | | **timeout** integer | | Time after which overload mode is reset (seconds). | | | **preference** integer | | Preference of internal routes. | | | **prefix\_export\_limit** integer | | Maximum number of external prefixes that can be exported. | | | **reference\_bandwidth** string | **Choices:*** 1g * 10g | Bandwidth for calculating metric defaults. | | | **rfc1583compatibility** boolean | **Choices:*** no * yes | Set RFC1583 compatibility | | | **router\_id** string | | The OSPFv2 router id. This option is DEPRECATED and will be replaced with router\_id attribute of junos\_routing\_options resource\_module. This attribute will be removed after 2024-01-01. | | | **spf\_options** dictionary | | Configure options for SPF. | | | | **delay** integer | | Time to wait before running an SPF (seconds). | | | | **holddown** integer | | Time to hold down before running an SPF (seconds). | | | | **rapid\_runs** integer | | Number of maximum rapid SPF runs before holddown (seconds). | | **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the Junos device by executing the command B(show protocols ospf. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result | | **state** string | **Choices:*** **merged** ← * replaced * overridden * deleted * gathered * rendered * parsed | The state the configuration should be left in. | Notes ----- Note * This module requires the netconf system service be enabled on the device being managed. * This module works with connection `netconf`. * See [the Junos OS Platform Options](../../../network/user_guide/platform_junos). * Tested against JunOS v18.4R1 Examples -------- ``` # Using merged # # Before state # ------------ # # admin# show protocols ospf - name: Merge Junos OSPFv2 config junipernetworks.junos.junos_ospfv2: config: - reference_bandwidth: 10g areas: - area_id: 0.0.0.100 area_range: 10.200.16.0/24 stub: default_metric: 100 set: true interfaces: - name: so-0/0/0.0 priority: 3 metric: 5 flood_reduction: false passive: true bandwidth_based_metrics: - bandwidth: 1g metric: 5 - bandwidth: 10g metric: 40 timers: dead_interval: 4 hello_interval: 2 poll_interval: 2 retransmit_interval: 2 rfc1583compatibility: false state: merged # After state # ----------- # # admin# show protocols ospf # reference-bandwidth 10g; # no-rfc-1583; # area 0.0.0.100 { # stub default-metric 100; # area-range 10.200.16.0/24; # interface so-0/0/0.0 { # passive; # bandwidth-based-metrics { # bandwidth 1g metric 5; # bandwidth 10g metric 40; # } # metric 5; # priority 3; # retransmit-interval 2; # hello-interval 2; # dead-interval 4; # poll-interval 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 | | --- | --- | --- | | **after** dictionary | when changed | The resulting configuration model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **before** dictionary | always | The configuration prior to the model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['command 1', 'command 2', 'command 3'] | ### Authors * Daniel Mellado (@dmellado)
programming_docs
ansible junipernetworks.junos.junos_bgp_address_family – Manage BGP Address Family attributes of interfaces on Junos devices. junipernetworks.junos.junos\_bgp\_address\_family – Manage BGP Address Family attributes of interfaces on Junos devices. ======================================================================================================================== Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_bgp_address_family`. New in version 1.3.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Manage BGP Address Family attributes of interfaces on Junos network devices. 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. * ncclient (>=v0.6.4) * xmltodict (>=0.12.0) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **config** dictionary | | The provided link BGP address family dictionary. | | | **address\_family** list / elements=dictionary | | Enable address family and enter its config mode. | | | | **af\_type** list / elements=dictionary | | Address family type for ipv4. | | | | | **accepted\_prefix\_limit** dictionary | | Specify limit for maximum number of prefixes accepted from a peer. | | | | | | **forever** boolean | **Choices:*** no * yes | Idle the peer until the user intervenes. | | | | | | **idle\_timeout** boolean | **Choices:*** no * yes | Set idle timeout node. | | | | | | **idle\_timeout\_value** integer | | Specify timeout before attempting to restart peer. | | | | | | **limit\_threshold** integer | | Specify teardown percentage of prefix-limit to start warnings. | | | | | | **maximum** integer | | Specify maximum number of prefixes accepted from a peer. | | | | | | **teardown** boolean | **Choices:*** no * yes | Clear peer connection on reaching limit. | | | | | **add\_path** dictionary | | Advertise multiple paths to peer. | | | | | | **receive** boolean | **Choices:*** no * yes | Receive multiple paths from peer. | | | | | | **send** dictionary | | Send multiple paths to peer. | | | | | | | **include\_backup\_path** integer | | Specify number of backup paths to advertise. | | | | | | | **multipath** boolean | **Choices:*** no * yes | Include only multipath contributor routes. | | | | | | | **path\_count** integer / required | | Include only multipath contributor routes. | | | | | | | **path\_selection\_mode** dictionary | | Configure how to select add-path routes. | | | | | | | | **all\_paths** boolean | **Choices:*** no * yes | Advertise all paths allowed by path count. | | | | | | | | **equal\_cost\_paths** boolean | **Choices:*** no * yes | Advertise equal cost paths. | | | | | | | **prefix\_policy** string | | Perform add-path only for prefixes that match policy. | | | | | **aggregate\_label** dictionary | | Aggregate labels of incoming routes with the same FEC. | | | | | | **community** string | | Community to identify the FEC of incoming routesC. | | | | | | **set** boolean | **Choices:*** no * yes | Set Aggregate labels of incoming routes with the same FEC | | | | | **aigp** dictionary | | Allow sending and receiving of AIGP attribute. | | | | | | **disable** boolean | **Choices:*** no * yes | Dn not allow sending and receiving of AIGP attribute. | | | | | | **set** boolean | **Choices:*** no * yes | Set AIGP. | | | | | **damping** boolean | **Choices:*** no * yes | Enable route flap damping. | | | | | **defer\_initial\_multipath\_build** dictionary | | Defer initial multipath build until EOR is received. | | | | | | **maximum\_delay** integer | | Max delay(sec) multipath build after peer is up. | | | | | | **set** boolean | **Choices:*** no * yes | Set defer initial multipath build. | | | | | **delay\_route\_advertisements** dictionary | | Delay route updates for this family until FIB-sync. | | | | | | **max\_delay\_route\_age** integer | | Set max delay advertisement route age. | | | | | | **max\_delay\_routing\_uptime** integer | | Set max delay advertisement route age. | | | | | | **min\_delay\_inbound\_convergence** integer | | Set min delayadvertisement after source-peer sent all routes. | | | | | | **min\_delay\_routing\_uptime** integer | | Set min delay advertisement route age. | | | | | | **set** boolean | **Choices:*** no * yes | Set delay route advertisements. | | | | | **entropy\_label** dictionary | | Use entropy label for entropy label capable BGP LSPs. | | | | | | **import** string | | Policy to select BGP LSPs to use entropy label. | | | | | | **no\_next\_hop\_validation** boolean | **Choices:*** no * yes | Don't validate next hop field against route next hop. | | | | | | **set** boolean | **Choices:*** no * yes | Set entropy-label attribute. | | | | | **explicit\_null** dictionary | | Advertise explicit null. | | | | | | **connected\_only** boolean | **Choices:*** no * yes | Advertise explicit null only for connected routes. | | | | | | **set** boolean | **Choices:*** no * yes | Set explicit-null attribute. | | | | | **extended\_nexthop** boolean | **Choices:*** no * yes | Enable extended nexthop encoding. | | | | | **extended\_nexthop\_color** boolean | **Choices:*** no * yes | Resolve using extended color nexthop. | | | | | **graceful\_restart\_forwarding\_state\_bit** string | **Choices:*** from-fib * set | Specify BGP graceful restart options. | | | | | **legacy\_redirect\_ip\_action** dictionary | | Configure legacy redirect to IP support. | | | | | | **receive** boolean | **Choices:*** no * yes | Accept legacy encoded redirect-to-ip action attribute | | | | | | **send** boolean | **Choices:*** no * yes | Advertise Redirect action as legacy redirect attribute. | | | | | | **set** boolean | **Choices:*** no * yes | Set the legacy-redirect-ip-action. | | | | | **local\_ipv4\_address** string | | Specify local IPv4 address. | | | | | **loops** integer | | Allow local AS in received AS paths. | | | | | **no\_install** boolean | **Choices:*** no * yes | Dont install received routes in forwarding. | | | | | **no\_validate** string | | Bypass validation procedure for routes that match policy. | | | | | **output\_queue\_priority\_expedited** boolean | **Choices:*** no * yes | Expedited queue; highest priority. | | | | | **output\_queue\_priority\_priority** integer | | Output queue priority; higher is better. | | | | | **per\_group\_label** boolean | **Choices:*** no * yes | Advertise prefixes with unique labels per group. | | | | | **per\_prefix\_label** boolean | **Choices:*** no * yes | Allocate a unique label to each advertised prefix. | | | | | **prefix\_limit** dictionary | | Limit maximum number of prefixes from a peer. | | | | | | **forever** boolean | **Choices:*** no * yes | Idle the peer until the user intervenes. | | | | | | **idle\_timeout** boolean | **Choices:*** no * yes | Set idle timeout node. | | | | | | **idle\_timeout\_value** integer | | Specify timeout before attempting to restart peer. | | | | | | **limit\_threshold** integer | | Percentage of prefix-limit to start warnings. | | | | | | **maximum** integer | | Specify maximum number of prefixes from a peer. | | | | | | **teardown** boolean | **Choices:*** no * yes | Clear peer connection on reaching limit. | | | | | **resolve\_vpn** boolean | **Choices:*** no * yes | Install received NLRI in inet.3 also. | | | | | **rib** string | **Choices:*** inet.3 | Select table used by labeled unicast routes. | | | | | **ribgroup\_name** string | | Name of the routing table group. | | | | | **route\_refresh\_priority\_expedited** boolean | **Choices:*** no * yes | Expedited queue; highest priority. | | | | | **route\_refresh\_priority\_priority** integer | | Output queue priority; higher is better. | | | | | **secondary\_independent\_resolution** boolean | **Choices:*** no * yes | Resolve FLOW routes in VRF table independent of VPN FLOW route. | | | | | **set** boolean | **Choices:*** no * yes | Set NLRI. | | | | | **strip\_nexthop** boolean | **Choices:*** no * yes | Strip the next-hop from the outgoing flow update. | | | | | **topology** list / elements=dictionary | | Multi topology routing tables. | | | | | | **community** list / elements=string | | Community to identify multi topology routes. | | | | | | **name** string | | Specify topology name. | | | | | **traffic\_statistics** dictionary | | Collect statistics for BGP label-switched paths | | | | | | **file** dictionary | | Statistics file options. | | | | | | | **filename** string | | Name of file in which to write trace information. | | | | | | | **files** integer | | Maximum number of trace files. | | | | | | | **no\_world\_readable** boolean | **Choices:*** no * yes | Don't allow any user to read the log file. | | | | | | | **size** integer | | Maximum trace file size. | | | | | | | **world\_readable** boolean | **Choices:*** no * yes | Don't allow any user to read the log file. | | | | | | **interval** integer | | Time to collect statistics (seconds). | | | | | | **labeled\_path** boolean | **Choices:*** no * yes | Enable ingress labeled path statistics. | | | | | | **set** boolean | **Choices:*** no * yes | Set traffic-statistics. | | | | | **type** string | **Choices:*** any * flow * labeled-unicast * multicast * segment-routing-te * unicast * signaling * auto-discovery-mspw * auto-discovery-only | Specify type of NLRI. | | | | | **withdraw\_priority\_expedited** boolean | **Choices:*** no * yes | Expedited queue; highest priority. | | | | | **withdraw\_priority\_priority** integer | | Output queue priority; higher is better. | | | | **afi** string | **Choices:*** evpn * inet * inet-mdt * inet-mvpn * inet-vpn * inet6 * inet6-mvpn * inet6-vpn * iso-vpn * l2vpn * route-target * traffic-engineering | address family. | | | **groups** list / elements=dictionary | | Specify address family config for groups. | | | | **address\_family** list / elements=dictionary | | Enable address family and enter its config mode. | | | | | **af\_type** list / elements=dictionary | | Address family type for ipv4. | | | | | | **accepted\_prefix\_limit** dictionary | | Specify limit for maximum number of prefixes accepted from a peer. | | | | | | | **forever** boolean | **Choices:*** no * yes | Idle the peer until the user intervenes. | | | | | | | **idle\_timeout** boolean | **Choices:*** no * yes | Set idle timeout node. | | | | | | | **idle\_timeout\_value** integer | | Specify timeout before attempting to restart peer. | | | | | | | **limit\_threshold** integer | | Specify teardown percentage of prefix-limit to start warnings. | | | | | | | **maximum** integer | | Specify maximum number of prefixes accepted from a peer. | | | | | | | **teardown** boolean | **Choices:*** no * yes | Clear peer connection on reaching limit. | | | | | | **add\_path** dictionary | | Advertise multiple paths to peer. | | | | | | | **receive** boolean | **Choices:*** no * yes | Receive multiple paths from peer. | | | | | | | **send** dictionary | | Send multiple paths to peer. | | | | | | | | **include\_backup\_path** integer | | Specify number of backup paths to advertise. | | | | | | | | **multipath** boolean | **Choices:*** no * yes | Include only multipath contributor routes. | | | | | | | | **path\_count** integer / required | | Include only multipath contributor routes. | | | | | | | | **path\_selection\_mode** dictionary | | Configure how to select add-path routes. | | | | | | | | | **all\_paths** boolean | **Choices:*** no * yes | Advertise all paths allowed by path count. | | | | | | | | | **equal\_cost\_paths** boolean | **Choices:*** no * yes | Advertise equal cost paths. | | | | | | | | **prefix\_policy** string | | Perform add-path only for prefixes that match policy. | | | | | | **aggregate\_label** dictionary | | Aggregate labels of incoming routes with the same FEC. | | | | | | | **community** string | | Community to identify the FEC of incoming routesC. | | | | | | | **set** boolean | **Choices:*** no * yes | Set Aggregate labels of incoming routes with the same FEC | | | | | | **aigp** dictionary | | Allow sending and receiving of AIGP attribute. | | | | | | | **disable** boolean | **Choices:*** no * yes | Dn not allow sending and receiving of AIGP attribute. | | | | | | | **set** boolean | **Choices:*** no * yes | Set AIGP. | | | | | | **damping** boolean | **Choices:*** no * yes | Enable route flap damping. | | | | | | **defer\_initial\_multipath\_build** dictionary | | Defer initial multipath build until EOR is received. | | | | | | | **maximum\_delay** integer | | Max delay(sec) multipath build after peer is up. | | | | | | | **set** boolean | **Choices:*** no * yes | Set defer initial multipath build. | | | | | | **delay\_route\_advertisements** dictionary | | Delay route updates for this family until FIB-sync. | | | | | | | **max\_delay\_route\_age** integer | | Set max delay advertisement route age. | | | | | | | **max\_delay\_routing\_uptime** integer | | Set max delay advertisement route age. | | | | | | | **min\_delay\_inbound\_convergence** integer | | Set min delayadvertisement after source-peer sent all routes. | | | | | | | **min\_delay\_routing\_uptime** integer | | Set min delay advertisement route age. | | | | | | | **set** boolean | **Choices:*** no * yes | Set delay route advertisements. | | | | | | **entropy\_label** dictionary | | Use entropy label for entropy label capable BGP LSPs. | | | | | | | **import** string | | Policy to select BGP LSPs to use entropy label. | | | | | | | **no\_next\_hop\_validation** boolean | **Choices:*** no * yes | Don't validate next hop field against route next hop. | | | | | | | **set** boolean | **Choices:*** no * yes | Set entropy-label attribute. | | | | | | **explicit\_null** dictionary | | Advertise explicit null. | | | | | | | **connected\_only** boolean | **Choices:*** no * yes | Advertise explicit null only for connected routes. | | | | | | | **set** boolean | **Choices:*** no * yes | Set explicit-null attribute. | | | | | | **extended\_nexthop** boolean | **Choices:*** no * yes | Enable extended nexthop encoding. | | | | | | **extended\_nexthop\_color** boolean | **Choices:*** no * yes | Resolve using extended color nexthop. | | | | | | **graceful\_restart\_forwarding\_state\_bit** string | **Choices:*** from-fib * set | Specify BGP graceful restart options. | | | | | | **legacy\_redirect\_ip\_action** dictionary | | Configure legacy redirect to IP support. | | | | | | | **receive** boolean | **Choices:*** no * yes | Accept legacy encoded redirect-to-ip action attribute | | | | | | | **send** boolean | **Choices:*** no * yes | Advertise Redirect action as legacy redirect attribute. | | | | | | | **set** boolean | **Choices:*** no * yes | Set the legacy-redirect-ip-action. | | | | | | **local\_ipv4\_address** string | | Specify local IPv4 address. | | | | | | **loops** integer | | Allow local AS in received AS paths. | | | | | | **no\_install** boolean | **Choices:*** no * yes | Dont install received routes in forwarding. | | | | | | **no\_validate** string | | Bypass validation procedure for routes that match policy. | | | | | | **output\_queue\_priority\_expedited** boolean | **Choices:*** no * yes | Expedited queue; highest priority. | | | | | | **output\_queue\_priority\_priority** integer | | Output queue priority; higher is better. | | | | | | **per\_group\_label** boolean | **Choices:*** no * yes | Advertise prefixes with unique labels per group. | | | | | | **per\_prefix\_label** boolean | **Choices:*** no * yes | Allocate a unique label to each advertised prefix. | | | | | | **prefix\_limit** dictionary | | Limit maximum number of prefixes from a peer. | | | | | | | **forever** boolean | **Choices:*** no * yes | Idle the peer until the user intervenes. | | | | | | | **idle\_timeout** boolean | **Choices:*** no * yes | Set idle timeout node. | | | | | | | **idle\_timeout\_value** integer | | Specify timeout before attempting to restart peer. | | | | | | | **limit\_threshold** integer | | Percentage of prefix-limit to start warnings. | | | | | | | **maximum** integer | | Specify maximum number of prefixes from a peer. | | | | | | | **teardown** boolean | **Choices:*** no * yes | Clear peer connection on reaching limit. | | | | | | **resolve\_vpn** boolean | **Choices:*** no * yes | Install received NLRI in inet.3 also. | | | | | | **rib** string | **Choices:*** inet.3 | Select table used by labeled unicast routes. | | | | | | **ribgroup\_name** string | | Name of the routing table group. | | | | | | **route\_refresh\_priority\_expedited** boolean | **Choices:*** no * yes | Expedited queue; highest priority. | | | | | | **route\_refresh\_priority\_priority** integer | | Output queue priority; higher is better. | | | | | | **secondary\_independent\_resolution** boolean | **Choices:*** no * yes | Resolve FLOW routes in VRF table independent of VPN FLOW route. | | | | | | **set** boolean | **Choices:*** no * yes | Set NLRI. | | | | | | **strip\_nexthop** boolean | **Choices:*** no * yes | Strip the next-hop from the outgoing flow update. | | | | | | **topology** list / elements=dictionary | | Multi topology routing tables. | | | | | | | **community** list / elements=string | | Community to identify multi topology routes. | | | | | | | **name** string | | Specify topology name. | | | | | | **traffic\_statistics** dictionary | | Collect statistics for BGP label-switched paths | | | | | | | **file** dictionary | | Statistics file options. | | | | | | | | **filename** string | | Name of file in which to write trace information. | | | | | | | | **files** integer | | Maximum number of trace files. | | | | | | | | **no\_world\_readable** boolean | **Choices:*** no * yes | Don't allow any user to read the log file. | | | | | | | | **size** integer | | Maximum trace file size. | | | | | | | | **world\_readable** boolean | **Choices:*** no * yes | Don't allow any user to read the log file. | | | | | | | **interval** integer | | Time to collect statistics (seconds). | | | | | | | **labeled\_path** boolean | **Choices:*** no * yes | Enable ingress labeled path statistics. | | | | | | | **set** boolean | **Choices:*** no * yes | Set traffic-statistics. | | | | | | **type** string | **Choices:*** any * flow * labeled-unicast * multicast * segment-routing-te * unicast * signaling * auto-discovery-mspw * auto-discovery-only | Specify type of NLRI. | | | | | | **withdraw\_priority\_expedited** boolean | **Choices:*** no * yes | Expedited queue; highest priority. | | | | | | **withdraw\_priority\_priority** integer | | Output queue priority; higher is better. | | | | | **afi** string | **Choices:*** evpn * inet * inet-mdt * inet-mvpn * inet-vpn * inet6 * inet6-mvpn * inet6-vpn * iso-vpn * l2vpn * route-target * traffic-engineering | address family. | | | | **name** string | | Specify name of the group | | | | **neighbors** list / elements=dictionary | | Specify address family config per neighbor. | | | | | **address\_family** list / elements=dictionary | | Enable address family and enter its config mode. | | | | | | **af\_type** list / elements=dictionary | | Address family type for ipv4. | | | | | | | **accepted\_prefix\_limit** dictionary | | Specify limit for maximum number of prefixes accepted from a peer. | | | | | | | | **forever** boolean | **Choices:*** no * yes | Idle the peer until the user intervenes. | | | | | | | | **idle\_timeout** boolean | **Choices:*** no * yes | Set idle timeout node. | | | | | | | | **idle\_timeout\_value** integer | | Specify timeout before attempting to restart peer. | | | | | | | | **limit\_threshold** integer | | Specify teardown percentage of prefix-limit to start warnings. | | | | | | | | **maximum** integer | | Specify maximum number of prefixes accepted from a peer. | | | | | | | | **teardown** boolean | **Choices:*** no * yes | Clear peer connection on reaching limit. | | | | | | | **add\_path** dictionary | | Advertise multiple paths to peer. | | | | | | | | **receive** boolean | **Choices:*** no * yes | Receive multiple paths from peer. | | | | | | | | **send** dictionary | | Send multiple paths to peer. | | | | | | | | | **include\_backup\_path** integer | | Specify number of backup paths to advertise. | | | | | | | | | **multipath** boolean | **Choices:*** no * yes | Include only multipath contributor routes. | | | | | | | | | **path\_count** integer / required | | Include only multipath contributor routes. | | | | | | | | | **path\_selection\_mode** dictionary | | Configure how to select add-path routes. | | | | | | | | | | **all\_paths** boolean | **Choices:*** no * yes | Advertise all paths allowed by path count. | | | | | | | | | | **equal\_cost\_paths** boolean | **Choices:*** no * yes | Advertise equal cost paths. | | | | | | | | | **prefix\_policy** string | | Perform add-path only for prefixes that match policy. | | | | | | | **aggregate\_label** dictionary | | Aggregate labels of incoming routes with the same FEC. | | | | | | | | **community** string | | Community to identify the FEC of incoming routesC. | | | | | | | | **set** boolean | **Choices:*** no * yes | Set Aggregate labels of incoming routes with the same FEC | | | | | | | **aigp** dictionary | | Allow sending and receiving of AIGP attribute. | | | | | | | | **disable** boolean | **Choices:*** no * yes | Dn not allow sending and receiving of AIGP attribute. | | | | | | | | **set** boolean | **Choices:*** no * yes | Set AIGP. | | | | | | | **damping** boolean | **Choices:*** no * yes | Enable route flap damping. | | | | | | | **defer\_initial\_multipath\_build** dictionary | | Defer initial multipath build until EOR is received. | | | | | | | | **maximum\_delay** integer | | Max delay(sec) multipath build after peer is up. | | | | | | | | **set** boolean | **Choices:*** no * yes | Set defer initial multipath build. | | | | | | | **delay\_route\_advertisements** dictionary | | Delay route updates for this family until FIB-sync. | | | | | | | | **max\_delay\_route\_age** integer | | Set max delay advertisement route age. | | | | | | | | **max\_delay\_routing\_uptime** integer | | Set max delay advertisement route age. | | | | | | | | **min\_delay\_inbound\_convergence** integer | | Set min delayadvertisement after source-peer sent all routes. | | | | | | | | **min\_delay\_routing\_uptime** integer | | Set min delay advertisement route age. | | | | | | | | **set** boolean | **Choices:*** no * yes | Set delay route advertisements. | | | | | | | **entropy\_label** dictionary | | Use entropy label for entropy label capable BGP LSPs. | | | | | | | | **import** string | | Policy to select BGP LSPs to use entropy label. | | | | | | | | **no\_next\_hop\_validation** boolean | **Choices:*** no * yes | Don't validate next hop field against route next hop. | | | | | | | | **set** boolean | **Choices:*** no * yes | Set entropy-label attribute. | | | | | | | **explicit\_null** dictionary | | Advertise explicit null. | | | | | | | | **connected\_only** boolean | **Choices:*** no * yes | Advertise explicit null only for connected routes. | | | | | | | | **set** boolean | **Choices:*** no * yes | Set explicit-null attribute. | | | | | | | **extended\_nexthop** boolean | **Choices:*** no * yes | Enable extended nexthop encoding. | | | | | | | **extended\_nexthop\_color** boolean | **Choices:*** no * yes | Resolve using extended color nexthop. | | | | | | | **graceful\_restart\_forwarding\_state\_bit** string | **Choices:*** from-fib * set | Specify BGP graceful restart options. | | | | | | | **legacy\_redirect\_ip\_action** dictionary | | Configure legacy redirect to IP support. | | | | | | | | **receive** boolean | **Choices:*** no * yes | Accept legacy encoded redirect-to-ip action attribute | | | | | | | | **send** boolean | **Choices:*** no * yes | Advertise Redirect action as legacy redirect attribute. | | | | | | | | **set** boolean | **Choices:*** no * yes | Set the legacy-redirect-ip-action. | | | | | | | **local\_ipv4\_address** string | | Specify local IPv4 address. | | | | | | | **loops** integer | | Allow local AS in received AS paths. | | | | | | | **no\_install** boolean | **Choices:*** no * yes | Dont install received routes in forwarding. | | | | | | | **no\_validate** string | | Bypass validation procedure for routes that match policy. | | | | | | | **output\_queue\_priority\_expedited** boolean | **Choices:*** no * yes | Expedited queue; highest priority. | | | | | | | **output\_queue\_priority\_priority** integer | | Output queue priority; higher is better. | | | | | | | **per\_group\_label** boolean | **Choices:*** no * yes | Advertise prefixes with unique labels per group. | | | | | | | **per\_prefix\_label** boolean | **Choices:*** no * yes | Allocate a unique label to each advertised prefix. | | | | | | | **prefix\_limit** dictionary | | Limit maximum number of prefixes from a peer. | | | | | | | | **forever** boolean | **Choices:*** no * yes | Idle the peer until the user intervenes. | | | | | | | | **idle\_timeout** boolean | **Choices:*** no * yes | Set idle timeout node. | | | | | | | | **idle\_timeout\_value** integer | | Specify timeout before attempting to restart peer. | | | | | | | | **limit\_threshold** integer | | Percentage of prefix-limit to start warnings. | | | | | | | | **maximum** integer | | Specify maximum number of prefixes from a peer. | | | | | | | | **teardown** boolean | **Choices:*** no * yes | Clear peer connection on reaching limit. | | | | | | | **resolve\_vpn** boolean | **Choices:*** no * yes | Install received NLRI in inet.3 also. | | | | | | | **rib** string | **Choices:*** inet.3 | Select table used by labeled unicast routes. | | | | | | | **ribgroup\_name** string | | Name of the routing table group. | | | | | | | **route\_refresh\_priority\_expedited** boolean | **Choices:*** no * yes | Expedited queue; highest priority. | | | | | | | **route\_refresh\_priority\_priority** integer | | Output queue priority; higher is better. | | | | | | | **secondary\_independent\_resolution** boolean | **Choices:*** no * yes | Resolve FLOW routes in VRF table independent of VPN FLOW route. | | | | | | | **set** boolean | **Choices:*** no * yes | Set NLRI. | | | | | | | **strip\_nexthop** boolean | **Choices:*** no * yes | Strip the next-hop from the outgoing flow update. | | | | | | | **topology** list / elements=dictionary | | Multi topology routing tables. | | | | | | | | **community** list / elements=string | | Community to identify multi topology routes. | | | | | | | | **name** string | | Specify topology name. | | | | | | | **traffic\_statistics** dictionary | | Collect statistics for BGP label-switched paths | | | | | | | | **file** dictionary | | Statistics file options. | | | | | | | | | **filename** string | | Name of file in which to write trace information. | | | | | | | | | **files** integer | | Maximum number of trace files. | | | | | | | | | **no\_world\_readable** boolean | **Choices:*** no * yes | Don't allow any user to read the log file. | | | | | | | | | **size** integer | | Maximum trace file size. | | | | | | | | | **world\_readable** boolean | **Choices:*** no * yes | Don't allow any user to read the log file. | | | | | | | | **interval** integer | | Time to collect statistics (seconds). | | | | | | | | **labeled\_path** boolean | **Choices:*** no * yes | Enable ingress labeled path statistics. | | | | | | | | **set** boolean | **Choices:*** no * yes | Set traffic-statistics. | | | | | | | **type** string | **Choices:*** any * flow * labeled-unicast * multicast * segment-routing-te * unicast * signaling * auto-discovery-mspw * auto-discovery-only | Specify type of NLRI. | | | | | | | **withdraw\_priority\_expedited** boolean | **Choices:*** no * yes | Expedited queue; highest priority. | | | | | | | **withdraw\_priority\_priority** integer | | Output queue priority; higher is better. | | | | | | **afi** string | **Choices:*** evpn * inet * inet-mdt * inet-mvpn * inet-vpn * inet6 * inet6-mvpn * inet6-vpn * iso-vpn * l2vpn * route-target * traffic-engineering | address family. | | | | | **neighbor\_address** string | | Specify neighbor address. | | **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the Junos device by executing the command **show protocols bgp**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result | | **state** string | **Choices:*** **merged** ← * replaced * overridden * deleted * parsed * gathered * rendered | The state the configuration should be left in. State *deleted* only removes BGP address family attributes that this modules manages and does not negate the BGP neighbor address family completely. Thereby, preserving address-family related configurations under BGP group neighbor context. To delete the address family associated to neighbor use [junipernetworks.junos.junos\_bgp\_neighbor\_address\_family](junos_bgp_neighbor_address_family_module) modules for prior cleanup. Refer to examples for more details. | Notes ----- Note * This module requires the netconf system service be enabled on the device being managed. * This module works with connection `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). * Tested against JunOS v18.4R1 Examples -------- ``` # Using merged # # Before state # ------------ # # admin# show protocols bgp # # [edit] - name: Merge Junos BGP address family configuration junipernetworks.junos.junos_bgp_address_family: config: address_family: - afi: 'evpn' af_type: - type: 'signaling' accepted_prefix_limit: maximum: 20 limit_threshold: 98 idle_timeout_value: 2001 damping: true defer_initial_multipath_build: maximum_delay: 2 - afi: 'inet' af_type: - type: 'flow' legacy_redirect_ip_action: send: true receive: true loops: 4 no_install: true output_queue_priority_expedited: true secondary_independent_resolution: true - type: 'unicast' extended_nexthop: true extended_nexthop_color: true local_ipv4_address: '9.9.9.9' - type: 'labeled-unicast' entropy_label: no_next_hop_validation: true explicit_null: connected_only: true per_prefix_label: true per_group_label: true prefix_limit: maximum: 20 limit_threshold: 99 forever: true resolve_vpn: true rib: 'inet.3' route_refresh_priority_expedited: true route_refresh_priority_priority: 3 - type: 'any' accepted_prefix_limit: maximum: 20 limit_threshold: 99 idle_timeout_value: 2000 damping: true defer_initial_multipath_build: maximum_delay: 2 delay_route_advertisements: max_delay_route_age: 20 max_delay_routing_uptime: 32000 min_delay_inbound_convergence: 32000 min_delay_routing_uptime: 23000 graceful_restart_forwarding_state_bit: 'from-fib' state: merged # After state # ----------- # # admin# show protocols bgp # family inet { # unicast { # local-ipv4-address 9.9.9.9; # extended-nexthop; # extended-nexthop-color; # } # flow { # loops 4; # no-install; # output-queue-priority expedited; # legacy-redirect-ip-action { # receive; # send; # } # secondary-independent-resolution; # } # any { # accepted-prefix-limit { # maximum 20; # teardown 99 idle-timeout 2000; # } # damping; # delay-route-advertisements { # minimum-delay { # routing-uptime 23000; # inbound-convergence 32000; # } # maximum-delay { # route-age 20; # routing-uptime 32000; # } # } # defer-initial-multipath-build { # maximum-delay 2; # } # graceful-restart { # forwarding-state-bit from-fib; # } # } # labeled-unicast { # prefix-limit { # maximum 20; # teardown 99 idle-timeout forever; # } # route-refresh-priority priority 3; # per-prefix-label; # per-group-label; # rib { # inet.3; # } # explicit-null connected-only; # resolve-vpn; # entropy-label { # no-next-hop-validation; # } # } # } # family evpn { # signaling { # accepted-prefix-limit { # maximum 20; # teardown 98 idle-timeout 2001; # } # damping; # defer-initial-multipath-build { # maximum-delay 2; # } # } # } # Using replaced # # Before state # ------------ # # admin# show protocols bgp # preference 2; # hold-time 5; # advertise-inactive; # out-delay 10; # bgp-error-tolerance { # malformed-route-limit 40000000; # } # authentication-algorithm md5; # advertise-bgp-static { # policy static-to-bgp; # } # family inet { # unicast { # local-ipv4-address 9.9.9.9; # extended-nexthop; # extended-nexthop-color; # } # flow { # loops 4; # no-install; # output-queue-priority expedited; # legacy-redirect-ip-action { # receive; # send; # } # secondary-independent-resolution; # } # any { # accepted-prefix-limit { # maximum 20; # teardown 99 idle-timeout 2000; # } # damping; # delay-route-advertisements { # minimum-delay { # routing-uptime 23000; # inbound-convergence 32000; # } # maximum-delay { # route-age 20; # routing-uptime 32000; # } # } # defer-initial-multipath-build { # maximum-delay 2; # } # graceful-restart { # forwarding-state-bit from-fib; # } # } # labeled-unicast { # prefix-limit { # maximum 20; # teardown 99 idle-timeout forever; # } # route-refresh-priority priority 3; # per-prefix-label; # per-group-label; # rib { # inet.3; # } # explicit-null connected-only; # resolve-vpn; # entropy-label { # no-next-hop-validation; # } # } # } # family evpn { # signaling { # accepted-prefix-limit { # maximum 20; # teardown 98 idle-timeout 2001; # } # damping; # defer-initial-multipath-build { # maximum-delay 2; # } # } # } - name: Replace existing Junos BGP address family config with provided config junipernetworks.junos.junos_bgp_address_family: config: address_family: - afi: 'evpn' af_type: - type: 'signaling' accepted_prefix_limit: maximum: 21 limit_threshold: 99 idle_timeout_value: 2002 delay_route_advertisements: max_delay_route_age: 20 max_delay_routing_uptime: 32000 min_delay_inbound_convergence: 32000 min_delay_routing_uptime: 23000 damping: true state: replaced # After state # ----------- # # admin# show protocols bgp # preference 2; # hold-time 5; # advertise-inactive; # out-delay 10; # bgp-error-tolerance { # malformed-route-limit 40000000; # } # authentication-algorithm md5; # advertise-bgp-static { # policy static-to-bgp; # } # family inet { # unicast { # local-ipv4-address 9.9.9.9; # extended-nexthop; # extended-nexthop-color; # } # flow { # loops 4; # no-install; # output-queue-priority expedited; # legacy-redirect-ip-action { # receive; # send; # } # secondary-independent-resolution; # } # any { # accepted-prefix-limit { # maximum 20; # teardown 99 idle-timeout 2000; # } # damping; # delay-route-advertisements { # minimum-delay { # routing-uptime 23000; # inbound-convergence 32000; # } # maximum-delay { # route-age 20; # routing-uptime 32000; # } # } # defer-initial-multipath-build { # maximum-delay 2; # } # graceful-restart { # forwarding-state-bit from-fib; # } # } # labeled-unicast { # prefix-limit { # maximum 20; # teardown 99 idle-timeout forever; # } # route-refresh-priority priority 3; # per-prefix-label; # per-group-label; # rib { # inet.3; # } # explicit-null connected-only; # resolve-vpn; # entropy-label { # no-next-hop-validation; # } # } # } # family evpn { # signaling { # accepted-prefix-limit { # maximum 21; # teardown 99 idle-timeout 2002; # } # damping; # delay-route-advertisements { # minimum-delay { # routing-uptime 23000; # inbound-convergence 32000; # } # maximum-delay { # route-age 20; # routing-uptime 32000; # } # } # } # } # Using overridden # # Before state # ------------ # # admin# show protocols bgp # family inet { # unicast { # local-ipv4-address 9.9.9.9; # extended-nexthop; # extended-nexthop-color; # } # flow { # loops 4; # no-install; # output-queue-priority expedited; # legacy-redirect-ip-action { # receive; # send; # } # secondary-independent-resolution; # } # any { # accepted-prefix-limit { # maximum 20; # teardown 99 idle-timeout 2000; # } # damping; # delay-route-advertisements { # minimum-delay { # routing-uptime 23000; # inbound-convergence 32000; # } # maximum-delay { # route-age 20; # routing-uptime 32000; # } # } # defer-initial-multipath-build { # maximum-delay 2; # } # graceful-restart { # forwarding-state-bit from-fib; # } # } # labeled-unicast { # prefix-limit { # maximum 20; # teardown 99 idle-timeout forever; # } # route-refresh-priority priority 3; # per-prefix-label; # per-group-label; # rib { # inet.3; # } # explicit-null connected-only; # resolve-vpn; # entropy-label { # no-next-hop-validation; # } # } # } # family evpn { # signaling { # accepted-prefix-limit { # maximum 20; # teardown 98 idle-timeout 2001; # } # damping; # defer-initial-multipath-build { # maximum-delay 2; # } # } # } - name: Override Junos BGP address family config junipernetworks.junos.junos_bgp_address_family: config: address_family: - afi: 'evpn' af_type: - type: 'signaling' accepted_prefix_limit: maximum: 21 limit_threshold: 99 idle_timeout_value: 2002 delay_route_advertisements: max_delay_route_age: 20 max_delay_routing_uptime: 32000 min_delay_inbound_convergence: 32000 min_delay_routing_uptime: 23000 damping: true state: overridden # After state # ----------- # # admin# show protocols bgp # family evpn { # signaling { # accepted-prefix-limit { # maximum 21; # teardown 99 idle-timeout 2002; # } # damping; # delay-route-advertisements { # minimum-delay { # routing-uptime 23000; # inbound-convergence 32000; # } # maximum-delay { # route-age 20; # routing-uptime 32000; # } # } # } # } # Using deleted # # Before state # ------------ # # admin# show protocols bgp # preference 2; # hold-time 5; # advertise-inactive; # out-delay 10; # family inet { # unicast { # local-ipv4-address 9.9.9.9; # extended-nexthop; # extended-nexthop-color; # } # flow { # loops 4; # no-install; # output-queue-priority expedited; # legacy-redirect-ip-action { # receive; # send; # } # secondary-independent-resolution; # } # any { # accepted-prefix-limit { # maximum 20; # teardown 99 idle-timeout 2000; # } # damping; # delay-route-advertisements { # minimum-delay { # routing-uptime 23000; # inbound-convergence 32000; # } # maximum-delay { # route-age 20; # routing-uptime 32000; # } # } # defer-initial-multipath-build { # maximum-delay 2; # } # graceful-restart { # forwarding-state-bit from-fib; # } # } # labeled-unicast { # prefix-limit { # maximum 20; # teardown 99 idle-timeout forever; # } # route-refresh-priority priority 3; # per-prefix-label; # per-group-label; # rib { # inet.3; # } # explicit-null connected-only; # resolve-vpn; # entropy-label { # no-next-hop-validation; # } # } # } # family evpn { # signaling { # accepted-prefix-limit { # maximum 20; # teardown 98 idle-timeout 2001; # } # damping; # defer-initial-multipath-build { # maximum-delay 2; # } # } # } - name: Delete Junos BGP address family config based on the afi junipernetworks.junos.junos_bgp_address_family: config: address_family: - afi: 'inet' state: deleted # After state # ----------- # # admin# show protocols bgp # preference 2; # hold-time 5; # advertise-inactive; # out-delay 10; # family evpn { # signaling { # accepted-prefix-limit { # maximum 20; # teardown 98 idle-timeout 2001; # } # damping; # defer-initial-multipath-build { # maximum-delay 2; # } # } # } # Using deleted # # Before state # ------------ # # admin# show protocols bgp # preference 2; # hold-time 5; # advertise-inactive; # out-delay 10; # family inet { # unicast { # local-ipv4-address 9.9.9.9; # extended-nexthop; # extended-nexthop-color; # } # flow { # loops 4; # no-install; # output-queue-priority expedited; # legacy-redirect-ip-action { # receive; # send; # } # secondary-independent-resolution; # } # any { # accepted-prefix-limit { # maximum 20; # teardown 99 idle-timeout 2000; # } # damping; # delay-route-advertisements { # minimum-delay { # routing-uptime 23000; # inbound-convergence 32000; # } # maximum-delay { # route-age 20; # routing-uptime 32000; # } # } # defer-initial-multipath-build { # maximum-delay 2; # } # graceful-restart { # forwarding-state-bit from-fib; # } # } # labeled-unicast { # prefix-limit { # maximum 20; # teardown 99 idle-timeout forever; # } # route-refresh-priority priority 3; # per-prefix-label; # per-group-label; # rib { # inet.3; # } # explicit-null connected-only; # resolve-vpn; # entropy-label { # no-next-hop-validation; # } # } # } # family evpn { # signaling { # accepted-prefix-limit { # maximum 20; # teardown 98 idle-timeout 2001; # } # damping; # defer-initial-multipath-build { # maximum-delay 2; # } # } # } - name: Delete complete Junos BGP address family config junipernetworks.junos.junos_bgp_address_family: config: state: deleted # After state # ----------- # # admin# show protocols bgp # preference 2; # hold-time 5; # advertise-inactive; # out-delay 10; # Using gathered # # Before state # ------------ # # admin# show protocols bgp # preference 2; # hold-time 5; # advertise-inactive; # out-delay 10; # family inet { # unicast { # local-ipv4-address 9.9.9.9; # extended-nexthop; # extended-nexthop-color; # } # flow { # loops 4; # no-install; # output-queue-priority expedited; # legacy-redirect-ip-action { # receive; # send; # } # secondary-independent-resolution; # } # any { # accepted-prefix-limit { # maximum 20; # teardown 99 idle-timeout 2000; # } # damping; # delay-route-advertisements { # minimum-delay { # routing-uptime 23000; # inbound-convergence 32000; # } # maximum-delay { # route-age 20; # routing-uptime 32000; # } # } # defer-initial-multipath-build { # maximum-delay 2; # } # graceful-restart { # forwarding-state-bit from-fib; # } # } # labeled-unicast { # prefix-limit { # maximum 20; # teardown 99 idle-timeout forever; # } # route-refresh-priority priority 3; # per-prefix-label; # per-group-label; # rib { # inet.3; # } # explicit-null connected-only; # resolve-vpn; # entropy-label { # no-next-hop-validation; # } # } # } # family evpn { # signaling { # accepted-prefix-limit { # maximum 20; # teardown 98 idle-timeout 2001; # } # damping; # defer-initial-multipath-build { # maximum-delay 2; # } # } # } - name: Gather Junos BGP address family config junipernetworks.junos.junos_bgp_address_family: config: state: gathered # # # ------------------------- # Module Execution Result # ------------------------- # # "gathered": { # "address_family": [ # { # "af_type": [ # { # "accepted_prefix_limit": { # "idle_timeout_value": 2001, # "limit_threshold": 98, # "maximum": 20 # }, # "damping": true, # "defer_initial_multipath_build": { # "maximum_delay": 2 # }, # "type": "signaling" # } # ], # "afi": "evpn" # }, # { # "af_type": [ # { # "accepted_prefix_limit": { # "idle_timeout_value": 2000, # "limit_threshold": 99, # "maximum": 20 # }, # "damping": true, # "defer_initial_multipath_build": { # "maximum_delay": 2 # }, # "delay_route_advertisements": { # "max_delay_route_age": 20, # "max_delay_routing_uptime": 32000, # "min_delay_inbound_convergence": 32000, # "min_delay_routing_uptime": 23000 # }, # "graceful_restart_forwarding_state_bit": "from-fib", # "type": "any" # }, # { # "legacy_redirect_ip_action": { # "receive": true, # "send": true # }, # "loops": 4, # "no_install": true, # "output_queue_priority_expedited": true, # "secondary_independent_resolution": true, # "type": "flow" # }, # { # "entropy_label": { # "no_next_hop_validation": true # }, # "explicit_null": { # "connected_only": true # }, # "per_group_label": true, # "per_prefix_label": true, # "prefix_limit": { # "forever": true, # "limit_threshold": 99, # "maximum": 20 # }, # "resolve_vpn": true, # "rib": "inet.3", # "route_refresh_priority_priority": 3, # "type": "labeled-unicast" # }, # { # "extended_nexthop": true, # "extended_nexthop_color": true, # "local_ipv4_address": "9.9.9.9", # "type": "unicast" # } # ], # "afi": "inet" # } # ] # } # # Using parsed # parsed.cfg # ------------ # <?xml version="1.0" encoding="UTF-8"?> # <rpc-reply message-id="urn:uuid:0cadb4e8-5bba-47f4-986e-72906227007f"> # <configuration changed-seconds="1590139550" changed-localtime="2020-05-22 09:25:50 UTC"> # <version>18.4R1-S2.4</version> # <protocols> # <bgp> # <preference>2</preference> # <hold-time>5</hold-time> # <advertise-inactive/> # <out-delay>10</out-delay> # <family> # <inet> # <unicast> # <local-ipv4-address>9.9.9.9</local-ipv4-address> # <extended-nexthop/> # <extended-nexthop-color/> # </unicast> # <flow> # <loops> # <loops>4</loops> # </loops> # <no-install/> # <output-queue-priority> # <expedited/> # </output-queue-priority> # <legacy-redirect-ip-action> # <receive/> # <send/> # </legacy-redirect-ip-action> # <secondary-independent-resolution/> # </flow> # <any> # <accepted-prefix-limit> # <maximum>20</maximum> # <teardown> # <limit-threshold>99</limit-threshold> # <idle-timeout> # <timeout>2000</timeout> # </idle-timeout> # </teardown> # </accepted-prefix-limit> # <damping/> # <delay-route-advertisements> # <minimum-delay> # <routing-uptime>23000</routing-uptime> # <inbound-convergence>32000</inbound-convergence> # </minimum-delay> # <maximum-delay> # <route-age>20</route-age> # <routing-uptime>32000</routing-uptime> # </maximum-delay> # </delay-route-advertisements> # <defer-initial-multipath-build> # <maximum-delay>2</maximum-delay> # </defer-initial-multipath-build> # <graceful-restart> # <forwarding-state-bit>from-fib</forwarding-state-bit> # </graceful-restart> # </any> # <labeled-unicast> # <prefix-limit> # <maximum>20</maximum> # <teardown> # <limit-threshold>99</limit-threshold> # <idle-timeout> # <forever/> # </idle-timeout> # </teardown> # </prefix-limit> # <route-refresh-priority> # <priority>3</priority> # </route-refresh-priority> # <per-prefix-label/> # <per-group-label/> # <rib> # <inet.3/> # </rib> # <explicit-null> # <connected-only/> # </explicit-null> # <resolve-vpn/> # <entropy-label> # <no-next-hop-validation/> # </entropy-label> # </labeled-unicast> # </inet> # <evpn> # <signaling> # <accepted-prefix-limit> # <maximum>20</maximum> # <teardown> # <limit-threshold>98</limit-threshold> # <idle-timeout> # <timeout>2001</timeout> # </idle-timeout> # </teardown> # </accepted-prefix-limit> # <damping/> # <defer-initial-multipath-build> # <maximum-delay>2</maximum-delay> # </defer-initial-multipath-build> # </signaling> # </evpn> # </family> # </bgp> # <ospf3> # <area> # <name>0.0.0.100</name> # <stub> # <default-metric>200</default-metric> # </stub> # <interface> # <name>so-0/0/0.0</name> # <metric>5</metric> # <priority>3</priority> # </interface> # </area> # </ospf3> # </protocols> # <routing-options> # <static> # <route> # <name>172.16.17.0/24</name> # <discard /> # </route> # </static> # <router-id>10.200.16.75</router-id> # <autonomous-system> # <as-number>65432</as-number> # </autonomous-system> # </routing-options> # </configuration> # </rpc-reply> - name: Parsed the bgp address family running config to get the facts junipernetworks.junos.junos_bgp_address_family: running_config: "{{ lookup('file', './parsed.cfg') }}" state: parsed # # # ------------------------- # Module Execution Result # ------------------------- # # # "parsed": { # "address_family": [ # { # "af_type": [ # { # "accepted_prefix_limit": { # "idle_timeout_value": 2001, # "limit_threshold": 98, # "maximum": 20 # }, # "damping": true, # "defer_initial_multipath_build": { # "maximum_delay": 2 # }, # "type": "signaling" # } # ], # "afi": "evpn" # }, # { # "af_type": [ # { # "accepted_prefix_limit": { # "idle_timeout_value": 2000, # "limit_threshold": 99, # "maximum": 20 # }, # "damping": true, # "defer_initial_multipath_build": { # "maximum_delay": 2 # }, # "delay_route_advertisements": { # "max_delay_route_age": 20, # "max_delay_routing_uptime": 32000, # "min_delay_inbound_convergence": 32000, # "min_delay_routing_uptime": 23000 # }, # "graceful_restart_forwarding_state_bit": "from-fib", # "type": "any" # }, # { # "legacy_redirect_ip_action": { # "receive": true, # "send": true # }, # "loops": 4, # "no_install": true, # "output_queue_priority_expedited": true, # "secondary_independent_resolution": true, # "type": "flow" # }, # { # "entropy_label": { # "no_next_hop_validation": true # }, # "explicit_null": { # "connected_only": true # }, # "per_group_label": true, # "per_prefix_label": true, # "prefix_limit": { # "forever": true, # "limit_threshold": 99, # "maximum": 20 # }, # "resolve_vpn": true, # "rib": "inet.3", # "route_refresh_priority_priority": 3, # "type": "labeled-unicast" # }, # { # "extended_nexthop": true, # "extended_nexthop_color": true, # "local_ipv4_address": "9.9.9.9", # "type": "unicast" # } # ], # "afi": "inet" # } # ] # } # Using rendered # # - name: Render the commands for provided configuration junipernetworks.junos.junos_bgp_address_family: config: address_family: - afi: 'evpn' af_type: - type: 'signaling' accepted_prefix_limit: maximum: 20 limit_threshold: 98 idle_timeout_value: 2001 damping: true defer_initial_multipath_build: maximum_delay: 2 - afi: 'inet' af_type: - type: 'flow' legacy_redirect_ip_action: send: true receive: true loops: 4 no_install: true output_queue_priority_expedited: true secondary_independent_resolution: true - type: 'unicast' extended_nexthop: true extended_nexthop_color: true local_ipv4_address: '9.9.9.9' - type: 'labeled-unicast' entropy_label: no_next_hop_validation: true explicit_null: connected_only: true per_prefix_label: true per_group_label: true prefix_limit: maximum: 20 limit_threshold: 99 forever: true resolve_vpn: true rib: 'inet.3' route_refresh_priority_expedited: true route_refresh_priority_priority: 3 - type: 'any' accepted_prefix_limit: maximum: 20 limit_threshold: 99 idle_timeout_value: 2000 damping: true defer_initial_multipath_build: maximum_delay: 2 delay_route_advertisements: max_delay_route_age: 20 max_delay_routing_uptime: 32000 min_delay_inbound_convergence: 32000 min_delay_routing_uptime: 23000 graceful_restart_forwarding_state_bit: 'from-fib' state: rendered # # # ------------------------- # Module Execution Result # ------------------------- # # # "rendered": "<nc:protocols xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> # <nc:bgp><nc:family><nc:evpn><nc:signaling><nc:accepted-prefix-limit><nc:maximum>20</nc:maximum> # <nc:teardown><nc:limit-threshold>98</nc:limit-threshold><nc:idle-timeout><nc:timeout>2001</nc:timeout> # </nc:idle-timeout></nc:teardown></nc:accepted-prefix-limit><nc:damping/><nc:defer-initial-multipath-build> # <nc:maximum-delay>2</nc:maximum-delay></nc:defer-initial-multipath-build></nc:signaling> # </nc:evpn><nc:inet><nc:flow><nc:legacy-redirect-ip-action><nc:send/><nc:receive/> # </nc:legacy-redirect-ip-action><nc:loops>4</nc:loops><nc:no-install/> # <nc:output-queue-priority><nc:expedited/></nc:output-queue-priority> # <nc:secondary-independent-resolution/></nc:flow><nc:unicast><nc:extended-nexthop/> # <nc:extended-nexthop-color/><nc:local-ipv4-address>9.9.9.9</nc:local-ipv4-address> # </nc:unicast><nc:labeled-unicast><nc:entropy-label><nc:no-next-hop-validation/> # </nc:entropy-label><nc:explicit-null><nc:connected-only/></nc:explicit-null> # <nc:per-prefix-label/><nc:per-group-label/><nc:prefix-limit><nc:maximum>20</nc:maximum> # <nc:teardown>99<nc:idle-timeout><nc:forever/></nc:idle-timeout></nc:teardown> # </nc:prefix-limit><nc:resolve-vpn/><nc:rib><nc:inet.3/></nc:rib><nc:route-refresh-priority> # <nc:expedited/><nc:priority>3</nc:priority></nc:route-refresh-priority></nc:labeled-unicast> # <nc:any><nc:accepted-prefix-limit><nc:maximum>20</nc:maximum><nc:teardown> # <nc:limit-threshold>99</nc:limit-threshold><nc:idle-timeout><nc:timeout>2000</nc:timeout> # </nc:idle-timeout></nc:teardown></nc:accepted-prefix-limit><nc:damping/> # <nc:defer-initial-multipath-build><nc:maximum-delay>2</nc:maximum-delay> # </nc:defer-initial-multipath-build><nc:delay-route-advertisements> # <nc:maximum-delay><nc:route-age>20</nc:route-age><nc:routing-uptime>32000</nc:routing-uptime> # </nc:maximum-delay><nc:minimum-delay><nc:inbound-convergence>32000</nc:inbound-convergence> # <nc:routing-uptime>23000</nc:routing-uptime></nc:minimum-delay></nc:delay-route-advertisements> # <nc:graceful-restart><nc:forwarding-state-bit>from-fib</nc:forwarding-state-bit> # </nc:graceful-restart></nc:any></nc:inet></nc:family></nc:bgp></nc:protocols>" ``` 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 | | --- | --- | --- | | **after** dictionary | when changed | The resulting configuration model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **before** dictionary | always | The configuration prior to the model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['<nc:protocols xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:bgp><nc:family><nc:evpn><nc:signaling><nc:accepted-prefix-limit> <nc:maximum>21</nc:maximum><nc:teardown><nc:limit-threshold>99</nc:limit-threshold> <nc:idle-timeout><nc:timeout>2002</nc:timeout></nc:idle-timeout> </nc:teardown></nc:accepted-prefix-limit><nc:damping/> <nc:delay-route-advertisements><nc:maximum-delay> <nc:route-age>20</nc:route-age><nc:routing-uptime>32000</nc:routing-uptime> </nc:maximum-delay><nc:minimum-delay><nc:inbound-convergence>32000</nc:inbound-convergence> <nc:routing-uptime>23000</nc:routing-uptime></nc:minimum-delay></nc:delay-route-advertisements> </nc:signaling></nc:evpn></nc:family></nc:bgp></nc:protocols>', 'xml 2', 'xml 3'] | ### Authors * Rohit Thakur (@rohitthakur2590)
programming_docs
ansible junipernetworks.junos.junos_banner – Manage multiline banners on Juniper JUNOS devices junipernetworks.junos.junos\_banner – Manage multiline banners on Juniper JUNOS devices ======================================================================================= Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_banner`. New in version 1.0.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This will configure both login and motd banners on network devices. It allows playbooks to add or remote banner text from the active running configuration. 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. * ncclient (>=v0.5.2) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **active** boolean | **Choices:*** no * **yes** ← | Specifies whether or not the configuration is active or deactivated | | **banner** string / required | **Choices:*** login * motd | Specifies which banner that should be configured on the remote device. Value `login` indicates system login message prior to authenticating, `motd` is login announcement after successful authentication. | | **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli` or `connection: netconf`. For more information please see the [Junos OS Platform Options guide](../network/user_guide/platform_junos). A dict object containing connection details. | | | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. | | | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. | | | **port** integer | | Specifies the port to use when building the connection to the remote device. The port value will default to the well known SSH port of 22 (for `transport=cli`) or port 830 (for `transport=netconf`) device. | | | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. | | | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. | | | **transport** string | **Choices:*** cli * **netconf** ← | Configures the transport connection to use when connecting to the remote device. | | | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. | | **state** string | **Choices:*** **present** ← * absent | Specifies whether or not the configuration is present in the current devices active running configuration. | | **text** string | | The banner text that should be present in the remote device running configuration. This argument accepts a multiline string, with no empty lines. Requires *state=present*. | Notes ----- Note * This module requires the netconf system service be enabled on the remote device being managed. * Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. * Recommended connection is `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). * This module also works with `local` connections for legacy playbooks. * For information on using CLI and netconf see the [Junos OS Platform Options guide](../../../network/user_guide/platform_junos#junos-platform-options) * For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide) * For more information on using Ansible to manage Juniper network devices see <https://www.ansible.com/ansible-juniper>. Examples -------- ``` - name: configure the login banner junipernetworks.junos.junos_banner: banner: login text: | this is my login banner that contains a multiline string state: present - name: remove the motd banner junipernetworks.junos.junos_banner: banner: motd state: absent - name: deactivate the motd banner junipernetworks.junos.junos_banner: banner: motd state: present active: false - name: activate the motd banner junipernetworks.junos.junos_banner: banner: motd state: present active: true - name: Configure banner from file junipernetworks.junos.junos_banner: banner: motd text: "{{ lookup('file', './config_partial/raw_banner.cfg') }}" 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 | | --- | --- | --- | | **diff.prepared** string | when configuration is changed and diff option is enabled. | Configuration difference before and after applying change. **Sample:** [edit system login] + message "this is my login banner"; | ### Authors * Ganesh Nalawade (@ganeshrn) ansible junipernetworks.junos.junos_logging – Manage logging on network devices junipernetworks.junos.junos\_logging – Manage logging on network devices ======================================================================== Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_logging`. New in version 1.0.0: of junipernetworks.junos * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in major release after 2023-08-01 Why Updated module released with more functionality. Alternative junos\_logging\_global Synopsis -------- * This module provides declarative management of logging on Juniper JUNOS devices. 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. * ncclient (>=v0.5.2) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **active** boolean | **Choices:*** no * **yes** ← | Specifies whether or not the configuration is active or deactivated | | **aggregate** list / elements=dictionary | | List of logging definitions. | | | **active** boolean | **Choices:*** no * yes | Specifies whether or not the configuration is active or deactivated | | | **dest** string | **Choices:*** console * host * file * user | Destination of the logs. | | | **facility** string | | Set logging facility. | | | **files** integer | | Number of files to be archived, this is applicable if value of *dest* is `file`. The acceptable value is in range from 1 to 1000. | | | **level** string | | Set logging severity levels. | | | **name** string | | If value of `dest` is *file* it indicates file-name, for *user* it indicates username and for *host* indicates the host name to be notified. | | | **rotate\_frequency** integer | | Rotate log frequency in minutes, this is applicable if value of *dest* is `file`. The acceptable value is in range of 1 to 59. This controls the frequency after which log file is rotated. | | | **size** integer | | Size of the file in archive, this is applicable if value of *dest* is `file`. The acceptable value is in range from 65536 to 1073741824 bytes. | | | **state** string | **Choices:*** present * absent | State of the logging configuration. | | **dest** string | **Choices:*** console * host * file * user | Destination of the logs. | | **facility** string | | Set logging facility. | | **files** integer | | Number of files to be archived, this is applicable if value of *dest* is `file`. The acceptable value is in range from 1 to 1000. | | **level** string | | Set logging severity levels. | | **name** string | | If value of `dest` is *file* it indicates file-name, for *user* it indicates username and for *host* indicates the host name to be notified. | | **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli` or `connection: netconf`. For more information please see the [Junos OS Platform Options guide](../network/user_guide/platform_junos). A dict object containing connection details. | | | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. | | | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. | | | **port** integer | | Specifies the port to use when building the connection to the remote device. The port value will default to the well known SSH port of 22 (for `transport=cli`) or port 830 (for `transport=netconf`) device. | | | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. | | | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. | | | **transport** string | **Choices:*** cli * **netconf** ← | Configures the transport connection to use when connecting to the remote device. | | | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. | | **rotate\_frequency** integer | | Rotate log frequency in minutes, this is applicable if value of *dest* is `file`. The acceptable value is in range of 1 to 59. This controls the frequency after which log file is rotated. | | **size** integer | | Size of the file in archive, this is applicable if value of *dest* is `file`. The acceptable value is in range from 65536 to 1073741824 bytes. | | **state** string | **Choices:*** **present** ← * absent | State of the logging configuration. | Notes ----- Note * This module requires the netconf system service be enabled on the remote device being managed. * Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. * Recommended connection is `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). * This module also works with `local` connections for legacy playbooks. * For information on using CLI and netconf see the [Junos OS Platform Options guide](../../../network/user_guide/platform_junos#junos-platform-options) * For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide) * For more information on using Ansible to manage Juniper network devices see <https://www.ansible.com/ansible-juniper>. Examples -------- ``` - name: configure console logging junipernetworks.junos.junos_logging: dest: console facility: any level: critical - name: remove console logging configuration junipernetworks.junos.junos_logging: dest: console state: absent - name: configure file logging junipernetworks.junos.junos_logging: dest: file name: test facility: pfe level: error - name: configure logging parameter junipernetworks.junos.junos_logging: files: 30 size: 65536 rotate_frequency: 10 - name: Configure file logging using aggregate junipernetworks.junos.junos_logging: dest: file aggregate: - name: test-1 facility: pfe level: critical - name: test-2 facility: kernel level: emergency active: true - name: Delete file logging using aggregate junipernetworks.junos.junos_logging: aggregate: - {dest: file, name: test-1, facility: pfe, level: critical} - {dest: file, name: test-2, facility: kernel, level: emergency} 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 | | --- | --- | --- | | **diff.prepared** string | when configuration is changed and diff option is enabled. | Configuration difference before and after applying change. **Sample:** [edit system syslog] + [edit system syslog] file interactive-commands { ... } + file test { + pfe critical; + } | Status ------ * This module will be removed in a major release after 2023-08-01. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Ganesh Nalawade (@ganeshrn) ansible junipernetworks.junos.junos_l2_interface – (deprecated, removed after 2022-06-01) Manage L2 Interface on Juniper JUNOS network devices junipernetworks.junos.junos\_l2\_interface – (deprecated, removed after 2022-06-01) Manage L2 Interface on Juniper JUNOS network devices ======================================================================================================================================== Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_l2_interface`. New in version 1.0.0: of junipernetworks.junos * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in major release after 2022-06-01 Why Updated modules released with more functionality Alternative Use [junipernetworks.junos.junos\_l2\_interfaces](junos_l2_interfaces_module#ansible-collections-junipernetworks-junos-junos-l2-interfaces-module) instead. Synopsis -------- * This module provides declarative management of Layer-2 interface on Juniper JUNOS network devices. 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. * ncclient (>=v0.5.2) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **access\_vlan** string | | Configure given VLAN in access port. The value of `access_vlan` should be vlan name. | | **active** boolean | **Choices:*** no * **yes** ← | Specifies whether or not the configuration is active or deactivated | | **aggregate** list / elements=dictionary | | List of Layer-2 interface definitions. | | | **access\_vlan** string | | Configure given VLAN in access port. The value of `access_vlan` should be vlan name. | | | **active** boolean | **Choices:*** no * yes | Specifies whether or not the configuration is active or deactivated | | | **description** string | | Description of Interface. | | | **enhanced\_layer** boolean | **Choices:*** no * yes | True if your device has Enhanced Layer 2 Software (ELS). | | | **filter\_input** string | | The name of input filter of ethernet-switching. | | | **filter\_output** string | | The name of output filter of ethernet-switching. | | | **mode** string | **Choices:*** access * trunk | Mode in which interface needs to be configured. | | | **name** string / required | | Name of the interface excluding any logical unit number. | | | **native\_vlan** integer | | Native VLAN to be configured in trunk port. The value of `native_vlan` should be vlan id. | | | **state** string | **Choices:*** present * absent | State of the Layer-2 Interface configuration. | | | **trunk\_vlans** list / elements=string | | List of VLAN names to be configured in trunk port. The value of `trunk_vlans` should be list of vlan names. | | | **unit** integer | | Logical interface number. Value of `unit` should be of type integer. | | **description** string | | Description of Interface. | | **enhanced\_layer** boolean | **Choices:*** no * **yes** ← | True if your device has Enhanced Layer 2 Software (ELS). | | **filter\_input** string | | The name of input filter of ethernet-switching. | | **filter\_output** string | | The name of output filter of ethernet-switching. | | **mode** string | **Choices:*** access * trunk | Mode in which interface needs to be configured. | | **name** string | | Name of the interface excluding any logical unit number. | | **native\_vlan** integer | | Native VLAN to be configured in trunk port. The value of `native_vlan` should be vlan id. | | **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli` or `connection: netconf`. For more information please see the [Junos OS Platform Options guide](../network/user_guide/platform_junos). A dict object containing connection details. | | | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. | | | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. | | | **port** integer | | Specifies the port to use when building the connection to the remote device. The port value will default to the well known SSH port of 22 (for `transport=cli`) or port 830 (for `transport=netconf`) device. | | | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. | | | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. | | | **transport** string | **Choices:*** cli * **netconf** ← | Configures the transport connection to use when connecting to the remote device. | | | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. | | **state** string | **Choices:*** **present** ← * absent | State of the Layer-2 Interface configuration. | | **trunk\_vlans** list / elements=string | | List of VLAN names to be configured in trunk port. The value of `trunk_vlans` should be list of vlan names. | | **unit** integer | **Default:**0 | Logical interface number. Value of `unit` should be of type integer. | Notes ----- Note * This module requires the netconf system service be enabled on the remote device being managed. * Tested against vqfx-10000 JUNOS Version 15.1X53-D60.4. * Recommended connection is `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). * This module also works with `local` connections for legacy playbooks. * For information on using CLI and netconf see the [Junos OS Platform Options guide](../../../network/user_guide/platform_junos#junos-platform-options) * For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide) * For more information on using Ansible to manage Juniper network devices see <https://www.ansible.com/ansible-juniper>. Examples -------- ``` - name: Configure interface in access mode junipernetworks.junos.junos_l2_interface: name: ge-0/0/1 description: interface-access mode: access access_vlan: red active: true state: present - name: Configure interface in trunk mode junipernetworks.junos.junos_l2_interface: name: ge-0/0/1 description: interface-trunk mode: trunk trunk_vlans: - blue - green native_vlan: 100 active: true state: present - name: Configure interface in access and trunk mode using aggregate junipernetworks.junos.junos_l2_interface: aggregate: - name: ge-0/0/1 description: test-interface-access mode: access access_vlan: red - name: ge-0/0/2 description: test-interface-trunk mode: trunk trunk_vlans: - blue - green native_vlan: 100 active: true 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 | | --- | --- | --- | | **diff** string | when configuration is changed and diff option is enabled. | Configuration difference before and after applying change. **Sample:** [edit interfaces] + ge-0/0/1 { + description "l2 interface configured by Ansible"; + unit 0 { + family ethernet-switching { + interface-mode access; + vlan { + members red; + } + } + } + } | Status ------ * This module will be removed in a major release after 2022-06-01. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Ganesh Nalawade (@ganeshrn)
programming_docs
ansible junipernetworks.junos.junos_vlans – VLANs resource module junipernetworks.junos.junos\_vlans – VLANs resource module ========================================================== Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_vlans`. New in version 1.0.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module creates and manages VLAN configurations on Junos OS. 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. * ncclient (>=v0.6.4) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **config** list / elements=dictionary | | A dictionary of Vlan options | | | **description** string | | Text description of VLANs | | | **l3\_interface** string | | Name of logical layer 3 interface. | | | **name** string / required | | Name of VLAN. | | | **vlan\_id** integer | | IEEE 802.1q VLAN identifier for VLAN (1..4094). | | **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the Junos device by executing the command **show vlans**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result | | **state** string | **Choices:*** **merged** ← * replaced * overridden * deleted * gathered * parsed * rendered | The state of the configuration after module completion. | Notes ----- Note * This module requires the netconf system service be enabled on the remote device being managed * Tested against Junos OS 18.4R1 * This module works with connection `netconf`. * See [the Junos OS Platform Options](../../../network/user_guide/platform_junos). Examples -------- ``` # Using merged # # Before state # ------------ # # vagrant@vsrx# show vlans # # [edit] - name: Merge provided Junos vlans config with running-config junipernetworks.junos.junos_vlans: config: - name: vlan1 vlan_id: 1 - name: vlan2 vlan_id: 2 l3_interface: irb.12 state: merged # # ------------------------- # Module Execution Result # ------------------------- # "after": [ # { # "name": "vlan1", # "vlan_id": 1 # }, # { # "l3_interface": "irb.12", # "name": "vlan2", # "vlan_id": 2 # } # ], # "before": [], # "changed": true, # "commands": [ # "<nc:vlans xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">" # "<nc:vlan><nc:name>vlan1</nc:name><nc:vlan-id>1</nc:vlan-id></nc:vlan>" # "<nc:vlan><nc:name>vlan2</nc:name><nc:vlan-id>2</nc:vlan-id><nc:l3-interface>irb.12</nc:l3-interface>" # "</nc:vlan></nc:vlans>" # ] # After state # ----------- # # vagrant@vsrx# show vlans # vlan1 { # vlan-id 1; # } # vlan2 { # vlan-id 2; # l3-interface irb.12; # } # Using replaced # # Before state # ------------ # # vagrant@vsrx# show vlans # vlan1 { # vlan-id 1; # } # vlan2 { # vlan-id 2; # l3-interface irb.12; # } - name: Replace Junos vlans running-config with the provided config junipernetworks.junos.junos_vlans: config: - name: vlan1 vlan_id: 11 l3_interface: irb.10 - name: vlan2 vlan_id: 2 state: replaced # ------------------------- # Module Execution Result # ------------------------- # "after": [ # { # "l3_interface": "irb.10", # "name": "vlan1", # "vlan_id": 11 # }, # { # "name": "vlan2", # "vlan_id": 2 # } # ], # "before": [ # { # "name": "vlan1", # "vlan_id": 1 # }, # { # "l3_interface": "irb.12", # "name": "vlan2", # "vlan_id": 2 # } # ], # "changed": true, # "commands": [ # "<nc:vlans xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">" # "<nc:vlan delete="delete"><nc:name>vlan1</nc:name></nc:vlan>" # "<nc:vlan delete="delete"><nc:name>vlan2</nc:name></nc:vlan>" # "<nc:vlan><nc:name>vlan1</nc:name><nc:vlan-id>11</nc:vlan-id>" # "<nc:l3-interface>irb.10</nc:l3-interface></nc:vlan><nc:vlan>" # "<nc:name>vlan2</nc:name><nc:vlan-id>2</nc:vlan-id></nc:vlan></nc:vlans>" # ] # After state # ----------- # # vagrant@vsrx# show vlans # vlan1 { # vlan-id 11; # l3-interface irb.10; # } # vlan2 { # vlan-id 2; # } # # Using overridden # # Before state # ------------ # # vagrant@vsrx# show vlans # vlan1 { # vlan-id 11; # l3-interface irb.10; # } # vlan2 { # vlan-id 2; # } - name: Override Junos running-config with provided config junipernetworks.junos.junos_vlans: config: - name: vlan3 vlan_id: 3 l3_interface: irb.13 state: overridden # ------------------------- # Module Execution Result # ------------------------- # "after": [ # { # "l3_interface": "irb.13", # "name": "vlan3", # "vlan_id": 3 # } # ], # "before": [ # { # "l3_interface": "irb.10", # "name": "vlan1", # "vlan_id": 11 # }, # { # "name": "vlan2", # "vlan_id": 2 # } # ], # "changed": true, # "commands": [ # "<nc:vlans xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">" # "<nc:vlan delete="delete"><nc:name>vlan1</nc:name></nc:vlan><nc:vlan delete="delete">" # "<nc:name>vlan2</nc:name></nc:vlan><nc:vlan><nc:name>vlan3</nc:name><nc:vlan-id>3</nc:vlan-id>" # "<nc:l3-interface>irb.13</nc:l3-interface></nc:vlan></nc:vlans>" # ] # After state # ----------- # # vagrant@vsrx# show vlans # vlan3 { # vlan-id 3; # l3-interface irb.13; # } # # Using deleted # # Before state # ------------ # # vagrant@vsrx# show vlans # vlan3 { # vlan-id 3; # l3-interface irb.13; # } - name: Delete specific vlan junipernetworks.junos.junos_vlans: config: - name: vlan3 state: deleted # ------------------------- # Module Execution Result # ------------------------- # "after": [], # "changed": true, # "commands": [ # "<nc:vlans xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> # "<nc:vlan delete="delete"><nc:name>vlan3</nc:name></nc:vlan></nc:vlans>" # ] # After state # ----------- # # vagrant@vsrx# show vlans # vlan1 { # vlan-id 11; # l3-interface irb.10; # } # vlan2 { # vlan-id 2; # } - name: Gather running vlans configuration junipernetworks.junos.junos_vlans: state: gathered # # ------------------------- # Module Execution Result # ------------------------- # "gathered": [ # { # "l3_interface": "irb.10", # "name": "vlan1", # "vlan_id": 11 # }, # { # "name": "vlan2", # "vlan_id": 2 # } # ], # "changed": false, # # Using rendered # # Before state # ------------ # - name: Render xml for provided facts. junipernetworks.junos.junos_vlans: config: - name: vlan1 vlan_id: 1 - name: vlan2 vlan_id: 2 l3_interface: irb.12 state: rendered # # ------------------------- # Module Execution Result # ------------------------- # "rendered": [ # "<nc:vlans xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">" # "<nc:vlan><nc:name>vlan1</nc:name><nc:vlan-id>1</nc:vlan-id></nc:vlan>" # "<nc:vlan><nc:name>vlan2</nc:name><nc:vlan-id>2</nc:vlan-id><nc:l3-interface>irb.12</nc:l3-interface>" # "</nc:vlan></nc:vlans>" # ] # Using parsed # parsed.cfg # ------------ # <?xml version="1.0" encoding="UTF-8"?> # <rpc-reply message-id="urn:uuid:0cadb4e8-5bba-47f4-986e-72906227007f"> # <configuration changed-seconds="1590139550" changed-localtime="2020-05-22 09:25:50 UTC"> # <version>18.4R1-S2.4</version> # <vlans> # <vlan> # <name>vlan1</name> # <vlan-id>1</vlan-id> # </vlan> # <vlan> # <name>vlan2</name> # <vlan-id>2</vlan-id> # <l3-interface>irb.12</l3-interface> # </vlan> # </vlans> # </configuration> # </rpc-reply> - name: Parse routing instance running config junipernetworks.junos.junos_vlans: running_config: "{{ lookup('file', './parsed.cfg') }}" state: parsed # # # ------------------------- # Module Execution Result # ------------------------- # # # "parsed": [ # { # "name": "vlan1", # "vlan_id": 1 # }, # { # "l3_interface": "irb.12", # "name": "vlan2", # "vlan_id": 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 | | --- | --- | --- | | **after** list / elements=string | when changed | The configuration as structured data after module completion. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **before** list / elements=string | always | The configuration as structured data prior to module invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['<nc:vlans xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:vlan><nc:name>vlan1</nc:name><nc:vlan-id>1</nc:vlan-id> </nc:vlan><nc:vlan><nc:name>vlan2</nc:name><nc:vlan-id>2</nc:vlan-id> <nc:l3-interface>irb.12</nc:l3-interface></nc:vlan></nc:vlans>', 'xml 2', 'xml 3'] | ### Authors * Daniel Mellado (@dmellado) ansible junipernetworks.junos.junos_l3_interfaces – L3 interfaces resource module junipernetworks.junos.junos\_l3\_interfaces – L3 interfaces resource module =========================================================================== Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_l3_interfaces`. New in version 1.0.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module provides declarative management of a Layer 3 interface on Juniper JUNOS devices 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. * ncclient (>=v0.6.4) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **config** list / elements=dictionary | | A dictionary of Layer 3 interface options | | | **ipv4** list / elements=dictionary | | IPv4 addresses to be set for the Layer 3 logical interface mentioned in *name* option. The address format is <ipv4 address>/<mask>. The mask is number in range 0-32 for example, 192.0.2.1/24, or `dhcp` to query DHCP for an IP address | | | | **address** string | | IPv4 address to be set for the specific interface | | | **ipv6** list / elements=dictionary | | IPv6 addresses to be set for the Layer 3 logical interface mentioned in *name* option. The address format is <ipv6 address>/<mask>, the mask is number in range 0-128 for example, 2001:db8:2201:1::1/64 or `auto-config` to use SLAAC | | | | **address** string | | IPv6 address to be set for the specific interface | | | **name** string / required | | Full name of interface, e.g. ge-0/0/1 | | | **unit** integer | **Default:**0 | Logical interface number. Value of `unit` should be of type integer | | **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the Junos device by executing the command **show interfaces**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result | | **state** string | **Choices:*** **merged** ← * replaced * overridden * deleted * gathered * rendered * parsed | The state of the configuration after module completion | Notes ----- Note * This module requires the netconf system service be enabled on the device being managed. * This module works with connection `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). * Tested against JunOS v18.4R1 Examples -------- ``` # Using deleted # Before state: # ------------- # # admin# show interfaces # ge-0/0/1 { # description "L3 interface"; # unit 0 { # family inet { # address 10.200.16.10/24; # } # } # } # ge-0/0/2 { # description "non L3 interface"; # unit 0 { # family ethernet-switching { # interface-mode access; # vlan { # members 2; # } # } # } # } - name: Delete JUNOS L3 logical interface junipernetworks.junos.junos_l3_interfaces: config: - name: ge-0/0/1 - name: ge-0/0/2 state: deleted # After state: # ------------ # # admin# show interfaces # ge-0/0/1 { # description "deleted L3 interface"; # } # ge-0/0/2 { # description "non L3 interface"; # unit 0 { # family ethernet-switching { # interface-mode access; # vlan { # members 2; # } # } # } # } # Using merged # Before state # ------------ # # admin# show interfaces # ge-0/0/1 { # description "L3 interface"; # unit 0 { # family inet { # address 10.200.16.10/24; # } # } # } # ge-0/0/2 { # description "non configured interface"; # unit 0; # } - name: Merge provided configuration with device configuration (default operation is merge) junipernetworks.junos.junos_l3_interfaces: config: - name: ge-0/0/1 ipv4: - address: 192.168.1.10/24 ipv6: - address: 8d8d:8d01::1/64 - name: ge-0/0/2 ipv4: - address: dhcp state: merged # After state: # ------------ # # admin# show interfaces # ge-0/0/1 { # description "L3 interface"; # unit 0 { # family inet { # address 10.200.16.10/24; # address 192.168.1.10/24; # } # family inet6 { # address 8d8d:8d01::1/64; # } # } # } # ge-0/0/2 { # description "L3 interface with dhcp"; # unit 0 { # family inet { # dhcp; # } # } # } # Using overridden # Before state # ------------ # # admin# show interfaces # ge-0/0/1 { # description "L3 interface"; # unit 0 { # family inet { # address 10.200.16.10/24; # } # } # } # ge-0/0/2 { # description "L3 interface with dhcp"; # unit 0 { # family inet { # dhcp; # } # } # } # ge-0/0/3 { # description "another L3 interface"; # unit 0 { # family inet { # address 192.168.1.10/24; # } # } # } - name: Override provided configuration with device configuration junipernetworks.junos.junos_l3_interfaces: config: - name: ge-0/0/1 ipv4: - address: 192.168.1.10/24 ipv6: - address: 8d8d:8d01::1/64 - name: ge-0/0/2 ipv6: - address: 2001:db8:3000::/64 state: overridden # After state: # ------------ # # admin# show interfaces # ge-0/0/1 { # description "L3 interface"; # unit 0 { # family inet { # address 192.168.1.10/24; # } # family inet6 { # address 8d8d:8d01::1/64; # } # } # } # ge-0/0/2 { # description "L3 interface with ipv6"; # unit 0 { # family inet6 { # address 2001:db8:3000::/64; # } # } # } # ge-0/0/3 { # description "overridden L3 interface"; # unit 0; # } # Using replaced # Before state # ------------ # # admin# show interfaces # ge-0/0/1 { # description "L3 interface"; # unit 0 { # family inet { # address 10.200.16.10/24; # } # } # } # ge-0/0/2 { # description "non configured interface"; # unit 0; # } # ge-0/0/3 { # description "another L3 interface"; # unit 0 { # family inet { # address 192.168.1.10/24; # } # } # } - name: Replace provided configuration with device configuration junipernetworks.junos.junos_l3_interfaces: config: - name: ge-0/0/1 ipv4: - address: 192.168.1.10/24 ipv6: - address: 8d8d:8d01::1/64 - name: ge-0/0/2 ipv4: - address: dhcp state: replaced # After state: # ------------ # # admin# show interfaces # ge-0/0/1 { # description "L3 interface"; # unit 0 { # family inet { # address 192.168.1.10/24; # } # family inet6 { # address 8d8d:8d01::1/64; # } # } # } # ge-0/0/2 { # description "L3 interface with dhcp"; # unit 0 { # family inet { # dhcp; # } # } # } # ge-0/0/3 { # description "another L3 interface"; # unit 0 { # family inet { # address 192.168.1.10/24; # } # } # } # Using gathered # Before state: # ------------ # # user@junos01# show interfaces # ge-0/0/1 { # description "Configured by Ansible"; # disable; # speed 100m; # mtu 1024; # hold-time up 2000 down 2200; # link-mode full-duplex; # unit 0 { # family ethernet-switching { # interface-mode access; # vlan { # members vlan100; # } # } # } # } # ge-0/0/2 { # description "Configured by Ansible"; # native-vlan-id 400; # speed 10m; # mtu 2048; # hold-time up 3000 down 3200; # unit 0 { # family ethernet-switching { # interface-mode trunk; # vlan { # members [ vlan200 vlan300 ]; # } # } # } # } # ge-1/0/0 { # unit 0 { # family inet { # address 192.168.100.1/24; # address 10.200.16.20/24; # } # family inet6; # } # } # ge-2/0/0 { # unit 0 { # family inet { # address 192.168.100.2/24; # address 10.200.16.21/24; # } # family inet6; # } # } # ge-3/0/0 { # unit 0 { # family inet { # address 192.168.100.3/24; # address 10.200.16.22/24; # } # family inet6; # } # } # em1 { # description TEST; # } # fxp0 { # description ANSIBLE; # speed 1g; # link-mode automatic; # unit 0 { # family inet { # address 10.8.38.38/24; # } # } # } - name: Gather junos layer3 interfaces as in given arguments junipernetworks.junos.junos_l3_interfaces: state: gathered # Task Output (redacted) # ----------------------- # # "gathered": [ # { # "ipv4": [ # { # "address": "192.168.100.1/24" # }, # { # "address": "10.200.16.20/24" # } # ], # "name": "ge-1/0/0", # "unit": "0" # }, # { # "ipv4": [ # { # "address": "192.168.100.2/24" # }, # { # "address": "10.200.16.21/24" # } # ], # "name": "ge-2/0/0", # "unit": "0" # }, # { # "ipv4": [ # { # "address": "192.168.100.3/24" # }, # { # "address": "10.200.16.22/24" # } # ], # "name": "ge-3/0/0", # "unit": "0" # }, # { # "ipv4": [ # { # "address": "10.8.38.38/24" # } # ], # "name": "fxp0", # "unit": "0" # } # ] # After state: # ------------ # # user@junos01# show interfaces # ge-0/0/1 { # description "Configured by Ansible"; # disable; # speed 100m; # mtu 1024; # hold-time up 2000 down 2200; # link-mode full-duplex; # unit 0 { # family ethernet-switching { # interface-mode access; # vlan { # members vlan100; # } # } # } # } # ge-0/0/2 { # description "Configured by Ansible"; # native-vlan-id 400; # speed 10m; # mtu 2048; # hold-time up 3000 down 3200; # unit 0 { # family ethernet-switching { # interface-mode trunk; # vlan { # members [ vlan200 vlan300 ]; # } # } # } # } # ge-1/0/0 { # unit 0 { # family inet { # address 192.168.100.1/24; # address 10.200.16.20/24; # } # family inet6; # } # } # ge-2/0/0 { # unit 0 { # family inet { # address 192.168.100.2/24; # address 10.200.16.21/24; # } # family inet6; # } # } # ge-3/0/0 { # unit 0 { # family inet { # address 192.168.100.3/24; # address 10.200.16.22/24; # } # family inet6; # } # } # em1 { # description TEST; # } # fxp0 { # description ANSIBLE; # speed 1g; # link-mode automatic; # unit 0 { # family inet { # address 10.8.38.38/24; # } # } # } # Using parsed # parsed.cfg # ------------ # # <?xml version="1.0" encoding="UTF-8"?> # <rpc-reply message-id="urn:uuid:0cadb4e8-5bba-47f4-986e-72906227007f"> # <configuration changed-seconds="1590139550" changed-localtime="2020-05-22 09:25:50 UTC"> # <interfaces> # <interface> # <name>ge-1/0/0</name> # <unit> # <name>0</name> # <family> # <inet> # <address> # <name>192.168.100.1/24</name> # </address> # <address> # <name>10.200.16.20/24</name> # </address> # </inet> # <inet6></inet6> # </family> # </unit> # </interface> # <interface> # <name>ge-2/0/0</name> # <unit> # <name>0</name> # <family> # <inet> # <address> # <name>192.168.100.2/24</name> # </address> # <address> # <name>10.200.16.21/24</name> # </address> # </inet> # <inet6></inet6> # </family> # </unit> # </interface> # </interfaces> # </configuration> # </rpc-reply> # - name: Convert interfaces config to argspec without connecting to the appliance # junipernetworks.junos.junos_l3_interfaces: # running_config: "{{ lookup('file', './parsed.cfg') }}" # state: parsed # Task Output (redacted) # ----------------------- # "parsed": [ # { # "ipv4": [ # { # "address": "192.168.100.1/24" # }, # { # "address": "10.200.16.20/24" # } # ], # "name": "ge-1/0/0", # "unit": "0" # }, # { # "ipv4": [ # { # "address": "192.168.100.2/24" # }, # { # "address": "10.200.16.21/24" # } # ], # "name": "ge-2/0/0", # "unit": "0" # } # ] # # Using rendered - name: Render platform specific xml from task input using rendered state junipernetworks.junos.junos_l3_interfaces: config: - name: ge-1/0/0 ipv4: - address: 192.168.100.1/24 - address: 10.200.16.20/24 unit: 0 - name: ge-2/0/0 ipv4: - address: 192.168.100.2/24 - address: 10.200.16.21/24 unit: 0 state: rendered # Task Output (redacted) # ----------------------- # "rendered": "<nc:interfaces # xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> # <nc:interface> # <nc:name>ge-1/0/0</nc:name> # <nc:unit> # <nc:name>0</nc:name> # <nc:family> # <nc:inet> # <nc:address> # <nc:name>192.168.100.1/24</nc:name> # </nc:address> # <nc:address> # <nc:name>10.200.16.20/24</nc:name> # </nc:address> # </nc:inet> # </nc:family> # </nc:unit> # </nc:interface> # <nc:interface> # <nc:name>ge-2/0/0</nc:name> # <nc:unit> # <nc:name>0</nc:name> # <nc:family> # <nc:inet> # <nc:address> # <nc:name>192.168.100.2/24</nc:name> # </nc:address> # <nc:address> # <nc:name>10.200.16.21/24</nc:name> # </nc:address> # </nc:inet> # </nc:family> # </nc:unit> # </nc:interface> # </nc:interfaces>" ``` 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 | | --- | --- | --- | | **after** list / elements=string | when changed | The configuration as structured data after module completion. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **before** list / elements=string | always | The configuration as structured data prior to module invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['<nc:interfaces xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:interface> <nc:name>ge-1/0/0</nc:name> <nc:unit> <nc:name>0</nc:name> <nc:family> <nc:inet> <nc:address> <nc:name>192.168.100.1/24</nc:name> </nc:address> <nc:address> <nc:name>10.200.16.20/24</nc:name> </nc:address> </nc:inet> </nc:family> </nc:unit> </nc:interfaces>', 'xml 2', 'xml 3'] | ### Authors * Daniel Mellado (@dmellado)
programming_docs
ansible junipernetworks.junos.junos_acl_interfaces – ACL interfaces resource module junipernetworks.junos.junos\_acl\_interfaces – ACL interfaces resource module ============================================================================= Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_acl_interfaces`. New in version 1.0.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module manages adding and removing Access Control Lists (ACLs) from interfaces on devices running Juniper JUNOS. 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. * ncclient (>=v0.6.4) * xmltodict (>=0.12.0) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **config** list / elements=dictionary | | A dictionary of ACL options for interfaces. | | | **access\_groups** list / elements=dictionary | | Specifies ACLs attached to the interface. | | | | **acls** list / elements=dictionary | | Specifies the ACLs for the provided AFI. | | | | | **direction** string | **Choices:*** in * out | Specifies the direction of packets that the ACL will be applied on. | | | | | **name** string | | Specifies the name of the IPv4/IPv4 ACL for the interface. | | | | **afi** string | **Choices:*** ipv4 * ipv6 | Specifies the AFI for the ACL(s) to be configured on this interface. | | | **name** string | | Name/Identifier for the interface. | | **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the Junos device by executing the command **show interfaces**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result | | **state** string | **Choices:*** **merged** ← * replaced * overridden * deleted * gathered * rendered * parsed | The state the configuration should be left in. | Notes ----- Note * This module requires the netconf system service be enabled on the device being managed. * This module works with connection `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). * Tested against JunOS v18.4R1 Examples -------- ``` # Using deleted # Before state: # ------------- # # admin# show interfaces # ge-1/0/0 { # description "L3 interface with filter"; # unit 0 { # family inet { # filter { # input inbound_acl; # output outbound_acl; # } # address 100.64.0.1/10; # address 100.64.0.2/10; # } # family inet6; # } - name: Delete JUNOS L3 interface filter junipernetworks.junos.junos_acl_interfaces: config: - name: ge-1/0/0 access_groups: - afi: ipv4 acls: - name: inbound_acl direction: in - name: outbound_acl direction: out state: deleted # After state: # ------------- # # admin# show interfaces # ge-1/0/0 { # description "L3 interface with filter"; # unit 0 { # family inet { # address 100.64.0.1/10; # address 100.64.0.2/10; # } # family inet6; # } # Using merged # Before state: # ------------- # # admin# show interfaces # ge-1/0/0 { # description "L3 interface without filter"; # unit 0 { # family inet { # address 100.64.0.1/10; # address 100.64.0.2/10; # } # family inet6; # } - name: Merge JUNOS L3 interface filter junipernetworks.junos.junos_acl_interfaces: config: - name: ge-1/0/0 access_groups: - afi: ipv4 acls: - name: inbound_acl direction: in - name: outbound_acl direction: out state: merged # After state: # ------------- # # admin# show interfaces # ge-1/0/0 { # description "L3 interface with filter"; # unit 0 { # family inet { # filter { # input inbound_acl; # output outbound_acl; # } # address 100.64.0.1/10; # address 100.64.0.2/10; # } # family inet6; # } # Using overridden # Before state: # ------------- # # admin# show interfaces # ge-1/0/0 { # description "L3 interface without filter"; # unit 0 { # family inet { # filter { # input foo_acl; # } # address 100.64.0.1/10; # address 100.64.0.2/10; # } # family inet6; # } - name: Override JUNOS L3 interface filter junipernetworks.junos.junos_acl_interfaces: config: - name: ge-1/0/0 access_groups: - afi: ipv4 acls: - name: inbound_acl direction: in - name: outbound_acl direction: out state: overridden # After state: # ------------- # # admin# show interfaces # ge-1/0/0 { # description "L3 interface with filter"; # unit 0 { # family inet { # filter { # input inbound_acl; # output outbound_acl; # } # address 100.64.0.1/10; # address 100.64.0.2/10; # } # family inet6; # } # Using replaced # Before state: # ------------- # # admin# show interfaces # ge-1/0/0 { # description "L3 interface without filter"; # unit 0 { # family inet { # filter { # input foo_acl; # output outbound_acl; # } # address 100.64.0.1/10; # address 100.64.0.2/10; # } # family inet6; # } - name: Replace JUNOS L3 interface filter junipernetworks.junos.junos_acl_interfaces: config: - name: ge-1/0/0 access_groups: - afi: ipv4 acls: - name: inbound_acl direction: in state: replaced # After state: # ------------- # # admin# show interfaces # ge-1/0/0 { # description "L3 interface with filter"; # unit 0 { # family inet { # filter { # input inbound_acl; # output outbound_acl; # } # address 100.64.0.1/10; # address 100.64.0.2/10; # } # family inet6; # } ``` 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 | | --- | --- | --- | | **after** dictionary | when changed | The resulting configuration model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **before** dictionary | always | The configuration prior to the model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['command 1', 'command 2', 'command 3'] | ### Authors * Daniel Mellado (@dmellado) ansible junipernetworks.junos.junos_package – Installs packages on remote devices running Junos junipernetworks.junos.junos\_package – Installs packages on remote devices running Junos ======================================================================================== Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_package`. New in version 1.0.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) Synopsis -------- * This module can install new and updated packages on remote devices running Junos. The module will compare the specified package with the one running on the remote device and install the specified version if there is a mismatch 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. * junos-eznc * ncclient (>=v0.5.2) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **force** boolean | **Choices:*** **no** ← * yes | The *force* argument instructs the module to bypass the package version check and install the packaged identified in *src* on the remote device. | | **force\_host** boolean | **Choices:*** **no** ← * yes | The *force\_host* argument controls the way software package or bundle is added on remote JUNOS host and is applicable for JUNOS QFX5100 device. If the value is set to `True` it will ignore any warnings while adding the host software package or bundle. | | **issu** boolean | **Choices:*** **no** ← * yes | The *issu* argument is a boolean flag when set to `True` allows unified in-service software upgrade (ISSU) feature which enables you to upgrade between two different Junos OS releases with no disruption on the control plane and with minimal disruption of traffic. | | **no\_copy** boolean | **Choices:*** **no** ← * yes | The *no\_copy* argument is responsible for instructing the remote device on where to install the package from. When enabled, the package is transferred to the remote device prior to installing. | | **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli` or `connection: netconf`. For more information please see the [Junos OS Platform Options guide](../network/user_guide/platform_junos). A dict object containing connection details. | | | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. | | | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. | | | **port** integer | | Specifies the port to use when building the connection to the remote device. The port value will default to the well known SSH port of 22 (for `transport=cli`) or port 830 (for `transport=netconf`) device. | | | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. | | | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. | | | **transport** string | **Choices:*** cli * **netconf** ← | Configures the transport connection to use when connecting to the remote device. | | | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. | | **reboot** boolean | **Choices:*** no * **yes** ← | In order for a package to take effect, the remote device must be restarted. When enabled, this argument will instruct the module to reboot the device once the updated package has been installed. If disabled or the remote package does not need to be changed, the device will not be started. | | **src** path / required | | The *src* argument specifies the path to the source package to be installed on the remote device in the advent of a version mismatch. The *src* argument can be either a localized path or a full path to the package file to install. aliases: package | | **ssh\_config** path | | The `ssh_config` argument is path to the SSH configuration file. This can be used to load SSH information from a configuration file. If this option is not given by default ~/.ssh/config is queried. | | **ssh\_private\_key\_file** path | | The `ssh_private_key_file` argument is path to the SSH private key file. This can be used if you need to provide a private key rather than loading the key into the ssh-key-ring/environment | | **validate** boolean | **Choices:*** no * **yes** ← | The *validate* argument is responsible for instructing the remote device to skip checking the current device configuration compatibility with the package being installed. When set to false validation is not performed. | | **version** string | | The *version* argument can be used to explicitly specify the version of the package that should be installed on the remote device. If the *version* argument is not specified, then the version is extracts from the *src* filename. | Notes ----- Note * This module requires the netconf system service be enabled on the remote device being managed. * Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. * Works with `local` connections only. * Since this module uses junos-eznc to establish connection with junos device the netconf configuration parameters needs to be passed using module options for example `ssh_config` unlike other junos modules that uses `netconf` connection type. * For information on using CLI and netconf see the [Junos OS Platform Options guide](../../../network/user_guide/platform_junos#junos-platform-options) * For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide) * For more information on using Ansible to manage Juniper network devices see <https://www.ansible.com/ansible-juniper>. Examples -------- ``` # the required set of connection arguments have been purposely left off # the examples for brevity - name: install local package on remote device junipernetworks.junos.junos_package: src: junos-vsrx-12.1X46-D10.2-domestic.tgz - name: install local package on remote device without rebooting junipernetworks.junos.junos_package: src: junos-vsrx-12.1X46-D10.2-domestic.tgz reboot: no - name: install local package on remote device with jumpost junipernetworks.junos.junos_package: src: junos-vsrx-12.1X46-D10.2-domestic.tgz ssh_config: /home/user/customsshconfig ``` ### Authors * Peter Sprygada (@privateip) ansible junipernetworks.junos.junos_bgp_global – Manages BGP Global configuration on devices running Juniper JUNOS. junipernetworks.junos.junos\_bgp\_global – Manages BGP Global configuration on devices running Juniper JUNOS. ============================================================================================================= Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_bgp_global`. New in version 1.3.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module manages global bgp configuration on devices running Juniper JUNOS. 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. * ncclient (>=v0.6.4) * xmltodict (>=0.12.0) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **config** dictionary | | A list of BGP process configuration. | | | **accept\_remote\_nexthop** boolean | **Choices:*** no * yes | Allow import policy to specify a non-directly connected next-hop. | | | **add\_path\_display\_ipv4\_address** boolean | **Choices:*** no * yes | Display add-path path-id in IPv4 address format. | | | **advertise\_bgp\_static** dictionary | | Advertise bgp-static routes. | | | | **policy** string | | Specify static route advertisement policy. | | | | **set** boolean | **Choices:*** no * yes | Set Advertise bgp-static routes. | | | **advertise\_external** dictionary | | Advertise best external routes. | | | | **conditional** boolean | **Choices:*** no * yes | Route matches active route upto med-comparison rule. | | | | **set** boolean | **Choices:*** no * yes | Set Advertise best external routes. | | | **advertise\_from\_main\_vpn\_tables** boolean | **Choices:*** no * yes | Advertise VPN routes from bgp.Xvpn.0 tables in master instance. | | | **advertise\_inactive** boolean | **Choices:*** no * yes | Advertise inactive routes. | | | **advertise\_peer\_as** boolean | **Choices:*** no * yes | Advertise routes received from the same autonomous system. | | | **as\_number** string | | Specify Autonomous system number. | | | **asdot\_notation** boolean | **Choices:*** no * yes | Enable AS-Dot notation to display true 4 byte AS numbers. | | | **authentication\_algorithm** string | **Choices:*** aes-128-cmac-96 * hmac-sha-1-96 * md5 | Specify authentication algorithm name. | | | **authentication\_key** string | | Specify MD5 authentication key. | | | **authentication\_key\_chain** string | | Specify authentication key chain name. | | | **bfd\_liveness\_detection** dictionary | | Bidirectional Forwarding Detection (BFD) options. | | | | **authentication** dictionary | | Authentication options. | | | | | **algorithm** string | **Choices:*** keyed-md5 * keyed-sha-1 * meticulous-keyed-md5 * meticulous-keyed-sha-1 * simple-password | Specify algorithm name. | | | | | **key\_chain** string | | Specify Key chain name. | | | | | **loose\_check** boolean | **Choices:*** no * yes | Verify authentication only if authentication is negotiated. | | | | **detection\_time** dictionary | | Specify Detection-time optionss. | | | | | **threshold** integer | | Specify high detection-time triggering a trap (milliseconds). | | | | **holddown\_interval** integer | | Specify time to hold the session-UP notification to the client. | | | | **minimum\_interval** integer | | Specify minimum transmit and receive interval. | | | | **minimum\_receive\_interval** integer | | Specify minimum receive interval. | | | | **multiplier** integer | | Specify detection time multiplier. | | | | **no\_adaptation** boolean | **Choices:*** no * yes | Disable adaptation. | | | | **session\_mode** string | **Choices:*** automatic * multihop * single-hop | BFD single-hop or multihop session-mode. | | | | **transmit\_interval** dictionary | | Transmit-interval options. | | | | | **minimum\_interval** integer | | Specify Minimum transmit interval. | | | | | **threshold** integer | | Specify high transmit interval triggering a trap. | | | | **version** string | **Choices:*** 0 * 1 * automatic | Specify BFD protocol version number. | | | **bgp\_error\_tolerance** dictionary | | Handle BGP malformed updates softly. | | | | **malformed\_route\_limit** integer | | Maximum number of malformed routes from a peer. | | | | **malformed\_update\_log\_interval** integer | | Time used when logging malformed update. | | | | **no\_malformed\_route\_limit** boolean | **Choices:*** no * yes | Specify no malformed route limit. | | | | **set** boolean | **Choices:*** no * yes | Set BGP malformed updates softly. | | | **bmp** dictionary | | Specific settings to override the routing-options settings. | | | | **monitor** boolean | **Choices:*** no * yes | Enable/Disable monitoring. | | | | **route\_monitoring** dictionary | | Control route monitoring settings. | | | | | **none** boolean | **Choices:*** no * yes | Do not send route montoring messages. | | | | | **post\_policy** boolean | **Choices:*** no * yes | Send post policy route montoring messages. | | | | | **post\_policy\_exclude\_non\_eligible** boolean | **Choices:*** no * yes | Send post policy route montoring messages and exclude unresolved routes, etc. | | | | | **post\_policy\_exclude\_non\_feasible** boolean | **Choices:*** no * yes | Send pre policy route montoring messages and exclude looped routes, etc. | | | | | **pre\_policy** boolean | **Choices:*** no * yes | Send pre policy route montoring messages. | | | **cluster\_id** string | | Specify cluster identifier. | | | **damping** boolean | **Choices:*** no * yes | Enable route flap damping. | | | **description** string | | Specify text description. | | | **disable** boolean | **Choices:*** no * yes | Disable BGP. | | | **egress\_te** dictionary | | Use Egress Peering traffic engineering. | | | | **backup\_path** string | | The 'egress-te-backup-paths template' to use for this peer. | | | | **set** boolean | **Choices:*** no * yes | Set the attribute. | | | **egress\_te\_backup\_paths** dictionary | | Backup-path for Egress-TE peer interface failure. | | | | **templates** list / elements=dictionary | | Specify Backup-path template. | | | | | **ip\_forward** dictionary | | Use IP-forward backup path for Egress TE. | | | | | | **rti\_name** string | | Routing-instance to use as IP forward backup-path. | | | | | | **set** boolean | **Choices:*** no * yes | Set use IP-forward backup path for Egress TE. | | | | | **path\_name** string / required | | Name of Egress-TE backup path. | | | | | **peers** list / elements=string | | Specify address of BGP peer to use as backup next-hop. | | | | | **remote\_nexthop** string | | Specify address of remote-nexthop to use as backup path. | | | **egress\_te\_set\_segment** list / elements=dictionary | | Configure BGP-Peer-Set segment. | | | | **egress\_te\_backup\_segment\_label** integer | | BGP-Peer-Set SID label value from static label pool. | | | | **label** integer | | Backup segment label value from static label pool. | | | | **name** string / required | | The BGP-Peer-Set segment name. | | | **egress\_te\_sid\_stats** boolean | **Choices:*** no * yes | Create BGP-Peer-SID sensor. | | | **enforce\_first\_as** boolean | **Choices:*** no * yes | Enforce neighbor AS is the first AS in AS-PATH attribute (EBGP). | | | **export** string | | Specify export policy. | | | **forwarding\_context** string | | Specify routing-instance used for data-forwarding and transport-session. | | | **graceful\_restart** dictionary | | BGP graceful restart options. | | | | **disable** boolean | **Choices:*** no * yes | Disable graceful restart. | | | | **dont\_help\_shared\_fate\_bfd\_down** boolean | **Choices:*** no * yes | Honor BFD-Down(C=0) if GR-restart not in progress. | | | | **forwarding\_state\_bit** dictionary | | Control forwarding-state flag negotiation. | | | | | **as\_rr\_client** boolean | **Choices:*** no * yes | As for a route reflector client. | | | | | **from\_fib** boolean | **Choices:*** no * yes | Always use state of associated FIB(s). | | | | **long\_lived** dictionary | | Long-lived graceful restart options. | | | | | **advertise\_to\_non\_llgr\_neighbor** dictionary | | Advertise stale routes to non-LLGR neighbors. | | | | | | **omit\_no\_export** boolean | **Choices:*** no * yes | Set Advertise stale routes to non-LLGR neighbors. | | | | | | **set** boolean | **Choices:*** no * yes | Set Advertise stale routes to non-LLGR neighbors. | | | | | **receiver\_disable** boolean | **Choices:*** no * yes | Disable receiver (helper) functionality. | | | | **restart\_time** integer | | Restart time used when negotiating with a peer. | | | | **set** boolean | **Choices:*** no * yes | Set BGP graceful restart options. | | | | **stale\_routes\_time** integer | | Maximum time for which stale routes are kept. | | | **groups** list / elements=dictionary | | Specify name of the group. | | | | **accept\_remote\_nexthop** boolean | **Choices:*** no * yes | Allow import policy to specify a non-directly connected next-hop. | | | | **add\_path\_display\_ipv4\_address** boolean | **Choices:*** no * yes | Display add-path path-id in IPv4 address format. | | | | **advertise\_bgp\_static** dictionary | | Advertise bgp-static routes. | | | | | **policy** string | | Specify static route advertisement policy. | | | | | **set** boolean | **Choices:*** no * yes | Set Advertise bgp-static routes. | | | | **advertise\_external** dictionary | | Advertise best external routes. | | | | | **conditional** boolean | **Choices:*** no * yes | Route matches active route upto med-comparison rule. | | | | | **set** boolean | **Choices:*** no * yes | Set Advertise best external routes. | | | | **advertise\_inactive** boolean | **Choices:*** no * yes | Advertise inactive routes. | | | | **advertise\_peer\_as** boolean | **Choices:*** no * yes | Advertise routes received from the same autonomous system. | | | | **allow** list / elements=string | | Configure peer connections for specific networks. | | | | **as\_override** boolean | **Choices:*** no * yes | Replace neighbor AS number with our AS number | | | | **authentication\_algorithm** string | **Choices:*** aes-128-cmac-96 * hmac-sha-1-96 * md5 | Specify authentication algorithm name. | | | | **authentication\_key** string | | Specify MD5 authentication key. | | | | **authentication\_key\_chain** string | | Specify authentication key chain name. | | | | **bfd\_liveness\_detection** dictionary | | Bidirectional Forwarding Detection (BFD) options. | | | | | **authentication** dictionary | | Authentication options. | | | | | | **algorithm** string | **Choices:*** keyed-md5 * keyed-sha-1 * meticulous-keyed-md5 * meticulous-keyed-sha-1 * simple-password | Specify algorithm name. | | | | | | **key\_chain** string | | Specify Key chain name. | | | | | | **loose\_check** boolean | **Choices:*** no * yes | Verify authentication only if authentication is negotiated. | | | | | **detection\_time** dictionary | | Specify Detection-time optionss. | | | | | | **threshold** integer | | Specify high detection-time triggering a trap (milliseconds). | | | | | **holddown\_interval** integer | | Specify time to hold the session-UP notification to the client. | | | | | **minimum\_interval** integer | | Specify minimum transmit and receive interval. | | | | | **minimum\_receive\_interval** integer | | Specify minimum receive interval. | | | | | **multiplier** integer | | Specify detection time multiplier. | | | | | **no\_adaptation** boolean | **Choices:*** no * yes | Disable adaptation. | | | | | **session\_mode** string | **Choices:*** automatic * multihop * single-hop | BFD single-hop or multihop session-mode. | | | | | **transmit\_interval** dictionary | | Transmit-interval options. | | | | | | **minimum\_interval** integer | | Specify Minimum transmit interval. | | | | | | **threshold** integer | | Specify high transmit interval triggering a trap. | | | | | **version** string | **Choices:*** 0 * 1 * automatic | Specify BFD protocol version number. | | | | **bgp\_error\_tolerance** dictionary | | Handle BGP malformed updates softly. | | | | | **malformed\_route\_limit** integer | | Maximum number of malformed routes from a peer. | | | | | **malformed\_update\_log\_interval** integer | | Time used when logging malformed update. | | | | | **no\_malformed\_route\_limit** boolean | **Choices:*** no * yes | Specify no malformed route limit. | | | | | **set** boolean | **Choices:*** no * yes | Set BGP malformed updates softly. | | | | **bmp** dictionary | | Specific settings to override the routing-options settings. | | | | | **monitor** boolean | **Choices:*** no * yes | Enable/Disable monitoring. | | | | | **route\_monitoring** dictionary | | Control route monitoring settings. | | | | | | **none** boolean | **Choices:*** no * yes | Do not send route montoring messages. | | | | | | **post\_policy** boolean | **Choices:*** no * yes | Send post policy route montoring messages. | | | | | | **post\_policy\_exclude\_non\_eligible** boolean | **Choices:*** no * yes | Send post policy route montoring messages and exclude unresolved routes, etc. | | | | | | **post\_policy\_exclude\_non\_feasible** boolean | **Choices:*** no * yes | Send pre policy route montoring messages and exclude looped routes, etc. | | | | | | **pre\_policy** boolean | **Choices:*** no * yes | Send pre policy route montoring messages. | | | | **cluster\_id** string | | Specify cluster identifier. | | | | **damping** boolean | **Choices:*** no * yes | Enable route flap damping. | | | | **description** string | | Specify text description. | | | | **egress\_te** dictionary | | Use Egress Peering traffic engineering. | | | | | **backup\_path** string | | The 'egress-te-backup-paths template' to use for this peer. | | | | | **set** boolean | **Choices:*** no * yes | Set the attribute. | | | | **enforce\_first\_as** boolean | **Choices:*** no * yes | Enforce neighbor AS is the first AS in AS-PATH attribute (EBGP). | | | | **export** string | | Specify export policy. | | | | **forwarding\_context** string | | Specify routing-instance used for data-forwarding and transport-session. | | | | **graceful\_restart** dictionary | | BGP graceful restart options. | | | | | **disable** boolean | **Choices:*** no * yes | Disable graceful restart. | | | | | **dont\_help\_shared\_fate\_bfd\_down** boolean | **Choices:*** no * yes | Honor BFD-Down(C=0) if GR-restart not in progress. | | | | | **forwarding\_state\_bit** dictionary | | Control forwarding-state flag negotiation. | | | | | | **as\_rr\_client** boolean | **Choices:*** no * yes | As for a route reflector client. | | | | | | **from\_fib** boolean | **Choices:*** no * yes | Always use state of associated FIB(s). | | | | | **long\_lived** dictionary | | Long-lived graceful restart options. | | | | | | **advertise\_to\_non\_llgr\_neighbor** dictionary | | Advertise stale routes to non-LLGR neighbors. | | | | | | | **omit\_no\_export** boolean | **Choices:*** no * yes | Set Advertise stale routes to non-LLGR neighbors. | | | | | | | **set** boolean | **Choices:*** no * yes | Set Advertise stale routes to non-LLGR neighbors. | | | | | | **receiver\_disable** boolean | **Choices:*** no * yes | Disable receiver (helper) functionality. | | | | | **restart\_time** integer | | Restart time used when negotiating with a peer. | | | | | **set** boolean | **Choices:*** no * yes | Set BGP graceful restart options. | | | | | **stale\_routes\_time** integer | | Maximum time for which stale routes are kept. | | | | **hold\_time** integer | | Specify hold time used when negotiating with a peer. | | | | **idle\_after\_switch\_over** dictionary | | Stop peer session from coming up after nonstop-routing switch-over. | | | | | **forever** boolean | **Choices:*** no * yes | Idle the peer until the user intervenes. | | | | | **timeout** integer | | Specify timeout value, in seconds, for starting peer after switch over. | | | | **import** list / elements=string | | Specify import policy. | | | | **include\_mp\_next\_hop** boolean | **Choices:*** no * yes | Include NEXT-HOP attribute in multiprotocol updates. | | | | **ipsec\_sa** string | | Specify IPSec SA name. | | | | **keep** string | **Choices:*** all * none | Specify how to retain routes in the routing table. | | | | **local\_address** string | | Specify Address of local end of BGP session. | | | | **local\_as** dictionary | | Local autonomous system number. | | | | | **alias** boolean | **Choices:*** no * yes | Treat this AS as an alias to the system AS. | | | | | **as\_num** string / required | | Autonomous system number in plain number or (asdot notation) format. | | | | | **loops** integer | | Maximum number of times this AS can be in an AS path. | | | | | **no\_prepend\_global\_as** boolean | **Choices:*** no * yes | Maximum number of times this AS can be in an AS path. | | | | | **private** boolean | **Choices:*** no * yes | Hide this local AS in paths learned from this peering. | | | | **local\_interface** string | | Specify Local interface for IPv6 link local EBGP peering. | | | | **local\_preference** string | | Specify value of LOCAL\_PREF path attribute. | | | | **log\_updown** boolean | **Choices:*** no * yes | Enable log a message for peer state transitions. | | | | **metric\_out** dictionary | | Specify route metric sent in MED. | | | | | **igp** dictionary | | Track the IGP metric. | | | | | | **delay\_med\_update** boolean | **Choices:*** no * yes | Delay updating MED when IGP metric increases. | | | | | | **metric\_offset** integer | | Specify metric offset for MED. | | | | | | **set** boolean | **Choices:*** no * yes | Set track the IGP metric. | | | | | **metric\_value** integer | | Specify metric value. | | | | | **minimum\_igp** dictionary | | Track the minimum IGP metric. | | | | | | **metric\_offset** integer | | Specify metric offset for MED. | | | | | | **set** boolean | **Choices:*** no * yes | Set track the minimum IGP metric. | | | | **mtu\_discovery** boolean | **Choices:*** no * yes | Enable TCP path MTU discovery. | | | | **multihop** dictionary | | Configure an EBGP multihop session. | | | | | **no\_nexthop\_change** boolean | **Choices:*** no * yes | Do not change next hop to self in advertisements. | | | | | **set** boolean | **Choices:*** no * yes | Set an EBGP multihop session. | | | | | **ttl** integer | | TTL value for the session. | | | | **multipath** dictionary | | Allow load sharing among multiple BGP paths. | | | | | **disable** boolean | **Choices:*** no * yes | Disable Multipath. | | | | | **multiple\_as** boolean | **Choices:*** no * yes | Use paths received from different ASs. | | | | | **multiple\_as\_disable** boolean | **Choices:*** no * yes | Disable multipath. | | | | | **set** boolean | **Choices:*** no * yes | Set allow load sharing among multiple BGP paths. | | | | **name** string | | Specify the name of the group | | | | **neighbors** list / elements=dictionary | | Specify list of neighbors. | | | | | **accept\_remote\_nexthop** boolean | **Choices:*** no * yes | Allow import policy to specify a non-directly connected next-hop. | | | | | **add\_path\_display\_ipv4\_address** boolean | **Choices:*** no * yes | Display add-path path-id in IPv4 address format. | | | | | **advertise\_bgp\_static** dictionary | | Advertise bgp-static routes. | | | | | | **policy** string | | Specify static route advertisement policy. | | | | | | **set** boolean | **Choices:*** no * yes | Set Advertise bgp-static routes. | | | | | **advertise\_external** dictionary | | Advertise best external routes. | | | | | | **conditional** boolean | **Choices:*** no * yes | Route matches active route upto med-comparison rule. | | | | | | **set** boolean | **Choices:*** no * yes | Set Advertise best external routes. | | | | | **advertise\_inactive** boolean | **Choices:*** no * yes | Advertise inactive routes. | | | | | **advertise\_peer\_as** boolean | **Choices:*** no * yes | Advertise routes received from the same autonomous system. | | | | | **as\_override** boolean | **Choices:*** no * yes | Replace neighbor AS number with our AS number | | | | | **authentication\_algorithm** string | **Choices:*** aes-128-cmac-96 * hmac-sha-1-96 * md5 | Specify authentication algorithm name. | | | | | **authentication\_key** string | | Specify MD5 authentication key. | | | | | **authentication\_key\_chain** string | | Specify authentication key chain name. | | | | | **bfd\_liveness\_detection** dictionary | | Bidirectional Forwarding Detection (BFD) options. | | | | | | **authentication** dictionary | | Authentication options. | | | | | | | **algorithm** string | **Choices:*** keyed-md5 * keyed-sha-1 * meticulous-keyed-md5 * meticulous-keyed-sha-1 * simple-password | Specify algorithm name. | | | | | | | **key\_chain** string | | Specify Key chain name. | | | | | | | **loose\_check** boolean | **Choices:*** no * yes | Verify authentication only if authentication is negotiated. | | | | | | **detection\_time** dictionary | | Specify Detection-time optionss. | | | | | | | **threshold** integer | | Specify high detection-time triggering a trap (milliseconds). | | | | | | **holddown\_interval** integer | | Specify time to hold the session-UP notification to the client. | | | | | | **minimum\_interval** integer | | Specify minimum transmit and receive interval. | | | | | | **minimum\_receive\_interval** integer | | Specify minimum receive interval. | | | | | | **multiplier** integer | | Specify detection time multiplier. | | | | | | **no\_adaptation** boolean | **Choices:*** no * yes | Disable adaptation. | | | | | | **session\_mode** string | **Choices:*** automatic * multihop * single-hop | BFD single-hop or multihop session-mode. | | | | | | **transmit\_interval** dictionary | | Transmit-interval options. | | | | | | | **minimum\_interval** integer | | Specify Minimum transmit interval. | | | | | | | **threshold** integer | | Specify high transmit interval triggering a trap. | | | | | | **version** string | **Choices:*** 0 * 1 * automatic | Specify BFD protocol version number. | | | | | **bgp\_error\_tolerance** dictionary | | Handle BGP malformed updates softly. | | | | | | **malformed\_route\_limit** integer | | Maximum number of malformed routes from a peer. | | | | | | **malformed\_update\_log\_interval** integer | | Time used when logging malformed update. | | | | | | **no\_malformed\_route\_limit** boolean | **Choices:*** no * yes | Specify no malformed route limit. | | | | | | **set** boolean | **Choices:*** no * yes | Set BGP malformed updates softly. | | | | | **bmp** dictionary | | Specific settings to override the routing-options settings. | | | | | | **monitor** boolean | **Choices:*** no * yes | Enable/Disable monitoring. | | | | | | **route\_monitoring** dictionary | | Control route monitoring settings. | | | | | | | **none** boolean | **Choices:*** no * yes | Do not send route montoring messages. | | | | | | | **post\_policy** boolean | **Choices:*** no * yes | Send post policy route montoring messages. | | | | | | | **post\_policy\_exclude\_non\_eligible** boolean | **Choices:*** no * yes | Send post policy route montoring messages and exclude unresolved routes, etc. | | | | | | | **post\_policy\_exclude\_non\_feasible** boolean | **Choices:*** no * yes | Send pre policy route montoring messages and exclude looped routes, etc. | | | | | | | **pre\_policy** boolean | **Choices:*** no * yes | Send pre policy route montoring messages. | | | | | **cluster\_id** string | | Specify cluster identifier. | | | | | **damping** boolean | **Choices:*** no * yes | Enable route flap damping. | | | | | **description** string | | Specify neighbor description. | | | | | **egress\_te** dictionary | | Use Egress Peering traffic engineering. | | | | | | **backup\_path** string | | The 'egress-te-backup-paths template' to use for this peer. | | | | | | **set** boolean | **Choices:*** no * yes | Set the attribute. | | | | | **enforce\_first\_as** boolean | **Choices:*** no * yes | Enforce neighbor AS is the first AS in AS-PATH attribute (EBGP). | | | | | **export** string | | Specify export policy. | | | | | **forwarding\_context** string | | Specify routing-instance used for data-forwarding and transport-session. | | | | | **graceful\_restart** dictionary | | BGP graceful restart options. | | | | | | **disable** boolean | **Choices:*** no * yes | Disable graceful restart. | | | | | | **dont\_help\_shared\_fate\_bfd\_down** boolean | **Choices:*** no * yes | Honor BFD-Down(C=0) if GR-restart not in progress. | | | | | | **forwarding\_state\_bit** dictionary | | Control forwarding-state flag negotiation. | | | | | | | **as\_rr\_client** boolean | **Choices:*** no * yes | As for a route reflector client. | | | | | | | **from\_fib** boolean | **Choices:*** no * yes | Always use state of associated FIB(s). | | | | | | **long\_lived** dictionary | | Long-lived graceful restart options. | | | | | | | **advertise\_to\_non\_llgr\_neighbor** dictionary | | Advertise stale routes to non-LLGR neighbors. | | | | | | | | **omit\_no\_export** boolean | **Choices:*** no * yes | Set Advertise stale routes to non-LLGR neighbors. | | | | | | | | **set** boolean | **Choices:*** no * yes | Set Advertise stale routes to non-LLGR neighbors. | | | | | | | **receiver\_disable** boolean | **Choices:*** no * yes | Disable receiver (helper) functionality. | | | | | | **restart\_time** integer | | Restart time used when negotiating with a peer. | | | | | | **set** boolean | **Choices:*** no * yes | Set BGP graceful restart options. | | | | | | **stale\_routes\_time** integer | | Maximum time for which stale routes are kept. | | | | | **hold\_time** integer | | Specify hold time used when negotiating with a peer. | | | | | **idle\_after\_switch\_over** dictionary | | Stop peer session from coming up after nonstop-routing switch-over. | | | | | | **forever** boolean | **Choices:*** no * yes | Idle the peer until the user intervenes. | | | | | | **timeout** integer | | Specify timeout value, in seconds, for starting peer after switch over. | | | | | **import** list / elements=string | | Specify import policy. | | | | | **include\_mp\_next\_hop** boolean | **Choices:*** no * yes | Include NEXT-HOP attribute in multiprotocol updates. | | | | | **ipsec\_sa** string | | Specify IPSec SA name. | | | | | **keep** string | **Choices:*** all * none | Specify how to retain routes in the routing table. | | | | | **local\_address** string | | Specify Address of local end of BGP session. | | | | | **local\_as** dictionary | | Local autonomous system number. | | | | | | **alias** boolean | **Choices:*** no * yes | Treat this AS as an alias to the system AS. | | | | | | **as\_num** string / required | | Autonomous system number in plain number or (asdot notation) format. | | | | | | **loops** integer | | Maximum number of times this AS can be in an AS path. | | | | | | **no\_prepend\_global\_as** boolean | **Choices:*** no * yes | Maximum number of times this AS can be in an AS path. | | | | | | **private** boolean | **Choices:*** no * yes | Hide this local AS in paths learned from this peering. | | | | | **local\_interface** string | | Specify Local interface for IPv6 link local EBGP peering. | | | | | **local\_preference** string | | Specify value of LOCAL\_PREF path attribute. | | | | | **log\_updown** boolean | **Choices:*** no * yes | Enable log a message for peer state transitions. | | | | | **metric\_out** dictionary | | Specify route metric sent in MED. | | | | | | **igp** dictionary | | Track the IGP metric. | | | | | | | **delay\_med\_update** boolean | **Choices:*** no * yes | Delay updating MED when IGP metric increases. | | | | | | | **metric\_offset** integer | | Specify metric offset for MED. | | | | | | | **set** boolean | **Choices:*** no * yes | Set track the IGP metric. | | | | | | **metric\_value** integer | | Specify metric value. | | | | | | **minimum\_igp** dictionary | | Track the minimum IGP metric. | | | | | | | **metric\_offset** integer | | Specify metric offset for MED. | | | | | | | **set** boolean | **Choices:*** no * yes | Set track the minimum IGP metric. | | | | | **mtu\_discovery** boolean | **Choices:*** no * yes | Enable TCP path MTU discovery. | | | | | **multihop** dictionary | | Configure an EBGP multihop session. | | | | | | **no\_nexthop\_change** boolean | **Choices:*** no * yes | Do not change next hop to self in advertisements. | | | | | | **set** boolean | **Choices:*** no * yes | Set an EBGP multihop session. | | | | | | **ttl** integer | | TTL value for the session. | | | | | **multipath** dictionary | | Allow load sharing among multiple BGP paths. | | | | | | **disable** boolean | **Choices:*** no * yes | Disable Multipath. | | | | | | **multiple\_as** boolean | **Choices:*** no * yes | Use paths received from different ASs. | | | | | | **multiple\_as\_disable** boolean | **Choices:*** no * yes | Disable multipath. | | | | | | **set** boolean | **Choices:*** no * yes | Set allow load sharing among multiple BGP paths. | | | | | **neighbor\_address** string | | Specify neighbor address. | | | | | **no\_advertise\_peer\_as** boolean | **Choices:*** no * yes | Allows to not advertise routes received from the same autonomous system. | | | | | **no\_aggregator\_id** boolean | **Choices:*** no * yes | Set router ID in aggregator path attribute to 0. | | | | | **no\_client\_reflect** boolean | **Choices:*** no * yes | Disable intracluster route redistribution. | | | | | **out\_delay** integer | | Specify how long before exporting routes from routing table. | | | | | **outbound\_route\_filter** dictionary | | Dynamically negotiated cooperative route filtering. | | | | | | **bgp\_orf\_cisco\_mode** boolean | **Choices:*** no * yes | Using BGP ORF capability code 130 and Prefix ORF type 128. | | | | | | **prefix\_based** dictionary | | Prefix-based outbound route filtering. | | | | | | | **accept** dictionary | | Honor Prefix-based ORFs from remote peers. | | | | | | | | **inet** boolean | **Choices:*** no * yes | Honor IPv4 prefix filters. | | | | | | | | **inet6** boolean | **Choices:*** no * yes | Honor IPv6 prefix filters. | | | | | | | | **set** boolean | **Choices:*** no * yes | Set honor Prefix-based ORFs from remote peers. | | | | | | | **set** boolean | **Choices:*** no * yes | Set prefix-based outbound route filtering. | | | | | **passive** boolean | **Choices:*** no * yes | Specify to not send open messages to a peer. | | | | | **peer\_as** string | | Specify Autonomous system number in plain number or 'higher 16bits'.'Lower 16 bits' format. | | | | | **preference** string | | Specify preference value. | | | | | **remove\_private** dictionary | | Remove well-known private AS numbers. | | | | | | **all** boolean | **Choices:*** no * yes | Remove all private AS numbers and do not stop at the first public AS number. | | | | | | **all\_replace** boolean | **Choices:*** no * yes | Specify private AS replacement. | | | | | | **all\_replace\_nearest** boolean | **Choices:*** no * yes | Use closest public AS number to replace a private AS number. | | | | | | **no\_peer\_loop\_check** boolean | **Choices:*** no * yes | Remove peer loop-check. | | | | | | **set** boolean | **Choices:*** no * yes | Remove well-known private AS numbers. | | | | | **rfc6514\_compliant\_safi129** boolean | **Choices:*** no * yes | Specify Compliance with RFC6514 SAFI129 format. | | | | | **route\_server\_client** boolean | **Choices:*** no * yes | Enable route server client behavior. | | | | | **tcp\_aggressive\_transmission** boolean | **Choices:*** no * yes | Enable aggressive transmission of pure TCP ACKs and retransmissions. | | | | | **tcp\_mss** integer | | Specify maximum TCP segment size. | | | | | **traceoptions** dictionary | | Configure trace options for BGP. | | | | | | **file** dictionary | | Specify trace file options. | | | | | | | **filename** string / required | | Specify name of file in which to write trace information. | | | | | | | **files** integer | | Specify maximum number of trace files. | | | | | | | **no\_world\_readable** boolean | **Choices:*** no * yes | Don't allow any user to read the log file. | | | | | | | **size** integer | | Specify maximum trace file size. | | | | | | | **world\_readable** boolean | **Choices:*** no * yes | Allow any user to read the log file. | | | | | | **flag** list / elements=dictionary | | Specify tracing parameters. | | | | | | | **detail** boolean | **Choices:*** no * yes | Trace detailed information. | | | | | | | **disable** boolean | **Choices:*** no * yes | Disable this trace flag. | | | | | | | **filter** dictionary | | Filter to apply to this flag. | | | | | | | | **match\_on\_prefix** boolean | **Choices:*** no * yes | Specify filter based on prefix. | | | | | | | | **policy** string | | Specify filter policy. | | | | | | | | **set** boolean | **Choices:*** no * yes | Set filter to apply to this flag. | | | | | | | **name** string / required | **Choices:*** 4byte-as * add-path * all * bfd * damping * egress-te * general * graceful-restart * keepalive * normal * nsr-synchronization * open * packets * policy * refresh * route * state * task * thread-io * thread-update-io * timer * update | specify event name | | | | | | | **receive** boolean | **Choices:*** no * yes | Trace received packets. | | | | | | | **send** boolean | **Choices:*** no * yes | Trace transmitted packets. | | | | | **ttl** integer | | Specify TTL value for the single-hop peer. | | | | | **unconfigured\_peer\_graceful\_restart** boolean | **Choices:*** no * yes | Specify BGP unconfigured peer graceful restart options. | | | | | **vpn\_apply\_export** boolean | **Choices:*** no * yes | Apply BGP export policy when exporting VPN routes. | | | | **no\_advertise\_peer\_as** boolean | **Choices:*** no * yes | Allows to not advertise routes received from the same autonomous system. | | | | **no\_aggregator\_id** boolean | **Choices:*** no * yes | Set router ID in aggregator path attribute to 0. | | | | **no\_client\_reflect** boolean | **Choices:*** no * yes | Disable intracluster route redistribution. | | | | **optimal\_route\_reflection** dictionary | | Enable optimal route reflection for this client group. | | | | | **igp\_backup** string | | Backup node identifier for this client group. | | | | | **igp\_primary** string | | Primary node identifier for this client group. | | | | **out\_delay** integer | | Specify how long before exporting routes from routing table. | | | | **outbound\_route\_filter** dictionary | | Dynamically negotiated cooperative route filtering. | | | | | **bgp\_orf\_cisco\_mode** boolean | **Choices:*** no * yes | Using BGP ORF capability code 130 and Prefix ORF type 128. | | | | | **prefix\_based** dictionary | | Prefix-based outbound route filtering. | | | | | | **accept** dictionary | | Honor Prefix-based ORFs from remote peers. | | | | | | | **inet** boolean | **Choices:*** no * yes | Honor IPv4 prefix filters. | | | | | | | **inet6** boolean | **Choices:*** no * yes | Honor IPv6 prefix filters. | | | | | | | **set** boolean | **Choices:*** no * yes | Set honor Prefix-based ORFs from remote peers. | | | | | | **set** boolean | **Choices:*** no * yes | Set prefix-based outbound route filtering. | | | | **passive** boolean | **Choices:*** no * yes | Specify to not send open messages to a peer. | | | | **peer\_as** string | | Specify Autonomous system number in plain number or 'higher 16bits'.'Lower 16 bits' format. | | | | **preference** string | | Specify preference value. | | | | **remove\_private** dictionary | | Remove well-known private AS numbers. | | | | | **all** boolean | **Choices:*** no * yes | Remove all private AS numbers and do not stop at the first public AS number. | | | | | **all\_replace** boolean | **Choices:*** no * yes | Specify private AS replacement. | | | | | **all\_replace\_nearest** boolean | **Choices:*** no * yes | Use closest public AS number to replace a private AS number. | | | | | **no\_peer\_loop\_check** boolean | **Choices:*** no * yes | Remove peer loop-check. | | | | | **set** boolean | **Choices:*** no * yes | Remove well-known private AS numbers. | | | | **rfc6514\_compliant\_safi129** boolean | **Choices:*** no * yes | Specify Compliance with RFC6514 SAFI129 format. | | | | **route\_server\_client** boolean | **Choices:*** no * yes | Enable route server client behavior. | | | | **tcp\_aggressive\_transmission** boolean | **Choices:*** no * yes | Enable aggressive transmission of pure TCP ACKs and retransmissions. | | | | **tcp\_mss** integer | | Specify maximum TCP segment size. | | | | **traceoptions** dictionary | | Configure trace options for BGP. | | | | | **file** dictionary | | Specify trace file options. | | | | | | **filename** string / required | | Specify name of file in which to write trace information. | | | | | | **files** integer | | Specify maximum number of trace files. | | | | | | **no\_world\_readable** boolean | **Choices:*** no * yes | Don't allow any user to read the log file. | | | | | | **size** integer | | Specify maximum trace file size. | | | | | | **world\_readable** boolean | **Choices:*** no * yes | Allow any user to read the log file. | | | | | **flag** list / elements=dictionary | | Specify tracing parameters. | | | | | | **detail** boolean | **Choices:*** no * yes | Trace detailed information. | | | | | | **disable** boolean | **Choices:*** no * yes | Disable this trace flag. | | | | | | **filter** dictionary | | Filter to apply to this flag. | | | | | | | **match\_on\_prefix** boolean | **Choices:*** no * yes | Specify filter based on prefix. | | | | | | | **policy** string | | Specify filter policy. | | | | | | | **set** boolean | **Choices:*** no * yes | Set filter to apply to this flag. | | | | | | **name** string / required | **Choices:*** 4byte-as * add-path * all * bfd * damping * egress-te * general * graceful-restart * keepalive * normal * nsr-synchronization * open * packets * policy * refresh * route * state * task * thread-io * thread-update-io * timer * update | specify event name | | | | | | **receive** boolean | **Choices:*** no * yes | Trace received packets. | | | | | | **send** boolean | **Choices:*** no * yes | Trace transmitted packets. | | | | **ttl** integer | | Specify TTL value for the single-hop peer. | | | | **type** string | **Choices:*** external * internal | Specify BGP group type. | | | | **unconfigured\_peer\_graceful\_restart** boolean | **Choices:*** no * yes | Specify BGP unconfigured peer graceful restart options. | | | | **vpn\_apply\_export** boolean | **Choices:*** no * yes | Apply BGP export policy when exporting VPN routes. | | | **hold\_time** integer | | Specify hold time used when negotiating with a peer. | | | **holddown\_all\_stale\_labels** boolean | **Choices:*** no * yes | Hold all BGP stale-labels, facilating make-before-break for new label advertisements. | | | **idle\_after\_switch\_over** dictionary | | Stop peer session from coming up after nonstop-routing switch-over. | | | | **forever** boolean | **Choices:*** no * yes | Idle the peer until the user intervenes. | | | | **timeout** integer | | Specify timeout value, in seconds, for starting peer after switch over. | | | **import** list / elements=string | | Specify import policy. | | | **include\_mp\_next\_hop** boolean | **Choices:*** no * yes | Include NEXT-HOP attribute in multiprotocol updates. | | | **ipsec\_sa** string | | Specify IPSec SA name. | | | **keep** string | **Choices:*** all * none | Specify how to retain routes in the routing table. | | | **local\_address** string | | Specify Address of local end of BGP session. | | | **local\_as** dictionary | | Local autonomous system number. | | | | **alias** boolean | **Choices:*** no * yes | Treat this AS as an alias to the system AS. | | | | **as\_num** string / required | | Autonomous system number in plain number or (asdot notation) format. | | | | **loops** integer | | Maximum number of times this AS can be in an AS path. | | | | **no\_prepend\_global\_as** boolean | **Choices:*** no * yes | Maximum number of times this AS can be in an AS path. | | | | **private** boolean | **Choices:*** no * yes | Hide this local AS in paths learned from this peering. | | | **local\_interface** string | | Specify Local interface for IPv6 link local EBGP peering. | | | **local\_preference** string | | Specify value of LOCAL\_PREF path attribute. | | | **log\_updown** boolean | **Choices:*** no * yes | Enable log a message for peer state transitions. | | | **loops** integer | | Specify maximum number of times this AS can be in an AS path. | | | **metric\_out** dictionary | | Specify route metric sent in MED. | | | | **igp** dictionary | | Track the IGP metric. | | | | | **delay\_med\_update** boolean | **Choices:*** no * yes | Delay updating MED when IGP metric increases. | | | | | **metric\_offset** integer | | Specify metric offset for MED. | | | | | **set** boolean | **Choices:*** no * yes | Set track the IGP metric. | | | | **metric\_value** integer | | Specify metric value. | | | | **minimum\_igp** dictionary | | Track the minimum IGP metric. | | | | | **metric\_offset** integer | | Specify metric offset for MED. | | | | | **set** boolean | **Choices:*** no * yes | Set track the minimum IGP metric. | | | **mtu\_discovery** boolean | **Choices:*** no * yes | Enable TCP path MTU discovery. | | | **multihop** dictionary | | Configure an EBGP multihop session. | | | | **no\_nexthop\_change** boolean | **Choices:*** no * yes | Do not change next hop to self in advertisements. | | | | **set** boolean | **Choices:*** no * yes | Set an EBGP multihop session. | | | | **ttl** integer | | TTL value for the session. | | | **multipath** dictionary | | Allow load sharing among multiple BGP paths. | | | | **disable** boolean | **Choices:*** no * yes | Disable Multipath. | | | | **multiple\_as** boolean | **Choices:*** no * yes | Use paths received from different ASs. | | | | **multiple\_as\_disable** boolean | **Choices:*** no * yes | Disable multipath. | | | | **set** boolean | **Choices:*** no * yes | Set allow load sharing among multiple BGP paths. | | | **multipath\_build\_priority** string | **Choices:*** low * medium | Configure the multipath build priority. | | | **no\_advertise\_peer\_as** boolean | **Choices:*** no * yes | Allows to not advertise routes received from the same autonomous system. | | | **no\_aggregator\_id** boolean | **Choices:*** no * yes | Set router ID in aggregator path attribute to 0. | | | **no\_client\_reflect** boolean | **Choices:*** no * yes | Disable intracluster route redistribution. | | | **no\_precision\_timers** boolean | **Choices:*** no * yes | Specify not to use precision timers for scheduling keepalives. | | | **out\_delay** integer | | Specify how long before exporting routes from routing table. | | | **outbound\_route\_filter** dictionary | | Dynamically negotiated cooperative route filtering. | | | | **bgp\_orf\_cisco\_mode** boolean | **Choices:*** no * yes | Using BGP ORF capability code 130 and Prefix ORF type 128. | | | | **prefix\_based** dictionary | | Prefix-based outbound route filtering. | | | | | **accept** dictionary | | Honor Prefix-based ORFs from remote peers. | | | | | | **inet** boolean | **Choices:*** no * yes | Honor IPv4 prefix filters. | | | | | | **inet6** boolean | **Choices:*** no * yes | Honor IPv6 prefix filters. | | | | | | **set** boolean | **Choices:*** no * yes | Set honor Prefix-based ORFs from remote peers. | | | | | **set** boolean | **Choices:*** no * yes | Set prefix-based outbound route filtering. | | | **output\_queue\_priority** dictionary | | BGP output queue priority scheduler for updates. | | | | **defaults** dictionary | | Map policy's priority class and BGP output-queue. | | | | | **high** dictionary | | Assign the 'high' priority class to this output-queue. | | | | | | **expedited** boolean | **Choices:*** no * yes | Expedited queue; highest priority. | | | | | | **priority** integer | | Specify output queue priorit. | | | | | **low** dictionary | | Assign the 'low' priority class to this output-queue. | | | | | | **expedited** boolean | **Choices:*** no * yes | Expedited queue; highest priority. | | | | | | **priority** integer | | Specify output queue priorit. | | | | | **medium** dictionary | | Assign the 'medium' priority class to this output-queue. | | | | | | **expedited** boolean | **Choices:*** no * yes | Expedited queue; highest priority. | | | | | | **priority** integer | | Specify output queue priorit. | | | | **expedited\_update\_tokens** integer | | Expedited queue; highest priority for number of tokens. | | | | **priority\_update\_tokens** list / elements=dictionary | | Output queue priority; higher is better. | | | | | **priority** integer / required | | Specify the priority. | | | | | **update\_tokens** integer / required | | Specify update\_tokens. | | | **passive** boolean | **Choices:*** no * yes | Specify to not send open messages to a peer. | | | **path\_selection** dictionary | | Configure path selection strategy. | | | | **always\_compare\_med** boolean | **Choices:*** no * yes | Compare MED on paths from different AS. | | | | **as\_path\_ignore** boolean | **Choices:*** no * yes | Ignore AS path comparison during path selection. | | | | **cisco\_non\_deterministic** boolean | **Choices:*** no * yes | Use Cisco IOS nondeterministic path selection algorithm. | | | | **external\_router\_id** boolean | **Choices:*** no * yes | Compare router ID on BGP externals. | | | | **l2vpn\_use\_bgp\_rules** boolean | **Choices:*** no * yes | Use standard BGP rules during L2VPN path selection. | | | | **med\_plus\_igp** dictionary | | Add IGP cost to next-hop to MED before comparing MED values. | | | | | **igp\_multiplier** integer | | Specify multiplier for IGP cost to next-hop. | | | | | **med\_multiplier** integer | | Specify Multiplier for MED. | | | | | **set** boolean | **Choices:*** no * yes | Set med-plus-igp attribute. | | | **peer\_as** string | | Specify Autonomous system number in plain number or 'higher 16bits'.'Lower 16 bits' format. | | | **precision\_timers** boolean | **Choices:*** no * yes | Use precision timers for scheduling keepalives. | | | **preference** string | | Specify preference value. | | | **remove\_private** dictionary | | Remove well-known private AS numbers. | | | | **all** boolean | **Choices:*** no * yes | Remove all private AS numbers and do not stop at the first public AS number. | | | | **all\_replace** boolean | **Choices:*** no * yes | Specify private AS replacement. | | | | **all\_replace\_nearest** boolean | **Choices:*** no * yes | Use closest public AS number to replace a private AS number. | | | | **no\_peer\_loop\_check** boolean | **Choices:*** no * yes | Remove peer loop-check. | | | | **set** boolean | **Choices:*** no * yes | Remove well-known private AS numbers. | | | **rfc6514\_compliant\_safi129** boolean | **Choices:*** no * yes | Specify Compliance with RFC6514 SAFI129 format. | | | **route\_server\_client** boolean | **Choices:*** no * yes | Enable route server client behavior. | | | **send\_addpath\_optimization** boolean | **Choices:*** no * yes | Enable BGP addpath advertisement optimization. | | | **snmp\_options** dictionary | | Customize SNMP behaviors specifically for BGP MIBs. | | | | **backward\_traps\_only\_from\_established** boolean | **Choices:*** no * yes | Limit traps for backward transitions to only those moving from Established state. | | | | **emit\_inet\_address\_length\_in\_oid** boolean | **Choices:*** no * yes | Emit Length in OID for InetAddress MIB type. | | | **sr\_preference\_override** string | | Replace received segment routing traffic engineering preference value with override value. | | | **stale\_labels\_holddown\_period** integer | | Specify duration (sec) MPLS labels allocated by BGP are kept after they go stale. | | | **tcp\_aggressive\_transmission** boolean | **Choices:*** no * yes | Enable aggressive transmission of pure TCP ACKs and retransmissions. | | | **tcp\_mss** integer | | Specify maximum TCP segment size. | | | **traceoptions** dictionary | | Configure trace options for BGP. | | | | **file** dictionary | | Specify trace file options. | | | | | **filename** string / required | | Specify name of file in which to write trace information. | | | | | **files** integer | | Specify maximum number of trace files. | | | | | **no\_world\_readable** boolean | **Choices:*** no * yes | Don't allow any user to read the log file. | | | | | **size** integer | | Specify maximum trace file size. | | | | | **world\_readable** boolean | **Choices:*** no * yes | Allow any user to read the log file. | | | | **flag** list / elements=dictionary | | Specify tracing parameters. | | | | | **detail** boolean | **Choices:*** no * yes | Trace detailed information. | | | | | **disable** boolean | **Choices:*** no * yes | Disable this trace flag. | | | | | **filter** dictionary | | Filter to apply to this flag. | | | | | | **match\_on\_prefix** boolean | **Choices:*** no * yes | Specify filter based on prefix. | | | | | | **policy** string | | Specify filter policy. | | | | | | **set** boolean | **Choices:*** no * yes | Set filter to apply to this flag. | | | | | **name** string / required | **Choices:*** 4byte-as * add-path * all * bfd * damping * egress-te * general * graceful-restart * keepalive * normal * nsr-synchronization * open * packets * policy * refresh * route * state * task * thread-io * thread-update-io * timer * update | specify event name | | | | | **receive** boolean | **Choices:*** no * yes | Trace received packets. | | | | | **send** boolean | **Choices:*** no * yes | Trace transmitted packets. | | | **traffic\_statistics\_labeled\_path** dictionary | | Collect periodic ingress labeled statistics for BGP label-switched paths. | | | | **file** dictionary | | Specify statistics file options. | | | | | **filename** string | | Specify name of file in which to write trace information. | | | | | **files** integer | | Specify maximum number of trace files. | | | | | **no\_world\_readable** boolean | **Choices:*** no * yes | Don't allow any user to read the log file. | | | | | **size** integer | | Specify maximum trace file size. | | | | | **world\_readable** boolean | **Choices:*** no * yes | Allow any user to read the log file. | | | | **interval** integer | | Specify time interval to collect statistics. | | | **ttl** integer | | Specify TTL value for the single-hop peer. | | | **unconfigured\_peer\_graceful\_restart** boolean | **Choices:*** no * yes | Specify BGP unconfigured peer graceful restart options. | | | **vpn\_apply\_export** boolean | **Choices:*** no * yes | Apply BGP export policy when exporting VPN routes. | | **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the Junos device by executing the command **show protocols bgp**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result | | **state** string | **Choices:*** purged * **merged** ← * replaced * deleted * gathered * parsed * rendered | The state the configuration should be left in. State *purged* removes all (routing-options autonomous-system, bgp global, bgp groups, bgp neighbors, bgp family and bgp group and neighbor family) the BGP configurations from the target device. Use caution with this state. State *deleted* only removes BGP attributes that this modules manages and does not negate the BGP process completely. Thereby, preserving address-family related configurations under BGP context. Running states *deleted* and *replaced* will result in an error if there are address-family configuration lines present under a neighbor.Please use the [junipernetworks.junos.junos\_bgp\_address\_family](junos_bgp_address_family_module) modules for prior cleanup. Refer to examples for more details. | Notes ----- Note * This module requires the netconf system service be enabled on the device being managed. * This module works with connection `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). * Tested against JunOS v18.4R1 Examples -------- ``` # Using merged # # Before state # ------------ # # admin# show protocols bgp # [edit] # admin# show routing-options autonomous-system # [edit] - name: Merge Junos BGP config junipernetworks.junos.junos_bgp_global: config: as_number: "65534" loops: 3 asdot_notation: true accept_remote_nexthop: true add_path_display_ipv4_address: true advertise_bgp_static: policy: "static-to-bgp" advertise_from_main_vpn_tables: true advertise_inactive: true authentication_algorithm: "md5" bgp_error_tolerance: malformed_route_limit: 20000000 bmp: monitor: true damping: true description: "This is configured with Junos_bgp resource module" egress_te_sid_stats: true hold_time: 5 holddown_all_stale_labels: true include_mp_next_hop: true log_updown: true no_advertise_peer_as: true no_aggregator_id: true no_client_reflect: true out_delay: 10 precision_timers: true preference: 2 state: merged # After state # ----------- # # admin# show routing-options autonomous-system # 65534 loops 3 asdot-notation; # admin# show protocols bgp # precision-timers; # advertise-from-main-vpn-tables; # holddown-all-stale-labels; # description "This is configured with Junos_bgp resource module"; # accept-remote-nexthop; # preference 2; # hold-time 5; # advertise-inactive; # no-advertise-peer-as; # no-aggregator-id; # out-delay 10; # log-updown; # damping; # bgp-error-tolerance { # malformed-route-limit 20000000; # } # authentication-algorithm md5; # no-client-reflect; # include-mp-next-hop; # bmp { # monitor enable; # } # advertise-bgp-static { # policy static-to-bgp; # } # add-path-display-ipv4-address; # egress-te-sid-stats; # Using merged # # Before state # ------------ # # admin# show routing-options autonomous-system # 65534 loops 3 asdot-notation; # admin# show protocols bgp # precision-timers; # advertise-from-main-vpn-tables; # holddown-all-stale-labels; # description "This is configured with Junos_bgp resource module"; # accept-remote-nexthop; # preference 2; # hold-time 5; # advertise-inactive; # no-advertise-peer-as; # no-aggregator-id; # out-delay 10; # log-updown; # damping; # bgp-error-tolerance { # malformed-route-limit 20000000; # } # authentication-algorithm md5; # no-client-reflect; # include-mp-next-hop; # bmp { # monitor enable; # } # advertise-bgp-static { # policy static-to-bgp; # } # add-path-display-ipv4-address; # egress-te-sid-stats; - name: Update running Junos BGP config junipernetworks.junos.junos_bgp_global: config: egress_te_backup_paths: templates: - path_name: customer1 peers: - '11.11.11.11' - '11.11.11.12' - '11.11.11.13' remote_nexthop: '2.2.2.2' groups: - name: 'internal' type: 'internal' vpn_apply_export: true out_delay: 30 accept_remote_nexthop: true add_path_display_ipv4_address: true peer_as: '65534' allow: - 'all' - '1.1.1.0/24' neighbors: - neighbor_address: '11.11.11.11' peer_as: '65534' out_delay: 11 - neighbor_address: '11.11.11.12' peer_as: '65534' out_delay: 12 - name: 'external' out_delay: 20 peer_as: '65534' accept_remote_nexthop: true add_path_display_ipv4_address: true neighbors: - neighbor_address: '12.12.12.12' peer_as: '65534' out_delay: 21 accept_remote_nexthop: true add_path_display_ipv4_address: true - neighbor_address: '11.11.11.13' peer_as: '65534' out_delay: 31 accept_remote_nexthop: true add_path_display_ipv4_address: true state: merged # After state # ----------- # # admin# show routing-options autonomous-system # 65534 loops 3 asdot-notation; # admin# show protocols bgp # precision-timers; # advertise-from-main-vpn-tables; # holddown-all-stale-labels; # egress-te-backup-paths { # template customer1 { # peer 11.11.11.11; # peer 11.11.11.12; # peer 11.11.11.13; # remote-nexthop { # 2.2.2.2; # } # } # } # description "This is configured with Junos_bgp resource module"; # accept-remote-nexthop; # preference 2; # hold-time 5; # advertise-inactive; # no-advertise-peer-as; # no-aggregator-id; # out-delay 10; # log-updown; # damping; # bgp-error-tolerance { # malformed-route-limit 20000000; # } # authentication-algorithm md5; # no-client-reflect; # include-mp-next-hop; # bmp { # monitor enable; # } # add-path-display-ipv4-address; # egress-te-sid-stats; # group internal { # type internal; # accept-remote-nexthop; # out-delay 30; # vpn-apply-export; # peer-as 65534; # add-path-display-ipv4-address; # allow [ 0.0.0.0/0 1.1.1.0/24 ]; # neighbor 11.11.11.11 { # out-delay 11; # peer-as 65534; # } # neighbor 11.11.11.12 { # out-delay 12; # peer-as 65534; # } # } # group external { # accept-remote-nexthop; # out-delay 20; # peer-as 65534; # add-path-display-ipv4-address; # neighbor 12.12.12.12 { # accept-remote-nexthop; # out-delay 21; # peer-as 65534; # add-path-display-ipv4-address; # } # neighbor 11.11.11.13 { # accept-remote-nexthop; # out-delay 31; # peer-as 65534; # add-path-display-ipv4-address; # } # } # Using replaced # # Before state # ------------ # # admin# show routing-options autonomous-system # [edit] # admin# show protocols bgp # precision-timers; # advertise-from-main-vpn-tables; # holddown-all-stale-labels; # description "This is configured with Junos_bgp resource module"; # accept-remote-nexthop; # preference 2; # hold-time 5; # advertise-inactive; # no-advertise-peer-as; # no-aggregator-id; # out-delay 10; # log-updown; # damping; # bgp-error-tolerance { # malformed-route-limit 20000000; # } # authentication-algorithm md5; # no-client-reflect; # include-mp-next-hop; # bmp { # monitor enable; # } # advertise-bgp-static { # policy static-to-bgp; # } # add-path-display-ipv4-address; # egress-te-sid-stats; - name: Replace Junos BGP global config junipernetworks.junos.junos_bgp_global: config: advertise_bgp_static: policy: "static-to-bgp" advertise_inactive: true authentication_algorithm: "md5" bfd_liveness_detection: minimum_receive_interval: 8 multiplier: 30 no_adaptation: true transmit_interval: minimum_interval: 4 version: "automatic" bgp_error_tolerance: malformed_route_limit: 40000000 description: "This is configured with Junos_bgp resource module replace" egress_te_sid_stats: true hold_time: 5 out_delay: 10 preference: "2" state: replaced # After state # ----------- # # admin# show protocols bgp # description "This is configured with Junos_bgp resource module replace"; # preference 2; # hold-time 5; # advertise-inactive; # out-delay 10; # bgp-error-tolerance { # malformed-route-limit 40000000; # } # authentication-algorithm md5; # advertise-bgp-static { # policy static-to-bgp; # } # bfd-liveness-detection { # version automatic; # minimum-receive-interval 8; # multiplier 30; # no-adaptation; # transmit-interval { # minimum-interval 4; # } # } # egress-te-sid-stats; # admin# show routing-options autonomous-system # [edit] # # Using deleted # # Before state # ------------ # # admin# show protocols bgp # precision-timers; # advertise-from-main-vpn-tables; # holddown-all-stale-labels; # description "This is configured with Junos_bgp resource module"; # accept-remote-nexthop; # preference 2; # hold-time 5; # advertise-inactive; # no-advertise-peer-as; # no-aggregator-id; # out-delay 10; # log-updown; # damping; # bgp-error-tolerance { # malformed-route-limit 20000000; # } # authentication-algorithm md5; # no-client-reflect; # include-mp-next-hop; # bmp { # monitor enable; # } # add-path-display-ipv4-address; # egress-te-sid-stats; # group internal { # out-delay 12; # } # admin# show routing-options autonomous-system # 65534 loops 3 asdot-notation; - name: Delete Junos BGP global config junipernetworks.junos.junos_bgp_global: config: state: deleted # After state # ----------- # admin# show protocols bgp # group internal { # out-delay 12; # } # admin# show protocols bgp # [edit] # admin# show routing-options autonomous-system # [edit] # Using gathered # # Before state # ------------ # # admin# show protocols bgp # description "This is configured with Junos_bgp resource module replace"; # preference 2; # hold-time 5; # advertise-inactive; # out-delay 10; # bgp-error-tolerance { # malformed-route-limit 40000000; # } # authentication-algorithm md5; # advertise-bgp-static { # policy static-to-bgp; # } # bfd-liveness-detection { # version automatic; # minimum-receive-interval 8; # multiplier 30; # no-adaptation; # transmit-interval { # minimum-interval 4; # } # } # egress-te-sid-stats; - name: Gather Junos BGP global config junipernetworks.junos.junos_bgp_global: config: state: gathered # # # ------------------------- # Module Execution Result # ------------------------- # # "gathered": { # "advertise_bgp_static": { # "policy": "static-to-bgp" # }, # "advertise_inactive": true, # "authentication_algorithm": "md5", # "bfd_liveness_detection": { # "minimum_receive_interval": 8, # "multiplier": 30, # "no_adaptation": true, # "transmit_interval": { # "minimum_interval": 4 # }, # "version": "automatic" # }, # "bgp_error_tolerance": { # "malformed_route_limit": 40000000 # }, # "description": "This is configured with Junos_bgp resource module replace", # "egress_te_sid_stats": true, # "hold_time": 5, # "out_delay": 10, # "preference": "2" # } # # # Using purged # # Before state # ------------ # # admin# show protocols bgp # precision-timers; # advertise-from-main-vpn-tables; # holddown-all-stale-labels; # description "This is configured with Junos_bgp resource module"; # accept-remote-nexthop; # preference 2; # hold-time 5; # advertise-inactive; # no-advertise-peer-as; # no-aggregator-id; # out-delay 10; # log-updown; # damping; # bgp-error-tolerance { # malformed-route-limit 20000000; # } # authentication-algorithm md5; # no-client-reflect; # include-mp-next-hop; # bmp { # monitor enable; # } # add-path-display-ipv4-address; # egress-te-sid-stats; # group internal { # out-delay 12; # } # admin# show routing-options autonomous-system # 65534 loops 3 asdot-notation; - name: Purge Junos BGP global config junipernetworks.junos.junos_bgp_global: config: state: purged # After state # ---------- # admin# show protocols bgp # # [edit] # admin# show routing-options autonomous-system # #[edit] # Using rendered # # - name: Render the commands for provided configuration junipernetworks.junos.junos_bgp_global: config: authentication_algorithm: "md5" bfd_liveness_detection: minimum_receive_interval: 4 multiplier: 10 no_adaptation: true transmit_interval: minimum_interval: 2 version: "automatic" bgp_error_tolerance: malformed_route_limit: 20000000 bmp: monitor: true damping: true description: "This is configured with Junos_bgp resource module" egress_te_sid_stats: true hold_time: 5 state: rendered # # # ------------------------- # Module Execution Result # ------------------------- # # # "rendered": " # <nc:protocols # xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> # <nc:bgp> # <nc:damping/> # <nc:egress-te-sid-stats/> # <nc:authentication-algorithm>md5</nc:authentication-algorithm> # <nc:description>This is configured with Junos_bgp resource module</nc:description> # <nc:hold-time>5</nc:hold-time> # <nc:bfd-liveness-detection> # <nc:transmit-interval> # <nc:minimum-interval>2</nc:minimum-interval> # </nc:transmit-interval> # <nc:minimum-receive-interval>4</nc:minimum-receive-interval> # <nc:multiplier>10</nc:multiplier> # <nc:no-adaptation/> # <nc:version>automatic</nc:version> # </nc:bfd-liveness-detection> # <nc:bgp-error-tolerance> # <nc:malformed-route-limit>20000000</nc:malformed-route-limit> # </nc:bgp-error-tolerance> # <nc:bmp> # <nc:monitor>enable</nc:monitor> # </nc:bmp> # </nc:bgp> # </nc:protocols>" # # Using parsed # parsed.cfg # ------------ # <?xml version="1.0" encoding="UTF-8"?> # <rpc-reply message-id="urn:uuid:0cadb4e8-5bba-47f4-986e-72906227007f"> # <configuration changed-seconds="1590139550" changed-localtime="2020-05-22 09:25:50 UTC"> # <version>18.4R1-S2.4</version> # <protocols> # <bgp> # <precision-timers /> # <advertise-from-main-vpn-tables /> # <holddown-all-stale-labels /> # <description>This is configured with Junos_bgp resource module</description> # <accept-remote-nexthop /> # <preference>2</preference> # <hold-time>5</hold-time> # <advertise-inactive /> # <no-advertise-peer-as /> # <no-aggregator-id /> # <out-delay>10</out-delay> # <log-updown /> # <damping /> # <bgp-error-tolerance> # <malformed-route-limit>20000000</malformed-route-limit> # </bgp-error-tolerance> # <authentication-algorithm>md5</authentication-algorithm> # <remove-private /> # <no-client-reflect /> # <include-mp-next-hop /> # <bmp> # <monitor>disable</monitor> # <route-monitoring> # <none /> # </route-monitoring> # </bmp> # <advertise-bgp-static> # <policy>static-to-bgp</policy> # </advertise-bgp-static> # <add-path-display-ipv4-address /> # <bfd-liveness-detection> # <version>automatic</version> # <minimum-receive-interval>4</minimum-receive-interval> # <multiplier>10</multiplier> # <no-adaptation /> # <transmit-interval> # <minimum-interval>2</minimum-interval> # </transmit-interval> # <detection-time> # <threshold>300000</threshold> # </detection-time> # </bfd-liveness-detection> # <egress-te-sid-stats /> # <group> # <name>internal</name> # <out-delay>8</out-delay> # </group> # <group> # <name>external</name> # <out-delay>9</out-delay> # </group> # <group> # <name>inboun</name> # <type>internal</type> # </group> # <group> # <name>ibgp</name> # <type>internal</type> # <local-address>10.2.2.2</local-address> # <export>static-to-bgp</export> # <neighbor> # <name>10.1.1.1</name> # </neighbor> # </group> # </bgp> # <ospf3> # <area> # <name>0.0.0.100</name> # <stub> # <default-metric>200</default-metric> # </stub> # <interface> # <name>so-0/0/0.0</name> # <metric>5</metric> # <priority>3</priority> # </interface> # </area> # </ospf3> # </protocols> # <routing-options> # <static> # <route> # <name>172.16.17.0/24</name> # <discard /> # </route> # </static> # <router-id>10.200.16.75</router-id> # <autonomous-system> # <as-number>65432</as-number> # </autonomous-system> # </routing-options> # </configuration> # </rpc-reply> - name: Parsed the device configuration to get output commands junipernetworks.junos.junos_bgp_global: running_config: "{{ lookup('file', './parsed.cfg') }}" state: parsed # # # ------------------------- # Module Execution Result # ------------------------- # # # "parsed": { # "accept_remote_nexthop": true, # "add_path_display_ipv4_address": true, # "advertise_bgp_static": { # "policy": "static-to-bgp" # }, # "advertise_from_main_vpn_tables": true, # "advertise_inactive": true, # "as_number": "65432", # "authentication_algorithm": "md5", # "bfd_liveness_detection": { # "detection_time": { # "threshold": 300000 # }, # "minimum_receive_interval": 4, # "multiplier": 10, # "no_adaptation": true, # "transmit_interval": { # "minimum_interval": 2 # }, # "version": "automatic" # }, # "bgp_error_tolerance": { # "malformed_route_limit": 20000000 # }, # "bmp": { # "monitor": false, # "route_monitoring": { # "none": true # } # }, # "damping": true, # "description": "This is configured with Junos_bgp resource module", # "egress_te_sid_stats": true, # "hold_time": 5, # "holddown_all_stale_labels": true, # "include_mp_next_hop": true, # "log_updown": true, # "no_advertise_peer_as": true, # "no_aggregator_id": true, # "no_client_reflect": true, # "out_delay": 10, # "precision_timers": true, # "preference": "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 | | --- | --- | --- | | **after** dictionary | when changed | The resulting configuration model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **before** dictionary | always | The configuration prior to the model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** [' <nc:protocols xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:bgp> <nc:damping/> <nc:egress-te-sid-stats/> <nc:authentication-algorithm>md5</nc:authentication-algorithm> <nc:description>This is configured with Junos\_bgp resource module</nc:description> <nc:hold-time>5</nc:hold-time> <nc:bfd-liveness-detection> <nc:transmit-interval> <nc:minimum-interval>2</nc:minimum-interval> </nc:transmit-interval> <nc:minimum-receive-interval>4</nc:minimum-receive-interval> <nc:multiplier>10</nc:multiplier> <nc:no-adaptation/> <nc:version>automatic</nc:version> </nc:bfd-liveness-detection> <nc:bgp-error-tolerance> <nc:malformed-route-limit>20000000</nc:malformed-route-limit> </nc:bgp-error-tolerance> <nc:bmp> <nc:monitor>enable</nc:monitor> </nc:bmp> </nc:bgp> </nc:protocols>', 'xml 2', 'xml 3'] | ### Authors * Rohit Thakur (@rohitthakur2590)
programming_docs
ansible junipernetworks.junos.junos_logging_global – Manage logging configuration on Junos devices. junipernetworks.junos.junos\_logging\_global – Manage logging configuration on Junos devices. ============================================================================================= Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_logging_global`. New in version 2.4.0: of junipernetworks.junos * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module manages logging configuration on devices running Junos. 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. * ncclient (>=v0.6.4) * xmltodict (>=0.12.0) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **config** dictionary | | A dictionary of logging configuration. | | | **allow\_duplicates** boolean | **Choices:*** no * yes | Do not suppress the repeated message for all targets. | | | **archive** dictionary | | Specify archive file information. | | | | **binary\_data** boolean | **Choices:*** no * yes | Mark file as if it contains binary data. | | | | **file\_size** integer | | Size of files to be archived (65536..1073741824 bytes). | | | | **files** integer | | Specify number of files to be archived (1..1000). | | | | **no\_binary\_data** boolean | **Choices:*** no * yes | Don't mark file as if it contains binary data. | | | | **no\_world\_readable** boolean | **Choices:*** no * yes | Don't allow any user to read the log file. | | | | **set** boolean | **Choices:*** no * yes | Set archive file information. | | | | **world\_readable** boolean | **Choices:*** no * yes | Allow any user to read the log file. | | | **console** dictionary | | Set console logging parameters. | | | | **any** dictionary | | Set All facilities. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **authorization** dictionary | | Specify authorization system. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **change\_log** dictionary | | Specify configuration change log. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **conflict\_log** dictionary | | Specify configuration conflict log. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **daemon** dictionary | | Specify various system processes. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **dfc** dictionary | | Specify dynamic flow capture. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **external** dictionary | | Specify Local external applications. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **firewall** dictionary | | Specify Firewall filtering system. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **ftp** dictionary | | Specify FTP process. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **interactive\_commands** dictionary | | Specify commands executed by the UI. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **kernel** dictionary | | Specify Kernel specific logging. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **ntp** dictionary | | Specify NTP process specific logging. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **pfe** dictionary | | Specify Packet Forwarding Engine specific logging. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **security** dictionary | | Specify Security related logging. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **user** dictionary | | Specify user specific logging. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | **files** list / elements=dictionary | | Specify files logging. | | | | **allow\_duplicates** boolean | **Choices:*** no * yes | Do not suppress the repeated message for all targets. | | | | **any** dictionary | | Set All facilities. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **archive** dictionary | | Specify archive file information. | | | | | **archive\_sites** list / elements=string | | Specify Primary and failover URLs to receive archive facilities. | | | | | **binary\_data** boolean | **Choices:*** no * yes | Mark file as if it contains binary data. | | | | | **file\_size** integer | | Size of files to be archived (65536..1073741824 bytes). | | | | | **files** integer | | Specify number of files to be archived (1..1000). | | | | | **no\_binary\_data** boolean | **Choices:*** no * yes | Don't mark file as if it contains binary data. | | | | | **no\_world\_readable** boolean | **Choices:*** no * yes | Don't allow any user to read the log file. | | | | | **set** boolean | **Choices:*** no * yes | Set archive file information. | | | | | **start\_time** string | | Specify start time for file transmission (yyyy-mm-dd.hh:mm). | | | | | **transfer\_interval** integer | | Specify frequency at which to transfer files to archive sites (5..2880 minutes). | | | | | **world\_readable** boolean | **Choices:*** no * yes | Allow any user to read the log file. | | | | **authorization** dictionary | | Specify authorization system. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **change\_log** dictionary | | Specify configuration change log. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **conflict\_log** dictionary | | Specify configuration conflict log. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **daemon** dictionary | | Specify various system processes. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **dfc** dictionary | | Specify dynamic flow capture. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **explicit\_priority** boolean | **Choices:*** no * yes | Include priority and facility in messages. | | | | **external** dictionary | | Specify Local external applications. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **firewall** dictionary | | Specify Firewall filtering system. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **ftp** dictionary | | Specify FTP process. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **interactive\_commands** dictionary | | Specify commands executed by the UI. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **kernel** dictionary | | Specify Kernel specific logging. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **match** string | | Specify regular expression for lines to be logged. | | | | **match\_strings** list / elements=string | | Specify matching string(s) for lines to be logged. | | | | **name** string | | Specify filename in which to log data. | | | | **ntp** dictionary | | Specify NTP process specific logging. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **pfe** dictionary | | Specify Packet Forwarding Engine specific logging. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **security** dictionary | | Specify Security related logging. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **structured\_data** dictionary | | Specify Log system message in structured format. | | | | | **brief** boolean | **Choices:*** no * yes | Omit English-language text from end of logged messages. | | | | | **set** boolean | **Choices:*** no * yes | Set Log system message in structured format. | | | | **user** dictionary | | Specify user specific logging. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | **hosts** list / elements=dictionary | | Specify hosts to be notified. | | | | **allow\_duplicates** boolean | **Choices:*** no * yes | Do not suppress the repeated message for all targets. | | | | **any** dictionary | | Set All facilities. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **authorization** dictionary | | Specify authorization system. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **change\_log** dictionary | | Specify configuration change log. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **conflict\_log** dictionary | | Specify configuration conflict log. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **daemon** dictionary | | Specify various system processes. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **dfc** dictionary | | Specify dynamic flow capture. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **exclude\_hostname** boolean | **Choices:*** no * yes | Specify exclude hostname field in messages. | | | | **explicit\_priority** boolean | **Choices:*** no * yes | Include priority and facility in messages. | | | | **external** dictionary | | Specify Local external applications. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **facility\_override** string | | Specify alternate facility for logging to remote host. | | | | **firewall** dictionary | | Specify Firewall filtering system. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **ftp** dictionary | | Specify FTP process. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **interactive\_commands** dictionary | | Specify commands executed by the UI. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **kernel** dictionary | | Specify Kernel specific logging. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **log\_prefix** string | | Prefix for all logging to this host. | | | | **match** string | | Specify regular expression for lines to be logged. | | | | **match\_strings** list / elements=string | | Specify matching string(s) for lines to be logged. | | | | **name** string | | Specify the host name. | | | | **ntp** dictionary | | Specify NTP process specific logging. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **pfe** dictionary | | Specify Packet Forwarding Engine specific logging. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **port** integer | | Specify port number. | | | | **routing\_instance** string | | Specify routing-instance. | | | | **security** dictionary | | Specify Security related logging. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **source\_address** string | | Specify address as source address. | | | | **structured\_data** dictionary | | Specify Log system message in structured format. | | | | | **brief** boolean | **Choices:*** no * yes | Omit English-language text from end of logged messages. | | | | | **set** boolean | **Choices:*** no * yes | Set Log system message in structured format. | | | | **user** dictionary | | Specify user specific logging. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | **log\_rotate\_frequency** integer | | Specify Rotate log frequency (1..59 minutes). | | | **routing\_instance** string | | Specify Routing routing-instance. | | | **server** dictionary | | Specify syslog server logging. | | | | **routing\_instance** dictionary | | nable/disable syslog server in routing-instances. | | | | | **all** boolean | **Choices:*** no * yes | Enable/disable all routing instances. | | | | | **default** boolean | **Choices:*** no * yes | Enable/disable default routing instances. | | | | | **routing\_instances** list / elements=dictionary | | Specify routing-instances. | | | | | | **disable** boolean | **Choices:*** no * yes | Disable syslog server in this routing instances. | | | | | | **name** string | | Specify routing-instance name. | | | | **set** boolean | **Choices:*** no * yes | Enable syslog server. | | | **source\_address** string | | Specify address as source address. | | | **time\_format** dictionary | | Specify additional information to include in system log timestamp. | | | | **millisecond** boolean | **Choices:*** no * yes | Include milliseconds in timestamp. | | | | **set** boolean | **Choices:*** no * yes | Set time-format | | | | **year** boolean | **Choices:*** no * yes | Include year in timestamp. | | | **users** list / elements=dictionary | | Specify user logging | | | | **allow\_duplicates** boolean | **Choices:*** no * yes | Do not suppress the repeated message for all targets. | | | | **any** dictionary | | Set All facilities. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **authorization** dictionary | | Specify authorization system. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **change\_log** dictionary | | Specify configuration change log. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **conflict\_log** dictionary | | Specify configuration conflict log. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **daemon** dictionary | | Specify various system processes. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **dfc** dictionary | | Specify dynamic flow capture. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **external** dictionary | | Specify Local external applications. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **firewall** dictionary | | Specify Firewall filtering system. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **ftp** dictionary | | Specify FTP process. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **interactive\_commands** dictionary | | Specify commands executed by the UI. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **kernel** dictionary | | Specify Kernel specific logging. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **match** string | | Specify regular expression for lines to be logged. | | | | **match\_strings** list / elements=string | | Specify matching string(s) for lines to be logged. | | | | **name** string | | Specify user name. | | | | **ntp** dictionary | | Specify NTP process specific logging. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **pfe** dictionary | | Specify Packet Forwarding Engine specific logging. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **security** dictionary | | Specify Security related logging. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | | | **user** dictionary | | Specify user specific logging. | | | | | **level** string / required | **Choices:*** alert * any * critical * emergency * error * info * none * notice * warning | Set severity logging level. | | **running\_config** string | | This option is used only with state *parsed*. The value of this option should be the output received from the Junos device by executing the command **show system syslog**. The state *parsed* reads the configuration from `running_config` option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the *parsed* key within the result. | | **state** string | **Choices:*** **merged** ← * replaced * deleted * overridden * parsed * gathered * rendered | The state the configuration should be left in. Refer to examples for more details. | Notes ----- Note * This module requires the netconf system service be enabled on the device being managed. * This module works with connection `netconf`. * See [the Junos OS Platform Options](../../../network/user_guide/platform_junos). * Tested against JunOS v18.4R1 Examples -------- ``` # Using merged # # Before state # ------------ # # vagrant@vsrx# show system syslog # # [edit] # vagrant@vsrx# show routing-instances # inst11 { # description inst11; # } - name: Merge provided logging configuration into running configuration. junipernetworks.junos.junos_logging_global: config: allow_duplicates: true archive: set: true no_binary_data: true files: 10 file_size: 65578 no_world_readable: true console: any: level: "info" authorization: level: "any" change_log: level: "critical" ftp: level: "none" files: - name: "file101" allow_duplicates: true - name: "file102" allow_duplicates: true any: level: "any" structured_data: set: true - name: "file103" archive: set: true no_binary_data: true files: 10 file_size: 65578 no_world_readable: true explicit_priority: true match: "^set*" match_strings: - "^delete" - "^prompt" hosts: - name: host111 exclude_hostname: true allow_duplicates: true any: level: "any" structured_data: set: true brief: true facility_override: "ftp" log_prefix: "field" match: "^set*" match_strings: - "^delete" - "^prompt" port: 1231 routing_instance: "inst11" source_address: "11.1.1.11" routing_instance: "inst11" log_rotate_frequency: 45 source_address: "33.33.33.33" time_format: millisecond: true year: true users: - name: "user1" allow_duplicates: true - name: "user2" allow_duplicates: true any: level: "any" user: level: info state: merged # # ------------------------- # Module Execution Result # ------------------------- # "after": { # "allow_duplicates": true, # "archive": { # "file_size": 65578, # "files": 10, # "no_binary_data": true, # "no_world_readable": true # }, # "console": { # "any": { # "level": "info" # }, # "authorization": { # "level": "any" # }, # "change_log": { # "level": "critical" # }, # "ftp": { # "level": "none" # } # }, # "files": [ # { # "allow_duplicates": true, # "name": "file101" # }, # { # "allow_duplicates": true, # "any": { # "level": "any" # }, # "name": "file102", # "structured_data": { # "set": true # } # }, # { # "archive": { # "file_size": 65578, # "files": 10, # "no_binary_data": true, # "no_world_readable": true # }, # "explicit_priority": true, # "match": "^set*", # "match_strings": [ # "^delete", # "^prompt" # ], # "name": "file103" # } # ], # "hosts": [ # { # "allow_duplicates": true, # "any": { # "level": "any" # }, # "exclude_hostname": true, # "facility_override": "ftp", # "log_prefix": "field", # "match": "^set*", # "match_strings": [ # "^delete", # "^prompt" # ], # "name": "host111", # "port": 1231, # "routing_instance": "inst11", # "source_address": "11.1.1.11", # "structured_data": { # "brief": true # } # } # ], # "log_rotate_frequency": 45, # "routing_instance": "inst11", # "source_address": "33.33.33.33", # "time_format": { # "millisecond": true, # "year": true # }, # "users": [ # { # "allow_duplicates": true, # "name": "user1" # }, # { # "allow_duplicates": true, # "any": { # "level": "any" # }, # "name": "user2", # "user": { # "level": "info" # } # } # ] # }, # "before": {}, # "changed": true, # "commands": [ # "<nc:system xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">" # "<nc:syslog><nc:allow-duplicates/><nc:archive><nc:files>10</nc:files>" # "<nc:no-binary-data/><nc:size>65578</nc:size><nc:no-world-readable/></nc:archive>" # "<nc:console><nc:name>change-log</nc:name><nc:critical/></nc:console><nc:console>" # "<nc:name>any</nc:name><nc:info/></nc:console><nc:console><nc:name>authorization</nc:name>" # "<nc:any/></nc:console><nc:console><nc:name>ftp</nc:name><nc:none/></nc:console><nc:file>" # "<nc:name>file101</nc:name><nc:allow-duplicates/></nc:file><nc:file><nc:name>file102</nc:name>" # "<nc:allow-duplicates/><nc:contents><nc:name>any</nc:name><nc:any/></nc:contents><nc:structured-data/>" # "</nc:file><nc:file><nc:name>file103</nc:name><nc:archive><nc:files>10</nc:files><nc:no-binary-data/>" # "<nc:size>65578</nc:size><nc:no-world-readable/></nc:archive><nc:explicit-priority/>" # "<nc:match>^set*</nc:match><nc:match-strings>^delete</nc:match-strings>" # "<nc:match-strings>^prompt</nc:match-strings></nc:file><nc:host><nc:name>host111</nc:name>" # "<nc:allow-duplicates/><nc:contents><nc:name>any</nc:name><nc:any/></nc:contents>" # "<nc:exclude-hostname/><nc:facility-override>ftp</nc:facility-override>" # "<nc:log-prefix>field</nc:log-prefix><nc:match>^set*</nc:match><nc:match-strings>^delete</nc:match-strings>" # "<nc:match-strings>^prompt</nc:match-strings><nc:port>1231</nc:port>" # "<nc:routing-instance>inst11</nc:routing-instance><nc:source-address>11.1.1.11</nc:source-address>" # "<nc:structured-data><nc:brief/></nc:structured-data></nc:host>" # "<nc:log-rotate-frequency>45</nc:log-rotate-frequency><nc:routing-instance>inst11</nc:routing-instance>" # "<nc:source-address>33.33.33.33</nc:source-address><nc:time-format><nc:millisecond/>" # "<nc:year/></nc:time-format><nc:user><nc:name>user1</nc:name><nc:allow-duplicates/></nc:user>" # "<nc:user><nc:name>user2</nc:name><nc:allow-duplicates/><nc:contents><nc:name>any</nc:name><nc:any/>" # "</nc:contents><nc:contents><nc:name>user</nc:name><nc:info/></nc:contents></nc:user></nc:syslog></nc:system>" # ] # After state # ----------- # # vagrant@vsrx# show system syslog # archive size 65578 files 10 no-world-readable no-binary-data; # user user1 { # allow-duplicates; # } # user user2 { # any any; # user info; # allow-duplicates; # } # host host111 { # any any; # match "^set*"; # allow-duplicates; # port 1231; # facility-override ftp; # log-prefix field; # source-address 11.1.1.11; # routing-instance inst11; # exclude-hostname; # match-strings [ "^delete" "^prompt" ]; # structured-data { # brief; # } # } # allow-duplicates; # file file101 { # allow-duplicates; # } # file file102 { # any any; # allow-duplicates; # structured-data; # } # file file103 { # match "^set*"; # archive size 65578 files 10 no-world-readable no-binary-data; # explicit-priority; # match-strings [ "^delete" "^prompt" ]; # } # console { # any info; # authorization any; # ftp none; # change-log critical; # } # time-format year millisecond; # source-address 33.33.33.33; # routing-instance inst11; # log-rotate-frequency 45; # Using replaced # # Before state # ------------ # # vagrant@vsrx# show system syslog # archive size 65578 files 10 no-world-readable no-binary-data; # user user1 { # allow-duplicates; # } # user user2 { # any any; # user info; # allow-duplicates; # } # host host111 { # any any; # match "^set*"; # allow-duplicates; # port 1231; # facility-override ftp; # log-prefix field; # source-address 11.1.1.11; # routing-instance inst11; # exclude-hostname; # match-strings [ "^delete" "^prompt" ]; # structured-data { # brief; # } # } # allow-duplicates; # file file101 { # allow-duplicates; # } # file file102 { # any any; # allow-duplicates; # structured-data; # } # file file103 { # match "^set*"; # archive size 65578 files 10 no-world-readable no-binary-data; # explicit-priority; # match-strings [ "^delete" "^prompt" ]; # } # console { # any info; # authorization any; # ftp none; # change-log critical; # } # time-format year millisecond; # source-address 33.33.33.33; # routing-instance inst11; # log-rotate-frequency 45; - name: Replaced running logging global configuration with provided configuration junipernetworks.junos.junos_logging_global: config: files: - name: "file104" allow_duplicates: true - name: "file102" allow_duplicates: true any: level: "any" structured_data: set: true hosts: - name: host222 exclude_hostname: true allow_duplicates: true any: level: "any" structured_data: set: true brief: true facility_override: "ftp" log_prefix: "field" match: "^set*" match_strings: - "^delete" - "^prompt" port: 1231 routing_instance: "inst11" source_address: "11.1.1.11" users: - name: "user1" allow_duplicates: true - name: "user2" allow_duplicates: true any: level: "any" user: level: info state: replaced # # ------------------------- # Module Execution Result # ------------------------- # "after": { # "files": [ # { # "allow_duplicates": true, # "name": "file104" # }, # { # "allow_duplicates": true, # "any": { # "level": "any" # }, # "name": "file102", # "structured_data": { # "set": true # } # } # ], # "hosts": [ # { # "allow_duplicates": true, # "any": { # "level": "any" # }, # "exclude_hostname": true, # "facility_override": "ftp", # "log_prefix": "field", # "match": "^set*", # "match_strings": [ # "^delete", # "^prompt" # ], # "name": "host222", # "port": 1231, # "routing_instance": "inst11", # "source_address": "11.1.1.11", # "structured_data": { # "brief": true # } # } # ], # "users": [ # { # "allow_duplicates": true, # "name": "user1" # }, # { # "allow_duplicates": true, # "any": { # "level": "any" # }, # "name": "user2", # "user": { # "level": "info" # } # } # ] # }, # "before": { # "allow_duplicates": true, # "archive": { # "file_size": 65578, # "files": 10, # "no_binary_data": true, # "no_world_readable": true # }, # "console": { # "any": { # "level": "info" # }, # "authorization": { # "level": "any" # }, # "change_log": { # "level": "critical" # }, # "ftp": { # "level": "none" # } # }, # "files": [ # { # "allow_duplicates": true, # "name": "file101" # }, # { # "allow_duplicates": true, # "any": { # "level": "any" # }, # "name": "file102", # "structured_data": { # "set": true # } # }, # { # "archive": { # "file_size": 65578, # "files": 10, # "no_binary_data": true, # "no_world_readable": true # }, # "explicit_priority": true, # "match": "^set*", # "match_strings": [ # "^delete", # "^prompt" # ], # "name": "file103" # } # ], # "hosts": [ # { # "allow_duplicates": true, # "any": { # "level": "any" # }, # "exclude_hostname": true, # "facility_override": "ftp", # "log_prefix": "field", # "match": "^set*", # "match_strings": [ # "^delete", # "^prompt" # ], # "name": "host111", # "port": 1231, # "routing_instance": "inst11", # "source_address": "11.1.1.11", # "structured_data": { # "brief": true # } # } # ], # "log_rotate_frequency": 45, # "routing_instance": "inst11", # "source_address": "33.33.33.33", # "time_format": { # "millisecond": true, # "year": true # }, # "users": [ # { # "allow_duplicates": true, # "name": "user1" # }, # { # "allow_duplicates": true, # "any": { # "level": "any" # }, # "name": "user2", # "user": { # "level": "info" # } # } # ] # }, # "changed": true, # "commands": [ # "<nc:system xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">" # "<nc:syslog delete="delete"/><nc:syslog><nc:file><nc:name>file104</nc:name>" # "<nc:allow-duplicates/></nc:file><nc:file><nc:name>file102</nc:name><nc:allow-duplicates/>" # "<nc:contents><nc:name>any</nc:name><nc:any/></nc:contents><nc:structured-data/></nc:file>" # "<nc:host><nc:name>host222</nc:name><nc:allow-duplicates/><nc:contents><nc:name>any</nc:name>" # "<nc:any/></nc:contents><nc:exclude-hostname/><nc:facility-override>ftp</nc:facility-override>" # "<nc:log-prefix>field</nc:log-prefix><nc:match>^set*</nc:match>" # "<nc:match-strings>^delete</nc:match-strings>" # "<nc:match-strings>^prompt</nc:match-strings><nc:port>1231</nc:port>" # "<nc:routing-instance>inst11</nc:routing-instance><nc:source-address>11.1.1.11</nc:source-address>" # "<nc:structured-data><nc:brief/></nc:structured-data></nc:host><nc:user><nc:name>user1</nc:name>" # "<nc:allow-duplicates/></nc:user><nc:user><nc:name>user2</nc:name><nc:allow-duplicates/><nc:contents>" # "<nc:name>any</nc:name><nc:any/></nc:contents>" # "<nc:contents><nc:name>user</nc:name><nc:info/></nc:contents></nc:user></nc:syslog></nc:system>" # ] # After state # ----------- # # vagrant@vsrx# show system syslog # user user1 { # allow-duplicates; # } # user user2 { # any any; # user info; # allow-duplicates; # } # host host222 { # any any; # match "^set*"; # allow-duplicates; # port 1231; # facility-override ftp; # log-prefix field; # source-address 11.1.1.11; # routing-instance inst11; # exclude-hostname; # match-strings [ "^delete" "^prompt" ]; # structured-data { # brief; # } # } # file file104 { # allow-duplicates; # } # file file102 { # any any; # allow-duplicates; # structured-data; # } # Using overridden # # Before state # ------------ # # vagrant@vsrx# show system syslog # archive size 65578 files 10 no-world-readable no-binary-data; # user user1 { # allow-duplicates; # } # user user2 { # any any; # user info; # allow-duplicates; # } # host host111 { # any any; # match "^set*"; # allow-duplicates; # port 1231; # facility-override ftp; # log-prefix field; # source-address 11.1.1.11; # routing-instance inst11; # exclude-hostname; # match-strings [ "^delete" "^prompt" ]; # structured-data { # brief; # } # } # allow-duplicates; # file file101 { # allow-duplicates; # } # file file102 { # any any; # allow-duplicates; # structured-data; # } # file file103 { # match "^set*"; # archive size 65578 files 10 no-world-readable no-binary-data; # explicit-priority; # match-strings [ "^delete" "^prompt" ]; # } # console { # any info; # authorization any; # ftp none; # change-log critical; # } # time-format year millisecond; # source-address 33.33.33.33; # routing-instance inst11; # log-rotate-frequency 45; - name: Override running logging global configuration with provided configuration junipernetworks.junos.junos_logging_global: config: files: - name: "file104" allow_duplicates: true - name: "file102" allow_duplicates: true any: level: "any" structured_data: set: true hosts: - name: host222 exclude_hostname: true allow_duplicates: true any: level: "any" structured_data: set: true brief: true facility_override: "ftp" log_prefix: "field" match: "^set*" match_strings: - "^delete" - "^prompt" port: 1231 routing_instance: "inst11" source_address: "11.1.1.11" users: - name: "user1" allow_duplicates: true - name: "user2" allow_duplicates: true any: level: "any" user: level: info state: overridden # # ------------------------- # Module Execution Result # ------------------------- # "after": { # "files": [ # { # "allow_duplicates": true, # "name": "file104" # }, # { # "allow_duplicates": true, # "any": { # "level": "any" # }, # "name": "file102", # "structured_data": { # "set": true # } # } # ], # "hosts": [ # { # "allow_duplicates": true, # "any": { # "level": "any" # }, # "exclude_hostname": true, # "facility_override": "ftp", # "log_prefix": "field", # "match": "^set*", # "match_strings": [ # "^delete", # "^prompt" # ], # "name": "host222", # "port": 1231, # "routing_instance": "inst11", # "source_address": "11.1.1.11", # "structured_data": { # "brief": true # } # } # ], # "users": [ # { # "allow_duplicates": true, # "name": "user1" # }, # { # "allow_duplicates": true, # "any": { # "level": "any" # }, # "name": "user2", # "user": { # "level": "info" # } # } # ] # }, # "before": { # "allow_duplicates": true, # "archive": { # "file_size": 65578, # "files": 10, # "no_binary_data": true, # "no_world_readable": true # }, # "console": { # "any": { # "level": "info" # }, # "authorization": { # "level": "any" # }, # "change_log": { # "level": "critical" # }, # "ftp": { # "level": "none" # } # }, # "files": [ # { # "allow_duplicates": true, # "name": "file101" # }, # { # "allow_duplicates": true, # "any": { # "level": "any" # }, # "name": "file102", # "structured_data": { # "set": true # } # }, # { # "archive": { # "file_size": 65578, # "files": 10, # "no_binary_data": true, # "no_world_readable": true # }, # "explicit_priority": true, # "match": "^set*", # "match_strings": [ # "^delete", # "^prompt" # ], # "name": "file103" # } # ], # "hosts": [ # { # "allow_duplicates": true, # "any": { # "level": "any" # }, # "exclude_hostname": true, # "facility_override": "ftp", # "log_prefix": "field", # "match": "^set*", # "match_strings": [ # "^delete", # "^prompt" # ], # "name": "host111", # "port": 1231, # "routing_instance": "inst11", # "source_address": "11.1.1.11", # "structured_data": { # "brief": true # } # } # ], # "log_rotate_frequency": 45, # "routing_instance": "inst11", # "source_address": "33.33.33.33", # "time_format": { # "millisecond": true, # "year": true # }, # "users": [ # { # "allow_duplicates": true, # "name": "user1" # }, # { # "allow_duplicates": true, # "any": { # "level": "any" # }, # "name": "user2", # "user": { # "level": "info" # } # } # ] # }, # "changed": true, # "commands": [ # "<nc:system xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">" # "<nc:syslog delete="delete"/><nc:syslog><nc:file><nc:name>file104</nc:name>" # "<nc:allow-duplicates/></nc:file><nc:file><nc:name>file102</nc:name><nc:allow-duplicates/>" # "<nc:contents><nc:name>any</nc:name><nc:any/></nc:contents><nc:structured-data/></nc:file>" # "<nc:host><nc:name>host222</nc:name><nc:allow-duplicates/><nc:contents><nc:name>any</nc:name>" # "<nc:any/></nc:contents><nc:exclude-hostname/><nc:facility-override>ftp</nc:facility-override>" # "<nc:log-prefix>field</nc:log-prefix><nc:match>^set*</nc:match>" # "<nc:match-strings>^delete</nc:match-strings>" # "<nc:match-strings>^prompt</nc:match-strings><nc:port>1231</nc:port>" # "<nc:routing-instance>inst11</nc:routing-instance><nc:source-address>11.1.1.11</nc:source-address>" # "<nc:structured-data><nc:brief/></nc:structured-data></nc:host><nc:user><nc:name>user1</nc:name>" # "<nc:allow-duplicates/></nc:user><nc:user><nc:name>user2</nc:name><nc:allow-duplicates/><nc:contents>" # "<nc:name>any</nc:name><nc:any/></nc:contents>" # "<nc:contents><nc:name>user</nc:name><nc:info/></nc:contents></nc:user></nc:syslog></nc:system>" # ] # After state # ----------- # # vagrant@vsrx# show system syslog # user user1 { # allow-duplicates; # } # user user2 { # any any; # user info; # allow-duplicates; # } # host host222 { # any any; # match "^set*"; # allow-duplicates; # port 1231; # facility-override ftp; # log-prefix field; # source-address 11.1.1.11; # routing-instance inst11; # exclude-hostname; # match-strings [ "^delete" "^prompt" ]; # structured-data { # brief; # } # } # file file104 { # allow-duplicates; # } # file file102 { # any any; # allow-duplicates; # structured-data; # } # Using deleted # # Before state # ------------ # # vagrant@vsrx# show system syslog # user user1 { # allow-duplicates; # } # user user2 { # any any; # user info; # allow-duplicates; # } # host host222 { # any any; # match "^set*"; # allow-duplicates; # port 1231; # facility-override ftp; # log-prefix field; # source-address 11.1.1.11; # routing-instance inst11; # exclude-hostname; # match-strings [ "^delete" "^prompt" ]; # structured-data { # brief; # } # } # file file104 { # allow-duplicates; # } # file file102 { # any any; # allow-duplicates; # structured-data; # } - name: Delete running logging global configuration junipernetworks.junos.junos_logging_global: config: state: deleted # # ------------------------- # Module Execution Result # ------------------------- # "after": {}, # "before": { # "files": [ # { # "allow_duplicates": true, # "name": "file104" # }, # { # "allow_duplicates": true, # "any": { # "level": "any" # }, # "name": "file102", # "structured_data": { # "set": true # } # } # ], # "hosts": [ # { # "allow_duplicates": true, # "any": { # "level": "any" # }, # "exclude_hostname": true, # "facility_override": "ftp", # "log_prefix": "field", # "match": "^set*", # "match_strings": [ # "^delete", # "^prompt" # ], # "name": "host222", # "port": 1231, # "routing_instance": "inst11", # "source_address": "11.1.1.11", # "structured_data": { # "brief": true # } # } # ], # "users": [ # { # "allow_duplicates": true, # "name": "user1" # }, # { # "allow_duplicates": true, # "any": { # "level": "any" # }, # "name": "user2", # "user": { # "level": "info" # } # } # ] # }, # "changed": true, # "commands": [ # "<nc:system xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">" # "<nc:syslog delete="delete"/></nc:system>" # ] # After state # ----------- # # vagrant@vsrx# show system syslog # # [edit] # Using gathered # # Before state # ------------ # # vagrant@vsrx# show system syslog # user user1 { # allow-duplicates; # } # user user2 { # any any; # user info; # allow-duplicates; # } # host host222 { # any any; # match "^set*"; # allow-duplicates; # port 1231; # facility-override ftp; # log-prefix field; # source-address 11.1.1.11; # routing-instance inst11; # exclude-hostname; # match-strings [ "^delete" "^prompt" ]; # structured-data { # brief; # } # } # file file104 { # allow-duplicates; # } # file file102 { # any any; # allow-duplicates; # structured-data; # } - name: Gather running logging global configuration junipernetworks.junos.junos_logging_global: state: gathered # # ------------------------- # Module Execution Result # ------------------------- # "gathered": { # "files": [ # { # "allow_duplicates": true, # "name": "file104" # }, # { # "allow_duplicates": true, # "any": { # "level": "any" # }, # "name": "file102", # "structured_data": { # "set": true # } # } # ], # "hosts": [ # { # "allow_duplicates": true, # "any": { # "level": "any" # }, # "exclude_hostname": true, # "facility_override": "ftp", # "log_prefix": "field", # "match": "^set*", # "match_strings": [ # "^delete", # "^prompt" # ], # "name": "host222", # "port": 1231, # "routing_instance": "inst11", # "source_address": "11.1.1.11", # "structured_data": { # "brief": true # } # } # ], # "users": [ # { # "allow_duplicates": true, # "name": "user1" # }, # { # "allow_duplicates": true, # "any": { # "level": "any" # }, # "name": "user2", # "user": { # "level": "info" # } # } # ] # }, # "changed": false, # Using rendered # # Before state # ------------ # - name: Render xml for provided facts. junipernetworks.junos.junos_logging_global: config: allow_duplicates: true archive: set: true no_binary_data: true files: 10 file_size: 65578 no_world_readable: true console: any: level: "info" authorization: level: "any" change_log: level: "critical" ftp: level: "none" files: - name: "file101" allow_duplicates: true - name: "file102" allow_duplicates: true any: level: "any" structured_data: set: true - name: "file103" archive: set: true no_binary_data: true files: 10 file_size: 65578 no_world_readable: true explicit_priority: true match: "^set*" match_strings: - "^delete" - "^prompt" hosts: - name: host111 exclude_hostname: true allow_duplicates: true any: level: "any" structured_data: set: true brief: true facility_override: "ftp" log_prefix: "field" match: "^set*" match_strings: - "^delete" - "^prompt" port: 1231 routing_instance: "inst11" source_address: "11.1.1.11" routing_instance: "inst11" log_rotate_frequency: 45 source_address: "33.33.33.33" time_format: millisecond: true year: true users: - name: "user1" allow_duplicates: true - name: "user2" allow_duplicates: true any: level: "any" user: level: info state: rendered # # ------------------------- # Module Execution Result # ------------------------- # "rendered": [ # "<nc:system xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">" # "<nc:syslog><nc:allow-duplicates/><nc:archive><nc:files>10</nc:files>" # "<nc:no-binary-data/><nc:size>65578</nc:size><nc:no-world-readable/></nc:archive>" # "<nc:console><nc:name>change-log</nc:name><nc:critical/></nc:console><nc:console>" # "<nc:name>any</nc:name><nc:info/></nc:console><nc:console><nc:name>authorization</nc:name>" # "<nc:any/></nc:console><nc:console><nc:name>ftp</nc:name><nc:none/></nc:console><nc:file>" # "<nc:name>file101</nc:name><nc:allow-duplicates/></nc:file><nc:file><nc:name>file102</nc:name>" # "<nc:allow-duplicates/><nc:contents><nc:name>any</nc:name><nc:any/></nc:contents><nc:structured-data/>" # "</nc:file><nc:file><nc:name>file103</nc:name><nc:archive><nc:files>10</nc:files><nc:no-binary-data/>" # "<nc:size>65578</nc:size><nc:no-world-readable/></nc:archive><nc:explicit-priority/>" # "<nc:match>^set*</nc:match><nc:match-strings>^delete</nc:match-strings>" # "<nc:match-strings>^prompt</nc:match-strings></nc:file><nc:host><nc:name>host111</nc:name>" # "<nc:allow-duplicates/><nc:contents><nc:name>any</nc:name><nc:any/></nc:contents>" # "<nc:exclude-hostname/><nc:facility-override>ftp</nc:facility-override>" # "<nc:log-prefix>field</nc:log-prefix><nc:match>^set*</nc:match><nc:match-strings>^delete</nc:match-strings>" # "<nc:match-strings>^prompt</nc:match-strings><nc:port>1231</nc:port>" # "<nc:routing-instance>inst11</nc:routing-instance><nc:source-address>11.1.1.11</nc:source-address>" # "<nc:structured-data><nc:brief/></nc:structured-data></nc:host>" # "<nc:log-rotate-frequency>45</nc:log-rotate-frequency><nc:routing-instance>inst11</nc:routing-instance>" # "<nc:source-address>33.33.33.33</nc:source-address><nc:time-format><nc:millisecond/>" # "<nc:year/></nc:time-format><nc:user><nc:name>user1</nc:name><nc:allow-duplicates/></nc:user>" # "<nc:user><nc:name>user2</nc:name><nc:allow-duplicates/><nc:contents><nc:name>any</nc:name><nc:any/>" # "</nc:contents><nc:contents><nc:name>user</nc:name><nc:info/></nc:contents></nc:user></nc:syslog></nc:system>" # ] # Using parsed # parsed.cfg # ------------ # <?xml version="1.0" encoding="UTF-8"?> # <rpc-reply message-id="urn:uuid:0cadb4e8-5bba-47f4-986e-72906227007f"> # <configuration changed-seconds="1590139550" changed-localtime="2020-05-22 09:25:50 UTC"> # <version>18.4R1-S2.4</version> # <system xmlns="http://yang.juniper.net/junos-es/conf/system"> # <syslog> # <user> # <name>*</name> # <contents> # <name>any</name> # <emergency/> # </contents> # </user> # <file> # <name>messages</name> # <contents> # <name>any</name> # <any/> # </contents> # <contents> # <name>authorization</name> # <info/> # </contents> # </file> # <file> # <name>interactive-commands</name> # <contents> # <name>interactive-commands</name> # <any/> # </contents> # </file> # </syslog> # </system> # </configuration> # </rpc-reply> - name: Parse logging global running config junipernetworks.junos.junos_routing_instances: running_config: "{{ lookup('file', './parsed.cfg') }}" state: parsed # # # ------------------------- # Module Execution Result # ------------------------- # # # "parsed": { # "files": [ # { # "any": { # "level": "any" # }, # "authorization": { # "level": "info" # }, # "name": "messages" # }, # { # "interactive_commands": { # "level": "any" # }, # "name": "interactive-commands" # } # ], # "users": [ # { # "any": { # "level": "emergency" # }, # "name": "*" # } # ] # } # # ``` 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 | | --- | --- | --- | | **after** dictionary | when changed | The resulting configuration model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **before** dictionary | always | The configuration prior to the model invocation. **Sample:** The configuration returned will always be in the same format of the parameters above. | | **commands** list / elements=string | always | The set of commands pushed to the remote device. **Sample:** ['<nc:allow-duplicates/></nc:user><nc:user><nc:name>user2</nc:name> <nc:allow-duplicates/><nc:contents><nc:name>any</nc:name><nc:any/> </nc:contents><nc:contents><nc:name>user</nc:name><nc:info/></nc:contents> </nc:user></nc:syslog></nc:system>"', 'xml 2', 'xml 3'] | ### Authors * Rohit Thakur (@rohitthakur2590)
programming_docs
ansible junipernetworks.junos.junos_vlan – (deprecated, removed after 2022-06-01) Manage VLANs on Juniper JUNOS network devices junipernetworks.junos.junos\_vlan – (deprecated, removed after 2022-06-01) Manage VLANs on Juniper JUNOS network devices ======================================================================================================================== Note This plugin is part of the [junipernetworks.junos collection](https://galaxy.ansible.com/junipernetworks/junos) (version 2.6.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install junipernetworks.junos`. To use it in a playbook, specify: `junipernetworks.junos.junos_vlan`. New in version 1.0.0: of junipernetworks.junos * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in major release after 2022-06-01 Why Updated modules released with more functionality Alternative Use [junipernetworks.junos.junos\_vlans](junos_vlans_module#ansible-collections-junipernetworks-junos-junos-vlans-module) instead. Synopsis -------- * This module provides declarative management of VLANs on Juniper JUNOS network devices. 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. * ncclient (>=v0.5.2) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **active** boolean | **Choices:*** no * **yes** ← | Specifies whether or not the configuration is active or deactivated | | **aggregate** list / elements=dictionary | | List of VLANs definitions. | | | **active** boolean | **Choices:*** no * yes | Specifies whether or not the configuration is active or deactivated | | | **description** string | | Text description of VLANs. | | | **filter\_input** string | | The name of input filter. | | | **filter\_output** string | | The name of output filter. | | | **interfaces** list / elements=string | | List of interfaces to check the VLAN has been configured correctly. | | | **l3\_interface** string | | Name of logical layer 3 interface. | | | **name** string / required | | Name of the VLAN. | | | **state** string | **Choices:*** present * absent | State of the VLAN configuration. | | | **vlan\_id** integer | | ID of the VLAN. Range 1-4094. | | **description** string | | Text description of VLANs. | | **filter\_input** string | | The name of input filter. | | **filter\_output** string | | The name of output filter. | | **interfaces** list / elements=string | | List of interfaces to check the VLAN has been configured correctly. | | **l3\_interface** string | | Name of logical layer 3 interface. | | **name** string | | Name of the VLAN. | | **provider** dictionary | | **Deprecated** Starting with Ansible 2.5 we recommend using `connection: network_cli` or `connection: netconf`. For more information please see the [Junos OS Platform Options guide](../network/user_guide/platform_junos). A dict object containing connection details. | | | **host** string | | Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. | | | **password** string | | Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_PASSWORD` will be used instead. | | | **port** integer | | Specifies the port to use when building the connection to the remote device. The port value will default to the well known SSH port of 22 (for `transport=cli`) or port 830 (for `transport=netconf`) device. | | | **ssh\_keyfile** path | | Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_SSH_KEYFILE` will be used instead. | | | **timeout** integer | | Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. | | | **transport** string | **Choices:*** cli * **netconf** ← | Configures the transport connection to use when connecting to the remote device. | | | **username** string | | Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_USERNAME` will be used instead. | | **state** string | **Choices:*** **present** ← * absent | State of the VLAN configuration. | | **vlan\_id** integer | | ID of the VLAN. Range 1-4094. | Notes ----- Note * This module requires the netconf system service be enabled on the remote device being managed. * Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. * Recommended connection is `netconf`. See [the Junos OS Platform Options](../network/user_guide/platform_junos). * This module also works with `local` connections for legacy playbooks. * For information on using CLI and netconf see the [Junos OS Platform Options guide](../../../network/user_guide/platform_junos#junos-platform-options) * For more information on using Ansible to manage network devices see the [Ansible Network Guide](../../../network/index#network-guide) * For more information on using Ansible to manage Juniper network devices see <https://www.ansible.com/ansible-juniper>. Examples -------- ``` - name: configure VLAN ID and name junipernetworks.junos.junos_vlan: name: test vlan_id: 20 - name: Link to logical layer 3 interface junipernetworks.junos.junos_vlan: name: test vlan_id: 20 l3-interface: vlan.20 - name: remove VLAN configuration junipernetworks.junos.junos_vlan: name: test state: absent - name: deactive VLAN configuration junipernetworks.junos.junos_vlan: name: test state: present active: false - name: activate VLAN configuration junipernetworks.junos.junos_vlan: name: test state: present active: true - name: Create vlan configuration using aggregate junipernetworks.junos.junos_vlan: aggregate: - {vlan_id: 159, name: test_vlan_1, description: test vlan-1} - {vlan_id: 160, name: test_vlan_2, description: test vlan-2} - name: Delete vlan configuration using aggregate junipernetworks.junos.junos_vlan: aggregate: - {vlan_id: 159, name: test_vlan_1} - {vlan_id: 160, name: test_vlan_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 | | --- | --- | --- | | **diff.prepared** string | when configuration is changed and diff option is enabled. | Configuration difference before and after applying change. **Sample:** [edit vlans] + test-vlan-1 { + vlan-id 60; + } | Status ------ * This module will be removed in a major release after 2022-06-01. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Ganesh Nalawade (@ganeshrn) ansible Collections in the Kubernetes Namespace Collections in the Kubernetes Namespace ======================================= These are the collections with docs hosted on [docs.ansible.com](https://docs.ansible.com/) in the **kubernetes** namespace. * [kubernetes.core](core/index#plugins-in-kubernetes-core) ansible kubernetes.core.helm_plugin_info – Gather information about Helm plugins kubernetes.core.helm\_plugin\_info – Gather information about Helm plugins ========================================================================== Note This plugin is part of the [kubernetes.core collection](https://galaxy.ansible.com/kubernetes/core) (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 kubernetes.core`. To use it in a playbook, specify: `kubernetes.core.helm_plugin_info`. New in version 1.0.0: of kubernetes.core * [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 kubernetes.core | | 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 kubernetes.core | | 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 kubernetes.core | | 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 kubernetes.core | **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 kubernetes.core.helm_plugin_info: - name: Gather Helm env plugin info kubernetes.core.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 kubernetes.core.helm_plugin – Manage Helm plugins kubernetes.core.helm\_plugin – Manage Helm plugins ================================================== Note This plugin is part of the [kubernetes.core collection](https://galaxy.ansible.com/kubernetes/core) (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 kubernetes.core`. To use it in a playbook, specify: `kubernetes.core.helm_plugin`. New in version 1.0.0: of kubernetes.core * [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 kubernetes.core | | 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 kubernetes.core | | 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 kubernetes.core | | 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 kubernetes.core | **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 kubernetes.core.helm_plugin: plugin_path: https://github.com/adamreese/helm-env state: present - name: Install Helm plugin from local filesystem kubernetes.core.helm_plugin: plugin_path: https://domain/path/to/plugin.tar.gz state: present - name: Remove Helm env plugin kubernetes.core.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) ansible kubernetes.core.openshift – OpenShift inventory source kubernetes.core.openshift – OpenShift inventory source ====================================================== Note This plugin is part of the [kubernetes.core collection](https://galaxy.ansible.com/kubernetes/core) (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 kubernetes.core`. To use it in a playbook, specify: `kubernetes.core.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: kubernetes.core.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: kubernetes.core.openshift connections: - namespaces: - testing # Use a custom config file, and a specific context. plugin: kubernetes.core.openshift connections: - kubeconfig: /path/to/config context: 'awx/192-168-64-4:8443/developer' ``` ### Authors * Chris Houseknecht <@chouseknecht>
programming_docs
ansible Kubernetes.Core Kubernetes.Core =============== Collection version 1.2.1 Plugin Index ------------ These are the plugins in the kubernetes.core collection ### Connection Plugins * [kubectl](kubectl_connection#ansible-collections-kubernetes-core-kubectl-connection) – Execute tasks in pods running on Kubernetes. ### Inventory Plugins * [k8s](k8s_inventory#ansible-collections-kubernetes-core-k8s-inventory) – Kubernetes (K8s) inventory source * [openshift](openshift_inventory#ansible-collections-kubernetes-core-openshift-inventory) – OpenShift inventory source ### Lookup Plugins * [k8s](k8s_lookup#ansible-collections-kubernetes-core-k8s-lookup) – Query the K8s API ### Modules * [helm](helm_module#ansible-collections-kubernetes-core-helm-module) – Manages Kubernetes packages with the Helm package manager * [helm\_info](helm_info_module#ansible-collections-kubernetes-core-helm-info-module) – Get information from Helm package deployed inside the cluster * [helm\_plugin](helm_plugin_module#ansible-collections-kubernetes-core-helm-plugin-module) – Manage Helm plugins * [helm\_plugin\_info](helm_plugin_info_module#ansible-collections-kubernetes-core-helm-plugin-info-module) – Gather information about Helm plugins * [helm\_repository](helm_repository_module#ansible-collections-kubernetes-core-helm-repository-module) – Manage Helm repositories. * [helm\_template](helm_template_module#ansible-collections-kubernetes-core-helm-template-module) – Render chart templates * [k8s](k8s_module#ansible-collections-kubernetes-core-k8s-module) – Manage Kubernetes (K8s) objects * [k8s\_auth](k8s_auth_module#ansible-collections-kubernetes-core-k8s-auth-module) – Authenticate to Kubernetes clusters which require an explicit login step * [k8s\_cluster\_info](k8s_cluster_info_module#ansible-collections-kubernetes-core-k8s-cluster-info-module) – Describe Kubernetes (K8s) cluster, APIs available and their respective versions * [k8s\_exec](k8s_exec_module#ansible-collections-kubernetes-core-k8s-exec-module) – Execute command in Pod * [k8s\_info](k8s_info_module#ansible-collections-kubernetes-core-k8s-info-module) – Describe Kubernetes (K8s) objects * [k8s\_log](k8s_log_module#ansible-collections-kubernetes-core-k8s-log-module) – Fetch logs from Kubernetes resources * [k8s\_rollback](k8s_rollback_module#ansible-collections-kubernetes-core-k8s-rollback-module) – Rollback Kubernetes (K8S) Deployments and DaemonSets * [k8s\_scale](k8s_scale_module#ansible-collections-kubernetes-core-k8s-scale-module) – Set a new size for a Deployment, ReplicaSet, Replication Controller, or Job. * [k8s\_service](k8s_service_module#ansible-collections-kubernetes-core-k8s-service-module) – Manage Services on Kubernetes See also List of [collections](../../index#list-of-collections) with docs hosted here. ansible kubernetes.core.k8s_info – Describe Kubernetes (K8s) objects kubernetes.core.k8s\_info – Describe Kubernetes (K8s) objects ============================================================= Note This plugin is part of the [kubernetes.core collection](https://galaxy.ansible.com/kubernetes/core) (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 kubernetes.core`. To use it in a playbook, specify: `kubernetes.core.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 kubernetes.core.k8s_info: api_version: v1 kind: Service name: web namespace: testing register: web_service - name: Get a list of all service objects kubernetes.core.k8s_info: api_version: v1 kind: Service namespace: testing register: service_list - name: Get a list of all pods from any namespace kubernetes.core.k8s_info: kind: Pod register: pod_list - name: Search for all Pods labelled app=web kubernetes.core.k8s_info: kind: Pod label_selectors: - app = web - tier in (dev, test) - name: Using vars while using label_selectors kubernetes.core.k8s_info: kind: Pod label_selectors: - "app = {{ app_label_web }}" vars: app_label_web: web - name: Search for all running pods kubernetes.core.k8s_info: kind: Pod field_selectors: - status.phase=Running - name: List custom objects created using CRD kubernetes.core.k8s_info: kind: MyCustomObject api_version: "stable.example.com/v1" - name: Wait till the Object is created kubernetes.core.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 kubernetes.core.helm_template – Render chart templates kubernetes.core.helm\_template – Render chart templates ======================================================= Note This plugin is part of the [kubernetes.core collection](https://galaxy.ansible.com/kubernetes/core) (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 kubernetes.core`. To use it in a playbook, specify: `kubernetes.core.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 kubernetes.core.helm_template: chart_ref: stable/prometheus output_dir: mycharts - name: Render templates kubernetes.core.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) ansible kubernetes.core.kubectl – Execute tasks in pods running on Kubernetes. kubernetes.core.kubectl – Execute tasks in pods running on Kubernetes. ====================================================================== Note This plugin is part of the [kubernetes.core collection](https://galaxy.ansible.com/kubernetes/core) (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 kubernetes.core`. To use it in a playbook, specify: `kubernetes.core.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
programming_docs
ansible kubernetes.core.k8s_cluster_info – Describe Kubernetes (K8s) cluster, APIs available and their respective versions kubernetes.core.k8s\_cluster\_info – Describe Kubernetes (K8s) cluster, APIs available and their respective versions ==================================================================================================================== Note This plugin is part of the [kubernetes.core collection](https://galaxy.ansible.com/kubernetes/core) (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 kubernetes.core`. To use it in a playbook, specify: `kubernetes.core.k8s_cluster_info`. New in version 0.11.1: of kubernetes.core * [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 kubernetes.core.k8s_cluster_info: register: api_status - name: Do not invalidate cache before getting information kubernetes.core.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 kubernetes.core.helm_info – Get information from Helm package deployed inside the cluster kubernetes.core.helm\_info – Get information from Helm package deployed inside the cluster ========================================================================================== Note This plugin is part of the [kubernetes.core collection](https://galaxy.ansible.com/kubernetes/core) (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 kubernetes.core`. To use it in a playbook, specify: `kubernetes.core.helm_info`. New in version 0.11.0: of kubernetes.core * [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 kubernetes.core | | 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 kubernetes.core | | 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 kubernetes.core | | 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 kubernetes.core | **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 kubernetes.core.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 kubernetes.core.k8s_log – Fetch logs from Kubernetes resources kubernetes.core.k8s\_log – Fetch logs from Kubernetes resources =============================================================== Note This plugin is part of the [kubernetes.core collection](https://galaxy.ansible.com/kubernetes/core) (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 kubernetes.core`. To use it in a playbook, specify: `kubernetes.core.k8s_log`. New in version 0.10.0: of kubernetes.core * [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 kubernetes.core.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 kubernetes.core.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 kubernetes.core.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 kubernetes.core.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 kubernetes.core.k8s – Manage Kubernetes (K8s) objects kubernetes.core.k8s – Manage Kubernetes (K8s) objects ===================================================== Note This plugin is part of the [kubernetes.core collection](https://galaxy.ansible.com/kubernetes/core) (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 kubernetes.core`. To use it in a playbook, specify: `kubernetes.core.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 [kubernetes.core.k8s\_info](k8s_info_module#ansible-collections-kubernetes-core-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 kubernetes.core | | 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 kubernetes.core.k8s: name: testing api_version: v1 kind: Namespace state: present - name: Create a Service object from an inline definition kubernetes.core.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 kubernetes.core.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 kubernetes.core.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. kubernetes.core.k8s: state: present definition: "{{ lookup('file', '/testing/deployment.yml') | from_yaml }}" - name: Read definition template file from the Ansible controller file system kubernetes.core.k8s: state: present template: '/testing/deployment.j2' - name: Read definition template file from the Ansible controller file system that uses custom start/end strings kubernetes.core.k8s: state: present template: path: '/testing/deployment.j2' variable_start_string: '[[' variable_end_string: ']]' - name: fail on validation errors kubernetes.core.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 kubernetes.core.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. kubernetes.core.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 kubernetes.core.helm – Manages Kubernetes packages with the Helm package manager kubernetes.core.helm – Manages Kubernetes packages with the Helm package manager ================================================================================ Note This plugin is part of the [kubernetes.core collection](https://galaxy.ansible.com/kubernetes/core) (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 kubernetes.core`. To use it in a playbook, specify: `kubernetes.core.helm`. New in version 0.11.0: of kubernetes.core * [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 kubernetes.core | | 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 kubernetes.core | | 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 kubernetes.core | **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 kubernetes.core | | 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 kubernetes.core | **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 kubernetes.core | **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 kubernetes.core | **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 kubernetes.core | **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) kubernetes.core.helm: name: test chart_ref: stable/prometheus release_namespace: monitoring create_namespace: true # From repository - name: Add stable chart repo kubernetes.core.helm_repository: name: stable repo_url: "https://kubernetes.github.io/ingress-nginx" - name: Deploy latest version of Grafana chart inside monitoring namespace with values kubernetes.core.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 kubernetes.core.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 kubernetes.core.helm: name: test chart_ref: stable/grafana release_namespace: monitoring values_files: - /path/to/values.yaml - name: Remove test release and waiting suppression ending kubernetes.core.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 kubernetes.core.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 kubernetes.core.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 kubernetes.core.k8s_scale – Set a new size for a Deployment, ReplicaSet, Replication Controller, or Job. kubernetes.core.k8s\_scale – Set a new size for a Deployment, ReplicaSet, Replication Controller, or Job. ========================================================================================================= Note This plugin is part of the [kubernetes.core collection](https://galaxy.ansible.com/kubernetes/core) (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 kubernetes.core`. To use it in a playbook, specify: `kubernetes.core.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 kubernetes.core.k8s_scale: api_version: v1 kind: Deployment name: elastic namespace: myproject replicas: 3 wait_timeout: 60 - name: Scale deployment down when current replicas match kubernetes.core.k8s_scale: api_version: v1 kind: Deployment name: elastic namespace: myproject current_replicas: 3 replicas: 2 - name: Increase job parallelism kubernetes.core.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 kubernetes.core.k8s_scale: src: /myproject/elastic_deployment.yml replicas: 3 wait: no - name: Scale deployment based on a template output kubernetes.core.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 kubernetes.core.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 kubernetes.core.helm_repository – Manage Helm repositories. kubernetes.core.helm\_repository – Manage Helm repositories. ============================================================ Note This plugin is part of the [kubernetes.core collection](https://galaxy.ansible.com/kubernetes/core) (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 kubernetes.core`. To use it in a playbook, specify: `kubernetes.core.helm_repository`. New in version 0.11.0: of kubernetes.core * [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 kubernetes.core.helm_repository: name: stable repo_url: https://kubernetes.github.io/ingress-nginx - name: Add Red Hat Helm charts repository kubernetes.core.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 kubernetes.core.k8s_auth – Authenticate to Kubernetes clusters which require an explicit login step kubernetes.core.k8s\_auth – Authenticate to Kubernetes clusters which require an explicit login step ==================================================================================================== Note This plugin is part of the [kubernetes.core collection](https://galaxy.ansible.com/kubernetes/core) (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 kubernetes.core`. To use it in a playbook, specify: `kubernetes.core.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) kubernetes.core.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 kubernetes.core.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 kubernetes.core.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 kubernetes.core.k8s_rollback – Rollback Kubernetes (K8S) Deployments and DaemonSets kubernetes.core.k8s\_rollback – Rollback Kubernetes (K8S) Deployments and DaemonSets ==================================================================================== Note This plugin is part of the [kubernetes.core collection](https://galaxy.ansible.com/kubernetes/core) (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 kubernetes.core`. To use it in a playbook, specify: `kubernetes.core.k8s_rollback`. New in version 1.0.0: of kubernetes.core * [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 kubernetes.core.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 kubernetes.core.k8s_exec – Execute command in Pod kubernetes.core.k8s\_exec – Execute command in Pod ================================================== Note This plugin is part of the [kubernetes.core collection](https://galaxy.ansible.com/kubernetes/core) (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 kubernetes.core`. To use it in a playbook, specify: `kubernetes.core.k8s_exec`. New in version 0.10.0: of kubernetes.core * [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 kubernetes.core.k8s_exec: namespace: myproject pod: zuul-scheduler command: zuul-scheduler full-reconfigure - name: Check RC status of command executed kubernetes.core.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 kubernetes.core.k8s – Kubernetes (K8s) inventory source kubernetes.core.k8s – Kubernetes (K8s) inventory source ======================================================= Note This plugin is part of the [kubernetes.core collection](https://galaxy.ansible.com/kubernetes/core) (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 kubernetes.core`. To use it in a playbook, specify: `kubernetes.core.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: kubernetes.core.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: kubernetes.core.k8s connections: - namespaces: - testing # Use a custom config file, and a specific context. plugin: kubernetes.core.k8s connections: - kubeconfig: /path/to/config context: 'awx/192-168-64-4:8443/developer' ``` ### Authors * Chris Houseknecht <@chouseknecht> * Fabian von Feilitzsch <@fabianvf> ansible kubernetes.core.k8s – Query the K8s API kubernetes.core.k8s – Query the K8s API ======================================= Note This plugin is part of the [kubernetes.core collection](https://galaxy.ansible.com/kubernetes/core) (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 kubernetes.core`. To use it in a playbook, specify: `kubernetes.core.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('kubernetes.core.k8s', api_version='v1', kind='Namespace') }}" - name: Fetch all deployments set_fact: deployments: "{{ lookup('kubernetes.core.k8s', kind='Deployment') }}" - name: Fetch all deployments in a namespace set_fact: deployments: "{{ lookup('kubernetes.core.k8s', kind='Deployment', namespace='testing') }}" - name: Fetch a specific deployment by name set_fact: deployments: "{{ lookup('kubernetes.core.k8s', kind='Deployment', namespace='testing', resource_name='elastic') }}" - name: Fetch with label selector set_fact: service: "{{ lookup('kubernetes.core.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('kubernetes.core.k8s', resource_definition=config) }}" - name: Use a config from the local filesystem set_fact: service: "{{ lookup('kubernetes.core.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 kubernetes.core.k8s_service – Manage Services on Kubernetes kubernetes.core.k8s\_service – Manage Services on Kubernetes ============================================================ Note This plugin is part of the [kubernetes.core collection](https://galaxy.ansible.com/kubernetes/core) (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 kubernetes.core`. To use it in a playbook, specify: `kubernetes.core.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 kubernetes.core.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 kubernetes.core.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 Collections in the Community Namespace Collections in the Community Namespace ====================================== These are the collections with docs hosted on [docs.ansible.com](https://docs.ansible.com/) in the **community** namespace. * [community.aws](aws/index#plugins-in-community-aws) * [community.azure](azure/index#plugins-in-community-azure) * [community.crypto](crypto/index#plugins-in-community-crypto) * [community.digitalocean](digitalocean/index#plugins-in-community-digitalocean) * [community.docker](docker/index#plugins-in-community-docker) * [community.fortios](fortios/index#plugins-in-community-fortios) * [community.general](general/index#plugins-in-community-general) * [community.google](google/index#plugins-in-community-google) * [community.grafana](grafana/index#plugins-in-community-grafana) * [community.hashi\_vault](hashi_vault/index#plugins-in-community-hashi-vault) * [community.hrobot](hrobot/index#plugins-in-community-hrobot) * [community.kubernetes](kubernetes/index#plugins-in-community-kubernetes) * [community.kubevirt](kubevirt/index#plugins-in-community-kubevirt) * [community.libvirt](libvirt/index#plugins-in-community-libvirt) * [community.mongodb](mongodb/index#plugins-in-community-mongodb) * [community.mysql](mysql/index#plugins-in-community-mysql) * [community.network](network/index#plugins-in-community-network) * [community.okd](okd/index#plugins-in-community-okd) * [community.postgresql](postgresql/index#plugins-in-community-postgresql) * [community.proxysql](proxysql/index#plugins-in-community-proxysql) * [community.rabbitmq](rabbitmq/index#plugins-in-community-rabbitmq) * [community.routeros](routeros/index#plugins-in-community-routeros) * [community.skydive](skydive/index#plugins-in-community-skydive) * [community.sops](sops/index#plugins-in-community-sops) * [community.vmware](vmware/index#plugins-in-community-vmware) * [community.windows](windows/index#plugins-in-community-windows) * [community.zabbix](zabbix/index#plugins-in-community-zabbix) ansible community.okd.oc – Execute tasks in pods running on OpenShift. community.okd.oc – Execute tasks in pods running on OpenShift. ============================================================== Note This plugin is part of the [community.okd collection](https://galaxy.ansible.com/community/okd) (version 1.1.2). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.okd`. To use it in a playbook, specify: `community.okd.oc`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) Synopsis -------- * Use the oc exec command to run tasks in, or put/fetch files to, pods running on the OpenShift container platform. Requirements ------------ The below requirements are needed on the local controller node that executes this connection. * oc (go binary) Parameters ---------- | Parameter | Choices/Defaults | Configuration | Comments | | --- | --- | --- | --- | | **ca\_cert** string | **Default:**"" | env:K8S\_AUTH\_SSL\_CA\_CERT var: ansible\_oc\_ssl\_ca\_cert var: ansible\_oc\_ca\_cert | Path to a CA certificate used to authenticate with the API. aliases: oc\_ssl\_ca\_cert | | **client\_cert** string | **Default:**"" | env:K8S\_AUTH\_CERT\_FILE var: ansible\_oc\_cert\_file var: ansible\_oc\_client\_cert | Path to a certificate used to authenticate with the API. aliases: oc\_cert\_file | | **client\_key** string | **Default:**"" | env:K8S\_AUTH\_KEY\_FILE var: ansible\_oc\_key\_file var: ansible\_oc\_client\_key | Path to a key file used to authenticate with the API. aliases: oc\_key\_file | | **oc\_container** string | **Default:**"" | env:K8S\_AUTH\_CONTAINER var: ansible\_oc\_container | Container name. Required when a pod contains more than one container. | | **oc\_context** string | **Default:**"" | env:K8S\_AUTH\_CONTEXT var: ansible\_oc\_context | The name of a context found in the K8s config file. | | **oc\_extra\_args** string | **Default:**"" | env:K8S\_AUTH\_EXTRA\_ARGS var: ansible\_oc\_extra\_args | Extra arguments to pass to the oc command line. | | **oc\_host** string | **Default:**"" | env:K8S\_AUTH\_HOST env:K8S\_AUTH\_SERVER var: ansible\_oc\_host var: ansible\_oc\_server | URL for accessing the API. | | **oc\_kubeconfig** string | **Default:**"" | env:K8S\_AUTH\_KUBECONFIG var: ansible\_oc\_kubeconfig var: ansible\_oc\_config | Path to a oc config file. Defaults to *~/.kube/config* | | **oc\_namespace** string | **Default:**"" | env:K8S\_AUTH\_NAMESPACE var: ansible\_oc\_namespace | The namespace of the pod | | **oc\_pod** string | **Default:**"" | env:K8S\_AUTH\_POD var: ansible\_oc\_pod | Pod name. Required when the host name does not match pod name. | | **oc\_token** string | | env:K8S\_AUTH\_TOKEN env:K8S\_AUTH\_API\_KEY var: ansible\_oc\_token var: ansible\_oc\_api\_key | API authentication bearer token. | | **validate\_certs** string | **Default:**"" | env:K8S\_AUTH\_VERIFY\_SSL var: ansible\_oc\_verify\_ssl var: ansible\_oc\_validate\_certs | Whether or not to verify the API server's SSL certificate. Defaults to *true*. aliases: oc\_verify\_ssl | ### Authors * xuxinkun ansible community.okd.openshift – OpenShift inventory source community.okd.openshift – OpenShift inventory source ==================================================== Note This plugin is part of the [community.okd collection](https://galaxy.ansible.com/community/okd) (version 1.1.2). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.okd`. To use it in a playbook, specify: `community.okd.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.okd.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.okd.openshift connections: - namespaces: - testing # Use a custom config file, and a specific context. plugin: community.okd.openshift connections: - kubeconfig: /path/to/config context: 'awx/192-168-64-4:8443/developer' ``` ### Authors * Chris Houseknecht <@chouseknecht> ansible Community.Okd Community.Okd ============= Collection version 1.1.2 Plugin Index ------------ These are the plugins in the community.okd collection ### Connection Plugins * [oc](oc_connection#ansible-collections-community-okd-oc-connection) – Execute tasks in pods running on OpenShift. ### Inventory Plugins * [openshift](openshift_inventory#ansible-collections-community-okd-openshift-inventory) – OpenShift inventory source ### Modules * [k8s](k8s_module#ansible-collections-community-okd-k8s-module) – Manage OpenShift objects * [openshift\_auth](openshift_auth_module#ansible-collections-community-okd-openshift-auth-module) – Authenticate to OpenShift clusters which require an explicit login step * [openshift\_process](openshift_process_module#ansible-collections-community-okd-openshift-process-module) – Process an OpenShift template.openshift.io/v1 Template * [openshift\_route](openshift_route_module#ansible-collections-community-okd-openshift-route-module) – Expose a Service as an OpenShift Route. See also List of [collections](../../index#list-of-collections) with docs hosted here. ansible community.okd.openshift_auth – Authenticate to OpenShift clusters which require an explicit login step community.okd.openshift\_auth – Authenticate to OpenShift clusters which require an explicit login step ======================================================================================================= Note This plugin is part of the [community.okd collection](https://galaxy.ansible.com/community/okd) (version 1.1.2). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.okd`. To use it in a playbook, specify: `community.okd.openshift_auth`. New in version 0.2.0: of community.okd * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module handles authenticating to OpenShift 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). * 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. 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: openshift_passwords.yml - name: Log in (obtain access token) community.okd.openshift_auth: username: admin password: "{{ openshift_admin_password }}" register: openshift_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 kubernetes.core.k8s_info: api_key: "{{ openshift_auth_results.openshift_auth.api_key }}" kind: Pod register: pod_list always: - name: If login succeeded, try to log out (revoke access token) when: openshift_auth_results.openshift_auth.api_key is defined community.okd.openshift_auth: state: absent api_key: "{{ openshift_auth_results.openshift_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 | Same as returned openshift\_auth. Kept only for backwards compatibility | | | **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. | | **openshift\_auth** complex | success | OpenShift 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) * Fabian von Feilitzsch (@fabianvf) ansible community.okd.k8s – Manage OpenShift objects community.okd.k8s – Manage OpenShift objects ============================================ Note This plugin is part of the [community.okd collection](https://galaxy.ansible.com/community/okd) (version 1.1.2). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.okd`. To use it in a playbook, specify: `community.okd.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 M(k8s\_info) 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. * Optimized for OKD/OpenShift Kubernetes flavors 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) | | **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. | | **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*. | | **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 | | | **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.okd.k8s: name: testing api_version: v1 kind: Namespace state: present - name: Create a Service object from an inline definition community.okd.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.okd.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.okd.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.okd.k8s: state: present definition: "{{ lookup('file', '/testing/deployment.yml') | from_yaml }}" - name: Read definition file from the Ansible controller file system after Jinja templating community.okd.k8s: state: present definition: "{{ lookup('template', '/testing/deployment.yml') | from_yaml }}" - name: fail on validation errors community.okd.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.okd.k8s: state: present definition: "{{ lookup('template', '/testing/deployment.yml') | from_yaml }}" validate: fail_on_error: no strict: 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 | | --- | --- | --- | | **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)
programming_docs
ansible community.okd.openshift_process – Process an OpenShift template.openshift.io/v1 Template community.okd.openshift\_process – Process an OpenShift template.openshift.io/v1 Template ========================================================================================= Note This plugin is part of the [community.okd collection](https://galaxy.ansible.com/community/okd) (version 1.1.2). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.okd`. To use it in a playbook, specify: `community.okd.openshift_process`. New in version 0.3.0: of community.okd * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Processes a specified OpenShift template with the provided template. * Templates can be provided inline, from a file, or specified by name and namespace in the cluster. * Analogous to `oc process`. * For CRUD operations on Template resources themselves, see the community.okd.k8s module. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * openshift >= 0.11.0 * 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. | | **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 | | The name of the Template to process. The Template must be present in the cluster. When provided, *namespace* is required. Mutually exclusive with *resource\_definition* or *src* | | **namespace** string | | The namespace that the template can be found in. | | **namespace\_target** string | | The namespace that resources should be created, updated, or deleted in. Only used when *state* is present or absent. | | **parameter\_file** string | | A path to a file containing template parameter values to override/set values in the Template. Corresponds to the `--param-file` argument to oc process. | | **parameters** dictionary | | A set of key: value pairs that will be used to set/override values in the Template. Corresponds to the `--param` argument to oc process. | | **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 * **rendered** ← | Determines what to do with the rendered Template. The state *rendered* will render the Template based on the provided parameters, and return the rendered objects in the *resources* field. These can then be referenced in future tasks. The state *present* will cause the resources in the rendered Template to be created if they do not already exist, and patched if they do. The state *absent* will delete the resources in the rendered Template. | | **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: Process a template in the cluster community.okd.openshift_process: name: nginx-example namespace: openshift # only needed if using a template already on the server parameters: NAMESPACE: openshift NAME: test123 state: rendered register: result - name: Create the rendered resources using apply community.okd.k8s: namespace: default definition: '{{ item }}' wait: yes apply: yes loop: '{{ result.resources }}' - name: Process a template with parameters from an env file and create the resources community.okd.openshift_process: name: nginx-example namespace: openshift namespace_target: default parameter_file: 'files/nginx.env' state: present wait: yes - name: Process a local template and create the resources community.okd.openshift_process: src: files/example-template.yaml parameter_file: files/example.env namespace_target: default state: present - name: Process a local template, delete the resources, and wait for them to terminate community.okd.openshift_process: src: files/example-template.yaml parameter_file: files/example.env namespace_target: default state: absent wait: 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 | | --- | --- | --- | | **resources** complex | on success when state is rendered | The rendered resources defined in the Template | | | **apiVersion** 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. | | | | **name** string | success | The name of the resource | | | | **namespace** string | success | The namespace of the resource | | | **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. | | | | **conditions** complex | success | Array of status conditions for the object. Not guaranteed to be present | | **result** complex | on success when state is present or absent | The created, patched, or otherwise present object. Will be empty in the case of a deletion. | | | **apiVersion** 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. | | | | **name** string | success | The name of the resource | | | | **namespace** string | success | The namespace of the resource | | | **spec** dictionary | success | Specific attributes of the object. Will vary based on the *api\_version* and *kind*. | | | **status** complex | success | Current status details for the object. | | | | **conditions** complex | success | Array of status conditions for the object. Not guaranteed to be present | ### Authors * Fabian von Feilitzsch (@fabianvf) ansible community.okd.openshift_route – Expose a Service as an OpenShift Route. community.okd.openshift\_route – Expose a Service as an OpenShift Route. ======================================================================== Note This plugin is part of the [community.okd collection](https://galaxy.ansible.com/community/okd) (version 1.1.2). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.okd`. To use it in a playbook, specify: `community.okd.openshift_route`. New in version 0.3.0: of community.okd * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Looks up a Service and creates a new Route based on it. * Analogous to `oc expose` and `oc create route` for creating Routes, but does not support creating Services. * For creating Services from other resources, see kubernetes.core.k8s\_expose Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * openshift >= 0.11.0 * 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. | | **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. | | **hostname** string | | The hostname for the Route. | | **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. | | **labels** dictionary | | Specify the labels to apply to the created Route. A set of key: value pairs. | | **name** string | | The desired name of the Route to be created. Defaults to the value of *service* | | **namespace** string / required | | The namespace of the resource being targeted. The Route will be created in this namespace as well. | | **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. | | **path** string | | The path for the Route | | **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 | | **port** string | | Name or number of the port the Route will route traffic to. | | **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). | | **service** string | | The name of the service to expose. Required when *state* is not absent. aliases: svc | | **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*. | | **termination** string | **Choices:*** edge * passthrough * reencrypt * **insecure** ← | The termination type of the Route. If left empty no termination type will be set, and the route will be insecure. When set to insecure *tls* will be ignored. | | **tls** dictionary | | TLS configuration for the newly created route. Only used when *termination* is set. | | | **ca\_certificate** string | | Path to a CA certificate file on the target host. Not supported when *termination* is set to passthrough. | | | **certificate** string | | Path to a certificate file on the target host. Not supported when *termination* is set to passthrough. | | | **destination\_ca\_certificate** string | | Path to a CA certificate file used for securing the connection. Only used when *termination* is set to reencrypt. Defaults to the Service CA. | | | **insecure\_policy** string | **Choices:*** allow * redirect * **disallow** ← | Sets the InsecureEdgeTerminationPolicy for the Route. Not supported when *termination* is set to reencrypt. When *termination* is set to passthrough, only redirect is supported. If not provided, insecure traffic will be disallowed. | | | **key** string | | Path to a key file on the target host. Not supported when *termination* is set to passthrough. | | **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. | | **wildcard\_policy** string | **Choices:*** Subdomain | The wildcard policy for the hostname. Currently only Subdomain is supported. If not provided, the default of None will be used. | 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: Create hello-world deployment community.okd.k8s: definition: apiVersion: apps/v1 kind: Deployment metadata: name: hello-kubernetes namespace: default spec: replicas: 3 selector: matchLabels: app: hello-kubernetes template: metadata: labels: app: hello-kubernetes spec: containers: - name: hello-kubernetes image: paulbouwer/hello-kubernetes:1.8 ports: - containerPort: 8080 - name: Create Service for the hello-world deployment community.okd.k8s: definition: apiVersion: v1 kind: Service metadata: name: hello-kubernetes namespace: default spec: ports: - port: 80 targetPort: 8080 selector: app: hello-kubernetes - name: Expose the insecure hello-world service externally community.okd.openshift_route: service: hello-kubernetes namespace: default insecure_policy: allow register: route ``` 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 | | --- | --- | --- | | **duration** integer | when `wait` is true | elapsed time of task in seconds **Sample:** 48 | | **result** complex | success | The Route object that was created or updated. Will be empty in the case of deletion. | | | **apiVersion** 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. | | | | **name** string | success | The name of the created Route | | | | **namespace** string | success | The namespace of the create Route | | | **spec** complex | success | Specification for the Route | | | | **host** string | success | Host is an alias/DNS that points to the service. | | | | **path** string | success | Path that the router watches for, to route traffic for to the service. | | | | **port** complex | success | Defines a port mapping from a router to an endpoint in the service endpoints. | | | | | **targetPort** string | success | The target port on pods selected by the service this route points to. | | | | **tls** complex | success | Defines config used to secure a route and provide termination. | | | | | **caCertificate** string | success | Provides the cert authority certificate contents. | | | | | **certificate** string | success | Provides certificate contents. | | | | | **destinationCACertificate** string | success | Provides the contents of the ca certificate of the final destination. | | | | | **insecureEdgeTerminationPolicy** string | success | Indicates the desired behavior for insecure connections to a route. | | | | | **key** string | success | Provides key file contents. | | | | | **termination** string | success | Indicates termination type. | | | | **to** complex | success | Specifies the target that resolve into endpoints. | | | | | **kind** string | success | The kind of target that the route is referring to. Currently, only 'Service' is allowed. | | | | | **name** string | success | Name of the service/target that is being referred to. e.g. name of the service. | | | | | **weight** integer | success | Specifies the target's relative weight against other target reference objects. | | | | **wildcardPolicy** string | success | Wildcard policy if any for the route. | | | **status** complex | success | Current status details for the Route | | | | **ingress** complex | success | List of places where the route may be exposed. | | | | | **conditions** complex | success | Array of status conditions for the Route ingress. | | | | | | **status** string | success | The status of the condition. Can be True, False, Unknown. | | | | | | **type** string | success | The type of the condition. Currently only 'Ready'. | | | | | **host** string | success | The host string under which the route is exposed. | | | | | **routerCanonicalHostname** string | success | The external host name for the router that can be used as a CNAME for the host requested for this route. May not be set. | | | | | **routerName** string | success | A name chosen by the router to identify itself. | | | | | **wildcardPolicy** string | success | The wildcard policy that was allowed where this route is exposed. | ### Authors * Fabian von Feilitzsch (@fabianvf)
programming_docs
ansible community.postgresql.postgresql_membership – Add or remove PostgreSQL roles from groups community.postgresql.postgresql\_membership – Add or remove PostgreSQL roles from groups ======================================================================================== Note This plugin is part of the [community.postgresql collection](https://galaxy.ansible.com/community/postgresql) (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.postgresql`. To use it in a playbook, specify: `community.postgresql.postgresql_membership`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Adds or removes PostgreSQL roles from groups (other roles). * Users are roles with login privilege. * Groups are PostgreSQL roles usually without LOGIN privilege. * Common use case: * 1. add a new group (groups) by [community.postgresql.postgresql\_user](postgresql_user_module#ansible-collections-community-postgresql-postgresql-user-module) module with *role\_attr\_flags=NOLOGIN* * 2. grant them desired privileges by [community.postgresql.postgresql\_privs](postgresql_privs_module#ansible-collections-community-postgresql-postgresql-privs-module) module * 3. add desired PostgreSQL users to the new group (groups) by this module Requirements ------------ The below requirements are needed on the host that executes this module. * psycopg2 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ca\_cert** string | | Specifies the name of a file containing SSL certificate authority (CA) certificate(s). If the file exists, the server's certificate will be verified to be signed by one of these authorities. aliases: ssl\_rootcert | | **db** string | | Name of database to connect to. aliases: login\_db | | **fail\_on\_role** boolean | **Choices:*** no * **yes** ← | If `yes`, fail when group or target\_role doesn't exist. If `no`, just warn and continue. | | **groups** list / elements=string / required | | The list of groups (roles) that need to be granted to or revoked from *target\_roles*. aliases: group, source\_role, source\_roles | | **login\_host** string | | Host running the database. If you have connection issues when using `localhost`, try to use `127.0.0.1` instead. | | **login\_password** string | | The password this module should use to establish its PostgreSQL session. | | **login\_unix\_socket** string | | Path to a Unix domain socket for local connections. | | **login\_user** string | **Default:**"postgres" | The username this module should use to establish its PostgreSQL session. | | **port** integer | **Default:**5432 | Database port to connect to. aliases: login\_port | | **session\_role** string | | Switch to session\_role after connecting. The specified session\_role must be a role that the current login\_user is a member of. Permissions checking for SQL commands is carried out as though the session\_role were the one that had logged in originally. | | **ssl\_mode** string | **Choices:*** allow * disable * **prefer** ← * require * verify-ca * verify-full | Determines whether or with what priority a secure SSL TCP/IP connection will be negotiated with the server. See <https://www.postgresql.org/docs/current/static/libpq-ssl.html> for more information on the modes. Default of `prefer` matches libpq default. | | **state** string | **Choices:*** absent * **present** ← | Membership state. *state=present* implies the *groups*must be granted to *target\_roles*. *state=absent* implies the *groups* must be revoked from *target\_roles*. | | **target\_roles** list / elements=string / required | | The list of target roles (groups will be granted to them). aliases: target\_role, users, user | | **trust\_input** boolean added in 0.2.0 of community.postgresql | **Choices:*** no * **yes** ← | If `no`, check whether values of parameters *groups*, *target\_roles*, *session\_role* are potentially dangerous. It makes sense to use `no` only when SQL injections via the parameters are possible. | Notes ----- Note * Supports `check_mode`. * The default authentication assumes that you are either logging in as or sudo’ing to the `postgres` account on the host. * To avoid “Peer authentication failed for user postgres” error, use postgres user as a *become\_user*. * This module uses psycopg2, a Python PostgreSQL database adapter. You must ensure that psycopg2 is installed on the host before using this module. * If the remote host is the PostgreSQL server (which is the default case), then PostgreSQL must also be installed on the remote host. * For Ubuntu-based systems, install the postgresql, libpq-dev, and python-psycopg2 packages on the remote host before using this module. * The ca\_cert parameter requires at least Postgres version 8.4 and *psycopg2* version 2.4.3. See Also -------- See also [community.postgresql.postgresql\_user](postgresql_user_module#ansible-collections-community-postgresql-postgresql-user-module) The official documentation on the **community.postgresql.postgresql\_user** module. [community.postgresql.postgresql\_privs](postgresql_privs_module#ansible-collections-community-postgresql-postgresql-privs-module) The official documentation on the **community.postgresql.postgresql\_privs** module. [community.postgresql.postgresql\_owner](postgresql_owner_module#ansible-collections-community-postgresql-postgresql-owner-module) The official documentation on the **community.postgresql.postgresql\_owner** module. [PostgreSQL role membership reference](https://www.postgresql.org/docs/current/role-membership.html) Complete reference of the PostgreSQL role membership documentation. [PostgreSQL role attributes reference](https://www.postgresql.org/docs/current/role-attributes.html) Complete reference of the PostgreSQL role attributes documentation. Examples -------- ``` - name: Grant role read_only to alice and bob community.postgresql.postgresql_membership: group: read_only target_roles: - alice - bob state: present # you can also use target_roles: alice,bob,etc to pass the role list - name: Revoke role read_only and exec_func from bob. Ignore if roles don't exist community.postgresql.postgresql_membership: groups: - read_only - exec_func target_role: bob fail_on_role: no 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 | | --- | --- | --- | | **granted** dictionary | if *state=present* | Dict of granted groups and roles. **Sample:** {'ro\_group': ['alice', 'bob']} | | **queries** string | always | List of executed queries. **Sample:** ['GRANT "user\_ro" TO "alice"'] | | **revoked** dictionary | if *state=absent* | Dict of revoked groups and roles. **Sample:** {'ro\_group': ['alice', 'bob']} | | **state** string | always | Membership state that tried to be set. **Sample:** present | ### Authors * Andrew Klychkov (@Andersson007) ansible community.postgresql.postgresql_sequence – Create, drop, or alter a PostgreSQL sequence community.postgresql.postgresql\_sequence – Create, drop, or alter a PostgreSQL sequence ======================================================================================== Note This plugin is part of the [community.postgresql collection](https://galaxy.ansible.com/community/postgresql) (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.postgresql`. To use it in a playbook, specify: `community.postgresql.postgresql_sequence`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Allows to create, drop or change the definition of a sequence generator. Requirements ------------ The below requirements are needed on the host that executes this module. * psycopg2 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ca\_cert** string | | Specifies the name of a file containing SSL certificate authority (CA) certificate(s). If the file exists, the server's certificate will be verified to be signed by one of these authorities. aliases: ssl\_rootcert | | **cache** integer | | Cache specifies how many sequence numbers are to be preallocated and stored in memory for faster access. The minimum value is 1 (only one value can be generated at a time, i.e., no cache), and this is also the default. | | **cascade** boolean | **Choices:*** **no** ← * yes | Automatically drop objects that depend on the sequence, and in turn all objects that depend on those objects. Ignored if *state=present*. Only used with *state=absent*. | | **cycle** boolean | **Choices:*** **no** ← * yes | The cycle option allows the sequence to wrap around when the *maxvalue* or *minvalue* has been reached by an ascending or descending sequence respectively. If the limit is reached, the next number generated will be the minvalue or maxvalue, respectively. If `false` (NO CYCLE) is specified, any calls to nextval after the sequence has reached its maximum value will return an error. False (NO CYCLE) is the default. | | **data\_type** string | **Choices:*** bigint * integer * smallint | Specifies the data type of the sequence. Valid types are bigint, integer, and smallint. bigint is the default. The data type determines the default minimum and maximum values of the sequence. For more info see the documentation <https://www.postgresql.org/docs/current/sql-createsequence.html>. Supported from PostgreSQL 10. | | **db** string | | Name of database to connect to and run queries against. aliases: database, login\_db | | **increment** integer | | Increment specifies which value is added to the current sequence value to create a new value. A positive value will make an ascending sequence, a negative one a descending sequence. The default value is 1. | | **login\_host** string | | Host running the database. If you have connection issues when using `localhost`, try to use `127.0.0.1` instead. | | **login\_password** string | | The password this module should use to establish its PostgreSQL session. | | **login\_unix\_socket** string | | Path to a Unix domain socket for local connections. | | **login\_user** string | **Default:**"postgres" | The username this module should use to establish its PostgreSQL session. | | **maxvalue** integer | | Maxvalue determines the maximum value for the sequence. The default for an ascending sequence is the maximum value of the data type. The default for a descending sequence is -1. aliases: max | | **minvalue** integer | | Minvalue determines the minimum value a sequence can generate. The default for an ascending sequence is 1. The default for a descending sequence is the minimum value of the data type. aliases: min | | **newschema** string | | The new schema for the *sequence*. Will be used for moving a *sequence* to another *schema*. Works only for existing sequences. | | **owner** string | | Set the owner for the *sequence*. | | **port** integer | **Default:**5432 | Database port to connect to. aliases: login\_port | | **rename\_to** string | | The new name for the *sequence*. Works only for existing sequences. | | **schema** string | **Default:**"public" | The schema of the *sequence*. This is be used to create and relocate a *sequence* in the given schema. | | **sequence** string / required | | The name of the sequence. aliases: name | | **session\_role** string | | Switch to session\_role after connecting. The specified *session\_role* must be a role that the current *login\_user* is a member of. Permissions checking for SQL commands is carried out as though the *session\_role* were the one that had logged in originally. | | **ssl\_mode** string | **Choices:*** allow * disable * **prefer** ← * require * verify-ca * verify-full | Determines whether or with what priority a secure SSL TCP/IP connection will be negotiated with the server. See <https://www.postgresql.org/docs/current/static/libpq-ssl.html> for more information on the modes. Default of `prefer` matches libpq default. | | **start** integer | | Start allows the sequence to begin anywhere. The default starting value is *minvalue* for ascending sequences and *maxvalue* for descending ones. | | **state** string | **Choices:*** absent * **present** ← | The sequence state. If *state=absent* other options will be ignored except of *name* and *schema*. | | **trust\_input** boolean added in 0.2.0 of community.postgresql | **Choices:*** no * **yes** ← | If `no`, check whether values of parameters *sequence*, *schema*, *rename\_to*, *owner*, *newschema*, *session\_role* are potentially dangerous. It makes sense to use `no` only when SQL injections via the parameters are possible. | Notes ----- Note * Supports `check_mode`. * If you do not pass db parameter, sequence will be created in the database named postgres. * The default authentication assumes that you are either logging in as or sudo’ing to the `postgres` account on the host. * To avoid “Peer authentication failed for user postgres” error, use postgres user as a *become\_user*. * This module uses psycopg2, a Python PostgreSQL database adapter. You must ensure that psycopg2 is installed on the host before using this module. * If the remote host is the PostgreSQL server (which is the default case), then PostgreSQL must also be installed on the remote host. * For Ubuntu-based systems, install the postgresql, libpq-dev, and python-psycopg2 packages on the remote host before using this module. * The ca\_cert parameter requires at least Postgres version 8.4 and *psycopg2* version 2.4.3. See Also -------- See also [community.postgresql.postgresql\_table](postgresql_table_module#ansible-collections-community-postgresql-postgresql-table-module) The official documentation on the **community.postgresql.postgresql\_table** module. [community.postgresql.postgresql\_owner](postgresql_owner_module#ansible-collections-community-postgresql-postgresql-owner-module) The official documentation on the **community.postgresql.postgresql\_owner** module. [community.postgresql.postgresql\_privs](postgresql_privs_module#ansible-collections-community-postgresql-postgresql-privs-module) The official documentation on the **community.postgresql.postgresql\_privs** module. [community.postgresql.postgresql\_tablespace](postgresql_tablespace_module#ansible-collections-community-postgresql-postgresql-tablespace-module) The official documentation on the **community.postgresql.postgresql\_tablespace** module. [CREATE SEQUENCE reference](https://www.postgresql.org/docs/current/sql-createsequence.html) Complete reference of the CREATE SEQUENCE command documentation. [ALTER SEQUENCE reference](https://www.postgresql.org/docs/current/sql-altersequence.html) Complete reference of the ALTER SEQUENCE command documentation. [DROP SEQUENCE reference](https://www.postgresql.org/docs/current/sql-dropsequence.html) Complete reference of the DROP SEQUENCE command documentation. Examples -------- ``` - name: Create an ascending bigint sequence called foobar in the default database community.postgresql.postgresql_sequence: name: foobar - name: Create an ascending integer sequence called foobar, starting at 101 community.postgresql.postgresql_sequence: name: foobar data_type: integer start: 101 - name: Create an descending sequence called foobar, starting at 101 and preallocated 10 sequence numbers in cache community.postgresql.postgresql_sequence: name: foobar increment: -1 cache: 10 start: 101 - name: Create an ascending sequence called foobar, which cycle between 1 to 10 community.postgresql.postgresql_sequence: name: foobar cycle: yes min: 1 max: 10 - name: Create an ascending bigint sequence called foobar in the default database with owner foobar community.postgresql.postgresql_sequence: name: foobar owner: foobar - name: Rename an existing sequence named foo to bar community.postgresql.postgresql_sequence: name: foo rename_to: bar - name: Change the schema of an existing sequence to foobar community.postgresql.postgresql_sequence: name: foobar newschema: foobar - name: Change the owner of an existing sequence to foobar community.postgresql.postgresql_sequence: name: foobar owner: foobar - name: Drop a sequence called foobar community.postgresql.postgresql_sequence: name: foobar state: absent - name: Drop a sequence called foobar with cascade community.postgresql.postgresql_sequence: name: foobar cascade: yes 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 | | --- | --- | --- | | **cycle** string | always | Shows if the sequence cycle or not. **Sample:** NO | | **data\_type** string | always | Shows the current data type of the sequence. **Sample:** bigint | | **increment** integer | always | The value of increment of the sequence. A positive value will make an ascending sequence, a negative one a descending sequence. **Sample:** -1 | | **maxvalue** integer | always | The value of maxvalue of the sequence. **Sample:** 9223372036854775807 | | **minvalue** integer | always | The value of minvalue of the sequence. **Sample:** 1 | | **newname** string | on success | Shows the new sequence name after rename. **Sample:** barfoo | | **newschema** string | on success | Shows the new schema of the sequence after schema change. **Sample:** foobar | | **owner** string | always | Shows the current owner of the sequence after the successful run of the task. **Sample:** postgres | | **queries** string | always | List of queries that was tried to be executed. **Sample:** ['CREATE SEQUENCE "foo"'] | | **schema** string | always | Name of the schema of the sequence. **Sample:** foo | | **sequence** string | always | Sequence name. **Sample:** foobar | | **start** integer | always | The value of start of the sequence. **Sample:** 12 | | **state** string | always | Sequence state at the end of execution. **Sample:** present | ### Authors * Tobias Birkefeld (@tcraxs) * Thomas O’Donnell (@andytom) ansible community.postgresql.postgresql_lang – Adds, removes or changes procedural languages with a PostgreSQL database community.postgresql.postgresql\_lang – Adds, removes or changes procedural languages with a PostgreSQL database ================================================================================================================ Note This plugin is part of the [community.postgresql collection](https://galaxy.ansible.com/community/postgresql) (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.postgresql`. To use it in a playbook, specify: `community.postgresql.postgresql_lang`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Adds, removes or changes procedural languages with a PostgreSQL database. * This module allows you to add a language, remote a language or change the trust relationship with a PostgreSQL database. * The module can be used on the machine where executed or on a remote host. * When removing a language from a database, it is possible that dependencies prevent the database from being removed. In that case, you can specify *cascade=yes* to automatically drop objects that depend on the language (such as functions in the language). * In case the language can’t be deleted because it is required by the database system, you can specify *fail\_on\_drop=no* to ignore the error. * Be careful when marking a language as trusted since this could be a potential security breach. Untrusted languages allow only users with the PostgreSQL superuser privilege to use this language to create new functions. Requirements ------------ The below requirements are needed on the host that executes this module. * psycopg2 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ca\_cert** string | | Specifies the name of a file containing SSL certificate authority (CA) certificate(s). If the file exists, the server's certificate will be verified to be signed by one of these authorities. aliases: ssl\_rootcert | | **cascade** boolean | **Choices:*** **no** ← * yes | When dropping a language, also delete object that depend on this language. Only used when *state=absent*. | | **db** string / required | | Name of database to connect to and where the language will be added, removed or changed. aliases: login\_db | | **fail\_on\_drop** boolean | **Choices:*** no * **yes** ← | If `yes`, fail when removing a language. Otherwise just log and continue. In some cases, it is not possible to remove a language (used by the db-system). When dependencies block the removal, consider using *cascade*. | | **force\_trust** boolean | **Choices:*** **no** ← * yes | Marks the language as trusted, even if it's marked as untrusted in pg\_pltemplate. Use with care! | | **lang** string / required | | Name of the procedural language to add, remove or change. aliases: name | | **login\_host** string | | Host running the database. If you have connection issues when using `localhost`, try to use `127.0.0.1` instead. | | **login\_password** string | | The password this module should use to establish its PostgreSQL session. | | **login\_unix\_socket** string | | Path to a Unix domain socket for local connections. | | **login\_user** string | **Default:**"postgres" | The username this module should use to establish its PostgreSQL session. | | **owner** string added in 0.2.0 of community.postgresql | | Set an owner for the language. Ignored when *state=absent*. | | **port** integer | **Default:**5432 | Database port to connect to. aliases: login\_port | | **session\_role** string | | Switch to session\_role after connecting. The specified *session\_role* must be a role that the current *login\_user* is a member of. Permissions checking for SQL commands is carried out as though the *session\_role* were the one that had logged in originally. | | **ssl\_mode** string | **Choices:*** allow * disable * **prefer** ← * require * verify-ca * verify-full | Determines whether or with what priority a secure SSL TCP/IP connection will be negotiated with the server. See <https://www.postgresql.org/docs/current/static/libpq-ssl.html> for more information on the modes. Default of `prefer` matches libpq default. | | **state** string | **Choices:*** absent * **present** ← | The state of the language for the selected database. | | **trust** boolean | **Choices:*** **no** ← * yes | Make this language trusted for the selected db. | | **trust\_input** boolean added in 0.2.0 of community.postgresql | **Choices:*** no * **yes** ← | If `no`, check whether values of parameters *lang*, *session\_role*, *owner* are potentially dangerous. It makes sense to use `no` only when SQL injections via the parameters are possible. | Notes ----- Note * Supports `check_mode`. * The default authentication assumes that you are either logging in as or sudo’ing to the `postgres` account on the host. * To avoid “Peer authentication failed for user postgres” error, use postgres user as a *become\_user*. * This module uses psycopg2, a Python PostgreSQL database adapter. You must ensure that psycopg2 is installed on the host before using this module. * If the remote host is the PostgreSQL server (which is the default case), then PostgreSQL must also be installed on the remote host. * For Ubuntu-based systems, install the postgresql, libpq-dev, and python-psycopg2 packages on the remote host before using this module. * The ca\_cert parameter requires at least Postgres version 8.4 and *psycopg2* version 2.4.3. See Also -------- See also [PostgreSQL languages](https://www.postgresql.org/docs/current/xplang.html) General information about PostgreSQL languages. [CREATE LANGUAGE reference](https://www.postgresql.org/docs/current/sql-createlanguage.html) Complete reference of the CREATE LANGUAGE command documentation. [ALTER LANGUAGE reference](https://www.postgresql.org/docs/current/sql-alterlanguage.html) Complete reference of the ALTER LANGUAGE command documentation. [DROP LANGUAGE reference](https://www.postgresql.org/docs/current/sql-droplanguage.html) Complete reference of the DROP LANGUAGE command documentation. Examples -------- ``` - name: Add language pltclu to database testdb if it doesn't exist community.postgresql.postgresql_lang: db=testdb lang=pltclu state=present # Add language pltclu to database testdb if it doesn't exist and mark it as trusted. # Marks the language as trusted if it exists but isn't trusted yet. # force_trust makes sure that the language will be marked as trusted - name: Add language pltclu to database testdb if it doesn't exist and mark it as trusted community.postgresql.postgresql_lang: db: testdb lang: pltclu state: present trust: yes force_trust: yes - name: Remove language pltclu from database testdb community.postgresql.postgresql_lang: db: testdb lang: pltclu state: absent - name: Remove language pltclu from database testdb and remove all dependencies community.postgresql.postgresql_lang: db: testdb lang: pltclu state: absent cascade: yes - name: Remove language c from database testdb but ignore errors if something prevents the removal community.postgresql.postgresql_lang: db: testdb lang: pltclu state: absent fail_on_drop: no - name: In testdb change owner of mylang to alice community.postgresql.postgresql_lang: db: testdb lang: mylang owner: alice ``` 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 | | --- | --- | --- | | **queries** list / elements=string | always | List of executed queries. **Sample:** ['CREATE LANGUAGE "acme"'] | ### Authors * Jens Depuydt (@jensdepuydt) * Thomas O’Donnell (@andytom)
programming_docs
ansible community.postgresql.postgresql_schema – Add or remove PostgreSQL schema community.postgresql.postgresql\_schema – Add or remove PostgreSQL schema ========================================================================= Note This plugin is part of the [community.postgresql collection](https://galaxy.ansible.com/community/postgresql) (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.postgresql`. To use it in a playbook, specify: `community.postgresql.postgresql_schema`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Add or remove PostgreSQL schema. Requirements ------------ The below requirements are needed on the host that executes this module. * psycopg2 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ca\_cert** string | | Specifies the name of a file containing SSL certificate authority (CA) certificate(s). If the file exists, the server's certificate will be verified to be signed by one of these authorities. aliases: ssl\_rootcert | | **cascade\_drop** boolean | **Choices:*** **no** ← * yes | Drop schema with CASCADE to remove child objects. | | **database** string | **Default:**"postgres" | Name of the database to connect to and add or remove the schema. aliases: db, login\_db | | **login\_host** string | | Host running the database. If you have connection issues when using `localhost`, try to use `127.0.0.1` instead. | | **login\_password** string | | The password this module should use to establish its PostgreSQL session. | | **login\_unix\_socket** string | | Path to a Unix domain socket for local connections. | | **login\_user** string | **Default:**"postgres" | The username this module should use to establish its PostgreSQL session. | | **name** string / required | | Name of the schema to add or remove. aliases: schema | | **owner** string | | Name of the role to set as owner of the schema. | | **port** integer | **Default:**5432 | Database port to connect to. aliases: login\_port | | **session\_role** string | | Switch to session\_role after connecting. The specified session\_role must be a role that the current login\_user is a member of. Permissions checking for SQL commands is carried out as though the session\_role were the one that had logged in originally. | | **ssl\_mode** string | **Choices:*** allow * disable * **prefer** ← * require * verify-ca * verify-full | Determines whether or with what priority a secure SSL TCP/IP connection will be negotiated with the server. See <https://www.postgresql.org/docs/current/static/libpq-ssl.html> for more information on the modes. Default of `prefer` matches libpq default. | | **state** string | **Choices:*** absent * **present** ← | The schema state. | | **trust\_input** boolean added in 0.2.0 of community.postgresql | **Choices:*** no * **yes** ← | If `no`, check whether values of parameters *schema*, *owner*, *session\_role* are potentially dangerous. It makes sense to use `no` only when SQL injections via the parameters are possible. | Notes ----- Note * Supports `check_mode`. * The default authentication assumes that you are either logging in as or sudo’ing to the `postgres` account on the host. * To avoid “Peer authentication failed for user postgres” error, use postgres user as a *become\_user*. * This module uses psycopg2, a Python PostgreSQL database adapter. You must ensure that psycopg2 is installed on the host before using this module. * If the remote host is the PostgreSQL server (which is the default case), then PostgreSQL must also be installed on the remote host. * For Ubuntu-based systems, install the postgresql, libpq-dev, and python-psycopg2 packages on the remote host before using this module. * The ca\_cert parameter requires at least Postgres version 8.4 and *psycopg2* version 2.4.3. See Also -------- See also [PostgreSQL schemas](https://www.postgresql.org/docs/current/ddl-schemas.html) General information about PostgreSQL schemas. [CREATE SCHEMA reference](https://www.postgresql.org/docs/current/sql-createschema.html) Complete reference of the CREATE SCHEMA command documentation. [ALTER SCHEMA reference](https://www.postgresql.org/docs/current/sql-alterschema.html) Complete reference of the ALTER SCHEMA command documentation. [DROP SCHEMA reference](https://www.postgresql.org/docs/current/sql-dropschema.html) Complete reference of the DROP SCHEMA command documentation. Examples -------- ``` - name: Create a new schema with name acme in test database community.postgresql.postgresql_schema: db: test name: acme - name: Create a new schema acme with a user bob who will own it community.postgresql.postgresql_schema: name: acme owner: bob - name: Drop schema "acme" with cascade community.postgresql.postgresql_schema: name: acme state: absent cascade_drop: 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 | | --- | --- | --- | | **queries** list / elements=string | always | List of executed queries. **Sample:** ['CREATE SCHEMA "acme"'] | | **schema** string | success, changed | Name of the schema. **Sample:** acme | ### Authors * Flavien Chantelot (@Dorn-) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#fe9d91908a9f9d8ad8ddcdc9c5d8ddcbccc5d8ddcac6c598929f88979b90d8ddcac8c59791)> * Thomas O’Donnell (@andytom) ansible community.postgresql.postgresql_privs – Grant or revoke privileges on PostgreSQL database objects community.postgresql.postgresql\_privs – Grant or revoke privileges on PostgreSQL database objects ================================================================================================== Note This plugin is part of the [community.postgresql collection](https://galaxy.ansible.com/community/postgresql) (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.postgresql`. To use it in a playbook, specify: `community.postgresql.postgresql_privs`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Grant or revoke privileges on PostgreSQL database objects. * This module is basically a wrapper around most of the functionality of PostgreSQL’s GRANT and REVOKE statements with detection of changes (GRANT/REVOKE *privs* ON *type* *objs* TO/FROM *roles*). Requirements ------------ The below requirements are needed on the host that executes this module. * psycopg2 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ca\_cert** string | | Specifies the name of a file containing SSL certificate authority (CA) certificate(s). If the file exists, the server's certificate will be verified to be signed by one of these authorities. aliases: ssl\_rootcert | | **database** string / required | | Name of database to connect to. aliases: db, login\_db | | **fail\_on\_role** boolean | **Choices:*** no * **yes** ← | If `yes`, fail when target role (for whom privs need to be granted) does not exist. Otherwise just warn and continue. | | **grant\_option** boolean | **Choices:*** no * yes | Whether `role` may grant/revoke the specified privileges/group memberships to others. Set to `no` to revoke GRANT OPTION, leave unspecified to make no changes. *grant\_option* only has an effect if *state* is `present`. aliases: admin\_option | | **host** string | | Database host address. If unspecified, connect via Unix socket. aliases: login\_host | | **login** string | **Default:**"postgres" | The username to authenticate with. aliases: login\_user | | **login\_host** string | | Host running the database. If you have connection issues when using `localhost`, try to use `127.0.0.1` instead. | | **login\_password** string | | The password this module should use to establish its PostgreSQL session. | | **login\_unix\_socket** string | | Path to a Unix domain socket for local connections. | | **login\_user** string | **Default:**"postgres" | The username this module should use to establish its PostgreSQL session. | | **objs** string | | Comma separated list of database objects to set privileges on. If *type* is `table`, `partition table`, `sequence`, `function` or `procedure`, the special valueC(ALL\_IN\_SCHEMA) can be provided instead to specify all database objects of type *type* in the schema specified via *schema*. (This also works with PostgreSQL < 9.0.) (`ALL_IN_SCHEMA` is available for `function` and `partition table` since Ansible 2.8). `procedure` is supported since PostgreSQL 11 and M(community.postgresql) collection 1.3.0. If *type* is `database`, this parameter can be omitted, in which case privileges are set for the database specified via *database*. If *type* is *function* or *procedure*, colons (":") in object names will be replaced with commas (needed to specify signatures, see examples). aliases: obj | | **password** string | | The password to authenticate with. aliases: login\_password | | **port** integer | **Default:**5432 | Database port to connect to. aliases: login\_port | | **privs** string | | Comma separated list of privileges to grant/revoke. aliases: priv | | **roles** string / required | | Comma separated list of role (user/group) names to set permissions for. The special value `PUBLIC` can be provided instead to set permissions for the implicitly defined PUBLIC group. aliases: role | | **schema** string | | Schema that contains the database objects specified via *objs*. May only be provided if *type* is `table`, `sequence`, `function`, `procedure`, `type`, or `default_privs`. Defaults to `public` in these cases. Pay attention, for embedded types when *type=type* *schema* can be `pg_catalog` or `information_schema` respectively. | | **session\_role** string | | Switch to session\_role after connecting. The specified session\_role must be a role that the current login\_user is a member of. Permissions checking for SQL commands is carried out as though the session\_role were the one that had logged in originally. | | **ssl\_mode** string | **Choices:*** allow * disable * **prefer** ← * require * verify-ca * verify-full | Determines whether or with what priority a secure SSL TCP/IP connection will be negotiated with the server. See <https://www.postgresql.org/docs/current/static/libpq-ssl.html> for more information on the modes. Default of `prefer` matches libpq default. | | **state** string | **Choices:*** absent * **present** ← | If `present`, the specified privileges are granted, if `absent` they are revoked. | | **target\_roles** string | | A list of existing role (user/group) names to set as the default permissions for database objects subsequently created by them. Parameter *target\_roles* is only available with `type=default_privs`. | | **trust\_input** boolean added in 0.2.0 of community.postgresql | **Choices:*** no * **yes** ← | If `no`, check whether values of parameters *roles*, *target\_roles*, *session\_role*, *schema* are potentially dangerous. It makes sense to use `no` only when SQL injections via the parameters are possible. | | **type** string | **Choices:*** database * default\_privs * foreign\_data\_wrapper * foreign\_server * function * group * language * **table** ← * tablespace * schema * sequence * type * procedure | Type of database object to set privileges on. The `default_privs` choice is available starting at version 2.7. The `foreign_data_wrapper` and `foreign_server` object types are available since Ansible version 2.8. The `type` choice is available since Ansible version 2.10. The `procedure` is supported since collection version 1.3.0 and PostgreSQL 11. | | **unix\_socket** string | | Path to a Unix domain socket for local connections. aliases: login\_unix\_socket | | **usage\_on\_types** boolean added in 1.2.0 of community.postgresql | **Choices:*** no * **yes** ← | When adding default privileges, the module always implicitly adds ``USAGE ON TYPES``. To avoid this behavior, set *usage\_on\_types* to `no`. Added to save backwards compatibility. Used only when adding default privileges, ignored otherwise. | Notes ----- Note * Supports `check_mode`. * Parameters that accept comma separated lists (*privs*, *objs*, *roles*) have singular alias names (*priv*, *obj*, *role*). * To revoke only `GRANT OPTION` for a specific object, set *state* to `present` and *grant\_option* to `no` (see examples). * Note that when revoking privileges from a role R, this role may still have access via privileges granted to any role R is a member of including `PUBLIC`. * Note that when you use `PUBLIC` role, the module always reports that the state has been changed. * Note that when revoking privileges from a role R, you do so as the user specified via *login*. If R has been granted the same privileges by another user also, R can still access database objects via these privileges. * When revoking privileges, `RESTRICT` is assumed (see PostgreSQL docs). * The default authentication assumes that you are either logging in as or sudo’ing to the `postgres` account on the host. * To avoid “Peer authentication failed for user postgres” error, use postgres user as a *become\_user*. * This module uses psycopg2, a Python PostgreSQL database adapter. You must ensure that psycopg2 is installed on the host before using this module. * If the remote host is the PostgreSQL server (which is the default case), then PostgreSQL must also be installed on the remote host. * For Ubuntu-based systems, install the postgresql, libpq-dev, and python-psycopg2 packages on the remote host before using this module. * The ca\_cert parameter requires at least Postgres version 8.4 and *psycopg2* version 2.4.3. See Also -------- See also [community.postgresql.postgresql\_user](postgresql_user_module#ansible-collections-community-postgresql-postgresql-user-module) The official documentation on the **community.postgresql.postgresql\_user** module. [community.postgresql.postgresql\_owner](postgresql_owner_module#ansible-collections-community-postgresql-postgresql-owner-module) The official documentation on the **community.postgresql.postgresql\_owner** module. [community.postgresql.postgresql\_membership](postgresql_membership_module#ansible-collections-community-postgresql-postgresql-membership-module) The official documentation on the **community.postgresql.postgresql\_membership** module. [PostgreSQL privileges](https://www.postgresql.org/docs/current/ddl-priv.html) General information about PostgreSQL privileges. [PostgreSQL GRANT command reference](https://www.postgresql.org/docs/current/sql-grant.html) Complete reference of the PostgreSQL GRANT command documentation. [PostgreSQL REVOKE command reference](https://www.postgresql.org/docs/current/sql-revoke.html) Complete reference of the PostgreSQL REVOKE command documentation. Examples -------- ``` # On database "library": # GRANT SELECT, INSERT, UPDATE ON TABLE public.books, public.authors # TO librarian, reader WITH GRANT OPTION - name: Grant privs to librarian and reader on database library community.postgresql.postgresql_privs: database: library state: present privs: SELECT,INSERT,UPDATE type: table objs: books,authors schema: public roles: librarian,reader grant_option: yes - name: Same as above leveraging default values community.postgresql.postgresql_privs: db: library privs: SELECT,INSERT,UPDATE objs: books,authors roles: librarian,reader grant_option: yes # REVOKE GRANT OPTION FOR INSERT ON TABLE books FROM reader # Note that role "reader" will be *granted* INSERT privilege itself if this # isn't already the case (since state: present). - name: Revoke privs from reader community.postgresql.postgresql_privs: db: library state: present priv: INSERT obj: books role: reader grant_option: no # "public" is the default schema. This also works for PostgreSQL 8.x. - name: REVOKE INSERT, UPDATE ON ALL TABLES IN SCHEMA public FROM reader community.postgresql.postgresql_privs: db: library state: absent privs: INSERT,UPDATE objs: ALL_IN_SCHEMA role: reader - name: GRANT ALL PRIVILEGES ON SCHEMA public, math TO librarian community.postgresql.postgresql_privs: db: library privs: ALL type: schema objs: public,math role: librarian # Note the separation of arguments with colons. - name: GRANT ALL PRIVILEGES ON FUNCTION math.add(int, int) TO librarian, reader community.postgresql.postgresql_privs: db: library privs: ALL type: function obj: add(int:int) schema: math roles: librarian,reader # Note that group role memberships apply cluster-wide and therefore are not # restricted to database "library" here. - name: GRANT librarian, reader TO alice, bob WITH ADMIN OPTION community.postgresql.postgresql_privs: db: library type: group objs: librarian,reader roles: alice,bob admin_option: yes # Note that here "db: postgres" specifies the database to connect to, not the # database to grant privileges on (which is specified via the "objs" param) - name: GRANT ALL PRIVILEGES ON DATABASE library TO librarian community.postgresql.postgresql_privs: db: postgres privs: ALL type: database obj: library role: librarian # If objs is omitted for type "database", it defaults to the database # to which the connection is established - name: GRANT ALL PRIVILEGES ON DATABASE library TO librarian community.postgresql.postgresql_privs: db: library privs: ALL type: database role: librarian # Available since version 2.7 # Objs must be set, ALL_DEFAULT to TABLES/SEQUENCES/TYPES/FUNCTIONS # ALL_DEFAULT works only with privs=ALL # For specific - name: ALTER DEFAULT PRIVILEGES ON DATABASE library TO librarian community.postgresql.postgresql_privs: db: library objs: ALL_DEFAULT privs: ALL type: default_privs role: librarian grant_option: yes # Available since version 2.7 # Objs must be set, ALL_DEFAULT to TABLES/SEQUENCES/TYPES/FUNCTIONS # ALL_DEFAULT works only with privs=ALL # For specific - name: ALTER DEFAULT PRIVILEGES ON DATABASE library TO reader, step 1 community.postgresql.postgresql_privs: db: library objs: TABLES,SEQUENCES privs: SELECT type: default_privs role: reader - name: ALTER DEFAULT PRIVILEGES ON DATABASE library TO reader, step 2 community.postgresql.postgresql_privs: db: library objs: TYPES privs: USAGE type: default_privs role: reader # Available since version 2.8 - name: GRANT ALL PRIVILEGES ON FOREIGN DATA WRAPPER fdw TO reader community.postgresql.postgresql_privs: db: test objs: fdw privs: ALL type: foreign_data_wrapper role: reader # Available since community.postgresql 0.2.0 - name: GRANT ALL PRIVILEGES ON TYPE customtype TO reader community.postgresql.postgresql_privs: db: test objs: customtype privs: ALL type: type role: reader # Available since version 2.8 - name: GRANT ALL PRIVILEGES ON FOREIGN SERVER fdw_server TO reader community.postgresql.postgresql_privs: db: test objs: fdw_server privs: ALL type: foreign_server role: reader # Available since version 2.8 # Grant 'execute' permissions on all functions in schema 'common' to role 'caller' - name: GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA common TO caller community.postgresql.postgresql_privs: type: function state: present privs: EXECUTE roles: caller objs: ALL_IN_SCHEMA schema: common # Available since collection version 1.3.0 # Grant 'execute' permissions on all procedures in schema 'common' to role 'caller' # Needs PostreSQL 11 or higher and community.postgresql 1.3.0 or higher - name: GRANT EXECUTE ON ALL PROCEDURES IN SCHEMA common TO caller community.postgresql.postgresql_privs: type: prucedure state: present privs: EXECUTE roles: caller objs: ALL_IN_SCHEMA schema: common # Available since version 2.8 # ALTER DEFAULT PRIVILEGES FOR ROLE librarian IN SCHEMA library GRANT SELECT ON TABLES TO reader # GRANT SELECT privileges for new TABLES objects created by librarian as # default to the role reader. # For specific - name: ALTER privs community.postgresql.postgresql_privs: db: library schema: library objs: TABLES privs: SELECT type: default_privs role: reader target_roles: librarian # Available since version 2.8 # ALTER DEFAULT PRIVILEGES FOR ROLE librarian IN SCHEMA library REVOKE SELECT ON TABLES FROM reader # REVOKE SELECT privileges for new TABLES objects created by librarian as # default from the role reader. # For specific - name: ALTER privs community.postgresql.postgresql_privs: db: library state: absent schema: library objs: TABLES privs: SELECT type: default_privs role: reader target_roles: librarian # Available since community.postgresql 0.2.0 - name: Grant type privileges for pg_catalog.numeric type to alice community.postgresql.postgresql_privs: type: type roles: alice privs: ALL objs: numeric schema: pg_catalog db: acme ``` 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 | | --- | --- | --- | | **queries** list / elements=string | always | List of executed queries. **Sample:** ['REVOKE GRANT OPTION FOR INSERT ON TABLE "books" FROM "reader";'] | ### Authors * Bernhard Weitzhofer (@b6d) * Tobias Birkefeld (@tcraxs)
programming_docs
ansible community.postgresql.postgresql_idx – Create or drop indexes from a PostgreSQL database community.postgresql.postgresql\_idx – Create or drop indexes from a PostgreSQL database ======================================================================================== Note This plugin is part of the [community.postgresql collection](https://galaxy.ansible.com/community/postgresql) (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.postgresql`. To use it in a playbook, specify: `community.postgresql.postgresql_idx`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Create or drop indexes from a PostgreSQL database. Requirements ------------ The below requirements are needed on the host that executes this module. * psycopg2 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ca\_cert** string | | Specifies the name of a file containing SSL certificate authority (CA) certificate(s). If the file exists, the server's certificate will be verified to be signed by one of these authorities. aliases: ssl\_rootcert | | **cascade** boolean | **Choices:*** **no** ← * yes | Automatically drop objects that depend on the index, and in turn all objects that depend on those objects. It used only with *state=absent*. Mutually exclusive with *concurrent=yes*. | | **columns** list / elements=string | | List of index columns that need to be covered by index. Mutually exclusive with *state=absent*. aliases: column | | **concurrent** boolean | **Choices:*** no * **yes** ← | Enable or disable concurrent mode (CREATE / DROP INDEX CONCURRENTLY). Pay attention, if *concurrent=no*, the table will be locked (ACCESS EXCLUSIVE) during the building process. For more information about the lock levels see <https://www.postgresql.org/docs/current/explicit-locking.html>. If the building process was interrupted for any reason when *cuncurrent=yes*, the index becomes invalid. In this case it should be dropped and created again. Mutually exclusive with *cascade=yes*. | | **cond** string | | Index conditions. Mutually exclusive with *state=absent*. | | **db** string | | Name of database to connect to and where the index will be created/dropped. aliases: login\_db | | **idxname** string / required | | Name of the index to create or drop. aliases: name | | **idxtype** string | | Index type (like btree, gist, gin, etc.). Mutually exclusive with *state=absent*. aliases: type | | **login\_host** string | | Host running the database. If you have connection issues when using `localhost`, try to use `127.0.0.1` instead. | | **login\_password** string | | The password this module should use to establish its PostgreSQL session. | | **login\_unix\_socket** string | | Path to a Unix domain socket for local connections. | | **login\_user** string | **Default:**"postgres" | The username this module should use to establish its PostgreSQL session. | | **port** integer | **Default:**5432 | Database port to connect to. aliases: login\_port | | **schema** string | | Name of a database schema where the index will be created. | | **session\_role** string | | Switch to session\_role after connecting. The specified session\_role must be a role that the current login\_user is a member of. Permissions checking for SQL commands is carried out as though the session\_role were the one that had logged in originally. | | **ssl\_mode** string | **Choices:*** allow * disable * **prefer** ← * require * verify-ca * verify-full | Determines whether or with what priority a secure SSL TCP/IP connection will be negotiated with the server. See <https://www.postgresql.org/docs/current/static/libpq-ssl.html> for more information on the modes. Default of `prefer` matches libpq default. | | **state** string | **Choices:*** absent * **present** ← | Index state. `present` implies the index will be created if it does not exist. `absent` implies the index will be dropped if it exists. | | **storage\_params** list / elements=string | | Storage parameters like fillfactor, vacuum\_cleanup\_index\_scale\_factor, etc. Mutually exclusive with *state=absent*. | | **table** string | | Table to create index on it. Mutually exclusive with *state=absent*. | | **tablespace** string | | Set a tablespace for the index. Mutually exclusive with *state=absent*. | | **trust\_input** boolean added in 0.2.0 of community.postgresql | **Choices:*** no * **yes** ← | If `no`, check whether values of parameters *idxname*, *session\_role*, *schema*, *table*, *columns*, *tablespace*, *storage\_params*, *cond* are potentially dangerous. It makes sense to use `no` only when SQL injections via the parameters are possible. | | **unique** boolean added in 0.2.0 of community.postgresql | **Choices:*** **no** ← * yes | Enable unique index. Only btree currently supports unique indexes. | Notes ----- Note * Supports `check_mode`. * The index building process can affect database performance. * To avoid table locks on production databases, use *concurrent=yes* (default behavior). * The default authentication assumes that you are either logging in as or sudo’ing to the `postgres` account on the host. * To avoid “Peer authentication failed for user postgres” error, use postgres user as a *become\_user*. * This module uses psycopg2, a Python PostgreSQL database adapter. You must ensure that psycopg2 is installed on the host before using this module. * If the remote host is the PostgreSQL server (which is the default case), then PostgreSQL must also be installed on the remote host. * For Ubuntu-based systems, install the postgresql, libpq-dev, and python-psycopg2 packages on the remote host before using this module. * The ca\_cert parameter requires at least Postgres version 8.4 and *psycopg2* version 2.4.3. See Also -------- See also [community.postgresql.postgresql\_table](postgresql_table_module#ansible-collections-community-postgresql-postgresql-table-module) The official documentation on the **community.postgresql.postgresql\_table** module. [community.postgresql.postgresql\_tablespace](postgresql_tablespace_module#ansible-collections-community-postgresql-postgresql-tablespace-module) The official documentation on the **community.postgresql.postgresql\_tablespace** module. [PostgreSQL indexes reference](https://www.postgresql.org/docs/current/indexes.html) General information about PostgreSQL indexes. [CREATE INDEX reference](https://www.postgresql.org/docs/current/sql-createindex.html) Complete reference of the CREATE INDEX command documentation. [ALTER INDEX reference](https://www.postgresql.org/docs/current/sql-alterindex.html) Complete reference of the ALTER INDEX command documentation. [DROP INDEX reference](https://www.postgresql.org/docs/current/sql-dropindex.html) Complete reference of the DROP INDEX command documentation. Examples -------- ``` - name: Create btree index if not exists test_idx concurrently covering columns id and name of table products community.postgresql.postgresql_idx: db: acme table: products columns: id,name name: test_idx - name: Create btree index test_idx concurrently with tablespace called ssd and storage parameter community.postgresql.postgresql_idx: db: acme table: products columns: - id - name idxname: test_idx tablespace: ssd storage_params: - fillfactor=90 - name: Create gist index test_gist_idx concurrently on column geo_data of table map community.postgresql.postgresql_idx: db: somedb table: map idxtype: gist columns: geo_data idxname: test_gist_idx # Note: for the example below pg_trgm extension must be installed for gin_trgm_ops - name: Create gin index gin0_idx not concurrently on column comment of table test community.postgresql.postgresql_idx: idxname: gin0_idx table: test columns: comment gin_trgm_ops concurrent: no idxtype: gin - name: Drop btree test_idx concurrently community.postgresql.postgresql_idx: db: mydb idxname: test_idx state: absent - name: Drop test_idx cascade community.postgresql.postgresql_idx: db: mydb idxname: test_idx state: absent cascade: yes concurrent: no - name: Create btree index test_idx concurrently on columns id,comment where column id > 1 community.postgresql.postgresql_idx: db: mydb table: test columns: id,comment idxname: test_idx cond: id > 1 - name: Create unique btree index if not exists test_unique_idx on column name of table products community.postgresql.postgresql_idx: db: acme table: products columns: name name: test_unique_idx unique: yes concurrent: 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 | | --- | --- | --- | | **name** string | always | Index name. **Sample:** foo\_idx | | **query** string | always | Query that was tried to be executed. **Sample:** CREATE INDEX CONCURRENTLY foo\_idx ON test\_table USING BTREE (id) | | **schema** string | always | Schema where index exists. **Sample:** public | | **state** string | always | Index state. **Sample:** present | | **storage\_params** list / elements=string | always | Index storage parameters. **Sample:** ['fillfactor=90'] | | **tablespace** string | always | Tablespace where index exists. **Sample:** ssd | | **valid** boolean | always | Index validity. **Sample:** True | ### Authors * Andrew Klychkov (@Andersson007) * Thomas O’Donnell (@andytom) ansible community.postgresql.postgresql_table – Create, drop, or modify a PostgreSQL table community.postgresql.postgresql\_table – Create, drop, or modify a PostgreSQL table =================================================================================== Note This plugin is part of the [community.postgresql collection](https://galaxy.ansible.com/community/postgresql) (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.postgresql`. To use it in a playbook, specify: `community.postgresql.postgresql_table`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Allows to create, drop, rename, truncate a table, or change some table attributes. Requirements ------------ The below requirements are needed on the host that executes this module. * psycopg2 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ca\_cert** string | | Specifies the name of a file containing SSL certificate authority (CA) certificate(s). If the file exists, the server's certificate will be verified to be signed by one of these authorities. aliases: ssl\_rootcert | | **cascade** boolean | **Choices:*** **no** ← * yes | Automatically drop objects that depend on the table (such as views). Used with *state=absent* only. | | **columns** list / elements=string | | Columns that are needed. | | **db** string | | Name of database to connect and where the table will be created. aliases: login\_db | | **including** string | | Keywords that are used with like parameter, may be DEFAULTS, CONSTRAINTS, INDEXES, STORAGE, COMMENTS or ALL. Needs *like* specified. Mutually exclusive with *columns*, *rename*, and *truncate*. | | **like** string | | Create a table like another table (with similar DDL). Mutually exclusive with *columns*, *rename*, and *truncate*. | | **login\_host** string | | Host running the database. If you have connection issues when using `localhost`, try to use `127.0.0.1` instead. | | **login\_password** string | | The password this module should use to establish its PostgreSQL session. | | **login\_unix\_socket** string | | Path to a Unix domain socket for local connections. | | **login\_user** string | **Default:**"postgres" | The username this module should use to establish its PostgreSQL session. | | **owner** string | | Set a table owner. | | **port** integer | **Default:**5432 | Database port to connect to. aliases: login\_port | | **rename** string | | New table name. Mutually exclusive with *tablespace*, *owner*, *unlogged*, *like*, *including*, *columns*, *truncate*, and *storage\_params*. | | **session\_role** string | | Switch to session\_role after connecting. The specified session\_role must be a role that the current login\_user is a member of. Permissions checking for SQL commands is carried out as though the session\_role were the one that had logged in originally. | | **ssl\_mode** string | **Choices:*** allow * disable * **prefer** ← * require * verify-ca * verify-full | Determines whether or with what priority a secure SSL TCP/IP connection will be negotiated with the server. See <https://www.postgresql.org/docs/current/static/libpq-ssl.html> for more information on the modes. Default of `prefer` matches libpq default. | | **state** string | **Choices:*** absent * **present** ← | The table state. *state=absent* is mutually exclusive with *tablespace*, *owner*, *unlogged*, *like*, *including*, *columns*, *truncate*, *storage\_params* and, *rename*. | | **storage\_params** list / elements=string | | Storage parameters like fillfactor, autovacuum\_vacuum\_treshold, etc. Mutually exclusive with *rename* and *truncate*. | | **table** string / required | | Table name. aliases: name | | **tablespace** string | | Set a tablespace for the table. | | **truncate** boolean | **Choices:*** **no** ← * yes | Truncate a table. Mutually exclusive with *tablespace*, *owner*, *unlogged*, *like*, *including*, *columns*, *rename*, and *storage\_params*. | | **trust\_input** boolean added in 0.2.0 of community.postgresql | **Choices:*** no * **yes** ← | If `no`, check whether values of parameters are potentially dangerous. It makes sense to use `no` only when SQL injections are possible. | | **unlogged** boolean | **Choices:*** **no** ← * yes | Create an unlogged table. | Notes ----- Note * Supports `check_mode`. * If you do not pass db parameter, tables will be created in the database named postgres. * PostgreSQL allows to create columnless table, so columns param is optional. * Unlogged tables are available from PostgreSQL server version 9.1. * The default authentication assumes that you are either logging in as or sudo’ing to the `postgres` account on the host. * To avoid “Peer authentication failed for user postgres” error, use postgres user as a *become\_user*. * This module uses psycopg2, a Python PostgreSQL database adapter. You must ensure that psycopg2 is installed on the host before using this module. * If the remote host is the PostgreSQL server (which is the default case), then PostgreSQL must also be installed on the remote host. * For Ubuntu-based systems, install the postgresql, libpq-dev, and python-psycopg2 packages on the remote host before using this module. * The ca\_cert parameter requires at least Postgres version 8.4 and *psycopg2* version 2.4.3. See Also -------- See also [community.postgresql.postgresql\_sequence](postgresql_sequence_module#ansible-collections-community-postgresql-postgresql-sequence-module) The official documentation on the **community.postgresql.postgresql\_sequence** module. [community.postgresql.postgresql\_idx](postgresql_idx_module#ansible-collections-community-postgresql-postgresql-idx-module) The official documentation on the **community.postgresql.postgresql\_idx** module. [community.postgresql.postgresql\_info](postgresql_info_module#ansible-collections-community-postgresql-postgresql-info-module) The official documentation on the **community.postgresql.postgresql\_info** module. [community.postgresql.postgresql\_tablespace](postgresql_tablespace_module#ansible-collections-community-postgresql-postgresql-tablespace-module) The official documentation on the **community.postgresql.postgresql\_tablespace** module. [community.postgresql.postgresql\_owner](postgresql_owner_module#ansible-collections-community-postgresql-postgresql-owner-module) The official documentation on the **community.postgresql.postgresql\_owner** module. [community.postgresql.postgresql\_privs](postgresql_privs_module#ansible-collections-community-postgresql-postgresql-privs-module) The official documentation on the **community.postgresql.postgresql\_privs** module. [community.postgresql.postgresql\_copy](postgresql_copy_module#ansible-collections-community-postgresql-postgresql-copy-module) The official documentation on the **community.postgresql.postgresql\_copy** module. [CREATE TABLE reference](https://www.postgresql.org/docs/current/sql-createtable.html) Complete reference of the CREATE TABLE command documentation. [ALTER TABLE reference](https://www.postgresql.org/docs/current/sql-altertable.html) Complete reference of the ALTER TABLE command documentation. [DROP TABLE reference](https://www.postgresql.org/docs/current/sql-droptable.html) Complete reference of the DROP TABLE command documentation. [PostgreSQL data types](https://www.postgresql.org/docs/current/datatype.html) Complete reference of the PostgreSQL data types documentation. Examples -------- ``` - name: Create tbl2 in the acme database with the DDL like tbl1 with testuser as an owner community.postgresql.postgresql_table: db: acme name: tbl2 like: tbl1 owner: testuser - name: Create tbl2 in the acme database and tablespace ssd with the DDL like tbl1 including comments and indexes community.postgresql.postgresql_table: db: acme table: tbl2 like: tbl1 including: comments, indexes tablespace: ssd - name: Create test_table with several columns in ssd tablespace with fillfactor=10 and autovacuum_analyze_threshold=1 community.postgresql.postgresql_table: name: test_table columns: - id bigserial primary key - num bigint - stories text tablespace: ssd storage_params: - fillfactor=10 - autovacuum_analyze_threshold=1 - name: Create an unlogged table in schema acme community.postgresql.postgresql_table: name: acme.useless_data columns: waste_id int unlogged: true - name: Rename table foo to bar community.postgresql.postgresql_table: table: foo rename: bar - name: Rename table foo from schema acme to bar community.postgresql.postgresql_table: name: acme.foo rename: bar - name: Set owner to someuser community.postgresql.postgresql_table: name: foo owner: someuser - name: Change tablespace of foo table to new_tablespace and set owner to new_user community.postgresql.postgresql_table: name: foo tablespace: new_tablespace owner: new_user - name: Truncate table foo community.postgresql.postgresql_table: name: foo truncate: yes - name: Drop table foo from schema acme community.postgresql.postgresql_table: name: acme.foo state: absent - name: Drop table bar cascade community.postgresql.postgresql_table: name: bar state: absent cascade: 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 | | --- | --- | --- | | **owner** string | always | Table owner. **Sample:** postgres | | **queries** string | always | List of executed queries. **Sample:** ['CREATE TABLE "test\_table" (id bigint)'] | | **state** string | always | Table state. **Sample:** present | | **storage\_params** list / elements=string | always | Storage parameters. **Sample:** ['fillfactor=100', 'autovacuum\_analyze\_threshold=1'] | | **table** string | always | Name of a table. **Sample:** foo | | **tablespace** string | always | Tablespace. **Sample:** ssd\_tablespace | ### Authors * Andrei Klychkov (@Andersson007)
programming_docs
ansible Community.Postgresql Community.Postgresql ==================== Collection version 1.5.0 Plugin Index ------------ These are the plugins in the community.postgresql collection ### Modules * [postgresql\_copy](postgresql_copy_module#ansible-collections-community-postgresql-postgresql-copy-module) – Copy data between a file/program and a PostgreSQL table * [postgresql\_db](postgresql_db_module#ansible-collections-community-postgresql-postgresql-db-module) – Add or remove PostgreSQL databases from a remote host * [postgresql\_ext](postgresql_ext_module#ansible-collections-community-postgresql-postgresql-ext-module) – Add or remove PostgreSQL extensions from a database * [postgresql\_idx](postgresql_idx_module#ansible-collections-community-postgresql-postgresql-idx-module) – Create or drop indexes from a PostgreSQL database * [postgresql\_info](postgresql_info_module#ansible-collections-community-postgresql-postgresql-info-module) – Gather information about PostgreSQL servers * [postgresql\_lang](postgresql_lang_module#ansible-collections-community-postgresql-postgresql-lang-module) – Adds, removes or changes procedural languages with a PostgreSQL database * [postgresql\_membership](postgresql_membership_module#ansible-collections-community-postgresql-postgresql-membership-module) – Add or remove PostgreSQL roles from groups * [postgresql\_owner](postgresql_owner_module#ansible-collections-community-postgresql-postgresql-owner-module) – Change an owner of PostgreSQL database object * [postgresql\_pg\_hba](postgresql_pg_hba_module#ansible-collections-community-postgresql-postgresql-pg-hba-module) – Add, remove or modify a rule in a pg\_hba file * [postgresql\_ping](postgresql_ping_module#ansible-collections-community-postgresql-postgresql-ping-module) – Check remote PostgreSQL server availability * [postgresql\_privs](postgresql_privs_module#ansible-collections-community-postgresql-postgresql-privs-module) – Grant or revoke privileges on PostgreSQL database objects * [postgresql\_publication](postgresql_publication_module#ansible-collections-community-postgresql-postgresql-publication-module) – Add, update, or remove PostgreSQL publication * [postgresql\_query](postgresql_query_module#ansible-collections-community-postgresql-postgresql-query-module) – Run PostgreSQL queries * [postgresql\_schema](postgresql_schema_module#ansible-collections-community-postgresql-postgresql-schema-module) – Add or remove PostgreSQL schema * [postgresql\_sequence](postgresql_sequence_module#ansible-collections-community-postgresql-postgresql-sequence-module) – Create, drop, or alter a PostgreSQL sequence * [postgresql\_set](postgresql_set_module#ansible-collections-community-postgresql-postgresql-set-module) – Change a PostgreSQL server configuration parameter * [postgresql\_slot](postgresql_slot_module#ansible-collections-community-postgresql-postgresql-slot-module) – Add or remove replication slots from a PostgreSQL database * [postgresql\_subscription](postgresql_subscription_module#ansible-collections-community-postgresql-postgresql-subscription-module) – Add, update, or remove PostgreSQL subscription * [postgresql\_table](postgresql_table_module#ansible-collections-community-postgresql-postgresql-table-module) – Create, drop, or modify a PostgreSQL table * [postgresql\_tablespace](postgresql_tablespace_module#ansible-collections-community-postgresql-postgresql-tablespace-module) – Add or remove PostgreSQL tablespaces from remote hosts * [postgresql\_user](postgresql_user_module#ansible-collections-community-postgresql-postgresql-user-module) – Create, alter, or remove a user (role) from a PostgreSQL server instance * [postgresql\_user\_obj\_stat\_info](postgresql_user_obj_stat_info_module#ansible-collections-community-postgresql-postgresql-user-obj-stat-info-module) – Gather statistics about PostgreSQL user objects See also List of [collections](../../index#list-of-collections) with docs hosted here. ansible community.postgresql.postgresql_ext – Add or remove PostgreSQL extensions from a database community.postgresql.postgresql\_ext – Add or remove PostgreSQL extensions from a database ========================================================================================== Note This plugin is part of the [community.postgresql collection](https://galaxy.ansible.com/community/postgresql) (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.postgresql`. To use it in a playbook, specify: `community.postgresql.postgresql_ext`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Add or remove PostgreSQL extensions from a database. Requirements ------------ The below requirements are needed on the host that executes this module. * psycopg2 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ca\_cert** string | | Specifies the name of a file containing SSL certificate authority (CA) certificate(s). If the file exists, the server's certificate will be verified to be signed by one of these authorities. aliases: ssl\_rootcert | | **cascade** boolean | **Choices:*** **no** ← * yes | Automatically install/remove any extensions that this extension depends on that are not already installed/removed (supported since PostgreSQL 9.6). | | **db** string / required | | Name of the database to add or remove the extension to/from. aliases: login\_db | | **login\_host** string | | Host running the database. If you have connection issues when using `localhost`, try to use `127.0.0.1` instead. | | **login\_password** string | | The password this module should use to establish its PostgreSQL session. | | **login\_unix\_socket** string | | Path to a Unix domain socket for local connections. | | **login\_user** string | **Default:**"postgres" | The username this module should use to establish its PostgreSQL session. | | **name** string / required | | Name of the extension to add or remove. aliases: ext | | **port** integer | **Default:**5432 | Database port to connect to. aliases: login\_port | | **schema** string | | Name of the schema to add the extension to. | | **session\_role** string | | Switch to session\_role after connecting. The specified session\_role must be a role that the current login\_user is a member of. Permissions checking for SQL commands is carried out as though the session\_role were the one that had logged in originally. | | **ssl\_mode** string | **Choices:*** allow * disable * **prefer** ← * require * verify-ca * verify-full | Determines whether or with what priority a secure SSL TCP/IP connection will be negotiated with the server. See <https://www.postgresql.org/docs/current/static/libpq-ssl.html> for more information on the modes. Default of `prefer` matches libpq default. | | **state** string | **Choices:*** absent * **present** ← | The database extension state. | | **trust\_input** boolean added in 0.2.0 of community.postgresql | **Choices:*** no * **yes** ← | If `no`, check whether values of parameters *ext*, *schema*, *version*, *session\_role* are potentially dangerous. It makes sense to use `no` only when SQL injections via the parameters are possible. | | **version** string | | Extension version to add or update to. Has effect with *state=present* only. If not specified, the latest extension version will be created. It can't downgrade an extension version. When version downgrade is needed, remove the extension and create new one with appropriate version. Set *version=latest* to update the extension to the latest available version. | Notes ----- Note * Supports `check_mode`. * The default authentication assumes that you are either logging in as or sudo’ing to the `postgres` account on the host. * This module uses *psycopg2*, a Python PostgreSQL database adapter. * You must ensure that `psycopg2` is installed on the host before using this module. * If the remote host is the PostgreSQL server (which is the default case), then PostgreSQL must also be installed on the remote host. * For Ubuntu-based systems, install the `postgresql`, `libpq-dev`, and `python-psycopg2` packages on the remote host before using this module. * Incomparable versions, for example PostGIS `unpackaged`, cannot be installed. * The default authentication assumes that you are either logging in as or sudo’ing to the `postgres` account on the host. * To avoid “Peer authentication failed for user postgres” error, use postgres user as a *become\_user*. * This module uses psycopg2, a Python PostgreSQL database adapter. You must ensure that psycopg2 is installed on the host before using this module. * If the remote host is the PostgreSQL server (which is the default case), then PostgreSQL must also be installed on the remote host. * For Ubuntu-based systems, install the postgresql, libpq-dev, and python-psycopg2 packages on the remote host before using this module. * The ca\_cert parameter requires at least Postgres version 8.4 and *psycopg2* version 2.4.3. See Also -------- See also [PostgreSQL extensions](https://www.postgresql.org/docs/current/external-extensions.html) General information about PostgreSQL extensions. [CREATE EXTENSION reference](https://www.postgresql.org/docs/current/sql-createextension.html) Complete reference of the CREATE EXTENSION command documentation. [ALTER EXTENSION reference](https://www.postgresql.org/docs/current/sql-alterextension.html) Complete reference of the ALTER EXTENSION command documentation. [DROP EXTENSION reference](https://www.postgresql.org/docs/current/sql-droppublication.html) Complete reference of the DROP EXTENSION command documentation. Examples -------- ``` - name: Adds postgis extension to the database acme in the schema foo community.postgresql.postgresql_ext: name: postgis db: acme schema: foo - name: Removes postgis extension to the database acme community.postgresql.postgresql_ext: name: postgis db: acme state: absent - name: Adds earthdistance extension to the database template1 cascade community.postgresql.postgresql_ext: name: earthdistance db: template1 cascade: true # In the example below, if earthdistance extension is installed, # it will be removed too because it depends on cube: - name: Removes cube extension from the database acme cascade community.postgresql.postgresql_ext: name: cube db: acme cascade: yes state: absent - name: Create extension foo of version 1.2 or update it if it's already created community.postgresql.postgresql_ext: db: acme name: foo version: 1.2 - name: Assuming extension foo is created, update it to the latest version community.postgresql.postgresql_ext: db: acme name: foo version: latest ``` 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 | | --- | --- | --- | | **query** list / elements=string | always | List of executed queries. **Sample:** ['DROP EXTENSION "acme"'] | ### Authors * Daniel Schep (@dschep) * Thomas O’Donnell (@andytom) * Sandro Santilli (@strk) * Andrew Klychkov (@Andersson007) ansible community.postgresql.postgresql_user_obj_stat_info – Gather statistics about PostgreSQL user objects community.postgresql.postgresql\_user\_obj\_stat\_info – Gather statistics about PostgreSQL user objects ======================================================================================================== Note This plugin is part of the [community.postgresql collection](https://galaxy.ansible.com/community/postgresql) (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.postgresql`. To use it in a playbook, specify: `community.postgresql.postgresql_user_obj_stat_info`. New in version 0.2.0: of community.postgresql * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Gathers statistics about PostgreSQL user objects. Requirements ------------ The below requirements are needed on the host that executes this module. * psycopg2 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ca\_cert** string | | Specifies the name of a file containing SSL certificate authority (CA) certificate(s). If the file exists, the server's certificate will be verified to be signed by one of these authorities. aliases: ssl\_rootcert | | **db** string | | Name of database to connect. aliases: login\_db | | **filter** list / elements=string | | Limit the collected information by comma separated string or YAML list. Allowable values are `functions`, `indexes`, `tables`. By default, collects all subsets. Unsupported values are ignored. | | **login\_host** string | | Host running the database. If you have connection issues when using `localhost`, try to use `127.0.0.1` instead. | | **login\_password** string | | The password this module should use to establish its PostgreSQL session. | | **login\_unix\_socket** string | | Path to a Unix domain socket for local connections. | | **login\_user** string | **Default:**"postgres" | The username this module should use to establish its PostgreSQL session. | | **port** integer | **Default:**5432 | Database port to connect to. aliases: login\_port | | **schema** string | | Restrict the output by certain schema. | | **session\_role** string | | Switch to session\_role after connecting. The specified session\_role must be a role that the current login\_user is a member of. Permissions checking for SQL commands is carried out as though the session\_role were the one that had logged in originally. | | **ssl\_mode** string | **Choices:*** allow * disable * **prefer** ← * require * verify-ca * verify-full | Determines whether or with what priority a secure SSL TCP/IP connection will be negotiated with the server. See <https://www.postgresql.org/docs/current/static/libpq-ssl.html> for more information on the modes. Default of `prefer` matches libpq default. | | **trust\_input** boolean added in 0.2.0 of community.postgresql | **Choices:*** no * **yes** ← | If `no`, check the value of *session\_role* is potentially dangerous. It makes sense to use `no` only when SQL injections via *session\_role* are possible. | Notes ----- Note * `size` and `total_size` returned values are presented in bytes. * For tracking function statistics the PostgreSQL `track_functions` parameter must be enabled. See <https://www.postgresql.org/docs/current/runtime-config-statistics.html> for more information. * Supports `check_mode`. * The default authentication assumes that you are either logging in as or sudo’ing to the `postgres` account on the host. * To avoid “Peer authentication failed for user postgres” error, use postgres user as a *become\_user*. * This module uses psycopg2, a Python PostgreSQL database adapter. You must ensure that psycopg2 is installed on the host before using this module. * If the remote host is the PostgreSQL server (which is the default case), then PostgreSQL must also be installed on the remote host. * For Ubuntu-based systems, install the postgresql, libpq-dev, and python-psycopg2 packages on the remote host before using this module. * The ca\_cert parameter requires at least Postgres version 8.4 and *psycopg2* version 2.4.3. See Also -------- See also [community.postgresql.postgresql\_info](postgresql_info_module#ansible-collections-community-postgresql-postgresql-info-module) The official documentation on the **community.postgresql.postgresql\_info** module. [community.postgresql.postgresql\_ping](postgresql_ping_module#ansible-collections-community-postgresql-postgresql-ping-module) The official documentation on the **community.postgresql.postgresql\_ping** module. [PostgreSQL statistics collector reference](https://www.postgresql.org/docs/current/monitoring-stats.html) Complete reference of the PostgreSQL statistics collector documentation. Examples -------- ``` - name: Collect information about all supported user objects of the acme database community.postgresql.postgresql_user_obj_stat_info: db: acme - name: Collect information about all supported user objects in the custom schema of the acme database community.postgresql.postgresql_user_obj_stat_info: db: acme schema: custom - name: Collect information about user tables and indexes in the acme database community.postgresql.postgresql_user_obj_stat_info: db: acme filter: tables, indexes ``` 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 | | --- | --- | --- | | **functions** dictionary | always | User function statistics. **Sample:** {'public': {'inc': {'calls': 1, 'funcid': 26722, 'self\_time': 0.23, 'total\_time': 0.23}}} | | **indexes** dictionary | always | User index statistics. **Sample:** {'public': {'test\_id\_idx': {'...': None, 'idx\_scan': 0, 'idx\_tup\_fetch': 0, 'idx\_tup\_read': 0, 'relname': 'test', 'size': 8192}}} | | **tables** dictionary | always | User table statistics. **Sample:** {'public': {'test': {'...': None, 'analyze\_count': 3, 'n\_dead\_tup': 0, 'n\_live\_tup': 0, 'seq\_scan': 2, 'size': 0, 'total\_size': 8192}}} | ### Authors * Andrew Klychkov (@Andersson007) * Thomas O’Donnell (@andytom) ansible community.postgresql.postgresql_owner – Change an owner of PostgreSQL database object community.postgresql.postgresql\_owner – Change an owner of PostgreSQL database object ====================================================================================== Note This plugin is part of the [community.postgresql collection](https://galaxy.ansible.com/community/postgresql) (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.postgresql`. To use it in a playbook, specify: `community.postgresql.postgresql_owner`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Change an owner of PostgreSQL database object. * Also allows to reassign the ownership of database objects owned by a database role to another role. Requirements ------------ The below requirements are needed on the host that executes this module. * psycopg2 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ca\_cert** string | | Specifies the name of a file containing SSL certificate authority (CA) certificate(s). If the file exists, the server's certificate will be verified to be signed by one of these authorities. aliases: ssl\_rootcert | | **db** string | | Name of database to connect to. aliases: login\_db | | **fail\_on\_role** boolean | **Choices:*** no * **yes** ← | If `yes`, fail when *reassign\_owned\_by* role does not exist. Otherwise just warn and continue. Mutually exclusive with *obj\_name* and *obj\_type*. | | **login\_host** string | | Host running the database. If you have connection issues when using `localhost`, try to use `127.0.0.1` instead. | | **login\_password** string | | The password this module should use to establish its PostgreSQL session. | | **login\_unix\_socket** string | | Path to a Unix domain socket for local connections. | | **login\_user** string | **Default:**"postgres" | The username this module should use to establish its PostgreSQL session. | | **new\_owner** string / required | | Role (user/group) to set as an *obj\_name* owner. | | **obj\_name** string | | Name of a database object to change ownership. Mutually exclusive with *reassign\_owned\_by*. | | **obj\_type** string | **Choices:*** database * function * matview * sequence * schema * table * tablespace * view | Type of a database object. Mutually exclusive with *reassign\_owned\_by*. aliases: type | | **port** integer | **Default:**5432 | Database port to connect to. aliases: login\_port | | **reassign\_owned\_by** list / elements=string | | The list of role names. The ownership of all the objects within the current database, and of all shared objects (databases, tablespaces), owned by this role(s) will be reassigned to *owner*. Pay attention - it reassigns all objects owned by this role(s) in the *db*! If role(s) exists, always returns changed True. Cannot reassign ownership of objects that are required by the database system. Mutually exclusive with `obj_type`. | | **session\_role** string | | Switch to session\_role after connecting. The specified session\_role must be a role that the current login\_user is a member of. Permissions checking for SQL commands is carried out as though the session\_role were the one that had logged in originally. | | **ssl\_mode** string | **Choices:*** allow * disable * **prefer** ← * require * verify-ca * verify-full | Determines whether or with what priority a secure SSL TCP/IP connection will be negotiated with the server. See <https://www.postgresql.org/docs/current/static/libpq-ssl.html> for more information on the modes. Default of `prefer` matches libpq default. | | **trust\_input** boolean added in 0.2.0 of community.postgresql | **Choices:*** no * **yes** ← | If `no`, check whether values of parameters *new\_owner*, *obj\_name*, *reassign\_owned\_by*, *session\_role* are potentially dangerous. It makes sense to use `no` only when SQL injections via the parameters are possible. | Notes ----- Note * Supports `check_mode`. * The default authentication assumes that you are either logging in as or sudo’ing to the `postgres` account on the host. * To avoid “Peer authentication failed for user postgres” error, use postgres user as a *become\_user*. * This module uses psycopg2, a Python PostgreSQL database adapter. You must ensure that psycopg2 is installed on the host before using this module. * If the remote host is the PostgreSQL server (which is the default case), then PostgreSQL must also be installed on the remote host. * For Ubuntu-based systems, install the postgresql, libpq-dev, and python-psycopg2 packages on the remote host before using this module. * The ca\_cert parameter requires at least Postgres version 8.4 and *psycopg2* version 2.4.3. See Also -------- See also [community.postgresql.postgresql\_user](postgresql_user_module#ansible-collections-community-postgresql-postgresql-user-module) The official documentation on the **community.postgresql.postgresql\_user** module. [community.postgresql.postgresql\_privs](postgresql_privs_module#ansible-collections-community-postgresql-postgresql-privs-module) The official documentation on the **community.postgresql.postgresql\_privs** module. [community.postgresql.postgresql\_membership](postgresql_membership_module#ansible-collections-community-postgresql-postgresql-membership-module) The official documentation on the **community.postgresql.postgresql\_membership** module. [PostgreSQL REASSIGN OWNED command reference](https://www.postgresql.org/docs/current/sql-reassign-owned.html) Complete reference of the PostgreSQL REASSIGN OWNED command documentation. Examples -------- ``` # Set owner as alice for function myfunc in database bar by ansible ad-hoc command: # ansible -m postgresql_owner -a "db=bar new_owner=alice obj_name=myfunc obj_type=function" - name: The same as above by playbook community.postgresql.postgresql_owner: db: bar new_owner: alice obj_name: myfunc obj_type: function - name: Set owner as bob for table acme in database bar community.postgresql.postgresql_owner: db: bar new_owner: bob obj_name: acme obj_type: table - name: Set owner as alice for view test_view in database bar community.postgresql.postgresql_owner: db: bar new_owner: alice obj_name: test_view obj_type: view - name: Set owner as bob for tablespace ssd in database foo community.postgresql.postgresql_owner: db: foo new_owner: bob obj_name: ssd obj_type: tablespace - name: Reassign all object in database bar owned by bob to alice community.postgresql.postgresql_owner: db: bar new_owner: alice reassign_owned_by: bob - name: Reassign all object in database bar owned by bob and bill to alice community.postgresql.postgresql_owner: db: bar new_owner: alice reassign_owned_by: - bob - bill ``` 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 | | --- | --- | --- | | **queries** string | always | List of executed queries. **Sample:** ['REASSIGN OWNED BY "bob" TO "alice"'] | ### Authors * Andrew Klychkov (@Andersson007)
programming_docs
ansible community.postgresql.postgresql_ping – Check remote PostgreSQL server availability community.postgresql.postgresql\_ping – Check remote PostgreSQL server availability =================================================================================== Note This plugin is part of the [community.postgresql collection](https://galaxy.ansible.com/community/postgresql) (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.postgresql`. To use it in a playbook, specify: `community.postgresql.postgresql_ping`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Simple module to check remote PostgreSQL server availability. Requirements ------------ The below requirements are needed on the host that executes this module. * psycopg2 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ca\_cert** string | | Specifies the name of a file containing SSL certificate authority (CA) certificate(s). If the file exists, the server's certificate will be verified to be signed by one of these authorities. aliases: ssl\_rootcert | | **db** string | | Name of a database to connect to. aliases: login\_db | | **login\_host** string | | Host running the database. If you have connection issues when using `localhost`, try to use `127.0.0.1` instead. | | **login\_password** string | | The password this module should use to establish its PostgreSQL session. | | **login\_unix\_socket** string | | Path to a Unix domain socket for local connections. | | **login\_user** string | **Default:**"postgres" | The username this module should use to establish its PostgreSQL session. | | **port** integer | **Default:**5432 | Database port to connect to. aliases: login\_port | | **session\_role** string added in 0.2.0 of community.postgresql | | Switch to session\_role after connecting. The specified session\_role must be a role that the current login\_user is a member of. Permissions checking for SQL commands is carried out as though the session\_role were the one that had logged in originally. | | **ssl\_mode** string | **Choices:*** allow * disable * **prefer** ← * require * verify-ca * verify-full | Determines whether or with what priority a secure SSL TCP/IP connection will be negotiated with the server. See <https://www.postgresql.org/docs/current/static/libpq-ssl.html> for more information on the modes. Default of `prefer` matches libpq default. | | **trust\_input** boolean added in 0.2.0 of community.postgresql | **Choices:*** no * **yes** ← | If `no`, check whether a value of *session\_role* is potentially dangerous. It makes sense to use `no` only when SQL injections via *session\_role* are possible. | Notes ----- Note * Supports `check_mode`. * The default authentication assumes that you are either logging in as or sudo’ing to the `postgres` account on the host. * To avoid “Peer authentication failed for user postgres” error, use postgres user as a *become\_user*. * This module uses psycopg2, a Python PostgreSQL database adapter. You must ensure that psycopg2 is installed on the host before using this module. * If the remote host is the PostgreSQL server (which is the default case), then PostgreSQL must also be installed on the remote host. * For Ubuntu-based systems, install the postgresql, libpq-dev, and python-psycopg2 packages on the remote host before using this module. * The ca\_cert parameter requires at least Postgres version 8.4 and *psycopg2* version 2.4.3. See Also -------- See also [community.postgresql.postgresql\_info](postgresql_info_module#ansible-collections-community-postgresql-postgresql-info-module) The official documentation on the **community.postgresql.postgresql\_info** module. Examples -------- ``` # PostgreSQL ping dbsrv server from the shell: # ansible dbsrv -m postgresql_ping # In the example below you need to generate certificates previously. # See https://www.postgresql.org/docs/current/libpq-ssl.html for more information. - name: PostgreSQL ping dbsrv server using not default credentials and ssl community.postgresql.postgresql_ping: db: protected_db login_host: dbsrv login_user: secret login_password: secret_pass ca_cert: /root/root.crt ssl_mode: verify-full ``` 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 | | --- | --- | --- | | **is\_available** boolean | always | PostgreSQL server availability. **Sample:** True | | **server\_version** dictionary | always | PostgreSQL server version. **Sample:** {'full': '13.2', 'major': 13, 'minor': 2, 'raw': 'PostgreSQL 13.2 on x86\_64-pc-linux-gnu'} | ### Authors * Andrew Klychkov (@Andersson007) ansible community.postgresql.postgresql_query – Run PostgreSQL queries community.postgresql.postgresql\_query – Run PostgreSQL queries =============================================================== Note This plugin is part of the [community.postgresql collection](https://galaxy.ansible.com/community/postgresql) (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.postgresql`. To use it in a playbook, specify: `community.postgresql.postgresql_query`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Runs arbitrary PostgreSQL queries. * Can run queries from SQL script files. * Does not run against backup files. Use [community.postgresql.postgresql\_db](postgresql_db_module#ansible-collections-community-postgresql-postgresql-db-module) with *state=restore* to run queries on files made by pg\_dump/pg\_dumpall utilities. Requirements ------------ The below requirements are needed on the host that executes this module. * psycopg2 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **as\_single\_query** boolean added in 1.1.0 of community.postgresql | **Choices:*** no * yes | If `yes`, when reading from the *path\_to\_script* file, executes its whole content in a single query. When `yes`, the `query_all_results` return value contains only the result of the last statement. Whether the state is reported as changed or not is determined by the last statement of the file. Used only when *path\_to\_script* is specified, otherwise ignored. If set to `no`, the script can contain only semicolon-separated queries. (see the *path\_to\_script* option documentation). The default value is `no`. | | **autocommit** boolean | **Choices:*** **no** ← * yes | Execute in autocommit mode when the query can't be run inside a transaction block (e.g., VACUUM). Mutually exclusive with *check\_mode*. | | **ca\_cert** string | | Specifies the name of a file containing SSL certificate authority (CA) certificate(s). If the file exists, the server's certificate will be verified to be signed by one of these authorities. aliases: ssl\_rootcert | | **db** string | | Name of database to connect to and run queries against. aliases: login\_db | | **encoding** string added in 0.2.0 of community.postgresql | | Set the client encoding for the current session (e.g. `UTF-8`). The default is the encoding defined by the database. | | **login\_host** string | | Host running the database. If you have connection issues when using `localhost`, try to use `127.0.0.1` instead. | | **login\_password** string | | The password this module should use to establish its PostgreSQL session. | | **login\_unix\_socket** string | | Path to a Unix domain socket for local connections. | | **login\_user** string | **Default:**"postgres" | The username this module should use to establish its PostgreSQL session. | | **named\_args** dictionary | | Dictionary of key-value arguments to pass to the query. When the value is a list, it will be converted to PostgreSQL array. Mutually exclusive with *positional\_args*. | | **path\_to\_script** path | | Path to a SQL script on the target machine. If the script contains several queries, they must be semicolon-separated. To run scripts containing objects with semicolons (for example, function and procedure definitions), use *as\_single\_query=yes*. To upload dumps or to execute other complex scripts, the preferable way is to use the [community.postgresql.postgresql\_db](postgresql_db_module) module with *state=restore*. Mutually exclusive with *query*. | | **port** integer | **Default:**5432 | Database port to connect to. aliases: login\_port | | **positional\_args** list / elements=raw | | List of values to be passed as positional arguments to the query. When the value is a list, it will be converted to PostgreSQL array. Mutually exclusive with *named\_args*. | | **query** string | | SQL query to run. Variables can be escaped with psycopg2 syntax <http://initd.org/psycopg/docs/usage.html>. | | **search\_path** list / elements=string added in 1.0.0 of community.postgresql | | List of schema names to look in. | | **session\_role** string | | Switch to session\_role after connecting. The specified session\_role must be a role that the current login\_user is a member of. Permissions checking for SQL commands is carried out as though the session\_role were the one that had logged in originally. | | **ssl\_mode** string | **Choices:*** allow * disable * **prefer** ← * require * verify-ca * verify-full | Determines whether or with what priority a secure SSL TCP/IP connection will be negotiated with the server. See <https://www.postgresql.org/docs/current/static/libpq-ssl.html> for more information on the modes. Default of `prefer` matches libpq default. | | **trust\_input** boolean added in 0.2.0 of community.postgresql | **Choices:*** no * **yes** ← | If `no`, check whether a value of *session\_role* is potentially dangerous. It makes sense to use `no` only when SQL injections via *session\_role* are possible. | Notes ----- Note * Supports `check_mode`. * The default authentication assumes that you are either logging in as or sudo’ing to the `postgres` account on the host. * To avoid “Peer authentication failed for user postgres” error, use postgres user as a *become\_user*. * This module uses psycopg2, a Python PostgreSQL database adapter. You must ensure that psycopg2 is installed on the host before using this module. * If the remote host is the PostgreSQL server (which is the default case), then PostgreSQL must also be installed on the remote host. * For Ubuntu-based systems, install the postgresql, libpq-dev, and python-psycopg2 packages on the remote host before using this module. * The ca\_cert parameter requires at least Postgres version 8.4 and *psycopg2* version 2.4.3. See Also -------- See also [community.postgresql.postgresql\_db](postgresql_db_module#ansible-collections-community-postgresql-postgresql-db-module) The official documentation on the **community.postgresql.postgresql\_db** module. [PostgreSQL Schema reference](https://www.postgresql.org/docs/current/ddl-schemas.html) Complete reference of the PostgreSQL schema documentation. Examples -------- ``` - name: Simple select query to acme db community.postgresql.postgresql_query: db: acme query: SELECT version() - name: Select query to db acme with positional arguments and non-default credentials community.postgresql.postgresql_query: db: acme login_user: django login_password: mysecretpass query: SELECT * FROM acme WHERE id = %s AND story = %s positional_args: - 1 - test - name: Select query to test_db with named_args community.postgresql.postgresql_query: db: test_db query: SELECT * FROM test WHERE id = %(id_val)s AND story = %(story_val)s named_args: id_val: 1 story_val: test - name: Insert query to test_table in db test_db community.postgresql.postgresql_query: db: test_db query: INSERT INTO test_table (id, story) VALUES (2, 'my_long_story') # If your script contains semicolons as parts of separate objects # like functions, procedures, and so on, use "as_single_query: yes" - name: Run queries from SQL script using UTF-8 client encoding for session community.postgresql.postgresql_query: db: test_db path_to_script: /var/lib/pgsql/test.sql positional_args: - 1 encoding: UTF-8 - name: Example of using autocommit parameter community.postgresql.postgresql_query: db: test_db query: VACUUM autocommit: yes - name: > Insert data to the column of array type using positional_args. Note that we use quotes here, the same as for passing JSON, etc. community.postgresql.postgresql_query: query: INSERT INTO test_table (array_column) VALUES (%s) positional_args: - '{1,2,3}' # Pass list and string vars as positional_args - name: Set vars ansible.builtin.set_fact: my_list: - 1 - 2 - 3 my_arr: '{1, 2, 3}' - name: Select from test table by passing positional_args as arrays community.postgresql.postgresql_query: query: SELECT * FROM test_array_table WHERE arr_col1 = %s AND arr_col2 = %s positional_args: - '{{ my_list }}' - '{{ my_arr|string }}' # Select from test table looking into app1 schema first, then, # if the schema doesn't exist or the table hasn't been found there, # try to find it in the schema public - name: Select from test using search_path community.postgresql.postgresql_query: query: SELECT * FROM test_array_table search_path: - app1 - public # If you use a variable in positional_args / named_args that can # be undefined and you wish to set it as NULL, the constructions like # "{{ my_var if (my_var is defined) else none | default(none) }}" # will not work as expected substituting an empty string instead of NULL. # If possible, we suggest to use Ansible's DEFAULT_JINJA2_NATIVE configuration # (https://docs.ansible.com/ansible/latest/reference_appendices/config.html#default-jinja2-native). # Enabling it fixes this problem. If you cannot enable it, the following workaround # can be used. # You should precheck such a value and define it as NULL when undefined. # For example: - name: When undefined, set to NULL set_fact: my_var: NULL when: my_var is undefined # Then: - name: Insert a value using positional arguments community.postgresql.postgresql_query: query: INSERT INTO test_table (col1) VALUES (%s) positional_args: - '{{ my_var }}' ``` 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 | | --- | --- | --- | | **query** string | always | Executed query. When reading several queries from a file, it contains only the last one. **Sample:** SELECT \* FROM bar | | **query\_all\_results** list / elements=list | always | List containing results of all queries executed (one sublist for every query). Useful when reading several queries from a file. **Sample:** [[{'Column': 'Value1'}, {'Column': 'Value2'}], [{'Column': 'Value1'}, {'Column': 'Value2'}]] | | **query\_list** list / elements=string | always | List of executed queries. Useful when reading several queries from a file. **Sample:** ['SELECT \* FROM foo', 'SELECT \* FROM bar'] | | **query\_result** list / elements=dictionary | always | List of dictionaries in column:value form representing returned rows. When running queries from a file, returns result of the last query. **Sample:** [{'Column': 'Value1'}, {'Column': 'Value2'}] | | **rowcount** integer | changed | Number of produced or affected rows. When using a script with multiple queries, it contains a total number of produced or affected rows. **Sample:** 5 | | **statusmessage** string | always | Attribute containing the message returned by the command. When reading several queries from a file, it contains a message of the last one. **Sample:** INSERT 0 1 | ### Authors * Felix Archambault (@archf) * Andrew Klychkov (@Andersson007) * Will Rouesnel (@wrouesnel) ansible community.postgresql.postgresql_pg_hba – Add, remove or modify a rule in a pg_hba file community.postgresql.postgresql\_pg\_hba – Add, remove or modify a rule in a pg\_hba file ========================================================================================= Note This plugin is part of the [community.postgresql collection](https://galaxy.ansible.com/community/postgresql) (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.postgresql`. To use it in a playbook, specify: `community.postgresql.postgresql_pg_hba`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * The fundamental function of the module is to create, or delete lines in pg\_hba files. * The lines in the file should be in a typical pg\_hba form and lines should be unique per key (type, databases, users, source). If they are not unique and the SID is ‘the one to change’, only one for *state=present* or none for *state=absent* of the SID’s will remain. Requirements ------------ The below requirements are needed on the host that executes this module. * ipaddress Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **address** string | **Default:**"samehost" | The source address/net where the connections could come from. Will not be used for entries of *type*=`local`. You can also use keywords `all`, `samehost`, and `samenet`. aliases: source, src | | **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 | | **backup** boolean | **Choices:*** **no** ← * yes | If set, create a backup of the `pg_hba` file before it is modified. The location of the backup is returned in the (backup) variable by this module. | | **backup\_file** string | | Write backup to a specific backupfile rather than a temp file. | | **comment** string added in 1.5.0 of community.postgresql | | A comment that will be placed in the same line behind the rule. See also the *keep\_comments\_at\_rules* parameter. | | **contype** string | **Choices:*** local * host * hostnossl * hostssl | Type of the rule. If not set, `postgresql_pg_hba` will only return contents. | | **create** boolean | **Choices:*** **no** ← * yes | Create an `pg_hba` file if none exists. When set to false, an error is raised when the `pg_hba` file doesn't exist. | | **databases** string | **Default:**"all" | Databases this line applies to. | | **dest** path / required | | Path to `pg_hba` file to modify. | | **group** string | | Name of the group that should own the file/directory, as would be fed to *chown*. | | **keep\_comments\_at\_rules** boolean added in 1.5.0 of community.postgresql | **Choices:*** **no** ← * yes | If `true`, comments that stand together with a rule in one line are kept behind that line. If `false`, such comments are moved to the beginning of the file, like all other comments. | | **method** string | **Choices:*** cert * gss * ident * krb5 * ldap * **md5** ← * pam * password * peer * radius * reject * scram-sha-256 * sspi * trust | Authentication method to be used. | | **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. | | **netmask** string | | The netmask of the source address. | | **options** string | | Additional options for the authentication *method*. | | **order** string | **Choices:*** **sdu** ← * sud * dsu * dus * usd * uds | The entries will be written out in a specific order. With this option you can control by which field they are ordered first, second and last. s=source, d=databases, u=users. This option is deprecated since 2.9 and will be removed in community.postgresql 3.0.0. Sortorder is now hardcoded to sdu. | | **owner** string | | Name of the user that should own the file/directory, as would be fed to *chown*. | | **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. | | **state** string | **Choices:*** absent * **present** ← | The lines will be added/modified when `state=present` and removed when `state=absent`. | | **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. | | **users** string | **Default:**"all" | Users this line applies to. | Notes ----- Note * The default authentication assumes that on the host, you are either logging in as or sudo’ing to an account with appropriate permissions to read and modify the file. * This module also returns the pg\_hba info. You can use this module to only retrieve it by only specifying *dest*. The info can be found in the returned data under key pg\_hba, being a list, containing a dict per rule. * This module will sort resulting `pg_hba` files if a rule change is required. This could give unexpected results with manual created hba files, if it was improperly sorted. For example a rule was created for a net first and for a ip in that net range next. In that situation, the ‘ip specific rule’ will never hit, it is in the `pg_hba` file obsolete. After the `pg_hba` file is rewritten by the [community.postgresql.postgresql\_pg\_hba](#ansible-collections-community-postgresql-postgresql-pg-hba-module) module, the ip specific rule will be sorted above the range rule. And then it will hit, which will give unexpected results. * With the ‘order’ parameter you can control which field is used to sort first, next and last. * The module supports a check mode and a diff mode. See Also -------- See also [PostgreSQL pg\_hba.conf file reference](https://www.postgresql.org/docs/current/auth-pg-hba-conf.html) Complete reference of the PostgreSQL pg\_hba.conf file documentation. Examples -------- ``` - name: Grant users joe and simon access to databases sales and logistics from ipv6 localhost ::1/128 using peer authentication community.postgresql.postgresql_pg_hba: dest: /var/lib/postgres/data/pg_hba.conf contype: host users: joe,simon source: ::1 databases: sales,logistics method: peer create: true - name: Grant user replication from network 192.168.0.100/24 access for replication with client cert authentication community.postgresql.postgresql_pg_hba: dest: /var/lib/postgres/data/pg_hba.conf contype: host users: replication source: 192.168.0.100/24 databases: replication method: cert - name: Revoke access from local user mary on database mydb community.postgresql.postgresql_pg_hba: dest: /var/lib/postgres/data/pg_hba.conf contype: local users: mary databases: mydb state: absent - name: Grant some_user access to some_db, comment that and keep other rule-specific comments attached to their rules community.postgresql.postgresql_pg_hba: dest: /var/lib/postgres/data/pg_hba.conf contype: host users: some_user databases: some_db method: md5 source: ::/0 keep_comments_at_rules: true comment: "this rule is an 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 | | --- | --- | --- | | **backup\_file** string | changed | File that the original pg\_hba file was backed up to. **Sample:** /tmp/pg\_hba\_jxobj\_p | | **msgs** list / elements=string | always | List of textual messages what was done. **Sample:** {'msgs': ['Removing', 'Changed', 'Writing']} | | **pg\_hba** list / elements=string | always | List of the pg\_hba rules as they are configured in the specified hba file. **Sample:** {'pg\_hba': [{'db': 'all', 'method': 'md5', 'src': 'samehost', 'type': 'host', 'usr': 'all'}]} | ### Authors * Sebastiaan Mannem (@sebasmannem) * Felix Hamme (@betanummeric)
programming_docs
ansible community.postgresql.postgresql_user – Create, alter, or remove a user (role) from a PostgreSQL server instance community.postgresql.postgresql\_user – Create, alter, or remove a user (role) from a PostgreSQL server instance ================================================================================================================ Note This plugin is part of the [community.postgresql collection](https://galaxy.ansible.com/community/postgresql) (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.postgresql`. To use it in a playbook, specify: `community.postgresql.postgresql_user`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Creates, alters, or removes a user (role) from a PostgreSQL server instance (“cluster” in PostgreSQL terminology) and, optionally, grants the user access to an existing database or tables. * A user is a role with login privilege. * You can also use it to grant or revoke user’s privileges in a particular database. * You cannot remove a user while it still has any privileges granted to it in any database. * Set *fail\_on\_user* to `no` to make the module ignore failures when trying to remove a user. In this case, the module reports if changes happened as usual and separately reports whether the user has been removed or not. Requirements ------------ The below requirements are needed on the host that executes this module. * psycopg2 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ca\_cert** string | | Specifies the name of a file containing SSL certificate authority (CA) certificate(s). If the file exists, verifies that the server's certificate is signed by one of these authorities. aliases: ssl\_rootcert | | **comment** string added in 0.2.0 of community.postgresql | | Adds a comment on the user (equivalent to the `COMMENT ON ROLE` statement). | | **conn\_limit** integer | | Specifies the user (role) connection limit. | | **db** string | | Name of database to connect to and where user's permissions are granted. aliases: login\_db | | **encrypted** boolean | **Choices:*** no * **yes** ← | Whether the password is stored hashed in the database. You can specify an unhashed password, and PostgreSQL ensures the stored password is hashed when *encrypted=yes* is set. If you specify a hashed password, the module uses it as-is, regardless of the setting of *encrypted*. Note: Postgresql 10 and newer does not support unhashed passwords. Previous to Ansible 2.6, this was `no` by default. | | **expires** string | | The date at which the user's password is to expire. If set to `'infinity'`, user's password never expires. Note that this value must be a valid SQL date and time type. | | **fail\_on\_user** boolean | **Choices:*** no * **yes** ← | If `yes`, fails when the user (role) cannot be removed. Otherwise just log and continue. aliases: fail\_on\_role | | **groups** list / elements=string | | The list of groups (roles) that you want to grant to the user. | | **login\_host** string | | Host running the database. If you have connection issues when using `localhost`, try to use `127.0.0.1` instead. | | **login\_password** string | | The password this module should use to establish its PostgreSQL session. | | **login\_unix\_socket** string | | Path to a Unix domain socket for local connections. | | **login\_user** string | **Default:**"postgres" | The username this module should use to establish its PostgreSQL session. | | **name** string / required | | Name of the user (role) to add or remove. aliases: user | | **no\_password\_changes** boolean | **Choices:*** **no** ← * yes | If `yes`, does not inspect the database for password changes. If the user already exists, skips all password related checks. Useful when `pg_authid` is not accessible (such as in AWS RDS). Otherwise, makes password changes as necessary. | | **password** string | | Set the user's password, before 1.4 this was required. Password can be passed unhashed or hashed (MD5-hashed). An unhashed password is automatically hashed when saved into the database if *encrypted* is set, otherwise it is saved in plain text format. When passing an MD5-hashed password, you must generate it with the format `'str["md5"] + md5[ password + username ]'`, resulting in a total of 35 characters. An easy way to do this is `echo "md5`echo -n 'verysecretpasswordJOE' | md5sum | awk '{print $1}'`"`. Note that if the provided password string is already in MD5-hashed format, then it is used as-is, regardless of *encrypted* option. | | **port** integer | **Default:**5432 | Database port to connect to. aliases: login\_port | | **priv** string | | Slash-separated PostgreSQL privileges string: `priv1/priv2`, where you can define the user's privileges for the database ( allowed options - 'CREATE', 'CONNECT', 'TEMPORARY', 'TEMP', 'ALL'. For example `CONNECT` ) or for table ( allowed options - 'SELECT', 'INSERT', 'UPDATE', 'DELETE', 'TRUNCATE', 'REFERENCES', 'TRIGGER', 'ALL'. For example `table:SELECT` ). Mixed example of this string: `CONNECT/CREATE/table1:SELECT/table2:INSERT`. When *priv* contains tables, the module uses the schema `public` by default. If you need to specify a different schema, use the `schema_name.table_name` notation, for example, `pg_catalog.pg_stat_database:SELECT`. | | **role\_attr\_flags** string | **Choices:*** [NO]SUPERUSER * [NO]CREATEROLE * [NO]CREATEDB * [NO]INHERIT * [NO]LOGIN * [NO]REPLICATION * [NO]BYPASSRLS | PostgreSQL user attributes string in the format: CREATEDB,CREATEROLE,SUPERUSER. Note that '[NO]CREATEUSER' is deprecated. To create a simple role for using it like a group, use `NOLOGIN` flag. | | **session\_role** string | | Switch to session role after connecting. The specified session role must be a role that the current login\_user is a member of. Permissions checking for SQL commands is carried out as though the session role were the one that had logged in originally. | | **ssl\_mode** string | **Choices:*** allow * disable * **prefer** ← * require * verify-ca * verify-full | Determines how an SSL session is negotiated with the server. See <https://www.postgresql.org/docs/current/static/libpq-ssl.html> for more information on the modes. Default of `prefer` matches libpq default. | | **state** string | **Choices:*** absent * **present** ← | The user (role) state. | | **trust\_input** boolean added in 0.2.0 of community.postgresql | **Choices:*** no * **yes** ← | If `no`, checks whether values of options *name*, *password*, *privs*, *expires*, *role\_attr\_flags*, *groups*, *comment*, *session\_role* are potentially dangerous. It makes sense to use `no` only when SQL injections through the options are possible. | Notes ----- Note * The module creates a user (role) with login privilege by default. Use `NOLOGIN` *role\_attr\_flags* to change this behaviour. * If you specify `PUBLIC` as the user (role), then the privilege changes apply to all users (roles). You may not specify password or role\_attr\_flags when the `PUBLIC` user is specified. * SCRAM-SHA-256-hashed passwords (SASL Authentication) require PostgreSQL version 10 or newer. On the previous versions the whole hashed string is used as a password. * Working with SCRAM-SHA-256-hashed passwords, be sure you use the *environment:* variable `PGOPTIONS: "-c password_encryption=scram-sha-256"` (see the provided example). * On some systems (such as AWS RDS), `pg_authid` is not accessible, thus, the module cannot compare the current and desired `password`. In this case, the module assumes that the passwords are different and changes it reporting that the state has been changed. To skip all password related checks for existing users, use *no\_password\_changes=yes*. * Supports `check_mode`. * The default authentication assumes that you are either logging in as or sudo’ing to the `postgres` account on the host. * To avoid “Peer authentication failed for user postgres” error, use postgres user as a *become\_user*. * This module uses psycopg2, a Python PostgreSQL database adapter. You must ensure that psycopg2 is installed on the host before using this module. * If the remote host is the PostgreSQL server (which is the default case), then PostgreSQL must also be installed on the remote host. * For Ubuntu-based systems, install the postgresql, libpq-dev, and python-psycopg2 packages on the remote host before using this module. * The ca\_cert parameter requires at least Postgres version 8.4 and *psycopg2* version 2.4.3. See Also -------- See also [community.postgresql.postgresql\_privs](postgresql_privs_module#ansible-collections-community-postgresql-postgresql-privs-module) The official documentation on the **community.postgresql.postgresql\_privs** module. [community.postgresql.postgresql\_membership](postgresql_membership_module#ansible-collections-community-postgresql-postgresql-membership-module) The official documentation on the **community.postgresql.postgresql\_membership** module. [community.postgresql.postgresql\_owner](postgresql_owner_module#ansible-collections-community-postgresql-postgresql-owner-module) The official documentation on the **community.postgresql.postgresql\_owner** module. [PostgreSQL database roles](https://www.postgresql.org/docs/current/user-manag.html) Complete reference of the PostgreSQL database roles documentation. [PostgreSQL SASL Authentication](https://www.postgresql.org/docs/current/sasl-authentication.html) Complete reference of the PostgreSQL SASL Authentication. Examples -------- ``` - name: Connect to acme database, create django user, and grant access to database and products table community.postgresql.postgresql_user: db: acme name: django password: ceec4eif7ya priv: "CONNECT/products:ALL" expires: "Jan 31 2020" - name: Add a comment on django user community.postgresql.postgresql_user: db: acme name: django comment: This is a test user # Connect to default database, create rails user, set its password (MD5-hashed), # and grant privilege to create other databases and demote rails from super user status if user exists - name: Create rails user, set MD5-hashed password, grant privs community.postgresql.postgresql_user: name: rails password: md59543f1d82624df2b31672ec0f7050460 role_attr_flags: CREATEDB,NOSUPERUSER - name: Connect to acme database and remove test user privileges from there community.postgresql.postgresql_user: db: acme name: test priv: "ALL/products:ALL" state: absent fail_on_user: no - name: Connect to test database, remove test user from cluster community.postgresql.postgresql_user: db: test name: test priv: ALL state: absent - name: Connect to acme database and set user's password with no expire date community.postgresql.postgresql_user: db: acme name: django password: mysupersecretword priv: "CONNECT/products:ALL" expires: infinity # Example privileges string format # INSERT,UPDATE/table:SELECT/anothertable:ALL - name: Connect to test database and remove an existing user's password community.postgresql.postgresql_user: db: test user: test password: "" - name: Create user test and grant group user_ro and user_rw to it community.postgresql.postgresql_user: name: test groups: - user_ro - user_rw # Create user with a cleartext password if it does not exist or update its password. # The password will be encrypted with SCRAM algorithm (available since PostgreSQL 10) - name: Create appclient user with SCRAM-hashed password community.postgresql.postgresql_user: name: appclient password: "secret123" environment: PGOPTIONS: "-c password_encryption=scram-sha-256" - name: Create a user, grant SELECT on pg_catalog.pg_stat_database community.postgresql.postgresql_user: name: monitoring priv: 'pg_catalog.pg_stat_database:SELECT' ``` 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 | | --- | --- | --- | | **queries** list / elements=string | always | List of executed queries. **Sample:** ['CREATE USER "alice"', 'GRANT CONNECT ON DATABASE "acme" TO "alice"'] | ### Authors * Ansible Core Team ansible community.postgresql.postgresql_set – Change a PostgreSQL server configuration parameter community.postgresql.postgresql\_set – Change a PostgreSQL server configuration parameter ========================================================================================= Note This plugin is part of the [community.postgresql collection](https://galaxy.ansible.com/community/postgresql) (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.postgresql`. To use it in a playbook, specify: `community.postgresql.postgresql_set`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Allows to change a PostgreSQL server configuration parameter. * The module uses ALTER SYSTEM command and applies changes by reload server configuration. * ALTER SYSTEM is used for changing server configuration parameters across the entire database cluster. * It can be more convenient and safe than the traditional method of manually editing the postgresql.conf file. * ALTER SYSTEM writes the given parameter setting to the $PGDATA/postgresql.auto.conf file, which is read in addition to postgresql.conf. * The module allows to reset parameter to boot\_val (cluster initial value) by *reset=yes* or remove parameter string from postgresql.auto.conf and reload *value=default* (for settings with postmaster context restart is required). * After change you can see in the ansible output the previous and the new parameter value and other information using returned values and [ansible.builtin.debug](../../ansible/builtin/debug_module#ansible-collections-ansible-builtin-debug-module) module. Requirements ------------ The below requirements are needed on the host that executes this module. * psycopg2 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ca\_cert** string | | Specifies the name of a file containing SSL certificate authority (CA) certificate(s). If the file exists, the server's certificate will be verified to be signed by one of these authorities. aliases: ssl\_rootcert | | **db** string | | Name of database to connect. aliases: login\_db | | **login\_host** string | | Host running the database. If you have connection issues when using `localhost`, try to use `127.0.0.1` instead. | | **login\_password** string | | The password this module should use to establish its PostgreSQL session. | | **login\_unix\_socket** string | | Path to a Unix domain socket for local connections. | | **login\_user** string | **Default:**"postgres" | The username this module should use to establish its PostgreSQL session. | | **name** string / required | | Name of PostgreSQL server parameter. Pay attention that parameters are case sensitive (see examples below). | | **port** integer | **Default:**5432 | Database port to connect to. aliases: login\_port | | **reset** boolean | **Choices:*** **no** ← * yes | Restore parameter to initial state (boot\_val). Mutually exclusive with *value*. | | **session\_role** string | | Switch to session\_role after connecting. The specified session\_role must be a role that the current login\_user is a member of. Permissions checking for SQL commands is carried out as though the session\_role were the one that had logged in originally. | | **ssl\_mode** string | **Choices:*** allow * disable * **prefer** ← * require * verify-ca * verify-full | Determines whether or with what priority a secure SSL TCP/IP connection will be negotiated with the server. See <https://www.postgresql.org/docs/current/static/libpq-ssl.html> for more information on the modes. Default of `prefer` matches libpq default. | | **trust\_input** boolean added in 0.2.0 of community.postgresql | **Choices:*** no * **yes** ← | If `no`, check whether values of parameters are potentially dangerous. It makes sense to use `no` only when SQL injections are possible. | | **value** string | | Parameter value to set. To remove parameter string from postgresql.auto.conf and reload the server configuration you must pass *value=default*. With *value=default* the playbook always returns changed is true. | Notes ----- Note * Supported version of PostgreSQL is 9.4 and later. * Supports `check_mode`. * Pay attention, change setting with ‘postmaster’ context can return changed is true when actually nothing changes because the same value may be presented in several different form, for example, 1024MB, 1GB, etc. However in pg\_settings system view it can be defined like 131072 number of 8kB pages. The final check of the parameter value cannot compare it because the server was not restarted and the value in pg\_settings is not updated yet. * For some parameters restart of PostgreSQL server is required. See official documentation <https://www.postgresql.org/docs/current/view-pg-settings.html>. * The default authentication assumes that you are either logging in as or sudo’ing to the `postgres` account on the host. * To avoid “Peer authentication failed for user postgres” error, use postgres user as a *become\_user*. * This module uses psycopg2, a Python PostgreSQL database adapter. You must ensure that psycopg2 is installed on the host before using this module. * If the remote host is the PostgreSQL server (which is the default case), then PostgreSQL must also be installed on the remote host. * For Ubuntu-based systems, install the postgresql, libpq-dev, and python-psycopg2 packages on the remote host before using this module. * The ca\_cert parameter requires at least Postgres version 8.4 and *psycopg2* version 2.4.3. See Also -------- See also [community.postgresql.postgresql\_info](postgresql_info_module#ansible-collections-community-postgresql-postgresql-info-module) The official documentation on the **community.postgresql.postgresql\_info** module. [PostgreSQL server configuration](https://www.postgresql.org/docs/current/runtime-config.html) General information about PostgreSQL server configuration. [PostgreSQL view pg\_settings reference](https://www.postgresql.org/docs/current/view-pg-settings.html) Complete reference of the pg\_settings view documentation. [PostgreSQL ALTER SYSTEM command reference](https://www.postgresql.org/docs/current/sql-altersystem.html) Complete reference of the ALTER SYSTEM command documentation. Examples -------- ``` - name: Restore wal_keep_segments parameter to initial state community.postgresql.postgresql_set: name: wal_keep_segments reset: yes # Set work_mem parameter to 32MB and show what's been changed and restart is required or not # (output example: "msg": "work_mem 4MB >> 64MB restart_req: False") - name: Set work mem parameter community.postgresql.postgresql_set: name: work_mem value: 32mb register: set - name: Print the result if the setting changed ansible.builtin.debug: msg: "{{ set.name }} {{ set.prev_val_pretty }} >> {{ set.value_pretty }} restart_req: {{ set.restart_required }}" when: set.changed # Ensure that the restart of PostgreSQL server must be required for some parameters. # In this situation you see the same parameter in prev_val_pretty and value_pretty, but 'changed=True' # (If you passed the value that was different from the current server setting). - name: Set log_min_duration_statement parameter to 1 second community.postgresql.postgresql_set: name: log_min_duration_statement value: 1s - name: Set wal_log_hints parameter to default value (remove parameter from postgresql.auto.conf) community.postgresql.postgresql_set: name: wal_log_hints value: default - name: Set TimeZone parameter (careful, case sensitive) community.postgresql.postgresql_set: name: TimeZone value: 'Europe/Paris' ``` 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 | | --- | --- | --- | | **context** string | always | PostgreSQL setting context. **Sample:** user | | **name** string | always | Name of PostgreSQL server parameter. **Sample:** shared\_buffers | | **prev\_val\_pretty** string | always | Information about previous state of the parameter. **Sample:** 4MB | | **restart\_required** boolean | always | Information about parameter current state. **Sample:** True | | **value** dictionary | always | Dictionary that contains the current parameter value (at the time of playbook finish). Pay attention that for real change some parameters restart of PostgreSQL server is required. Returns the current value in the check mode. **Sample:** {'unit': 'b', 'value': 67108864} | | **value\_pretty** string | always | Information about current state of the parameter. **Sample:** 64MB | ### Authors * Andrew Klychkov (@Andersson007)
programming_docs
ansible community.postgresql.postgresql_tablespace – Add or remove PostgreSQL tablespaces from remote hosts community.postgresql.postgresql\_tablespace – Add or remove PostgreSQL tablespaces from remote hosts ==================================================================================================== Note This plugin is part of the [community.postgresql collection](https://galaxy.ansible.com/community/postgresql) (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.postgresql`. To use it in a playbook, specify: `community.postgresql.postgresql_tablespace`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Adds or removes PostgreSQL tablespaces from remote hosts. Requirements ------------ The below requirements are needed on the host that executes this module. * psycopg2 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ca\_cert** string | | Specifies the name of a file containing SSL certificate authority (CA) certificate(s). If the file exists, the server's certificate will be verified to be signed by one of these authorities. aliases: ssl\_rootcert | | **db** string | | Name of database to connect to and run queries against. aliases: login\_db | | **location** path | | Path to the tablespace directory in the file system. Ensure that the location exists and has right privileges. aliases: path | | **login\_host** string | | Host running the database. If you have connection issues when using `localhost`, try to use `127.0.0.1` instead. | | **login\_password** string | | The password this module should use to establish its PostgreSQL session. | | **login\_unix\_socket** string | | Path to a Unix domain socket for local connections. | | **login\_user** string | **Default:**"postgres" | The username this module should use to establish its PostgreSQL session. | | **owner** string | | Name of the role to set as an owner of the tablespace. If this option is not specified, the tablespace owner is a role that creates the tablespace. | | **port** integer | **Default:**5432 | Database port to connect to. aliases: login\_port | | **rename\_to** string | | New name of the tablespace. The new name cannot begin with pg\_, as such names are reserved for system tablespaces. | | **session\_role** string | | Switch to session\_role after connecting. The specified session\_role must be a role that the current login\_user is a member of. Permissions checking for SQL commands is carried out as though the session\_role were the one that had logged in originally. | | **set** dictionary | | Dict of tablespace options to set. Supported from PostgreSQL 9.0. For more information see <https://www.postgresql.org/docs/current/sql-createtablespace.html>. When reset is passed as an option's value, if the option was set previously, it will be removed. | | **ssl\_mode** string | **Choices:*** allow * disable * **prefer** ← * require * verify-ca * verify-full | Determines whether or with what priority a secure SSL TCP/IP connection will be negotiated with the server. See <https://www.postgresql.org/docs/current/static/libpq-ssl.html> for more information on the modes. Default of `prefer` matches libpq default. | | **state** string | **Choices:*** absent * **present** ← | Tablespace state. *state=present* implies the tablespace must be created if it doesn't exist. *state=absent* implies the tablespace must be removed if present. *state=absent* is mutually exclusive with *location*, *owner*, i(set). See the Notes section for information about check mode restrictions. | | **tablespace** string / required | | Name of the tablespace to add or remove. aliases: name | | **trust\_input** boolean added in 0.2.0 of community.postgresql | **Choices:*** no * **yes** ← | If `no`, check whether values of parameters *tablespace*, *location*, *owner*, *rename\_to*, *session\_role*, *settings\_list* are potentially dangerous. It makes sense to use `no` only when SQL injections via the parameters are possible. | Notes ----- Note * *state=absent* and *state=present* (the second one if the tablespace doesn’t exist) do not support check mode because the corresponding PostgreSQL DROP and CREATE TABLESPACE commands can not be run inside the transaction block. * The default authentication assumes that you are either logging in as or sudo’ing to the `postgres` account on the host. * To avoid “Peer authentication failed for user postgres” error, use postgres user as a *become\_user*. * This module uses psycopg2, a Python PostgreSQL database adapter. You must ensure that psycopg2 is installed on the host before using this module. * If the remote host is the PostgreSQL server (which is the default case), then PostgreSQL must also be installed on the remote host. * For Ubuntu-based systems, install the postgresql, libpq-dev, and python-psycopg2 packages on the remote host before using this module. * The ca\_cert parameter requires at least Postgres version 8.4 and *psycopg2* version 2.4.3. See Also -------- See also [PostgreSQL tablespaces](https://www.postgresql.org/docs/current/manage-ag-tablespaces.html) General information about PostgreSQL tablespaces. [CREATE TABLESPACE reference](https://www.postgresql.org/docs/current/sql-createtablespace.html) Complete reference of the CREATE TABLESPACE command documentation. [ALTER TABLESPACE reference](https://www.postgresql.org/docs/current/sql-altertablespace.html) Complete reference of the ALTER TABLESPACE command documentation. [DROP TABLESPACE reference](https://www.postgresql.org/docs/current/sql-droptablespace.html) Complete reference of the DROP TABLESPACE command documentation. Examples -------- ``` - name: Create a new tablespace called acme and set bob as an its owner community.postgresql.postgresql_tablespace: name: acme owner: bob location: /data/foo - name: Create a new tablespace called bar with tablespace options community.postgresql.postgresql_tablespace: name: bar set: random_page_cost: 1 seq_page_cost: 1 - name: Reset random_page_cost option community.postgresql.postgresql_tablespace: name: bar set: random_page_cost: reset - name: Rename the tablespace from bar to pcie_ssd community.postgresql.postgresql_tablespace: name: bar rename_to: pcie_ssd - name: Drop tablespace called bloat community.postgresql.postgresql_tablespace: name: bloat 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 | | --- | --- | --- | | **location** string | always | Path to the tablespace in the file system. **Sample:** /incredible/fast/ssd | | **newname** string | if existent | New tablespace name. **Sample:** new\_ssd | | **options** dictionary | always | Tablespace options. **Sample:** {'random\_page\_cost': 1, 'seq\_page\_cost': 1} | | **owner** string | always | Tablespace owner. **Sample:** Bob | | **queries** string | always | List of queries that was tried to be executed. **Sample:** ["CREATE TABLESPACE bar LOCATION '/incredible/ssd'"] | | **state** string | always | Tablespace state at the end of execution. **Sample:** present | | **tablespace** string | always | Tablespace name. **Sample:** ssd | ### Authors * Flavien Chantelot (@Dorn-) * Antoine Levy-Lambert (@antoinell) * Andrew Klychkov (@Andersson007) ansible community.postgresql.postgresql_info – Gather information about PostgreSQL servers community.postgresql.postgresql\_info – Gather information about PostgreSQL servers =================================================================================== Note This plugin is part of the [community.postgresql collection](https://galaxy.ansible.com/community/postgresql) (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.postgresql`. To use it in a playbook, specify: `community.postgresql.postgresql_info`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Gathers information about PostgreSQL servers. Requirements ------------ The below requirements are needed on the host that executes this module. * psycopg2 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ca\_cert** string | | Specifies the name of a file containing SSL certificate authority (CA) certificate(s). If the file exists, the server's certificate will be verified to be signed by one of these authorities. aliases: ssl\_rootcert | | **db** string | | Name of database to connect. aliases: login\_db | | **filter** list / elements=string | | Limit the collected information by comma separated string or YAML list. Allowable values are `version`, `databases`, `in_recovery`, `settings`, `tablespaces`, `roles`, `replications`, `repl_slots`. By default, collects all subsets. You can use shell-style (fnmatch) wildcard to pass groups of values (see Examples). You can use '!' before value (for example, `!settings`) to exclude it from the information. If you pass including and excluding values to the filter, for example, *filter=!settings,ver*, the excluding values will be ignored. | | **login\_host** string | | Host running the database. If you have connection issues when using `localhost`, try to use `127.0.0.1` instead. | | **login\_password** string | | The password this module should use to establish its PostgreSQL session. | | **login\_unix\_socket** string | | Path to a Unix domain socket for local connections. | | **login\_user** string | **Default:**"postgres" | The username this module should use to establish its PostgreSQL session. | | **port** integer | **Default:**5432 | Database port to connect to. aliases: login\_port | | **session\_role** string | | Switch to session\_role after connecting. The specified session\_role must be a role that the current login\_user is a member of. Permissions checking for SQL commands is carried out as though the session\_role were the one that had logged in originally. | | **ssl\_mode** string | **Choices:*** allow * disable * **prefer** ← * require * verify-ca * verify-full | Determines whether or with what priority a secure SSL TCP/IP connection will be negotiated with the server. See <https://www.postgresql.org/docs/current/static/libpq-ssl.html> for more information on the modes. Default of `prefer` matches libpq default. | | **trust\_input** boolean added in 0.2.0 of community.postgresql | **Choices:*** no * **yes** ← | If `no`, check whether a value of *session\_role* is potentially dangerous. It makes sense to use `no` only when SQL injections via *session\_role* are possible. | Notes ----- Note * Supports `check_mode`. * The default authentication assumes that you are either logging in as or sudo’ing to the `postgres` account on the host. * To avoid “Peer authentication failed for user postgres” error, use postgres user as a *become\_user*. * This module uses psycopg2, a Python PostgreSQL database adapter. You must ensure that psycopg2 is installed on the host before using this module. * If the remote host is the PostgreSQL server (which is the default case), then PostgreSQL must also be installed on the remote host. * For Ubuntu-based systems, install the postgresql, libpq-dev, and python-psycopg2 packages on the remote host before using this module. * The ca\_cert parameter requires at least Postgres version 8.4 and *psycopg2* version 2.4.3. See Also -------- See also [community.postgresql.postgresql\_ping](postgresql_ping_module#ansible-collections-community-postgresql-postgresql-ping-module) The official documentation on the **community.postgresql.postgresql\_ping** module. Examples -------- ``` # Display info from postgres hosts. # ansible postgres -m postgresql_info # Display only databases and roles info from all hosts using shell-style wildcards: # ansible all -m postgresql_info -a 'filter=dat*,rol*' # Display only replications and repl_slots info from standby hosts using shell-style wildcards: # ansible standby -m postgresql_info -a 'filter=repl*' # Display all info from databases hosts except settings: # ansible databases -m postgresql_info -a 'filter=!settings' - name: Collect PostgreSQL version and extensions become: yes become_user: postgres community.postgresql.postgresql_info: filter: ver*,ext* - name: Collect all info except settings and roles become: yes become_user: postgres community.postgresql.postgresql_info: filter: "!settings,!roles" # On FreeBSD with PostgreSQL 9.5 version and lower use pgsql user to become # and pass "postgres" as a database to connect to - name: Collect tablespaces and repl_slots info become: yes become_user: pgsql community.postgresql.postgresql_info: db: postgres filter: - tablesp* - repl_sl* - name: Collect all info except databases become: yes become_user: postgres community.postgresql.postgresql_info: filter: - "!databases" ``` 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 | | --- | --- | --- | | **databases** dictionary | always | Information about databases. **Sample:** [{'postgres': {'access\_priv': '', 'collate': 'en\_US.UTF-8', 'ctype': 'en\_US.UTF-8', 'encoding': 'UTF8', 'owner': 'postgres', 'size': '7997 kB'}}] | | | **database\_name** dictionary | always | Database name. **Sample:** template1 | | | | **access\_priv** string | always | Database access privileges. **Sample:** =c/postgres\_npostgres=CTc/postgres | | | | **collate** string | always | Database collation <https://www.postgresql.org/docs/current/collation.html>. **Sample:** en\_US.UTF-8 | | | | **ctype** string | always | Database LC\_CTYPE <https://www.postgresql.org/docs/current/multibyte.html>. **Sample:** en\_US.UTF-8 | | | | **encoding** string | always | Database encoding <https://www.postgresql.org/docs/current/multibyte.html>. **Sample:** UTF8 | | | | **extensions** dictionary | always | Extensions <https://www.postgresql.org/docs/current/sql-createextension.html>. **Sample:** [{'plpgsql': {'description': 'PL/pgSQL procedural language', 'extversion': {'major': 1, 'minor': 0, 'raw': '1.0'}}}] | | | | | **extdescription** string | if existent | Extension description. **Sample:** PL/pgSQL procedural language | | | | | **extversion** dictionary | always | Extension description. | | | | | | **major** integer | always | Extension major version. **Sample:** 1 | | | | | | **minor** integer | always | Extension minor version. | | | | | | **raw** string | always | Extension full version. **Sample:** 1.0 | | | | | **nspname** string | always | Namespace where the extension is. **Sample:** pg\_catalog | | | | **languages** dictionary | always | Procedural languages <https://www.postgresql.org/docs/current/xplang.html>. **Sample:** {'sql': {'lanacl': '', 'lanowner': 'postgres'}} | | | | | **lanacl** string | always | Language access privileges <https://www.postgresql.org/docs/current/catalog-pg-language.html>. **Sample:** {postgres=UC/postgres,=U/postgres} | | | | | **lanowner** string | always | Language owner <https://www.postgresql.org/docs/current/catalog-pg-language.html>. **Sample:** postgres | | | | **namespaces** dictionary | always | Namespaces (schema) <https://www.postgresql.org/docs/current/sql-createschema.html>. **Sample:** {'pg\_catalog': {'nspacl': '{postgres=UC/postgres,=U/postgres}', 'nspowner': 'postgres'}} | | | | | **nspacl** string | always | Access privileges <https://www.postgresql.org/docs/current/catalog-pg-namespace.html>. **Sample:** {postgres=UC/postgres,=U/postgres} | | | | | **nspowner** string | always | Schema owner <https://www.postgresql.org/docs/current/catalog-pg-namespace.html>. **Sample:** postgres | | | | **owner** string | always | Database owner <https://www.postgresql.org/docs/current/sql-createdatabase.html>. **Sample:** postgres | | | | **publications** dictionary added in 0.2.0 of community.postgresql | if configured | Information about logical replication publications (available for PostgreSQL 10 and higher) <https://www.postgresql.org/docs/current/logical-replication-publication.html>. Content depends on PostgreSQL server version. **Sample:** {'pub1': {'ownername': 'postgres', 'puballtables': True, 'pubinsert': True, 'pubupdate': True}} | | | | **size** string | always | Database size in bytes. **Sample:** 8189415 | | | | **subscriptions** dictionary added in 0.2.0 of community.postgresql | if configured | Information about replication subscriptions (available for PostgreSQL 10 and higher) <https://www.postgresql.org/docs/current/logical-replication-subscription.html>. Content depends on PostgreSQL server version. **Sample:** [{'my\_subscription': {'ownername': 'postgres', 'subenabled': True, 'subpublications': ['first\_publication']}}] | | **in\_recovery** boolean | always | Indicates if the service is in recovery mode or not. | | **pending\_restart\_settings** list / elements=string | always | List of settings that are pending restart to be set. **Sample:** ['shared\_buffers'] | | **repl\_slots** dictionary | if existent | Replication slots (available in 9.4 and later) <https://www.postgresql.org/docs/current/view-pg-replication-slots.html>. **Sample:** {'slot0': {'active': False, 'database': None, 'plugin': None, 'slot\_type': 'physical'}} | | | **active** boolean | always | True means that a receiver has connected to it, and it is currently reserving archives. **Sample:** True | | | **database** string | always | Database name this slot is associated with, or null. **Sample:** acme | | | **plugin** string | always | Base name of the shared object containing the output plugin this logical slot is using, or null for physical slots. **Sample:** pgoutput | | | **slot\_type** string | always | The slot type - physical or logical. **Sample:** logical | | **replications** dictionary | if pg\_stat\_replication view existent | Information about the current replications by process PIDs <https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-STATS-VIEWS-TABLE>. **Sample:** [{'76580': {'app\_name': 'standby1', 'backend\_start': '2019-02-03 00:14:33.908593+03', 'client\_addr': '10.10.10.2', 'client\_hostname': '', 'state': 'streaming', 'usename': 'postgres'}}] | | | **app\_name** string | if existent | Name of the application that is connected to this WAL sender. **Sample:** acme\_srv | | | **backend\_start** string | always | Time when this process was started, i.e., when the client connected to this WAL sender. **Sample:** 2019-02-03 00:14:33.908593+03 | | | **client\_addr** string | always | IP address of the client connected to this WAL sender. If this field is null, it indicates that the client is connected via a Unix socket on the server machine. **Sample:** 10.0.0.101 | | | **client\_hostname** string | always | Host name of the connected client, as reported by a reverse DNS lookup of client\_addr. This field will only be non-null for IP connections, and only when log\_hostname is enabled. **Sample:** dbsrv1 | | | **state** string | always | Current WAL sender state. **Sample:** streaming | | | **usename** string | always | Name of the user logged into this WAL sender process ('usename' is a column name in pg\_stat\_replication view). **Sample:** replication\_user | | **roles** dictionary | always | Information about roles <https://www.postgresql.org/docs/current/user-manag.html>. **Sample:** [{'test\_role': {'canlogin': True, 'member\_of': ['user\_ro'], 'superuser': False, 'valid\_until': '9999-12-31T23:59:59.999999+00:00'}}] | | | **canlogin** boolean | always | Login privilege <https://www.postgresql.org/docs/current/role-attributes.html>. **Sample:** True | | | **member\_of** list / elements=string | always | Role membership <https://www.postgresql.org/docs/current/role-membership.html>. **Sample:** ['read\_only\_users'] | | | **superuser** boolean | always | User is a superuser or not. | | | **valid\_until** string | always | Password expiration date <https://www.postgresql.org/docs/current/sql-alterrole.html>. **Sample:** 9999-12-31T23:59:59.999999+00:00 | | **settings** dictionary | always | Information about run-time server parameters <https://www.postgresql.org/docs/current/view-pg-settings.html>. **Sample:** [{'work\_mem': {'boot\_val': '4096', 'context': 'user', 'max\_val': '2147483647', 'min\_val': '64', 'setting': '8192', 'sourcefile': '/var/lib/pgsql/10/data/postgresql.auto.conf', 'unit': 'kB', 'val\_in\_bytes': 4194304, 'vartype': 'integer'}}] | | | **boot\_val** string | always | Parameter value assumed at server startup if the parameter is not otherwise set. **Sample:** 4096 | | | **context** string | always | Context required to set the parameter's value. For more information see <https://www.postgresql.org/docs/current/view-pg-settings.html>. **Sample:** user | | | **max\_val** string | always | Maximum allowed value of the parameter (null for non-numeric values). **Sample:** 2147483647 | | | **min\_val** string | always | Minimum allowed value of the parameter (null for non-numeric values). **Sample:** 64 | | | **pending\_restart** boolean | always | True if the value has been changed in the configuration file but needs a restart; or false otherwise. Returns only if `settings` is passed. | | | **pretty\_val** string | always | Value presented in the pretty form. **Sample:** 2MB | | | **setting** string | always | Current value of the parameter. **Sample:** 49152 | | | **sourcefile** string | always | Configuration file the current value was set in. Null for values set from sources other than configuration files, or when examined by a user who is neither a superuser or a member of pg\_read\_all\_settings. Helpful when using include directives in configuration files. **Sample:** /var/lib/pgsql/10/data/postgresql.auto.conf | | | **unit** string | always | Implicit unit of the parameter. **Sample:** kB | | | **val\_in\_bytes** integer | if supported | Current value of the parameter in bytes. **Sample:** 2147483647 | | | **vartype** string | always | Parameter type (bool, enum, integer, real, or string). **Sample:** integer | | **tablespaces** dictionary | always | Information about tablespaces <https://www.postgresql.org/docs/current/catalog-pg-tablespace.html>. **Sample:** [{'test': {'spcacl': '{postgres=C/postgres,andreyk=C/postgres}', 'spcoptions': ['seq\_page\_cost=1'], 'spcowner': 'postgres'}}] | | | **spcacl** string | always | Tablespace access privileges. **Sample:** {postgres=C/postgres,andreyk=C/postgres} | | | **spcoptions** list / elements=string | always | Tablespace-level options. **Sample:** ['seq\_page\_cost=1'] | | | **spcowner** string | always | Owner of the tablespace. **Sample:** test\_user | | **version** dictionary | always | Database server version <https://www.postgresql.org/support/versioning/>. **Sample:** {'version': {'major': 10, 'minor': 6}} | | | **full** string added in 1.2.0 of community.postgresql | always | Full server version. **Sample:** 13.2 | | | **major** integer | always | Major server version. **Sample:** 11 | | | **minor** integer | always | Minor server version. **Sample:** 1 | | | **patch** integer added in 1.2.0 of community.postgresql | if supported | Patch server version. **Sample:** 5 | | | **raw** string added in 1.2.0 of community.postgresql | always | Full output returned by ``SELECT version()``. **Sample:** PostgreSQL 13.2 on x86\_64-pc-linux-gnu, compiled by gcc (GCC) 10.2.1 20201125 (Red Hat 10.2.1-9), 64-bit | ### Authors * Andrew Klychkov (@Andersson007)
programming_docs
ansible community.postgresql.postgresql_publication – Add, update, or remove PostgreSQL publication community.postgresql.postgresql\_publication – Add, update, or remove PostgreSQL publication ============================================================================================ Note This plugin is part of the [community.postgresql collection](https://galaxy.ansible.com/community/postgresql) (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.postgresql`. To use it in a playbook, specify: `community.postgresql.postgresql_publication`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Add, update, or remove PostgreSQL publication. Requirements ------------ The below requirements are needed on the host that executes this module. * psycopg2 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ca\_cert** string | | Specifies the name of a file containing SSL certificate authority (CA) certificate(s). If the file exists, the server's certificate will be verified to be signed by one of these authorities. aliases: ssl\_rootcert | | **cascade** boolean | **Choices:*** **no** ← * yes | Drop publication dependencies. Has effect with *state=absent* only. | | **db** string | | Name of the database to connect to and where the publication state will be changed. aliases: login\_db | | **login\_host** string | | Host running the database. If you have connection issues when using `localhost`, try to use `127.0.0.1` instead. | | **login\_password** string | | The password this module should use to establish its PostgreSQL session. | | **login\_unix\_socket** string | | Path to a Unix domain socket for local connections. | | **login\_user** string | **Default:**"postgres" | The username this module should use to establish its PostgreSQL session. | | **name** string / required | | Name of the publication to add, update, or remove. | | **owner** string | | Publication owner. If *owner* is not defined, the owner will be set as *login\_user* or *session\_role*. | | **parameters** dictionary | | Dictionary with optional publication parameters. Available parameters depend on PostgreSQL version. | | **port** integer | **Default:**5432 | Database port to connect to. aliases: login\_port | | **session\_role** string added in 0.2.0 of community.postgresql | | Switch to session\_role after connecting. The specified session\_role must be a role that the current login\_user is a member of. Permissions checking for SQL commands is carried out as though the session\_role were the one that had logged in originally. | | **ssl\_mode** string | **Choices:*** allow * disable * **prefer** ← * require * verify-ca * verify-full | Determines whether or with what priority a secure SSL TCP/IP connection will be negotiated with the server. See <https://www.postgresql.org/docs/current/static/libpq-ssl.html> for more information on the modes. Default of `prefer` matches libpq default. | | **state** string | **Choices:*** absent * **present** ← | The publication state. | | **tables** list / elements=string | | List of tables to add to the publication. If no value is set all tables are targeted. If the publication already exists for specific tables and *tables* is not passed, nothing will be changed. If you need to add all tables to the publication with the same name, drop existent and create new without passing *tables*. | | **trust\_input** boolean added in 0.2.0 of community.postgresql | **Choices:*** no * **yes** ← | If `no`, check whether values of parameters *name*, *tables*, *owner*, *session\_role*, *params* are potentially dangerous. It makes sense to use `no` only when SQL injections via the parameters are possible. | Notes ----- Note * PostgreSQL version must be 10 or greater. * Supports `check_mode`. * The default authentication assumes that you are either logging in as or sudo’ing to the `postgres` account on the host. * To avoid “Peer authentication failed for user postgres” error, use postgres user as a *become\_user*. * This module uses psycopg2, a Python PostgreSQL database adapter. You must ensure that psycopg2 is installed on the host before using this module. * If the remote host is the PostgreSQL server (which is the default case), then PostgreSQL must also be installed on the remote host. * For Ubuntu-based systems, install the postgresql, libpq-dev, and python-psycopg2 packages on the remote host before using this module. * The ca\_cert parameter requires at least Postgres version 8.4 and *psycopg2* version 2.4.3. See Also -------- See also [CREATE PUBLICATION reference](https://www.postgresql.org/docs/current/sql-createpublication.html) Complete reference of the CREATE PUBLICATION command documentation. [ALTER PUBLICATION reference](https://www.postgresql.org/docs/current/sql-alterpublication.html) Complete reference of the ALTER PUBLICATION command documentation. [DROP PUBLICATION reference](https://www.postgresql.org/docs/current/sql-droppublication.html) Complete reference of the DROP PUBLICATION command documentation. Examples -------- ``` - name: Create a new publication with name "acme" targeting all tables in database "test" community.postgresql.postgresql_publication: db: test name: acme - name: Create publication "acme" publishing only prices and vehicles tables community.postgresql.postgresql_publication: name: acme tables: - prices - vehicles - name: > Create publication "acme", set user alice as an owner, targeting all tables Allowable DML operations are INSERT and UPDATE only community.postgresql.postgresql_publication: name: acme owner: alice parameters: publish: 'insert,update' - name: > Assuming publication "acme" exists and there are targeted tables "prices" and "vehicles", add table "stores" to the publication community.postgresql.postgresql_publication: name: acme tables: - prices - vehicles - stores - name: Remove publication "acme" if exists in database "test" community.postgresql.postgresql_publication: db: test 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 | | --- | --- | --- | | **alltables** boolean | if publication exists | Flag indicates that all tables are published. | | **exists** boolean | always | Flag indicates the publication exists or not at the end of runtime. **Sample:** True | | **owner** string | if publication exists | Owner of the publication at the end of runtime. **Sample:** alice | | **parameters** dictionary | if publication exists | Publication parameters at the end of runtime. **Sample:** {'publish': {'delete': False, 'insert': False, 'update': True}} | | **queries** string | always | List of executed queries. **Sample:** ['DROP PUBLICATION "acme" CASCADE'] | | **tables** list / elements=string | if publication exists | List of tables in the publication at the end of runtime. If all tables are published, returns empty list. **Sample:** ['"public"."prices"', '"public"."vehicles"'] | ### Authors * Loic Blot (@nerzhul) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#cda1a2a4aeebeef9fbf6afa1a2b9ebeefefaf6ebeef8fff6ebeef9f5f6b8a3a4b5e0a8b5bda8bfa4a8a3aea8ebeef9fbf6abbf)> * Andrew Klychkov (@Andersson007) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#5f3e3e3433263c37343029797c6c6864797c6a6d64797c6b6764323e3633797c6b69642d2a)> ansible community.postgresql.postgresql_db – Add or remove PostgreSQL databases from a remote host community.postgresql.postgresql\_db – Add or remove PostgreSQL databases from a remote host =========================================================================================== Note This plugin is part of the [community.postgresql collection](https://galaxy.ansible.com/community/postgresql) (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.postgresql`. To use it in a playbook, specify: `community.postgresql.postgresql_db`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Add or remove PostgreSQL databases from a remote host. Requirements ------------ The below requirements are needed on the host that executes this module. * psycopg2 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ca\_cert** string | | Specifies the name of a file containing SSL certificate authority (CA) certificate(s). If the file exists, the server's certificate will be verified to be signed by one of these authorities. aliases: ssl\_rootcert | | **conn\_limit** string | | Specifies the database connection limit. | | **dump\_extra\_args** string added in 0.2.0 of community.postgresql | | Provides additional arguments when *state* is `dump`. Cannot be used with dump-file-format-related arguments like ``--format=d``. | | **encoding** string | | Encoding of the database. | | **force** boolean | **Choices:*** **no** ← * yes | Used to forcefully drop a database when the *state* is `absent`, ignored otherwise. | | **lc\_collate** string | | Collation order (LC\_COLLATE) to use in the database must match collation order of template database unless `template0` is used as template. | | **lc\_ctype** string | | Character classification (LC\_CTYPE) to use in the database (e.g. lower, upper, ...). Must match LC\_CTYPE of template database unless `template0` is used as template. | | **login\_host** string | | Host running the database. If you have connection issues when using `localhost`, try to use `127.0.0.1` instead. | | **login\_password** string | | The password this module should use to establish its PostgreSQL session. | | **login\_unix\_socket** string | | Path to a Unix domain socket for local connections. | | **login\_user** string | **Default:**"postgres" | The username this module should use to establish its PostgreSQL session. | | **maintenance\_db** string | **Default:**"postgres" | The value specifies the initial database (which is also called as maintenance DB) that Ansible connects to. | | **name** string / required | | Name of the database to add or remove. aliases: db | | **owner** string | | Name of the role to set as owner of the database. | | **port** integer | **Default:**5432 | Database port to connect (if needed). aliases: login\_port | | **session\_role** string | | Switch to session\_role after connecting. The specified session\_role must be a role that the current login\_user is a member of. Permissions checking for SQL commands is carried out as though the session\_role were the one that had logged in originally. | | **ssl\_mode** string | **Choices:*** allow * disable * **prefer** ← * require * verify-ca * verify-full | Determines whether or with what priority a secure SSL TCP/IP connection will be negotiated with the server. See <https://www.postgresql.org/docs/current/static/libpq-ssl.html> for more information on the modes. Default of `prefer` matches libpq default. | | **state** string | **Choices:*** absent * dump * **present** ← * rename * restore | The database state. `present` implies that the database should be created if necessary. `absent` implies that the database should be removed if present. `dump` requires a target definition to which the database will be backed up. (Added in Ansible 2.4) Note that in some PostgreSQL versions of pg\_dump, which is an embedded PostgreSQL utility and is used by the module, returns rc 0 even when errors occurred (e.g. the connection is forbidden by pg\_hba.conf, etc.), so the module returns changed=True but the dump has not actually been done. Please, be sure that your version of pg\_dump returns rc 1 in this case. `restore` also requires a target definition from which the database will be restored. (Added in Ansible 2.4). The format of the backup will be detected based on the target name. Supported compression formats for dump and restore include `.pgc`, `.bz2`, `.gz` and `.xz`. Supported formats for dump and restore include `.sql`, `.tar`, and `.dir` (for the directory format which is supported since collection version 1.4.0). Restore program is selected by target file format: `.tar`, `.pgc`, and `.dir` are handled by pg\_restore, other with pgsql. . `rename` is used to rename the database `name` to `target`. If the database `name` exists, it will be renamed to `target`. If the database `name` does not exist and the `target` database exists, the module will report that nothing has changed. If both the databases exist as well as when they have the same value, an error will be raised. When *state=rename*, in addition to the `name` option, the module requires the `target` option. Other options are ignored. Supported since collection version 1.4.0. | | **tablespace** path | | The tablespace to set for the database <https://www.postgresql.org/docs/current/sql-alterdatabase.html>. If you want to move the database back to the default tablespace, explicitly set this to pg\_default. | | **target** path | | File to back up or restore from. Used when *state* is `dump` or `restore`. | | **target\_opts** string | | Additional arguments for pg\_dump or restore program (pg\_restore or psql, depending on target's format). Used when *state* is `dump` or `restore`. | | **template** string | | Template used to create the database. | | **trust\_input** boolean added in 0.2.0 of community.postgresql | **Choices:*** no * **yes** ← | If `no`, check whether values of parameters *owner*, *conn\_limit*, *encoding*, *db*, *template*, *tablespace*, *session\_role* are potentially dangerous. It makes sense to use `no` only when SQL injections via the parameters are possible. | Notes ----- Note * State `dump` and `restore` don’t require *psycopg2* since version 2.8. * Supports `check_mode`. * The default authentication assumes that you are either logging in as or sudo’ing to the `postgres` account on the host. * To avoid “Peer authentication failed for user postgres” error, use postgres user as a *become\_user*. * This module uses psycopg2, a Python PostgreSQL database adapter. You must ensure that psycopg2 is installed on the host before using this module. * If the remote host is the PostgreSQL server (which is the default case), then PostgreSQL must also be installed on the remote host. * For Ubuntu-based systems, install the postgresql, libpq-dev, and python-psycopg2 packages on the remote host before using this module. * The ca\_cert parameter requires at least Postgres version 8.4 and *psycopg2* version 2.4.3. See Also -------- See also [CREATE DATABASE reference](https://www.postgresql.org/docs/current/sql-createdatabase.html) Complete reference of the CREATE DATABASE command documentation. [DROP DATABASE reference](https://www.postgresql.org/docs/current/sql-dropdatabase.html) Complete reference of the DROP DATABASE command documentation. [pg\_dump reference](https://www.postgresql.org/docs/current/app-pgdump.html) Complete reference of pg\_dump documentation. [pg\_restore reference](https://www.postgresql.org/docs/current/app-pgrestore.html) Complete reference of pg\_restore documentation. [community.postgresql.postgresql\_tablespace](postgresql_tablespace_module#ansible-collections-community-postgresql-postgresql-tablespace-module) The official documentation on the **community.postgresql.postgresql\_tablespace** module. [community.postgresql.postgresql\_info](postgresql_info_module#ansible-collections-community-postgresql-postgresql-info-module) The official documentation on the **community.postgresql.postgresql\_info** module. [community.postgresql.postgresql\_ping](postgresql_ping_module#ansible-collections-community-postgresql-postgresql-ping-module) The official documentation on the **community.postgresql.postgresql\_ping** module. Examples -------- ``` - name: Create a new database with name "acme" community.postgresql.postgresql_db: name: acme # Note: If a template different from "template0" is specified, # encoding and locale settings must match those of the template. - name: Create a new database with name "acme" and specific encoding and locale # settings community.postgresql.postgresql_db: name: acme encoding: UTF-8 lc_collate: de_DE.UTF-8 lc_ctype: de_DE.UTF-8 template: template0 # Note: Default limit for the number of concurrent connections to # a specific database is "-1", which means "unlimited" - name: Create a new database with name "acme" which has a limit of 100 concurrent connections community.postgresql.postgresql_db: name: acme conn_limit: "100" - name: Dump an existing database to a file community.postgresql.postgresql_db: name: acme state: dump target: /tmp/acme.sql - name: Dump an existing database to a file excluding the test table community.postgresql.postgresql_db: name: acme state: dump target: /tmp/acme.sql dump_extra_args: --exclude-table=test - name: Dump an existing database to a file (with compression) community.postgresql.postgresql_db: name: acme state: dump target: /tmp/acme.sql.gz - name: Dump a single schema for an existing database community.postgresql.postgresql_db: name: acme state: dump target: /tmp/acme.sql target_opts: "-n public" - name: Dump only table1 and table2 from the acme database community.postgresql.postgresql_db: name: acme state: dump target: /tmp/table1_table2.sql target_opts: "-t table1 -t table2" - name: Dump an existing database using the directory format community.postgresql.postgresql_db: name: acme state: dump target: /tmp/acme.dir # Note: In the example below, if database foo exists and has another tablespace # the tablespace will be changed to foo. Access to the database will be locked # until the copying of database files is finished. - name: Create a new database called foo in tablespace bar community.postgresql.postgresql_db: name: foo tablespace: bar # Rename the database foo to bar. # If the database foo exists, it will be renamed to bar. # If the database foo does not exist and the bar database exists, # the module will report that nothing has changed. # If both the databases exist, an error will be raised. - name: Rename the database foo to bar community.postgresql.postgresql_db: name: foo state: rename target: bar ``` 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 | | --- | --- | --- | | **executed\_commands** list / elements=string added in 0.2.0 of community.postgresql | always | List of commands which tried to run. **Sample:** ['CREATE DATABASE acme'] | ### Authors * Ansible Core Team ansible community.postgresql.postgresql_copy – Copy data between a file/program and a PostgreSQL table community.postgresql.postgresql\_copy – Copy data between a file/program and a PostgreSQL table =============================================================================================== Note This plugin is part of the [community.postgresql collection](https://galaxy.ansible.com/community/postgresql) (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.postgresql`. To use it in a playbook, specify: `community.postgresql.postgresql_copy`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Copy data between a file/program and a PostgreSQL table. Requirements ------------ The below requirements are needed on the host that executes this module. * psycopg2 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ca\_cert** string | | Specifies the name of a file containing SSL certificate authority (CA) certificate(s). If the file exists, the server's certificate will be verified to be signed by one of these authorities. aliases: ssl\_rootcert | | **columns** list / elements=string | | List of column names for the src/dst table to COPY FROM/TO. aliases: column | | **copy\_from** path | | Copy data from a file to a table (appending the data to whatever is in the table already). Mutually exclusive with *copy\_to* and *src*. aliases: from | | **copy\_to** path | | Copy the contents of a table to a file. Can also copy the results of a SELECT query. Mutually exclusive with *copy\_from* and *dst*. aliases: to | | **db** string | | Name of database to connect to. aliases: login\_db | | **dst** string | | Copy data to *dst=tablename* from *copy\_from=/path/to/data.file*. Used with *copy\_from* only. aliases: destination | | **login\_host** string | | Host running the database. If you have connection issues when using `localhost`, try to use `127.0.0.1` instead. | | **login\_password** string | | The password this module should use to establish its PostgreSQL session. | | **login\_unix\_socket** string | | Path to a Unix domain socket for local connections. | | **login\_user** string | **Default:**"postgres" | The username this module should use to establish its PostgreSQL session. | | **options** dictionary | | Options of COPY command. See the full list of available options <https://www.postgresql.org/docs/current/sql-copy.html>. | | **port** integer | **Default:**5432 | Database port to connect to. aliases: login\_port | | **program** boolean | **Choices:*** **no** ← * yes | Mark *src*/*dst* as a program. Data will be copied to/from a program. See block Examples and PROGRAM arg description <https://www.postgresql.org/docs/current/sql-copy.html>. | | **session\_role** string | | Switch to session\_role after connecting. The specified session\_role must be a role that the current login\_user is a member of. Permissions checking for SQL commands is carried out as though the session\_role were the one that had logged in originally. | | **src** string | | Copy data from *copy\_from* to *src=tablename*. Used with *copy\_to* only. aliases: source | | **ssl\_mode** string | **Choices:*** allow * disable * **prefer** ← * require * verify-ca * verify-full | Determines whether or with what priority a secure SSL TCP/IP connection will be negotiated with the server. See <https://www.postgresql.org/docs/current/static/libpq-ssl.html> for more information on the modes. Default of `prefer` matches libpq default. | | **trust\_input** boolean added in 0.2.0 of community.postgresql | **Choices:*** no * **yes** ← | If `no`, check whether values of parameters are potentially dangerous. It makes sense to use `no` only when SQL injections are possible. | Notes ----- Note * Supports PostgreSQL version 9.4+. * COPY command is only allowed to database superusers. * If *check\_mode=yes*, we just check the src/dst table availability and return the COPY query that actually has not been executed. * If i(check\_mode=yes) and the source has been passed as SQL, the module will execute it and rolled the transaction back but pay attention it can affect database performance (e.g., if SQL collects a lot of data). * The default authentication assumes that you are either logging in as or sudo’ing to the `postgres` account on the host. * To avoid “Peer authentication failed for user postgres” error, use postgres user as a *become\_user*. * This module uses psycopg2, a Python PostgreSQL database adapter. You must ensure that psycopg2 is installed on the host before using this module. * If the remote host is the PostgreSQL server (which is the default case), then PostgreSQL must also be installed on the remote host. * For Ubuntu-based systems, install the postgresql, libpq-dev, and python-psycopg2 packages on the remote host before using this module. * The ca\_cert parameter requires at least Postgres version 8.4 and *psycopg2* version 2.4.3. See Also -------- See also [COPY command reference](https://www.postgresql.org/docs/current/sql-copy.html) Complete reference of the COPY command documentation. Examples -------- ``` - name: Copy text TAB-separated data from file /tmp/data.txt to acme table community.postgresql.postgresql_copy: copy_from: /tmp/data.txt dst: acme - name: Copy CSV (comma-separated) data from file /tmp/data.csv to columns id, name of table acme community.postgresql.postgresql_copy: copy_from: /tmp/data.csv dst: acme columns: id,name options: format: csv - name: > Copy text vertical-bar-separated data from file /tmp/data.txt to bar table. The NULL values are specified as N community.postgresql.postgresql_copy: copy_from: /tmp/data.csv dst: bar options: delimiter: '|' null: 'N' - name: Copy data from acme table to file /tmp/data.txt in text format, TAB-separated community.postgresql.postgresql_copy: src: acme copy_to: /tmp/data.txt - name: Copy data from SELECT query to/tmp/data.csv in CSV format community.postgresql.postgresql_copy: src: 'SELECT * FROM acme' copy_to: /tmp/data.csv options: format: csv - name: Copy CSV data from my_table to gzip community.postgresql.postgresql_copy: src: my_table copy_to: 'gzip > /tmp/data.csv.gz' program: yes options: format: csv - name: > Copy data from columns id, name of table bar to /tmp/data.txt. Output format is text, vertical-bar-separated, NULL as N community.postgresql.postgresql_copy: src: bar columns: - id - name copy_to: /tmp/data.csv options: delimiter: '|' null: 'N' ``` 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 | | --- | --- | --- | | **dst** string | always | Data destination. **Sample:** /tmp/data.csv | | **queries** string | always | List of executed queries. **Sample:** ["COPY test\_table FROM '/tmp/data\_file.txt' (FORMAT csv, DELIMITER ',', NULL 'NULL')"] | | **src** string | always | Data source. **Sample:** mytable | ### Authors * Andrew Klychkov (@Andersson007)
programming_docs
ansible community.postgresql.postgresql_subscription – Add, update, or remove PostgreSQL subscription community.postgresql.postgresql\_subscription – Add, update, or remove PostgreSQL subscription ============================================================================================== Note This plugin is part of the [community.postgresql collection](https://galaxy.ansible.com/community/postgresql) (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.postgresql`. To use it in a playbook, specify: `community.postgresql.postgresql_subscription`. New in version 0.2.0: of community.postgresql * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Add, update, or remove PostgreSQL subscription. Requirements ------------ The below requirements are needed on the host that executes this module. * psycopg2 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ca\_cert** string | | Specifies the name of a file containing SSL certificate authority (CA) certificate(s). If the file exists, the server's certificate will be verified to be signed by one of these authorities. aliases: ssl\_rootcert | | **cascade** boolean | **Choices:*** **no** ← * yes | Drop subscription dependencies. Has effect with *state=absent* only. Ignored when *state* is not `absent`. | | **connparams** dictionary | | The connection dict param-value to connect to the publisher. For more information see <https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING>. Ignored when *state* is not `present`. | | **db** string / required | | Name of the database to connect to and where the subscription state will be changed. aliases: login\_db | | **login\_host** string | | Host running the database. If you have connection issues when using `localhost`, try to use `127.0.0.1` instead. | | **login\_password** string | | The password this module should use to establish its PostgreSQL session. | | **login\_unix\_socket** string | | Path to a Unix domain socket for local connections. | | **login\_user** string | **Default:**"postgres" | The username this module should use to establish its PostgreSQL session. | | **name** string / required | | Name of the subscription to add, update, or remove. | | **owner** string | | Subscription owner. If *owner* is not defined, the owner will be set as *login\_user* or *session\_role*. Ignored when *state* is not `present`. | | **port** integer | **Default:**5432 | Database port to connect to. aliases: login\_port | | **publications** list / elements=string | | The publication names on the publisher to use for the subscription. Ignored when *state* is not `present`. | | **session\_role** string added in 0.2.0 of community.postgresql | | Switch to session\_role after connecting. The specified session\_role must be a role that the current login\_user is a member of. Permissions checking for SQL commands is carried out as though the session\_role were the one that had logged in originally. | | **ssl\_mode** string | **Choices:*** allow * disable * **prefer** ← * require * verify-ca * verify-full | Determines whether or with what priority a secure SSL TCP/IP connection will be negotiated with the server. See <https://www.postgresql.org/docs/current/static/libpq-ssl.html> for more information on the modes. Default of `prefer` matches libpq default. | | **state** string | **Choices:*** absent * **present** ← * refresh | The subscription state. `present` implies that if *name* subscription doesn't exist, it will be created. `absent` implies that if *name* subscription exists, it will be removed. `refresh` implies that if *name* subscription exists, it will be refreshed. Fetch missing table information from publisher. Always returns ``changed`` is ``True``. This will start replication of tables that were added to the subscribed-to publications since the last invocation of REFRESH PUBLICATION or since CREATE SUBSCRIPTION. The existing data in the publications that are being subscribed to should be copied once the replication starts. For more information about `refresh` see <https://www.postgresql.org/docs/current/sql-altersubscription.html>. | | **subsparams** dictionary | | Dictionary of optional parameters for a subscription, e.g. copy\_data, enabled, create\_slot, etc. For update the subscription allowed keys are `enabled`, `slot_name`, `synchronous_commit`, `publication_name`. See available parameters to create a new subscription on <https://www.postgresql.org/docs/current/sql-createsubscription.html>. Ignored when *state* is not `present`. | | **trust\_input** boolean added in 0.2.0 of community.postgresql | **Choices:*** no * **yes** ← | If `no`, check whether values of parameters *name*, *publications*, *owner*, *session\_role*, *connparams*, *subsparams* are potentially dangerous. It makes sense to use `yes` only when SQL injections via the parameters are possible. | Notes ----- Note * PostgreSQL version must be 10 or greater. * Supports `check_mode`. * The default authentication assumes that you are either logging in as or sudo’ing to the `postgres` account on the host. * To avoid “Peer authentication failed for user postgres” error, use postgres user as a *become\_user*. * This module uses psycopg2, a Python PostgreSQL database adapter. You must ensure that psycopg2 is installed on the host before using this module. * If the remote host is the PostgreSQL server (which is the default case), then PostgreSQL must also be installed on the remote host. * For Ubuntu-based systems, install the postgresql, libpq-dev, and python-psycopg2 packages on the remote host before using this module. * The ca\_cert parameter requires at least Postgres version 8.4 and *psycopg2* version 2.4.3. See Also -------- See also [community.postgresql.postgresql\_publication](postgresql_publication_module#ansible-collections-community-postgresql-postgresql-publication-module) The official documentation on the **community.postgresql.postgresql\_publication** module. [community.postgresql.postgresql\_info](postgresql_info_module#ansible-collections-community-postgresql-postgresql-info-module) The official documentation on the **community.postgresql.postgresql\_info** module. [CREATE SUBSCRIPTION reference](https://www.postgresql.org/docs/current/sql-createsubscription.html) Complete reference of the CREATE SUBSCRIPTION command documentation. [ALTER SUBSCRIPTION reference](https://www.postgresql.org/docs/current/sql-altersubscription.html) Complete reference of the ALTER SUBSCRIPTION command documentation. [DROP SUBSCRIPTION reference](https://www.postgresql.org/docs/current/sql-dropsubscription.html) Complete reference of the DROP SUBSCRIPTION command documentation. Examples -------- ``` - name: > Create acme subscription in mydb database using acme_publication and the following connection parameters to connect to the publisher. Set the subscription owner as alice. community.postgresql.postgresql_subscription: db: mydb name: acme state: present publications: acme_publication owner: alice connparams: host: 127.0.0.1 port: 5432 user: repl password: replpass dbname: mydb - name: Assuming that acme subscription exists, try to change conn parameters community.postgresql.postgresql_subscription: db: mydb name: acme connparams: host: 127.0.0.1 port: 5432 user: repl password: replpass connect_timeout: 100 - name: Refresh acme publication community.postgresql.postgresql_subscription: db: mydb name: acme state: refresh - name: Drop acme subscription from mydb with dependencies (cascade=yes) community.postgresql.postgresql_subscription: db: mydb name: acme state: absent cascade: yes - name: Assuming that acme subscription exists and enabled, disable the subscription community.postgresql.postgresql_subscription: db: mydb name: acme state: present subsparams: enabled: 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 | | --- | --- | --- | | **exists** boolean | always | Flag indicates the subscription exists or not at the end of runtime. **Sample:** True | | **final\_state** dictionary | always | Subscription configuration at the end of runtime. **Sample:** {'conninfo': {}, 'enabled': True, 'owner': 'postgres', 'slotname': 'test', 'synccommit': True} | | **initial\_state** dictionary | always | Subscription configuration at the beginning of runtime. **Sample:** {'conninfo': {}, 'enabled': True, 'owner': 'postgres', 'slotname': 'test', 'synccommit': True} | | **name** string | always | Name of the subscription. **Sample:** acme | | **queries** string | always | List of executed queries. **Sample:** ['DROP SUBSCRIPTION "mysubscription"'] | ### Authors * Andrew Klychkov (@Andersson007) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#4425252f283d272c2f2b32626777737f626771767f6267707c7f29252d28626770727f3631)> ansible community.postgresql.postgresql_slot – Add or remove replication slots from a PostgreSQL database community.postgresql.postgresql\_slot – Add or remove replication slots from a PostgreSQL database ================================================================================================== Note This plugin is part of the [community.postgresql collection](https://galaxy.ansible.com/community/postgresql) (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.postgresql`. To use it in a playbook, specify: `community.postgresql.postgresql_slot`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Add or remove physical or logical replication slots from a PostgreSQL database. Requirements ------------ The below requirements are needed on the host that executes this module. * psycopg2 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ca\_cert** string | | Specifies the name of a file containing SSL certificate authority (CA) certificate(s). If the file exists, the server's certificate will be verified to be signed by one of these authorities. aliases: ssl\_rootcert | | **db** string | | Name of database to connect to. aliases: login\_db | | **immediately\_reserve** boolean | **Choices:*** **no** ← * yes | Optional parameter that when `yes` specifies that the LSN for this replication slot be reserved immediately, otherwise the default, `no`, specifies that the LSN is reserved on the first connection from a streaming replication client. Is available from PostgreSQL version 9.6. Uses only with *slot\_type=physical*. Mutually exclusive with *slot\_type=logical*. | | **login\_host** string | | Host running the database. If you have connection issues when using `localhost`, try to use `127.0.0.1` instead. | | **login\_password** string | | The password this module should use to establish its PostgreSQL session. | | **login\_unix\_socket** string | | Path to a Unix domain socket for local connections. | | **login\_user** string | **Default:**"postgres" | The username this module should use to establish its PostgreSQL session. | | **name** string / required | | Name of the replication slot to add or remove. aliases: slot\_name | | **output\_plugin** string | **Default:**"test\_decoding" | All logical slots must indicate which output plugin decoder they're using. This parameter does not apply to physical slots. It will be ignored with *slot\_type=physical*. | | **port** integer | **Default:**5432 | Database port to connect to. aliases: login\_port | | **session\_role** string | | Switch to session\_role after connecting. The specified session\_role must be a role that the current login\_user is a member of. Permissions checking for SQL commands is carried out as though the session\_role were the one that had logged in originally. | | **slot\_type** string | **Choices:*** logical * **physical** ← | Slot type. | | **ssl\_mode** string | **Choices:*** allow * disable * **prefer** ← * require * verify-ca * verify-full | Determines whether or with what priority a secure SSL TCP/IP connection will be negotiated with the server. See <https://www.postgresql.org/docs/current/static/libpq-ssl.html> for more information on the modes. Default of `prefer` matches libpq default. | | **state** string | **Choices:*** absent * **present** ← | The slot state. *state=present* implies the slot must be present in the system. *state=absent* implies the *groups* must be revoked from *target\_roles*. | | **trust\_input** boolean added in 0.2.0 of community.postgresql | **Choices:*** no * **yes** ← | If `no`, check the value of *session\_role* is potentially dangerous. It makes sense to use `no` only when SQL injections via *session\_role* are possible. | Notes ----- Note * Physical replication slots were introduced to PostgreSQL with version 9.4, while logical replication slots were added beginning with version 10.0. * Supports `check_mode`. * The default authentication assumes that you are either logging in as or sudo’ing to the `postgres` account on the host. * To avoid “Peer authentication failed for user postgres” error, use postgres user as a *become\_user*. * This module uses psycopg2, a Python PostgreSQL database adapter. You must ensure that psycopg2 is installed on the host before using this module. * If the remote host is the PostgreSQL server (which is the default case), then PostgreSQL must also be installed on the remote host. * For Ubuntu-based systems, install the postgresql, libpq-dev, and python-psycopg2 packages on the remote host before using this module. * The ca\_cert parameter requires at least Postgres version 8.4 and *psycopg2* version 2.4.3. See Also -------- See also [PostgreSQL pg\_replication\_slots view reference](https://www.postgresql.org/docs/current/view-pg-replication-slots.html) Complete reference of the PostgreSQL pg\_replication\_slots view. [PostgreSQL streaming replication protocol reference](https://www.postgresql.org/docs/current/protocol-replication.html) Complete reference of the PostgreSQL streaming replication protocol documentation. [PostgreSQL logical replication protocol reference](https://www.postgresql.org/docs/current/protocol-logical-replication.html) Complete reference of the PostgreSQL logical replication protocol documentation. Examples -------- ``` - name: Create physical_one physical slot if doesn't exist become_user: postgres community.postgresql.postgresql_slot: slot_name: physical_one db: ansible - name: Remove physical_one slot if exists become_user: postgres community.postgresql.postgresql_slot: slot_name: physical_one db: ansible state: absent - name: Create logical_one logical slot to the database acme if doesn't exist community.postgresql.postgresql_slot: name: logical_slot_one slot_type: logical state: present output_plugin: custom_decoder_one db: "acme" - name: Remove logical_one slot if exists from the cluster running on another host and non-standard port community.postgresql.postgresql_slot: name: logical_one login_host: mydatabase.example.org port: 5433 login_user: ourSuperuser login_password: thePassword 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 | | --- | --- | --- | | **name** string | always | Name of the slot. **Sample:** physical\_one | | **queries** string | always | List of executed queries. **Sample:** ["SELECT pg\_create\_physical\_replication\_slot('physical\_one', False, False)"] | ### Authors * John Scalia (@jscalia) * Andrew Klychkov (@Andersson007) * Thomas O’Donnell (@andytom) ansible community.crypto.x509_certificate_pipe – Generate and/or check OpenSSL certificates community.crypto.x509\_certificate\_pipe – Generate and/or check OpenSSL certificates ===================================================================================== Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.x509_certificate_pipe`. New in version 1.3.0: of community.crypto * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * If both the cryptography and PyOpenSSL libraries are available (and meet the minimum version requirements) cryptography will be preferred as a backend over PyOpenSSL (unless the backend is forced with `select_crypto_backend`). Please note that the PyOpenSSL backend was deprecated in Ansible 2.9 and will be removed in community.crypto 2.0.0. * It implements a notion of provider (ie. `selfsigned`, `ownca`, `entrust`) for your certificate. * It uses the pyOpenSSL or cryptography python library to interact with OpenSSL. * Please note that the module regenerates an existing certificate if it does not match the module’s options, or if it seems to be corrupt. If you are concerned that this could overwrite your existing certificate, consider using the *backup* option. * The `ownca` provider is intended for generating an OpenSSL certificate signed with your own CA (Certificate Authority) certificate (self-signed certificate). * This module allows one to (re)generate OpenSSL certificates. Requirements ------------ The below requirements are needed on the host that executes this module. * PyOpenSSL >= 0.15 or cryptography >= 1.6 (if using `selfsigned`, `ownca` or `assertonly` provider) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **content** string | | The existing certificate. | | **csr\_content** string | | Content of the Certificate Signing Request (CSR) used to generate this certificate. This is mutually exclusive with *csr\_path*. | | **csr\_path** path | | Path to the Certificate Signing Request (CSR) used to generate this certificate. This is mutually exclusive with *csr\_content*. | | **entrust\_api\_client\_cert\_key\_path** path | | The path to the private key of the client certificate used to authenticate to the Entrust Certificate Services (ECS) API. This is only used by the `entrust` provider. This is required if the provider is `entrust`. | | **entrust\_api\_client\_cert\_path** path | | The path to the client certificate used to authenticate to the Entrust Certificate Services (ECS) API. This is only used by the `entrust` provider. This is required if the provider is `entrust`. | | **entrust\_api\_key** string | | The key (password) for authentication to the Entrust Certificate Services (ECS) API. This is only used by the `entrust` provider. This is required if the provider is `entrust`. | | **entrust\_api\_specification\_path** path | **Default:**"https://cloud.entrust.net/EntrustCloud/documentation/cms-api-2.1.0.yaml" | The path to the specification file defining the Entrust Certificate Services (ECS) API configuration. You can use this to keep a local copy of the specification to avoid downloading it every time the module is used. This is only used by the `entrust` provider. | | **entrust\_api\_user** string | | The username for authentication to the Entrust Certificate Services (ECS) API. This is only used by the `entrust` provider. This is required if the provider is `entrust`. | | **entrust\_cert\_type** string | **Choices:*** **STANDARD\_SSL** ← * ADVANTAGE\_SSL * UC\_SSL * EV\_SSL * WILDCARD\_SSL * PRIVATE\_SSL * PD\_SSL * CDS\_ENT\_LITE * CDS\_ENT\_PRO * SMIME\_ENT | Specify the type of certificate requested. This is only used by the `entrust` provider. | | **entrust\_not\_after** string | **Default:**"+365d" | The point in time at which the certificate stops being valid. Time can be specified either as relative time or as an absolute timestamp. A valid absolute time format is `ASN.1 TIME` such as `2019-06-18`. A valid relative time format is `[+-]timespec` where timespec can be an integer + `[w | d | h | m | s]`, such as `+365d` or `+32w1d2h`). Time will always be interpreted as UTC. Note that only the date (day, month, year) is supported for specifying the expiry date of the issued certificate. The full date-time is adjusted to EST (GMT -5:00) before issuance, which may result in a certificate with an expiration date one day earlier than expected if a relative time is used. The minimum certificate lifetime is 90 days, and maximum is three years. If this value is not specified, the certificate will stop being valid 365 days the date of issue. This is only used by the `entrust` provider. | | **entrust\_requester\_email** string | | The email of the requester of the certificate (for tracking purposes). This is only used by the `entrust` provider. This is required if the provider is `entrust`. | | **entrust\_requester\_name** string | | The name of the requester of the certificate (for tracking purposes). This is only used by the `entrust` provider. This is required if the provider is `entrust`. | | **entrust\_requester\_phone** string | | The phone number of the requester of the certificate (for tracking purposes). This is only used by the `entrust` provider. This is required if the provider is `entrust`. | | **force** boolean | **Choices:*** **no** ← * yes | Generate the certificate, even if it already exists. | | **ownca\_content** string | | Content of the CA (Certificate Authority) certificate. This is only used by the `ownca` provider. This is mutually exclusive with *ownca\_path*. | | **ownca\_create\_authority\_key\_identifier** boolean | **Choices:*** no * **yes** ← | Create a Authority Key Identifier from the CA's certificate. If the CSR provided a authority key identifier, it is ignored. The Authority Key Identifier is generated from the CA certificate's Subject Key Identifier, if available. If it is not available, the CA certificate's public key will be used. This is only used by the `ownca` provider. Note that this is only supported if the `cryptography` backend is used! | | **ownca\_create\_subject\_key\_identifier** string | **Choices:*** **create\_if\_not\_provided** ← * always\_create * never\_create | Whether to create the Subject Key Identifier (SKI) from the public key. A value of `create_if_not_provided` (default) only creates a SKI when the CSR does not provide one. A value of `always_create` always creates a SKI. If the CSR provides one, that one is ignored. A value of `never_create` never creates a SKI. If the CSR provides one, that one is used. This is only used by the `ownca` provider. Note that this is only supported if the `cryptography` backend is used! | | **ownca\_digest** string | **Default:**"sha256" | The digest algorithm to be used for the `ownca` certificate. This is only used by the `ownca` provider. | | **ownca\_not\_after** string | **Default:**"+3650d" | The point in time at which the certificate stops being valid. Time can be specified either as relative time or as absolute timestamp. Time will always be interpreted as UTC. Valid format is `[+-]timespec | ASN.1 TIME` where timespec can be an integer + `[w | d | h | m | s]` (e.g. `+32w1d2h`. If this value is not specified, the certificate will stop being valid 10 years from now. Note that this value is **not used to determine whether an existing certificate should be regenerated**. This is only used by the `ownca` provider. On macOS 10.15 and onwards, TLS server certificates must have a validity period of 825 days or fewer. Please see <https://support.apple.com/en-us/HT210176> for more details. | | **ownca\_not\_before** string | **Default:**"+0s" | The point in time the certificate is valid from. Time can be specified either as relative time or as absolute timestamp. Time will always be interpreted as UTC. Valid format is `[+-]timespec | ASN.1 TIME` where timespec can be an integer + `[w | d | h | m | s]` (e.g. `+32w1d2h`. If this value is not specified, the certificate will start being valid from now. Note that this value is **not used to determine whether an existing certificate should be regenerated**. This is only used by the `ownca` provider. | | **ownca\_path** path | | Remote absolute path of the CA (Certificate Authority) certificate. This is only used by the `ownca` provider. This is mutually exclusive with *ownca\_content*. | | **ownca\_privatekey\_content** string | | Content of the CA (Certificate Authority) private key to use when signing the certificate. This is only used by the `ownca` provider. This is mutually exclusive with *ownca\_privatekey\_path*. | | **ownca\_privatekey\_passphrase** string | | The passphrase for the *ownca\_privatekey\_path* resp. *ownca\_privatekey\_content*. This is only used by the `ownca` provider. | | **ownca\_privatekey\_path** path | | Path to the CA (Certificate Authority) private key to use when signing the certificate. This is only used by the `ownca` provider. This is mutually exclusive with *ownca\_privatekey\_content*. | | **ownca\_version** integer | **Default:**3 | The version of the `ownca` certificate. Nowadays it should almost always be `3`. This is only used by the `ownca` provider. | | **privatekey\_content** string | | Path to the private key to use when signing the certificate. This is mutually exclusive with *privatekey\_path*. | | **privatekey\_passphrase** string | | The passphrase for the *privatekey\_path* resp. *privatekey\_content*. This is required if the private key is password protected. | | **privatekey\_path** path | | Path to the private key to use when signing the certificate. This is mutually exclusive with *privatekey\_content*. | | **provider** string / required | **Choices:*** entrust * ownca * selfsigned | Name of the provider to use to generate/retrieve the OpenSSL certificate. The `entrust` provider requires credentials for the [Entrust Certificate Services](https://www.entrustdatacard.com/products/categories/ssl-certificates) (ECS) API. | | **select\_crypto\_backend** string | **Choices:*** **auto** ← * cryptography * pyopenssl | Determines which crypto backend to use. The default choice is `auto`, which tries to use `cryptography` if available, and falls back to `pyopenssl`. If set to `pyopenssl`, will try to use the [pyOpenSSL](https://pypi.org/project/pyOpenSSL/) library. If set to `cryptography`, will try to use the [cryptography](https://cryptography.io/) library. Please note that the `pyopenssl` backend has been deprecated in Ansible 2.9, and will be removed in community.crypto 2.0.0. From that point on, only the `cryptography` backend will be available. | | **selfsigned\_create\_subject\_key\_identifier** string | **Choices:*** **create\_if\_not\_provided** ← * always\_create * never\_create | Whether to create the Subject Key Identifier (SKI) from the public key. A value of `create_if_not_provided` (default) only creates a SKI when the CSR does not provide one. A value of `always_create` always creates a SKI. If the CSR provides one, that one is ignored. A value of `never_create` never creates a SKI. If the CSR provides one, that one is used. This is only used by the `selfsigned` provider. Note that this is only supported if the `cryptography` backend is used! | | **selfsigned\_digest** string | **Default:**"sha256" | Digest algorithm to be used when self-signing the certificate. This is only used by the `selfsigned` provider. | | **selfsigned\_not\_after** string | **Default:**"+3650d" | The point in time at which the certificate stops being valid. Time can be specified either as relative time or as absolute timestamp. Time will always be interpreted as UTC. Valid format is `[+-]timespec | ASN.1 TIME` where timespec can be an integer + `[w | d | h | m | s]` (e.g. `+32w1d2h`. If this value is not specified, the certificate will stop being valid 10 years from now. Note that this value is **not used to determine whether an existing certificate should be regenerated**. This is only used by the `selfsigned` provider. On macOS 10.15 and onwards, TLS server certificates must have a validity period of 825 days or fewer. Please see <https://support.apple.com/en-us/HT210176> for more details. aliases: selfsigned\_notAfter | | **selfsigned\_not\_before** string | **Default:**"+0s" | The point in time the certificate is valid from. Time can be specified either as relative time or as absolute timestamp. Time will always be interpreted as UTC. Valid format is `[+-]timespec | ASN.1 TIME` where timespec can be an integer + `[w | d | h | m | s]` (e.g. `+32w1d2h`. If this value is not specified, the certificate will start being valid from now. Note that this value is **not used to determine whether an existing certificate should be regenerated**. This is only used by the `selfsigned` provider. aliases: selfsigned\_notBefore | | **selfsigned\_version** integer | **Default:**3 | Version of the `selfsigned` certificate. Nowadays it should almost always be `3`. This is only used by the `selfsigned` provider. | Notes ----- Note * Supports `check_mode`. * All ASN.1 TIME values should be specified following the YYYYMMDDHHMMSSZ pattern. * Date specified should be UTC. Minutes and seconds are mandatory. * For security reason, when you use `ownca` provider, you should NOT run [community.crypto.x509\_certificate](x509_certificate_module#ansible-collections-community-crypto-x509-certificate-module) on a target machine, but on a dedicated CA machine. It is recommended not to store the CA private key on the target machine. Once signed, the certificate can be moved to the target machine. * For the `selfsigned` provider, *csr\_path* and *csr\_content* are optional. If not provided, a certificate without any information (Subject, Subject Alternative Names, Key Usage, etc.) is created. See Also -------- See also [community.crypto.x509\_certificate](x509_certificate_module#ansible-collections-community-crypto-x509-certificate-module) The official documentation on the **community.crypto.x509\_certificate** module. [community.crypto.openssl\_csr](openssl_csr_module#ansible-collections-community-crypto-openssl-csr-module) The official documentation on the **community.crypto.openssl\_csr** module. [community.crypto.openssl\_csr\_pipe](openssl_csr_pipe_module#ansible-collections-community-crypto-openssl-csr-pipe-module) The official documentation on the **community.crypto.openssl\_csr\_pipe** module. [community.crypto.openssl\_dhparam](openssl_dhparam_module#ansible-collections-community-crypto-openssl-dhparam-module) The official documentation on the **community.crypto.openssl\_dhparam** module. [community.crypto.openssl\_pkcs12](openssl_pkcs12_module#ansible-collections-community-crypto-openssl-pkcs12-module) The official documentation on the **community.crypto.openssl\_pkcs12** module. [community.crypto.openssl\_privatekey](openssl_privatekey_module#ansible-collections-community-crypto-openssl-privatekey-module) The official documentation on the **community.crypto.openssl\_privatekey** module. [community.crypto.openssl\_privatekey\_pipe](openssl_privatekey_pipe_module#ansible-collections-community-crypto-openssl-privatekey-pipe-module) The official documentation on the **community.crypto.openssl\_privatekey\_pipe** module. [community.crypto.openssl\_publickey](openssl_publickey_module#ansible-collections-community-crypto-openssl-publickey-module) The official documentation on the **community.crypto.openssl\_publickey** module. Examples -------- ``` - name: Generate a Self Signed OpenSSL certificate community.crypto.x509_certificate_pipe: provider: selfsigned privatekey_path: /etc/ssl/private/ansible.com.pem csr_path: /etc/ssl/csr/ansible.com.csr register: result - name: Print the certificate ansible.builtin.debug: var: result.certificate # In the following example, both CSR and certificate file are stored on the # machine where ansible-playbook is executed, while the OwnCA data (certificate, # private key) are stored on the remote machine. - name: (1/2) Generate an OpenSSL Certificate with the CSR provided inline community.crypto.x509_certificate_pipe: provider: ownca content: "{{ lookup('file', '/etc/ssl/csr/www.ansible.com.crt') }}" csr_content: "{{ lookup('file', '/etc/ssl/csr/www.ansible.com.csr') }}" ownca_cert: /path/to/ca_cert.crt ownca_privatekey: /path/to/ca_cert.key ownca_privatekey_passphrase: hunter2 register: result - name: (2/2) Store certificate ansible.builtin.copy: dest: /etc/ssl/csr/www.ansible.com.crt content: "{{ result.certificate }}" delegate_to: localhost when: result is changed # In the following example, the certificate from another machine is signed by # our OwnCA whose private key and certificate are only available on this # machine (where ansible-playbook is executed), without having to write # the certificate file to disk on localhost. The CSR could have been # provided by community.crypto.openssl_csr_pipe earlier, or also have been # read from the remote machine. - name: (1/3) Read certificate's contents from remote machine ansible.builtin.slurp: src: /etc/ssl/csr/www.ansible.com.crt register: certificate_content - name: (2/3) Generate an OpenSSL Certificate with the CSR provided inline community.crypto.x509_certificate_pipe: provider: ownca content: "{{ certificate_content.content | b64decode }}" csr_content: "{{ the_csr }}" ownca_cert: /path/to/ca_cert.crt ownca_privatekey: /path/to/ca_cert.key ownca_privatekey_passphrase: hunter2 delegate_to: localhost register: result - name: (3/3) Store certificate ansible.builtin.copy: dest: /etc/ssl/csr/www.ansible.com.crt content: "{{ result.certificate }}" when: result is changed ``` 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 | | --- | --- | --- | | **certificate** string | changed or success | The (current or generated) certificate's content. | ### Authors * Yanis Guenane (@Spredzy) * Markus Teufelberger (@MarkusTeufelberger) * Felix Fontein (@felixfontein)
programming_docs
ansible community.crypto.openssl_privatekey – Generate OpenSSL private keys community.crypto.openssl\_privatekey – Generate OpenSSL private keys ==================================================================== Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.openssl_privatekey`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Keys are generated in PEM format. * One can generate [RSA](https://en.wikipedia.org/wiki/RSA_%28cryptosystem%29), [DSA](https://en.wikipedia.org/wiki/Digital_Signature_Algorithm), [ECC](https://en.wikipedia.org/wiki/Elliptic-curve_cryptography) or [EdDSA](https://en.wikipedia.org/wiki/EdDSA) private keys. * Please note that the module regenerates private keys if they don’t match the module’s options. In particular, if you provide another passphrase (or specify none), change the keysize, etc., the private key will be regenerated. If you are concerned that this could **overwrite your private key**, consider using the *backup* option. * The default mode for the private key file will be `0600` if *mode* is not explicitly set. * The module can use the cryptography Python library, or the pyOpenSSL Python library. By default, it tries to detect which one is available. This can be overridden with the *select\_crypto\_backend* option. Please note that the PyOpenSSL backend was deprecated in Ansible 2.9 and will be removed in community.crypto 2.0.0. * This module allows one to (re)generate OpenSSL private keys. Requirements ------------ The below requirements are needed on the host that executes this module. * Either cryptography >= 1.2.3 (older versions might work as well) * Or pyOpenSSL 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 | | **backup** boolean | **Choices:*** **no** ← * yes | Create a backup file including a timestamp so you can get the original private key back if you overwrote it with a new one by accident. | | **cipher** string | | The cipher to encrypt the private key. (Valid values can be found by running `openssl list -cipher-algorithms` or `openssl list-cipher-algorithms`, depending on your OpenSSL version.) When using the `cryptography` backend, use `auto`. | | **curve** string | **Choices:*** secp224r1 * secp256k1 * secp256r1 * secp384r1 * secp521r1 * secp192r1 * brainpoolP256r1 * brainpoolP384r1 * brainpoolP512r1 * sect163k1 * sect163r2 * sect233k1 * sect233r1 * sect283k1 * sect283r1 * sect409k1 * sect409r1 * sect571k1 * sect571r1 | Note that not all curves are supported by all versions of `cryptography`. For maximal interoperability, `secp384r1` or `secp256r1` should be used. We use the curve names as defined in the [IANA registry for TLS](https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-8). Please note that all curves except `secp224r1`, `secp256k1`, `secp256r1`, `secp384r1` and `secp521r1` are discouraged for new private keys. | | **force** boolean | **Choices:*** **no** ← * yes | Should the key be regenerated even if it already exists. | | **format** string added in 1.0.0 of community.crypto | **Choices:*** pkcs1 * pkcs8 * raw * auto * **auto\_ignore** ← | Determines which format the private key is written in. By default, PKCS1 (traditional OpenSSL format) is used for all keys which support it. Please note that not every key can be exported in any format. The value `auto` selects a fromat based on the key format. The value `auto_ignore` does the same, but for existing private key files, it will not force a regenerate when its format is not the automatically selected one for generation. Note that if the format for an existing private key mismatches, the key is **regenerated** by default. To change this behavior, use the *format\_mismatch* option. The *format* option is only supported by the `cryptography` backend. The `pyopenssl` backend will fail if a value different from `auto_ignore` is used. | | **format\_mismatch** string added in 1.0.0 of community.crypto | **Choices:*** **regenerate** ← * convert | Determines behavior of the module if the format of a private key does not match the expected format, but all other parameters are as expected. If set to `regenerate` (default), generates a new private key. If set to `convert`, the key will be converted to the new format instead. Only supported by the `cryptography` backend. | | **group** string | | Name of the group that should own the file/directory, as would be fed to *chown*. | | **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*. | | **passphrase** string | | The passphrase for the private key. | | **path** path / required | | Name of the file in which the generated TLS/SSL private key will be written. It will have `0600` mode if *mode* is not explicitly set. | | **regenerate** string added in 1.0.0 of community.crypto | **Choices:*** never * fail * partial\_idempotence * **full\_idempotence** ← * always | Allows to configure in which situations the module is allowed to regenerate private keys. The module will always generate a new key if the destination file does not exist. By default, the key will be regenerated when it doesn't match the module's options, except when the key cannot be read or the passphrase does not match. Please note that this **changed** for Ansible 2.10. For Ansible 2.9, the behavior was as if `full_idempotence` is specified. If set to `never`, the module will fail if the key cannot be read or the passphrase isn't matching, and will never regenerate an existing key. If set to `fail`, the module will fail if the key does not correspond to the module's options. If set to `partial_idempotence`, the key will be regenerated if it does not conform to the module's options. The key is **not** regenerated if it cannot be read (broken file), the key is protected by an unknown passphrase, or when they key is not protected by a passphrase, but a passphrase is specified. If set to `full_idempotence`, the key will be regenerated if it does not conform to the module's options. This is also the case if the key cannot be read (broken file), the key is protected by an unknown passphrase, or when they key is not protected by a passphrase, but a passphrase is specified. Make sure you have a **backup** when using this option! If set to `always`, the module will always regenerate the key. This is equivalent to setting *force* to `yes`. Note that if *format\_mismatch* is set to `convert` and everything matches except the format, the key will always be converted, except if *regenerate* is set to `always`. | | **return\_content** boolean added in 1.0.0 of community.crypto | **Choices:*** **no** ← * yes | If set to `yes`, will return the (current or generated) private key's content as *privatekey*. Note that especially if the private key is not encrypted, you have to make sure that the returned value is treated appropriately and not accidentally written to logs etc.! Use with care! Use Ansible's *no\_log* task option to avoid the output being shown. See also <https://docs.ansible.com/ansible/latest/reference_appendices/faq.html#how-do-i-keep-secret-data-in-my-playbook>. | | **select\_crypto\_backend** string | **Choices:*** **auto** ← * cryptography * pyopenssl | Determines which crypto backend to use. The default choice is `auto`, which tries to use `cryptography` if available, and falls back to `pyopenssl`. If set to `pyopenssl`, will try to use the [pyOpenSSL](https://pypi.org/project/pyOpenSSL/) library. If set to `cryptography`, will try to use the [cryptography](https://cryptography.io/) library. Please note that the `pyopenssl` backend has been deprecated in Ansible 2.9, and will be removed in community.crypto 2.0.0. From that point on, only the `cryptography` backend will be available. | | **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. | | **size** integer | **Default:**4096 | Size (in bits) of the TLS/SSL key to generate. | | **state** string | **Choices:*** absent * **present** ← | Whether the private key should exist or not, taking action if the state is different from what is stated. | | **type** string | **Choices:*** DSA * ECC * Ed25519 * Ed448 * **RSA** ← * X25519 * X448 | The algorithm used to generate the TLS/SSL private key. Note that `ECC`, `X25519`, `X448`, `Ed25519` and `Ed448` require the `cryptography` backend. `X25519` needs cryptography 2.5 or newer, while `X448`, `Ed25519` and `Ed448` require cryptography 2.6 or newer. For `ECC`, the minimal cryptography version required depends on the *curve* 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. | See Also -------- See also [community.crypto.openssl\_privatekey\_pipe](openssl_privatekey_pipe_module#ansible-collections-community-crypto-openssl-privatekey-pipe-module) The official documentation on the **community.crypto.openssl\_privatekey\_pipe** module. [community.crypto.openssl\_privatekey\_info](openssl_privatekey_info_module#ansible-collections-community-crypto-openssl-privatekey-info-module) The official documentation on the **community.crypto.openssl\_privatekey\_info** module. [community.crypto.x509\_certificate](x509_certificate_module#ansible-collections-community-crypto-x509-certificate-module) The official documentation on the **community.crypto.x509\_certificate** module. [community.crypto.x509\_certificate\_pipe](x509_certificate_pipe_module#ansible-collections-community-crypto-x509-certificate-pipe-module) The official documentation on the **community.crypto.x509\_certificate\_pipe** module. [community.crypto.openssl\_csr](openssl_csr_module#ansible-collections-community-crypto-openssl-csr-module) The official documentation on the **community.crypto.openssl\_csr** module. [community.crypto.openssl\_csr\_pipe](openssl_csr_pipe_module#ansible-collections-community-crypto-openssl-csr-pipe-module) The official documentation on the **community.crypto.openssl\_csr\_pipe** module. [community.crypto.openssl\_dhparam](openssl_dhparam_module#ansible-collections-community-crypto-openssl-dhparam-module) The official documentation on the **community.crypto.openssl\_dhparam** module. [community.crypto.openssl\_pkcs12](openssl_pkcs12_module#ansible-collections-community-crypto-openssl-pkcs12-module) The official documentation on the **community.crypto.openssl\_pkcs12** module. [community.crypto.openssl\_publickey](openssl_publickey_module#ansible-collections-community-crypto-openssl-publickey-module) The official documentation on the **community.crypto.openssl\_publickey** module. Examples -------- ``` - name: Generate an OpenSSL private key with the default values (4096 bits, RSA) community.crypto.openssl_privatekey: path: /etc/ssl/private/ansible.com.pem - name: Generate an OpenSSL private key with the default values (4096 bits, RSA) and a passphrase community.crypto.openssl_privatekey: path: /etc/ssl/private/ansible.com.pem passphrase: ansible cipher: aes256 - name: Generate an OpenSSL private key with a different size (2048 bits) community.crypto.openssl_privatekey: path: /etc/ssl/private/ansible.com.pem size: 2048 - name: Force regenerate an OpenSSL private key if it already exists community.crypto.openssl_privatekey: path: /etc/ssl/private/ansible.com.pem force: yes - name: Generate an OpenSSL private key with a different algorithm (DSA) community.crypto.openssl_privatekey: path: /etc/ssl/private/ansible.com.pem type: DSA ``` 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 | changed and if *backup* is `yes` | Name of backup file created. **Sample:** /path/to/privatekey.pem.2019-03-09@11:22~ | | **curve** string | changed or success, and *type* is `ECC` | Elliptic curve used to generate the TLS/SSL private key. **Sample:** secp256r1 | | **filename** string | changed or success | Path to the generated TLS/SSL private key file. **Sample:** /etc/ssl/private/ansible.com.pem | | **fingerprint** dictionary | changed or success | The fingerprint of the public key. Fingerprint will be generated for each `hashlib.algorithms` available. The PyOpenSSL backend requires PyOpenSSL >= 16.0 for meaningful output. **Sample:** {'md5': '84:75:71:72:8d:04:b5:6c:4d:37:6d:66:83:f5:4c:29', 'sha1': '51:cc:7c:68:5d:eb:41:43:88:7e:1a:ae:c7:f8:24:72:ee:71:f6:10', 'sha224': 'b1:19:a6:6c:14:ac:33:1d:ed:18:50:d3:06:5c:b2:32:91:f1:f1:52:8c:cb:d5:75:e9:f5:9b:46', 'sha256': '41:ab:c7:cb:d5:5f:30:60:46:99:ac:d4:00:70:cf:a1:76:4f:24:5d:10:24:57:5d:51:6e:09:97:df:2f:de:c7', 'sha384': '85:39:50:4e:de:d9:19:33:40:70:ae:10:ab:59:24:19:51:c3:a2:e4:0b:1c:b1:6e:dd:b3:0c:d9:9e:6a:46:af:da:18:f8:ef:ae:2e:c0:9a:75:2c:9b:b3:0f:3a:5f:3d', 'sha512': 'fd:ed:5e:39:48:5f:9f:fe:7f:25:06:3f:79:08:cd:ee:a5:e7:b3:3d:13:82:87:1f:84:e1:f5:c7:28:77:53:94:86:56:38:69:f0:d9:35:22:01:1e:a6:60:...:0f:9b'} | | **privatekey** string added in 1.0.0 of community.crypto | if *state* is `present` and *return\_content* is `yes` | The (current or generated) private key's content. Will be Base64-encoded if the key is in raw format. | | **size** integer | changed or success | Size (in bits) of the TLS/SSL private key. **Sample:** 4096 | | **type** string | changed or success | Algorithm used to generate the TLS/SSL private key. **Sample:** RSA | ### Authors * Yanis Guenane (@Spredzy) * Felix Fontein (@felixfontein) ansible community.crypto.acme_inspect – Send direct requests to an ACME server community.crypto.acme\_inspect – Send direct requests to an ACME server ======================================================================= Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.acme_inspect`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Allows to send direct requests to an ACME server with the [ACME protocol](https://tools.ietf.org/html/rfc8555), which is supported by CAs such as [Let’s Encrypt](https://letsencrypt.org/). * This module can be used to debug failed certificate request attempts, for example when [community.crypto.acme\_certificate](acme_certificate_module#ansible-collections-community-crypto-acme-certificate-module) fails or encounters a problem which you wish to investigate. * The module can also be used to directly access features of an ACME servers which are not yet supported by the Ansible ACME modules. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.6 * either openssl or [cryptography](https://cryptography.io/) >= 1.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **account\_key\_content** string | | Content of the ACME account RSA or Elliptic Curve key. Mutually exclusive with `account_key_src`. Required if `account_key_src` is not used. **Warning:** the content will be written into a temporary file, which will be deleted by Ansible when the module completes. Since this is an important private key — it can be used to change the account key, or to revoke your certificates without knowing their private keys —, this might not be acceptable. In case `cryptography` is used, the content is not written into a temporary file. It can still happen that it is written to disk by Ansible in the process of moving the module with its argument to the node where it is executed. | | **account\_key\_passphrase** string added in 1.6.0 of community.crypto | | Phassphrase to use to decode the account key. **Note:** this is not supported by the `openssl` backend, only by the `cryptography` backend. | | **account\_key\_src** path | | Path to a file containing the ACME account RSA or Elliptic Curve key. Private keys can be created with the [community.crypto.openssl\_privatekey](openssl_privatekey_module) or [community.crypto.openssl\_privatekey\_pipe](openssl_privatekey_pipe_module) modules. If the requisites (pyOpenSSL or cryptography) are not available, keys can also be created directly with the `openssl` command line tool: RSA keys can be created with `openssl genrsa ...`. Elliptic curve keys can be created with `openssl ecparam -genkey ...`. Any other tool creating private keys in PEM format can be used as well. Mutually exclusive with `account_key_content`. Required if `account_key_content` is not used. aliases: account\_key | | **account\_uri** string | | If specified, assumes that the account URI is as given. If the account key does not match this account, or an account with this URI does not exist, the module fails. | | **acme\_directory** string | | The ACME directory to use. This is the entry point URL to access the ACME CA server API. For safety reasons the default is set to the Let's Encrypt staging server (for the ACME v1 protocol). This will create technically correct, but untrusted certificates. The default value is `https://acme-staging.api.letsencrypt.org/directory`. Note that in community.crypto 2.0.0, this option **will be required** and will no longer have a default. Note that the default is the Let's Encrypt staging server for the ACME v1 protocol, which is deprecated and will be disabled in May 2021 (see [here](https://community.letsencrypt.org/t/end-of-life-plan-for-acmev1/88430/7) for details). For Let's Encrypt, all staging endpoints can be found here: <https://letsencrypt.org/docs/staging-environment/>. For Buypass, all endpoints can be found here: <https://community.buypass.com/t/63d4ay/buypass-go-ssl-endpoints> For **Let's Encrypt**, the production directory URL for ACME v2 is <https://acme-v02.api.letsencrypt.org/directory>. (The production directory URL for ACME v1 is <https://acme-v01.api.letsencrypt.org/directory> and will be disabled in July 2021.) For **Buypass**, the production directory URL for ACME v2 and v1 is <https://api.buypass.com/acme/directory>. For **ZeroSSL**, the production directory URL for ACME v2 is <https://acme.zerossl.com/v2/DV90>. **Warning:** So far, the ACME modules have only been tested against Let's Encrypt (staging and production), Buypass (staging and production), ZeroSSL (production), and [Pebble testing server](https://github.com/letsencrypt/Pebble). If you experience problems with another ACME server, please [create an issue](https://github.com/ansible-collections/community.crypto/issues/new/choose) to help us supporting it. Feedback that an ACME server not mentioned does work is also appreciated. | | **acme\_version** integer | **Choices:*** 1 * 2 | The ACME version of the endpoint. Must be `1` for the classic Let's Encrypt and Buypass ACME endpoints, or `2` for standardized ACME v2 endpoints. The default value is `1`. Note that in community.crypto 2.0.0, this option **will be required** and will no longer have a default. Please also note that we will deprecate ACME v1 support eventually. | | **content** string | | An encoded JSON object which will be sent as the content if *method* is `post`. Required when *method* is `post`, and not allowed otherwise. | | **fail\_on\_acme\_error** boolean | **Choices:*** no * **yes** ← | If *method* is `post` or `get`, make the module fail in case an ACME error is returned. | | **method** string | **Choices:*** **get** ← * post * directory-only | The method to use to access the given URL on the ACME server. The value `post` executes an authenticated POST request. The content must be specified in the *content* option. The value `get` executes an authenticated POST-as-GET request for ACME v2, and a regular GET request for ACME v1. The value `directory-only` only retrieves the directory, without doing a request. | | **select\_crypto\_backend** string | **Choices:*** **auto** ← * cryptography * openssl | Determines which crypto backend to use. The default choice is `auto`, which tries to use `cryptography` if available, and falls back to `openssl`. If set to `openssl`, will try to use the `openssl` binary. If set to `cryptography`, will try to use the [cryptography](https://cryptography.io/) library. | | **url** string | | The URL to send the request to. Must be specified if *method* is not `directory-only`. | | **validate\_certs** boolean | **Choices:*** no * **yes** ← | Whether calls to the ACME directory will validate TLS certificates. **Warning:** Should **only ever** be set to `no` for testing purposes, for example when testing against a local Pebble server. | Notes ----- Note * The *account\_uri* option must be specified for properly authenticated ACME v2 requests (except a `new-account` request). * Using the `ansible` tool, [community.crypto.acme\_inspect](#ansible-collections-community-crypto-acme-inspect-module) can be used to directly execute ACME requests without the need of writing a playbook. For example, the following command retrieves the ACME account with ID 1 from Let’s Encrypt (assuming `/path/to/key` is the correct private account key): `ansible localhost -m acme_inspect -a "account_key_src=/path/to/key acme_directory=https://acme-v02.api.letsencrypt.org/directory acme_version=2 account_uri=https://acme-v02.api.letsencrypt.org/acme/acct/1 method=get url=https://acme-v02.api.letsencrypt.org/acme/acct/1"` * If a new enough version of the `cryptography` library is available (see Requirements for details), it will be used instead of the `openssl` binary. This can be explicitly disabled or enabled with the `select_crypto_backend` option. Note that using the `openssl` binary will be slower and less secure, as private key contents always have to be stored on disk (see `account_key_content`). * Although the defaults are chosen so that the module can be used with the [Let’s Encrypt](https://letsencrypt.org/) CA, the module can in principle be used with any CA providing an ACME endpoint, such as [Buypass Go SSL](https://www.buypass.com/ssl/products/acme). See Also -------- See also [Automatic Certificate Management Environment (ACME)](https://tools.ietf.org/html/rfc8555) The specification of the ACME protocol (RFC 8555). [ACME TLS ALPN Challenge Extension](https://www.rfc-editor.org/rfc/rfc8737.html) The specification of the `tls-alpn-01` challenge (RFC 8737). Examples -------- ``` - name: Get directory community.crypto.acme_inspect: acme_directory: https://acme-staging-v02.api.letsencrypt.org/directory acme_version: 2 method: directory-only register: directory - name: Create an account community.crypto.acme_inspect: acme_directory: https://acme-staging-v02.api.letsencrypt.org/directory acme_version: 2 account_key_src: /etc/pki/cert/private/account.key url: "{{ directory.newAccount}}" method: post content: '{"termsOfServiceAgreed":true}' register: account_creation # account_creation.headers.location contains the account URI # if creation was successful - name: Get account information community.crypto.acme_inspect: acme_directory: https://acme-staging-v02.api.letsencrypt.org/directory acme_version: 2 account_key_src: /etc/pki/cert/private/account.key account_uri: "{{ account_creation.headers.location }}" url: "{{ account_creation.headers.location }}" method: get - name: Update account contacts community.crypto.acme_inspect: acme_directory: https://acme-staging-v02.api.letsencrypt.org/directory acme_version: 2 account_key_src: /etc/pki/cert/private/account.key account_uri: "{{ account_creation.headers.location }}" url: "{{ account_creation.headers.location }}" method: post content: '{{ account_info | to_json }}' vars: account_info: # For valid values, see # https://tools.ietf.org/html/rfc8555#section-7.3 contact: - mailto:[email protected] - name: Create certificate order community.crypto.acme_certificate: acme_directory: https://acme-staging-v02.api.letsencrypt.org/directory acme_version: 2 account_key_src: /etc/pki/cert/private/account.key account_uri: "{{ account_creation.headers.location }}" csr: /etc/pki/cert/csr/sample.com.csr fullchain_dest: /etc/httpd/ssl/sample.com-fullchain.crt challenge: http-01 register: certificate_request # Assume something went wrong. certificate_request.order_uri contains # the order URI. - name: Get order information community.crypto.acme_inspect: acme_directory: https://acme-staging-v02.api.letsencrypt.org/directory acme_version: 2 account_key_src: /etc/pki/cert/private/account.key account_uri: "{{ account_creation.headers.location }}" url: "{{ certificate_request.order_uri }}" method: get register: order - name: Get first authz for order community.crypto.acme_inspect: acme_directory: https://acme-staging-v02.api.letsencrypt.org/directory acme_version: 2 account_key_src: /etc/pki/cert/private/account.key account_uri: "{{ account_creation.headers.location }}" url: "{{ order.output_json.authorizations[0] }}" method: get register: authz - name: Get HTTP-01 challenge for authz community.crypto.acme_inspect: acme_directory: https://acme-staging-v02.api.letsencrypt.org/directory acme_version: 2 account_key_src: /etc/pki/cert/private/account.key account_uri: "{{ account_creation.headers.location }}" url: "{{ authz.output_json.challenges | selectattr('type', 'equalto', 'http-01') }}" method: get register: http01challenge - name: Activate HTTP-01 challenge manually community.crypto.acme_inspect: acme_directory: https://acme-staging-v02.api.letsencrypt.org/directory acme_version: 2 account_key_src: /etc/pki/cert/private/account.key account_uri: "{{ account_creation.headers.location }}" url: "{{ http01challenge.url }}" method: post content: '{}' ``` 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 | | --- | --- | --- | | **directory** dictionary | always | The ACME directory's content **Sample:** { "a85k3x9f91A4": "https://community.letsencrypt.org/t/adding-random-entries-to-the-directory/33417", "keyChange": "https://acme-v02.api.letsencrypt.org/acme/key-change", "meta": { "caaIdentities": [ "letsencrypt.org" ], "termsOfService": "https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf", "website": "https://letsencrypt.org" }, "newAccount": "https://acme-v02.api.letsencrypt.org/acme/new-acct", "newNonce": "https://acme-v02.api.letsencrypt.org/acme/new-nonce", "newOrder": "https://acme-v02.api.letsencrypt.org/acme/new-order", "revokeCert": "https://acme-v02.api.letsencrypt.org/acme/revoke-cert" } | | **headers** dictionary | always | The request's HTTP headers (with lowercase keys) **Sample:** { "boulder-requester": "12345", "cache-control": "max-age=0, no-cache, no-store", "connection": "close", "content-length": "904", "content-type": "application/json", "cookies": {}, "cookies\_string": "", "date": "Wed, 07 Nov 2018 12:34:56 GMT", "expires": "Wed, 07 Nov 2018 12:44:56 GMT", "link": "<https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf>;rel="terms-of-service"", "msg": "OK (904 bytes)", "pragma": "no-cache", "replay-nonce": "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGH", "server": "nginx", "status": 200, "strict-transport-security": "max-age=604800", "url": "https://acme-v02.api.letsencrypt.org/acme/acct/46161", "x-frame-options": "DENY" } | | **output\_json** dictionary | if output can be parsed as JSON | The output parsed as JSON **Sample:** [{'id': 12345}, {'key': [{'kty': 'RSA'}, '...']}] | | **output\_text** string | always | The raw text output **Sample:** { "id": 12345, "key": { "kty": "RSA", ... | ### Authors * Felix Fontein (@felixfontein)
programming_docs
ansible Community.Crypto Community.Crypto ================ Collection version 1.9.6 Scenario Guides --------------- * [How to create self-signed certificates](docsite/guide_selfsigned) * [How to create a small CA](docsite/guide_ownca) Plugin Index ------------ These are the plugins in the community.crypto collection ### Modules * [acme\_account](acme_account_module#ansible-collections-community-crypto-acme-account-module) – Create, modify or delete ACME accounts * [acme\_account\_info](acme_account_info_module#ansible-collections-community-crypto-acme-account-info-module) – Retrieves information on ACME accounts * [acme\_certificate](acme_certificate_module#ansible-collections-community-crypto-acme-certificate-module) – Create SSL/TLS certificates with the ACME protocol * [acme\_certificate\_revoke](acme_certificate_revoke_module#ansible-collections-community-crypto-acme-certificate-revoke-module) – Revoke certificates with the ACME protocol * [acme\_challenge\_cert\_helper](acme_challenge_cert_helper_module#ansible-collections-community-crypto-acme-challenge-cert-helper-module) – Prepare certificates required for ACME challenges such as `tls-alpn-01` * [acme\_inspect](acme_inspect_module#ansible-collections-community-crypto-acme-inspect-module) – Send direct requests to an ACME server * [certificate\_complete\_chain](certificate_complete_chain_module#ansible-collections-community-crypto-certificate-complete-chain-module) – Complete certificate chain given a set of untrusted and root certificates * [ecs\_certificate](ecs_certificate_module#ansible-collections-community-crypto-ecs-certificate-module) – Request SSL/TLS certificates with the Entrust Certificate Services (ECS) API * [ecs\_domain](ecs_domain_module#ansible-collections-community-crypto-ecs-domain-module) – Request validation of a domain with the Entrust Certificate Services (ECS) API * [get\_certificate](get_certificate_module#ansible-collections-community-crypto-get-certificate-module) – Get a certificate from a host:port * [luks\_device](luks_device_module#ansible-collections-community-crypto-luks-device-module) – Manage encrypted (LUKS) devices * [openssh\_cert](openssh_cert_module#ansible-collections-community-crypto-openssh-cert-module) – Generate OpenSSH host or user certificates. * [openssh\_keypair](openssh_keypair_module#ansible-collections-community-crypto-openssh-keypair-module) – Generate OpenSSH private and public keys * [openssl\_csr](openssl_csr_module#ansible-collections-community-crypto-openssl-csr-module) – Generate OpenSSL Certificate Signing Request (CSR) * [openssl\_csr\_info](openssl_csr_info_module#ansible-collections-community-crypto-openssl-csr-info-module) – Provide information of OpenSSL Certificate Signing Requests (CSR) * [openssl\_csr\_pipe](openssl_csr_pipe_module#ansible-collections-community-crypto-openssl-csr-pipe-module) – Generate OpenSSL Certificate Signing Request (CSR) * [openssl\_dhparam](openssl_dhparam_module#ansible-collections-community-crypto-openssl-dhparam-module) – Generate OpenSSL Diffie-Hellman Parameters * [openssl\_pkcs12](openssl_pkcs12_module#ansible-collections-community-crypto-openssl-pkcs12-module) – Generate OpenSSL PKCS#12 archive * [openssl\_privatekey](openssl_privatekey_module#ansible-collections-community-crypto-openssl-privatekey-module) – Generate OpenSSL private keys * [openssl\_privatekey\_info](openssl_privatekey_info_module#ansible-collections-community-crypto-openssl-privatekey-info-module) – Provide information for OpenSSL private keys * [openssl\_privatekey\_pipe](openssl_privatekey_pipe_module#ansible-collections-community-crypto-openssl-privatekey-pipe-module) – Generate OpenSSL private keys without disk access * [openssl\_publickey](openssl_publickey_module#ansible-collections-community-crypto-openssl-publickey-module) – Generate an OpenSSL public key from its private key. * [openssl\_publickey\_info](openssl_publickey_info_module#ansible-collections-community-crypto-openssl-publickey-info-module) – Provide information for OpenSSL public keys * [openssl\_signature](openssl_signature_module#ansible-collections-community-crypto-openssl-signature-module) – Sign data with openssl * [openssl\_signature\_info](openssl_signature_info_module#ansible-collections-community-crypto-openssl-signature-info-module) – Verify signatures with openssl * [x509\_certificate](x509_certificate_module#ansible-collections-community-crypto-x509-certificate-module) – Generate and/or check OpenSSL certificates * [x509\_certificate\_info](x509_certificate_info_module#ansible-collections-community-crypto-x509-certificate-info-module) – Provide information of OpenSSL X.509 certificates * [x509\_certificate\_pipe](x509_certificate_pipe_module#ansible-collections-community-crypto-x509-certificate-pipe-module) – Generate and/or check OpenSSL certificates * [x509\_crl](x509_crl_module#ansible-collections-community-crypto-x509-crl-module) – Generate Certificate Revocation Lists (CRLs) * [x509\_crl\_info](x509_crl_info_module#ansible-collections-community-crypto-x509-crl-info-module) – Retrieve information on Certificate Revocation Lists (CRLs) See also List of [collections](../../index#list-of-collections) with docs hosted here. ansible community.crypto.acme_certificate_revoke – Revoke certificates with the ACME protocol community.crypto.acme\_certificate\_revoke – Revoke certificates with the ACME protocol ======================================================================================= Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.acme_certificate_revoke`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) Synopsis -------- * Allows to revoke certificates issued by a CA supporting the [ACME protocol](https://tools.ietf.org/html/rfc8555), such as [Let’s Encrypt](https://letsencrypt.org/). Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.6 * either openssl or [cryptography](https://cryptography.io/) >= 1.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **account\_key\_content** string | | Content of the ACME account RSA or Elliptic Curve key. Note that exactly one of `account_key_src`, `account_key_content`, `private_key_src` or `private_key_content` must be specified. *Warning*: the content will be written into a temporary file, which will be deleted by Ansible when the module completes. Since this is an important private key — it can be used to change the account key, or to revoke your certificates without knowing their private keys —, this might not be acceptable. In case `cryptography` is used, the content is not written into a temporary file. It can still happen that it is written to disk by Ansible in the process of moving the module with its argument to the node where it is executed. | | **account\_key\_passphrase** string added in 1.6.0 of community.crypto | | Phassphrase to use to decode the account key. **Note:** this is not supported by the `openssl` backend, only by the `cryptography` backend. | | **account\_key\_src** path | | Path to a file containing the ACME account RSA or Elliptic Curve key. RSA keys can be created with `openssl rsa ...`. Elliptic curve keys can be created with `openssl ecparam -genkey ...`. Any other tool creating private keys in PEM format can be used as well. Mutually exclusive with `account_key_content`. Required if `account_key_content` is not used. aliases: account\_key | | **account\_uri** string | | If specified, assumes that the account URI is as given. If the account key does not match this account, or an account with this URI does not exist, the module fails. | | **acme\_directory** string | | The ACME directory to use. This is the entry point URL to access the ACME CA server API. For safety reasons the default is set to the Let's Encrypt staging server (for the ACME v1 protocol). This will create technically correct, but untrusted certificates. The default value is `https://acme-staging.api.letsencrypt.org/directory`. Note that in community.crypto 2.0.0, this option **will be required** and will no longer have a default. Note that the default is the Let's Encrypt staging server for the ACME v1 protocol, which is deprecated and will be disabled in May 2021 (see [here](https://community.letsencrypt.org/t/end-of-life-plan-for-acmev1/88430/7) for details). For Let's Encrypt, all staging endpoints can be found here: <https://letsencrypt.org/docs/staging-environment/>. For Buypass, all endpoints can be found here: <https://community.buypass.com/t/63d4ay/buypass-go-ssl-endpoints> For **Let's Encrypt**, the production directory URL for ACME v2 is <https://acme-v02.api.letsencrypt.org/directory>. (The production directory URL for ACME v1 is <https://acme-v01.api.letsencrypt.org/directory> and will be disabled in July 2021.) For **Buypass**, the production directory URL for ACME v2 and v1 is <https://api.buypass.com/acme/directory>. For **ZeroSSL**, the production directory URL for ACME v2 is <https://acme.zerossl.com/v2/DV90>. **Warning:** So far, the ACME modules have only been tested against Let's Encrypt (staging and production), Buypass (staging and production), ZeroSSL (production), and [Pebble testing server](https://github.com/letsencrypt/Pebble). If you experience problems with another ACME server, please [create an issue](https://github.com/ansible-collections/community.crypto/issues/new/choose) to help us supporting it. Feedback that an ACME server not mentioned does work is also appreciated. | | **acme\_version** integer | **Choices:*** 1 * 2 | The ACME version of the endpoint. Must be `1` for the classic Let's Encrypt and Buypass ACME endpoints, or `2` for standardized ACME v2 endpoints. The default value is `1`. Note that in community.crypto 2.0.0, this option **will be required** and will no longer have a default. Please also note that we will deprecate ACME v1 support eventually. | | **certificate** path / required | | Path to the certificate to revoke. | | **private\_key\_content** string | | Content of the certificate's private key. Note that exactly one of `account_key_src`, `account_key_content`, `private_key_src` or `private_key_content` must be specified. *Warning*: the content will be written into a temporary file, which will be deleted by Ansible when the module completes. Since this is an important private key — it can be used to change the account key, or to revoke your certificates without knowing their private keys —, this might not be acceptable. In case `cryptography` is used, the content is not written into a temporary file. It can still happen that it is written to disk by Ansible in the process of moving the module with its argument to the node where it is executed. | | **private\_key\_passphrase** string added in 1.6.0 of community.crypto | | Phassphrase to use to decode the certificate's private key. **Note:** this is not supported by the `openssl` backend, only by the `cryptography` backend. | | **private\_key\_src** path | | Path to the certificate's private key. Note that exactly one of `account_key_src`, `account_key_content`, `private_key_src` or `private_key_content` must be specified. | | **revoke\_reason** integer | | One of the revocation reasonCodes defined in [Section 5.3.1 of RFC5280](https://tools.ietf.org/html/rfc5280#section-5.3.1). Possible values are `0` (unspecified), `1` (keyCompromise), `2` (cACompromise), `3` (affiliationChanged), `4` (superseded), `5` (cessationOfOperation), `6` (certificateHold), `8` (removeFromCRL), `9` (privilegeWithdrawn), `10` (aACompromise). | | **select\_crypto\_backend** string | **Choices:*** **auto** ← * cryptography * openssl | Determines which crypto backend to use. The default choice is `auto`, which tries to use `cryptography` if available, and falls back to `openssl`. If set to `openssl`, will try to use the `openssl` binary. If set to `cryptography`, will try to use the [cryptography](https://cryptography.io/) library. | | **validate\_certs** boolean | **Choices:*** no * **yes** ← | Whether calls to the ACME directory will validate TLS certificates. **Warning:** Should **only ever** be set to `no` for testing purposes, for example when testing against a local Pebble server. | Notes ----- Note * Exactly one of `account_key_src`, `account_key_content`, `private_key_src` or `private_key_content` must be specified. * Trying to revoke an already revoked certificate should result in an unchanged status, even if the revocation reason was different than the one specified here. Also, depending on the server, it can happen that some other error is returned if the certificate has already been revoked. * Does not support `check_mode`. * If a new enough version of the `cryptography` library is available (see Requirements for details), it will be used instead of the `openssl` binary. This can be explicitly disabled or enabled with the `select_crypto_backend` option. Note that using the `openssl` binary will be slower and less secure, as private key contents always have to be stored on disk (see `account_key_content`). * Although the defaults are chosen so that the module can be used with the [Let’s Encrypt](https://letsencrypt.org/) CA, the module can in principle be used with any CA providing an ACME endpoint, such as [Buypass Go SSL](https://www.buypass.com/ssl/products/acme). See Also -------- See also [The Let’s Encrypt documentation](https://letsencrypt.org/docs/) Documentation for the Let’s Encrypt Certification Authority. Provides useful information for example on rate limits. [Automatic Certificate Management Environment (ACME)](https://tools.ietf.org/html/rfc8555) The specification of the ACME protocol (RFC 8555). [community.crypto.acme\_inspect](acme_inspect_module#ansible-collections-community-crypto-acme-inspect-module) Allows to debug problems. Examples -------- ``` - name: Revoke certificate with account key community.crypto.acme_certificate_revoke: account_key_src: /etc/pki/cert/private/account.key certificate: /etc/httpd/ssl/sample.com.crt - name: Revoke certificate with certificate's private key community.crypto.acme_certificate_revoke: private_key_src: /etc/httpd/ssl/sample.com.key certificate: /etc/httpd/ssl/sample.com.crt ``` ### Authors * Felix Fontein (@felixfontein) ansible community.crypto.certificate_complete_chain – Complete certificate chain given a set of untrusted and root certificates community.crypto.certificate\_complete\_chain – Complete certificate chain given a set of untrusted and root certificates ========================================================================================================================= Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.certificate_complete_chain`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module completes a given chain of certificates in PEM format by finding intermediate certificates from a given set of certificates, until it finds a root certificate in another given set of certificates. * This can for example be used to find the root certificate for a certificate chain returned by [community.crypto.acme\_certificate](acme_certificate_module#ansible-collections-community-crypto-acme-certificate-module). * Note that this module does *not* check for validity of the chains. It only checks that issuer and subject match, and that the signature is correct. It ignores validity dates and key usage completely. If you need to verify that a generated chain is valid, please use `openssl verify ...`. Requirements ------------ The below requirements are needed on the host that executes this module. * cryptography >= 1.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **input\_chain** string / required | | A concatenated set of certificates in PEM format forming a chain. The module will try to complete this chain. | | **intermediate\_certificates** list / elements=path | **Default:**[] | A list of filenames or directories. A filename is assumed to point to a file containing one or more certificates in PEM format. All certificates in this file will be added to the set of root certificates. If a directory name is given, all files in the directory and its subdirectories will be scanned and tried to be parsed as concatenated certificates in PEM format. Symbolic links will be followed. | | **root\_certificates** list / elements=path / required | | A list of filenames or directories. A filename is assumed to point to a file containing one or more certificates in PEM format. All certificates in this file will be added to the set of root certificates. If a directory name is given, all files in the directory and its subdirectories will be scanned and tried to be parsed as concatenated certificates in PEM format. Symbolic links will be followed. | Examples -------- ``` # Given a leaf certificate for www.ansible.com and one or more intermediate # certificates, finds the associated root certificate. - name: Find root certificate community.crypto.certificate_complete_chain: input_chain: "{{ lookup('file', '/etc/ssl/csr/www.ansible.com-fullchain.pem') }}" root_certificates: - /etc/ca-certificates/ register: www_ansible_com - name: Write root certificate to disk copy: dest: /etc/ssl/csr/www.ansible.com-root.pem content: "{{ www_ansible_com.root }}" # Given a leaf certificate for www.ansible.com, and a list of intermediate # certificates, finds the associated root certificate. - name: Find root certificate community.crypto.certificate_complete_chain: input_chain: "{{ lookup('file', '/etc/ssl/csr/www.ansible.com.pem') }}" intermediate_certificates: - /etc/ssl/csr/www.ansible.com-chain.pem root_certificates: - /etc/ca-certificates/ register: www_ansible_com - name: Write complete chain to disk copy: dest: /etc/ssl/csr/www.ansible.com-completechain.pem content: "{{ ''.join(www_ansible_com.complete_chain) }}" - name: Write root chain (intermediates and root) to disk copy: dest: /etc/ssl/csr/www.ansible.com-rootchain.pem content: "{{ ''.join(www_ansible_com.chain) }}" ``` 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 | | --- | --- | --- | | **chain** list / elements=string | success | The chain added to the given input chain. Includes the root certificate. Returned as a list of PEM certificates. | | **complete\_chain** list / elements=string | success | The completed chain, including leaf, all intermediates, and root. Returned as a list of PEM certificates. | | **root** string | success | The root certificate in PEM format. | ### Authors * Felix Fontein (@felixfontein)
programming_docs
ansible community.crypto.x509_crl_info – Retrieve information on Certificate Revocation Lists (CRLs) community.crypto.x509\_crl\_info – Retrieve information on Certificate Revocation Lists (CRLs) ============================================================================================== Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.x509_crl_info`. New in version 1.0.0: of community.crypto * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows one to retrieve information on Certificate Revocation Lists (CRLs). Requirements ------------ The below requirements are needed on the host that executes this module. * cryptography >= 1.2 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **content** string | | Content of the X.509 CRL in PEM format, or Base64-encoded X.509 CRL. Either *path* or *content* must be specified, but not both. | | **list\_revoked\_certificates** boolean added in 1.7.0 of community.crypto | **Choices:*** no * **yes** ← | If set to `false`, the list of revoked certificates is not included in the result. This is useful when retrieving information on large CRL files. Enumerating all revoked certificates can take some time, including serializing the result as JSON, sending it to the Ansible controller, and decoding it again. | | **path** path | | Remote absolute path where the generated CRL file should be created or is already located. Either *path* or *content* must be specified, but not both. | Notes ----- Note * All timestamp values are provided in ASN.1 TIME format, in other words, following the `YYYYMMDDHHMMSSZ` pattern. They are all in UTC. * Supports `check_mode`. See Also -------- See also [community.crypto.x509\_crl](x509_crl_module#ansible-collections-community-crypto-x509-crl-module) The official documentation on the **community.crypto.x509\_crl** module. Examples -------- ``` - name: Get information on CRL community.crypto.x509_crl_info: path: /etc/ssl/my-ca.crl register: result - name: Print the information ansible.builtin.debug: msg: "{{ result }}" - name: Get information on CRL without list of revoked certificates community.crypto.x509_crl_info: path: /etc/ssl/very-large.crl list_revoked_certificates: 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 | | --- | --- | --- | | **digest** string | success | The signature algorithm used to sign the CRL. **Sample:** sha256WithRSAEncryption | | **format** string | success | Whether the CRL is in PEM format (`pem`) or in DER format (`der`). **Sample:** pem | | **issuer** dictionary | success | The CRL's issuer. Note that for repeated values, only the last one will be returned. **Sample:** {"organizationName": "Ansible", "commonName": "ca.example.com"} | | **issuer\_ordered** list / elements=list | success | The CRL's issuer as an ordered list of tuples. **Sample:** [["organizationName", "Ansible"], ["commonName": "ca.example.com"]] | | **last\_update** string | success | The point in time from which this CRL can be trusted as ASN.1 TIME. **Sample:** 20190413202428Z | | **next\_update** string | success | The point in time from which a new CRL will be issued and the client has to check for it as ASN.1 TIME. **Sample:** 20190413202428Z | | **revoked\_certificates** list / elements=dictionary | success if *list\_revoked\_certificates=true* | List of certificates to be revoked. | | | **invalidity\_date** string | success | The point in time it was known/suspected that the private key was compromised or that the certificate otherwise became invalid as ASN.1 TIME. **Sample:** 20190413202428Z | | | **invalidity\_date\_critical** boolean | success | Whether the invalidity date extension is critical. | | | **issuer** list / elements=string | success | The certificate's issuer. **Sample:** ["DNS:ca.example.org"] | | | **issuer\_critical** boolean | success | Whether the certificate issuer extension is critical. | | | **reason** string | success | The value for the revocation reason extension. One of `unspecified`, `key_compromise`, `ca_compromise`, `affiliation_changed`, `superseded`, `cessation_of_operation`, `certificate_hold`, `privilege_withdrawn`, `aa_compromise`, and `remove_from_crl`. **Sample:** key\_compromise | | | **reason\_critical** boolean | success | Whether the revocation reason extension is critical. | | | **revocation\_date** string | success | The point in time the certificate was revoked as ASN.1 TIME. **Sample:** 20190413202428Z | | | **serial\_number** integer | success | Serial number of the certificate. **Sample:** 1234 | ### Authors * Felix Fontein (@felixfontein) ansible community.crypto.ecs_certificate – Request SSL/TLS certificates with the Entrust Certificate Services (ECS) API community.crypto.ecs\_certificate – Request SSL/TLS certificates with the Entrust Certificate Services (ECS) API ================================================================================================================ Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.ecs_certificate`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Create, reissue, and renew certificates with the Entrust Certificate Services (ECS) API. * Requires credentials for the [Entrust Certificate Services](https://www.entrustdatacard.com/products/categories/ssl-certificates) (ECS) API. * In order to request a certificate, the domain and organization used in the certificate signing request must be already validated in the ECS system. It is *not* the responsibility of this module to perform those steps. Requirements ------------ The below requirements are needed on the host that executes this module. * PyYAML >= 3.11 * cryptography >= 1.6 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **additional\_emails** list / elements=string | | A list of additional email addresses to receive the delivery notice and expiry notification for the certificate. | | **backup** boolean | **Choices:*** **no** ← * yes | Whether a backup should be made for the certificate in *path*. | | **cert\_expiry** string | | The date the certificate should be set to expire, in RFC3339 compliant date or date-time format. For example, `2020-02-23`, `2020-02-23T15:00:00.05Z`. *cert\_expiry* is only supported for requests of `request_type=new` or `request_type=renew`. If `request_type=reissue`, *cert\_expiry* will be used for the first certificate issuance, but subsequent issuances will have the same expiry as the initial certificate. A reissued certificate will always have the same expiry as the original certificate. Note that only the date (day, month, year) is supported for specifying the expiry date. If you choose to specify an expiry time with the expiry date, the time will be adjusted to Eastern Standard Time (EST). This could have the unintended effect of moving your expiry date to the previous day. Applies only to accounts with a pooling inventory model. Only one of *cert\_expiry* or *cert\_lifetime* may be specified. | | **cert\_lifetime** string | **Choices:*** P1Y * P2Y * P3Y | The lifetime of the certificate. Applies to all certificates for accounts with a non-pooling inventory model. *cert\_lifetime* is only supported for requests of `request_type=new` or `request_type=renew`. If `request_type=reissue`, *cert\_lifetime* will be used for the first certificate issuance, but subsequent issuances will have the same expiry as the initial certificate. Applies to certificates of *cert\_type*=`CDS_INDIVIDUAL, CDS_GROUP, CDS_ENT_LITE, CDS_ENT_PRO, SMIME_ENT` for accounts with a pooling inventory model. `P1Y` is a certificate with a 1 year lifetime. `P2Y` is a certificate with a 2 year lifetime. `P3Y` is a certificate with a 3 year lifetime. Only one of *cert\_expiry* or *cert\_lifetime* may be specified. | | **cert\_type** string | **Choices:*** STANDARD\_SSL * ADVANTAGE\_SSL * UC\_SSL * EV\_SSL * WILDCARD\_SSL * PRIVATE\_SSL * PD\_SSL * CODE\_SIGNING * EV\_CODE\_SIGNING * CDS\_INDIVIDUAL * CDS\_GROUP * CDS\_ENT\_LITE * CDS\_ENT\_PRO * SMIME\_ENT | Specify the type of certificate requested. If a certificate is being reissued or renewed, this parameter is ignored, and the `cert_type` of the initial certificate is used. | | **client\_id** integer | **Default:**1 | The client ID to submit the Certificate Signing Request under. If no client ID is specified, the certificate will be submitted under the primary client with ID of 1. When using a client other than the primary client, the *org* parameter cannot be specified. The issued certificate will have an organization value in the subject distinguished name represented by the client. | | **csr** string | | Base-64 encoded Certificate Signing Request (CSR). *csr* is accepted with or without PEM formatting around the Base-64 string. If no *csr* is provided when `request_type=reissue` or `request_type=renew`, the certificate will be generated with the same public key as the certificate being renewed or reissued. If *subject\_alt\_name* is specified, it will override the subject alternate names in the CSR. If *eku* is specified, it will override the extended key usage in the CSR. If *ou* is specified, it will override the organizational units "ou=" present in the subject distinguished name of the CSR, if any. The organization "O=" field from the CSR will not be used. It will be replaced in the issued certificate by *org* if present, and if not present, the organization tied to *client\_id*. | | **ct\_log** boolean | **Choices:*** no * yes | In compliance with browser requirements, this certificate may be posted to the Certificate Transparency (CT) logs. This is a best practice technique that helps domain owners monitor certificates issued to their domains. Note that not all certificates are eligible for CT logging. If *ct\_log* is not specified, the certificate uses the account default. If *ct\_log* is specified and the account settings allow it, *ct\_log* overrides the account default. If *ct\_log* is set to `false`, but the account settings are set to "always log", the certificate generation will fail. | | **custom\_fields** dictionary | | Mapping of custom fields to associate with the certificate request and certificate. Only supported if custom fields are enabled for your account. Each custom field specified must be a custom field you have defined for your account. | | | **date1** string | | Custom date field. | | | **date2** string | | Custom date field. | | | **date3** string | | Custom date field. | | | **date4** string | | Custom date field. | | | **date5** string | | Custom date field. | | | **dropdown1** string | | Custom dropdown field. | | | **dropdown2** string | | Custom dropdown field. | | | **dropdown3** string | | Custom dropdown field. | | | **dropdown4** string | | Custom dropdown field. | | | **dropdown5** string | | Custom dropdown field. | | | **email1** string | | Custom email field. | | | **email2** string | | Custom email field. | | | **email3** string | | Custom email field. | | | **email4** string | | Custom email field. | | | **email5** string | | Custom email field. | | | **number1** float | | Custom number field. | | | **number2** float | | Custom number field. | | | **number3** float | | Custom number field. | | | **number4** float | | Custom number field. | | | **number5** float | | Custom number field. | | | **text1** string | | Custom text field (maximum 500 characters) | | | **text10** string | | Custom text field (maximum 500 characters) | | | **text11** string | | Custom text field (maximum 500 characters) | | | **text12** string | | Custom text field (maximum 500 characters) | | | **text13** string | | Custom text field (maximum 500 characters) | | | **text14** string | | Custom text field (maximum 500 characters) | | | **text15** string | | Custom text field (maximum 500 characters) | | | **text2** string | | Custom text field (maximum 500 characters) | | | **text3** string | | Custom text field (maximum 500 characters) | | | **text4** string | | Custom text field (maximum 500 characters) | | | **text5** string | | Custom text field (maximum 500 characters) | | | **text6** string | | Custom text field (maximum 500 characters) | | | **text7** string | | Custom text field (maximum 500 characters) | | | **text8** string | | Custom text field (maximum 500 characters) | | | **text9** string | | Custom text field (maximum 500 characters) | | **eku** string | **Choices:*** SERVER\_AUTH * CLIENT\_AUTH * SERVER\_AND\_CLIENT\_AUTH | If specified, overrides the key usage in the *csr*. | | **end\_user\_key\_storage\_agreement** boolean | **Choices:*** no * yes | The end user of the Code Signing certificate must generate and store the private key for this request on cryptographically secure hardware to be compliant with the Entrust CSP and Subscription agreement. If requesting a certificate of type `CODE_SIGNING` or `EV_CODE_SIGNING`, you must set *end\_user\_key\_storage\_agreement* to true if and only if you acknowledge that you will inform the user of this requirement. Applicable only to *cert\_type* of values `CODE_SIGNING` and `EV_CODE_SIGNING`. | | **entrust\_api\_client\_cert\_key\_path** path / required | | The path to the key for the client certificate used to authenticate to the Entrust Certificate Services (ECS) API. | | **entrust\_api\_client\_cert\_path** path / required | | The path to the client certificate used to authenticate to the Entrust Certificate Services (ECS) API. | | **entrust\_api\_key** string / required | | The key (password) for authentication to the Entrust Certificate Services (ECS) API. | | **entrust\_api\_specification\_path** path | **Default:**"https://cloud.entrust.net/EntrustCloud/documentation/cms-api-2.1.0.yaml" | The path to the specification file defining the Entrust Certificate Services (ECS) API configuration. You can use this to keep a local copy of the specification to avoid downloading it every time the module is used. | | **entrust\_api\_user** string / required | | The username for authentication to the Entrust Certificate Services (ECS) API. | | **force** boolean | **Choices:*** **no** ← * yes | If force is used, a certificate is requested regardless of whether *path* points to an existing valid certificate. If `request_type=renew`, a forced renew will fail if the certificate being renewed has been issued within the past 30 days, regardless of the value of *remaining\_days* or the return value of *cert\_days* - the ECS API does not support the "renew" operation for certificates that are not at least 30 days old. | | **full\_chain\_path** path | | The destination path for the full certificate chain of the certificate, intermediates, and roots. | | **org** string | | Organization "O=" to include in the certificate. If *org* is not specified, the organization from the client represented by *client\_id* is used. Unless the *cert\_type* is `PD_SSL`, this field may not be specified if the value of *client\_id* is not "1" (the primary client). non-primary clients, certificates may only be issued with the organization of that client. | | **ou** list / elements=string | | Organizational unit "OU=" to include in the certificate. *ou* behavior is dependent on whether organizational units are enabled for your account. If organizational unit support is disabled for your account, organizational units from the *csr* and the *ou* parameter are ignored. If both *csr* and *ou* are specified, the value in *ou* will override the OU fields present in the subject distinguished name in the *csr* If neither *csr* nor *ou* are specified for a renew or reissue operation, the OU fields in the initial certificate are reused. An invalid OU from *csr* is ignored, but any invalid organizational units in *ou* will result in an error indicating "Unapproved OU". The *ou* parameter can be used to force failure if an unapproved organizational unit is provided. A maximum of one OU may be specified for current products. Multiple OUs are reserved for future products. | | **path** path / required | | The destination path for the generated certificate as a PEM encoded cert. If the certificate at this location is not an Entrust issued certificate, a new certificate will always be requested even if the current certificate is technically valid. If there is already an Entrust certificate at this location, whether it is replaced is depends on the *remaining\_days* calculation. If an existing certificate is being replaced (see *remaining\_days*, *force*, and *tracking\_id*), whether a new certificate is requested or the existing certificate is renewed or reissued is based on *request\_type*. | | **remaining\_days** integer | **Default:**30 | The number of days the certificate must have left being valid. If `cert_days < remaining_days` then a new certificate will be obtained using *request\_type*. If `request_type=renew`, a renewal will fail if the certificate being renewed has been issued within the past 30 days, so do not set a *remaining\_days* value that is within 30 days of the full lifetime of the certificate being acted upon. (e.g. if you are requesting Certificates with a 90 day lifetime, do not set remaining\_days to a value `60` or higher). The *force* option may be used to ensure that a new certificate is always obtained. | | **request\_type** string | **Choices:*** **new** ← * renew * reissue * validate\_only | The operation performed if *tracking\_id* references a valid certificate to reissue, or there is already a certificate present in *path* but either *force* is specified or `cert_days < remaining_days`. Specifying `request_type=validate_only` means the request will be validated against the ECS API, but no certificate will be issued. Specifying `request_type=new` means a certificate request will always be submitted and a new certificate issued. Specifying `request_type=renew` means that an existing certificate (specified by *tracking\_id* if present, otherwise *path*) will be renewed. If there is no certificate to renew, a new certificate is requested. Specifying `request_type=reissue` means that an existing certificate (specified by *tracking\_id* if present, otherwise *path*) will be reissued. If there is no certificate to reissue, a new certificate is requested. If a certificate was issued within the past 30 days, the 'renew' operation is not a valid operation and will fail. Note that `reissue` is an operation that will result in the revocation of the certificate that is reissued, be cautious with it's use. *check\_mode* is only supported if `request_type=new` For example, setting `request_type=renew` and `remaining_days=30` and pointing to the same certificate on multiple playbook runs means that on the first run new certificate will be requested. It will then be left along on future runs until it is within 30 days of expiry, then the ECS "renew" operation will be performed. | | **requester\_email** string / required | | The requester email to associate with certificate tracking information and receive delivery and expiry notices for the certificate. | | **requester\_name** string / required | | The requester name to associate with certificate tracking information. | | **requester\_phone** string / required | | The requester phone number to associate with certificate tracking information. | | **subject\_alt\_name** list / elements=string | | The subject alternative name identifiers, as an array of values (applies to *cert\_type* with a value of `STANDARD_SSL`, `ADVANTAGE_SSL`, `UC_SSL`, `EV_SSL`, `WILDCARD_SSL`, `PRIVATE_SSL`, and `PD_SSL`). If you are requesting a new SSL certificate, and you pass a *subject\_alt\_name* parameter, any SAN names in the CSR are ignored. If no subjectAltName parameter is passed, the SAN names in the CSR are used. See *request\_type* to understand more about SANs during reissues and renewals. In the case of certificates of type `STANDARD_SSL` certificates, if the CN of the certificate is <domain>.<tld> only the www.<domain>.<tld> value is accepted. If the CN of the certificate is www.<domain>.<tld> only the <domain>.<tld> value is accepted. | | **tracking\_id** integer | | The tracking ID of the certificate to reissue or renew. *tracking\_id* is invalid if `request_type=new` or `request_type=validate_only`. If there is a certificate present in *path* and it is an ECS certificate, *tracking\_id* will be ignored. If there is no certificate present in *path* or there is but it is from another provider, the certificate represented by *tracking\_id* will be renewed or reissued and saved to *path*. If there is no certificate present in *path* and the *force* and *remaining\_days* parameters do not indicate a new certificate is needed, the certificate referenced by *tracking\_id* certificate will be saved to *path*. This can be used when a known certificate is not currently present on a server, but you want to renew or reissue it to be managed by an ansible playbook. For example, if you specify `request_type=renew`, *tracking\_id* of an issued certificate, and *path* to a file that does not exist, the first run of a task will download the certificate specified by *tracking\_id* (assuming it is still valid). Future runs of the task will (if applicable - see *force* and *remaining\_days*) renew the certificate now present in *path*. | | **tracking\_info** string | | Free form tracking information to attach to the record for the certificate. | Notes ----- Note * `path` must be specified as the output location of the certificate. See Also -------- See also [community.crypto.openssl\_privatekey](openssl_privatekey_module#ansible-collections-community-crypto-openssl-privatekey-module) Can be used to create private keys (both for certificates and accounts). [community.crypto.openssl\_csr](openssl_csr_module#ansible-collections-community-crypto-openssl-csr-module) Can be used to create a Certificate Signing Request (CSR). Examples -------- ``` - name: Request a new certificate from Entrust with bare minimum parameters. Will request a new certificate if current one is valid but within 30 days of expiry. If replacing an existing file in path, will back it up. community.crypto.ecs_certificate: backup: true path: /etc/ssl/crt/ansible.com.crt full_chain_path: /etc/ssl/crt/ansible.com.chain.crt csr: /etc/ssl/csr/ansible.com.csr cert_type: EV_SSL requester_name: Jo Doe requester_email: [email protected] requester_phone: 555-555-5555 entrust_api_user: apiusername entrust_api_key: a^lv*32!cd9LnT entrust_api_client_cert_path: /etc/ssl/entrust/ecs-client.crt entrust_api_client_cert_key_path: /etc/ssl/entrust/ecs-client.key - name: If there is no certificate present in path, request a new certificate of type EV_SSL. Otherwise, if there is an Entrust managed certificate in path and it is within 63 days of expiration, request a renew of that certificate. community.crypto.ecs_certificate: path: /etc/ssl/crt/ansible.com.crt csr: /etc/ssl/csr/ansible.com.csr cert_type: EV_SSL cert_expiry: '2020-08-20' request_type: renew remaining_days: 63 requester_name: Jo Doe requester_email: [email protected] requester_phone: 555-555-5555 entrust_api_user: apiusername entrust_api_key: a^lv*32!cd9LnT entrust_api_client_cert_path: /etc/ssl/entrust/ecs-client.crt entrust_api_client_cert_key_path: /etc/ssl/entrust/ecs-client.key - name: If there is no certificate present in path, download certificate specified by tracking_id if it is still valid. Otherwise, if the certificate is within 79 days of expiration, request a renew of that certificate and save it in path. This can be used to "migrate" a certificate to be Ansible managed. community.crypto.ecs_certificate: path: /etc/ssl/crt/ansible.com.crt csr: /etc/ssl/csr/ansible.com.csr tracking_id: 2378915 request_type: renew remaining_days: 79 entrust_api_user: apiusername entrust_api_key: a^lv*32!cd9LnT entrust_api_client_cert_path: /etc/ssl/entrust/ecs-client.crt entrust_api_client_cert_key_path: /etc/ssl/entrust/ecs-client.key - name: Force a reissue of the certificate specified by tracking_id. community.crypto.ecs_certificate: path: /etc/ssl/crt/ansible.com.crt force: true tracking_id: 2378915 request_type: reissue entrust_api_user: apiusername entrust_api_key: a^lv*32!cd9LnT entrust_api_client_cert_path: /etc/ssl/entrust/ecs-client.crt entrust_api_client_cert_key_path: /etc/ssl/entrust/ecs-client.key - name: Request a new certificate with an alternative client. Note that the issued certificate will have it's Subject Distinguished Name use the organization details associated with that client, rather than what is in the CSR. community.crypto.ecs_certificate: path: /etc/ssl/crt/ansible.com.crt csr: /etc/ssl/csr/ansible.com.csr client_id: 2 requester_name: Jo Doe requester_email: [email protected] requester_phone: 555-555-5555 entrust_api_user: apiusername entrust_api_key: a^lv*32!cd9LnT entrust_api_client_cert_path: /etc/ssl/entrust/ecs-client.crt entrust_api_client_cert_key_path: /etc/ssl/entrust/ecs-client.key - name: Request a new certificate with a number of CSR parameters overridden and tracking information community.crypto.ecs_certificate: path: /etc/ssl/crt/ansible.com.crt full_chain_path: /etc/ssl/crt/ansible.com.chain.crt csr: /etc/ssl/csr/ansible.com.csr subject_alt_name: - ansible.testcertificates.com - www.testcertificates.com eku: SERVER_AND_CLIENT_AUTH ct_log: true org: Test Organization Inc. ou: - Administration tracking_info: "Submitted via Ansible" additional_emails: - [email protected] - [email protected] custom_fields: text1: Admin text2: Invoice 25 number1: 342 date1: '2018-01-01' email1: [email protected] dropdown1: red cert_expiry: '2020-08-15' requester_name: Jo Doe requester_email: [email protected] requester_phone: 555-555-5555 entrust_api_user: apiusername entrust_api_key: a^lv*32!cd9LnT entrust_api_client_cert_path: /etc/ssl/entrust/ecs-client.crt entrust_api_client_cert_key_path: /etc/ssl/entrust/ecs-client.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 | | --- | --- | --- | | **backup\_file** string | changed and if *backup* is `true` | Name of backup file created for the certificate. **Sample:** /path/to/www.ansible.com.crt.2019-03-09@11:22~ | | **backup\_full\_chain\_file** string | changed and if *backup* is `true` and *full\_chain\_path* is set. | Name of the backup file created for the certificate chain. **Sample:** /path/to/ca.chain.crt.2019-03-09@11:22~ | | **cert\_days** integer | success | The number of days the certificate remains valid. **Sample:** 253 | | **cert\_details** dictionary | success | The full response JSON from the Get Certificate call of the ECS API. While the response contents are guaranteed to be forwards compatible with new ECS API releases, Entrust recommends that you do not make any playbooks take actions based on the content of this field. However it may be useful for debugging, logging, or auditing purposes. | | **cert\_status** string | success | The certificate status in ECS. Current possible values (which may be expanded in the future) are: `ACTIVE`, `APPROVED`, `DEACTIVATED`, `DECLINED`, `EXPIRED`, `NA`, `PENDING`, `PENDING_QUORUM`, `READY`, `REISSUED`, `REISSUING`, `RENEWED`, `RENEWING`, `REVOKED`, `SUSPENDED` **Sample:** ACTIVE | | **filename** string | changed or success | The destination path for the generated certificate. **Sample:** /etc/ssl/crt/www.ansible.com.crt | | **serial\_number** integer | success | The serial number of the issued certificate. **Sample:** 1235262234164342 | | **tracking\_id** integer | success | The tracking ID to reference and track the certificate in ECS. **Sample:** 380079 | ### Authors * Chris Trufan (@ctrufan)
programming_docs
ansible community.crypto.ecs_domain – Request validation of a domain with the Entrust Certificate Services (ECS) API community.crypto.ecs\_domain – Request validation of a domain with the Entrust Certificate Services (ECS) API ============================================================================================================= Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.ecs_domain`. New in version 1.0.0: of community.crypto * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Request validation or re-validation of a domain with the Entrust Certificate Services (ECS) API. * Requires credentials for the [Entrust Certificate Services](https://www.entrustdatacard.com/products/categories/ssl-certificates) (ECS) API. * If the domain is already in the validation process, no new validation will be requested, but the validation data (if applicable) will be returned. * If the domain is already in the validation process but the *verification\_method* specified is different than the current *verification\_method*, the *verification\_method* will be updated and validation data (if applicable) will be returned. * If the domain is an active, validated domain, the return value of *changed* will be false, unless `domain_status=EXPIRED`, in which case a re-validation will be performed. * If `verification_method=dns`, details about the required DNS entry will be specified in the return parameters *dns\_contents*, *dns\_location*, and *dns\_resource\_type*. * If `verification_method=web_server`, details about the required file details will be specified in the return parameters *file\_contents* and *file\_location*. * If `verification_method=email`, the email address(es) that the validation email(s) were sent to will be in the return parameter *emails*. This is purely informational. For domains requested using this module, this will always be a list of size 1. Requirements ------------ The below requirements are needed on the host that executes this module. * PyYAML >= 3.11 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **client\_id** integer | **Default:**1 | The client ID to request the domain be associated with. If no client ID is specified, the domain will be added under the primary client with ID of 1. | | **domain\_name** string / required | | The domain name to be verified or reverified. | | **entrust\_api\_client\_cert\_key\_path** path / required | | The path to the key for the client certificate used to authenticate to the Entrust Certificate Services (ECS) API. | | **entrust\_api\_client\_cert\_path** path / required | | The path to the client certificate used to authenticate to the Entrust Certificate Services (ECS) API. | | **entrust\_api\_key** string / required | | The key (password) for authentication to the Entrust Certificate Services (ECS) API. | | **entrust\_api\_specification\_path** path | **Default:**"https://cloud.entrust.net/EntrustCloud/documentation/cms-api-2.1.0.yaml" | The path to the specification file defining the Entrust Certificate Services (ECS) API configuration. You can use this to keep a local copy of the specification to avoid downloading it every time the module is used. | | **entrust\_api\_user** string / required | | The username for authentication to the Entrust Certificate Services (ECS) API. | | **verification\_email** string | | Email address to be used to verify domain ownership. Email address must be either an email address present in the WHOIS data for *domain\_name*, or one of the following constructed emails: admin@*domain\_name*, administrator@*domain\_name*, webmaster@*domain\_name*, hostmaster@*domain\_name*, postmaster@*domain\_name* Note that if *domain\_name* includes subdomains, the top level domain should be used. For example, if requesting validation of example1.ansible.com, or test.example2.ansible.com, and you want to use the "admin" preconstructed name, the email address should be [email protected]. If using the email values from the WHOIS data for the domain or it's top level namespace, they must be exact matches. If `verification_method=email` but *verification\_email* is not provided, the first email address found in WHOIS data for the domain will be used. To verify domain ownership, domain owner must follow the instructions in the email they receive. Only allowed if `verification_method=email` | | **verification\_method** string / required | **Choices:*** dns * email * manual * web\_server | The verification method to be used to prove control of the domain. If `verification_method=email` and the value *verification\_email* is specified, that value is used for the email validation. If *verification\_email* is not provided, the first value present in WHOIS data will be used. An email will be sent to the address in *verification\_email* with instructions on how to verify control of the domain. If `verification_method=dns`, the value *dns\_contents* must be stored in location *dns\_location*, with a DNS record type of *verification\_dns\_record\_type*. To prove domain ownership, update your DNS records so the text string returned by *dns\_contents* is available at *dns\_location*. If `verification_method=web_server`, the contents of return value *file\_contents* must be made available on a web server accessible at location *file\_location*. If `verification_method=manual`, the domain will be validated with a manual process. This is not recommended. | Notes ----- Note * There is a small delay (typically about 5 seconds, but can be as long as 60 seconds) before obtaining the random values when requesting a validation while `verification_method=dns` or `verification_method=web_server`. Be aware of that if doing many domain validation requests. See Also -------- See also [community.crypto.x509\_certificate](x509_certificate_module#ansible-collections-community-crypto-x509-certificate-module) Can be used to request certificates from ECS, with `provider=entrust`. [community.crypto.ecs\_certificate](ecs_certificate_module#ansible-collections-community-crypto-ecs-certificate-module) Can be used to request a Certificate from ECS using a verified domain. Examples -------- ``` - name: Request domain validation using email validation for client ID of 2. community.crypto.ecs_domain: domain_name: ansible.com client_id: 2 verification_method: email verification_email: [email protected] entrust_api_user: apiusername entrust_api_key: a^lv*32!cd9LnT entrust_api_client_cert_path: /etc/ssl/entrust/ecs-client.crt entrust_api_client_cert_key_path: /etc/ssl/entrust/ecs-client.key - name: Request domain validation using DNS. If domain is already valid, request revalidation if expires within 90 days community.crypto.ecs_domain: domain_name: ansible.com verification_method: dns entrust_api_user: apiusername entrust_api_key: a^lv*32!cd9LnT entrust_api_client_cert_path: /etc/ssl/entrust/ecs-client.crt entrust_api_client_cert_key_path: /etc/ssl/entrust/ecs-client.key - name: Request domain validation using web server validation, and revalidate if fewer than 60 days remaining of EV eligibility. community.crypto.ecs_domain: domain_name: ansible.com verification_method: web_server entrust_api_user: apiusername entrust_api_key: a^lv*32!cd9LnT entrust_api_client_cert_path: /etc/ssl/entrust/ecs-client.crt entrust_api_client_cert_key_path: /etc/ssl/entrust/ecs-client.key - name: Request domain validation using manual validation. community.crypto.ecs_domain: domain_name: ansible.com verification_method: manual entrust_api_user: apiusername entrust_api_key: a^lv*32!cd9LnT entrust_api_client_cert_path: /etc/ssl/entrust/ecs-client.crt entrust_api_client_cert_key_path: /etc/ssl/entrust/ecs-client.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 | | --- | --- | --- | | **client\_id** integer | changed or success | Client ID that the domain belongs to. If the input value *client\_id* is specified, this will always be the same as *client\_id* **Sample:** 1 | | **dns\_contents** string | changed and if *verification\_method* is `dns` | The value that ECS will be expecting to find in the DNS record located at *dns\_location*. **Sample:** AB23CD41432522FF2526920393982FAB | | **dns\_location** string | changed and if *verification\_method* is `dns` | The location that ECS will be expecting to be able to find the DNS entry for domain verification, containing the contents of *dns\_contents*. **Sample:** \_pki-validation.ansible.com | | **dns\_resource\_type** string | changed and if *verification\_method* is `dns` | The type of resource record that ECS will be expecting for the DNS record located at *dns\_location*. **Sample:** TXT | | **domain\_status** string | changed or success | Status of the current domain. Will be one of `APPROVED`, `DECLINED`, `CANCELLED`, `INITIAL_VERIFICATION`, `DECLINED`, `CANCELLED`, `RE_VERIFICATION`, `EXPIRED`, `EXPIRING` **Sample:** APPROVED | | **emails** list / elements=string | *verification\_method* is `email` | The list of emails used to request validation of this domain. Domains requested using this module will only have a list of size 1. **Sample:** ['[email protected]', '[email protected]'] | | **ev\_days\_remaining** integer | success and *ev\_eligible* is `true` and *domain\_status* is `APPROVED`, `RE_VERIFICATION` or `EXPIRING`. | The number of days the domain remains eligible for submission of "EV" certificates. Will never be greater than the value of *ov\_days\_remaining* **Sample:** 94 | | **ev\_eligible** boolean | success and *domain\_status* is `APPROVED`, `RE_VERIFICATION` or `EXPIRING`, or `EXPIRED`. | Whether the domain is eligible for submission of "EV" certificates. Will never be `true` if *ov\_eligible* is `false` **Sample:** True | | **file\_contents** string | *verification\_method* is `web_server` | The contents of the file that ECS will be expecting to find at `file_location`. **Sample:** AB23CD41432522FF2526920393982FAB | | **file\_location** string | *verification\_method* is `web_server` | The location that ECS will be expecting to be able to find the file for domain verification, containing the contents of *file\_contents*. **Sample:** http://ansible.com/.well-known/pki-validation/abcd.txt | | **ov\_days\_remaining** integer | success and *ov\_eligible* is `true` and *domain\_status* is `APPROVED`, `RE_VERIFICATION` or `EXPIRING`. | The number of days the domain remains eligible for submission of "OV" certificates. Will never be less than the value of *ev\_days\_remaining* **Sample:** 129 | | **ov\_eligible** boolean | success and *domain\_status* is `APPROVED`, `RE_VERIFICATION`, `EXPIRING`, or `EXPIRED`. | Whether the domain is eligible for submission of "OV" certificates. Will never be `false` if *ov\_eligible* is `true` **Sample:** True | | **verification\_method** string | changed or success | Verification method used to request the domain validation. If `changed` will be the same as *verification\_method* input parameter. **Sample:** dns | ### Authors * Chris Trufan (@ctrufan) ansible community.crypto.x509_certificate_info – Provide information of OpenSSL X.509 certificates community.crypto.x509\_certificate\_info – Provide information of OpenSSL X.509 certificates ============================================================================================ Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.x509_certificate_info`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows one to query information on OpenSSL certificates. * It uses the pyOpenSSL or cryptography python library to interact with OpenSSL. If both the cryptography and PyOpenSSL libraries are available (and meet the minimum version requirements) cryptography will be preferred as a backend over PyOpenSSL (unless the backend is forced with `select_crypto_backend`). Please note that the PyOpenSSL backend was deprecated in Ansible 2.9 and will be removed in community.crypto 2.0.0. * Note that this module was called `openssl_certificate_info` when included directly in Ansible up to version 2.9. When moved to the collection `community.crypto`, it was renamed to [community.crypto.x509\_certificate\_info](#ansible-collections-community-crypto-x509-certificate-info-module). From Ansible 2.10 on, it can still be used by the old short name (or by `ansible.builtin.openssl_certificate_info`), which redirects to `community.crypto.x509_certificate_info`. When using FQCNs or when using the [collections](../../../user_guide/collections_using#using-collections-in-a-playbook) keyword, the new name [community.crypto.x509\_certificate\_info](#ansible-collections-community-crypto-x509-certificate-info-module) should be used to avoid a deprecation warning. Requirements ------------ The below requirements are needed on the host that executes this module. * PyOpenSSL >= 0.15 or cryptography >= 1.6 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **content** string added in 1.0.0 of community.crypto | | Content of the X.509 certificate in PEM format. Either *path* or *content* must be specified, but not both. | | **path** path | | Remote absolute path where the certificate file is loaded from. Either *path* or *content* must be specified, but not both. | | **select\_crypto\_backend** string | **Choices:*** **auto** ← * cryptography * pyopenssl | Determines which crypto backend to use. The default choice is `auto`, which tries to use `cryptography` if available, and falls back to `pyopenssl`. If set to `pyopenssl`, will try to use the [pyOpenSSL](https://pypi.org/project/pyOpenSSL/) library. If set to `cryptography`, will try to use the [cryptography](https://cryptography.io/) library. Please note that the `pyopenssl` backend has been deprecated in Ansible 2.9, and will be removed in community.crypto 2.0.0. From that point on, only the `cryptography` backend will be available. | | **valid\_at** dictionary | | A dict of names mapping to time specifications. Every time specified here will be checked whether the certificate is valid at this point. See the `valid_at` return value for informations on the result. Time can be specified either as relative time or as absolute timestamp. Time will always be interpreted as UTC. Valid format is `[+-]timespec | ASN.1 TIME` where timespec can be an integer + `[w | d | h | m | s]` (e.g. `+32w1d2h`, and ASN.1 TIME (in other words, pattern `YYYYMMDDHHMMSSZ`). Note that all timestamps will be treated as being in UTC. | Notes ----- Note * All timestamp values are provided in ASN.1 TIME format, in other words, following the `YYYYMMDDHHMMSSZ` pattern. They are all in UTC. * Supports `check_mode`. See Also -------- See also [community.crypto.x509\_certificate](x509_certificate_module#ansible-collections-community-crypto-x509-certificate-module) The official documentation on the **community.crypto.x509\_certificate** module. [community.crypto.x509\_certificate\_pipe](x509_certificate_pipe_module#ansible-collections-community-crypto-x509-certificate-pipe-module) The official documentation on the **community.crypto.x509\_certificate\_pipe** module. Examples -------- ``` - name: Generate a Self Signed OpenSSL certificate community.crypto.x509_certificate: path: /etc/ssl/crt/ansible.com.crt privatekey_path: /etc/ssl/private/ansible.com.pem csr_path: /etc/ssl/csr/ansible.com.csr provider: selfsigned # Get information on the certificate - name: Get information on generated certificate community.crypto.x509_certificate_info: path: /etc/ssl/crt/ansible.com.crt register: result - name: Dump information ansible.builtin.debug: var: result # Check whether the certificate is valid or not valid at certain times, fail # if this is not the case. The first task (x509_certificate_info) collects # the information, and the second task (assert) validates the result and # makes the playbook fail in case something is not as expected. - name: Test whether that certificate is valid tomorrow and/or in three weeks community.crypto.x509_certificate_info: path: /etc/ssl/crt/ansible.com.crt valid_at: point_1: "+1d" point_2: "+3w" register: result - name: Validate that certificate is valid tomorrow, but not in three weeks assert: that: - result.valid_at.point_1 # valid in one day - not result.valid_at.point_2 # not valid in three weeks ``` 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 | | --- | --- | --- | | **authority\_cert\_issuer** list / elements=string | success and if the pyOpenSSL backend is *not* used | The certificate's authority cert issuer as a list of general names. Is `none` if the `AuthorityKeyIdentifier` extension is not present. **Sample:** [DNS:www.ansible.com, IP:1.2.3.4] | | **authority\_cert\_serial\_number** integer | success and if the pyOpenSSL backend is *not* used | The certificate's authority cert serial number. Is `none` if the `AuthorityKeyIdentifier` extension is not present. **Sample:** 12345 | | **authority\_key\_identifier** string | success and if the pyOpenSSL backend is *not* used | The certificate's authority key identifier. The identifier is returned in hexadecimal, with `:` used to separate bytes. Is `none` if the `AuthorityKeyIdentifier` extension is not present. **Sample:** 00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff:00:11:22:33 | | **basic\_constraints** list / elements=string | success | Entries in the `basic_constraints` extension, or `none` if extension is not present. **Sample:** [CA:TRUE, pathlen:1] | | **basic\_constraints\_critical** boolean | success | Whether the `basic_constraints` extension is critical. | | **expired** boolean | success | Whether the certificate is expired (in other words, `notAfter` is in the past). | | **extended\_key\_usage** list / elements=string | success | Entries in the `extended_key_usage` extension, or `none` if extension is not present. **Sample:** [Biometric Info, DVCS, Time Stamping] | | **extended\_key\_usage\_critical** boolean | success | Whether the `extended_key_usage` extension is critical. | | **extensions\_by\_oid** dictionary | success | Returns a dictionary for every extension OID. **Sample:** {"1.3.6.1.5.5.7.1.24": { "critical": false, "value": "MAMCAQU="}} | | | **critical** boolean | success | Whether the extension is critical. | | | **value** string | success | The Base64 encoded value (in DER format) of the extension. **Sample:** MAMCAQU= | | **fingerprints** dictionary added in 1.2.0 of community.crypto | success | Fingerprints of the DER-encoded form of the whole certificate. For every hash algorithm available, the fingerprint is computed. **Sample:** {'sha256': 'd4:b3:aa:6d:c8:04:ce:4e:ba:f6:29:4d:92:a3:94:b0:c2:ff:bd:bf:33:63:11:43:34:0f:51:b0:95:09:2f:63', 'sha512': 'f7:07:4a:f0:b0:f0:e6:8b:95:5f:f9:e6:61:0a:32:68:f1... | | **issuer** dictionary | success | The certificate's issuer. Note that for repeated values, only the last one will be returned. **Sample:** {"organizationName": "Ansible", "commonName": "ca.example.com"} | | **issuer\_ordered** list / elements=list | success | The certificate's issuer as an ordered list of tuples. **Sample:** [["organizationName", "Ansible"], ["commonName": "ca.example.com"]] | | **key\_usage** string | success | Entries in the `key_usage` extension, or `none` if extension is not present. **Sample:** [Key Agreement, Data Encipherment] | | **key\_usage\_critical** boolean | success | Whether the `key_usage` extension is critical. | | **not\_after** string | success | `notAfter` date as ASN.1 TIME. **Sample:** 20190413202428Z | | **not\_before** string | success | `notBefore` date as ASN.1 TIME. **Sample:** 20190331202428Z | | **ocsp\_must\_staple** boolean | success | `yes` if the OCSP Must Staple extension is present, `none` otherwise. | | **ocsp\_must\_staple\_critical** boolean | success | Whether the `ocsp_must_staple` extension is critical. | | **ocsp\_uri** string | success | The OCSP responder URI, if included in the certificate. Will be `none` if no OCSP responder URI is included. | | **public\_key** string | success | Certificate's public key in PEM format. **Sample:** -----BEGIN PUBLIC KEY----- MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A... | | **public\_key\_data** dictionary added in 1.7.0 of community.crypto | success | Public key data. Depends on the public key's type. | | | **curve** string | When `public_key_type=ECC` | The curve's name for ECC. | | | **exponent** integer | When `public_key_type=RSA` | The RSA key's public exponent. | | | **exponent\_size** integer | When `public_key_type=ECC` | The maximum number of bits of a private key. This is basically the bit size of the subgroup used. | | | **g** integer | When `public_key_type=DSA` | The `g` value for DSA. This is the element spanning the subgroup of the multiplicative group of the prime field used. | | | **modulus** integer | When `public_key_type=RSA` | The RSA key's modulus. | | | **p** integer | When `public_key_type=DSA` | The `p` value for DSA. This is the prime modulus upon which arithmetic takes place. | | | **q** integer | When `public_key_type=DSA` | The `q` value for DSA. This is a prime that divides `p - 1`, and at the same time the order of the subgroup of the multiplicative group of the prime field used. | | | **size** integer | When `public_key_type=RSA` or `public_key_type=DSA` | Bit size of modulus (RSA) or prime number (DSA). | | | **x** integer | When `public_key_type=ECC` | The `x` coordinate for the public point on the elliptic curve. | | | **y** integer | When `public_key_type=DSA` or `public_key_type=ECC` | For `public_key_type=ECC`, this is the `y` coordinate for the public point on the elliptic curve. For `public_key_type=DSA`, this is the publicly known group element whose discrete logarithm w.r.t. `g` is the private key. | | **public\_key\_fingerprints** dictionary | success | Fingerprints of certificate's public key. For every hash algorithm available, the fingerprint is computed. **Sample:** {'sha256': 'd4:b3:aa:6d:c8:04:ce:4e:ba:f6:29:4d:92:a3:94:b0:c2:ff:bd:bf:33:63:11:43:34:0f:51:b0:95:09:2f:63', 'sha512': 'f7:07:4a:f0:b0:f0:e6:8b:95:5f:f9:e6:61:0a:32:68:f1... | | **public\_key\_type** string added in 1.7.0 of community.crypto | success | The certificate's public key's type. One of `RSA`, `DSA`, `ECC`, `Ed25519`, `X25519`, `Ed448`, or `X448`. Will start with `unknown` if the key type cannot be determined. **Sample:** RSA | | **serial\_number** integer | success | The certificate's serial number. **Sample:** 1234 | | **signature\_algorithm** string | success | The signature algorithm used to sign the certificate. **Sample:** sha256WithRSAEncryption | | **subject** dictionary | success | The certificate's subject as a dictionary. Note that for repeated values, only the last one will be returned. **Sample:** {"commonName": "www.example.com", "emailAddress": "[email protected]"} | | **subject\_alt\_name** list / elements=string | success | Entries in the `subject_alt_name` extension, or `none` if extension is not present. **Sample:** [DNS:www.ansible.com, IP:1.2.3.4] | | **subject\_alt\_name\_critical** boolean | success | Whether the `subject_alt_name` extension is critical. | | **subject\_key\_identifier** string | success and if the pyOpenSSL backend is *not* used | The certificate's subject key identifier. The identifier is returned in hexadecimal, with `:` used to separate bytes. Is `none` if the `SubjectKeyIdentifier` extension is not present. **Sample:** 00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff:00:11:22:33 | | **subject\_ordered** list / elements=list | success | The certificate's subject as an ordered list of tuples. **Sample:** [["commonName", "www.example.com"], ["emailAddress": "[email protected]"]] | | **valid\_at** dictionary | success | For every time stamp provided in the *valid\_at* option, a boolean whether the certificate is valid at that point in time or not. | | **version** integer | success | The certificate version. **Sample:** 3 | ### Authors * Felix Fontein (@felixfontein) * Yanis Guenane (@Spredzy) * Markus Teufelberger (@MarkusTeufelberger)
programming_docs
ansible community.crypto.luks_device – Manage encrypted (LUKS) devices community.crypto.luks\_device – Manage encrypted (LUKS) devices =============================================================== Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.luks_device`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Module manages [LUKS](https://en.wikipedia.org/wiki/Linux_Unified_Key_Setup) on given device. Supports creating, destroying, opening and closing of LUKS container and adding or removing new keys and passphrases. Requirements ------------ The below requirements are needed on the host that executes this module. * cryptsetup * wipefs (when *state* is `absent`) * lsblk * blkid (when *label* or *uuid* options are used) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **cipher** string added in 1.1.0 of community.crypto | | This option allows the user to define the cipher specification string for the LUKS container. Will only be used on container creation. For pre-2.6.10 kernels, use `aes-plain` as they don't understand the new cipher spec strings. To use ESSIV, use `aes-cbc-essiv:sha256`. | | **device** string | | Device to work with (e.g. `/dev/sda1`). Needed in most cases. Can be omitted only when *state=closed* together with *name* is provided. | | **force\_remove\_last\_key** boolean | **Choices:*** **no** ← * yes | If set to `yes`, allows removing the last key from a container. BEWARE that when the last key has been removed from a container, the container can no longer be opened! | | **hash** string added in 1.1.0 of community.crypto | | This option allows the user to specify the hash function used in LUKS key setup scheme and volume key digest. Will only be used on container creation. | | **keyfile** path | | Used to unlock the container. Either a *keyfile* or a *passphrase* is needed for most of the operations. Parameter value is the path to the keyfile with the passphrase. BEWARE that working with keyfiles in plaintext is dangerous. Make sure that they are protected. | | **keysize** integer added in 1.0.0 of community.crypto | | Sets the key size only if LUKS container does not exist. | | **label** string added in 1.0.0 of community.crypto | | This option allow the user to create a LUKS2 format container with label support, respectively to identify the container by label on later usages. Will only be used on container creation, or when *device* is not specified. This cannot be specified if *type* is set to `luks1`. | | **name** string | | Sets container name when *state=opened*. Can be used instead of *device* when closing the existing container (i.e. when *state=closed*). | | **new\_keyfile** path | | Adds additional key to given container on *device*. Needs *keyfile* or *passphrase* option for authorization. LUKS container supports up to 8 keyslots. Parameter value is the path to the keyfile with the passphrase. NOTE that adding additional keys is idempotent only since community.crypto 1.4.0. For older versions, a new keyslot will be used even if another keyslot already exists for this keyfile. BEWARE that working with keyfiles in plaintext is dangerous. Make sure that they are protected. | | **new\_passphrase** string added in 1.0.0 of community.crypto | | Adds additional passphrase to given container on *device*. Needs *keyfile* or *passphrase* option for authorization. LUKS container supports up to 8 keyslots. Parameter value is a string with the new passphrase. NOTE that adding additional passphrase is idempotent only since community.crypto 1.4.0. For older versions, a new keyslot will be used even if another keyslot already exists for this passphrase. | | **passphrase** string added in 1.0.0 of community.crypto | | Used to unlock the container. Either a *passphrase* or a *keyfile* is needed for most of the operations. Parameter value is a string with the passphrase. | | **pbkdf** dictionary added in 1.4.0 of community.crypto | | This option allows the user to configure the Password-Based Key Derivation Function (PBKDF) used. Will only be used on container creation, and when adding keys to an existing container. | | | **algorithm** string | **Choices:*** argon2i * argon2id * pbkdf2 | The algorithm to use. Only available for the LUKS 2 format. | | | **iteration\_count** integer | | Specify the iteration count used for the PBKDF. Mutually exclusive with *iteration\_time*. | | | **iteration\_time** float | | Specify the iteration time used for the PBKDF. Note that this is in **seconds**, not in milliseconds as on the command line. Mutually exclusive with *iteration\_count*. | | | **memory** integer | | The memory cost limit in kilobytes for the PBKDF. This is not used for PBKDF2, but only for the Argon PBKDFs. | | | **parallel** integer | | The parallel cost for the PBKDF. This is the number of threads that run in parallel. This is not used for PBKDF2, but only for the Argon PBKDFs. | | **remove\_keyfile** path | | Removes given key from the container on *device*. Does not remove the keyfile from filesystem. Parameter value is the path to the keyfile with the passphrase. NOTE that removing keys is idempotent only since community.crypto 1.4.0. For older versions, trying to remove a key which no longer exists results in an error. NOTE that to remove the last key from a LUKS container, the *force\_remove\_last\_key* option must be set to `yes`. BEWARE that working with keyfiles in plaintext is dangerous. Make sure that they are protected. | | **remove\_passphrase** string added in 1.0.0 of community.crypto | | Removes given passphrase from the container on *device*. Parameter value is a string with the passphrase to remove. NOTE that removing passphrases is idempotent only since community.crypto 1.4.0. For older versions, trying to remove a passphrase which no longer exists results in an error. NOTE that to remove the last keyslot from a LUKS container, the *force\_remove\_last\_key* option must be set to `yes`. | | **sector\_size** integer added in 1.5.0 of community.crypto | | This option allows the user to specify the sector size (in bytes) used for LUKS2 containers. Will only be used on container creation. | | **state** string | **Choices:*** **present** ← * absent * opened * closed | Desired state of the LUKS container. Based on its value creates, destroys, opens or closes the LUKS container on a given device. *present* will create LUKS container unless already present. Requires *device* and either *keyfile* or *passphrase* options to be provided. *absent* will remove existing LUKS container if it exists. Requires *device* or *name* to be specified. *opened* will unlock the LUKS container. If it does not exist it will be created first. Requires *device* and either *keyfile* or *passphrase* to be specified. Use the *name* option to set the name of the opened container. Otherwise the name will be generated automatically and returned as a part of the result. *closed* will lock the LUKS container. However if the container does not exist it will be created. Requires *device* and either *keyfile* or *passphrase* options to be provided. If container does already exist *device* or *name* will suffice. | | **type** string added in 1.0.0 of community.crypto | **Choices:*** luks1 * luks2 | This option allow the user explicit define the format of LUKS container that wants to work with. Options are `luks1` or `luks2` | | **uuid** string added in 1.0.0 of community.crypto | | With this option user can identify the LUKS container by UUID. Will only be used when *device* and *label* are not specified. | Examples -------- ``` - name: Create LUKS container (remains unchanged if it already exists) community.crypto.luks_device: device: "/dev/loop0" state: "present" keyfile: "/vault/keyfile" - name: Create LUKS container with a passphrase community.crypto.luks_device: device: "/dev/loop0" state: "present" passphrase: "foo" - name: Create LUKS container with specific encryption community.crypto.luks_device: device: "/dev/loop0" state: "present" cipher: "aes" hash: "sha256" - name: (Create and) open the LUKS container; name it "mycrypt" community.crypto.luks_device: device: "/dev/loop0" state: "opened" name: "mycrypt" keyfile: "/vault/keyfile" - name: Close the existing LUKS container "mycrypt" community.crypto.luks_device: state: "closed" name: "mycrypt" - name: Make sure LUKS container exists and is closed community.crypto.luks_device: device: "/dev/loop0" state: "closed" keyfile: "/vault/keyfile" - name: Create container if it does not exist and add new key to it community.crypto.luks_device: device: "/dev/loop0" state: "present" keyfile: "/vault/keyfile" new_keyfile: "/vault/keyfile2" - name: Add new key to the LUKS container (container has to exist) community.crypto.luks_device: device: "/dev/loop0" keyfile: "/vault/keyfile" new_keyfile: "/vault/keyfile2" - name: Add new passphrase to the LUKS container community.crypto.luks_device: device: "/dev/loop0" keyfile: "/vault/keyfile" new_passphrase: "foo" - name: Remove existing keyfile from the LUKS container community.crypto.luks_device: device: "/dev/loop0" remove_keyfile: "/vault/keyfile2" - name: Remove existing passphrase from the LUKS container community.crypto.luks_device: device: "/dev/loop0" remove_passphrase: "foo" - name: Completely remove the LUKS container and its contents community.crypto.luks_device: device: "/dev/loop0" state: "absent" - name: Create a container with label community.crypto.luks_device: device: "/dev/loop0" state: "present" keyfile: "/vault/keyfile" label: personalLabelName - name: Open the LUKS container based on label without device; name it "mycrypt" community.crypto.luks_device: label: "personalLabelName" state: "opened" name: "mycrypt" keyfile: "/vault/keyfile" - name: Close container based on UUID community.crypto.luks_device: uuid: 03ecd578-fad4-4e6c-9348-842e3e8fa340 state: "closed" name: "mycrypt" - name: Create a container using luks2 format community.crypto.luks_device: device: "/dev/loop0" state: "present" keyfile: "/vault/keyfile" type: luks2 ``` 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 | | --- | --- | --- | | **name** string | success | When *state=opened* returns (generated or given) name of LUKS container. Returns None if no name is supplied. **Sample:** luks-c1da9a58-2fde-4256-9d9f-6ab008b4dd1b | ### Authors * Jan Pokorny (@japokorn) ansible community.crypto.x509_certificate – Generate and/or check OpenSSL certificates community.crypto.x509\_certificate – Generate and/or check OpenSSL certificates =============================================================================== Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.x509_certificate`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * If both the cryptography and PyOpenSSL libraries are available (and meet the minimum version requirements) cryptography will be preferred as a backend over PyOpenSSL (unless the backend is forced with `select_crypto_backend`). Please note that the PyOpenSSL backend was deprecated in Ansible 2.9 and will be removed in community.crypto 2.0.0. * It implements a notion of provider (ie. `selfsigned`, `ownca`, `acme`, `assertonly`, `entrust`) for your certificate. * It uses the pyOpenSSL or cryptography python library to interact with OpenSSL. * Many properties that can be specified in this module are for validation of an existing or newly generated certificate. The proper place to specify them, if you want to receive a certificate with these properties is a CSR (Certificate Signing Request). * Note that this module was called `openssl_certificate` when included directly in Ansible up to version 2.9. When moved to the collection `community.crypto`, it was renamed to [community.crypto.x509\_certificate](#ansible-collections-community-crypto-x509-certificate-module). From Ansible 2.10 on, it can still be used by the old short name (or by `ansible.builtin.openssl_certificate`), which redirects to `community.crypto.x509_certificate`. When using FQCNs or when using the [collections](../../../user_guide/collections_using#using-collections-in-a-playbook) keyword, the new name [community.crypto.x509\_certificate](#ansible-collections-community-crypto-x509-certificate-module) should be used to avoid a deprecation warning. * Please note that the module regenerates existing certificate if it does not match the module’s options, or if it seems to be corrupt. If you are concerned that this could overwrite your existing certificate, consider using the *backup* option. * The `assertonly` provider is intended for use cases where one is only interested in checking properties of a supplied certificate. Please note that this provider has been deprecated in Ansible 2.9 and will be removed in community.crypto 2.0.0. See the examples on how to emulate `assertonly` usage with [community.crypto.x509\_certificate\_info](x509_certificate_info_module#ansible-collections-community-crypto-x509-certificate-info-module), [community.crypto.openssl\_csr\_info](openssl_csr_info_module#ansible-collections-community-crypto-openssl-csr-info-module), [community.crypto.openssl\_privatekey\_info](openssl_privatekey_info_module#ansible-collections-community-crypto-openssl-privatekey-info-module) and [ansible.builtin.assert](../../ansible/builtin/assert_module#ansible-collections-ansible-builtin-assert-module). This also allows more flexible checks than the ones offered by the `assertonly` provider. * The `ownca` provider is intended for generating an OpenSSL certificate signed with your own CA (Certificate Authority) certificate (self-signed certificate). * This module allows one to (re)generate OpenSSL certificates. Requirements ------------ The below requirements are needed on the host that executes this module. * PyOpenSSL >= 0.15 or cryptography >= 1.6 (if using `selfsigned`, `ownca` or `assertonly` provider) * acme-tiny >= 4.0.0 (if using the `acme` provider) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **acme\_accountkey\_path** path | | The path to the accountkey for the `acme` provider. This is only used by the `acme` provider. | | **acme\_chain** boolean | **Choices:*** **no** ← * yes | Include the intermediate certificate to the generated certificate This is only used by the `acme` provider. Note that this is only available for older versions of `acme-tiny`. New versions include the chain automatically, and setting *acme\_chain* to `yes` results in an error. | | **acme\_challenge\_path** path | | The path to the ACME challenge directory that is served on [http://<HOST>:80/.well-known/acme-challenge/](#) This is only used by the `acme` provider. | | **acme\_directory** string added in 1.0.0 of community.crypto | **Default:**"https://acme-v02.api.letsencrypt.org/directory" | The ACME directory to use. You can use any directory that supports the ACME protocol, such as Buypass or Let's Encrypt. Let's Encrypt recommends using their staging server while developing jobs. <https://letsencrypt.org/docs/staging-environment/>. | | **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 | | **backup** boolean | **Choices:*** **no** ← * yes | Create a backup file including a timestamp so you can get the original certificate back if you overwrote it with a new one by accident. This is not used by the `assertonly` provider. This option is deprecated since Ansible 2.9 and will be removed with the `assertonly` provider in community.crypto 2.0.0. For alternatives, see the example on replacing `assertonly`. | | **csr\_content** string added in 1.0.0 of community.crypto | | Content of the Certificate Signing Request (CSR) used to generate this certificate. This is mutually exclusive with *csr\_path*. | | **csr\_path** path | | Path to the Certificate Signing Request (CSR) used to generate this certificate. This is mutually exclusive with *csr\_content*. | | **entrust\_api\_client\_cert\_key\_path** path | | The path to the private key of the client certificate used to authenticate to the Entrust Certificate Services (ECS) API. This is only used by the `entrust` provider. This is required if the provider is `entrust`. | | **entrust\_api\_client\_cert\_path** path | | The path to the client certificate used to authenticate to the Entrust Certificate Services (ECS) API. This is only used by the `entrust` provider. This is required if the provider is `entrust`. | | **entrust\_api\_key** string | | The key (password) for authentication to the Entrust Certificate Services (ECS) API. This is only used by the `entrust` provider. This is required if the provider is `entrust`. | | **entrust\_api\_specification\_path** path | **Default:**"https://cloud.entrust.net/EntrustCloud/documentation/cms-api-2.1.0.yaml" | The path to the specification file defining the Entrust Certificate Services (ECS) API configuration. You can use this to keep a local copy of the specification to avoid downloading it every time the module is used. This is only used by the `entrust` provider. | | **entrust\_api\_user** string | | The username for authentication to the Entrust Certificate Services (ECS) API. This is only used by the `entrust` provider. This is required if the provider is `entrust`. | | **entrust\_cert\_type** string | **Choices:*** **STANDARD\_SSL** ← * ADVANTAGE\_SSL * UC\_SSL * EV\_SSL * WILDCARD\_SSL * PRIVATE\_SSL * PD\_SSL * CDS\_ENT\_LITE * CDS\_ENT\_PRO * SMIME\_ENT | Specify the type of certificate requested. This is only used by the `entrust` provider. | | **entrust\_not\_after** string | **Default:**"+365d" | The point in time at which the certificate stops being valid. Time can be specified either as relative time or as an absolute timestamp. A valid absolute time format is `ASN.1 TIME` such as `2019-06-18`. A valid relative time format is `[+-]timespec` where timespec can be an integer + `[w | d | h | m | s]`, such as `+365d` or `+32w1d2h`). Time will always be interpreted as UTC. Note that only the date (day, month, year) is supported for specifying the expiry date of the issued certificate. The full date-time is adjusted to EST (GMT -5:00) before issuance, which may result in a certificate with an expiration date one day earlier than expected if a relative time is used. The minimum certificate lifetime is 90 days, and maximum is three years. If this value is not specified, the certificate will stop being valid 365 days the date of issue. This is only used by the `entrust` provider. | | **entrust\_requester\_email** string | | The email of the requester of the certificate (for tracking purposes). This is only used by the `entrust` provider. This is required if the provider is `entrust`. | | **entrust\_requester\_name** string | | The name of the requester of the certificate (for tracking purposes). This is only used by the `entrust` provider. This is required if the provider is `entrust`. | | **entrust\_requester\_phone** string | | The phone number of the requester of the certificate (for tracking purposes). This is only used by the `entrust` provider. This is required if the provider is `entrust`. | | **extended\_key\_usage** list / elements=string | | The *extended\_key\_usage* extension field must contain all these values. This is only used by the `assertonly` provider. This option is deprecated since Ansible 2.9 and will be removed with the `assertonly` provider in community.crypto 2.0.0. For alternatives, see the example on replacing `assertonly`. aliases: extendedKeyUsage | | **extended\_key\_usage\_strict** boolean | **Choices:*** **no** ← * yes | If set to `yes`, the *extended\_key\_usage* extension field must contain only these values. This is only used by the `assertonly` provider. This option is deprecated since Ansible 2.9 and will be removed with the `assertonly` provider in community.crypto 2.0.0. For alternatives, see the example on replacing `assertonly`. aliases: extendedKeyUsage\_strict | | **force** boolean | **Choices:*** **no** ← * yes | Generate the certificate, even if it already exists. | | **group** string | | Name of the group that should own the file/directory, as would be fed to *chown*. | | **has\_expired** boolean | **Choices:*** **no** ← * yes | Checks if the certificate is expired/not expired at the time the module is executed. This is only used by the `assertonly` provider. This option is deprecated since Ansible 2.9 and will be removed with the `assertonly` provider in community.crypto 2.0.0. For alternatives, see the example on replacing `assertonly`. | | **invalid\_at** string | | The certificate must be invalid at this point in time. The timestamp is formatted as an ASN.1 TIME. This is only used by the `assertonly` provider. This option is deprecated since Ansible 2.9 and will be removed with the `assertonly` provider in community.crypto 2.0.0. For alternatives, see the example on replacing `assertonly`. | | **issuer** dictionary | | The key/value pairs that must be present in the issuer name field of the certificate. If you need to specify more than one value with the same key, use a list as value. This is only used by the `assertonly` provider. This option is deprecated since Ansible 2.9 and will be removed with the `assertonly` provider in community.crypto 2.0.0. For alternatives, see the example on replacing `assertonly`. | | **issuer\_strict** boolean | **Choices:*** **no** ← * yes | If set to `yes`, the *issuer* field must contain only these values. This is only used by the `assertonly` provider. This option is deprecated since Ansible 2.9 and will be removed with the `assertonly` provider in community.crypto 2.0.0. For alternatives, see the example on replacing `assertonly`. | | **key\_usage** list / elements=string | | The *key\_usage* extension field must contain all these values. This is only used by the `assertonly` provider. This option is deprecated since Ansible 2.9 and will be removed with the `assertonly` provider in community.crypto 2.0.0. For alternatives, see the example on replacing `assertonly`. aliases: keyUsage | | **key\_usage\_strict** boolean | **Choices:*** **no** ← * yes | If set to `yes`, the *key\_usage* extension field must contain only these values. This is only used by the `assertonly` provider. This option is deprecated since Ansible 2.9 and will be removed with the `assertonly` provider in community.crypto 2.0.0. For alternatives, see the example on replacing `assertonly`. aliases: keyUsage\_strict | | **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. | | **not\_after** string | | The certificate must expire at this point in time. The timestamp is formatted as an ASN.1 TIME. This is only used by the `assertonly` provider. This option is deprecated since Ansible 2.9 and will be removed with the `assertonly` provider in community.crypto 2.0.0. For alternatives, see the example on replacing `assertonly`. aliases: notAfter | | **not\_before** string | | The certificate must start to become valid at this point in time. The timestamp is formatted as an ASN.1 TIME. This is only used by the `assertonly` provider. This option is deprecated since Ansible 2.9 and will be removed with the `assertonly` provider in community.crypto 2.0.0. For alternatives, see the example on replacing `assertonly`. aliases: notBefore | | **ownca\_content** string added in 1.0.0 of community.crypto | | Content of the CA (Certificate Authority) certificate. This is only used by the `ownca` provider. This is mutually exclusive with *ownca\_path*. | | **ownca\_create\_authority\_key\_identifier** boolean | **Choices:*** no * **yes** ← | Create a Authority Key Identifier from the CA's certificate. If the CSR provided a authority key identifier, it is ignored. The Authority Key Identifier is generated from the CA certificate's Subject Key Identifier, if available. If it is not available, the CA certificate's public key will be used. This is only used by the `ownca` provider. Note that this is only supported if the `cryptography` backend is used! | | **ownca\_create\_subject\_key\_identifier** string | **Choices:*** **create\_if\_not\_provided** ← * always\_create * never\_create | Whether to create the Subject Key Identifier (SKI) from the public key. A value of `create_if_not_provided` (default) only creates a SKI when the CSR does not provide one. A value of `always_create` always creates a SKI. If the CSR provides one, that one is ignored. A value of `never_create` never creates a SKI. If the CSR provides one, that one is used. This is only used by the `ownca` provider. Note that this is only supported if the `cryptography` backend is used! | | **ownca\_digest** string | **Default:**"sha256" | The digest algorithm to be used for the `ownca` certificate. This is only used by the `ownca` provider. | | **ownca\_not\_after** string | **Default:**"+3650d" | The point in time at which the certificate stops being valid. Time can be specified either as relative time or as absolute timestamp. Time will always be interpreted as UTC. Valid format is `[+-]timespec | ASN.1 TIME` where timespec can be an integer + `[w | d | h | m | s]` (e.g. `+32w1d2h`. If this value is not specified, the certificate will stop being valid 10 years from now. Note that this value is **not used to determine whether an existing certificate should be regenerated**. This is only used by the `ownca` provider. On macOS 10.15 and onwards, TLS server certificates must have a validity period of 825 days or fewer. Please see <https://support.apple.com/en-us/HT210176> for more details. | | **ownca\_not\_before** string | **Default:**"+0s" | The point in time the certificate is valid from. Time can be specified either as relative time or as absolute timestamp. Time will always be interpreted as UTC. Valid format is `[+-]timespec | ASN.1 TIME` where timespec can be an integer + `[w | d | h | m | s]` (e.g. `+32w1d2h`. If this value is not specified, the certificate will start being valid from now. Note that this value is **not used to determine whether an existing certificate should be regenerated**. This is only used by the `ownca` provider. | | **ownca\_path** path | | Remote absolute path of the CA (Certificate Authority) certificate. This is only used by the `ownca` provider. This is mutually exclusive with *ownca\_content*. | | **ownca\_privatekey\_content** string added in 1.0.0 of community.crypto | | Content of the CA (Certificate Authority) private key to use when signing the certificate. This is only used by the `ownca` provider. This is mutually exclusive with *ownca\_privatekey\_path*. | | **ownca\_privatekey\_passphrase** string | | The passphrase for the *ownca\_privatekey\_path* resp. *ownca\_privatekey\_content*. This is only used by the `ownca` provider. | | **ownca\_privatekey\_path** path | | Path to the CA (Certificate Authority) private key to use when signing the certificate. This is only used by the `ownca` provider. This is mutually exclusive with *ownca\_privatekey\_content*. | | **ownca\_version** integer | **Default:**3 | The version of the `ownca` certificate. Nowadays it should almost always be `3`. This is only used by the `ownca` provider. | | **owner** string | | Name of the user that should own the file/directory, as would be fed to *chown*. | | **path** path / required | | Remote absolute path where the generated certificate file should be created or is already located. | | **privatekey\_content** string added in 1.0.0 of community.crypto | | Path to the private key to use when signing the certificate. This is mutually exclusive with *privatekey\_path*. | | **privatekey\_passphrase** string | | The passphrase for the *privatekey\_path* resp. *privatekey\_content*. This is required if the private key is password protected. | | **privatekey\_path** path | | Path to the private key to use when signing the certificate. This is mutually exclusive with *privatekey\_content*. | | **provider** string | **Choices:*** acme * assertonly * entrust * ownca * selfsigned | Name of the provider to use to generate/retrieve the OpenSSL certificate. The `assertonly` provider will not generate files and fail if the certificate file is missing. The `assertonly` provider has been deprecated in Ansible 2.9 and will be removed in community.crypto 2.0.0. Please see the examples on how to emulate it with [community.crypto.x509\_certificate\_info](x509_certificate_info_module), [community.crypto.openssl\_csr\_info](openssl_csr_info_module), [community.crypto.openssl\_privatekey\_info](openssl_privatekey_info_module) and [ansible.builtin.assert](../../ansible/builtin/assert_module). The `entrust` provider was added for Ansible 2.9 and requires credentials for the [Entrust Certificate Services](https://www.entrustdatacard.com/products/categories/ssl-certificates) (ECS) API. Required if *state* is `present`. | | **return\_content** boolean added in 1.0.0 of community.crypto | **Choices:*** **no** ← * yes | If set to `yes`, will return the (current or generated) certificate's content as *certificate*. | | **select\_crypto\_backend** string | **Choices:*** **auto** ← * cryptography * pyopenssl | Determines which crypto backend to use. The default choice is `auto`, which tries to use `cryptography` if available, and falls back to `pyopenssl`. If set to `pyopenssl`, will try to use the [pyOpenSSL](https://pypi.org/project/pyOpenSSL/) library. If set to `cryptography`, will try to use the [cryptography](https://cryptography.io/) library. Please note that the `pyopenssl` backend has been deprecated in Ansible 2.9, and will be removed in community.crypto 2.0.0. From that point on, only the `cryptography` backend will be available. | | **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. | | **selfsigned\_create\_subject\_key\_identifier** string | **Choices:*** **create\_if\_not\_provided** ← * always\_create * never\_create | Whether to create the Subject Key Identifier (SKI) from the public key. A value of `create_if_not_provided` (default) only creates a SKI when the CSR does not provide one. A value of `always_create` always creates a SKI. If the CSR provides one, that one is ignored. A value of `never_create` never creates a SKI. If the CSR provides one, that one is used. This is only used by the `selfsigned` provider. Note that this is only supported if the `cryptography` backend is used! | | **selfsigned\_digest** string | **Default:**"sha256" | Digest algorithm to be used when self-signing the certificate. This is only used by the `selfsigned` provider. | | **selfsigned\_not\_after** string | **Default:**"+3650d" | The point in time at which the certificate stops being valid. Time can be specified either as relative time or as absolute timestamp. Time will always be interpreted as UTC. Valid format is `[+-]timespec | ASN.1 TIME` where timespec can be an integer + `[w | d | h | m | s]` (e.g. `+32w1d2h`. If this value is not specified, the certificate will stop being valid 10 years from now. Note that this value is **not used to determine whether an existing certificate should be regenerated**. This is only used by the `selfsigned` provider. On macOS 10.15 and onwards, TLS server certificates must have a validity period of 825 days or fewer. Please see <https://support.apple.com/en-us/HT210176> for more details. aliases: selfsigned\_notAfter | | **selfsigned\_not\_before** string | **Default:**"+0s" | The point in time the certificate is valid from. Time can be specified either as relative time or as absolute timestamp. Time will always be interpreted as UTC. Valid format is `[+-]timespec | ASN.1 TIME` where timespec can be an integer + `[w | d | h | m | s]` (e.g. `+32w1d2h`. If this value is not specified, the certificate will start being valid from now. Note that this value is **not used to determine whether an existing certificate should be regenerated**. This is only used by the `selfsigned` provider. aliases: selfsigned\_notBefore | | **selfsigned\_version** integer | **Default:**3 | Version of the `selfsigned` certificate. Nowadays it should almost always be `3`. This is only used by the `selfsigned` provider. | | **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. | | **signature\_algorithms** list / elements=string | | A list of algorithms that you would accept the certificate to be signed with (e.g. ['sha256WithRSAEncryption', 'sha512WithRSAEncryption']). This is only used by the `assertonly` provider. This option is deprecated since Ansible 2.9 and will be removed with the `assertonly` provider in community.crypto 2.0.0. For alternatives, see the example on replacing `assertonly`. | | **state** string | **Choices:*** absent * **present** ← | Whether the certificate should exist or not, taking action if the state is different from what is stated. | | **subject** dictionary | | The key/value pairs that must be present in the subject name field of the certificate. If you need to specify more than one value with the same key, use a list as value. This is only used by the `assertonly` provider. This option is deprecated since Ansible 2.9 and will be removed with the `assertonly` provider in community.crypto 2.0.0. For alternatives, see the example on replacing `assertonly`. | | **subject\_alt\_name** list / elements=string | | The *subject\_alt\_name* extension field must contain these values. This is only used by the `assertonly` provider. This option is deprecated since Ansible 2.9 and will be removed with the `assertonly` provider in community.crypto 2.0.0. For alternatives, see the example on replacing `assertonly`. aliases: subjectAltName | | **subject\_alt\_name\_strict** boolean | **Choices:*** **no** ← * yes | If set to `yes`, the *subject\_alt\_name* extension field must contain only these values. This is only used by the `assertonly` provider. This option is deprecated since Ansible 2.9 and will be removed with the `assertonly` provider in community.crypto 2.0.0. For alternatives, see the example on replacing `assertonly`. aliases: subjectAltName\_strict | | **subject\_strict** boolean | **Choices:*** **no** ← * yes | If set to `yes`, the *subject* field must contain only these values. This is only used by the `assertonly` provider. This option is deprecated since Ansible 2.9 and will be removed with the `assertonly` provider in community.crypto 2.0.0. For alternatives, see the example on replacing `assertonly`. | | **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. | | **valid\_at** string | | The certificate must be valid at this point in time. The timestamp is formatted as an ASN.1 TIME. This is only used by the `assertonly` provider. This option is deprecated since Ansible 2.9 and will be removed with the `assertonly` provider in community.crypto 2.0.0. For alternatives, see the example on replacing `assertonly`. | | **valid\_in** string | | The certificate must still be valid at this relative time offset from now. Valid format is `[+-]timespec | number_of_seconds` where timespec can be an integer + `[w | d | h | m | s]` (e.g. `+32w1d2h`. Note that if using this parameter, this module is NOT idempotent. This is only used by the `assertonly` provider. This option is deprecated since Ansible 2.9 and will be removed with the `assertonly` provider in community.crypto 2.0.0. For alternatives, see the example on replacing `assertonly`. | | **version** integer | | The version of the certificate. Nowadays it should almost always be 3. This is only used by the `assertonly` provider. This option is deprecated since Ansible 2.9 and will be removed with the `assertonly` provider in community.crypto 2.0.0. For alternatives, see the example on replacing `assertonly`. | Notes ----- Note * Supports `check_mode`. * All ASN.1 TIME values should be specified following the YYYYMMDDHHMMSSZ pattern. * Date specified should be UTC. Minutes and seconds are mandatory. * For security reason, when you use `ownca` provider, you should NOT run [community.crypto.x509\_certificate](#ansible-collections-community-crypto-x509-certificate-module) on a target machine, but on a dedicated CA machine. It is recommended not to store the CA private key on the target machine. Once signed, the certificate can be moved to the target machine. * For the `selfsigned` provider, *csr\_path* and *csr\_content* are optional. If not provided, a certificate without any information (Subject, Subject Alternative Names, Key Usage, etc.) is created. See Also -------- See also [community.crypto.x509\_certificate\_pipe](x509_certificate_pipe_module#ansible-collections-community-crypto-x509-certificate-pipe-module) The official documentation on the **community.crypto.x509\_certificate\_pipe** module. [community.crypto.openssl\_csr](openssl_csr_module#ansible-collections-community-crypto-openssl-csr-module) The official documentation on the **community.crypto.openssl\_csr** module. [community.crypto.openssl\_csr\_pipe](openssl_csr_pipe_module#ansible-collections-community-crypto-openssl-csr-pipe-module) The official documentation on the **community.crypto.openssl\_csr\_pipe** module. [community.crypto.openssl\_dhparam](openssl_dhparam_module#ansible-collections-community-crypto-openssl-dhparam-module) The official documentation on the **community.crypto.openssl\_dhparam** module. [community.crypto.openssl\_pkcs12](openssl_pkcs12_module#ansible-collections-community-crypto-openssl-pkcs12-module) The official documentation on the **community.crypto.openssl\_pkcs12** module. [community.crypto.openssl\_privatekey](openssl_privatekey_module#ansible-collections-community-crypto-openssl-privatekey-module) The official documentation on the **community.crypto.openssl\_privatekey** module. [community.crypto.openssl\_privatekey\_pipe](openssl_privatekey_pipe_module#ansible-collections-community-crypto-openssl-privatekey-pipe-module) The official documentation on the **community.crypto.openssl\_privatekey\_pipe** module. [community.crypto.openssl\_publickey](openssl_publickey_module#ansible-collections-community-crypto-openssl-publickey-module) The official documentation on the **community.crypto.openssl\_publickey** module. Examples -------- ``` - name: Generate a Self Signed OpenSSL certificate community.crypto.x509_certificate: path: /etc/ssl/crt/ansible.com.crt privatekey_path: /etc/ssl/private/ansible.com.pem csr_path: /etc/ssl/csr/ansible.com.csr provider: selfsigned - name: Generate an OpenSSL certificate signed with your own CA certificate community.crypto.x509_certificate: path: /etc/ssl/crt/ansible.com.crt csr_path: /etc/ssl/csr/ansible.com.csr ownca_path: /etc/ssl/crt/ansible_CA.crt ownca_privatekey_path: /etc/ssl/private/ansible_CA.pem provider: ownca - name: Generate a Let's Encrypt Certificate community.crypto.x509_certificate: path: /etc/ssl/crt/ansible.com.crt csr_path: /etc/ssl/csr/ansible.com.csr provider: acme acme_accountkey_path: /etc/ssl/private/ansible.com.pem acme_challenge_path: /etc/ssl/challenges/ansible.com/ - name: Force (re-)generate a new Let's Encrypt Certificate community.crypto.x509_certificate: path: /etc/ssl/crt/ansible.com.crt csr_path: /etc/ssl/csr/ansible.com.csr provider: acme acme_accountkey_path: /etc/ssl/private/ansible.com.pem acme_challenge_path: /etc/ssl/challenges/ansible.com/ force: yes - name: Generate an Entrust certificate via the Entrust Certificate Services (ECS) API community.crypto.x509_certificate: path: /etc/ssl/crt/ansible.com.crt csr_path: /etc/ssl/csr/ansible.com.csr provider: entrust entrust_requester_name: Jo Doe entrust_requester_email: [email protected] entrust_requester_phone: 555-555-5555 entrust_cert_type: STANDARD_SSL entrust_api_user: apiusername entrust_api_key: a^lv*32!cd9LnT entrust_api_client_cert_path: /etc/ssl/entrust/ecs-client.crt entrust_api_client_cert_key_path: /etc/ssl/entrust/ecs-key.crt entrust_api_specification_path: /etc/ssl/entrust/api-docs/cms-api-2.1.0.yaml # The following example shows one assertonly usage using all existing options for # assertonly, and shows how to emulate the behavior with the x509_certificate_info, # openssl_csr_info, openssl_privatekey_info and assert modules: - name: Usage of assertonly with all existing options community.crypto.x509_certificate: provider: assertonly path: /etc/ssl/crt/ansible.com.crt csr_path: /etc/ssl/csr/ansible.com.csr privatekey_path: /etc/ssl/csr/ansible.com.key signature_algorithms: - sha256WithRSAEncryption - sha512WithRSAEncryption subject: commonName: ansible.com subject_strict: yes issuer: commonName: ansible.com issuer_strict: yes has_expired: no version: 3 key_usage: - Data Encipherment key_usage_strict: yes extended_key_usage: - DVCS extended_key_usage_strict: yes subject_alt_name: - dns:ansible.com subject_alt_name_strict: yes not_before: 20190331202428Z not_after: 20190413202428Z valid_at: "+1d10h" invalid_at: 20200331202428Z valid_in: 10 # in ten seconds - name: Get certificate information community.crypto.x509_certificate_info: path: /etc/ssl/crt/ansible.com.crt # for valid_at, invalid_at and valid_in valid_at: one_day_ten_hours: "+1d10h" fixed_timestamp: 20200331202428Z ten_seconds: "+10" register: result - name: Get CSR information community.crypto.openssl_csr_info: # Verifies that the CSR signature is valid; module will fail if not path: /etc/ssl/csr/ansible.com.csr register: result_csr - name: Get private key information community.crypto.openssl_privatekey_info: path: /etc/ssl/csr/ansible.com.key register: result_privatekey - assert: that: # When private key is specified for assertonly, this will be checked: - result.public_key == result_privatekey.public_key # When CSR is specified for assertonly, this will be checked: - result.public_key == result_csr.public_key - result.subject_ordered == result_csr.subject_ordered - result.extensions_by_oid == result_csr.extensions_by_oid # signature_algorithms check - "result.signature_algorithm == 'sha256WithRSAEncryption' or result.signature_algorithm == 'sha512WithRSAEncryption'" # subject and subject_strict - "result.subject.commonName == 'ansible.com'" - "result.subject | length == 1" # the number must be the number of entries you check for # issuer and issuer_strict - "result.issuer.commonName == 'ansible.com'" - "result.issuer | length == 1" # the number must be the number of entries you check for # has_expired - not result.expired # version - result.version == 3 # key_usage and key_usage_strict - "'Data Encipherment' in result.key_usage" - "result.key_usage | length == 1" # the number must be the number of entries you check for # extended_key_usage and extended_key_usage_strict - "'DVCS' in result.extended_key_usage" - "result.extended_key_usage | length == 1" # the number must be the number of entries you check for # subject_alt_name and subject_alt_name_strict - "'dns:ansible.com' in result.subject_alt_name" - "result.subject_alt_name | length == 1" # the number must be the number of entries you check for # not_before and not_after - "result.not_before == '20190331202428Z'" - "result.not_after == '20190413202428Z'" # valid_at, invalid_at and valid_in - "result.valid_at.one_day_ten_hours" # for valid_at - "not result.valid_at.fixed_timestamp" # for invalid_at - "result.valid_at.ten_seconds" # for valid_in # Examples for some checks one could use the assertonly provider for: # (Please note that assertonly has been deprecated!) # How to use the assertonly provider to implement and trigger your own custom certificate generation workflow: - name: Check if a certificate is currently still valid, ignoring failures community.crypto.x509_certificate: path: /etc/ssl/crt/example.com.crt provider: assertonly has_expired: no ignore_errors: yes register: validity_check - name: Run custom task(s) to get a new, valid certificate in case the initial check failed command: superspecialSSL recreate /etc/ssl/crt/example.com.crt when: validity_check.failed - name: Check the new certificate again for validity with the same parameters, this time failing the play if it is still invalid community.crypto.x509_certificate: path: /etc/ssl/crt/example.com.crt provider: assertonly has_expired: no when: validity_check.failed # Some other checks that assertonly could be used for: - name: Verify that an existing certificate was issued by the Let's Encrypt CA and is currently still valid community.crypto.x509_certificate: path: /etc/ssl/crt/example.com.crt provider: assertonly issuer: O: Let's Encrypt has_expired: no - name: Ensure that a certificate uses a modern signature algorithm (no SHA1, MD5 or DSA) community.crypto.x509_certificate: path: /etc/ssl/crt/example.com.crt provider: assertonly signature_algorithms: - sha224WithRSAEncryption - sha256WithRSAEncryption - sha384WithRSAEncryption - sha512WithRSAEncryption - sha224WithECDSAEncryption - sha256WithECDSAEncryption - sha384WithECDSAEncryption - sha512WithECDSAEncryption - name: Ensure that the existing certificate belongs to the specified private key community.crypto.x509_certificate: path: /etc/ssl/crt/example.com.crt privatekey_path: /etc/ssl/private/example.com.pem provider: assertonly - name: Ensure that the existing certificate is still valid at the winter solstice 2017 community.crypto.x509_certificate: path: /etc/ssl/crt/example.com.crt provider: assertonly valid_at: 20171221162800Z - name: Ensure that the existing certificate is still valid 2 weeks (1209600 seconds) from now community.crypto.x509_certificate: path: /etc/ssl/crt/example.com.crt provider: assertonly valid_in: 1209600 - name: Ensure that the existing certificate is only used for digital signatures and encrypting other keys community.crypto.x509_certificate: path: /etc/ssl/crt/example.com.crt provider: assertonly key_usage: - digitalSignature - keyEncipherment key_usage_strict: true - name: Ensure that the existing certificate can be used for client authentication community.crypto.x509_certificate: path: /etc/ssl/crt/example.com.crt provider: assertonly extended_key_usage: - clientAuth - name: Ensure that the existing certificate can only be used for client authentication and time stamping community.crypto.x509_certificate: path: /etc/ssl/crt/example.com.crt provider: assertonly extended_key_usage: - clientAuth - 1.3.6.1.5.5.7.3.8 extended_key_usage_strict: true - name: Ensure that the existing certificate has a certain domain in its subjectAltName community.crypto.x509_certificate: path: /etc/ssl/crt/example.com.crt provider: assertonly subject_alt_name: - www.example.com - test.example.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 | | --- | --- | --- | | **backup\_file** string | changed and if *backup* is `yes` | Name of backup file created. **Sample:** /path/to/www.ansible.com.crt.2019-03-09@11:22~ | | **certificate** string added in 1.0.0 of community.crypto | if *state* is `present` and *return\_content* is `yes` | The (current or generated) certificate's content. | | **filename** string | changed or success | Path to the generated certificate. **Sample:** /etc/ssl/crt/www.ansible.com.crt | ### Authors * Yanis Guenane (@Spredzy) * Markus Teufelberger (@MarkusTeufelberger)
programming_docs
ansible community.crypto.openssh_keypair – Generate OpenSSH private and public keys community.crypto.openssh\_keypair – Generate OpenSSH private and public keys ============================================================================ Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.openssh_keypair`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows one to (re)generate OpenSSH private and public keys. It uses ssh-keygen to generate keys. One can generate `rsa`, `dsa`, `rsa1`, `ed25519` or `ecdsa` private keys. Requirements ------------ The below requirements are needed on the host that executes this module. * ssh-keygen (if *backend=openssh*) * cryptography >= 2.6 (if *backend=cryptography* and OpenSSH < 7.8 is installed) * cryptography >= 3.0 (if *backend=cryptography* and OpenSSH >= 7.8 is installed) 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 | | **backend** string added in 1.7.0 of community.crypto | **Choices:*** **auto** ← * cryptography * opensshbin | Selects between the `cryptography` library or the OpenSSH binary `opensshbin`. `auto` will default to `opensshbin` unless the OpenSSH binary is not installed or when using *passphrase*. | | **comment** string | | Provides a new comment to the public key. | | **force** boolean | **Choices:*** **no** ← * yes | Should the key be regenerated even if it already exists | | **group** string | | Name of the group that should own the file/directory, as would be fed to *chown*. | | **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*. | | **passphrase** string added in 1.7.0 of community.crypto | | Passphrase used to decrypt an existing private key or encrypt a newly generated private key. Passphrases are not supported for *type=rsa1*. Can only be used when *backend=cryptography*, or when *backend=auto* and a required `cryptography` version is installed. | | **path** path / required | | Name of the files containing the public and private key. The file containing the public key will have the extension `.pub`. | | **private\_key\_format** string added in 1.7.0 of community.crypto | **Choices:*** **auto** ← | Used when a *backend=cryptography* to select a format for the private key at the provided *path*. The only valid option currently is `auto` which will match the key format of the installed OpenSSH version. For OpenSSH < 7.8 private keys will be in PKCS1 format except ed25519 keys which will be in OpenSSH format. For OpenSSH >= 7.8 all private key types will be in the OpenSSH format. | | **regenerate** string added in 1.0.0 of community.crypto | **Choices:*** never * fail * **partial\_idempotence** ← * full\_idempotence * always | Allows to configure in which situations the module is allowed to regenerate private keys. The module will always generate a new key if the destination file does not exist. By default, the key will be regenerated when it does not match the module's options, except when the key cannot be read or the passphrase does not match. Please note that this **changed** for Ansible 2.10. For Ansible 2.9, the behavior was as if `full_idempotence` is specified. If set to `never`, the module will fail if the key cannot be read or the passphrase isn't matching, and will never regenerate an existing key. If set to `fail`, the module will fail if the key does not correspond to the module's options. If set to `partial_idempotence`, the key will be regenerated if it does not conform to the module's options. The key is **not** regenerated if it cannot be read (broken file), the key is protected by an unknown passphrase, or when they key is not protected by a passphrase, but a passphrase is specified. If set to `full_idempotence`, the key will be regenerated if it does not conform to the module's options. This is also the case if the key cannot be read (broken file), the key is protected by an unknown passphrase, or when they key is not protected by a passphrase, but a passphrase is specified. Make sure you have a **backup** when using this option! If set to `always`, the module will always regenerate the key. This is equivalent to setting *force* to `yes`. Note that adjusting the comment and the permissions can be changed without regeneration. Therefore, even for `never`, the task can result in changed. | | **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. | | **size** integer | | Specifies the number of bits in the private key to create. For RSA keys, the minimum size is 1024 bits and the default is 4096 bits. Generally, 2048 bits is considered sufficient. DSA keys must be exactly 1024 bits as specified by FIPS 186-2. For ECDSA keys, size determines the key length by selecting from one of three elliptic curve sizes: 256, 384 or 521 bits. Attempting to use bit lengths other than these three values for ECDSA keys will cause this module to fail. Ed25519 keys have a fixed length and the size will be ignored. | | **state** string | **Choices:*** **present** ← * absent | Whether the private and public keys should exist or not, taking action if the state is different from what is stated. | | **type** string | **Choices:*** **rsa** ← * dsa * rsa1 * ecdsa * ed25519 | The algorithm used to generate the SSH private key. `rsa1` is for protocol version 1. `rsa1` is deprecated and may not be supported by every version of ssh-keygen. | | **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 * In case the ssh key is broken or password protected, the module will fail. Set the *force* option to `yes` if you want to regenerate the keypair. * Supports `check_mode`. * In the case a custom `mode`, `group`, `owner`, or other file attribute is provided it will be applied to both key files. Examples -------- ``` - name: Generate an OpenSSH keypair with the default values (4096 bits, rsa) community.crypto.openssh_keypair: path: /tmp/id_ssh_rsa - name: Generate an OpenSSH keypair with the default values (4096 bits, rsa) and encrypted private key community.crypto.openssh_keypair: path: /tmp/id_ssh_rsa passphrase: super_secret_password - name: Generate an OpenSSH rsa keypair with a different size (2048 bits) community.crypto.openssh_keypair: path: /tmp/id_ssh_rsa size: 2048 - name: Force regenerate an OpenSSH keypair if it already exists community.crypto.openssh_keypair: path: /tmp/id_ssh_rsa force: True - name: Generate an OpenSSH keypair with a different algorithm (dsa) community.crypto.openssh_keypair: path: /tmp/id_ssh_dsa type: dsa ``` 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 | changed or success | The comment of the generated key. **Sample:** test@comment | | **filename** string | changed or success | Path to the generated SSH private key file. **Sample:** /tmp/id\_ssh\_rsa | | **fingerprint** string | changed or success | The fingerprint of the key. **Sample:** SHA256:r4YCZxihVjedH2OlfjVGI6Y5xAYtdCwk8VxKyzVyYfM | | **public\_key** string | changed or success | The public key of the generated SSH private key. **Sample:** ssh-rsa AAAAB3Nza(...omitted...)veL4E3Xcw== test\_key | | **size** integer | changed or success | Size (in bits) of the SSH private key. **Sample:** 4096 | | **type** string | changed or success | Algorithm used to generate the SSH private key. **Sample:** rsa | ### Authors * David Kainz (@lolcube) ansible community.crypto.acme_challenge_cert_helper – Prepare certificates required for ACME challenges such as tls-alpn-01 community.crypto.acme\_challenge\_cert\_helper – Prepare certificates required for ACME challenges such as tls-alpn-01 ====================================================================================================================== Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.acme_challenge_cert_helper`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Prepares certificates for ACME challenges such as `tls-alpn-01`. * The raw data is provided by the [community.crypto.acme\_certificate](acme_certificate_module#ansible-collections-community-crypto-acme-certificate-module) module, and needs to be converted to a certificate to be used for challenge validation. This module provides a simple way to generate the required certificates. Requirements ------------ The below requirements are needed on the host that executes this module. * cryptography >= 1.3 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **challenge** string / required | **Choices:*** tls-alpn-01 | The challenge type. | | **challenge\_data** dictionary / required | | The `challenge_data` entry provided by [community.crypto.acme\_certificate](acme_certificate_module) for the challenge. | | **private\_key\_content** string | | Content of the private key to use for this challenge certificate. Mutually exclusive with `private_key_src`. | | **private\_key\_passphrase** string added in 1.6.0 of community.crypto | | Phassphrase to use to decode the private key. | | **private\_key\_src** path | | Path to a file containing the private key file to use for this challenge certificate. Mutually exclusive with `private_key_content`. | Notes ----- Note * Does not support `check_mode`. See Also -------- See also [Automatic Certificate Management Environment (ACME)](https://tools.ietf.org/html/rfc8555) The specification of the ACME protocol (RFC 8555). [ACME TLS ALPN Challenge Extension](https://www.rfc-editor.org/rfc/rfc8737.html) The specification of the `tls-alpn-01` challenge (RFC 8737). Examples -------- ``` - name: Create challenges for a given CRT for sample.com community.crypto.acme_certificate: account_key_src: /etc/pki/cert/private/account.key challenge: tls-alpn-01 csr: /etc/pki/cert/csr/sample.com.csr dest: /etc/httpd/ssl/sample.com.crt register: sample_com_challenge - name: Create certificates for challenges community.crypto.acme_challenge_cert_helper: challenge: tls-alpn-01 challenge_data: "{{ item.value['tls-alpn-01'] }}" private_key_src: /etc/pki/cert/key/sample.com.key loop: "{{ sample_com_challenge.challenge_data | dictsort }}" register: sample_com_challenge_certs - name: Install challenge certificates # We need to set up HTTPS such that for the domain, # regular_certificate is delivered for regular connections, # except if ALPN selects the "acme-tls/1"; then, the # challenge_certificate must be delivered. # This can for example be achieved with very new versions # of NGINX; search for ssl_preread and # ssl_preread_alpn_protocols for information on how to # route by ALPN protocol. ...: domain: "{{ item.domain }}" challenge_certificate: "{{ item.challenge_certificate }}" regular_certificate: "{{ item.regular_certificate }}" private_key: /etc/pki/cert/key/sample.com.key loop: "{{ sample_com_challenge_certs.results }}" - name: Create certificate for a given CSR for sample.com community.crypto.acme_certificate: account_key_src: /etc/pki/cert/private/account.key challenge: tls-alpn-01 csr: /etc/pki/cert/csr/sample.com.csr dest: /etc/httpd/ssl/sample.com.crt data: "{{ sample_com_challenge }}" ``` 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 | | --- | --- | --- | | **challenge\_certificate** string | always | The challenge certificate in PEM format. | | **domain** string | always | The domain the challenge is for. The certificate should be provided if this is specified in the request's the `Host` header. | | **identifier** string | always | The identifier for the actual resource. Will be a domain name if the type is `dns`, or an IP address if the type is `ip`. | | **identifier\_type** string | always | The identifier type for the actual resource identifier. Will be `dns` or `ip`. | | **regular\_certificate** string | always | A self-signed certificate for the challenge domain. If no existing certificate exists, can be used to set-up https in the first place if that is needed for providing the challenge. | ### Authors * Felix Fontein (@felixfontein) ansible community.crypto.get_certificate – Get a certificate from a host:port community.crypto.get\_certificate – Get a certificate from a host:port ====================================================================== Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.get_certificate`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Makes a secure connection and returns information about the presented certificate * The module can use the cryptography Python library, or the pyOpenSSL Python library. By default, it tries to detect which one is available. This can be overridden with the *select\_crypto\_backend* option. Please note that the PyOpenSSL backend was deprecated in Ansible 2.9 and will be removed in community.crypto 2.0.0. * Support SNI ([Server Name Indication](https://en.wikipedia.org/wiki/Server_Name_Indication)) only with python >= 2.7. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 when using `proxy_host` * cryptography >= 1.6 or pyOpenSSL >= 0.15 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ca\_cert** path | | A PEM file containing one or more root certificates; if present, the cert will be validated against these root certs. Note that this only validates the certificate is signed by the chain; not that the cert is valid for the host presenting it. | | **host** string / required | | The host to get the cert for (IP is fine) | | **port** integer / required | | The port to connect to | | **proxy\_host** string | | Proxy host used when get a certificate. | | **proxy\_port** integer | **Default:**8080 | Proxy port used when get a certificate. | | **select\_crypto\_backend** string | **Choices:*** **auto** ← * cryptography * pyopenssl | Determines which crypto backend to use. The default choice is `auto`, which tries to use `cryptography` if available, and falls back to `pyopenssl`. If set to `pyopenssl`, will try to use the [pyOpenSSL](https://pypi.org/project/pyOpenSSL/) library. If set to `cryptography`, will try to use the [cryptography](https://cryptography.io/) library. | | **server\_name** string added in 1.4.0 of community.crypto | | Server name used for SNI ([Server Name Indication](https://en.wikipedia.org/wiki/Server_Name_Indication)) when hostname is an IP or is different from server name. | | **starttls** string added in 1.9.0 of community.crypto | **Choices:*** mysql | Requests a secure connection for protocols which require clients to initiate encryption. Only available for `mysql` currently. | | **timeout** integer | **Default:**10 | The timeout in seconds | Notes ----- Note * When using ca\_cert on OS X it has been reported that in some conditions the validate will always succeed. Examples -------- ``` - name: Get the cert from an RDP port community.crypto.get_certificate: host: "1.2.3.4" port: 3389 delegate_to: localhost run_once: true register: cert - name: Get a cert from an https port community.crypto.get_certificate: host: "www.google.com" port: 443 delegate_to: localhost run_once: true register: cert - name: How many days until cert expires debug: msg: "cert expires in: {{ expire_days }} days." vars: expire_days: "{{ (( cert.not_after | to_datetime('%Y%m%d%H%M%SZ')) - (ansible_date_time.iso8601 | to_datetime('%Y-%m-%dT%H:%M:%SZ')) ).days }}" ``` 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 | | --- | --- | --- | | **cert** string | success | The certificate retrieved from the port | | **expired** boolean | success | Boolean indicating if the cert is expired | | **extensions** list / elements=dictionary | success | Extensions applied to the cert | | | **asn1\_data** string | success | The Base64 encoded ASN.1 content of the extnesion. | | | **critical** boolean | success | Whether the extension is critical. | | | **name** string | success | The extension's name. | | **issuer** dictionary | success | Information about the issuer of the cert | | **not\_after** string | success | Expiration date of the cert | | **not\_before** string | success | Issue date of the cert | | **serial\_number** string | success | The serial number of the cert | | **signature\_algorithm** string | success | The algorithm used to sign the cert | | **subject** dictionary | success | Information about the subject of the cert (OU, CN, etc) | | **version** string | success | The version number of the certificate | ### Authors * John Westcott IV (@john-westcott-iv)
programming_docs
ansible community.crypto.openssl_csr – Generate OpenSSL Certificate Signing Request (CSR) community.crypto.openssl\_csr – Generate OpenSSL Certificate Signing Request (CSR) ================================================================================== Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.openssl_csr`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Please note that the module regenerates an existing CSR if it doesn’t match the module’s options, or if it seems to be corrupt. If you are concerned that this could overwrite your existing CSR, consider using the *backup* option. * The module can use the cryptography Python library, or the pyOpenSSL Python library. By default, it tries to detect which one is available. This can be overridden with the *select\_crypto\_backend* option. Please note that the PyOpenSSL backend was deprecated in Ansible 2.9 and will be removed in community.crypto 2.0.0. * This module allows one to (re)generate OpenSSL certificate signing requests. * This module supports the subjectAltName, keyUsage, extendedKeyUsage, basicConstraints and OCSP Must Staple extensions. Requirements ------------ The below requirements are needed on the host that executes this module. * Either cryptography >= 1.3 * Or pyOpenSSL >= 0.15 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 | | **authority\_cert\_issuer** list / elements=string | | Names that will be present in the authority cert issuer field of the certificate signing request. Values must be prefixed by their options. (i.e., `email`, `URI`, `DNS`, `RID`, `IP`, `dirName`, `otherName` and the ones specific to your CA) Example: `DNS:ca.example.org` If specified, *authority\_cert\_serial\_number* must also be specified. Please note that commercial CAs ignore this value, respectively use a value of their own choice. Specifying this option is mostly useful for self-signed certificates or for own CAs. Note that this is only supported if the `cryptography` backend is used! The `AuthorityKeyIdentifier` extension will only be added if at least one of *authority\_key\_identifier*, *authority\_cert\_issuer* and *authority\_cert\_serial\_number* is specified. | | **authority\_cert\_serial\_number** integer | | The authority cert serial number. If specified, *authority\_cert\_issuer* must also be specified. Note that this is only supported if the `cryptography` backend is used! Please note that commercial CAs ignore this value, respectively use a value of their own choice. Specifying this option is mostly useful for self-signed certificates or for own CAs. The `AuthorityKeyIdentifier` extension will only be added if at least one of *authority\_key\_identifier*, *authority\_cert\_issuer* and *authority\_cert\_serial\_number* is specified. | | **authority\_key\_identifier** string | | The authority key identifier as a hex string, where two bytes are separated by colons. Example: `00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff:00:11:22:33` Please note that commercial CAs ignore this value, respectively use a value of their own choice. Specifying this option is mostly useful for self-signed certificates or for own CAs. Note that this is only supported if the `cryptography` backend is used! The `AuthorityKeyIdentifier` extension will only be added if at least one of *authority\_key\_identifier*, *authority\_cert\_issuer* and *authority\_cert\_serial\_number* is specified. | | **backup** boolean | **Choices:*** **no** ← * yes | Create a backup file including a timestamp so you can get the original CSR back if you overwrote it with a new one by accident. | | **basic\_constraints** list / elements=string | | Indicates basic constraints, such as if the certificate is a CA. aliases: basicConstraints | | **basic\_constraints\_critical** boolean | **Choices:*** **no** ← * yes | Should the basicConstraints extension be considered as critical. aliases: basicConstraints\_critical | | **common\_name** string | | The commonName field of the certificate signing request subject. aliases: CN, commonName | | **country\_name** string | | The countryName field of the certificate signing request subject. aliases: C, countryName | | **create\_subject\_key\_identifier** boolean | **Choices:*** **no** ← * yes | Create the Subject Key Identifier from the public key. Please note that commercial CAs can ignore the value, respectively use a value of their own choice instead. Specifying this option is mostly useful for self-signed certificates or for own CAs. Note that this is only supported if the `cryptography` backend is used! | | **crl\_distribution\_points** list / elements=dictionary added in 1.4.0 of community.crypto | | Allows to specify one or multiple CRL distribution points. Only supported by the `cryptography` backend. | | | **crl\_issuer** list / elements=string | | Information about the issuer of the CRL. | | | **full\_name** list / elements=string | | Describes how the CRL can be retrieved. Mutually exclusive with *relative\_name*. Example: `URI:https://ca.example.com/revocations.crl`. | | | **reasons** list / elements=string | **Choices:*** key\_compromise * ca\_compromise * affiliation\_changed * superseded * cessation\_of\_operation * certificate\_hold * privilege\_withdrawn * aa\_compromise | List of reasons that this distribution point can be used for when performing revocation checks. | | | **relative\_name** list / elements=string | | Describes how the CRL can be retrieved relative to the CRL issuer. Mutually exclusive with *full\_name*. Example: `/CN=example.com`. Can only be used when cryptography >= 1.6 is installed. | | **digest** string | **Default:**"sha256" | The digest used when signing the certificate signing request with the private key. | | **email\_address** string | | The emailAddress field of the certificate signing request subject. aliases: E, emailAddress | | **extended\_key\_usage** list / elements=string | | Additional restrictions (e.g. client authentication, server authentication) on the allowed purposes for which the public key may be used. aliases: extKeyUsage, extendedKeyUsage | | **extended\_key\_usage\_critical** boolean | **Choices:*** **no** ← * yes | Should the extkeyUsage extension be considered as critical. aliases: extKeyUsage\_critical, extendedKeyUsage\_critical | | **force** boolean | **Choices:*** **no** ← * yes | Should the certificate signing request be forced regenerated by this ansible module. | | **group** string | | Name of the group that should own the file/directory, as would be fed to *chown*. | | **key\_usage** list / elements=string | | This defines the purpose (e.g. encipherment, signature, certificate signing) of the key contained in the certificate. aliases: keyUsage | | **key\_usage\_critical** boolean | **Choices:*** **no** ← * yes | Should the keyUsage extension be considered as critical. aliases: keyUsage\_critical | | **locality\_name** string | | The localityName field of the certificate signing request subject. aliases: L, localityName | | **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. | | **name\_constraints\_critical** boolean added in 1.1.0 of community.crypto | **Choices:*** **no** ← * yes | Should the Name Constraints extension be considered as critical. | | **name\_constraints\_excluded** list / elements=string added in 1.1.0 of community.crypto | | For CA certificates, this specifies a list of identifiers which describe subtrees of names that this CA is **not** allowed to issue certificates for. Values must be prefixed by their options. (i.e., `email`, `URI`, `DNS`, `RID`, `IP`, `dirName`, `otherName` and the ones specific to your CA). | | **name\_constraints\_permitted** list / elements=string added in 1.1.0 of community.crypto | | For CA certificates, this specifies a list of identifiers which describe subtrees of names that this CA is allowed to issue certificates for. Values must be prefixed by their options. (i.e., `email`, `URI`, `DNS`, `RID`, `IP`, `dirName`, `otherName` and the ones specific to your CA). | | **ocsp\_must\_staple** boolean | **Choices:*** **no** ← * yes | Indicates that the certificate should contain the OCSP Must Staple extension (<https://tools.ietf.org/html/rfc7633>). aliases: ocspMustStaple | | **ocsp\_must\_staple\_critical** boolean | **Choices:*** **no** ← * yes | Should the OCSP Must Staple extension be considered as critical. Note that according to the RFC, this extension should not be marked as critical, as old clients not knowing about OCSP Must Staple are required to reject such certificates (see <https://tools.ietf.org/html/rfc7633#section-4>). aliases: ocspMustStaple\_critical | | **organization\_name** string | | The organizationName field of the certificate signing request subject. aliases: O, organizationName | | **organizational\_unit\_name** string | | The organizationalUnitName field of the certificate signing request subject. aliases: OU, organizationalUnitName | | **owner** string | | Name of the user that should own the file/directory, as would be fed to *chown*. | | **path** path / required | | The name of the file into which the generated OpenSSL certificate signing request will be written. | | **privatekey\_content** string added in 1.0.0 of community.crypto | | The content of the private key to use when signing the certificate signing request. Either *privatekey\_path* or *privatekey\_content* must be specified if *state* is `present`, but not both. | | **privatekey\_passphrase** string | | The passphrase for the private key. This is required if the private key is password protected. | | **privatekey\_path** path | | The path to the private key to use when signing the certificate signing request. Either *privatekey\_path* or *privatekey\_content* must be specified if *state* is `present`, but not both. | | **return\_content** boolean added in 1.0.0 of community.crypto | **Choices:*** **no** ← * yes | If set to `yes`, will return the (current or generated) CSR's content as *csr*. | | **select\_crypto\_backend** string | **Choices:*** **auto** ← * cryptography * pyopenssl | Determines which crypto backend to use. The default choice is `auto`, which tries to use `cryptography` if available, and falls back to `pyopenssl`. If set to `pyopenssl`, will try to use the [pyOpenSSL](https://pypi.org/project/pyOpenSSL/) library. If set to `cryptography`, will try to use the [cryptography](https://cryptography.io/) library. Please note that the `pyopenssl` backend has been deprecated in Ansible 2.9, and will be removed in community.crypto 2.0.0. From that point on, only the `cryptography` backend will be available. | | **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. | | **state** string | **Choices:*** absent * **present** ← | Whether the certificate signing request should exist or not, taking action if the state is different from what is stated. | | **state\_or\_province\_name** string | | The stateOrProvinceName field of the certificate signing request subject. aliases: ST, stateOrProvinceName | | **subject** dictionary | | Key/value pairs that will be present in the subject name field of the certificate signing request. If you need to specify more than one value with the same key, use a list as value. | | **subject\_alt\_name** list / elements=string | | Subject Alternative Name (SAN) extension to attach to the certificate signing request. This can either be a 'comma separated string' or a YAML list. Values must be prefixed by their options. (i.e., `email`, `URI`, `DNS`, `RID`, `IP`, `dirName`, `otherName` and the ones specific to your CA). Note that if no SAN is specified, but a common name, the common name will be added as a SAN except if `useCommonNameForSAN` is set to *false*. More at <https://tools.ietf.org/html/rfc5280#section-4.2.1.6>. aliases: subjectAltName | | **subject\_alt\_name\_critical** boolean | **Choices:*** **no** ← * yes | Should the subjectAltName extension be considered as critical. aliases: subjectAltName\_critical | | **subject\_key\_identifier** string | | The subject key identifier as a hex string, where two bytes are separated by colons. Example: `00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff:00:11:22:33` Please note that commercial CAs ignore this value, respectively use a value of their own choice. Specifying this option is mostly useful for self-signed certificates or for own CAs. Note that this option can only be used if *create\_subject\_key\_identifier* is `no`. Note that this is only supported if the `cryptography` backend is used! | | **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. | | **use\_common\_name\_for\_san** boolean | **Choices:*** no * **yes** ← | If set to `yes`, the module will fill the common name in for `subject_alt_name` with `DNS:` prefix if no SAN is specified. aliases: useCommonNameForSAN | | **version** integer | **Default:**1 | The version of the certificate signing request. The only allowed value according to [RFC 2986](https://tools.ietf.org/html/rfc2986#section-4.1) is 1. This option will no longer accept unsupported values from community.crypto 2.0.0 on. | Notes ----- Note * If the certificate signing request already exists it will be checked whether subjectAltName, keyUsage, extendedKeyUsage and basicConstraints only contain the requested values, whether OCSP Must Staple is as requested, and if the request was signed by the given private key. See Also -------- See also [community.crypto.openssl\_csr\_pipe](openssl_csr_pipe_module#ansible-collections-community-crypto-openssl-csr-pipe-module) The official documentation on the **community.crypto.openssl\_csr\_pipe** module. [community.crypto.x509\_certificate](x509_certificate_module#ansible-collections-community-crypto-x509-certificate-module) The official documentation on the **community.crypto.x509\_certificate** module. [community.crypto.x509\_certificate\_pipe](x509_certificate_pipe_module#ansible-collections-community-crypto-x509-certificate-pipe-module) The official documentation on the **community.crypto.x509\_certificate\_pipe** module. [community.crypto.openssl\_dhparam](openssl_dhparam_module#ansible-collections-community-crypto-openssl-dhparam-module) The official documentation on the **community.crypto.openssl\_dhparam** module. [community.crypto.openssl\_pkcs12](openssl_pkcs12_module#ansible-collections-community-crypto-openssl-pkcs12-module) The official documentation on the **community.crypto.openssl\_pkcs12** module. [community.crypto.openssl\_privatekey](openssl_privatekey_module#ansible-collections-community-crypto-openssl-privatekey-module) The official documentation on the **community.crypto.openssl\_privatekey** module. [community.crypto.openssl\_privatekey\_pipe](openssl_privatekey_pipe_module#ansible-collections-community-crypto-openssl-privatekey-pipe-module) The official documentation on the **community.crypto.openssl\_privatekey\_pipe** module. [community.crypto.openssl\_publickey](openssl_publickey_module#ansible-collections-community-crypto-openssl-publickey-module) The official documentation on the **community.crypto.openssl\_publickey** module. [community.crypto.openssl\_csr\_info](openssl_csr_info_module#ansible-collections-community-crypto-openssl-csr-info-module) The official documentation on the **community.crypto.openssl\_csr\_info** module. Examples -------- ``` - name: Generate an OpenSSL Certificate Signing Request community.crypto.openssl_csr: path: /etc/ssl/csr/www.ansible.com.csr privatekey_path: /etc/ssl/private/ansible.com.pem common_name: www.ansible.com - name: Generate an OpenSSL Certificate Signing Request with an inline key community.crypto.openssl_csr: path: /etc/ssl/csr/www.ansible.com.csr privatekey_content: "{{ private_key_content }}" common_name: www.ansible.com - name: Generate an OpenSSL Certificate Signing Request with a passphrase protected private key community.crypto.openssl_csr: path: /etc/ssl/csr/www.ansible.com.csr privatekey_path: /etc/ssl/private/ansible.com.pem privatekey_passphrase: ansible common_name: www.ansible.com - name: Generate an OpenSSL Certificate Signing Request with Subject information community.crypto.openssl_csr: path: /etc/ssl/csr/www.ansible.com.csr privatekey_path: /etc/ssl/private/ansible.com.pem country_name: FR organization_name: Ansible email_address: [email protected] common_name: www.ansible.com - name: Generate an OpenSSL Certificate Signing Request with subjectAltName extension community.crypto.openssl_csr: path: /etc/ssl/csr/www.ansible.com.csr privatekey_path: /etc/ssl/private/ansible.com.pem subject_alt_name: 'DNS:www.ansible.com,DNS:m.ansible.com' - name: Generate an OpenSSL CSR with subjectAltName extension with dynamic list community.crypto.openssl_csr: path: /etc/ssl/csr/www.ansible.com.csr privatekey_path: /etc/ssl/private/ansible.com.pem subject_alt_name: "{{ item.value | map('regex_replace', '^', 'DNS:') | list }}" with_dict: dns_server: - www.ansible.com - m.ansible.com - name: Force regenerate an OpenSSL Certificate Signing Request community.crypto.openssl_csr: path: /etc/ssl/csr/www.ansible.com.csr privatekey_path: /etc/ssl/private/ansible.com.pem force: yes common_name: www.ansible.com - name: Generate an OpenSSL Certificate Signing Request with special key usages community.crypto.openssl_csr: path: /etc/ssl/csr/www.ansible.com.csr privatekey_path: /etc/ssl/private/ansible.com.pem common_name: www.ansible.com key_usage: - digitalSignature - keyAgreement extended_key_usage: - clientAuth - name: Generate an OpenSSL Certificate Signing Request with OCSP Must Staple community.crypto.openssl_csr: path: /etc/ssl/csr/www.ansible.com.csr privatekey_path: /etc/ssl/private/ansible.com.pem common_name: www.ansible.com ocsp_must_staple: yes - name: Generate an OpenSSL Certificate Signing Request for WinRM Certificate authentication community.crypto.openssl_csr: path: /etc/ssl/csr/winrm.auth.csr privatekey_path: /etc/ssl/private/winrm.auth.pem common_name: username extended_key_usage: - clientAuth subject_alt_name: otherName:1.3.6.1.4.1.311.20.2.3;UTF8:username@localhost - name: Generate an OpenSSL Certificate Signing Request with a CRL distribution point community.crypto.openssl_csr: path: /etc/ssl/csr/www.ansible.com.csr privatekey_path: /etc/ssl/private/ansible.com.pem common_name: www.ansible.com crl_distribution_points: - full_name: - "URI:https://ca.example.com/revocations.crl" crl_issuer: - "URI:https://ca.example.com/" reasons: - key_compromise - ca_compromise - cessation_of_operation ``` 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 | changed and if *backup* is `yes` | Name of backup file created. **Sample:** /path/to/www.ansible.com.csr.2019-03-09@11:22~ | | **basicConstraints** list / elements=string | changed or success | Indicates if the certificate belongs to a CA **Sample:** ['CA:TRUE', 'pathLenConstraint:0'] | | **csr** string added in 1.0.0 of community.crypto | if *state* is `present` and *return\_content* is `yes` | The (current or generated) CSR's content. | | **extendedKeyUsage** list / elements=string | changed or success | Additional restriction on the public key purposes **Sample:** ['clientAuth'] | | **filename** string | changed or success | Path to the generated Certificate Signing Request **Sample:** /etc/ssl/csr/www.ansible.com.csr | | **keyUsage** list / elements=string | changed or success | Purpose for which the public key may be used **Sample:** ['digitalSignature', 'keyAgreement'] | | **name\_constraints\_excluded** list / elements=string added in 1.1.0 of community.crypto | changed or success | List of excluded subtrees the CA cannot sign certificates for. **Sample:** ['email:.com'] | | **name\_constraints\_permitted** list / elements=string added in 1.1.0 of community.crypto | changed or success | List of permitted subtrees to sign certificates for. **Sample:** ['email:.somedomain.com'] | | **ocsp\_must\_staple** boolean | changed or success | Indicates whether the certificate has the OCSP Must Staple feature enabled | | **privatekey** string | changed or success | Path to the TLS/SSL private key the CSR was generated for Will be `none` if the private key has been provided in *privatekey\_content*. **Sample:** /etc/ssl/private/ansible.com.pem | | **subject** list / elements=list | changed or success | A list of the subject tuples attached to the CSR **Sample:** [('CN', 'www.ansible.com'), ('O', 'Ansible')] | | **subjectAltName** list / elements=string | changed or success | The alternative names this CSR is valid for **Sample:** ['DNS:www.ansible.com', 'DNS:m.ansible.com'] | ### Authors * Yanis Guenane (@Spredzy) * Felix Fontein (@felixfontein)
programming_docs
ansible community.crypto.openssl_publickey_info – Provide information for OpenSSL public keys community.crypto.openssl\_publickey\_info – Provide information for OpenSSL public keys ======================================================================================= Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.openssl_publickey_info`. New in version 1.7.0: of community.crypto * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows one to query information on OpenSSL public keys. * It uses the pyOpenSSL or cryptography python library to interact with OpenSSL. If both the cryptography and PyOpenSSL libraries are available (and meet the minimum version requirements) cryptography will be preferred as a backend over PyOpenSSL (unless the backend is forced with `select_crypto_backend`). Please note that the PyOpenSSL backend was deprecated in Ansible 2.9 and will be removed in community.crypto 2.0.0. Requirements ------------ The below requirements are needed on the host that executes this module. * PyOpenSSL >= 0.15 or cryptography >= 1.2.3 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **content** string | | Content of the public key file. Either *path* or *content* must be specified, but not both. | | **path** path | | Remote absolute path where the public key file is loaded from. | | **select\_crypto\_backend** string | **Choices:*** **auto** ← * cryptography * pyopenssl | Determines which crypto backend to use. The default choice is `auto`, which tries to use `cryptography` if available, and falls back to `pyopenssl`. If set to `pyopenssl`, will try to use the [pyOpenSSL](https://pypi.org/project/pyOpenSSL/) library. If set to `cryptography`, will try to use the [cryptography](https://cryptography.io/) library. Please note that the `pyopenssl` backend has been deprecated in Ansible 2.9, and will be removed in community.crypto 2.0.0. From that point on, only the `cryptography` backend will be available. | Notes ----- Note * Supports `check_mode`. See Also -------- See also [community.crypto.openssl\_publickey](openssl_publickey_module#ansible-collections-community-crypto-openssl-publickey-module) The official documentation on the **community.crypto.openssl\_publickey** module. [community.crypto.openssl\_privatekey\_info](openssl_privatekey_info_module#ansible-collections-community-crypto-openssl-privatekey-info-module) The official documentation on the **community.crypto.openssl\_privatekey\_info** module. Examples -------- ``` - name: Generate an OpenSSL private key with the default values (4096 bits, RSA) community.crypto.openssl_privatekey: path: /etc/ssl/private/ansible.com.pem - name: Create public key from private key community.crypto.openssl_privatekey: privatekey_path: /etc/ssl/private/ansible.com.pem path: /etc/ssl/ansible.com.pub - name: Get information on public key community.crypto.openssl_publickey_info: path: /etc/ssl/ansible.com.pub register: result - name: Dump information ansible.builtin.debug: var: 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 | | --- | --- | --- | | **fingerprints** dictionary | success | Fingerprints of public key. For every hash algorithm available, the fingerprint is computed. **Sample:** {'sha256': 'd4:b3:aa:6d:c8:04:ce:4e:ba:f6:29:4d:92:a3:94:b0:c2:ff:bd:bf:33:63:11:43:34:0f:51:b0:95:09:2f:63', 'sha512': 'f7:07:4a:f0:b0:f0:e6:8b:95:5f:f9:e6:61:0a:32:68:f1... | | **public\_data** dictionary | success | Public key data. Depends on key type. | | | **curve** string | When `type=ECC` | The curve's name for ECC. | | | **exponent** integer | When `type=RSA` | The RSA key's public exponent. | | | **exponent\_size** integer | When `type=ECC` | The maximum number of bits of a private key. This is basically the bit size of the subgroup used. | | | **g** integer | When `type=DSA` | The `g` value for DSA. This is the element spanning the subgroup of the multiplicative group of the prime field used. | | | **modulus** integer | When `type=RSA` | The RSA key's modulus. | | | **p** integer | When `type=DSA` | The `p` value for DSA. This is the prime modulus upon which arithmetic takes place. | | | **q** integer | When `type=DSA` | The `q` value for DSA. This is a prime that divides `p - 1`, and at the same time the order of the subgroup of the multiplicative group of the prime field used. | | | **size** integer | When `type=RSA` or `type=DSA` | Bit size of modulus (RSA) or prime number (DSA). | | | **x** integer | When `type=ECC` | The `x` coordinate for the public point on the elliptic curve. | | | **y** integer | When `type=DSA` or `type=ECC` | For `type=ECC`, this is the `y` coordinate for the public point on the elliptic curve. For `type=DSA`, this is the publicly known group element whose discrete logarithm w.r.t. `g` is the private key. | | **type** string | success | The key's type. One of `RSA`, `DSA`, `ECC`, `Ed25519`, `X25519`, `Ed448`, or `X448`. Will start with `unknown` if the key type cannot be determined. **Sample:** RSA | ### Authors * Felix Fontein (@felixfontein) ansible community.crypto.openssl_signature_info – Verify signatures with openssl community.crypto.openssl\_signature\_info – Verify signatures with openssl ========================================================================== Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.openssl_signature_info`. New in version 1.1.0: of community.crypto * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows one to verify a signature for a file by a certificate. * The module can use the cryptography Python library, or the pyOpenSSL Python library. By default, it tries to detect which one is available. This can be overridden with the *select\_crypto\_backend* option. Please note that the PyOpenSSL backend was deprecated in Ansible 2.9 and will be removed in community.crypto 2.0.0. Requirements ------------ The below requirements are needed on the host that executes this module. * Either cryptography >= 1.4 (some key types require newer versions) * Or pyOpenSSL >= 0.11 (Ed25519 and Ed448 keys are not supported with this backend) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **certificate\_content** string | | The content of the certificate used to verify the signature. Either *certificate\_path* or *certificate\_content* must be specified, but not both. | | **certificate\_path** path | | The path to the certificate used to verify the signature. Either *certificate\_path* or *certificate\_content* must be specified, but not both. | | **path** path / required | | The signed file to verify. This file will only be read and not modified. | | **select\_crypto\_backend** string | **Choices:*** **auto** ← * cryptography * pyopenssl | Determines which crypto backend to use. The default choice is `auto`, which tries to use `cryptography` if available, and falls back to `pyopenssl`. If set to `pyopenssl`, will try to use the [pyOpenSSL](https://pypi.org/project/pyOpenSSL/) library. If set to `cryptography`, will try to use the [cryptography](https://cryptography.io/) library. | | **signature** string / required | | Base64 encoded signature. | Notes ----- Note * When using the `cryptography` backend, the following key types require at least the following `cryptography` version: RSA keys: `cryptography` >= 1.4 DSA and ECDSA keys: `cryptography` >= 1.5 ed448 and ed25519 keys: `cryptography` >= 2.6 * Supports `check_mode`. See Also -------- See also [community.crypto.openssl\_signature](openssl_signature_module#ansible-collections-community-crypto-openssl-signature-module) The official documentation on the **community.crypto.openssl\_signature** module. [community.crypto.x509\_certificate](x509_certificate_module#ansible-collections-community-crypto-x509-certificate-module) The official documentation on the **community.crypto.x509\_certificate** module. Examples -------- ``` - name: Sign example file community.crypto.openssl_signature: privatekey_path: private.key path: /tmp/example_file register: sig - name: Verify signature of example file community.crypto.openssl_signature_info: certificate_path: cert.pem path: /tmp/example_file signature: "{{ sig.signature }}" register: verify - name: Make sure the signature is valid assert: that: - verify.valid ``` 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 | | --- | --- | --- | | **valid** boolean | success | `true` means the signature was valid for the given file, `false` means it was not. | ### Authors * Patrick Pichler (@aveexy) * Markus Teufelberger (@MarkusTeufelberger) ansible community.crypto.acme_certificate – Create SSL/TLS certificates with the ACME protocol community.crypto.acme\_certificate – Create SSL/TLS certificates with the ACME protocol ======================================================================================= Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.acme_certificate`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Create and renew SSL/TLS certificates with a CA supporting the [ACME protocol](https://tools.ietf.org/html/rfc8555), such as [Let’s Encrypt](https://letsencrypt.org/) or [Buypass](https://www.buypass.com/). The current implementation supports the `http-01`, `dns-01` and `tls-alpn-01` challenges. * To use this module, it has to be executed twice. Either as two different tasks in the same run or during two runs. Note that the output of the first run needs to be recorded and passed to the second run as the module argument `data`. * Between these two tasks you have to fulfill the required steps for the chosen challenge by whatever means necessary. For `http-01` that means creating the necessary challenge file on the destination webserver. For `dns-01` the necessary dns record has to be created. For `tls-alpn-01` the necessary certificate has to be created and served. It is *not* the responsibility of this module to perform these steps. * For details on how to fulfill these challenges, you might have to read through [the main ACME specification](https://tools.ietf.org/html/rfc8555#section-8) and the [TLS-ALPN-01 specification](https://www.rfc-editor.org/rfc/rfc8737.html#section-3). Also, consider the examples provided for this module. * The module includes experimental support for IP identifiers according to the [RFC 8738](https://www.rfc-editor.org/rfc/rfc8738.html). Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.6 * either openssl or [cryptography](https://cryptography.io/) >= 1.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **account\_email** string | | The email address associated with this account. It will be used for certificate expiration warnings. Note that when `modify_account` is not set to `no` and you also used the [community.crypto.acme\_account](acme_account_module) module to specify more than one contact for your account, this module will update your account and restrict it to the (at most one) contact email address specified here. | | **account\_key\_content** string | | Content of the ACME account RSA or Elliptic Curve key. Mutually exclusive with `account_key_src`. Required if `account_key_src` is not used. **Warning:** the content will be written into a temporary file, which will be deleted by Ansible when the module completes. Since this is an important private key — it can be used to change the account key, or to revoke your certificates without knowing their private keys —, this might not be acceptable. In case `cryptography` is used, the content is not written into a temporary file. It can still happen that it is written to disk by Ansible in the process of moving the module with its argument to the node where it is executed. | | **account\_key\_passphrase** string added in 1.6.0 of community.crypto | | Phassphrase to use to decode the account key. **Note:** this is not supported by the `openssl` backend, only by the `cryptography` backend. | | **account\_key\_src** path | | Path to a file containing the ACME account RSA or Elliptic Curve key. Private keys can be created with the [community.crypto.openssl\_privatekey](openssl_privatekey_module) or [community.crypto.openssl\_privatekey\_pipe](openssl_privatekey_pipe_module) modules. If the requisites (pyOpenSSL or cryptography) are not available, keys can also be created directly with the `openssl` command line tool: RSA keys can be created with `openssl genrsa ...`. Elliptic curve keys can be created with `openssl ecparam -genkey ...`. Any other tool creating private keys in PEM format can be used as well. Mutually exclusive with `account_key_content`. Required if `account_key_content` is not used. aliases: account\_key | | **account\_uri** string | | If specified, assumes that the account URI is as given. If the account key does not match this account, or an account with this URI does not exist, the module fails. | | **acme\_directory** string | | The ACME directory to use. This is the entry point URL to access the ACME CA server API. For safety reasons the default is set to the Let's Encrypt staging server (for the ACME v1 protocol). This will create technically correct, but untrusted certificates. The default value is `https://acme-staging.api.letsencrypt.org/directory`. Note that in community.crypto 2.0.0, this option **will be required** and will no longer have a default. Note that the default is the Let's Encrypt staging server for the ACME v1 protocol, which is deprecated and will be disabled in May 2021 (see [here](https://community.letsencrypt.org/t/end-of-life-plan-for-acmev1/88430/7) for details). For Let's Encrypt, all staging endpoints can be found here: <https://letsencrypt.org/docs/staging-environment/>. For Buypass, all endpoints can be found here: <https://community.buypass.com/t/63d4ay/buypass-go-ssl-endpoints> For **Let's Encrypt**, the production directory URL for ACME v2 is <https://acme-v02.api.letsencrypt.org/directory>. (The production directory URL for ACME v1 is <https://acme-v01.api.letsencrypt.org/directory> and will be disabled in July 2021.) For **Buypass**, the production directory URL for ACME v2 and v1 is <https://api.buypass.com/acme/directory>. For **ZeroSSL**, the production directory URL for ACME v2 is <https://acme.zerossl.com/v2/DV90>. **Warning:** So far, the ACME modules have only been tested against Let's Encrypt (staging and production), Buypass (staging and production), ZeroSSL (production), and [Pebble testing server](https://github.com/letsencrypt/Pebble). If you experience problems with another ACME server, please [create an issue](https://github.com/ansible-collections/community.crypto/issues/new/choose) to help us supporting it. Feedback that an ACME server not mentioned does work is also appreciated. | | **acme\_version** integer | **Choices:*** 1 * 2 | The ACME version of the endpoint. Must be `1` for the classic Let's Encrypt and Buypass ACME endpoints, or `2` for standardized ACME v2 endpoints. The default value is `1`. Note that in community.crypto 2.0.0, this option **will be required** and will no longer have a default. Please also note that we will deprecate ACME v1 support eventually. | | **agreement** string | | URI to a terms of service document you agree to when using the ACME v1 service at `acme_directory`. Default is latest gathered from `acme_directory` URL. This option will only be used when `acme_version` is 1. | | **chain\_dest** path | | If specified, the intermediate certificate will be written to this file. aliases: chain | | **challenge** string | **Choices:*** **http-01** ← * dns-01 * tls-alpn-01 | The challenge to be performed. | | **csr** path | | File containing the CSR for the new certificate. Can be created with [community.crypto.openssl\_csr](openssl_csr_module) or `openssl req ...`. The CSR may contain multiple Subject Alternate Names, but each one will lead to an individual challenge that must be fulfilled for the CSR to be signed. *Note*: the private key used to create the CSR *must not* be the account key. This is a bad idea from a security point of view, and the CA should not accept the CSR. The ACME server should return an error in this case. Precisely one of *csr* or *csr\_content* must be specified. aliases: src | | **csr\_content** string added in 1.2.0 of community.crypto | | Content of the CSR for the new certificate. Can be created with [community.crypto.openssl\_csr\_pipe](openssl_csr_pipe_module) or `openssl req ...`. The CSR may contain multiple Subject Alternate Names, but each one will lead to an individual challenge that must be fulfilled for the CSR to be signed. *Note*: the private key used to create the CSR *must not* be the account key. This is a bad idea from a security point of view, and the CA should not accept the CSR. The ACME server should return an error in this case. Precisely one of *csr* or *csr\_content* must be specified. | | **data** dictionary | | The data to validate ongoing challenges. This must be specified for the second run of the module only. The value that must be used here will be provided by a previous use of this module. See the examples for more details. Note that for ACME v2, only the `order_uri` entry of `data` will be used. For ACME v1, `data` must be non-empty to indicate the second stage is active; all needed data will be taken from the CSR. *Note*: the `data` option was marked as `no_log` up to Ansible 2.5. From Ansible 2.6 on, it is no longer marked this way as it causes error messages to be come unusable, and `data` does not contain any information which can be used without having access to the account key or which are not public anyway. | | **deactivate\_authzs** boolean | **Choices:*** **no** ← * yes | Deactivate authentication objects (authz) after issuing a certificate, or when issuing the certificate failed. Authentication objects are bound to an account key and remain valid for a certain amount of time, and can be used to issue certificates without having to re-authenticate the domain. This can be a security concern. | | **dest** path | | The destination file for the certificate. Required if `fullchain_dest` is not specified. aliases: cert | | **force** boolean | **Choices:*** **no** ← * yes | Enforces the execution of the challenge and validation, even if an existing certificate is still valid for more than `remaining_days`. This is especially helpful when having an updated CSR e.g. with additional domains for which a new certificate is desired. | | **fullchain\_dest** path | | The destination file for the full chain (i.e. certificate followed by chain of intermediate certificates). Required if `dest` is not specified. aliases: fullchain | | **modify\_account** boolean | **Choices:*** no * **yes** ← | Boolean indicating whether the module should create the account if necessary, and update its contact data. Set to `no` if you want to use the [community.crypto.acme\_account](acme_account_module) module to manage your account instead, and to avoid accidental creation of a new account using an old key if you changed the account key with [community.crypto.acme\_account](acme_account_module). If set to `no`, `terms_agreed` and `account_email` are ignored. | | **remaining\_days** integer | **Default:**10 | The number of days the certificate must have left being valid. If `cert_days < remaining_days`, then it will be renewed. If the certificate is not renewed, module return values will not include `challenge_data`. To make sure that the certificate is renewed in any case, you can use the `force` option. | | **retrieve\_all\_alternates** boolean | **Choices:*** **no** ← * yes | When set to `yes`, will retrieve all alternate trust chains offered by the ACME CA. These will not be written to disk, but will be returned together with the main chain as `all_chains`. See the documentation for the `all_chains` return value for details. | | **select\_chain** list / elements=dictionary added in 1.0.0 of community.crypto | | Allows to specify criteria by which an (alternate) trust chain can be selected. The list of criteria will be processed one by one until a chain is found matching a criterium. If such a chain is found, it will be used by the module instead of the default chain. If a criterium matches multiple chains, the first one matching will be returned. The order is determined by the ordering of the `Link` headers returned by the ACME server and might not be deterministic. Every criterium can consist of multiple different conditions, like *issuer* and *subject*. For the criterium to match a chain, all conditions must apply to the same certificate in the chain. This option can only be used with the `cryptography` backend. | | | **authority\_key\_identifier** string | | Checks for the AuthorityKeyIdentifier extension. This is an identifier based on the private key of the issuer of the intermediate certificate. The identifier must be of the form `C4:A7:B1:A4:7B:2C:71:FA:DB:E1:4B:90:75:FF:C4:15:60:85:89:10`. | | | **issuer** dictionary | | Allows to specify parts of the issuer of a certificate in the chain must have to be selected. If *issuer* is empty, any certificate will match. An example value would be `{"commonName": "My Preferred CA Root"}`. | | | **subject** dictionary | | Allows to specify parts of the subject of a certificate in the chain must have to be selected. If *subject* is empty, any certificate will match. An example value would be `{"CN": "My Preferred CA Intermediate"}` | | | **subject\_key\_identifier** string | | Checks for the SubjectKeyIdentifier extension. This is an identifier based on the private key of the intermediate certificate. The identifier must be of the form `A8:4A:6A:63:04:7D:DD:BA:E6:D1:39:B7:A6:45:65:EF:F3:A8:EC:A1`. | | | **test\_certificates** string | **Choices:*** first * last * **all** ← | Determines which certificates in the chain will be tested. *all* tests all certificates in the chain (excluding the leaf, which is identical in all chains). *first* only tests the first certificate in the chain, i.e. the one which signed the leaf. *last* only tests the last certificate in the chain, i.e. the one furthest away from the leaf. Its issuer is the root certificate of this chain. | | **select\_crypto\_backend** string | **Choices:*** **auto** ← * cryptography * openssl | Determines which crypto backend to use. The default choice is `auto`, which tries to use `cryptography` if available, and falls back to `openssl`. If set to `openssl`, will try to use the `openssl` binary. If set to `cryptography`, will try to use the [cryptography](https://cryptography.io/) library. | | **terms\_agreed** boolean | **Choices:*** **no** ← * yes | Boolean indicating whether you agree to the terms of service document. ACME servers can require this to be true. This option will only be used when `acme_version` is not 1. | | **validate\_certs** boolean | **Choices:*** no * **yes** ← | Whether calls to the ACME directory will validate TLS certificates. **Warning:** Should **only ever** be set to `no` for testing purposes, for example when testing against a local Pebble server. | Notes ----- Note * At least one of `dest` and `fullchain_dest` must be specified. * This module includes basic account management functionality. If you want to have more control over your ACME account, use the [community.crypto.acme\_account](acme_account_module#ansible-collections-community-crypto-acme-account-module) module and disable account management for this module using the `modify_account` option. * This module was called `letsencrypt` before Ansible 2.6. The usage did not change. * If a new enough version of the `cryptography` library is available (see Requirements for details), it will be used instead of the `openssl` binary. This can be explicitly disabled or enabled with the `select_crypto_backend` option. Note that using the `openssl` binary will be slower and less secure, as private key contents always have to be stored on disk (see `account_key_content`). * Although the defaults are chosen so that the module can be used with the [Let’s Encrypt](https://letsencrypt.org/) CA, the module can in principle be used with any CA providing an ACME endpoint, such as [Buypass Go SSL](https://www.buypass.com/ssl/products/acme). See Also -------- See also [The Let’s Encrypt documentation](https://letsencrypt.org/docs/) Documentation for the Let’s Encrypt Certification Authority. Provides useful information for example on rate limits. [Buypass Go SSL](https://www.buypass.com/ssl/products/acme) Documentation for the Buypass Certification Authority. Provides useful information for example on rate limits. [Automatic Certificate Management Environment (ACME)](https://tools.ietf.org/html/rfc8555) The specification of the ACME protocol (RFC 8555). [ACME TLS ALPN Challenge Extension](https://www.rfc-editor.org/rfc/rfc8737.html-05) The specification of the `tls-alpn-01` challenge (RFC 8737). [community.crypto.acme\_challenge\_cert\_helper](acme_challenge_cert_helper_module#ansible-collections-community-crypto-acme-challenge-cert-helper-module) Helps preparing `tls-alpn-01` challenges. [community.crypto.openssl\_privatekey](openssl_privatekey_module#ansible-collections-community-crypto-openssl-privatekey-module) Can be used to create private keys (both for certificates and accounts). [community.crypto.openssl\_privatekey\_pipe](openssl_privatekey_pipe_module#ansible-collections-community-crypto-openssl-privatekey-pipe-module) Can be used to create private keys without writing it to disk (both for certificates and accounts). [community.crypto.openssl\_csr](openssl_csr_module#ansible-collections-community-crypto-openssl-csr-module) Can be used to create a Certificate Signing Request (CSR). [community.crypto.openssl\_csr\_pipe](openssl_csr_pipe_module#ansible-collections-community-crypto-openssl-csr-pipe-module) Can be used to create a Certificate Signing Request (CSR) without writing it to disk. [community.crypto.certificate\_complete\_chain](certificate_complete_chain_module#ansible-collections-community-crypto-certificate-complete-chain-module) Allows to find the root certificate for the returned fullchain. [community.crypto.acme\_certificate\_revoke](acme_certificate_revoke_module#ansible-collections-community-crypto-acme-certificate-revoke-module) Allows to revoke certificates. [community.crypto.acme\_account](acme_account_module#ansible-collections-community-crypto-acme-account-module) Allows to create, modify or delete an ACME account. [community.crypto.acme\_inspect](acme_inspect_module#ansible-collections-community-crypto-acme-inspect-module) Allows to debug problems. Examples -------- ``` ### Example with HTTP challenge ### - name: Create a challenge for sample.com using a account key from a variable. community.crypto.acme_certificate: account_key_content: "{{ account_private_key }}" csr: /etc/pki/cert/csr/sample.com.csr dest: /etc/httpd/ssl/sample.com.crt register: sample_com_challenge # Alternative first step: - name: Create a challenge for sample.com using a account key from hashi vault. community.crypto.acme_certificate: account_key_content: "{{ lookup('hashi_vault', 'secret=secret/account_private_key:value') }}" csr: /etc/pki/cert/csr/sample.com.csr fullchain_dest: /etc/httpd/ssl/sample.com-fullchain.crt register: sample_com_challenge # Alternative first step: - name: Create a challenge for sample.com using a account key file. community.crypto.acme_certificate: account_key_src: /etc/pki/cert/private/account.key csr_content: "{{ lookup('file', '/etc/pki/cert/csr/sample.com.csr') }}" dest: /etc/httpd/ssl/sample.com.crt fullchain_dest: /etc/httpd/ssl/sample.com-fullchain.crt register: sample_com_challenge # perform the necessary steps to fulfill the challenge # for example: # # - copy: # dest: /var/www/html/{{ sample_com_challenge['challenge_data']['sample.com']['http-01']['resource'] }} # content: "{{ sample_com_challenge['challenge_data']['sample.com']['http-01']['resource_value'] }}" # when: sample_com_challenge is changed and 'sample.com' in sample_com_challenge['challenge_data'] # # Alternative way: # # - copy: # dest: /var/www/{{ item.key }}/{{ item.value['http-01']['resource'] }} # content: "{{ item.value['http-01']['resource_value'] }}" # loop: "{{ sample_com_challenge.challenge_data | dict2items }}" # when: sample_com_challenge is changed - name: Let the challenge be validated and retrieve the cert and intermediate certificate community.crypto.acme_certificate: account_key_src: /etc/pki/cert/private/account.key csr: /etc/pki/cert/csr/sample.com.csr dest: /etc/httpd/ssl/sample.com.crt fullchain_dest: /etc/httpd/ssl/sample.com-fullchain.crt chain_dest: /etc/httpd/ssl/sample.com-intermediate.crt data: "{{ sample_com_challenge }}" ### Example with DNS challenge against production ACME server ### - name: Create a challenge for sample.com using a account key file. community.crypto.acme_certificate: account_key_src: /etc/pki/cert/private/account.key account_email: [email protected] src: /etc/pki/cert/csr/sample.com.csr cert: /etc/httpd/ssl/sample.com.crt challenge: dns-01 acme_directory: https://acme-v01.api.letsencrypt.org/directory # Renew if the certificate is at least 30 days old remaining_days: 60 register: sample_com_challenge # perform the necessary steps to fulfill the challenge # for example: # # - community.aws.route53: # zone: sample.com # record: "{{ sample_com_challenge.challenge_data['sample.com']['dns-01'].record }}" # type: TXT # ttl: 60 # state: present # wait: yes # # Note: route53 requires TXT entries to be enclosed in quotes # value: "{{ sample_com_challenge.challenge_data['sample.com']['dns-01'].resource_value | regex_replace('^(.*)$', '\"\\1\"') }}" # when: sample_com_challenge is changed and 'sample.com' in sample_com_challenge.challenge_data # # Alternative way: # # - community.aws.route53: # zone: sample.com # record: "{{ item.key }}" # type: TXT # ttl: 60 # state: present # wait: yes # # Note: item.value is a list of TXT entries, and route53 # # requires every entry to be enclosed in quotes # value: "{{ item.value | map('regex_replace', '^(.*)$', '\"\\1\"' ) | list }}" # loop: "{{ sample_com_challenge.challenge_data_dns | dict2items }}" # when: sample_com_challenge is changed - name: Let the challenge be validated and retrieve the cert and intermediate certificate community.crypto.acme_certificate: account_key_src: /etc/pki/cert/private/account.key account_email: [email protected] src: /etc/pki/cert/csr/sample.com.csr cert: /etc/httpd/ssl/sample.com.crt fullchain: /etc/httpd/ssl/sample.com-fullchain.crt chain: /etc/httpd/ssl/sample.com-intermediate.crt challenge: dns-01 acme_directory: https://acme-v01.api.letsencrypt.org/directory remaining_days: 60 data: "{{ sample_com_challenge }}" when: sample_com_challenge is changed # Alternative second step: - name: Let the challenge be validated and retrieve the cert and intermediate certificate community.crypto.acme_certificate: account_key_src: /etc/pki/cert/private/account.key account_email: [email protected] src: /etc/pki/cert/csr/sample.com.csr cert: /etc/httpd/ssl/sample.com.crt fullchain: /etc/httpd/ssl/sample.com-fullchain.crt chain: /etc/httpd/ssl/sample.com-intermediate.crt challenge: tls-alpn-01 remaining_days: 60 data: "{{ sample_com_challenge }}" # We use Let's Encrypt's ACME v2 endpoint acme_directory: https://acme-v02.api.letsencrypt.org/directory acme_version: 2 # The following makes sure that if a chain with /CN=DST Root CA X3 in its issuer is provided # as an alternative, it will be selected. These are the roots cross-signed by IdenTrust. # As long as Let's Encrypt provides alternate chains with the cross-signed root(s) when # switching to their own ISRG Root X1 root, this will use the chain ending with a cross-signed # root. This chain is more compatible with older TLS clients. select_chain: - test_certificates: last issuer: CN: DST Root CA X3 O: Digital Signature Trust Co. when: sample_com_challenge is changed ``` 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\_uri** string | changed | ACME account URI. | | **all\_chains** list / elements=dictionary | when certificate was retrieved and *retrieve\_all\_alternates* is set to `yes` | When *retrieve\_all\_alternates* is set to `yes`, the module will query the ACME server for alternate chains. This return value will contain a list of all chains returned, the first entry being the main chain returned by the server. See [Section 7.4.2 of RFC8555](https://tools.ietf.org/html/rfc8555#section-7.4.2) for details. | | | **cert** string | always | The leaf certificate itself, in PEM format. | | | **chain** string | always | The certificate chain, excluding the root, as concatenated PEM certificates. | | | **full\_chain** string | always | The certificate chain, excluding the root, but including the leaf certificate, as concatenated PEM certificates. | | **authorizations** dictionary | changed | ACME authorization data. Maps an identifier to ACME authorization objects. See <https://tools.ietf.org/html/rfc8555#section-7.1.4>. **Sample:** {"example.com":{...}} | | **cert\_days** integer | success | The number of days the certificate remains valid. | | **challenge\_data** list / elements=dictionary | changed | Per identifier / challenge type challenge data. Since Ansible 2.8.5, only challenges which are not yet valid are returned. | | | **record** string | changed and challenge is `dns-01` | The full DNS record's name for the challenge. **Sample:** \_acme-challenge.example.com | | | **resource** string | changed | The challenge resource that must be created for validation. **Sample:** .well-known/acme-challenge/evaGxfADs6pSRb2LAv9IZf17Dt3juxGJ-PCt92wr-oA | | | **resource\_original** string | changed and challenge is `tls-alpn-01` | The original challenge resource including type identifier for `tls-alpn-01` challenges. **Sample:** DNS:example.com | | | **resource\_value** string | changed | The value the resource has to produce for the validation. For `http-01` and `dns-01` challenges, the value can be used as-is. For `tls-alpn-01` challenges, note that this return value contains a Base64 encoded version of the correct binary blob which has to be put into the acmeValidation x509 extension; see <https://www.rfc-editor.org/rfc/rfc8737.html#section-3> for details. To do this, you might need the `b64decode` Jinja filter to extract the binary blob from this return value. **Sample:** IlirfxKKXA...17Dt3juxGJ-PCt92wr-oA | | **challenge\_data\_dns** dictionary | changed | List of TXT values per DNS record, in case challenge is `dns-01`. Since Ansible 2.8.5, only challenges which are not yet valid are returned. | | **finalization\_uri** string | changed | ACME finalization URI. | | **order\_uri** string | changed | ACME order URI. | ### Authors * Michael Gruener (@mgruener)
programming_docs
ansible community.crypto.openssl_privatekey_info – Provide information for OpenSSL private keys community.crypto.openssl\_privatekey\_info – Provide information for OpenSSL private keys ========================================================================================= Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.openssl_privatekey_info`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows one to query information on OpenSSL private keys. * In case the key consistency checks fail, the module will fail as this indicates a faked private key. In this case, all return variables are still returned. Note that key consistency checks are not available all key types; if none is available, `none` is returned for `key_is_consistent`. * It uses the pyOpenSSL or cryptography python library to interact with OpenSSL. If both the cryptography and PyOpenSSL libraries are available (and meet the minimum version requirements) cryptography will be preferred as a backend over PyOpenSSL (unless the backend is forced with `select_crypto_backend`). Please note that the PyOpenSSL backend was deprecated in Ansible 2.9 and will be removed in community.crypto 2.0.0. Requirements ------------ The below requirements are needed on the host that executes this module. * PyOpenSSL >= 0.15 or cryptography >= 1.2.3 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **content** string added in 1.0.0 of community.crypto | | Content of the private key file. Either *path* or *content* must be specified, but not both. | | **passphrase** string | | The passphrase for the private key. | | **path** path | | Remote absolute path where the private key file is loaded from. | | **return\_private\_key\_data** boolean | **Choices:*** **no** ← * yes | Whether to return private key data. Only set this to `yes` when you want private information about this key to leave the remote machine. WARNING: you have to make sure that private key data isn't accidentally logged! | | **select\_crypto\_backend** string | **Choices:*** **auto** ← * cryptography * pyopenssl | Determines which crypto backend to use. The default choice is `auto`, which tries to use `cryptography` if available, and falls back to `pyopenssl`. If set to `pyopenssl`, will try to use the [pyOpenSSL](https://pypi.org/project/pyOpenSSL/) library. If set to `cryptography`, will try to use the [cryptography](https://cryptography.io/) library. Please note that the `pyopenssl` backend has been deprecated in Ansible 2.9, and will be removed in community.crypto 2.0.0. From that point on, only the `cryptography` backend will be available. | Notes ----- Note * Supports `check_mode`. See Also -------- See also [community.crypto.openssl\_privatekey](openssl_privatekey_module#ansible-collections-community-crypto-openssl-privatekey-module) The official documentation on the **community.crypto.openssl\_privatekey** module. [community.crypto.openssl\_privatekey\_pipe](openssl_privatekey_pipe_module#ansible-collections-community-crypto-openssl-privatekey-pipe-module) The official documentation on the **community.crypto.openssl\_privatekey\_pipe** module. Examples -------- ``` - name: Generate an OpenSSL private key with the default values (4096 bits, RSA) community.crypto.openssl_privatekey: path: /etc/ssl/private/ansible.com.pem - name: Get information on generated key community.crypto.openssl_privatekey_info: path: /etc/ssl/private/ansible.com.pem register: result - name: Dump information ansible.builtin.debug: var: 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 | | --- | --- | --- | | **can\_load\_key** boolean | always | Whether the module was able to load the private key from disk. | | **can\_parse\_key** boolean | always | Whether the module was able to parse the private key. | | **key\_is\_consistent** boolean | always | Whether the key is consistent. Can also return `none` next to `yes` and `no`, to indicate that consistency could not be checked. In case the check returns `no`, the module will fail. | | **private\_data** dictionary | success and when *return\_private\_key\_data* is set to `yes` | Private key data. Depends on key type. | | **public\_data** dictionary | success | Public key data. Depends on key type. | | | **curve** string | When `type=ECC` | The curve's name for ECC. | | | **exponent** integer | When `type=RSA` | The RSA key's public exponent. | | | **exponent\_size** integer | When `type=ECC` | The maximum number of bits of a private key. This is basically the bit size of the subgroup used. | | | **g** integer | When `type=DSA` | The `g` value for DSA. This is the element spanning the subgroup of the multiplicative group of the prime field used. | | | **modulus** integer | When `type=RSA` | The RSA key's modulus. | | | **p** integer | When `type=DSA` | The `p` value for DSA. This is the prime modulus upon which arithmetic takes place. | | | **q** integer | When `type=DSA` | The `q` value for DSA. This is a prime that divides `p - 1`, and at the same time the order of the subgroup of the multiplicative group of the prime field used. | | | **size** integer | When `type=RSA` or `type=DSA` | Bit size of modulus (RSA) or prime number (DSA). | | | **x** integer | When `type=ECC` | The `x` coordinate for the public point on the elliptic curve. | | | **y** integer | When `type=DSA` or `type=ECC` | For `type=ECC`, this is the `y` coordinate for the public point on the elliptic curve. For `type=DSA`, this is the publicly known group element whose discrete logarithm w.r.t. `g` is the private key. | | **public\_key** string | success | Private key's public key in PEM format. **Sample:** -----BEGIN PUBLIC KEY----- MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A... | | **public\_key\_fingerprints** dictionary | success | Fingerprints of private key's public key. For every hash algorithm available, the fingerprint is computed. **Sample:** {'sha256': 'd4:b3:aa:6d:c8:04:ce:4e:ba:f6:29:4d:92:a3:94:b0:c2:ff:bd:bf:33:63:11:43:34:0f:51:b0:95:09:2f:63', 'sha512': 'f7:07:4a:f0:b0:f0:e6:8b:95:5f:f9:e6:61:0a:32:68:f1... | | **type** string | success | The key's type. One of `RSA`, `DSA`, `ECC`, `Ed25519`, `X25519`, `Ed448`, or `X448`. Will start with `unknown` if the key type cannot be determined. **Sample:** RSA | ### Authors * Felix Fontein (@felixfontein) * Yanis Guenane (@Spredzy) ansible community.crypto.openssh_cert – Generate OpenSSH host or user certificates. community.crypto.openssh\_cert – Generate OpenSSH host or user certificates. ============================================================================ Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.openssh_cert`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Generate and regenerate OpenSSH host or user certificates. Requirements ------------ The below requirements are needed on the host that executes this module. * ssh-keygen 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 | | **force** boolean | **Choices:*** **no** ← * yes | Should the certificate be regenerated even if it already exists and is valid. Equivalent to *regenerate=always*. | | **group** string | | Name of the group that should own the file/directory, as would be fed to *chown*. | | **identifier** string | | Specify the key identity when signing a public key. The identifier that is logged by the server when the certificate is used for authentication. | | **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. | | **options** list / elements=string | | Specify certificate options when signing a key. The option that are valid for user certificates are: `clear`: Clear all enabled permissions. This is useful for clearing the default set of permissions so permissions may be added individually. `force-command=command`: Forces the execution of command instead of any shell or command specified by the user when the certificate is used for authentication. `no-agent-forwarding`: Disable ssh-agent forwarding (permitted by default). `no-port-forwarding`: Disable port forwarding (permitted by default). `no-pty`: Disable PTY allocation (permitted by default). `no-user-rc`: Disable execution of `~/.ssh/rc` by sshd (permitted by default). `no-x11-forwarding`: Disable X11 forwarding (permitted by default) `permit-agent-forwarding`: Allows ssh-agent forwarding. `permit-port-forwarding`: Allows port forwarding. `permit-pty`: Allows PTY allocation. `permit-user-rc`: Allows execution of `~/.ssh/rc` by sshd. `permit-x11-forwarding`: Allows X11 forwarding. `source-address=address_list`: Restrict the source addresses from which the certificate is considered valid. The `address_list` is a comma-separated list of one or more address/netmask pairs in CIDR format. At present, no options are valid for host keys. | | **owner** string | | Name of the user that should own the file/directory, as would be fed to *chown*. | | **path** path / required | | Path of the file containing the certificate. | | **pkcs11\_provider** string added in 1.1.0 of community.crypto | | To use a signing key that resides on a PKCS#11 token, set this to the name (or full path) of the shared library to use with the token. Usually `libpkcs11.so`. If this is set, *signing\_key* needs to point to a file containing the public key of the CA. | | **principals** list / elements=string | | Certificates may be limited to be valid for a set of principal (user/host) names. By default, generated certificates are valid for all users or hosts. | | **public\_key** path | | The path to the public key that will be signed with the signing key in order to generate the certificate. Required if *state* is `present`. | | **regenerate** string added in 1.8.0 of community.crypto | **Choices:*** never * fail * **partial\_idempotence** ← * full\_idempotence * always | When `never` the task will fail if a certificate already exists at *path* and is unreadable otherwise a new certificate will only be generated if there is no existing certificate. When `fail` the task will fail if a certificate already exists at *path* and does not match the module's options. When `partial_idempotence` an existing certificate will be regenerated based on *serial*, *signature\_algorithm*, *type*, *valid\_from*, *valid\_to*, *valid\_at*, and *principals*. When `full_idempotence` *identifier*, *options*, *public\_key*, and *signing\_key* are also considered when compared against an existing certificate. `always` is equivalent to *force=true*. | | **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. | | **serial\_number** integer | | Specify the certificate serial number. The serial number is logged by the server when the certificate is used for authentication. The certificate serial number may be used in a KeyRevocationList. The serial number may be omitted for checks, but must be specified again for a new certificate. Note: The default value set by ssh-keygen is 0. | | **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. | | **signature\_algorithm** string added in 1.10.0 of community.crypto | **Choices:*** ssh-rsa * rsa-sha2-256 * rsa-sha2-512 | As of OpenSSH 8.2 the SHA-1 signature algorithm for RSA keys has been disabled and `ssh` will refuse host certificates signed with the SHA-1 algorithm. OpenSSH 8.1 made `rsa-sha2-512` the default algorithm when acting as a CA and signing certificates with a RSA key. However, for OpenSSH versions less than 8.1 the SHA-2 signature algorithms, `rsa-sha2-256` or `rsa-sha2-512`, must be specified using this option if compatibility with newer `ssh` clients is required. Conversely if hosts using OpenSSH version 8.2 or greater must remain compatible with `ssh` clients using OpenSSH less than 7.2, then `ssh-rsa` can be used when generating host certificates (a corresponding change to the sshd\_config to add `ssh-rsa` to the `CASignatureAlgorithms` keyword is also required). Using any value for this option with a non-RSA *signing\_key* will cause this module to fail. Note: OpenSSH versions prior to 7.2 do not support SHA-2 signature algorithms for RSA keys and OpenSSH versions prior to 7.3 do not support SHA-2 signature algorithms for certificates. See <https://www.openssh.com/txt/release-8.2> for more information. | | **signing\_key** path | | The path to the private openssh key that is used for signing the public key in order to generate the certificate. If the private key is on a PKCS#11 token (*pkcs11\_provider*), set this to the path to the public key instead. Required if *state* is `present`. | | **state** string | **Choices:*** **present** ← * absent | Whether the host or user certificate should exist or not, taking action if the state is different from what is stated. | | **type** string | **Choices:*** host * user | Whether the module should generate a host or a user certificate. Required if *state* is `present`. | | **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. | | **use\_agent** boolean added in 1.3.0 of community.crypto | **Choices:*** **no** ← * yes | Should the ssh-keygen use a CA key residing in a ssh-agent. | | **valid\_at** string | | Check if the certificate is valid at a certain point in time. If it is not the certificate will be regenerated. Time will always be interpreted as UTC. Mainly to be used with relative timespec for *valid\_from* and / or *valid\_to*. Note that if using relative time this module is NOT idempotent. | | **valid\_from** string | | The point in time the certificate is valid from. Time can be specified either as relative time or as absolute timestamp. Time will always be interpreted as UTC. Valid formats are: `[+-]timespec | YYYY-MM-DD | YYYY-MM-DDTHH:MM:SS | YYYY-MM-DD HH:MM:SS | always` where timespec can be an integer + `[w | d | h | m | s]` (e.g. `+32w1d2h`. Note that if using relative time this module is NOT idempotent. Required if *state* is `present`. | | **valid\_to** string | | The point in time the certificate is valid to. Time can be specified either as relative time or as absolute timestamp. Time will always be interpreted as UTC. Valid formats are: `[+-]timespec | YYYY-MM-DD | YYYY-MM-DDTHH:MM:SS | YYYY-MM-DD HH:MM:SS | forever` where timespec can be an integer + `[w | d | h | m | s]` (e.g. `+32w1d2h`. Note that if using relative time this module is NOT idempotent. Required if *state* is `present`. | Examples -------- ``` - name: Generate an OpenSSH user certificate that is valid forever and for all users community.crypto.openssh_cert: type: user signing_key: /path/to/private_key public_key: /path/to/public_key.pub path: /path/to/certificate valid_from: always valid_to: forever # Generate an OpenSSH host certificate that is valid for 32 weeks from now and will be regenerated # if it is valid for less than 2 weeks from the time the module is being run - name: Generate an OpenSSH host certificate with valid_from, valid_to and valid_at parameters community.crypto.openssh_cert: type: host signing_key: /path/to/private_key public_key: /path/to/public_key.pub path: /path/to/certificate valid_from: +0s valid_to: +32w valid_at: +2w - name: Generate an OpenSSH host certificate that is valid forever and only for example.com and examplehost community.crypto.openssh_cert: type: host signing_key: /path/to/private_key public_key: /path/to/public_key.pub path: /path/to/certificate valid_from: always valid_to: forever principals: - example.com - examplehost - name: Generate an OpenSSH host Certificate that is valid from 21.1.2001 to 21.1.2019 community.crypto.openssh_cert: type: host signing_key: /path/to/private_key public_key: /path/to/public_key.pub path: /path/to/certificate valid_from: "2001-01-21" valid_to: "2019-01-21" - name: Generate an OpenSSH user Certificate with clear and force-command option community.crypto.openssh_cert: type: user signing_key: /path/to/private_key public_key: /path/to/public_key.pub path: /path/to/certificate valid_from: always valid_to: forever options: - "clear" - "force-command=/tmp/bla/foo" - name: Generate an OpenSSH user certificate using a PKCS#11 token community.crypto.openssh_cert: type: user signing_key: /path/to/ca_public_key.pub pkcs11_provider: libpkcs11.so public_key: /path/to/public_key.pub path: /path/to/certificate valid_from: always valid_to: forever ``` 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 | | --- | --- | --- | | **filename** string | changed or success | path to the certificate **Sample:** /tmp/certificate-cert.pub | | **info** list / elements=string | change or success | Information about the certificate. Output of `ssh-keygen -L -f`. | | **type** string | changed or success | type of the certificate (host or user) **Sample:** host | ### Authors * David Kainz (@lolcube)
programming_docs
ansible community.crypto.openssl_csr_info – Provide information of OpenSSL Certificate Signing Requests (CSR) community.crypto.openssl\_csr\_info – Provide information of OpenSSL Certificate Signing Requests (CSR) ======================================================================================================= Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.openssl_csr_info`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows one to query information on OpenSSL Certificate Signing Requests (CSR). * In case the CSR signature cannot be validated, the module will fail. In this case, all return variables are still returned. * It uses the pyOpenSSL or cryptography python library to interact with OpenSSL. If both the cryptography and PyOpenSSL libraries are available (and meet the minimum version requirements) cryptography will be preferred as a backend over PyOpenSSL (unless the backend is forced with `select_crypto_backend`). Please note that the PyOpenSSL backend was deprecated in Ansible 2.9 and will be removed in community.crypto 2.0.0. Requirements ------------ The below requirements are needed on the host that executes this module. * PyOpenSSL >= 0.15 or cryptography >= 1.3 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **content** string added in 1.0.0 of community.crypto | | Content of the CSR file. Either *path* or *content* must be specified, but not both. | | **path** path | | Remote absolute path where the CSR file is loaded from. Either *path* or *content* must be specified, but not both. | | **select\_crypto\_backend** string | **Choices:*** **auto** ← * cryptography * pyopenssl | Determines which crypto backend to use. The default choice is `auto`, which tries to use `cryptography` if available, and falls back to `pyopenssl`. If set to `pyopenssl`, will try to use the [pyOpenSSL](https://pypi.org/project/pyOpenSSL/) library. If set to `cryptography`, will try to use the [cryptography](https://cryptography.io/) library. Please note that the `pyopenssl` backend has been deprecated in Ansible 2.9, and will be removed in community.crypto 2.0.0. From that point on, only the `cryptography` backend will be available. | See Also -------- See also [community.crypto.openssl\_csr](openssl_csr_module#ansible-collections-community-crypto-openssl-csr-module) The official documentation on the **community.crypto.openssl\_csr** module. [community.crypto.openssl\_csr\_pipe](openssl_csr_pipe_module#ansible-collections-community-crypto-openssl-csr-pipe-module) The official documentation on the **community.crypto.openssl\_csr\_pipe** module. Examples -------- ``` - name: Generate an OpenSSL Certificate Signing Request community.crypto.openssl_csr: path: /etc/ssl/csr/www.ansible.com.csr privatekey_path: /etc/ssl/private/ansible.com.pem common_name: www.ansible.com - name: Get information on the CSR community.crypto.openssl_csr_info: path: /etc/ssl/csr/www.ansible.com.csr register: result - name: Dump information debug: var: 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 | | --- | --- | --- | | **authority\_cert\_issuer** list / elements=string | success and if the pyOpenSSL backend is *not* used | The CSR's authority cert issuer as a list of general names. Is `none` if the `AuthorityKeyIdentifier` extension is not present. **Sample:** [DNS:www.ansible.com, IP:1.2.3.4] | | **authority\_cert\_serial\_number** integer | success and if the pyOpenSSL backend is *not* used | The CSR's authority cert serial number. Is `none` if the `AuthorityKeyIdentifier` extension is not present. **Sample:** 12345 | | **authority\_key\_identifier** string | success and if the pyOpenSSL backend is *not* used | The CSR's authority key identifier. The identifier is returned in hexadecimal, with `:` used to separate bytes. Is `none` if the `AuthorityKeyIdentifier` extension is not present. **Sample:** 00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff:00:11:22:33 | | **basic\_constraints** list / elements=string | success | Entries in the `basic_constraints` extension, or `none` if extension is not present. **Sample:** [CA:TRUE, pathlen:1] | | **basic\_constraints\_critical** boolean | success | Whether the `basic_constraints` extension is critical. | | **extended\_key\_usage** list / elements=string | success | Entries in the `extended_key_usage` extension, or `none` if extension is not present. **Sample:** [Biometric Info, DVCS, Time Stamping] | | **extended\_key\_usage\_critical** boolean | success | Whether the `extended_key_usage` extension is critical. | | **extensions\_by\_oid** dictionary | success | Returns a dictionary for every extension OID **Sample:** {"1.3.6.1.5.5.7.1.24": { "critical": false, "value": "MAMCAQU="}} | | | **critical** boolean | success | Whether the extension is critical. | | | **value** string | success | The Base64 encoded value (in DER format) of the extension **Sample:** MAMCAQU= | | **key\_usage** string | success | Entries in the `key_usage` extension, or `none` if extension is not present. **Sample:** [Key Agreement, Data Encipherment] | | **key\_usage\_critical** boolean | success | Whether the `key_usage` extension is critical. | | **name\_constraints\_critical** boolean added in 1.1.0 of community.crypto | success | Whether the `name_constraints` extension is critical. Is `none` if extension is not present. | | **name\_constraints\_excluded** list / elements=string added in 1.1.0 of community.crypto | success | List of excluded subtrees the CA cannot sign certificates for. Is `none` if extension is not present. **Sample:** ['email:.com'] | | **name\_constraints\_permitted** list / elements=string added in 1.1.0 of community.crypto | success | List of permitted subtrees to sign certificates for. **Sample:** ['email:.somedomain.com'] | | **ocsp\_must\_staple** boolean | success | `yes` if the OCSP Must Staple extension is present, `none` otherwise. | | **ocsp\_must\_staple\_critical** boolean | success | Whether the `ocsp_must_staple` extension is critical. | | **public\_key** string | success | CSR's public key in PEM format **Sample:** -----BEGIN PUBLIC KEY----- MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A... | | **public\_key\_data** dictionary added in 1.7.0 of community.crypto | success | Public key data. Depends on the public key's type. | | | **curve** string | When `public_key_type=ECC` | The curve's name for ECC. | | | **exponent** integer | When `public_key_type=RSA` | The RSA key's public exponent. | | | **exponent\_size** integer | When `public_key_type=ECC` | The maximum number of bits of a private key. This is basically the bit size of the subgroup used. | | | **g** integer | When `public_key_type=DSA` | The `g` value for DSA. This is the element spanning the subgroup of the multiplicative group of the prime field used. | | | **modulus** integer | When `public_key_type=RSA` | The RSA key's modulus. | | | **p** integer | When `public_key_type=DSA` | The `p` value for DSA. This is the prime modulus upon which arithmetic takes place. | | | **q** integer | When `public_key_type=DSA` | The `q` value for DSA. This is a prime that divides `p - 1`, and at the same time the order of the subgroup of the multiplicative group of the prime field used. | | | **size** integer | When `public_key_type=RSA` or `public_key_type=DSA` | Bit size of modulus (RSA) or prime number (DSA). | | | **x** integer | When `public_key_type=ECC` | The `x` coordinate for the public point on the elliptic curve. | | | **y** integer | When `public_key_type=DSA` or `public_key_type=ECC` | For `public_key_type=ECC`, this is the `y` coordinate for the public point on the elliptic curve. For `public_key_type=DSA`, this is the publicly known group element whose discrete logarithm w.r.t. `g` is the private key. | | **public\_key\_fingerprints** dictionary | success | Fingerprints of CSR's public key. For every hash algorithm available, the fingerprint is computed. **Sample:** {'sha256': 'd4:b3:aa:6d:c8:04:ce:4e:ba:f6:29:4d:92:a3:94:b0:c2:ff:bd:bf:33:63:11:43:34:0f:51:b0:95:09:2f:63', 'sha512': 'f7:07:4a:f0:b0:f0:e6:8b:95:5f:f9:e6:61:0a:32:68:f1... | | **public\_key\_type** string added in 1.7.0 of community.crypto | success | The CSR's public key's type. One of `RSA`, `DSA`, `ECC`, `Ed25519`, `X25519`, `Ed448`, or `X448`. Will start with `unknown` if the key type cannot be determined. **Sample:** RSA | | **signature\_valid** boolean | success | Whether the CSR's signature is valid. In case the check returns `no`, the module will fail. | | **subject** dictionary | success | The CSR's subject as a dictionary. Note that for repeated values, only the last one will be returned. **Sample:** {"commonName": "www.example.com", "emailAddress": "[email protected]"} | | **subject\_alt\_name** list / elements=string | success | Entries in the `subject_alt_name` extension, or `none` if extension is not present. **Sample:** [DNS:www.ansible.com, IP:1.2.3.4] | | **subject\_alt\_name\_critical** boolean | success | Whether the `subject_alt_name` extension is critical. | | **subject\_key\_identifier** string | success and if the pyOpenSSL backend is *not* used | The CSR's subject key identifier. The identifier is returned in hexadecimal, with `:` used to separate bytes. Is `none` if the `SubjectKeyIdentifier` extension is not present. **Sample:** 00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff:00:11:22:33 | | **subject\_ordered** list / elements=list | success | The CSR's subject as an ordered list of tuples. **Sample:** [["commonName", "www.example.com"], ["emailAddress": "[email protected]"]] | ### Authors * Felix Fontein (@felixfontein) * Yanis Guenane (@Spredzy) ansible community.crypto.acme_account_info – Retrieves information on ACME accounts community.crypto.acme\_account\_info – Retrieves information on ACME accounts ============================================================================= Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.acme_account_info`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Allows to retrieve information on accounts a CA supporting the [ACME protocol](https://tools.ietf.org/html/rfc8555), such as [Let’s Encrypt](https://letsencrypt.org/). * This module only works with the ACME v2 protocol. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.6 * either openssl or [cryptography](https://cryptography.io/) >= 1.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **account\_key\_content** string | | Content of the ACME account RSA or Elliptic Curve key. Mutually exclusive with `account_key_src`. Required if `account_key_src` is not used. **Warning:** the content will be written into a temporary file, which will be deleted by Ansible when the module completes. Since this is an important private key — it can be used to change the account key, or to revoke your certificates without knowing their private keys —, this might not be acceptable. In case `cryptography` is used, the content is not written into a temporary file. It can still happen that it is written to disk by Ansible in the process of moving the module with its argument to the node where it is executed. | | **account\_key\_passphrase** string added in 1.6.0 of community.crypto | | Phassphrase to use to decode the account key. **Note:** this is not supported by the `openssl` backend, only by the `cryptography` backend. | | **account\_key\_src** path | | Path to a file containing the ACME account RSA or Elliptic Curve key. Private keys can be created with the [community.crypto.openssl\_privatekey](openssl_privatekey_module) or [community.crypto.openssl\_privatekey\_pipe](openssl_privatekey_pipe_module) modules. If the requisites (pyOpenSSL or cryptography) are not available, keys can also be created directly with the `openssl` command line tool: RSA keys can be created with `openssl genrsa ...`. Elliptic curve keys can be created with `openssl ecparam -genkey ...`. Any other tool creating private keys in PEM format can be used as well. Mutually exclusive with `account_key_content`. Required if `account_key_content` is not used. aliases: account\_key | | **account\_uri** string | | If specified, assumes that the account URI is as given. If the account key does not match this account, or an account with this URI does not exist, the module fails. | | **acme\_directory** string | | The ACME directory to use. This is the entry point URL to access the ACME CA server API. For safety reasons the default is set to the Let's Encrypt staging server (for the ACME v1 protocol). This will create technically correct, but untrusted certificates. The default value is `https://acme-staging.api.letsencrypt.org/directory`. Note that in community.crypto 2.0.0, this option **will be required** and will no longer have a default. Note that the default is the Let's Encrypt staging server for the ACME v1 protocol, which is deprecated and will be disabled in May 2021 (see [here](https://community.letsencrypt.org/t/end-of-life-plan-for-acmev1/88430/7) for details). For Let's Encrypt, all staging endpoints can be found here: <https://letsencrypt.org/docs/staging-environment/>. For Buypass, all endpoints can be found here: <https://community.buypass.com/t/63d4ay/buypass-go-ssl-endpoints> For **Let's Encrypt**, the production directory URL for ACME v2 is <https://acme-v02.api.letsencrypt.org/directory>. (The production directory URL for ACME v1 is <https://acme-v01.api.letsencrypt.org/directory> and will be disabled in July 2021.) For **Buypass**, the production directory URL for ACME v2 and v1 is <https://api.buypass.com/acme/directory>. For **ZeroSSL**, the production directory URL for ACME v2 is <https://acme.zerossl.com/v2/DV90>. **Warning:** So far, the ACME modules have only been tested against Let's Encrypt (staging and production), Buypass (staging and production), ZeroSSL (production), and [Pebble testing server](https://github.com/letsencrypt/Pebble). If you experience problems with another ACME server, please [create an issue](https://github.com/ansible-collections/community.crypto/issues/new/choose) to help us supporting it. Feedback that an ACME server not mentioned does work is also appreciated. | | **acme\_version** integer | **Choices:*** 1 * 2 | The ACME version of the endpoint. Must be `1` for the classic Let's Encrypt and Buypass ACME endpoints, or `2` for standardized ACME v2 endpoints. The default value is `1`. Note that in community.crypto 2.0.0, this option **will be required** and will no longer have a default. Please also note that we will deprecate ACME v1 support eventually. | | **retrieve\_orders** string | **Choices:*** **ignore** ← * url\_list * object\_list | Whether to retrieve the list of order URLs or order objects, if provided by the ACME server. A value of `ignore` will not fetch the list of orders. If the value is not `ignore` and the ACME server supports orders, the `order_uris` return value is always populated. The `orders` return value currently depends on whether this option is set to `url_list` or `object_list`. In community.crypto 2.0.0, it will only be returned if this option is set to `object_list`. Currently, Let's Encrypt does not return orders, so the `orders` result will always be empty. | | **select\_crypto\_backend** string | **Choices:*** **auto** ← * cryptography * openssl | Determines which crypto backend to use. The default choice is `auto`, which tries to use `cryptography` if available, and falls back to `openssl`. If set to `openssl`, will try to use the `openssl` binary. If set to `cryptography`, will try to use the [cryptography](https://cryptography.io/) library. | | **validate\_certs** boolean | **Choices:*** no * **yes** ← | Whether calls to the ACME directory will validate TLS certificates. **Warning:** Should **only ever** be set to `no` for testing purposes, for example when testing against a local Pebble server. | Notes ----- Note * The [community.crypto.acme\_account](acme_account_module#ansible-collections-community-crypto-acme-account-module) module allows to modify, create and delete ACME accounts. * This module was called `acme_account_facts` before Ansible 2.8. The usage did not change. * Supports `check_mode`. * If a new enough version of the `cryptography` library is available (see Requirements for details), it will be used instead of the `openssl` binary. This can be explicitly disabled or enabled with the `select_crypto_backend` option. Note that using the `openssl` binary will be slower and less secure, as private key contents always have to be stored on disk (see `account_key_content`). * Although the defaults are chosen so that the module can be used with the [Let’s Encrypt](https://letsencrypt.org/) CA, the module can in principle be used with any CA providing an ACME endpoint, such as [Buypass Go SSL](https://www.buypass.com/ssl/products/acme). See Also -------- See also [community.crypto.acme\_account](acme_account_module#ansible-collections-community-crypto-acme-account-module) Allows to create, modify or delete an ACME account. Examples -------- ``` - name: Check whether an account with the given account key exists community.crypto.acme_account_info: account_key_src: /etc/pki/cert/private/account.key register: account_data - name: Verify that account exists assert: that: - account_data.exists - name: Print account URI ansible.builtin.debug: var: account_data.account_uri - name: Print account contacts ansible.builtin.debug: var: account_data.account.contact - name: Check whether the account exists and is accessible with the given account key acme_account_info: account_key_content: "{{ acme_account_key }}" account_uri: "{{ acme_account_uri }}" register: account_data - name: Verify that account exists assert: that: - account_data.exists - name: Print account contacts ansible.builtin.debug: var: account_data.account.contact ``` 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** dictionary | if account exists | The account information, as retrieved from the ACME server. | | | **contact** list / elements=string | always | the challenge resource that must be created for validation **Sample:** ['mailto:[email protected]', 'tel:00123456789'] | | | **orders** string | always | A URL where a list of orders can be retrieved for this account. Use the *retrieve\_orders* option to query this URL and retrieve the complete list of orders. **Sample:** https://example.ca/account/1/orders | | | **public\_account\_key** string | always | the public account key as a [JSON Web Key](https://tools.ietf.org/html/rfc7517). **Sample:** {"kty":"EC","crv":"P-256","x":"MKBCTNIcKUSDii11ySs3526iDZ8AiTo7Tu6KPAqv7D4","y":"4Etl6SRW2YiLUrN5vfvVHuhp7x8PxltmWWlbbM4IFyM"} | | | **status** string | always | the account's status **Can only return:** valid, deactivated, revoked **Sample:** valid | | **account\_uri** string | always | ACME account URI, or None if account does not exist. | | **exists** boolean | always | Whether the account exists. | | **order\_uris** list / elements=string added in 1.5.0 of community.crypto | if account exists, *retrieve\_orders* is not `ignore`, and server supports order listing | The list of orders. If *retrieve\_orders* is `url_list`, this will be a list of URLs. If *retrieve\_orders* is `object_list`, this will be a list of objects. | | **orders** list / elements=string | if account exists, *retrieve\_orders* is not `ignore`, and server supports order listing | The list of orders. If *retrieve\_orders* is `url_list`, this will be a list of URLs. In community.crypto 2.0.0, this return value will no longer be returned for `url_list`. If *retrieve\_orders* is `object_list`, this will be a list of objects. | | | **authorizations** list / elements=string | success | A list of URLs for authorizations for this order. | | | **certificate** string | when certificate was issued | The URL for retrieving the certificate. | | | **error** dictionary | when an error occurred | In case an error occurred during processing, this contains information about the error. The field is structured as a problem document (RFC7807). | | | **expires** string | when server gives expiry date | When the order expires. Timestamp should be formatted as described in RFC3339. Only required to be included in result when *status* is `pending` or `valid`. | | | **finalize** string | success | A URL used for finalizing an ACME order. | | | **identifiers** list / elements=dictionary | success | List of identifiers this order is for. | | | | **type** string | success | Type of identifier. `dns` or `ip`. | | | | **value** string | success | Name of identifier. Hostname or IP address. | | | | **wildcard** boolean | required to be included if the identifier is wildcarded | Whether *value* is actually a wildcard. The wildcard prefix `*.` is not included in *value* if this is `true`. | | | **notAfter** string | when server returns this | The requested value of the `notAfter` field in the certificate. Date should be formatted as described in RFC3339. Server is not required to return this. | | | **notBefore** string | when server returns this | The requested value of the `notBefore` field in the certificate. Date should be formatted as described in RFC3339. Server is not required to return this. | | | **status** string | success | The order's status. **Can only return:** pending, ready, processing, valid, invalid | ### Authors * Felix Fontein (@felixfontein)
programming_docs
ansible community.crypto.openssl_pkcs12 – Generate OpenSSL PKCS#12 archive community.crypto.openssl\_pkcs12 – Generate OpenSSL PKCS#12 archive =================================================================== Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.openssl_pkcs12`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows one to (re-)generate PKCS#12. * The module can use the cryptography Python library, or the pyOpenSSL Python library. By default, it tries to detect which one is available, assuming none of the *iter\_size* and *maciter\_size* options are used. This can be overridden with the *select\_crypto\_backend* option. Requirements ------------ The below requirements are needed on the host that executes this module. * PyOpenSSL >= 0.15 or cryptography >= 3.0 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **action** string | **Choices:*** **export** ← * parse | `export` or `parse` a PKCS#12. | | **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 | | **backup** boolean | **Choices:*** **no** ← * yes | Create a backup file including a timestamp so you can get the original output file back if you overwrote it with a new one by accident. | | **certificate\_path** path | | The path to read certificates and private keys from. Must be in PEM format. | | **force** boolean | **Choices:*** **no** ← * yes | Should the file be regenerated even if it already exists. | | **friendly\_name** string | | Specifies the friendly name for the certificate and private key. aliases: name | | **group** string | | Name of the group that should own the file/directory, as would be fed to *chown*. | | **iter\_size** integer | | Number of times to repeat the encryption step. This is not considered during idempotency checks. This is only used by the `pyopenssl` backend. When using it, the default is `2048`. | | **maciter\_size** integer | | Number of times to repeat the MAC step. This is not considered during idempotency checks. This is only used by the `pyopenssl` backend. When using it, the default is `1`. | | **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. | | **other\_certificates** list / elements=path | | List of other certificates to include. Pre Ansible 2.8 this parameter was called *ca\_certificates*. Assumes there is one PEM-encoded certificate per file. If a file contains multiple PEM certificates, set *other\_certificates\_parse\_all* to `true`. aliases: ca\_certificates | | **other\_certificates\_parse\_all** boolean added in 1.4.0 of community.crypto | **Choices:*** **no** ← * yes | If set to `true`, assumes that the files mentioned in *other\_certificates* can contain more than one certificate per file (or even none per file). | | **owner** string | | Name of the user that should own the file/directory, as would be fed to *chown*. | | **passphrase** string | | The PKCS#12 password. **Note:** PKCS12 encryption is not secure and should not be used as a security mechanism. If you need to store or send a PKCS12 file safely, you should additionally encrypt it with something else. | | **path** path / required | | Filename to write the PKCS#12 file to. | | **privatekey\_passphrase** string | | Passphrase source to decrypt any input private keys with. | | **privatekey\_path** path | | File to read private key from. | | **return\_content** boolean added in 1.0.0 of community.crypto | **Choices:*** **no** ← * yes | If set to `yes`, will return the (current or generated) PKCS#12's content as *pkcs12*. | | **select\_crypto\_backend** string added in 1.7.0 of community.crypto | **Choices:*** **auto** ← * cryptography * pyopenssl | Determines which crypto backend to use. The default choice is `auto`, which tries to use `cryptography` if available, and falls back to `pyopenssl`. If one of *iter\_size* or *maciter\_size* is used, `auto` will always result in `pyopenssl` to be chosen for backwards compatibility. If set to `pyopenssl`, will try to use the [pyOpenSSL](https://pypi.org/project/pyOpenSSL/) library. If set to `cryptography`, will try to use the [cryptography](https://cryptography.io/) library. | | **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. | | **src** path | | PKCS#12 file path to parse. | | **state** string | **Choices:*** absent * **present** ← | Whether the file should exist or not. All parameters except `path` are ignored when state is `absent`. | | **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. | See Also -------- See also [community.crypto.x509\_certificate](x509_certificate_module#ansible-collections-community-crypto-x509-certificate-module) The official documentation on the **community.crypto.x509\_certificate** module. [community.crypto.openssl\_csr](openssl_csr_module#ansible-collections-community-crypto-openssl-csr-module) The official documentation on the **community.crypto.openssl\_csr** module. [community.crypto.openssl\_dhparam](openssl_dhparam_module#ansible-collections-community-crypto-openssl-dhparam-module) The official documentation on the **community.crypto.openssl\_dhparam** module. [community.crypto.openssl\_privatekey](openssl_privatekey_module#ansible-collections-community-crypto-openssl-privatekey-module) The official documentation on the **community.crypto.openssl\_privatekey** module. [community.crypto.openssl\_publickey](openssl_publickey_module#ansible-collections-community-crypto-openssl-publickey-module) The official documentation on the **community.crypto.openssl\_publickey** module. Examples -------- ``` - name: Generate PKCS#12 file community.crypto.openssl_pkcs12: action: export path: /opt/certs/ansible.p12 friendly_name: raclette privatekey_path: /opt/certs/keys/key.pem certificate_path: /opt/certs/cert.pem other_certificates: /opt/certs/ca.pem # Note that if /opt/certs/ca.pem contains multiple certificates, # only the first one will be used. See the other_certificates_parse_all # option for changing this behavior. state: present - name: Generate PKCS#12 file community.crypto.openssl_pkcs12: action: export path: /opt/certs/ansible.p12 friendly_name: raclette privatekey_path: /opt/certs/keys/key.pem certificate_path: /opt/certs/cert.pem other_certificates_parse_all: true other_certificates: - /opt/certs/ca_bundle.pem # Since we set other_certificates_parse_all to true, all # certificates in the CA bundle are included and not just # the first one. - /opt/certs/intermediate.pem # In case this file has multiple certificates in it, # all will be included as well. state: present - name: Change PKCS#12 file permission community.crypto.openssl_pkcs12: action: export path: /opt/certs/ansible.p12 friendly_name: raclette privatekey_path: /opt/certs/keys/key.pem certificate_path: /opt/certs/cert.pem other_certificates: /opt/certs/ca.pem state: present mode: '0600' - name: Regen PKCS#12 file community.crypto.openssl_pkcs12: action: export src: /opt/certs/ansible.p12 path: /opt/certs/ansible.p12 friendly_name: raclette privatekey_path: /opt/certs/keys/key.pem certificate_path: /opt/certs/cert.pem other_certificates: /opt/certs/ca.pem state: present mode: '0600' force: yes - name: Dump/Parse PKCS#12 file community.crypto.openssl_pkcs12: action: parse src: /opt/certs/ansible.p12 path: /opt/certs/ansible.pem state: present - name: Remove PKCS#12 file community.crypto.openssl_pkcs12: path: /opt/certs/ansible.p12 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 | | --- | --- | --- | | **backup\_file** string | changed and if *backup* is `yes` | Name of backup file created. **Sample:** /path/to/ansible.com.pem.2019-03-09@11:22~ | | **filename** string | changed or success | Path to the generate PKCS#12 file. **Sample:** /opt/certs/ansible.p12 | | **pkcs12** string added in 1.0.0 of community.crypto | if *state* is `present` and *return\_content* is `yes` | The (current or generated) PKCS#12's content Base64 encoded. | | **privatekey** string | changed or success | Path to the TLS/SSL private key the public key was generated from. **Sample:** /etc/ssl/private/ansible.com.pem | ### Authors * Guillaume Delpierre (@gdelpierre) ansible community.crypto.acme_account – Create, modify or delete ACME accounts community.crypto.acme\_account – Create, modify or delete ACME accounts ======================================================================= Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.acme_account`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Allows to create, modify or delete accounts with a CA supporting the [ACME protocol](https://tools.ietf.org/html/rfc8555), such as [Let’s Encrypt](https://letsencrypt.org/). * This module only works with the ACME v2 protocol. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.6 * either openssl or [cryptography](https://cryptography.io/) >= 1.5 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **account\_key\_content** string | | Content of the ACME account RSA or Elliptic Curve key. Mutually exclusive with `account_key_src`. Required if `account_key_src` is not used. **Warning:** the content will be written into a temporary file, which will be deleted by Ansible when the module completes. Since this is an important private key — it can be used to change the account key, or to revoke your certificates without knowing their private keys —, this might not be acceptable. In case `cryptography` is used, the content is not written into a temporary file. It can still happen that it is written to disk by Ansible in the process of moving the module with its argument to the node where it is executed. | | **account\_key\_passphrase** string added in 1.6.0 of community.crypto | | Phassphrase to use to decode the account key. **Note:** this is not supported by the `openssl` backend, only by the `cryptography` backend. | | **account\_key\_src** path | | Path to a file containing the ACME account RSA or Elliptic Curve key. Private keys can be created with the [community.crypto.openssl\_privatekey](openssl_privatekey_module) or [community.crypto.openssl\_privatekey\_pipe](openssl_privatekey_pipe_module) modules. If the requisites (pyOpenSSL or cryptography) are not available, keys can also be created directly with the `openssl` command line tool: RSA keys can be created with `openssl genrsa ...`. Elliptic curve keys can be created with `openssl ecparam -genkey ...`. Any other tool creating private keys in PEM format can be used as well. Mutually exclusive with `account_key_content`. Required if `account_key_content` is not used. aliases: account\_key | | **account\_uri** string | | If specified, assumes that the account URI is as given. If the account key does not match this account, or an account with this URI does not exist, the module fails. | | **acme\_directory** string | | The ACME directory to use. This is the entry point URL to access the ACME CA server API. For safety reasons the default is set to the Let's Encrypt staging server (for the ACME v1 protocol). This will create technically correct, but untrusted certificates. The default value is `https://acme-staging.api.letsencrypt.org/directory`. Note that in community.crypto 2.0.0, this option **will be required** and will no longer have a default. Note that the default is the Let's Encrypt staging server for the ACME v1 protocol, which is deprecated and will be disabled in May 2021 (see [here](https://community.letsencrypt.org/t/end-of-life-plan-for-acmev1/88430/7) for details). For Let's Encrypt, all staging endpoints can be found here: <https://letsencrypt.org/docs/staging-environment/>. For Buypass, all endpoints can be found here: <https://community.buypass.com/t/63d4ay/buypass-go-ssl-endpoints> For **Let's Encrypt**, the production directory URL for ACME v2 is <https://acme-v02.api.letsencrypt.org/directory>. (The production directory URL for ACME v1 is <https://acme-v01.api.letsencrypt.org/directory> and will be disabled in July 2021.) For **Buypass**, the production directory URL for ACME v2 and v1 is <https://api.buypass.com/acme/directory>. For **ZeroSSL**, the production directory URL for ACME v2 is <https://acme.zerossl.com/v2/DV90>. **Warning:** So far, the ACME modules have only been tested against Let's Encrypt (staging and production), Buypass (staging and production), ZeroSSL (production), and [Pebble testing server](https://github.com/letsencrypt/Pebble). If you experience problems with another ACME server, please [create an issue](https://github.com/ansible-collections/community.crypto/issues/new/choose) to help us supporting it. Feedback that an ACME server not mentioned does work is also appreciated. | | **acme\_version** integer | **Choices:*** 1 * 2 | The ACME version of the endpoint. Must be `1` for the classic Let's Encrypt and Buypass ACME endpoints, or `2` for standardized ACME v2 endpoints. The default value is `1`. Note that in community.crypto 2.0.0, this option **will be required** and will no longer have a default. Please also note that we will deprecate ACME v1 support eventually. | | **allow\_creation** boolean | **Choices:*** no * **yes** ← | Whether account creation is allowed (when state is `present`). | | **contact** list / elements=string | **Default:**[] | A list of contact URLs. Email addresses must be prefixed with `mailto:`. See <https://tools.ietf.org/html/rfc8555#section-7.3> for what is allowed. Must be specified when state is `present`. Will be ignored if state is `absent` or `changed_key`. | | **external\_account\_binding** dictionary added in 1.1.0 of community.crypto | | Allows to provide external account binding data during account creation. This is used by CAs like Sectigo to bind a new ACME account to an existing CA-specific account, to be able to properly identify a customer. Only used when creating a new account. Can not be specified for ACME v1. | | | **alg** string / required | **Choices:*** HS256 * HS384 * HS512 | The MAC algorithm provided by the CA. If not specified by the CA, this is probably `HS256`. | | | **key** string / required | | Base64 URL encoded value of the MAC key provided by the CA. Padding (`=` symbols at the end) can be omitted. | | | **kid** string / required | | The key identifier provided by the CA. | | **new\_account\_key\_content** string | | Content of the ACME account RSA or Elliptic Curve key to change to. Same restrictions apply as to `account_key_content`. Mutually exclusive with `new_account_key_src`. Required if `new_account_key_src` is not used and state is `changed_key`. | | **new\_account\_key\_passphrase** string added in 1.6.0 of community.crypto | | Phassphrase to use to decode the new account key. **Note:** this is not supported by the `openssl` backend, only by the `cryptography` backend. | | **new\_account\_key\_src** path | | Path to a file containing the ACME account RSA or Elliptic Curve key to change to. Same restrictions apply as to `account_key_src`. Mutually exclusive with `new_account_key_content`. Required if `new_account_key_content` is not used and state is `changed_key`. | | **select\_crypto\_backend** string | **Choices:*** **auto** ← * cryptography * openssl | Determines which crypto backend to use. The default choice is `auto`, which tries to use `cryptography` if available, and falls back to `openssl`. If set to `openssl`, will try to use the `openssl` binary. If set to `cryptography`, will try to use the [cryptography](https://cryptography.io/) library. | | **state** string / required | **Choices:*** present * absent * changed\_key | The state of the account, to be identified by its account key. If the state is `absent`, the account will either not exist or be deactivated. If the state is `changed_key`, the account must exist. The account key will be changed; no other information will be touched. | | **terms\_agreed** boolean | **Choices:*** **no** ← * yes | Boolean indicating whether you agree to the terms of service document. ACME servers can require this to be true. | | **validate\_certs** boolean | **Choices:*** no * **yes** ← | Whether calls to the ACME directory will validate TLS certificates. **Warning:** Should **only ever** be set to `no` for testing purposes, for example when testing against a local Pebble server. | Notes ----- Note * The [community.crypto.acme\_certificate](acme_certificate_module#ansible-collections-community-crypto-acme-certificate-module) module also allows to do basic account management. When using both modules, it is recommended to disable account management for [community.crypto.acme\_certificate](acme_certificate_module#ansible-collections-community-crypto-acme-certificate-module). For that, use the `modify_account` option of [community.crypto.acme\_certificate](acme_certificate_module#ansible-collections-community-crypto-acme-certificate-module). * If a new enough version of the `cryptography` library is available (see Requirements for details), it will be used instead of the `openssl` binary. This can be explicitly disabled or enabled with the `select_crypto_backend` option. Note that using the `openssl` binary will be slower and less secure, as private key contents always have to be stored on disk (see `account_key_content`). * Although the defaults are chosen so that the module can be used with the [Let’s Encrypt](https://letsencrypt.org/) CA, the module can in principle be used with any CA providing an ACME endpoint, such as [Buypass Go SSL](https://www.buypass.com/ssl/products/acme). See Also -------- See also [Automatic Certificate Management Environment (ACME)](https://tools.ietf.org/html/rfc8555) The specification of the ACME protocol (RFC 8555). [community.crypto.acme\_account\_info](acme_account_info_module#ansible-collections-community-crypto-acme-account-info-module) Retrieves facts about an ACME account. [community.crypto.openssl\_privatekey](openssl_privatekey_module#ansible-collections-community-crypto-openssl-privatekey-module) Can be used to create a private account key. [community.crypto.openssl\_privatekey\_pipe](openssl_privatekey_pipe_module#ansible-collections-community-crypto-openssl-privatekey-pipe-module) Can be used to create a private account key without writing it to disk. [community.crypto.acme\_inspect](acme_inspect_module#ansible-collections-community-crypto-acme-inspect-module) Allows to debug problems. Examples -------- ``` - name: Make sure account exists and has given contacts. We agree to TOS. community.crypto.acme_account: account_key_src: /etc/pki/cert/private/account.key state: present terms_agreed: yes contact: - mailto:[email protected] - mailto:[email protected] - name: Make sure account has given email address. Don't create account if it doesn't exist community.crypto.acme_account: account_key_src: /etc/pki/cert/private/account.key state: present allow_creation: no contact: - mailto:[email protected] - name: Change account's key to the one stored in the variable new_account_key community.crypto.acme_account: account_key_src: /etc/pki/cert/private/account.key new_account_key_content: '{{ new_account_key }}' state: changed_key - name: Delete account (we have to use the new key) community.crypto.acme_account: account_key_content: '{{ new_account_key }}' 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\_uri** string | always | ACME account URI, or None if account does not exist. | ### Authors * Felix Fontein (@felixfontein)
programming_docs
ansible community.crypto.openssl_csr_pipe – Generate OpenSSL Certificate Signing Request (CSR) community.crypto.openssl\_csr\_pipe – Generate OpenSSL Certificate Signing Request (CSR) ======================================================================================== Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.openssl_csr_pipe`. New in version 1.3.0: of community.crypto * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Please note that the module regenerates an existing CSR if it doesn’t match the module’s options, or if it seems to be corrupt. * The module can use the cryptography Python library, or the pyOpenSSL Python library. By default, it tries to detect which one is available. This can be overridden with the *select\_crypto\_backend* option. Please note that the PyOpenSSL backend was deprecated in Ansible 2.9 and will be removed in community.crypto 2.0.0. * This module allows one to (re)generate OpenSSL certificate signing requests. * This module supports the subjectAltName, keyUsage, extendedKeyUsage, basicConstraints and OCSP Must Staple extensions. Requirements ------------ The below requirements are needed on the host that executes this module. * Either cryptography >= 1.3 * Or pyOpenSSL >= 0.15 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **authority\_cert\_issuer** list / elements=string | | Names that will be present in the authority cert issuer field of the certificate signing request. Values must be prefixed by their options. (i.e., `email`, `URI`, `DNS`, `RID`, `IP`, `dirName`, `otherName` and the ones specific to your CA) Example: `DNS:ca.example.org` If specified, *authority\_cert\_serial\_number* must also be specified. Please note that commercial CAs ignore this value, respectively use a value of their own choice. Specifying this option is mostly useful for self-signed certificates or for own CAs. Note that this is only supported if the `cryptography` backend is used! The `AuthorityKeyIdentifier` extension will only be added if at least one of *authority\_key\_identifier*, *authority\_cert\_issuer* and *authority\_cert\_serial\_number* is specified. | | **authority\_cert\_serial\_number** integer | | The authority cert serial number. If specified, *authority\_cert\_issuer* must also be specified. Note that this is only supported if the `cryptography` backend is used! Please note that commercial CAs ignore this value, respectively use a value of their own choice. Specifying this option is mostly useful for self-signed certificates or for own CAs. The `AuthorityKeyIdentifier` extension will only be added if at least one of *authority\_key\_identifier*, *authority\_cert\_issuer* and *authority\_cert\_serial\_number* is specified. | | **authority\_key\_identifier** string | | The authority key identifier as a hex string, where two bytes are separated by colons. Example: `00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff:00:11:22:33` Please note that commercial CAs ignore this value, respectively use a value of their own choice. Specifying this option is mostly useful for self-signed certificates or for own CAs. Note that this is only supported if the `cryptography` backend is used! The `AuthorityKeyIdentifier` extension will only be added if at least one of *authority\_key\_identifier*, *authority\_cert\_issuer* and *authority\_cert\_serial\_number* is specified. | | **basic\_constraints** list / elements=string | | Indicates basic constraints, such as if the certificate is a CA. aliases: basicConstraints | | **basic\_constraints\_critical** boolean | **Choices:*** **no** ← * yes | Should the basicConstraints extension be considered as critical. aliases: basicConstraints\_critical | | **common\_name** string | | The commonName field of the certificate signing request subject. aliases: CN, commonName | | **content** string | | The existing CSR. | | **country\_name** string | | The countryName field of the certificate signing request subject. aliases: C, countryName | | **create\_subject\_key\_identifier** boolean | **Choices:*** **no** ← * yes | Create the Subject Key Identifier from the public key. Please note that commercial CAs can ignore the value, respectively use a value of their own choice instead. Specifying this option is mostly useful for self-signed certificates or for own CAs. Note that this is only supported if the `cryptography` backend is used! | | **crl\_distribution\_points** list / elements=dictionary added in 1.4.0 of community.crypto | | Allows to specify one or multiple CRL distribution points. Only supported by the `cryptography` backend. | | | **crl\_issuer** list / elements=string | | Information about the issuer of the CRL. | | | **full\_name** list / elements=string | | Describes how the CRL can be retrieved. Mutually exclusive with *relative\_name*. Example: `URI:https://ca.example.com/revocations.crl`. | | | **reasons** list / elements=string | **Choices:*** key\_compromise * ca\_compromise * affiliation\_changed * superseded * cessation\_of\_operation * certificate\_hold * privilege\_withdrawn * aa\_compromise | List of reasons that this distribution point can be used for when performing revocation checks. | | | **relative\_name** list / elements=string | | Describes how the CRL can be retrieved relative to the CRL issuer. Mutually exclusive with *full\_name*. Example: `/CN=example.com`. Can only be used when cryptography >= 1.6 is installed. | | **digest** string | **Default:**"sha256" | The digest used when signing the certificate signing request with the private key. | | **email\_address** string | | The emailAddress field of the certificate signing request subject. aliases: E, emailAddress | | **extended\_key\_usage** list / elements=string | | Additional restrictions (e.g. client authentication, server authentication) on the allowed purposes for which the public key may be used. aliases: extKeyUsage, extendedKeyUsage | | **extended\_key\_usage\_critical** boolean | **Choices:*** **no** ← * yes | Should the extkeyUsage extension be considered as critical. aliases: extKeyUsage\_critical, extendedKeyUsage\_critical | | **key\_usage** list / elements=string | | This defines the purpose (e.g. encipherment, signature, certificate signing) of the key contained in the certificate. aliases: keyUsage | | **key\_usage\_critical** boolean | **Choices:*** **no** ← * yes | Should the keyUsage extension be considered as critical. aliases: keyUsage\_critical | | **locality\_name** string | | The localityName field of the certificate signing request subject. aliases: L, localityName | | **name\_constraints\_critical** boolean | **Choices:*** **no** ← * yes | Should the Name Constraints extension be considered as critical. | | **name\_constraints\_excluded** list / elements=string | | For CA certificates, this specifies a list of identifiers which describe subtrees of names that this CA is **not** allowed to issue certificates for. Values must be prefixed by their options. (i.e., `email`, `URI`, `DNS`, `RID`, `IP`, `dirName`, `otherName` and the ones specific to your CA). | | **name\_constraints\_permitted** list / elements=string | | For CA certificates, this specifies a list of identifiers which describe subtrees of names that this CA is allowed to issue certificates for. Values must be prefixed by their options. (i.e., `email`, `URI`, `DNS`, `RID`, `IP`, `dirName`, `otherName` and the ones specific to your CA). | | **ocsp\_must\_staple** boolean | **Choices:*** **no** ← * yes | Indicates that the certificate should contain the OCSP Must Staple extension (<https://tools.ietf.org/html/rfc7633>). aliases: ocspMustStaple | | **ocsp\_must\_staple\_critical** boolean | **Choices:*** **no** ← * yes | Should the OCSP Must Staple extension be considered as critical. Note that according to the RFC, this extension should not be marked as critical, as old clients not knowing about OCSP Must Staple are required to reject such certificates (see <https://tools.ietf.org/html/rfc7633#section-4>). aliases: ocspMustStaple\_critical | | **organization\_name** string | | The organizationName field of the certificate signing request subject. aliases: O, organizationName | | **organizational\_unit\_name** string | | The organizationalUnitName field of the certificate signing request subject. aliases: OU, organizationalUnitName | | **privatekey\_content** string | | The content of the private key to use when signing the certificate signing request. Either *privatekey\_path* or *privatekey\_content* must be specified if *state* is `present`, but not both. | | **privatekey\_passphrase** string | | The passphrase for the private key. This is required if the private key is password protected. | | **privatekey\_path** path | | The path to the private key to use when signing the certificate signing request. Either *privatekey\_path* or *privatekey\_content* must be specified if *state* is `present`, but not both. | | **select\_crypto\_backend** string | **Choices:*** **auto** ← * cryptography * pyopenssl | Determines which crypto backend to use. The default choice is `auto`, which tries to use `cryptography` if available, and falls back to `pyopenssl`. If set to `pyopenssl`, will try to use the [pyOpenSSL](https://pypi.org/project/pyOpenSSL/) library. If set to `cryptography`, will try to use the [cryptography](https://cryptography.io/) library. Please note that the `pyopenssl` backend has been deprecated in Ansible 2.9, and will be removed in community.crypto 2.0.0. From that point on, only the `cryptography` backend will be available. | | **state\_or\_province\_name** string | | The stateOrProvinceName field of the certificate signing request subject. aliases: ST, stateOrProvinceName | | **subject** dictionary | | Key/value pairs that will be present in the subject name field of the certificate signing request. If you need to specify more than one value with the same key, use a list as value. | | **subject\_alt\_name** list / elements=string | | Subject Alternative Name (SAN) extension to attach to the certificate signing request. This can either be a 'comma separated string' or a YAML list. Values must be prefixed by their options. (i.e., `email`, `URI`, `DNS`, `RID`, `IP`, `dirName`, `otherName` and the ones specific to your CA). Note that if no SAN is specified, but a common name, the common name will be added as a SAN except if `useCommonNameForSAN` is set to *false*. More at <https://tools.ietf.org/html/rfc5280#section-4.2.1.6>. aliases: subjectAltName | | **subject\_alt\_name\_critical** boolean | **Choices:*** **no** ← * yes | Should the subjectAltName extension be considered as critical. aliases: subjectAltName\_critical | | **subject\_key\_identifier** string | | The subject key identifier as a hex string, where two bytes are separated by colons. Example: `00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff:00:11:22:33` Please note that commercial CAs ignore this value, respectively use a value of their own choice. Specifying this option is mostly useful for self-signed certificates or for own CAs. Note that this option can only be used if *create\_subject\_key\_identifier* is `no`. Note that this is only supported if the `cryptography` backend is used! | | **use\_common\_name\_for\_san** boolean | **Choices:*** no * **yes** ← | If set to `yes`, the module will fill the common name in for `subject_alt_name` with `DNS:` prefix if no SAN is specified. aliases: useCommonNameForSAN | | **version** integer | **Default:**1 | The version of the certificate signing request. The only allowed value according to [RFC 2986](https://tools.ietf.org/html/rfc2986#section-4.1) is 1. This option will no longer accept unsupported values from community.crypto 2.0.0 on. | Notes ----- Note * If the certificate signing request already exists it will be checked whether subjectAltName, keyUsage, extendedKeyUsage and basicConstraints only contain the requested values, whether OCSP Must Staple is as requested, and if the request was signed by the given private key. See Also -------- See also [community.crypto.openssl\_csr](openssl_csr_module#ansible-collections-community-crypto-openssl-csr-module) The official documentation on the **community.crypto.openssl\_csr** module. [community.crypto.x509\_certificate](x509_certificate_module#ansible-collections-community-crypto-x509-certificate-module) The official documentation on the **community.crypto.x509\_certificate** module. [community.crypto.x509\_certificate\_pipe](x509_certificate_pipe_module#ansible-collections-community-crypto-x509-certificate-pipe-module) The official documentation on the **community.crypto.x509\_certificate\_pipe** module. [community.crypto.openssl\_dhparam](openssl_dhparam_module#ansible-collections-community-crypto-openssl-dhparam-module) The official documentation on the **community.crypto.openssl\_dhparam** module. [community.crypto.openssl\_pkcs12](openssl_pkcs12_module#ansible-collections-community-crypto-openssl-pkcs12-module) The official documentation on the **community.crypto.openssl\_pkcs12** module. [community.crypto.openssl\_privatekey](openssl_privatekey_module#ansible-collections-community-crypto-openssl-privatekey-module) The official documentation on the **community.crypto.openssl\_privatekey** module. [community.crypto.openssl\_privatekey\_pipe](openssl_privatekey_pipe_module#ansible-collections-community-crypto-openssl-privatekey-pipe-module) The official documentation on the **community.crypto.openssl\_privatekey\_pipe** module. [community.crypto.openssl\_publickey](openssl_publickey_module#ansible-collections-community-crypto-openssl-publickey-module) The official documentation on the **community.crypto.openssl\_publickey** module. [community.crypto.openssl\_csr\_info](openssl_csr_info_module#ansible-collections-community-crypto-openssl-csr-info-module) The official documentation on the **community.crypto.openssl\_csr\_info** module. Examples -------- ``` - name: Generate an OpenSSL Certificate Signing Request community.crypto.openssl_csr_pipe: privatekey_path: /etc/ssl/private/ansible.com.pem common_name: www.ansible.com register: result - debug: var: result.csr - name: Generate an OpenSSL Certificate Signing Request with an inline CSR community.crypto.openssl_csr: content: "{{ lookup('file', '/etc/ssl/csr/www.ansible.com.csr') }}" privatekey_content: "{{ private_key_content }}" common_name: www.ansible.com register: result - name: Store CSR ansible.builtin.copy: dest: /etc/ssl/csr/www.ansible.com.csr content: "{{ result.csr }}" when: result is changed ``` 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 | | --- | --- | --- | | **basicConstraints** list / elements=string | changed or success | Indicates if the certificate belongs to a CA **Sample:** ['CA:TRUE', 'pathLenConstraint:0'] | | **csr** string | changed or success | The (current or generated) CSR's content. | | **extendedKeyUsage** list / elements=string | changed or success | Additional restriction on the public key purposes **Sample:** ['clientAuth'] | | **keyUsage** list / elements=string | changed or success | Purpose for which the public key may be used **Sample:** ['digitalSignature', 'keyAgreement'] | | **name\_constraints\_excluded** list / elements=string | changed or success | List of excluded subtrees the CA cannot sign certificates for. **Sample:** ['email:.com'] | | **name\_constraints\_permitted** list / elements=string | changed or success | List of permitted subtrees to sign certificates for. **Sample:** ['email:.somedomain.com'] | | **ocsp\_must\_staple** boolean | changed or success | Indicates whether the certificate has the OCSP Must Staple feature enabled | | **privatekey** string | changed or success | Path to the TLS/SSL private key the CSR was generated for Will be `none` if the private key has been provided in *privatekey\_content*. **Sample:** /etc/ssl/private/ansible.com.pem | | **subject** list / elements=list | changed or success | A list of the subject tuples attached to the CSR **Sample:** [('CN', 'www.ansible.com'), ('O', 'Ansible')] | | **subjectAltName** list / elements=string | changed or success | The alternative names this CSR is valid for **Sample:** ['DNS:www.ansible.com', 'DNS:m.ansible.com'] | ### Authors * Yanis Guenane (@Spredzy) * Felix Fontein (@felixfontein) ansible community.crypto.openssl_signature – Sign data with openssl community.crypto.openssl\_signature – Sign data with openssl ============================================================ Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.openssl_signature`. New in version 1.1.0: of community.crypto * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows one to sign data using a private key. * The module can use the cryptography Python library, or the pyOpenSSL Python library. By default, it tries to detect which one is available. This can be overridden with the *select\_crypto\_backend* option. Please note that the PyOpenSSL backend was deprecated in Ansible 2.9 and will be removed in community.crypto 2.0.0. Requirements ------------ The below requirements are needed on the host that executes this module. * Either cryptography >= 1.4 (some key types require newer versions) * Or pyOpenSSL >= 0.11 (Ed25519 and Ed448 keys are not supported with this backend) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **path** path / required | | The file to sign. This file will only be read and not modified. | | **privatekey\_content** string | | The content of the private key to use when signing the certificate signing request. Either *privatekey\_path* or *privatekey\_content* must be specified, but not both. | | **privatekey\_passphrase** string | | The passphrase for the private key. This is required if the private key is password protected. | | **privatekey\_path** path | | The path to the private key to use when signing. Either *privatekey\_path* or *privatekey\_content* must be specified, but not both. | | **select\_crypto\_backend** string | **Choices:*** **auto** ← * cryptography * pyopenssl | Determines which crypto backend to use. The default choice is `auto`, which tries to use `cryptography` if available, and falls back to `pyopenssl`. If set to `pyopenssl`, will try to use the [pyOpenSSL](https://pypi.org/project/pyOpenSSL/) library. If set to `cryptography`, will try to use the [cryptography](https://cryptography.io/) library. | Notes ----- Note * When using the `cryptography` backend, the following key types require at least the following `cryptography` version: RSA keys: `cryptography` >= 1.4 DSA and ECDSA keys: `cryptography` >= 1.5 ed448 and ed25519 keys: `cryptography` >= 2.6 See Also -------- See also [community.crypto.openssl\_signature\_info](openssl_signature_info_module#ansible-collections-community-crypto-openssl-signature-info-module) The official documentation on the **community.crypto.openssl\_signature\_info** module. [community.crypto.openssl\_privatekey](openssl_privatekey_module#ansible-collections-community-crypto-openssl-privatekey-module) The official documentation on the **community.crypto.openssl\_privatekey** module. Examples -------- ``` - name: Sign example file community.crypto.openssl_signature: privatekey_path: private.key path: /tmp/example_file register: sig - name: Verify signature of example file community.crypto.openssl_signature_info: certificate_path: cert.pem path: /tmp/example_file signature: "{{ sig.signature }}" register: verify - name: Make sure the signature is valid assert: that: - verify.valid ``` 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 | | --- | --- | --- | | **signature** string | success | Base64 encoded signature. | ### Authors * Patrick Pichler (@aveexy) * Markus Teufelberger (@MarkusTeufelberger)
programming_docs
ansible community.crypto.openssl_publickey – Generate an OpenSSL public key from its private key. community.crypto.openssl\_publickey – Generate an OpenSSL public key from its private key. ========================================================================================== Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.openssl_publickey`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows one to (re)generate OpenSSL public keys from their private keys. * Keys are generated in PEM or OpenSSH format. * The module can use the cryptography Python library, or the pyOpenSSL Python library. By default, it tries to detect which one is available. This can be overridden with the *select\_crypto\_backend* option. When *format* is `OpenSSH`, the `cryptography` backend has to be used. Please note that the PyOpenSSL backend was deprecated in Ansible 2.9 and will be removed in community.crypto 2.0.0. Requirements ------------ The below requirements are needed on the host that executes this module. * Either cryptography >= 1.2.3 (older versions might work as well) * Or pyOpenSSL >= 16.0.0 * Needs cryptography >= 1.4 if *format* is `OpenSSH` 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 | | **backup** boolean | **Choices:*** **no** ← * yes | Create a backup file including a timestamp so you can get the original public key back if you overwrote it with a different one by accident. | | **force** boolean | **Choices:*** **no** ← * yes | Should the key be regenerated even it it already exists. | | **format** string | **Choices:*** OpenSSH * **PEM** ← | The format of the public key. | | **group** string | | Name of the group that should own the file/directory, as would be fed to *chown*. | | **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 | | Name of the file in which the generated TLS/SSL public key will be written. | | **privatekey\_content** string added in 1.0.0 of community.crypto | | The content of the TLS/SSL private key from which to generate the public key. Either *privatekey\_path* or *privatekey\_content* must be specified, but not both. If *state* is `present`, one of them is required. | | **privatekey\_passphrase** string | | The passphrase for the private key. | | **privatekey\_path** path | | Path to the TLS/SSL private key from which to generate the public key. Either *privatekey\_path* or *privatekey\_content* must be specified, but not both. If *state* is `present`, one of them is required. | | **return\_content** boolean added in 1.0.0 of community.crypto | **Choices:*** **no** ← * yes | If set to `yes`, will return the (current or generated) public key's content as *publickey*. | | **select\_crypto\_backend** string | **Choices:*** **auto** ← * cryptography * pyopenssl | Determines which crypto backend to use. The default choice is `auto`, which tries to use `cryptography` if available, and falls back to `pyopenssl`. If set to `pyopenssl`, will try to use the [pyOpenSSL](https://pypi.org/project/pyOpenSSL/) library. If set to `cryptography`, will try to use the [cryptography](https://cryptography.io/) library. | | **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. | | **state** string | **Choices:*** absent * **present** ← | Whether the public key should exist or not, taking action if the state is different from what is stated. | | **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. | See Also -------- See also [community.crypto.x509\_certificate](x509_certificate_module#ansible-collections-community-crypto-x509-certificate-module) The official documentation on the **community.crypto.x509\_certificate** module. [community.crypto.x509\_certificate\_pipe](x509_certificate_pipe_module#ansible-collections-community-crypto-x509-certificate-pipe-module) The official documentation on the **community.crypto.x509\_certificate\_pipe** module. [community.crypto.openssl\_csr](openssl_csr_module#ansible-collections-community-crypto-openssl-csr-module) The official documentation on the **community.crypto.openssl\_csr** module. [community.crypto.openssl\_csr\_pipe](openssl_csr_pipe_module#ansible-collections-community-crypto-openssl-csr-pipe-module) The official documentation on the **community.crypto.openssl\_csr\_pipe** module. [community.crypto.openssl\_dhparam](openssl_dhparam_module#ansible-collections-community-crypto-openssl-dhparam-module) The official documentation on the **community.crypto.openssl\_dhparam** module. [community.crypto.openssl\_pkcs12](openssl_pkcs12_module#ansible-collections-community-crypto-openssl-pkcs12-module) The official documentation on the **community.crypto.openssl\_pkcs12** module. [community.crypto.openssl\_privatekey](openssl_privatekey_module#ansible-collections-community-crypto-openssl-privatekey-module) The official documentation on the **community.crypto.openssl\_privatekey** module. [community.crypto.openssl\_privatekey\_pipe](openssl_privatekey_pipe_module#ansible-collections-community-crypto-openssl-privatekey-pipe-module) The official documentation on the **community.crypto.openssl\_privatekey\_pipe** module. Examples -------- ``` - name: Generate an OpenSSL public key in PEM format community.crypto.openssl_publickey: path: /etc/ssl/public/ansible.com.pem privatekey_path: /etc/ssl/private/ansible.com.pem - name: Generate an OpenSSL public key in PEM format from an inline key community.crypto.openssl_publickey: path: /etc/ssl/public/ansible.com.pem privatekey_content: "{{ private_key_content }}" - name: Generate an OpenSSL public key in OpenSSH v2 format community.crypto.openssl_publickey: path: /etc/ssl/public/ansible.com.pem privatekey_path: /etc/ssl/private/ansible.com.pem format: OpenSSH - name: Generate an OpenSSL public key with a passphrase protected private key community.crypto.openssl_publickey: path: /etc/ssl/public/ansible.com.pem privatekey_path: /etc/ssl/private/ansible.com.pem privatekey_passphrase: ansible - name: Force regenerate an OpenSSL public key if it already exists community.crypto.openssl_publickey: path: /etc/ssl/public/ansible.com.pem privatekey_path: /etc/ssl/private/ansible.com.pem force: yes - name: Remove an OpenSSL public key community.crypto.openssl_publickey: path: /etc/ssl/public/ansible.com.pem 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 | | --- | --- | --- | | **backup\_file** string | changed and if *backup* is `yes` | Name of backup file created. **Sample:** /path/to/publickey.pem.2019-03-09@11:22~ | | **filename** string | changed or success | Path to the generated TLS/SSL public key file. **Sample:** /etc/ssl/public/ansible.com.pem | | **fingerprint** dictionary | changed or success | The fingerprint of the public key. Fingerprint will be generated for each hashlib.algorithms available. Requires PyOpenSSL >= 16.0 for meaningful output. **Sample:** {'md5': '84:75:71:72:8d:04:b5:6c:4d:37:6d:66:83:f5:4c:29', 'sha1': '51:cc:7c:68:5d:eb:41:43:88:7e:1a:ae:c7:f8:24:72:ee:71:f6:10', 'sha224': 'b1:19:a6:6c:14:ac:33:1d:ed:18:50:d3:06:5c:b2:32:91:f1:f1:52:8c:cb:d5:75:e9:f5:9b:46', 'sha256': '41:ab:c7:cb:d5:5f:30:60:46:99:ac:d4:00:70:cf:a1:76:4f:24:5d:10:24:57:5d:51:6e:09:97:df:2f:de:c7', 'sha384': '85:39:50:4e:de:d9:19:33:40:70:ae:10:ab:59:24:19:51:c3:a2:e4:0b:1c:b1:6e:dd:b3:0c:d9:9e:6a:46:af:da:18:f8:ef:ae:2e:c0:9a:75:2c:9b:b3:0f:3a:5f:3d', 'sha512': 'fd:ed:5e:39:48:5f:9f:fe:7f:25:06:3f:79:08:cd:ee:a5:e7:b3:3d:13:82:87:1f:84:e1:f5:c7:28:77:53:94:86:56:38:69:f0:d9:35:22:01:1e:a6:60:...:0f:9b'} | | **format** string | changed or success | The format of the public key (PEM, OpenSSH, ...). **Sample:** PEM | | **privatekey** string | changed or success | Path to the TLS/SSL private key the public key was generated from. Will be `none` if the private key has been provided in *privatekey\_content*. **Sample:** /etc/ssl/private/ansible.com.pem | | **publickey** string added in 1.0.0 of community.crypto | if *state* is `present` and *return\_content* is `yes` | The (current or generated) public key's content. | ### Authors * Yanis Guenane (@Spredzy) * Felix Fontein (@felixfontein) ansible community.crypto.x509_crl – Generate Certificate Revocation Lists (CRLs) community.crypto.x509\_crl – Generate Certificate Revocation Lists (CRLs) ========================================================================= Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.x509_crl`. New in version 1.0.0: of community.crypto * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows one to (re)generate or update Certificate Revocation Lists (CRLs). * Certificates on the revocation list can be either specified by serial number and (optionally) their issuer, or as a path to a certificate file in PEM format. Requirements ------------ The below requirements are needed on the host that executes this module. * cryptography >= 1.2 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 | | **backup** boolean | **Choices:*** **no** ← * yes | Create a backup file including a timestamp so you can get the original CRL back if you overwrote it with a new one by accident. | | **digest** string | **Default:**"sha256" | Digest algorithm to be used when signing the CRL. | | **force** boolean | **Choices:*** **no** ← * yes | Should the CRL be forced to be regenerated. | | **format** string | **Choices:*** **pem** ← * der | Whether the CRL file should be in PEM or DER format. If an existing CRL file does match everything but *format*, it will be converted to the correct format instead of regenerated. | | **group** string | | Name of the group that should own the file/directory, as would be fed to *chown*. | | **ignore\_timestamps** boolean | **Choices:*** **no** ← * yes | Whether the timestamps *last\_update*, *next\_update* and *revocation\_date* (in *revoked\_certificates*) should be ignored for idempotency checks. The timestamp *invalidity\_date* in *revoked\_certificates* will never be ignored. Use this in combination with relative timestamps for these values to get idempotency. | | **issuer** dictionary | | Key/value pairs that will be present in the issuer name field of the CRL. If you need to specify more than one value with the same key, use a list as value. Required if *state* is `present`. | | **last\_update** string | **Default:**"+0s" | The point in time from which this CRL can be trusted. Time can be specified either as relative time or as absolute timestamp. Time will always be interpreted as UTC. Valid format is `[+-]timespec | ASN.1 TIME` where timespec can be an integer + `[w | d | h | m | s]` (e.g. `+32w1d2h`. Note that if using relative time this module is NOT idempotent, except when *ignore\_timestamps* is set to `yes`. | | **mode** string | **Choices:*** **generate** ← * update | Defines how to process entries of existing CRLs. If set to `generate`, makes sure that the CRL has the exact set of revoked certificates as specified in *revoked\_certificates*. If set to `update`, makes sure that the CRL contains the revoked certificates from *revoked\_certificates*, but can also contain other revoked certificates. If the CRL file already exists, all entries from the existing CRL will also be included in the new CRL. When using `update`, you might be interested in setting *ignore\_timestamps* to `yes`. | | **next\_update** string | | The absolute latest point in time by which this *issuer* is expected to have issued another CRL. Many clients will treat a CRL as expired once *next\_update* occurs. Time can be specified either as relative time or as absolute timestamp. Time will always be interpreted as UTC. Valid format is `[+-]timespec | ASN.1 TIME` where timespec can be an integer + `[w | d | h | m | s]` (e.g. `+32w1d2h`. Note that if using relative time this module is NOT idempotent, except when *ignore\_timestamps* is set to `yes`. Required if *state* is `present`. | | **owner** string | | Name of the user that should own the file/directory, as would be fed to *chown*. | | **path** path / required | | Remote absolute path where the generated CRL file should be created or is already located. | | **privatekey\_content** string | | The content of the CA's private key to use when signing the CRL. Either *privatekey\_path* or *privatekey\_content* must be specified if *state* is `present`, but not both. | | **privatekey\_passphrase** string | | The passphrase for the *privatekey\_path*. This is required if the private key is password protected. | | **privatekey\_path** path | | Path to the CA's private key to use when signing the CRL. Either *privatekey\_path* or *privatekey\_content* must be specified if *state* is `present`, but not both. | | **return\_content** boolean | **Choices:*** **no** ← * yes | If set to `yes`, will return the (current or generated) CRL's content as *crl*. | | **revoked\_certificates** list / elements=dictionary | | List of certificates to be revoked. Required if *state* is `present`. | | | **content** string | | Content of a certificate in PEM format. The serial number and issuer will be extracted from the certificate. Mutually exclusive with *path* and *serial\_number*. One of these three options must be specified. | | | **invalidity\_date** string | | The point in time it was known/suspected that the private key was compromised or that the certificate otherwise became invalid. Time can be specified either as relative time or as absolute timestamp. Time will always be interpreted as UTC. Valid format is `[+-]timespec | ASN.1 TIME` where timespec can be an integer + `[w | d | h | m | s]` (e.g. `+32w1d2h`. Note that if using relative time this module is NOT idempotent. This will NOT change when *ignore\_timestamps* is set to `yes`. | | | **invalidity\_date\_critical** boolean | **Choices:*** **no** ← * yes | Whether the invalidity date extension should be critical. | | | **issuer** list / elements=string | | The certificate's issuer. Example: `DNS:ca.example.org` | | | **issuer\_critical** boolean | **Choices:*** **no** ← * yes | Whether the certificate issuer extension should be critical. | | | **path** path | | Path to a certificate in PEM format. The serial number and issuer will be extracted from the certificate. Mutually exclusive with *content* and *serial\_number*. One of these three options must be specified. | | | **reason** string | **Choices:*** unspecified * key\_compromise * ca\_compromise * affiliation\_changed * superseded * cessation\_of\_operation * certificate\_hold * privilege\_withdrawn * aa\_compromise * remove\_from\_crl | The value for the revocation reason extension. | | | **reason\_critical** boolean | **Choices:*** **no** ← * yes | Whether the revocation reason extension should be critical. | | | **revocation\_date** string | **Default:**"+0s" | The point in time the certificate was revoked. Time can be specified either as relative time or as absolute timestamp. Time will always be interpreted as UTC. Valid format is `[+-]timespec | ASN.1 TIME` where timespec can be an integer + `[w | d | h | m | s]` (e.g. `+32w1d2h`. Note that if using relative time this module is NOT idempotent, except when *ignore\_timestamps* is set to `yes`. | | | **serial\_number** integer | | Serial number of the certificate. Mutually exclusive with *path* and *content*. One of these three options must be specified. | | **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. | | **state** string | **Choices:*** absent * **present** ← | Whether the CRL file should exist or not, taking action if the state is different from what is stated. | | **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 * All ASN.1 TIME values should be specified following the YYYYMMDDHHMMSSZ pattern. * Date specified should be UTC. Minutes and seconds are mandatory. * Supports `check_mode`. Examples -------- ``` - name: Generate a CRL community.crypto.x509_crl: path: /etc/ssl/my-ca.crl privatekey_path: /etc/ssl/private/my-ca.pem issuer: CN: My CA last_update: "+0s" next_update: "+7d" revoked_certificates: - serial_number: 1234 revocation_date: 20190331202428Z issuer: CN: My CA - serial_number: 2345 revocation_date: 20191013152910Z reason: affiliation_changed invalidity_date: 20191001000000Z - path: /etc/ssl/crt/revoked-cert.pem revocation_date: 20191010010203Z ``` 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 | changed and if *backup* is `yes` | Name of backup file created. **Sample:** /path/to/my-ca.crl.2019-03-09@11:22~ | | **crl** string | if *state* is `present` and *return\_content* is `yes` | The (current or generated) CRL's content. Will be the CRL itself if *format* is `pem`, and Base64 of the CRL if *format* is `der`. | | **digest** string | success | The signature algorithm used to sign the CRL. **Sample:** sha256WithRSAEncryption | | **filename** string | changed or success | Path to the generated CRL. **Sample:** /path/to/my-ca.crl | | **format** string | success | Whether the CRL is in PEM format (`pem`) or in DER format (`der`). **Sample:** pem | | **issuer** dictionary | success | The CRL's issuer. Note that for repeated values, only the last one will be returned. **Sample:** {"organizationName": "Ansible", "commonName": "ca.example.com"} | | **issuer\_ordered** list / elements=list | success | The CRL's issuer as an ordered list of tuples. **Sample:** [["organizationName", "Ansible"], ["commonName": "ca.example.com"]] | | **last\_update** string | success | The point in time from which this CRL can be trusted as ASN.1 TIME. **Sample:** 20190413202428Z | | **next\_update** string | success | The point in time from which a new CRL will be issued and the client has to check for it as ASN.1 TIME. **Sample:** 20190413202428Z | | **privatekey** string | changed or success | Path to the private CA key. **Sample:** /path/to/my-ca.pem | | **revoked\_certificates** list / elements=dictionary | success | List of certificates to be revoked. | | | **invalidity\_date** string | success | The point in time it was known/suspected that the private key was compromised or that the certificate otherwise became invalid as ASN.1 TIME. **Sample:** 20190413202428Z | | | **invalidity\_date\_critical** boolean | success | Whether the invalidity date extension is critical. | | | **issuer** list / elements=string | success | The certificate's issuer. **Sample:** ["DNS:ca.example.org"] | | | **issuer\_critical** boolean | success | Whether the certificate issuer extension is critical. | | | **reason** string | success | The value for the revocation reason extension. One of `unspecified`, `key_compromise`, `ca_compromise`, `affiliation_changed`, `superseded`, `cessation_of_operation`, `certificate_hold`, `privilege_withdrawn`, `aa_compromise`, and `remove_from_crl`. **Sample:** key\_compromise | | | **reason\_critical** boolean | success | Whether the revocation reason extension is critical. | | | **revocation\_date** string | success | The point in time the certificate was revoked as ASN.1 TIME. **Sample:** 20190413202428Z | | | **serial\_number** integer | success | Serial number of the certificate. **Sample:** 1234 | ### Authors * Felix Fontein (@felixfontein)
programming_docs
ansible community.crypto.openssl_dhparam – Generate OpenSSL Diffie-Hellman Parameters community.crypto.openssl\_dhparam – Generate OpenSSL Diffie-Hellman Parameters ============================================================================== Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.openssl_dhparam`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows one to (re)generate OpenSSL DH-params. * This module uses file common arguments to specify generated file permissions. * Please note that the module regenerates existing DH params if they do not match the module’s options. If you are concerned that this could overwrite your existing DH params, consider using the *backup* option. * The module can use the cryptography Python library, or the `openssl` executable. By default, it tries to detect which one is available. This can be overridden with the *select\_crypto\_backend* option. Requirements ------------ The below requirements are needed on the host that executes this module. * Either cryptography >= 2.0 * Or OpenSSL binary `openssl` 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 | | **backup** boolean | **Choices:*** **no** ← * yes | Create a backup file including a timestamp so you can get the original DH params back if you overwrote them with new ones by accident. | | **force** boolean | **Choices:*** **no** ← * yes | Should the parameters be regenerated even it it already exists. | | **group** string | | Name of the group that should own the file/directory, as would be fed to *chown*. | | **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 | | Name of the file in which the generated parameters will be saved. | | **return\_content** boolean added in 1.0.0 of community.crypto | **Choices:*** **no** ← * yes | If set to `yes`, will return the (current or generated) DH params' content as *dhparams*. | | **select\_crypto\_backend** string added in 1.0.0 of community.crypto | **Choices:*** **auto** ← * cryptography * openssl | Determines which crypto backend to use. The default choice is `auto`, which tries to use `cryptography` if available, and falls back to `openssl`. If set to `openssl`, will try to use the OpenSSL `openssl` executable. If set to `cryptography`, will try to use the [cryptography](https://cryptography.io/) library. | | **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. | | **size** integer | **Default:**4096 | Size (in bits) of the generated DH-params. | | **state** string | **Choices:*** absent * **present** ← | Whether the parameters should exist or not, taking action if the state is different from what is stated. | | **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.crypto.x509\_certificate](x509_certificate_module#ansible-collections-community-crypto-x509-certificate-module) The official documentation on the **community.crypto.x509\_certificate** module. [community.crypto.openssl\_csr](openssl_csr_module#ansible-collections-community-crypto-openssl-csr-module) The official documentation on the **community.crypto.openssl\_csr** module. [community.crypto.openssl\_pkcs12](openssl_pkcs12_module#ansible-collections-community-crypto-openssl-pkcs12-module) The official documentation on the **community.crypto.openssl\_pkcs12** module. [community.crypto.openssl\_privatekey](openssl_privatekey_module#ansible-collections-community-crypto-openssl-privatekey-module) The official documentation on the **community.crypto.openssl\_privatekey** module. [community.crypto.openssl\_publickey](openssl_publickey_module#ansible-collections-community-crypto-openssl-publickey-module) The official documentation on the **community.crypto.openssl\_publickey** module. Examples -------- ``` - name: Generate Diffie-Hellman parameters with the default size (4096 bits) community.crypto.openssl_dhparam: path: /etc/ssl/dhparams.pem - name: Generate DH Parameters with a different size (2048 bits) community.crypto.openssl_dhparam: path: /etc/ssl/dhparams.pem size: 2048 - name: Force regenerate an DH parameters if they already exist community.crypto.openssl_dhparam: path: /etc/ssl/dhparams.pem 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 | | --- | --- | --- | | **backup\_file** string | changed and if *backup* is `yes` | Name of backup file created. **Sample:** /path/to/dhparams.pem.2019-03-09@11:22~ | | **dhparams** string added in 1.0.0 of community.crypto | if *state* is `present` and *return\_content* is `yes` | The (current or generated) DH params' content. | | **filename** string | changed or success | Path to the generated Diffie-Hellman parameters. **Sample:** /etc/ssl/dhparams.pem | | **size** integer | changed or success | Size (in bits) of the Diffie-Hellman parameters. **Sample:** 4096 | ### Authors * Thom Wiggers (@thomwiggers) ansible community.crypto.openssl_privatekey_pipe – Generate OpenSSL private keys without disk access community.crypto.openssl\_privatekey\_pipe – Generate OpenSSL private keys without disk access ============================================================================================== Note This plugin is part of the [community.crypto collection](https://galaxy.ansible.com/community/crypto) (version 1.9.6). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.crypto`. To use it in a playbook, specify: `community.crypto.openssl_privatekey_pipe`. New in version 1.3.0: of community.crypto * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Keys are generated in PEM format. * Make sure to not write the result of this module into logs or to the console, as it contains private key data! Use the *no\_log* task option to be sure. * Note that this module is implemented as an [action plugin](../../../plugins/action) and will always be executed on the controller. * One can generate [RSA](https://en.wikipedia.org/wiki/RSA_%28cryptosystem%29), [DSA](https://en.wikipedia.org/wiki/Digital_Signature_Algorithm), [ECC](https://en.wikipedia.org/wiki/Elliptic-curve_cryptography) or [EdDSA](https://en.wikipedia.org/wiki/EdDSA) private keys. * Please note that the module regenerates private keys if they don’t match the module’s options. In particular, if you provide another passphrase (or specify none), change the keysize, etc., the private key will be regenerated. If you are concerned that this could **overwrite your private key**, consider using the *backup* option. * The module can use the cryptography Python library, or the pyOpenSSL Python library. By default, it tries to detect which one is available. This can be overridden with the *select\_crypto\_backend* option. Please note that the PyOpenSSL backend was deprecated in Ansible 2.9 and will be removed in community.crypto 2.0.0. * This allows to read and write keys to vaults without having to write intermediate versions to disk. * This module allows one to (re)generate OpenSSL private keys without disk access. 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. * Either cryptography >= 1.2.3 (older versions might work as well) * Or pyOpenSSL Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **cipher** string | | The cipher to encrypt the private key. (Valid values can be found by running `openssl list -cipher-algorithms` or `openssl list-cipher-algorithms`, depending on your OpenSSL version.) When using the `cryptography` backend, use `auto`. | | **content** string | | The current private key data. Needed for idempotency. If not provided, the module will always return a change, and all idempotence-related options are ignored. | | **content\_base64** boolean | **Choices:*** **no** ← * yes | Set to `true` if the content is base64 encoded. | | **curve** string | **Choices:*** secp224r1 * secp256k1 * secp256r1 * secp384r1 * secp521r1 * secp192r1 * brainpoolP256r1 * brainpoolP384r1 * brainpoolP512r1 * sect163k1 * sect163r2 * sect233k1 * sect233r1 * sect283k1 * sect283r1 * sect409k1 * sect409r1 * sect571k1 * sect571r1 | Note that not all curves are supported by all versions of `cryptography`. For maximal interoperability, `secp384r1` or `secp256r1` should be used. We use the curve names as defined in the [IANA registry for TLS](https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-8). Please note that all curves except `secp224r1`, `secp256k1`, `secp256r1`, `secp384r1` and `secp521r1` are discouraged for new private keys. | | **format** string | **Choices:*** pkcs1 * pkcs8 * raw * auto * **auto\_ignore** ← | Determines which format the private key is written in. By default, PKCS1 (traditional OpenSSL format) is used for all keys which support it. Please note that not every key can be exported in any format. The value `auto` selects a fromat based on the key format. The value `auto_ignore` does the same, but for existing private key files, it will not force a regenerate when its format is not the automatically selected one for generation. Note that if the format for an existing private key mismatches, the key is **regenerated** by default. To change this behavior, use the *format\_mismatch* option. The *format* option is only supported by the `cryptography` backend. The `pyopenssl` backend will fail if a value different from `auto_ignore` is used. | | **format\_mismatch** string | **Choices:*** **regenerate** ← * convert | Determines behavior of the module if the format of a private key does not match the expected format, but all other parameters are as expected. If set to `regenerate` (default), generates a new private key. If set to `convert`, the key will be converted to the new format instead. Only supported by the `cryptography` backend. | | **passphrase** string | | The passphrase for the private key. | | **regenerate** string | **Choices:*** never * fail * partial\_idempotence * **full\_idempotence** ← * always | Allows to configure in which situations the module is allowed to regenerate private keys. The module will always generate a new key if the destination file does not exist. By default, the key will be regenerated when it doesn't match the module's options, except when the key cannot be read or the passphrase does not match. Please note that this **changed** for Ansible 2.10. For Ansible 2.9, the behavior was as if `full_idempotence` is specified. If set to `never`, the module will fail if the key cannot be read or the passphrase isn't matching, and will never regenerate an existing key. If set to `fail`, the module will fail if the key does not correspond to the module's options. If set to `partial_idempotence`, the key will be regenerated if it does not conform to the module's options. The key is **not** regenerated if it cannot be read (broken file), the key is protected by an unknown passphrase, or when they key is not protected by a passphrase, but a passphrase is specified. If set to `full_idempotence`, the key will be regenerated if it does not conform to the module's options. This is also the case if the key cannot be read (broken file), the key is protected by an unknown passphrase, or when they key is not protected by a passphrase, but a passphrase is specified. Make sure you have a **backup** when using this option! If set to `always`, the module will always regenerate the key. This is equivalent to setting *force* to `yes`. Note that if *format\_mismatch* is set to `convert` and everything matches except the format, the key will always be converted, except if *regenerate* is set to `always`. | | **return\_current\_key** boolean | **Choices:*** **no** ← * yes | Set to `true` to return the current private key when the module did not generate a new one. Note that in case of check mode, when this option is not set to `true`, the module always returns the current key (if it was provided) and Ansible will replace it by `VALUE_SPECIFIED_IN_NO_LOG_PARAMETER`. | | **select\_crypto\_backend** string | **Choices:*** **auto** ← * cryptography * pyopenssl | Determines which crypto backend to use. The default choice is `auto`, which tries to use `cryptography` if available, and falls back to `pyopenssl`. If set to `pyopenssl`, will try to use the [pyOpenSSL](https://pypi.org/project/pyOpenSSL/) library. If set to `cryptography`, will try to use the [cryptography](https://cryptography.io/) library. Please note that the `pyopenssl` backend has been deprecated in Ansible 2.9, and will be removed in community.crypto 2.0.0. From that point on, only the `cryptography` backend will be available. | | **size** integer | **Default:**4096 | Size (in bits) of the TLS/SSL key to generate. | | **type** string | **Choices:*** DSA * ECC * Ed25519 * Ed448 * **RSA** ← * X25519 * X448 | The algorithm used to generate the TLS/SSL private key. Note that `ECC`, `X25519`, `X448`, `Ed25519` and `Ed448` require the `cryptography` backend. `X25519` needs cryptography 2.5 or newer, while `X448`, `Ed25519` and `Ed448` require cryptography 2.6 or newer. For `ECC`, the minimal cryptography version required depends on the *curve* option. | See Also -------- See also [community.crypto.openssl\_privatekey](openssl_privatekey_module#ansible-collections-community-crypto-openssl-privatekey-module) The official documentation on the **community.crypto.openssl\_privatekey** module. [community.crypto.openssl\_privatekey\_info](openssl_privatekey_info_module#ansible-collections-community-crypto-openssl-privatekey-info-module) The official documentation on the **community.crypto.openssl\_privatekey\_info** module. [community.crypto.x509\_certificate](x509_certificate_module#ansible-collections-community-crypto-x509-certificate-module) The official documentation on the **community.crypto.x509\_certificate** module. [community.crypto.x509\_certificate\_pipe](x509_certificate_pipe_module#ansible-collections-community-crypto-x509-certificate-pipe-module) The official documentation on the **community.crypto.x509\_certificate\_pipe** module. [community.crypto.openssl\_csr](openssl_csr_module#ansible-collections-community-crypto-openssl-csr-module) The official documentation on the **community.crypto.openssl\_csr** module. [community.crypto.openssl\_csr\_pipe](openssl_csr_pipe_module#ansible-collections-community-crypto-openssl-csr-pipe-module) The official documentation on the **community.crypto.openssl\_csr\_pipe** module. [community.crypto.openssl\_dhparam](openssl_dhparam_module#ansible-collections-community-crypto-openssl-dhparam-module) The official documentation on the **community.crypto.openssl\_dhparam** module. [community.crypto.openssl\_pkcs12](openssl_pkcs12_module#ansible-collections-community-crypto-openssl-pkcs12-module) The official documentation on the **community.crypto.openssl\_pkcs12** module. [community.crypto.openssl\_publickey](openssl_publickey_module#ansible-collections-community-crypto-openssl-publickey-module) The official documentation on the **community.crypto.openssl\_publickey** module. Examples -------- ``` - name: Generate an OpenSSL private key with the default values (4096 bits, RSA) community.crypto.openssl_privatekey_pipe: path: /etc/ssl/private/ansible.com.pem register: output no_log: true # make sure that private key data is not accidentally revealed in logs! - name: Show generated key debug: msg: "{{ output.privatekey }}" # DO NOT OUTPUT KEY MATERIAL TO CONSOLE OR LOGS IN PRODUCTION! - block: - name: Update sops-encrypted key with the community.sops collection community.crypto.openssl_privatekey_pipe: content: "{{ lookup('community.sops.sops', 'private_key.pem.sops') }}" size: 2048 register: output no_log: true # make sure that private key data is not accidentally revealed in logs! - name: Update encrypted key when openssl_privatekey_pipe reported a change community.sops.sops_encrypt: path: private_key.pem.sops content_text: "{{ output.privatekey }}" when: output is changed always: - name: Make sure that output (which contains the private key) is overwritten set_fact: 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 | | --- | --- | --- | | **curve** string | changed or success, and *type* is `ECC` | Elliptic curve used to generate the TLS/SSL private key. **Sample:** secp256r1 | | **fingerprint** dictionary | changed or success | The fingerprint of the public key. Fingerprint will be generated for each `hashlib.algorithms` available. The PyOpenSSL backend requires PyOpenSSL >= 16.0 for meaningful output. **Sample:** {'md5': '84:75:71:72:8d:04:b5:6c:4d:37:6d:66:83:f5:4c:29', 'sha1': '51:cc:7c:68:5d:eb:41:43:88:7e:1a:ae:c7:f8:24:72:ee:71:f6:10', 'sha224': 'b1:19:a6:6c:14:ac:33:1d:ed:18:50:d3:06:5c:b2:32:91:f1:f1:52:8c:cb:d5:75:e9:f5:9b:46', 'sha256': '41:ab:c7:cb:d5:5f:30:60:46:99:ac:d4:00:70:cf:a1:76:4f:24:5d:10:24:57:5d:51:6e:09:97:df:2f:de:c7', 'sha384': '85:39:50:4e:de:d9:19:33:40:70:ae:10:ab:59:24:19:51:c3:a2:e4:0b:1c:b1:6e:dd:b3:0c:d9:9e:6a:46:af:da:18:f8:ef:ae:2e:c0:9a:75:2c:9b:b3:0f:3a:5f:3d', 'sha512': 'fd:ed:5e:39:48:5f:9f:fe:7f:25:06:3f:79:08:cd:ee:a5:e7:b3:3d:13:82:87:1f:84:e1:f5:c7:28:77:53:94:86:56:38:69:f0:d9:35:22:01:1e:a6:60:...:0f:9b'} | | **privatekey** string | changed, or *return\_current\_key* is `true` | The generated private key's content. Please note that if the result is not changed, the current private key will only be returned if the *return\_current\_key* option is set to `true`. Will be Base64-encoded if the key is in raw format. | | **size** integer | changed or success | Size (in bits) of the TLS/SSL private key. **Sample:** 4096 | | **type** string | changed or success | Algorithm used to generate the TLS/SSL private key. **Sample:** RSA | ### Authors * Yanis Guenane (@Spredzy) * Felix Fontein (@felixfontein)
programming_docs
ansible Community.Docker Community.Docker ================ Collection version 1.10.0 Scenario Guide -------------- * [Docker Guide](docsite/scenario_guide) Plugin Index ------------ These are the plugins in the community.docker collection ### Connection Plugins * [docker](docker_connection#ansible-collections-community-docker-docker-connection) – Run tasks in docker containers * [docker\_api](docker_api_connection#ansible-collections-community-docker-docker-api-connection) – Run tasks in docker containers * [nsenter](nsenter_connection#ansible-collections-community-docker-nsenter-connection) – execute on host running controller container ### Inventory Plugins * [docker\_containers](docker_containers_inventory#ansible-collections-community-docker-docker-containers-inventory) – Ansible dynamic inventory plugin for Docker containers. * [docker\_machine](docker_machine_inventory#ansible-collections-community-docker-docker-machine-inventory) – Docker Machine inventory source * [docker\_swarm](docker_swarm_inventory#ansible-collections-community-docker-docker-swarm-inventory) – Ansible dynamic inventory plugin for Docker swarm nodes. ### Modules * [current\_container\_facts](current_container_facts_module#ansible-collections-community-docker-current-container-facts-module) – Return facts about whether the module runs in a Docker container * [docker\_compose](docker_compose_module#ansible-collections-community-docker-docker-compose-module) – Manage multi-container Docker applications with Docker Compose. * [docker\_config](docker_config_module#ansible-collections-community-docker-docker-config-module) – Manage docker configs. * [docker\_container](docker_container_module#ansible-collections-community-docker-docker-container-module) – manage docker containers * [docker\_container\_exec](docker_container_exec_module#ansible-collections-community-docker-docker-container-exec-module) – Execute command in a docker container * [docker\_container\_info](docker_container_info_module#ansible-collections-community-docker-docker-container-info-module) – Retrieves facts about docker container * [docker\_host\_info](docker_host_info_module#ansible-collections-community-docker-docker-host-info-module) – Retrieves facts about docker host and lists of objects of the services. * [docker\_image](docker_image_module#ansible-collections-community-docker-docker-image-module) – Manage docker images * [docker\_image\_info](docker_image_info_module#ansible-collections-community-docker-docker-image-info-module) – Inspect docker images * [docker\_image\_load](docker_image_load_module#ansible-collections-community-docker-docker-image-load-module) – Load docker image(s) from archives * [docker\_login](docker_login_module#ansible-collections-community-docker-docker-login-module) – Log into a Docker registry. * [docker\_network](docker_network_module#ansible-collections-community-docker-docker-network-module) – Manage Docker networks * [docker\_network\_info](docker_network_info_module#ansible-collections-community-docker-docker-network-info-module) – Retrieves facts about docker network * [docker\_node](docker_node_module#ansible-collections-community-docker-docker-node-module) – Manage Docker Swarm node * [docker\_node\_info](docker_node_info_module#ansible-collections-community-docker-docker-node-info-module) – Retrieves facts about docker swarm node from Swarm Manager * [docker\_plugin](docker_plugin_module#ansible-collections-community-docker-docker-plugin-module) – Manage Docker plugins * [docker\_prune](docker_prune_module#ansible-collections-community-docker-docker-prune-module) – Allows to prune various docker objects * [docker\_secret](docker_secret_module#ansible-collections-community-docker-docker-secret-module) – Manage docker secrets. * [docker\_stack](docker_stack_module#ansible-collections-community-docker-docker-stack-module) – docker stack module * [docker\_stack\_info](docker_stack_info_module#ansible-collections-community-docker-docker-stack-info-module) – Return information on a docker stack * [docker\_stack\_task\_info](docker_stack_task_info_module#ansible-collections-community-docker-docker-stack-task-info-module) – Return information of the tasks on a docker stack * [docker\_swarm](docker_swarm_module#ansible-collections-community-docker-docker-swarm-module) – Manage Swarm cluster * [docker\_swarm\_info](docker_swarm_info_module#ansible-collections-community-docker-docker-swarm-info-module) – Retrieves facts about Docker Swarm cluster. * [docker\_swarm\_service](docker_swarm_service_module#ansible-collections-community-docker-docker-swarm-service-module) – docker swarm service * [docker\_swarm\_service\_info](docker_swarm_service_info_module#ansible-collections-community-docker-docker-swarm-service-info-module) – Retrieves information about docker services from a Swarm Manager * [docker\_volume](docker_volume_module#ansible-collections-community-docker-docker-volume-module) – Manage Docker volumes * [docker\_volume\_info](docker_volume_info_module#ansible-collections-community-docker-docker-volume-info-module) – Retrieve facts about Docker volumes See also List of [collections](../../index#list-of-collections) with docs hosted here. ansible community.docker.nsenter – execute on host running controller container community.docker.nsenter – execute on host running controller container ======================================================================= Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.nsenter`. New in version 1.9.0: of community.docker * [Synopsis](#synopsis) * [Parameters](#parameters) * [Notes](#notes) Synopsis -------- * This connection plugin allows Ansible, running in a privileged container, to execute tasks on the container host instead of in the container itself. * This is useful for running Ansible in a pull model, while still keeping the Ansible control node containerized. * It relies on having privileged access to run `nsenter` in the host’s PID namespace, allowing it to enter the namespaces of the provided PID (default PID 1, or init/systemd). Parameters ---------- | Parameter | Choices/Defaults | Configuration | Comments | | --- | --- | --- | --- | | **nsenter\_pid** integer | **Default:**1 | ini entries: [nsenter\_connection]nsenter\_pid = 1 env:ANSIBLE\_NSENTER\_PID var: ansible\_nsenter\_pid | PID to attach with using nsenter. The default should be fine unless you are attaching as a non-root user. | Notes ----- Note * The remote user is ignored; this plugin always runs as root. * This plugin requires the Ansible controller container to be launched in the following way: (1) The container image contains the `nsenter` program; (2) The container is launched in privileged mode; (3) The container is launched in the host’s PID namespace (`--pid host`). ### Authors * Jeff Goldschrafe (@jgoldschrafe) ansible community.docker.current_container_facts – Return facts about whether the module runs in a Docker container community.docker.current\_container\_facts – Return facts about whether the module runs in a Docker container ============================================================================================================= Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.current_container_facts`. New in version 1.1.0: of community.docker * [Synopsis](#synopsis) * [Examples](#examples) * [Returned Facts](#returned-facts) Synopsis -------- * Return facts about whether the module runs in a Docker container. Examples -------- ``` - name: Get facts on current container community.docker.current_container_facts: - name: Print information on current container when running in a container ansible.builtin.debug: msg: "Container ID is {{ ansible_module_container_id }}" when: ansible_module_running_in_container ``` 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\_module\_container\_id** string / elements=string | always | The detected container ID. Contains an empty string if no container was detected. | | **ansible\_module\_container\_type** string / elements=string | always | The detected container environment. Contains an empty string if no container was detected. Otherwise, will be one of `docker` or `azure_pipelines`. | | **ansible\_module\_running\_in\_container** boolean / elements=string | always | Whether the module was able to detect that it runs in a container or not. | ### Authors * Felix Fontein (@felixfontein) ansible community.docker.docker_container_exec – Execute command in a docker container community.docker.docker\_container\_exec – Execute command in a docker container ================================================================================ Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_container_exec`. New in version 1.5.0: of community.docker * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Executes a command in a Docker container. Requirements ------------ The below requirements are needed on the host that executes this module. * Docker API >= 1.20 * Docker SDK for Python: Please note that the [docker-py](https://pypi.org/project/docker-py/) Python module has been superseded by [docker](https://pypi.org/project/docker/) (see [here](https://github.com/docker/docker-py/issues/1310) for details). For Python 2.6, `docker-py` must be used. Otherwise, it is recommended to install the `docker` Python module. Note that both modules should *not* be installed at the same time. Also note that when both modules are installed and one of them is uninstalled, the other might no longer function and a reinstall of it is required. * [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) >= 1.8.0 (use [docker-py](https://pypi.org/project/docker-py/) for Python 2.6) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **api\_version** string | **Default:**"auto" | The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported by Docker SDK for Python and the docker daemon. If the value is not specified in the task, the value of environment variable `DOCKER_API_VERSION` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_api\_version | | **argv** list / elements=string | | The command to execute. Since this is a list of arguments, no quoting is needed. Exactly one of *argv* and *command* must be specified. | | **ca\_cert** path | | Use a CA certificate when performing server verification by providing the path to a CA certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `ca.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_ca\_cert, cacert\_path | | **chdir** string | | The directory to run the command in. | | **client\_cert** path | | Path to the client's TLS certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `cert.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_cert, cert\_path | | **client\_key** path | | Path to the client's TLS key file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `key.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_key, key\_path | | **command** string | | The command to execute. Exactly one of *argv* and *command* must be specified. | | **container** string / required | | The name of the container to execute the command in. | | **debug** boolean | **Choices:*** **no** ← * yes | Debug mode | | **docker\_host** string | **Default:**"unix://var/run/docker.sock" | The URL or Unix socket path used to connect to the Docker API. To connect to a remote host, provide the TCP connection string. For example, `tcp://192.0.2.23:2376`. If TLS is used to encrypt the connection, the module will automatically replace `tcp` in the connection URL with `https`. If the value is not specified in the task, the value of environment variable `DOCKER_HOST` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_url | | **ssl\_version** string | | Provide a valid SSL version number. Default value determined by ssl.py module. If the value is not specified in the task, the value of environment variable `DOCKER_SSL_VERSION` will be used instead. | | **stdin** string | | Set the stdin of the command directly to the specified value. | | **stdin\_add\_newline** boolean | **Choices:*** no * **yes** ← | If set to `true`, appends a newline to *stdin*. | | **strip\_empty\_ends** boolean | **Choices:*** no * **yes** ← | Strip empty lines from the end of stdout/stderr in result. | | **timeout** integer | **Default:**60 | The maximum amount of time in seconds to wait on a response from the API. If the value is not specified in the task, the value of environment variable `DOCKER_TIMEOUT` will be used instead. If the environment variable is not set, the default value will be used. | | **tls** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS without verifying the authenticity of the Docker host server. Note that if *validate\_certs* is set to `yes` as well, it will take precedence. If the value is not specified in the task, the value of environment variable `DOCKER_TLS` will be used instead. If the environment variable is not set, the default value will be used. | | **tls\_hostname** string | | When verifying the authenticity of the Docker Host server, provide the expected name of the server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_HOSTNAME` will be used instead. If the environment variable is not set, the default value will be used. The current default value is `localhost`. This default is deprecated and will change in community.docker 2.0.0 to be a value computed from *docker\_host*. Explicitly specify `localhost` to make sure this value will still be used, and to disable the deprecation message which will be shown otherwise. | | **tty** boolean | **Choices:*** **no** ← * yes | Whether to allocate a TTY. | | **use\_ssh\_client** boolean added in 1.5.0 of community.docker | **Choices:*** **no** ← * yes | For SSH transports, use the `ssh` CLI tool instead of paramiko. Requires Docker SDK for Python 4.4.0 or newer. | | **user** string | | If specified, the user to execute this command with. | | **validate\_certs** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS and verifying the authenticity of the Docker host server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_VERIFY` will be used instead. If the environment variable is not set, the default value will be used. aliases: tls\_verify | Notes ----- Note * Does not support `check_mode`. * Connect to the Docker daemon by providing parameters with each task or by defining environment variables. You can define `DOCKER_HOST`, `DOCKER_TLS_HOSTNAME`, `DOCKER_API_VERSION`, `DOCKER_CERT_PATH`, `DOCKER_SSL_VERSION`, `DOCKER_TLS`, `DOCKER_TLS_VERIFY` and `DOCKER_TIMEOUT`. If you are using docker machine, run the script shipped with the product that sets up the environment. It will set these variables for you. See <https://docs.docker.com/machine/reference/env/> for more details. * When connecting to Docker daemon with TLS, you might need to install additional Python packages. For the Docker SDK for Python, version 2.4 or newer, this can be done by installing `docker[tls]` with [ansible.builtin.pip](../../ansible/builtin/pip_module#ansible-collections-ansible-builtin-pip-module). * Note that the Docker SDK for Python only allows to specify the path to the Docker configuration for very few functions. In general, it will use `$HOME/.docker/config.json` if the `DOCKER_CONFIG` environment variable is not specified, and use `$DOCKER_CONFIG/config.json` otherwise. * This module uses the [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) to communicate with the Docker daemon. Examples -------- ``` - name: Run a simple command (command) community.docker.docker_container_exec: container: foo command: /bin/bash -c "ls -lah" chdir: /root register: result - name: Print stdout debug: var: result.stdout - name: Run a simple command (argv) community.docker.docker_container_exec: container: foo argv: - /bin/bash - "-c" - "ls -lah > /dev/stderr" chdir: /root register: result - name: Print stderr lines debug: var: result.stderr_lines ``` 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 | success | The exit code of the command. | | **stderr** string | success | The standard error output of the container command. | | **stdout** string | success | The standard output of the container command. | ### Authors * Felix Fontein (@felixfontein) ansible community.docker.docker_node_info – Retrieves facts about docker swarm node from Swarm Manager community.docker.docker\_node\_info – Retrieves facts about docker swarm node from Swarm Manager ================================================================================================ Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_node_info`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Retrieves facts about a docker node. * Essentially returns the output of `docker node inspect <name>`. * Must be executed on a host running as Swarm Manager, otherwise the module will fail. Requirements ------------ The below requirements are needed on the host that executes this module. * Docker API >= 1.24 * Docker SDK for Python: Please note that the [docker-py](https://pypi.org/project/docker-py/) Python module has been superseded by [docker](https://pypi.org/project/docker/) (see [here](https://github.com/docker/docker-py/issues/1310) for details). For Python 2.6, `docker-py` must be used. Otherwise, it is recommended to install the `docker` Python module. Note that both modules should *not* be installed at the same time. Also note that when both modules are installed and one of them is uninstalled, the other might no longer function and a reinstall of it is required. * [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) >= 2.4.0 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **api\_version** string | **Default:**"auto" | The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported by Docker SDK for Python and the docker daemon. If the value is not specified in the task, the value of environment variable `DOCKER_API_VERSION` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_api\_version | | **ca\_cert** path | | Use a CA certificate when performing server verification by providing the path to a CA certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `ca.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_ca\_cert, cacert\_path | | **client\_cert** path | | Path to the client's TLS certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `cert.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_cert, cert\_path | | **client\_key** path | | Path to the client's TLS key file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `key.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_key, key\_path | | **debug** boolean | **Choices:*** **no** ← * yes | Debug mode | | **docker\_host** string | **Default:**"unix://var/run/docker.sock" | The URL or Unix socket path used to connect to the Docker API. To connect to a remote host, provide the TCP connection string. For example, `tcp://192.0.2.23:2376`. If TLS is used to encrypt the connection, the module will automatically replace `tcp` in the connection URL with `https`. If the value is not specified in the task, the value of environment variable `DOCKER_HOST` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_url | | **name** list / elements=string | | The name of the node to inspect. The list of nodes names to inspect. If empty then return information of all nodes in Swarm cluster. When identifying the node use either the hostname of the node (as registered in Swarm) or node ID. If *self* is `true` then this parameter is ignored. | | **self** boolean | **Choices:*** **no** ← * yes | If `true`, queries the node (i.e. the docker daemon) the module communicates with. If `true` then *name* is ignored. If `false` then query depends on *name* presence and value. | | **ssl\_version** string | | Provide a valid SSL version number. Default value determined by ssl.py module. If the value is not specified in the task, the value of environment variable `DOCKER_SSL_VERSION` will be used instead. | | **timeout** integer | **Default:**60 | The maximum amount of time in seconds to wait on a response from the API. If the value is not specified in the task, the value of environment variable `DOCKER_TIMEOUT` will be used instead. If the environment variable is not set, the default value will be used. | | **tls** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS without verifying the authenticity of the Docker host server. Note that if *validate\_certs* is set to `yes` as well, it will take precedence. If the value is not specified in the task, the value of environment variable `DOCKER_TLS` will be used instead. If the environment variable is not set, the default value will be used. | | **tls\_hostname** string | | When verifying the authenticity of the Docker Host server, provide the expected name of the server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_HOSTNAME` will be used instead. If the environment variable is not set, the default value will be used. The current default value is `localhost`. This default is deprecated and will change in community.docker 2.0.0 to be a value computed from *docker\_host*. Explicitly specify `localhost` to make sure this value will still be used, and to disable the deprecation message which will be shown otherwise. | | **use\_ssh\_client** boolean added in 1.5.0 of community.docker | **Choices:*** **no** ← * yes | For SSH transports, use the `ssh` CLI tool instead of paramiko. Requires Docker SDK for Python 4.4.0 or newer. | | **validate\_certs** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS and verifying the authenticity of the Docker host server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_VERIFY` will be used instead. If the environment variable is not set, the default value will be used. aliases: tls\_verify | Notes ----- Note * Connect to the Docker daemon by providing parameters with each task or by defining environment variables. You can define `DOCKER_HOST`, `DOCKER_TLS_HOSTNAME`, `DOCKER_API_VERSION`, `DOCKER_CERT_PATH`, `DOCKER_SSL_VERSION`, `DOCKER_TLS`, `DOCKER_TLS_VERIFY` and `DOCKER_TIMEOUT`. If you are using docker machine, run the script shipped with the product that sets up the environment. It will set these variables for you. See <https://docs.docker.com/machine/reference/env/> for more details. * When connecting to Docker daemon with TLS, you might need to install additional Python packages. For the Docker SDK for Python, version 2.4 or newer, this can be done by installing `docker[tls]` with [ansible.builtin.pip](../../ansible/builtin/pip_module#ansible-collections-ansible-builtin-pip-module). * Note that the Docker SDK for Python only allows to specify the path to the Docker configuration for very few functions. In general, it will use `$HOME/.docker/config.json` if the `DOCKER_CONFIG` environment variable is not specified, and use `$DOCKER_CONFIG/config.json` otherwise. * This module uses the [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) to communicate with the Docker daemon. Examples -------- ``` - name: Get info on all nodes community.docker.docker_node_info: register: result - name: Get info on node community.docker.docker_node_info: name: mynode register: result - name: Get info on list of nodes community.docker.docker_node_info: name: - mynode1 - mynode2 register: result - name: Get info on host if it is Swarm Manager community.docker.docker_node_info: self: true 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 | | --- | --- | --- | | **nodes** list / elements=dictionary | always | Facts representing the current state of the nodes. Matches the `docker node inspect` output. Can contain multiple entries if more than one node provided in *name*, or *name* is not provided. If *name* contains a list of nodes, the output will provide information on all nodes registered at the swarm, including nodes that left the swarm but haven't been removed from the cluster on swarm managers and nodes that are unreachable. | ### Authors * Piotr Wojciechowski (@WojciechowskiPiotr)
programming_docs
ansible community.docker.docker_containers – Ansible dynamic inventory plugin for Docker containers. community.docker.docker\_containers – Ansible dynamic inventory plugin for Docker containers. ============================================================================================= Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_containers`. New in version 1.1.0: of community.docker * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) Synopsis -------- * Reads inventories from the Docker API. * Uses a YAML configuration file that ends with `docker.[yml|yaml]`. Requirements ------------ The below requirements are needed on the local controller node that executes this inventory. * Docker SDK for Python: Please note that the [docker-py](https://pypi.org/project/docker-py/) Python module has been superseded by [docker](https://pypi.org/project/docker/) (see [here](https://github.com/docker/docker-py/issues/1310) for details). For Python 2.6, `docker-py` must be used. Otherwise, it is recommended to install the `docker` Python module. Note that both modules should *not* be installed at the same time. Also note that when both modules are installed and one of them is uninstalled, the other might no longer function and a reinstall of it is required. * [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) >= 1.10.0 Parameters ---------- | Parameter | Choices/Defaults | Configuration | Comments | | --- | --- | --- | --- | | **add\_legacy\_groups** boolean | **Choices:*** **no** ← * yes | | Add the same groups as the `docker` inventory script does. These are the following: `<container id>`: contains the container of this ID. `<container name>`: contains the container that has this name. `<container short id>`: contains the containers that have this short ID (first 13 letters of ID). `image_<image name>`: contains the containers that have the image `<image name>`. `stack_<stack name>`: contains the containers that belong to the stack `<stack name>`. `service_<service name>`: contains the containers that belong to the service `<service name>` `<docker_host>`: contains the containers which belong to the Docker daemon *docker\_host*. Useful if you run this plugin against multiple Docker daemons. `running`: contains all containers that are running. `stopped`: contains all containers that are not running. If this is not set to `true`, you should use keyed groups to add the containers to groups. See the examples for how to do that. | | **api\_version** string | **Default:**"auto" | | The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported by Docker SDK for Python and the docker daemon. If the value is not specified in the task, the value of environment variable `DOCKER_API_VERSION` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_api\_version | | **ca\_cert** path | | | Use a CA certificate when performing server verification by providing the path to a CA certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `ca.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_ca\_cert, cacert\_path | | **client\_cert** path | | | Path to the client's TLS certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `cert.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_cert, cert\_path | | **client\_key** path | | | Path to the client's TLS key file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `key.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_key, key\_path | | **compose** dictionary | **Default:**{} | | Create vars from jinja2 expressions. | | **configure\_docker\_daemon** boolean added in 1.8.0 of community.docker | **Choices:*** no * **yes** ← | | Whether to pass all Docker daemon configuration from the inventory plugin to the connection plugin. Only used when *connection\_type=docker-api*. | | **connection\_type** string | **Choices:*** ssh * docker-cli * **docker-api** ← | | Which connection type to use the containers. One way to connect to containers is to use SSH (`ssh`). For this, the options *default\_ip* and *private\_ssh\_port* are used. This requires that a SSH daemon is running inside the containers. Alternatively, `docker-cli` selects the docker connection plugin, and `docker-api` (default) selects the docker\_api connection plugin. When `docker-api` is used, all Docker daemon configuration values are passed from the inventory plugin to the connection plugin. This can be controlled with *configure\_docker\_daemon*. | | **debug** boolean | **Choices:*** **no** ← * yes | | Debug mode | | **default\_ip** string | **Default:**"127.0.0.1" | | The IP address to assign to ansible\_host when the container's SSH port is mapped to interface '0.0.0.0'. Only used if *connection\_type* is `ssh`. | | **docker\_host** string | **Default:**"unix://var/run/docker.sock" | | The URL or Unix socket path used to connect to the Docker API. To connect to a remote host, provide the TCP connection string. For example, `tcp://192.0.2.23:2376`. If TLS is used to encrypt the connection, the module will automatically replace `tcp` in the connection URL with `https`. If the value is not specified in the task, the value of environment variable `DOCKER_HOST` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_url | | **groups** dictionary | **Default:**{} | | Add hosts to group based on Jinja2 conditionals. | | **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. | | **plugin** string / required | **Choices:*** community.docker.docker\_containers | | The name of this plugin, it should always be set to `community.docker.docker_containers` for this plugin to recognize it as it's own. | | **private\_ssh\_port** integer | **Default:**22 | | The port containers use for SSH. Only used if *connection\_type* is `ssh`. | | **ssl\_version** string | | | Provide a valid SSL version number. Default value determined by ssl.py module. If the value is not specified in the task, the value of environment variable `DOCKER_SSL_VERSION` will be used instead. | | **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:**60 | | The maximum amount of time in seconds to wait on a response from the API. If the value is not specified in the task, the value of environment variable `DOCKER_TIMEOUT` will be used instead. If the environment variable is not set, the default value will be used. | | **tls** boolean | **Choices:*** **no** ← * yes | | Secure the connection to the API by using TLS without verifying the authenticity of the Docker host server. Note that if *validate\_certs* is set to `yes` as well, it will take precedence. If the value is not specified in the task, the value of environment variable `DOCKER_TLS` will be used instead. If the environment variable is not set, the default value will be used. | | **tls\_hostname** string | | | When verifying the authenticity of the Docker Host server, provide the expected name of the server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_HOSTNAME` will be used instead. If the environment variable is not set, the default value will be used. The current default value is `localhost`. This default is deprecated and will change in community.docker 2.0.0 to be a value computed from *docker\_host*. Explicitly specify `localhost` to make sure this value will still be used, and to disable the deprecation message which will be shown otherwise. | | **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). | | **use\_ssh\_client** boolean added in 1.5.0 of community.docker | **Choices:*** **no** ← * yes | | For SSH transports, use the `ssh` CLI tool instead of paramiko. Requires Docker SDK for Python 4.4.0 or newer. | | **validate\_certs** boolean | **Choices:*** **no** ← * yes | | Secure the connection to the API by using TLS and verifying the authenticity of the Docker host server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_VERIFY` will be used instead. If the environment variable is not set, the default value will be used. aliases: tls\_verify | | **verbose\_output** boolean | **Choices:*** **no** ← * yes | | Toggle to (not) include all available inspection metadata. Note that all top-level keys will be transformed to the format `docker_xxx`. For example, `HostConfig` is converted to `docker_hostconfig`. If this is `false`, these values can only be used during *constructed*, *groups*, and *keyed\_groups*. The `docker` inventory script always added these variables, so for compatibility set this to `true`. | Notes ----- Note * Connect to the Docker daemon by providing parameters with each task or by defining environment variables. You can define `DOCKER_HOST`, `DOCKER_TLS_HOSTNAME`, `DOCKER_API_VERSION`, `DOCKER_CERT_PATH`, `DOCKER_SSL_VERSION`, `DOCKER_TLS`, `DOCKER_TLS_VERIFY` and `DOCKER_TIMEOUT`. If you are using docker machine, run the script shipped with the product that sets up the environment. It will set these variables for you. See <https://docs.docker.com/machine/reference/env/> for more details. * When connecting to Docker daemon with TLS, you might need to install additional Python packages. For the Docker SDK for Python, version 2.4 or newer, this can be done by installing `docker[tls]` with [ansible.builtin.pip](../../ansible/builtin/pip_module#ansible-collections-ansible-builtin-pip-module). * Note that the Docker SDK for Python only allows to specify the path to the Docker configuration for very few functions. In general, it will use `$HOME/.docker/config.json` if the `DOCKER_CONFIG` environment variable is not specified, and use `$DOCKER_CONFIG/config.json` otherwise. * This module uses the [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) to communicate with the Docker daemon. Examples -------- ``` # Minimal example using local Docker daemon plugin: community.docker.docker_containers docker_host: unix://var/run/docker.sock # Minimal example using remote Docker daemon plugin: community.docker.docker_containers docker_host: tcp://my-docker-host:2375 # Example using remote Docker daemon with unverified TLS plugin: community.docker.docker_containers docker_host: tcp://my-docker-host:2376 tls: true # Example using remote Docker daemon with verified TLS and client certificate verification plugin: community.docker.docker_containers docker_host: tcp://my-docker-host:2376 validate_certs: true ca_cert: /somewhere/ca.pem client_key: /somewhere/key.pem client_cert: /somewhere/cert.pem # Example using constructed features to create groups plugin: community.docker.docker_containers docker_host: tcp://my-docker-host:2375 strict: false keyed_groups: # Add containers with primary network foo to a network_foo group - prefix: network key: 'docker_hostconfig.NetworkMode' # Add Linux hosts to an os_linux group - prefix: os key: docker_platform # Example using SSH connection with an explicit fallback for when port 22 hasn't been # exported: use container name as ansible_ssh_host and 22 as ansible_ssh_port plugin: community.docker.docker_containers connection_type: ssh compose: ansible_ssh_host: ansible_ssh_host | default(docker_name[1:], true) ansible_ssh_port: ansible_ssh_port | default(22, true) ``` ### Authors * Felix Fontein (@felixfontein) ansible community.docker.docker_network_info – Retrieves facts about docker network community.docker.docker\_network\_info – Retrieves facts about docker network ============================================================================= Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_network_info`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Retrieves facts about a docker network. * Essentially returns the output of `docker network inspect <name>`, similar to what [community.docker.docker\_network](docker_network_module#ansible-collections-community-docker-docker-network-module) returns for a non-absent network. Requirements ------------ The below requirements are needed on the host that executes this module. * Docker API >= 1.21 * Docker SDK for Python: Please note that the [docker-py](https://pypi.org/project/docker-py/) Python module has been superseded by [docker](https://pypi.org/project/docker/) (see [here](https://github.com/docker/docker-py/issues/1310) for details). For Python 2.6, `docker-py` must be used. Otherwise, it is recommended to install the `docker` Python module. Note that both modules should *not* be installed at the same time. Also note that when both modules are installed and one of them is uninstalled, the other might no longer function and a reinstall of it is required. * [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) >= 1.8.0 (use [docker-py](https://pypi.org/project/docker-py/) for Python 2.6) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **api\_version** string | **Default:**"auto" | The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported by Docker SDK for Python and the docker daemon. If the value is not specified in the task, the value of environment variable `DOCKER_API_VERSION` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_api\_version | | **ca\_cert** path | | Use a CA certificate when performing server verification by providing the path to a CA certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `ca.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_ca\_cert, cacert\_path | | **client\_cert** path | | Path to the client's TLS certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `cert.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_cert, cert\_path | | **client\_key** path | | Path to the client's TLS key file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `key.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_key, key\_path | | **debug** boolean | **Choices:*** **no** ← * yes | Debug mode | | **docker\_host** string | **Default:**"unix://var/run/docker.sock" | The URL or Unix socket path used to connect to the Docker API. To connect to a remote host, provide the TCP connection string. For example, `tcp://192.0.2.23:2376`. If TLS is used to encrypt the connection, the module will automatically replace `tcp` in the connection URL with `https`. If the value is not specified in the task, the value of environment variable `DOCKER_HOST` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_url | | **name** string / required | | The name of the network to inspect. When identifying an existing network name may be a name or a long or short network ID. | | **ssl\_version** string | | Provide a valid SSL version number. Default value determined by ssl.py module. If the value is not specified in the task, the value of environment variable `DOCKER_SSL_VERSION` will be used instead. | | **timeout** integer | **Default:**60 | The maximum amount of time in seconds to wait on a response from the API. If the value is not specified in the task, the value of environment variable `DOCKER_TIMEOUT` will be used instead. If the environment variable is not set, the default value will be used. | | **tls** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS without verifying the authenticity of the Docker host server. Note that if *validate\_certs* is set to `yes` as well, it will take precedence. If the value is not specified in the task, the value of environment variable `DOCKER_TLS` will be used instead. If the environment variable is not set, the default value will be used. | | **tls\_hostname** string | | When verifying the authenticity of the Docker Host server, provide the expected name of the server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_HOSTNAME` will be used instead. If the environment variable is not set, the default value will be used. The current default value is `localhost`. This default is deprecated and will change in community.docker 2.0.0 to be a value computed from *docker\_host*. Explicitly specify `localhost` to make sure this value will still be used, and to disable the deprecation message which will be shown otherwise. | | **use\_ssh\_client** boolean added in 1.5.0 of community.docker | **Choices:*** **no** ← * yes | For SSH transports, use the `ssh` CLI tool instead of paramiko. Requires Docker SDK for Python 4.4.0 or newer. | | **validate\_certs** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS and verifying the authenticity of the Docker host server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_VERIFY` will be used instead. If the environment variable is not set, the default value will be used. aliases: tls\_verify | Notes ----- Note * Connect to the Docker daemon by providing parameters with each task or by defining environment variables. You can define `DOCKER_HOST`, `DOCKER_TLS_HOSTNAME`, `DOCKER_API_VERSION`, `DOCKER_CERT_PATH`, `DOCKER_SSL_VERSION`, `DOCKER_TLS`, `DOCKER_TLS_VERIFY` and `DOCKER_TIMEOUT`. If you are using docker machine, run the script shipped with the product that sets up the environment. It will set these variables for you. See <https://docs.docker.com/machine/reference/env/> for more details. * When connecting to Docker daemon with TLS, you might need to install additional Python packages. For the Docker SDK for Python, version 2.4 or newer, this can be done by installing `docker[tls]` with [ansible.builtin.pip](../../ansible/builtin/pip_module#ansible-collections-ansible-builtin-pip-module). * Note that the Docker SDK for Python only allows to specify the path to the Docker configuration for very few functions. In general, it will use `$HOME/.docker/config.json` if the `DOCKER_CONFIG` environment variable is not specified, and use `$DOCKER_CONFIG/config.json` otherwise. * This module uses the [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) to communicate with the Docker daemon. Examples -------- ``` - name: Get infos on network community.docker.docker_network_info: name: mydata register: result - name: Does network exist? ansible.builtin.debug: msg: "The network {{ 'exists' if result.exists else 'does not exist' }}" - name: Print information about network ansible.builtin.debug: var: result.network when: result.exists ``` 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 | Returns whether the network exists. **Sample:** True | | **network** dictionary | always | Facts representing the current state of the network. Matches the docker inspection output. Will be `none` if network does not exist. **Sample:** { "Attachable": false, "ConfigFrom": { "Network": "" }, "ConfigOnly": false, "Containers": {}, "Created": "2018-12-07T01:47:51.250835114-06:00", "Driver": "bridge", "EnableIPv6": false, "IPAM": { "Config": [ { "Gateway": "192.168.96.1", "Subnet": "192.168.96.0/20" } ], "Driver": "default", "Options": null }, "Id": "0856968545f22026c41c2c7c3d448319d3b4a6a03a40b148b3ac4031696d1c0a", "Ingress": false, "Internal": false, "Labels": {}, "Name": "ansible-test-f2700bba", "Options": {}, "Scope": "local" } | ### Authors * Dave Bendit (@DBendit)
programming_docs
ansible community.docker.docker_stack – docker stack module community.docker.docker\_stack – docker stack module ==================================================== Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_stack`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Manage docker stacks using the ‘docker stack’ command on the target node (see examples). Requirements ------------ The below requirements are needed on the host that executes this module. * jsondiff * pyyaml Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **absent\_retries** integer | **Default:**0 | If `>0` and *state* is `absent` the module will retry up to *absent\_retries* times to delete the stack until all the resources have been effectively deleted. If the last try still reports the stack as not completely removed the module will fail. | | **absent\_retries\_interval** integer | **Default:**1 | Interval in seconds between consecutive *absent\_retries*. | | **compose** list / elements=raw | **Default:**[] | List of compose definitions. Any element may be a string referring to the path of the compose file on the target host or the YAML contents of a compose file nested as dictionary. | | **name** string / required | | Stack name | | **prune** boolean | **Choices:*** **no** ← * yes | If true will add the `--prune` option to the `docker stack deploy` command. This will have docker remove the services not present in the current stack definition. | | **resolve\_image** string | **Choices:*** always * changed * never | If set will add the `--resolve-image` option to the `docker stack deploy` command. This will have docker query the registry to resolve image digest and supported platforms. If not set, docker use "always" by default. | | **state** string | **Choices:*** **present** ← * absent | Service state. | | **with\_registry\_auth** boolean | **Choices:*** **no** ← * yes | If true will add the `--with-registry-auth` option to the `docker stack deploy` command. This will have docker send registry authentication details to Swarm agents. | Notes ----- Note * Return values *out* and *err* have been deprecated and will be removed in community.docker 2.0.0. Use *stdout* and *stderr* instead. Examples -------- ``` - name: Deploy stack from a compose file community.docker.docker_stack: state: present name: mystack compose: - /opt/docker-compose.yml - name: Deploy stack from base compose file and override the web service community.docker.docker_stack: state: present name: mystack compose: - /opt/docker-compose.yml - version: '3' services: web: image: nginx:latest environment: ENVVAR: envvar - name: Remove stack community.docker.docker_stack: name: mystack 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 | | --- | --- | --- | | **stack\_spec\_diff** dictionary | on change | dictionary containing the differences between the 'Spec' field of the stack services before and after applying the new stack definition. **Sample:** "stack\_spec\_diff": {'test\_stack\_test\_service': {u'TaskTemplate': {u'ContainerSpec': {delete: [u'Env']}}}} | ### Authors * Dario Zanzico (@dariko) ansible community.docker.docker_network – Manage Docker networks community.docker.docker\_network – Manage Docker networks ========================================================= Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_network`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Create/remove Docker networks and connect containers to them. * Performs largely the same function as the “docker network” CLI subcommand. Requirements ------------ The below requirements are needed on the host that executes this module. * Docker SDK for Python: Please note that the [docker-py](https://pypi.org/project/docker-py/) Python module has been superseded by [docker](https://pypi.org/project/docker/) (see [here](https://github.com/docker/docker-py/issues/1310) for details). For Python 2.6, `docker-py` must be used. Otherwise, it is recommended to install the `docker` Python module. Note that both modules should *not* be installed at the same time. Also note that when both modules are installed and one of them is uninstalled, the other might no longer function and a reinstall of it is required. * [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) >= 1.10.0 (use [docker-py](https://pypi.org/project/docker-py/) for Python 2.6) * The docker server >= 1.10.0 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **api\_version** string | **Default:**"auto" | The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported by Docker SDK for Python and the docker daemon. If the value is not specified in the task, the value of environment variable `DOCKER_API_VERSION` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_api\_version | | **appends** boolean | **Choices:*** **no** ← * yes | By default the connected list is canonical, meaning containers not on the list are removed from the network. Use *appends* to leave existing containers connected. aliases: incremental | | **attachable** boolean | **Choices:*** no * yes | If enabled, and the network is in the global scope, non-service containers on worker nodes will be able to connect to the network. | | **ca\_cert** path | | Use a CA certificate when performing server verification by providing the path to a CA certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `ca.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_ca\_cert, cacert\_path | | **client\_cert** path | | Path to the client's TLS certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `cert.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_cert, cert\_path | | **client\_key** path | | Path to the client's TLS key file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `key.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_key, key\_path | | **connected** list / elements=string | | List of container names or container IDs to connect to a network. Please note that the module only makes sure that these containers are connected to the network, but does not care about connection options. If you rely on specific IP addresses etc., use the [community.docker.docker\_container](docker_container_module) module to ensure your containers are correctly connected to this network. aliases: containers | | **debug** boolean | **Choices:*** **no** ← * yes | Debug mode | | **docker\_host** string | **Default:**"unix://var/run/docker.sock" | The URL or Unix socket path used to connect to the Docker API. To connect to a remote host, provide the TCP connection string. For example, `tcp://192.0.2.23:2376`. If TLS is used to encrypt the connection, the module will automatically replace `tcp` in the connection URL with `https`. If the value is not specified in the task, the value of environment variable `DOCKER_HOST` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_url | | **driver** string | **Default:**"bridge" | Specify the type of network. Docker provides bridge and overlay drivers, but 3rd party drivers can also be used. | | **driver\_options** dictionary | | Dictionary of network settings. Consult docker docs for valid options and values. | | **enable\_ipv6** boolean | **Choices:*** no * yes | Enable IPv6 networking. | | **force** boolean | **Choices:*** **no** ← * yes | With state `absent` forces disconnecting all containers from the network prior to deleting the network. With state `present` will disconnect all containers, delete the network and re-create the network. This option is required if you have changed the IPAM or driver options and want an existing network to be updated to use the new options. | | **internal** boolean | **Choices:*** no * yes | Restrict external access to the network. | | **ipam\_config** list / elements=dictionary | | List of IPAM config blocks. Consult [Docker docs](https://docs.docker.com/compose/compose-file/compose-file-v2/#ipam) for valid options and values. Note that *iprange* is spelled differently here (we use the notation from the Docker SDK for Python). | | | **aux\_addresses** dictionary | | Auxiliary IP addresses used by Network driver, as a mapping from hostname to IP. | | | **gateway** string | | IP gateway address. | | | **iprange** string | | IP address range in CIDR notation. | | | **subnet** string | | IP subset in CIDR notation. | | **ipam\_driver** string | | Specify an IPAM driver. | | **ipam\_driver\_options** dictionary | | Dictionary of IPAM driver options. | | **labels** dictionary | | Dictionary of labels. | | **name** string / required | | Name of the network to operate on. aliases: network\_name | | **scope** string | **Choices:*** local * global * swarm | Specify the network's scope. | | **ssl\_version** string | | Provide a valid SSL version number. Default value determined by ssl.py module. If the value is not specified in the task, the value of environment variable `DOCKER_SSL_VERSION` will be used instead. | | **state** string | **Choices:*** absent * **present** ← | `absent` deletes the network. If a network has connected containers, it cannot be deleted. Use the *force* option to disconnect all containers and delete the network. `present` creates the network, if it does not already exist with the specified parameters, and connects the list of containers provided via the connected parameter. Containers not on the list will be disconnected. An empty list will leave no containers connected to the network. Use the *appends* option to leave existing containers connected. Use the *force* options to force re-creation of the network. | | **timeout** integer | **Default:**60 | The maximum amount of time in seconds to wait on a response from the API. If the value is not specified in the task, the value of environment variable `DOCKER_TIMEOUT` will be used instead. If the environment variable is not set, the default value will be used. | | **tls** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS without verifying the authenticity of the Docker host server. Note that if *validate\_certs* is set to `yes` as well, it will take precedence. If the value is not specified in the task, the value of environment variable `DOCKER_TLS` will be used instead. If the environment variable is not set, the default value will be used. | | **tls\_hostname** string | | When verifying the authenticity of the Docker Host server, provide the expected name of the server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_HOSTNAME` will be used instead. If the environment variable is not set, the default value will be used. The current default value is `localhost`. This default is deprecated and will change in community.docker 2.0.0 to be a value computed from *docker\_host*. Explicitly specify `localhost` to make sure this value will still be used, and to disable the deprecation message which will be shown otherwise. | | **use\_ssh\_client** boolean added in 1.5.0 of community.docker | **Choices:*** **no** ← * yes | For SSH transports, use the `ssh` CLI tool instead of paramiko. Requires Docker SDK for Python 4.4.0 or newer. | | **validate\_certs** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS and verifying the authenticity of the Docker host server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_VERIFY` will be used instead. If the environment variable is not set, the default value will be used. aliases: tls\_verify | Notes ----- Note * When network options are changed, the module disconnects all containers from the network, deletes the network, and re-creates the network. It does not try to reconnect containers, except the ones listed in (*connected*, and even for these, it does not consider specific connection options like fixed IP addresses or MAC addresses. If you need more control over how the containers are connected to the network, loop the [community.docker.docker\_container](docker_container_module#ansible-collections-community-docker-docker-container-module) module to loop over your containers to make sure they are connected properly. * The module does not support Docker Swarm, i.e. it will not try to disconnect or reconnect services. If services are connected to the network, deleting the network will fail. When network options are changed, the network has to be deleted and recreated, so this will fail as well. * Connect to the Docker daemon by providing parameters with each task or by defining environment variables. You can define `DOCKER_HOST`, `DOCKER_TLS_HOSTNAME`, `DOCKER_API_VERSION`, `DOCKER_CERT_PATH`, `DOCKER_SSL_VERSION`, `DOCKER_TLS`, `DOCKER_TLS_VERIFY` and `DOCKER_TIMEOUT`. If you are using docker machine, run the script shipped with the product that sets up the environment. It will set these variables for you. See <https://docs.docker.com/machine/reference/env/> for more details. * When connecting to Docker daemon with TLS, you might need to install additional Python packages. For the Docker SDK for Python, version 2.4 or newer, this can be done by installing `docker[tls]` with [ansible.builtin.pip](../../ansible/builtin/pip_module#ansible-collections-ansible-builtin-pip-module). * Note that the Docker SDK for Python only allows to specify the path to the Docker configuration for very few functions. In general, it will use `$HOME/.docker/config.json` if the `DOCKER_CONFIG` environment variable is not specified, and use `$DOCKER_CONFIG/config.json` otherwise. * This module uses the [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) to communicate with the Docker daemon. Examples -------- ``` - name: Create a network community.docker.docker_network: name: network_one - name: Remove all but selected list of containers community.docker.docker_network: name: network_one connected: - container_a - container_b - container_c - name: Remove a single container community.docker.docker_network: name: network_one connected: "{{ fulllist|difference(['container_a']) }}" - name: Add a container to a network, leaving existing containers connected community.docker.docker_network: name: network_one connected: - container_a appends: yes - name: Create a network with driver options community.docker.docker_network: name: network_two driver_options: com.docker.network.bridge.name: net2 - name: Create a network with custom IPAM config community.docker.docker_network: name: network_three ipam_config: - subnet: 172.23.27.0/24 gateway: 172.23.27.2 iprange: 172.23.27.0/26 aux_addresses: host1: 172.23.27.3 host2: 172.23.27.4 - name: Create a network with labels community.docker.docker_network: name: network_four labels: key1: value1 key2: value2 - name: Create a network with IPv6 IPAM config community.docker.docker_network: name: network_ipv6_one enable_ipv6: yes ipam_config: - subnet: fdd1:ac8c:0557:7ce1::/64 - name: Create a network with IPv6 and custom IPv4 IPAM config community.docker.docker_network: name: network_ipv6_two enable_ipv6: yes ipam_config: - subnet: 172.24.27.0/24 - subnet: fdd1:ac8c:0557:7ce2::/64 - name: Delete a network, disconnecting all containers community.docker.docker_network: name: network_one 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 | | --- | --- | --- | | **network** dictionary | success | Network inspection results for the affected network. | ### Authors * Ben Keith (@keitwb) * Chris Houseknecht (@chouseknecht) * Dave Bendit (@DBendit) ansible community.docker.docker_swarm_service_info – Retrieves information about docker services from a Swarm Manager community.docker.docker\_swarm\_service\_info – Retrieves information about docker services from a Swarm Manager ================================================================================================================ Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_swarm_service_info`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Retrieves information about a docker service. * Essentially returns the output of `docker service inspect <name>`. * Must be executed on a host running as Swarm Manager, otherwise the module will fail. Requirements ------------ The below requirements are needed on the host that executes this module. * Docker API >= 1.24 * Docker SDK for Python: Please note that the [docker-py](https://pypi.org/project/docker-py/) Python module has been superseded by [docker](https://pypi.org/project/docker/) (see [here](https://github.com/docker/docker-py/issues/1310) for details). For Python 2.6, `docker-py` must be used. Otherwise, it is recommended to install the `docker` Python module. Note that both modules should *not* be installed at the same time. Also note that when both modules are installed and one of them is uninstalled, the other might no longer function and a reinstall of it is required. * [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) >= 2.0.0 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **api\_version** string | **Default:**"auto" | The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported by Docker SDK for Python and the docker daemon. If the value is not specified in the task, the value of environment variable `DOCKER_API_VERSION` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_api\_version | | **ca\_cert** path | | Use a CA certificate when performing server verification by providing the path to a CA certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `ca.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_ca\_cert, cacert\_path | | **client\_cert** path | | Path to the client's TLS certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `cert.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_cert, cert\_path | | **client\_key** path | | Path to the client's TLS key file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `key.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_key, key\_path | | **debug** boolean | **Choices:*** **no** ← * yes | Debug mode | | **docker\_host** string | **Default:**"unix://var/run/docker.sock" | The URL or Unix socket path used to connect to the Docker API. To connect to a remote host, provide the TCP connection string. For example, `tcp://192.0.2.23:2376`. If TLS is used to encrypt the connection, the module will automatically replace `tcp` in the connection URL with `https`. If the value is not specified in the task, the value of environment variable `DOCKER_HOST` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_url | | **name** string / required | | The name of the service to inspect. | | **ssl\_version** string | | Provide a valid SSL version number. Default value determined by ssl.py module. If the value is not specified in the task, the value of environment variable `DOCKER_SSL_VERSION` will be used instead. | | **timeout** integer | **Default:**60 | The maximum amount of time in seconds to wait on a response from the API. If the value is not specified in the task, the value of environment variable `DOCKER_TIMEOUT` will be used instead. If the environment variable is not set, the default value will be used. | | **tls** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS without verifying the authenticity of the Docker host server. Note that if *validate\_certs* is set to `yes` as well, it will take precedence. If the value is not specified in the task, the value of environment variable `DOCKER_TLS` will be used instead. If the environment variable is not set, the default value will be used. | | **tls\_hostname** string | | When verifying the authenticity of the Docker Host server, provide the expected name of the server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_HOSTNAME` will be used instead. If the environment variable is not set, the default value will be used. The current default value is `localhost`. This default is deprecated and will change in community.docker 2.0.0 to be a value computed from *docker\_host*. Explicitly specify `localhost` to make sure this value will still be used, and to disable the deprecation message which will be shown otherwise. | | **use\_ssh\_client** boolean added in 1.5.0 of community.docker | **Choices:*** **no** ← * yes | For SSH transports, use the `ssh` CLI tool instead of paramiko. Requires Docker SDK for Python 4.4.0 or newer. | | **validate\_certs** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS and verifying the authenticity of the Docker host server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_VERIFY` will be used instead. If the environment variable is not set, the default value will be used. aliases: tls\_verify | Notes ----- Note * Connect to the Docker daemon by providing parameters with each task or by defining environment variables. You can define `DOCKER_HOST`, `DOCKER_TLS_HOSTNAME`, `DOCKER_API_VERSION`, `DOCKER_CERT_PATH`, `DOCKER_SSL_VERSION`, `DOCKER_TLS`, `DOCKER_TLS_VERIFY` and `DOCKER_TIMEOUT`. If you are using docker machine, run the script shipped with the product that sets up the environment. It will set these variables for you. See <https://docs.docker.com/machine/reference/env/> for more details. * When connecting to Docker daemon with TLS, you might need to install additional Python packages. For the Docker SDK for Python, version 2.4 or newer, this can be done by installing `docker[tls]` with [ansible.builtin.pip](../../ansible/builtin/pip_module#ansible-collections-ansible-builtin-pip-module). * Note that the Docker SDK for Python only allows to specify the path to the Docker configuration for very few functions. In general, it will use `$HOME/.docker/config.json` if the `DOCKER_CONFIG` environment variable is not specified, and use `$DOCKER_CONFIG/config.json` otherwise. * This module uses the [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) to communicate with the Docker daemon. Examples -------- ``` - name: Get info from a service community.docker.docker_swarm_service_info: name: myservice 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 | | --- | --- | --- | | **exists** boolean | always | Returns whether the service exists. **Sample:** True | | **service** dictionary | always | A dictionary representing the current state of the service. Matches the `docker service inspect` output. Will be `none` if service does not exist. | ### Authors * Hannes Ljungberg (@hannseman)
programming_docs
ansible community.docker.docker_container – manage docker containers community.docker.docker\_container – manage docker containers ============================================================= Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_container`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Manage the life cycle of docker containers. * Supports check mode. Run with `--check` and `--diff` to view config difference and list of actions to be taken. Requirements ------------ The below requirements are needed on the host that executes this module. * Docker API >= 1.20 * Docker SDK for Python: Please note that the [docker-py](https://pypi.org/project/docker-py/) Python module has been superseded by [docker](https://pypi.org/project/docker/) (see [here](https://github.com/docker/docker-py/issues/1310) for details). For Python 2.6, `docker-py` must be used. Otherwise, it is recommended to install the `docker` Python module. Note that both modules should *not* be installed at the same time. Also note that when both modules are installed and one of them is uninstalled, the other might no longer function and a reinstall of it is required. * [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) >= 1.8.0 (use [docker-py](https://pypi.org/project/docker-py/) for Python 2.6) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **api\_version** string | **Default:**"auto" | The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported by Docker SDK for Python and the docker daemon. If the value is not specified in the task, the value of environment variable `DOCKER_API_VERSION` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_api\_version | | **auto\_remove** boolean | **Choices:*** no * yes | Enable auto-removal of the container on daemon side when the container's process exits. If *container\_default\_behavior* is set to `compatiblity` (the default value), this option has a default of `no`. | | **blkio\_weight** integer | | Block IO (relative weight), between 10 and 1000. | | **ca\_cert** path | | Use a CA certificate when performing server verification by providing the path to a CA certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `ca.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_ca\_cert, cacert\_path | | **cap\_drop** list / elements=string | | List of capabilities to drop from the container. | | **capabilities** list / elements=string | | List of capabilities to add to the container. | | **cgroup\_parent** string added in 1.1.0 of community.docker | | Specify the parent cgroup for the container. | | **cleanup** boolean | **Choices:*** **no** ← * yes | Use with *detach=false* to remove the container after successful execution. | | **client\_cert** path | | Path to the client's TLS certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `cert.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_cert, cert\_path | | **client\_key** path | | Path to the client's TLS key file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `key.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_key, key\_path | | **command** raw | | Command to execute when the container starts. A command may be either a string or a list. Prior to version 2.4, strings were split on commas. See *command\_handling* for differences in how strings and lists are handled. | | **command\_handling** string added in 1.9.0 of community.docker | **Choices:*** compatibility * correct | The default behavior for *command* (when provided as a list) and *entrypoint* is to convert them to strings without considering shell quoting rules. (For comparing idempotency, the resulting string is split considering shell quoting rules.) Also, setting *command* to an empty list of string, and setting *entrypoint* to an empty list will be handled as if these options are not specified. This is different from idempotency handling for other container-config related options. When this is set to `compatiblity`, which is the default until community.docker 3.0.0, the current behavior will be kept. When this is set to `correct`, these options are kept as lists, and an empty value or empty list will be handled correctly for idempotency checks. In community.docker 3.0.0, the default will change to `correct`. | | **comparisons** dictionary | | Allows to specify how properties of existing containers are compared with module options to decide whether the container should be recreated / updated or not. Only options which correspond to the state of a container as handled by the Docker daemon can be specified, as well as `networks`. Must be a dictionary specifying for an option one of the keys `strict`, `ignore` and `allow_more_present`. If `strict` is specified, values are tested for equality, and changes always result in updating or restarting. If `ignore` is specified, changes are ignored. `allow_more_present` is allowed only for lists, sets and dicts. If it is specified for lists or sets, the container will only be updated or restarted if the module option contains a value which is not present in the container's options. If the option is specified for a dict, the container will only be updated or restarted if the module option contains a key which isn't present in the container's option, or if the value of a key present differs. The wildcard option `*` can be used to set one of the default values `strict` or `ignore` to \*all\* comparisons which are not explicitly set to other values. See the examples for details. | | **container\_default\_behavior** string | **Choices:*** compatibility * no\_defaults | Various module options used to have default values. This causes problems with containers which use different values for these options. The default value is `compatibility`, which will ensure that the default values are used when the values are not explicitly specified by the user. From community.docker 2.0.0 on, the default value will switch to `no_defaults`. To avoid deprecation warnings, please set *container\_default\_behavior* to an explicit value. This affects the *auto\_remove*, *detach*, *init*, *interactive*, *memory*, *paused*, *privileged*, *read\_only* and *tty* options. | | **cpu\_period** integer | | Limit CPU CFS (Completely Fair Scheduler) period. See *cpus* for an easier to use alternative. | | **cpu\_quota** integer | | Limit CPU CFS (Completely Fair Scheduler) quota. See *cpus* for an easier to use alternative. | | **cpu\_shares** integer | | CPU shares (relative weight). | | **cpus** float | | Specify how much of the available CPU resources a container can use. A value of `1.5` means that at most one and a half CPU (core) will be used. | | **cpuset\_cpus** string | | CPUs in which to allow execution `1,3` or `1-3`. | | **cpuset\_mems** string | | Memory nodes (MEMs) in which to allow execution `0-3` or `0,1`. | | **debug** boolean | **Choices:*** **no** ← * yes | Debug mode | | **default\_host\_ip** string added in 1.2.0 of community.docker | | Define the default host IP to use. Must be an empty string, an IPv4 address, or an IPv6 address. With Docker 20.10.2 or newer, this should be set to an empty string (`""`) to avoid the port bindings without an explicit IP address to only bind to IPv4. See <https://github.com/ansible-collections/community.docker/issues/70> for details. By default, the module will try to auto-detect this value from the `bridge` network's `com.docker.network.bridge.host_binding_ipv4` option. If it cannot auto-detect it, it will fall back to `0.0.0.0`. | | **detach** boolean | **Choices:*** no * yes | Enable detached mode to leave the container running in background. If disabled, the task will reflect the status of the container run (failed if the command failed). If *container\_default\_behavior* is set to `compatiblity` (the default value), this option has a default of `yes`. | | **device\_read\_bps** list / elements=dictionary | | List of device path and read rate (bytes per second) from device. | | | **path** string / required | | Device path in the container. | | | **rate** string / required | | Device read limit in format `<number>[<unit>]`. Number is a positive integer. Unit can be one of `B` (byte), `K` (kibibyte, 1024B), `M` (mebibyte), `G` (gibibyte), `T` (tebibyte), or `P` (pebibyte). Omitting the unit defaults to bytes. | | **device\_read\_iops** list / elements=dictionary | | List of device and read rate (IO per second) from device. | | | **path** string / required | | Device path in the container. | | | **rate** integer / required | | Device read limit. Must be a positive integer. | | **device\_requests** list / elements=dictionary added in 0.1.0 of community.docker | | Allows to request additional resources, such as GPUs. | | | **capabilities** list / elements=list | | List of lists of strings to request capabilities. The top-level list entries are combined by OR, and for every list entry, the entries in the list it contains are combined by AND. The driver tries to satisfy one of the sub-lists. Available capabilities for the `nvidia` driver can be found at <https://github.com/NVIDIA/nvidia-container-runtime>. | | | **count** integer | | Number or devices to request. Set to `-1` to request all available devices. | | | **device\_ids** list / elements=string | | List of device IDs. | | | **driver** string | | Which driver to use for this device. | | | **options** dictionary | | Driver-specific options. | | **device\_write\_bps** list / elements=dictionary | | List of device and write rate (bytes per second) to device. | | | **path** string / required | | Device path in the container. | | | **rate** string / required | | Device read limit in format `<number>[<unit>]`. Number is a positive integer. Unit can be one of `B` (byte), `K` (kibibyte, 1024B), `M` (mebibyte), `G` (gibibyte), `T` (tebibyte), or `P` (pebibyte). Omitting the unit defaults to bytes. | | **device\_write\_iops** list / elements=dictionary | | List of device and write rate (IO per second) to device. | | | **path** string / required | | Device path in the container. | | | **rate** integer / required | | Device read limit. Must be a positive integer. | | **devices** list / elements=string | | List of host device bindings to add to the container. Each binding is a mapping expressed in the format `<path_on_host>:<path_in_container>:<cgroup_permissions>`. | | **dns\_opts** list / elements=string | | List of DNS options. | | **dns\_search\_domains** list / elements=string | | List of custom DNS search domains. | | **dns\_servers** list / elements=string | | List of custom DNS servers. | | **docker\_host** string | **Default:**"unix://var/run/docker.sock" | The URL or Unix socket path used to connect to the Docker API. To connect to a remote host, provide the TCP connection string. For example, `tcp://192.0.2.23:2376`. If TLS is used to encrypt the connection, the module will automatically replace `tcp` in the connection URL with `https`. If the value is not specified in the task, the value of environment variable `DOCKER_HOST` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_url | | **domainname** string | | Container domainname. | | **entrypoint** list / elements=string | | Command that overwrites the default `ENTRYPOINT` of the image. See *command\_handling* for differences in how strings and lists are handled. | | **env** dictionary | | Dictionary of key,value pairs. Values which might be parsed as numbers, booleans or other types by the YAML parser must be quoted (e.g. `"true"`) in order to avoid data loss. Please note that if you are passing values in with Jinja2 templates, like `"{{ value }}"`, you need to add `| string` to prevent Ansible to convert strings such as `"true"` back to booleans. The correct way is to use `"{{ value | string }}"`. | | **env\_file** path | | Path to a file, present on the target, containing environment variables *FOO=BAR*. If variable also present in *env*, then the *env* value will override. | | **etc\_hosts** dictionary | | Dict of host-to-IP mappings, where each host name is a key in the dictionary. Each host name will be added to the container's `/etc/hosts` file. | | **exposed\_ports** list / elements=string | | List of additional container ports which informs Docker that the container listens on the specified network ports at runtime. If the port is already exposed using `EXPOSE` in a Dockerfile, it does not need to be exposed again. aliases: exposed, expose | | **force\_kill** boolean | **Choices:*** **no** ← * yes | Use the kill command when stopping a running container. aliases: forcekill | | **groups** list / elements=string | | List of additional group names and/or IDs that the container process will run as. | | **healthcheck** dictionary | | Configure a check that is run to determine whether or not containers for this service are "healthy". See the docs for the [HEALTHCHECK Dockerfile instruction](https://docs.docker.com/engine/reference/builder/#healthcheck) for details on how healthchecks work. *interval*, *timeout* and *start\_period* are specified as durations. They accept duration as a string in a format that look like: `5h34m56s`, `1m30s` etc. The supported units are `us`, `ms`, `s`, `m` and `h`. | | | **interval** string | | Time between running the check. The default used by the Docker daemon is `30s`. | | | **retries** integer | | Consecutive number of failures needed to report unhealthy. The default used by the Docker daemon is `3`. | | | **start\_period** string | | Start period for the container to initialize before starting health-retries countdown. The default used by the Docker daemon is `0s`. | | | **test** raw | | Command to run to check health. Must be either a string or a list. If it is a list, the first item must be one of `NONE`, `CMD` or `CMD-SHELL`. | | | **timeout** string | | Maximum time to allow one check to run. The default used by the Docker daemon is `30s`. | | **hostname** string | | The container's hostname. | | **ignore\_image** boolean | **Choices:*** **no** ← * yes | When *state* is `present` or `started`, the module compares the configuration of an existing container to requested configuration. The evaluation includes the image version. If the image version in the registry does not match the container, the container will be recreated. You can stop this behavior by setting *ignore\_image* to `True`. \*Warning:\* This option is ignored if `image: ignore` or `*: ignore` is specified in the *comparisons* option. | | **image** string | | Repository path and tag used to create the container. If an image is not found or pull is true, the image will be pulled from the registry. If no tag is included, `latest` will be used. Can also be an image ID. If this is the case, the image is assumed to be available locally. The *pull* option is ignored for this case. | | **init** boolean | **Choices:*** no * yes | Run an init inside the container that forwards signals and reaps processes. This option requires Docker API >= 1.25. If *container\_default\_behavior* is set to `compatiblity` (the default value), this option has a default of `no`. | | **interactive** boolean | **Choices:*** no * yes | Keep stdin open after a container is launched, even if not attached. If *container\_default\_behavior* is set to `compatiblity` (the default value), this option has a default of `no`. | | **ipc\_mode** string | | Set the IPC mode for the container. Can be one of `container:<name|id>` to reuse another container's IPC namespace or `host` to use the host's IPC namespace within the container. | | **keep\_volumes** boolean | **Choices:*** no * **yes** ← | Retain anonymous volumes associated with a removed container. | | **kernel\_memory** string | | Kernel memory limit in format `<number>[<unit>]`. Number is a positive integer. Unit can be `B` (byte), `K` (kibibyte, 1024B), `M` (mebibyte), `G` (gibibyte), `T` (tebibyte), or `P` (pebibyte). Minimum is `4M`. Omitting the unit defaults to bytes. | | **kill\_signal** string | | Override default signal used to kill a running container. | | **labels** dictionary | | Dictionary of key value pairs. | | **links** list / elements=string | | List of name aliases for linked containers in the format `container_name:alias`. Setting this will force container to be restarted. | | **log\_driver** string | | Specify the logging driver. Docker uses `json-file` by default. See [here](https://docs.docker.com/config/containers/logging/configure/) for possible choices. | | **log\_options** dictionary | | Dictionary of options specific to the chosen *log\_driver*. See <https://docs.docker.com/engine/admin/logging/overview/> for details. aliases: log\_opt | | **mac\_address** string | | Container MAC address (e.g. 92:d0:c6:0a:29:33). | | **memory** string | | Memory limit in format `<number>[<unit>]`. Number is a positive integer. Unit can be `B` (byte), `K` (kibibyte, 1024B), `M` (mebibyte), `G` (gibibyte), `T` (tebibyte), or `P` (pebibyte). Omitting the unit defaults to bytes. If *container\_default\_behavior* is set to `compatiblity` (the default value), this option has a default of `"0"`. | | **memory\_reservation** string | | Memory soft limit in format `<number>[<unit>]`. Number is a positive integer. Unit can be `B` (byte), `K` (kibibyte, 1024B), `M` (mebibyte), `G` (gibibyte), `T` (tebibyte), or `P` (pebibyte). Omitting the unit defaults to bytes. | | **memory\_swap** string | | Total memory limit (memory + swap) in format `<number>[<unit>]`, or the special values `unlimited` or `-1` for unlimited swap usage. Number is a positive integer. Unit can be `B` (byte), `K` (kibibyte, 1024B), `M` (mebibyte), `G` (gibibyte), `T` (tebibyte), or `P` (pebibyte). Omitting the unit defaults to bytes. | | **memory\_swappiness** integer | | Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100. If not set, the value will be remain the same if container exists and will be inherited from the host machine if it is (re-)created. | | **mounts** list / elements=dictionary | | Specification for mounts to be added to the container. More powerful alternative to *volumes*. | | | **consistency** string | **Choices:*** cached * consistent * default * delegated | The consistency requirement for the mount. | | | **labels** dictionary | | User-defined name and labels for the volume. Only valid for the `volume` type. | | | **no\_copy** boolean | **Choices:*** no * yes | False if the volume should be populated with the data from the target. Only valid for the `volume` type. The default value is `false`. | | | **propagation** string | **Choices:*** private * rprivate * shared * rshared * slave * rslave | Propagation mode. Only valid for the `bind` type. | | | **read\_only** boolean | **Choices:*** no * yes | Whether the mount should be read-only. | | | **source** string | | Mount source (e.g. a volume name or a host path). If not supplied when *type=volume* an anonymous volume will be created. | | | **target** string / required | | Path inside the container. | | | **tmpfs\_mode** string | | The permission mode for the tmpfs mount. | | | **tmpfs\_size** string | | The size for the tmpfs mount in bytes in format <number>[<unit>]. Number is a positive integer. Unit can be one of `B` (byte), `K` (kibibyte, 1024B), `M` (mebibyte), `G` (gibibyte), `T` (tebibyte), or `P` (pebibyte). Omitting the unit defaults to bytes. | | | **type** string | **Choices:*** bind * npipe * tmpfs * **volume** ← | The mount type. Note that `npipe` is only supported by Docker for Windows. | | | **volume\_driver** string | | Specify the volume driver. Only valid for the `volume` type. See [here](https://docs.docker.com/storage/volumes/#use-a-volume-driver) for details. | | | **volume\_options** dictionary | | Dictionary of options specific to the chosen volume\_driver. See [here](https://docs.docker.com/storage/volumes/#use-a-volume-driver) for details. | | **name** string / required | | Assign a name to a new container or match an existing container. When identifying an existing container name may be a name or a long or short container ID. | | **network\_mode** string | | Connect the container to a network. Choices are `bridge`, `host`, `none`, `container:<name|id>`, `<network_name>` or `default`. \*Note\* that from community.docker 2.0.0 on, if *networks\_cli\_compatible* is `true` and *networks* contains at least one network, the default value for *network\_mode* will be the name of the first network in the *networks* list. You can prevent this by explicitly specifying a value for *network\_mode*, like the default value `default` which will be used by Docker if *network\_mode* is not specified. | | **networks** list / elements=dictionary | | List of networks the container belongs to. For examples of the data structure and usage see EXAMPLES below. To remove a container from one or more networks, use the *purge\_networks* option. If *networks\_cli\_compatible* is set to `false`, this will not remove the default network if *networks* is specified. This is different from the behavior of `docker run ...`. You need to explicitly use *purge\_networks* to enforce the removal of the default network (and all other networks not explicitly mentioned in *networks*) in that case. | | | **aliases** list / elements=string | | List of aliases for this container in this network. These names can be used in the network to reach this container. | | | **ipv4\_address** string | | The container's IPv4 address in this network. | | | **ipv6\_address** string | | The container's IPv6 address in this network. | | | **links** list / elements=string | | A list of containers to link to. | | | **name** string / required | | The network's name. | | **networks\_cli\_compatible** boolean | **Choices:*** no * **yes** ← | If *networks\_cli\_compatible* is set to `yes` (default), this module will behave as `docker run --network` and will \*not\* add the default network if *networks* is specified. If *networks* is not specified, the default network will be attached. When *networks\_cli\_compatible* is set to `no` and networks are provided to the module via the *networks* option, the module behaves differently than `docker run --network`: `docker run --network other` will create a container with network `other` attached, but the default network not attached. This module with *networks: {name: other}* will create a container with both `default` and `other` attached. If *purge\_networks* is set to `yes`, the `default` network will be removed afterwards. \*Note\* that docker CLI also sets *network\_mode* to the name of the first network added if `--network` is specified. For more compatibility with docker CLI, you explicitly have to set *network\_mode* to the name of the first network you're adding. This behavior will change for community.docker 2.0.0: then *network\_mode* will automatically be set to the first network name in *networks* if *network\_mode* is not specified, *networks* has at least one entry and *networks\_cli\_compatible* is `true`. | | **oom\_killer** boolean | **Choices:*** no * yes | Whether or not to disable OOM Killer for the container. | | **oom\_score\_adj** integer | | An integer value containing the score given to the container in order to tune OOM killer preferences. | | **output\_logs** boolean | **Choices:*** **no** ← * yes | If set to true, output of the container command will be printed. Only effective when *log\_driver* is set to `json-file` or `journald`. | | **paused** boolean | **Choices:*** no * yes | Use with the started state to pause running processes inside the container. If *container\_default\_behavior* is set to `compatiblity` (the default value), this option has a default of `no`. | | **pid\_mode** string | | Set the PID namespace mode for the container. Note that Docker SDK for Python < 2.0 only supports `host`. Newer versions of the Docker SDK for Python (docker) allow all values supported by the Docker daemon. | | **pids\_limit** integer | | Set PIDs limit for the container. It accepts an integer value. Set `-1` for unlimited PIDs. | | **privileged** boolean | **Choices:*** no * yes | Give extended privileges to the container. If *container\_default\_behavior* is set to `compatiblity` (the default value), this option has a default of `no`. | | **publish\_all\_ports** boolean added in 1.8.0 of community.docker | **Choices:*** no * yes | Publish all ports to the host. Any specified port bindings from *published\_ports* will remain intact when `true`. | | **published\_ports** list / elements=string | | List of ports to publish from the container to the host. Use docker CLI syntax: `8000`, `9000:8000`, or `0.0.0.0:9000:8000`, where 8000 is a container port, 9000 is a host port, and 0.0.0.0 is a host interface. Port ranges can be used for source and destination ports. If two ranges with different lengths are specified, the shorter range will be used. Since community.general 0.2.0, if the source port range has length 1, the port will not be assigned to the first port of the destination range, but to a free port in that range. This is the same behavior as for `docker` command line utility. Bind addresses must be either IPv4 or IPv6 addresses. Hostnames are \*not\* allowed. This is different from the `docker` command line utility. Use the [dig lookup](../lookup/dig) to resolve hostnames. A value of `all` will publish all exposed container ports to random host ports, ignoring any other mappings. Use *publish\_all\_ports* instead as the use of `all` will be deprecated in version 2.0.0. If *networks* parameter is provided, will inspect each network to see if there exists a bridge network with optional parameter `com.docker.network.bridge.host_binding_ipv4`. If such a network is found, then published ports where no host IP address is specified will be bound to the host IP pointed to by `com.docker.network.bridge.host_binding_ipv4`. Note that the first bridge network with a `com.docker.network.bridge.host_binding_ipv4` value encountered in the list of *networks* is the one that will be used. aliases: ports | | **pull** boolean | **Choices:*** **no** ← * yes | If true, always pull the latest version of an image. Otherwise, will only pull an image when missing. \*Note:\* images are only pulled when specified by name. If the image is specified as a image ID (hash), it cannot be pulled. | | **purge\_networks** boolean | **Choices:*** **no** ← * yes | Remove the container from ALL networks not included in *networks* parameter. Any default networks such as `bridge`, if not found in *networks*, will be removed as well. | | **read\_only** boolean | **Choices:*** no * yes | Mount the container's root file system as read-only. If *container\_default\_behavior* is set to `compatiblity` (the default value), this option has a default of `no`. | | **recreate** boolean | **Choices:*** **no** ← * yes | Use with present and started states to force the re-creation of an existing container. | | **removal\_wait\_timeout** float | | When removing an existing container, the docker daemon API call exists after the container is scheduled for removal. Removal usually is very fast, but it can happen that during high I/O load, removal can take longer. By default, the module will wait until the container has been removed before trying to (re-)create it, however long this takes. By setting this option, the module will wait at most this many seconds for the container to be removed. If the container is still in the removal phase after this many seconds, the module will fail. | | **restart** boolean | **Choices:*** **no** ← * yes | Use with started state to force a matching container to be stopped and restarted. | | **restart\_policy** string | **Choices:*** no * on-failure * always * unless-stopped | Container restart policy. Place quotes around `no` option. | | **restart\_retries** integer | | Use with restart policy to control maximum number of restart attempts. | | **runtime** string | | Runtime to use for the container. | | **security\_opts** list / elements=string | | List of security options in the form of `"label:user:User"`. | | **shm\_size** string | | Size of `/dev/shm` in format `<number>[<unit>]`. Number is positive integer. Unit can be `B` (byte), `K` (kibibyte, 1024B), `M` (mebibyte), `G` (gibibyte), `T` (tebibyte), or `P` (pebibyte). Omitting the unit defaults to bytes. If you omit the size entirely, Docker daemon uses `64M`. | | **ssl\_version** string | | Provide a valid SSL version number. Default value determined by ssl.py module. If the value is not specified in the task, the value of environment variable `DOCKER_SSL_VERSION` will be used instead. | | **state** string | **Choices:*** absent * present * stopped * **started** ← | `absent` - A container matching the specified name will be stopped and removed. Use *force\_kill* to kill the container rather than stopping it. Use *keep\_volumes* to retain anonymous volumes associated with the removed container. `present` - Asserts the existence of a container matching the name and any provided configuration parameters. If no container matches the name, a container will be created. If a container matches the name but the provided configuration does not match, the container will be updated, if it can be. If it cannot be updated, it will be removed and re-created with the requested config. `started` - Asserts that the container is first `present`, and then if the container is not running moves it to a running state. Use *restart* to force a matching container to be stopped and restarted. `stopped` - Asserts that the container is first `present`, and then if the container is running moves it to a stopped state. To control what will be taken into account when comparing configuration, see the *comparisons* option. To avoid that the image version will be taken into account, you can also use the *ignore\_image* option. Use the *recreate* option to always force re-creation of a matching container, even if it is running. If the container should be killed instead of stopped in case it needs to be stopped for recreation, or because *state* is `stopped`, please use the *force\_kill* option. Use *keep\_volumes* to retain anonymous volumes associated with a removed container. Use *keep\_volumes* to retain anonymous volumes associated with a removed container. | | **stop\_signal** string | | Override default signal used to stop the container. | | **stop\_timeout** integer | | Number of seconds to wait for the container to stop before sending `SIGKILL`. When the container is created by this module, its `StopTimeout` configuration will be set to this value. When the container is stopped, will be used as a timeout for stopping the container. In case the container has a custom `StopTimeout` configuration, the behavior depends on the version of the docker daemon. New versions of the docker daemon will always use the container's configured `StopTimeout` value if it has been configured. | | **storage\_opts** dictionary added in 1.3.0 of community.docker | | Storage driver options for this container as a key-value mapping. | | **sysctls** dictionary | | Dictionary of key,value pairs. | | **timeout** integer | **Default:**60 | The maximum amount of time in seconds to wait on a response from the API. If the value is not specified in the task, the value of environment variable `DOCKER_TIMEOUT` will be used instead. If the environment variable is not set, the default value will be used. | | **tls** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS without verifying the authenticity of the Docker host server. Note that if *validate\_certs* is set to `yes` as well, it will take precedence. If the value is not specified in the task, the value of environment variable `DOCKER_TLS` will be used instead. If the environment variable is not set, the default value will be used. | | **tls\_hostname** string | | When verifying the authenticity of the Docker Host server, provide the expected name of the server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_HOSTNAME` will be used instead. If the environment variable is not set, the default value will be used. The current default value is `localhost`. This default is deprecated and will change in community.docker 2.0.0 to be a value computed from *docker\_host*. Explicitly specify `localhost` to make sure this value will still be used, and to disable the deprecation message which will be shown otherwise. | | **tmpfs** list / elements=string | | Mount a tmpfs directory. | | **tty** boolean | **Choices:*** no * yes | Allocate a pseudo-TTY. If *container\_default\_behavior* is set to `compatiblity` (the default value), this option has a default of `no`. | | **ulimits** list / elements=string | | List of ulimit options. A ulimit is specified as `nofile:262144:262144`. | | **use\_ssh\_client** boolean added in 1.5.0 of community.docker | **Choices:*** **no** ← * yes | For SSH transports, use the `ssh` CLI tool instead of paramiko. Requires Docker SDK for Python 4.4.0 or newer. | | **user** string | | Sets the username or UID used and optionally the groupname or GID for the specified command. Can be of the forms `user`, `user:group`, `uid`, `uid:gid`, `user:gid` or `uid:group`. | | **userns\_mode** string | | Set the user namespace mode for the container. Currently, the only valid value are `host` and the empty string. | | **uts** string | | Set the UTS namespace mode for the container. | | **validate\_certs** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS and verifying the authenticity of the Docker host server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_VERIFY` will be used instead. If the environment variable is not set, the default value will be used. aliases: tls\_verify | | **volume\_driver** string | | The container volume driver. | | **volumes** list / elements=string | | List of volumes to mount within the container. Use docker CLI-style syntax: `/host:/container[:mode]` Mount modes can be a comma-separated list of various modes such as `ro`, `rw`, `consistent`, `delegated`, `cached`, `rprivate`, `private`, `rshared`, `shared`, `rslave`, `slave`, and `nocopy`. Note that the docker daemon might not support all modes and combinations of such modes. SELinux hosts can additionally use `z` or `Z` to use a shared or private label for the volume. Note that Ansible 2.7 and earlier only supported one mode, which had to be one of `ro`, `rw`, `z`, and `Z`. | | **volumes\_from** list / elements=string | | List of container names or IDs to get volumes from. | | **working\_dir** string | | Path to the working directory. | Notes ----- Note * For most config changes, the container needs to be recreated, i.e. the existing container has to be destroyed and a new one created. This can cause unexpected data loss and downtime. You can use the *comparisons* option to prevent this. * If the module needs to recreate the container, it will only use the options provided to the module to create the new container (except *image*). Therefore, always specify *all* options relevant to the container. * When *restart* is set to `true`, the module will only restart the container if no config changes are detected. Please note that several options have default values; if the container to be restarted uses different values for these options, it will be recreated instead. The options with default values which can cause this are *auto\_remove*, *detach*, *init*, *interactive*, *memory*, *paused*, *privileged*, *read\_only* and *tty*. This behavior can be changed by setting *container\_default\_behavior* to `no_defaults`, which will be the default value from community.docker 2.0.0 on. * Connect to the Docker daemon by providing parameters with each task or by defining environment variables. You can define `DOCKER_HOST`, `DOCKER_TLS_HOSTNAME`, `DOCKER_API_VERSION`, `DOCKER_CERT_PATH`, `DOCKER_SSL_VERSION`, `DOCKER_TLS`, `DOCKER_TLS_VERIFY` and `DOCKER_TIMEOUT`. If you are using docker machine, run the script shipped with the product that sets up the environment. It will set these variables for you. See <https://docs.docker.com/machine/reference/env/> for more details. * When connecting to Docker daemon with TLS, you might need to install additional Python packages. For the Docker SDK for Python, version 2.4 or newer, this can be done by installing `docker[tls]` with [ansible.builtin.pip](../../ansible/builtin/pip_module#ansible-collections-ansible-builtin-pip-module). * Note that the Docker SDK for Python only allows to specify the path to the Docker configuration for very few functions. In general, it will use `$HOME/.docker/config.json` if the `DOCKER_CONFIG` environment variable is not specified, and use `$DOCKER_CONFIG/config.json` otherwise. * This module uses the [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) to communicate with the Docker daemon. Examples -------- ``` - name: Create a data container community.docker.docker_container: name: mydata image: busybox volumes: - /data - name: Re-create a redis container community.docker.docker_container: name: myredis image: redis command: redis-server --appendonly yes state: present recreate: yes exposed_ports: - 6379 volumes_from: - mydata - name: Restart a container community.docker.docker_container: name: myapplication image: someuser/appimage state: started restart: yes links: - "myredis:aliasedredis" devices: - "/dev/sda:/dev/xvda:rwm" ports: # Publish container port 9000 as host port 8080 - "8080:9000" # Publish container UDP port 9001 as host port 8081 on interface 127.0.0.1 - "127.0.0.1:8081:9001/udp" # Publish container port 9002 as a random host port - "9002" # Publish container port 9003 as a free host port in range 8000-8100 # (the host port will be selected by the Docker daemon) - "8000-8100:9003" # Publish container ports 9010-9020 to host ports 7000-7010 - "7000-7010:9010-9020" env: SECRET_KEY: "ssssh" # Values which might be parsed as numbers, booleans or other types by the YAML parser need to be quoted BOOLEAN_KEY: "yes" - name: Container present community.docker.docker_container: name: mycontainer state: present image: ubuntu:14.04 command: sleep infinity - name: Stop a container community.docker.docker_container: name: mycontainer state: stopped - name: Start 4 load-balanced containers community.docker.docker_container: name: "container{{ item }}" recreate: yes image: someuser/anotherappimage command: sleep 1d with_sequence: count=4 - name: Remove container community.docker.docker_container: name: ohno state: absent - name: Syslogging output community.docker.docker_container: name: myservice image: busybox log_driver: syslog log_options: syslog-address: tcp://my-syslog-server:514 syslog-facility: daemon # NOTE: in Docker 1.13+ the "syslog-tag" option was renamed to "tag" for # older docker installs, use "syslog-tag" instead tag: myservice - name: Create db container and connect to network community.docker.docker_container: name: db_test image: "postgres:latest" networks: - name: "{{ docker_network_name }}" - name: Start container, connect to network and link community.docker.docker_container: name: sleeper image: ubuntu:14.04 networks: - name: TestingNet ipv4_address: "172.16.1.100" aliases: - sleepyzz links: - db_test:db - name: TestingNet2 - name: Start a container with a command community.docker.docker_container: name: sleepy image: ubuntu:14.04 command: ["sleep", "infinity"] - name: Add container to networks community.docker.docker_container: name: sleepy networks: - name: TestingNet ipv4_address: 172.16.1.18 links: - sleeper - name: TestingNet2 ipv4_address: 172.16.10.20 - name: Update network with aliases community.docker.docker_container: name: sleepy networks: - name: TestingNet aliases: - sleepyz - zzzz - name: Remove container from one network community.docker.docker_container: name: sleepy networks: - name: TestingNet2 purge_networks: yes - name: Remove container from all networks community.docker.docker_container: name: sleepy purge_networks: yes - name: Start a container and use an env file community.docker.docker_container: name: agent image: jenkinsci/ssh-slave env_file: /var/tmp/jenkins/agent.env - name: Create a container with limited capabilities community.docker.docker_container: name: sleepy image: ubuntu:16.04 command: sleep infinity capabilities: - sys_time cap_drop: - all - name: Finer container restart/update control community.docker.docker_container: name: test image: ubuntu:18.04 env: arg1: "true" arg2: "whatever" volumes: - /tmp:/tmp comparisons: image: ignore # don't restart containers with older versions of the image env: strict # we want precisely this environment volumes: allow_more_present # if there are more volumes, that's ok, as long as `/tmp:/tmp` is there - name: Finer container restart/update control II community.docker.docker_container: name: test image: ubuntu:18.04 env: arg1: "true" arg2: "whatever" comparisons: '*': ignore # by default, ignore *all* options (including image) env: strict # except for environment variables; there, we want to be strict - name: Start container with healthstatus community.docker.docker_container: name: nginx-proxy image: nginx:1.13 state: started healthcheck: # Check if nginx server is healthy by curl'ing the server. # If this fails or timeouts, the healthcheck fails. test: ["CMD", "curl", "--fail", "http://nginx.host.com"] interval: 1m30s timeout: 10s retries: 3 start_period: 30s - name: Remove healthcheck from container community.docker.docker_container: name: nginx-proxy image: nginx:1.13 state: started healthcheck: # The "NONE" check needs to be specified test: ["NONE"] - name: Start container with block device read limit community.docker.docker_container: name: test image: ubuntu:18.04 state: started device_read_bps: # Limit read rate for /dev/sda to 20 mebibytes per second - path: /dev/sda rate: 20M device_read_iops: # Limit read rate for /dev/sdb to 300 IO per second - path: /dev/sdb rate: 300 - name: Start container with GPUs community.docker.docker_container: name: test image: ubuntu:18.04 state: started device_requests: - # Add some specific devices to this container device_ids: - '0' - 'GPU-3a23c669-1f69-c64e-cf85-44e9b07e7a2a' - # Add nVidia GPUs to this container driver: nvidia count: -1 # this means we want all capabilities: # We have one OR condition: 'gpu' AND 'utility' - - gpu - utility # See https://github.com/NVIDIA/nvidia-container-runtime#supported-driver-capabilities # for a list of capabilities supported by the nvidia driver - name: Start container with storage options community.docker.docker_container: name: test image: ubuntu:18.04 state: started storage_opts: # Limit root filesystem to 12 MB - note that this requires special storage backends # (https://fabianlee.org/2020/01/15/docker-use-overlay2-with-an-xfs-backing-filesystem-to-limit-rootfs-size/) size: 12m ``` 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** dictionary | success; or when *state=started* and *detach=false*, and when waiting for the container result did not fail | Facts representing the current state of the container. Matches the docker inspection output. Empty if *state* is `absent`. If *detach=false*, will include `Output` attribute containing any output from container run. **Sample:** { "AppArmorProfile": "", "Args": [], "Config": { "AttachStderr": false, "AttachStdin": false, "AttachStdout": false, "Cmd": [ "/usr/bin/supervisord" ], "Domainname": "", "Entrypoint": null, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ], "ExposedPorts": { "443/tcp": {}, "80/tcp": {} }, "Hostname": "8e47bf643eb9", "Image": "lnmp\_nginx:v1", "Labels": {}, "OnBuild": null, "OpenStdin": false, "StdinOnce": false, "Tty": false, "User": "", "Volumes": { "/tmp/lnmp/nginx-sites/logs/": {} }, ... } | | **status** integer | when *state=started* and *detach=false*, and when waiting for the container result did not fail | In case a container is started without detaching, this contains the exit code of the process in the container. Before community.docker 1.1.0, this was only returned when non-zero. | ### Authors * Cove Schneider (@cove) * Joshua Conner (@joshuaconner) * Pavel Antonov (@softzilla) * Thomas Steinbach (@ThomasSteinbach) * Philippe Jandot (@zfil) * Daan Oosterveld (@dusdanig) * Chris Houseknecht (@chouseknecht) * Kassian Sun (@kassiansun) * Felix Fontein (@felixfontein)
programming_docs
ansible community.docker.docker_volume – Manage Docker volumes community.docker.docker\_volume – Manage Docker volumes ======================================================= Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_volume`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Create/remove Docker volumes. * Performs largely the same function as the “docker volume” CLI subcommand. Requirements ------------ The below requirements are needed on the host that executes this module. * Docker SDK for Python: Please note that the [docker-py](https://pypi.org/project/docker-py/) Python module has been superseded by [docker](https://pypi.org/project/docker/) (see [here](https://github.com/docker/docker-py/issues/1310) for details). For Python 2.6, `docker-py` must be used. Otherwise, it is recommended to install the `docker` Python module. Note that both modules should *not* be installed at the same time. Also note that when both modules are installed and one of them is uninstalled, the other might no longer function and a reinstall of it is required. * [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) >= 1.10.0 (use [docker-py](https://pypi.org/project/docker-py/) for Python 2.6) * The docker server >= 1.9.0 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **api\_version** string | **Default:**"auto" | The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported by Docker SDK for Python and the docker daemon. If the value is not specified in the task, the value of environment variable `DOCKER_API_VERSION` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_api\_version | | **ca\_cert** path | | Use a CA certificate when performing server verification by providing the path to a CA certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `ca.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_ca\_cert, cacert\_path | | **client\_cert** path | | Path to the client's TLS certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `cert.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_cert, cert\_path | | **client\_key** path | | Path to the client's TLS key file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `key.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_key, key\_path | | **debug** boolean | **Choices:*** **no** ← * yes | Debug mode | | **docker\_host** string | **Default:**"unix://var/run/docker.sock" | The URL or Unix socket path used to connect to the Docker API. To connect to a remote host, provide the TCP connection string. For example, `tcp://192.0.2.23:2376`. If TLS is used to encrypt the connection, the module will automatically replace `tcp` in the connection URL with `https`. If the value is not specified in the task, the value of environment variable `DOCKER_HOST` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_url | | **driver** string | **Default:**"local" | Specify the type of volume. Docker provides the `local` driver, but 3rd party drivers can also be used. | | **driver\_options** dictionary | | Dictionary of volume settings. Consult docker docs for valid options and values: <https://docs.docker.com/engine/reference/commandline/volume_create/#driver-specific-options> | | **labels** dictionary | | Dictionary of label key/values to set for the volume | | **recreate** string | **Choices:*** always * **never** ← * options-changed | Controls when a volume will be recreated when *state* is `present`. Please note that recreating an existing volume will cause \*\*any data in the existing volume to be lost!\*\* The volume will be deleted and a new volume with the same name will be created. The value `always` forces the volume to be always recreated. The value `never` makes sure the volume will not be recreated. The value `options-changed` makes sure the volume will be recreated if the volume already exist and the driver, driver options or labels differ. | | **ssl\_version** string | | Provide a valid SSL version number. Default value determined by ssl.py module. If the value is not specified in the task, the value of environment variable `DOCKER_SSL_VERSION` will be used instead. | | **state** string | **Choices:*** absent * **present** ← | `absent` deletes the volume. `present` creates the volume, if it does not already exist. | | **timeout** integer | **Default:**60 | The maximum amount of time in seconds to wait on a response from the API. If the value is not specified in the task, the value of environment variable `DOCKER_TIMEOUT` will be used instead. If the environment variable is not set, the default value will be used. | | **tls** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS without verifying the authenticity of the Docker host server. Note that if *validate\_certs* is set to `yes` as well, it will take precedence. If the value is not specified in the task, the value of environment variable `DOCKER_TLS` will be used instead. If the environment variable is not set, the default value will be used. | | **tls\_hostname** string | | When verifying the authenticity of the Docker Host server, provide the expected name of the server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_HOSTNAME` will be used instead. If the environment variable is not set, the default value will be used. The current default value is `localhost`. This default is deprecated and will change in community.docker 2.0.0 to be a value computed from *docker\_host*. Explicitly specify `localhost` to make sure this value will still be used, and to disable the deprecation message which will be shown otherwise. | | **use\_ssh\_client** boolean added in 1.5.0 of community.docker | **Choices:*** **no** ← * yes | For SSH transports, use the `ssh` CLI tool instead of paramiko. Requires Docker SDK for Python 4.4.0 or newer. | | **validate\_certs** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS and verifying the authenticity of the Docker host server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_VERIFY` will be used instead. If the environment variable is not set, the default value will be used. aliases: tls\_verify | | **volume\_name** string / required | | Name of the volume to operate on. aliases: name | Notes ----- Note * Connect to the Docker daemon by providing parameters with each task or by defining environment variables. You can define `DOCKER_HOST`, `DOCKER_TLS_HOSTNAME`, `DOCKER_API_VERSION`, `DOCKER_CERT_PATH`, `DOCKER_SSL_VERSION`, `DOCKER_TLS`, `DOCKER_TLS_VERIFY` and `DOCKER_TIMEOUT`. If you are using docker machine, run the script shipped with the product that sets up the environment. It will set these variables for you. See <https://docs.docker.com/machine/reference/env/> for more details. * When connecting to Docker daemon with TLS, you might need to install additional Python packages. For the Docker SDK for Python, version 2.4 or newer, this can be done by installing `docker[tls]` with [ansible.builtin.pip](../../ansible/builtin/pip_module#ansible-collections-ansible-builtin-pip-module). * Note that the Docker SDK for Python only allows to specify the path to the Docker configuration for very few functions. In general, it will use `$HOME/.docker/config.json` if the `DOCKER_CONFIG` environment variable is not specified, and use `$DOCKER_CONFIG/config.json` otherwise. * This module uses the [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) to communicate with the Docker daemon. Examples -------- ``` - name: Create a volume community.docker.docker_volume: name: volume_one - name: Remove a volume community.docker.docker_volume: name: volume_one state: absent - name: Create a volume with options community.docker.docker_volume: name: volume_two driver_options: type: btrfs device: /dev/sda2 ``` 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 | | --- | --- | --- | | **volume** dictionary | success | Volume inspection results for the affected volume. | ### Authors * Alex Grönholm (@agronholm) ansible community.docker.docker_stack_task_info – Return information of the tasks on a docker stack community.docker.docker\_stack\_task\_info – Return information of the tasks on a docker stack ============================================================================================== Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_stack_task_info`. * [Synopsis](#synopsis) * [Parameters](#parameters) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Retrieve information on docker stacks tasks using the `docker stack` command on the target node (see examples). Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **name** string / required | | Stack name. | Examples -------- ``` - name: Shows stack info community.docker.docker_stack_task_info: name: test_stack register: result - name: Show results ansible.builtin.debug: var: result.results ``` 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** list / elements=dictionary | always | List of dictionaries containing the list of tasks associated to a stack name. **Sample:** [{"CurrentState":"Running","DesiredState":"Running","Error":"","ID":"7wqv6m02ugkw","Image":"busybox","Name":"test\_stack.1","Node":"swarm","Ports":""}] | ### Authors * Jose Angel Munoz (@imjoseangel) ansible community.docker.docker_swarm_service – docker swarm service community.docker.docker\_swarm\_service – docker swarm service ============================================================== Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_swarm_service`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Manages docker services via a swarm manager node. Requirements ------------ The below requirements are needed on the host that executes this module. * Docker API >= 1.24 * Docker SDK for Python: Please note that the [docker-py](https://pypi.org/project/docker-py/) Python module has been superseded by [docker](https://pypi.org/project/docker/) (see [here](https://github.com/docker/docker-py/issues/1310) for details). This module does *not* work with docker-py. * [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) >= 2.0.2 * Python >= 2.7 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **api\_version** string | **Default:**"auto" | The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported by Docker SDK for Python and the docker daemon. If the value is not specified in the task, the value of environment variable `DOCKER_API_VERSION` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_api\_version | | **args** list / elements=string | | List arguments to be passed to the container. Corresponds to the `ARG` parameter of `docker service create`. | | **ca\_cert** path | | Use a CA certificate when performing server verification by providing the path to a CA certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `ca.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_ca\_cert, cacert\_path | | **client\_cert** path | | Path to the client's TLS certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `cert.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_cert, cert\_path | | **client\_key** path | | Path to the client's TLS key file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `key.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_key, key\_path | | **command** raw | | Command to execute when the container starts. A command may be either a string or a list or a list of strings. Corresponds to the `COMMAND` parameter of `docker service create`. | | **configs** list / elements=dictionary | | List of dictionaries describing the service configs. Corresponds to the `--config` option of `docker service create`. Requires API version >= 1.30. | | | **config\_id** string | | Config's ID. | | | **config\_name** string / required | | Config's name as defined at its creation. | | | **filename** string | | Name of the file containing the config. Defaults to the *config\_name* if not specified. | | | **gid** string | | GID of the config file's group. | | | **mode** integer | | File access mode inside the container. Must be an octal number (like `0644` or `0444`). | | | **uid** string | | UID of the config file's owner. | | **container\_labels** dictionary | | Dictionary of key value pairs. Corresponds to the `--container-label` option of `docker service create`. | | **debug** boolean | **Choices:*** **no** ← * yes | Debug mode | | **dns** list / elements=string | | List of custom DNS servers. Corresponds to the `--dns` option of `docker service create`. Requires API version >= 1.25. | | **dns\_options** list / elements=string | | List of custom DNS options. Corresponds to the `--dns-option` option of `docker service create`. Requires API version >= 1.25. | | **dns\_search** list / elements=string | | List of custom DNS search domains. Corresponds to the `--dns-search` option of `docker service create`. Requires API version >= 1.25. | | **docker\_host** string | **Default:**"unix://var/run/docker.sock" | The URL or Unix socket path used to connect to the Docker API. To connect to a remote host, provide the TCP connection string. For example, `tcp://192.0.2.23:2376`. If TLS is used to encrypt the connection, the module will automatically replace `tcp` in the connection URL with `https`. If the value is not specified in the task, the value of environment variable `DOCKER_HOST` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_url | | **endpoint\_mode** string | **Choices:*** vip * dnsrr | Service endpoint mode. Corresponds to the `--endpoint-mode` option of `docker service create`. Requires API version >= 1.25. | | **env** raw | | List or dictionary of the service environment variables. If passed a list each items need to be in the format of `KEY=VALUE`. If passed a dictionary values which might be parsed as numbers, booleans or other types by the YAML parser must be quoted (e.g. `"true"`) in order to avoid data loss. Corresponds to the `--env` option of `docker service create`. | | **env\_files** list / elements=path | | List of paths to files, present on the target, containing environment variables `FOO=BAR`. The order of the list is significant in determining the value assigned to a variable that shows up more than once. If variable also present in *env*, then *env* value will override. | | **force\_update** boolean | **Choices:*** **no** ← * yes | Force update even if no changes require it. Corresponds to the `--force` option of `docker service update`. Requires API version >= 1.25. | | **groups** list / elements=string | | List of additional group names and/or IDs that the container process will run as. Corresponds to the `--group` option of `docker service update`. Requires API version >= 1.25. | | **healthcheck** dictionary | | Configure a check that is run to determine whether or not containers for this service are "healthy". See the docs for the [HEALTHCHECK Dockerfile instruction](https://docs.docker.com/engine/reference/builder/#healthcheck) for details on how healthchecks work. *interval*, *timeout* and *start\_period* are specified as durations. They accept duration as a string in a format that look like: `5h34m56s`, `1m30s` etc. The supported units are `us`, `ms`, `s`, `m` and `h`. Requires API version >= 1.25. | | | **interval** string | | Time between running the check. | | | **retries** integer | | Consecutive failures needed to report unhealthy. It accept integer value. | | | **start\_period** string | | Start period for the container to initialize before starting health-retries countdown. | | | **test** raw | | Command to run to check health. Must be either a string or a list. If it is a list, the first item must be one of `NONE`, `CMD` or `CMD-SHELL`. | | | **timeout** string | | Maximum time to allow one check to run. | | **hostname** string | | Container hostname. Corresponds to the `--hostname` option of `docker service create`. Requires API version >= 1.25. | | **hosts** dictionary | | Dict of host-to-IP mappings, where each host name is a key in the dictionary. Each host name will be added to the container's /etc/hosts file. Corresponds to the `--host` option of `docker service create`. Requires API version >= 1.25. | | **image** string | | Service image path and tag. Corresponds to the `IMAGE` parameter of `docker service create`. | | **init** boolean | **Choices:*** no * yes | Use an init inside each service container to forward signals and reap processes. Corresponds to the `--init` option of `docker service create`. Requires API version >= 1.37. | | **labels** dictionary | | Dictionary of key value pairs. Corresponds to the `--label` option of `docker service create`. | | **limits** dictionary | | Configures service resource limits. | | | **cpus** float | | Service CPU limit. `0` equals no limit. Corresponds to the `--limit-cpu` option of `docker service create`. | | | **memory** string | | Service memory limit in format `<number>[<unit>]`. Number is a positive integer. Unit can be `B` (byte), `K` (kibibyte, 1024B), `M` (mebibyte), `G` (gibibyte), `T` (tebibyte), or `P` (pebibyte). `0` equals no limit. Omitting the unit defaults to bytes. Corresponds to the `--limit-memory` option of `docker service create`. | | **logging** dictionary | | Logging configuration for the service. | | | **driver** string | | Configure the logging driver for a service. Corresponds to the `--log-driver` option of `docker service create`. | | | **options** dictionary | | Options for service logging driver. Corresponds to the `--log-opt` option of `docker service create`. | | **mode** string | **Choices:*** **replicated** ← * global | Service replication mode. Service will be removed and recreated when changed. Corresponds to the `--mode` option of `docker service create`. | | **mounts** list / elements=dictionary | | List of dictionaries describing the service mounts. Corresponds to the `--mount` option of `docker service create`. | | | **driver\_config** dictionary | | Volume driver configuration. Can only be used when *type* is `volume`. | | | | **name** string | | Name of the volume-driver plugin to use for the volume. | | | | **options** dictionary | | Options as key-value pairs to pass to the driver for this volume. | | | **labels** dictionary | | Volume labels to apply. | | | **no\_copy** boolean | **Choices:*** no * yes | Disable copying of data from a container when a volume is created. Can only be used when *type* is `volume`. | | | **propagation** string | **Choices:*** shared * slave * private * rshared * rslave * rprivate | The propagation mode to use. Can only be used when *type* is `bind`. | | | **readonly** boolean | **Choices:*** no * yes | Whether the mount should be read-only. | | | **source** string | | Mount source (e.g. a volume name or a host path). Must be specified if *type* is not `tmpfs`. | | | **target** string / required | | Container path. | | | **tmpfs\_mode** integer | | File mode of the tmpfs in octal. Can only be used when *type* is `tmpfs`. | | | **tmpfs\_size** string | | Size of the tmpfs mount in format `<number>[<unit>]`. Number is a positive integer. Unit can be `B` (byte), `K` (kibibyte, 1024B), `M` (mebibyte), `G` (gibibyte), `T` (tebibyte), or `P` (pebibyte). Can only be used when *type* is `tmpfs`. | | | **type** string | **Choices:*** **bind** ← * volume * tmpfs * npipe | The mount type. Note that `npipe` is only supported by Docker for Windows. Also note that `npipe` was added in Ansible 2.9. | | **name** string / required | | Service name. Corresponds to the `--name` option of `docker service create`. | | **networks** list / elements=raw | | List of the service networks names or dictionaries. When passed dictionaries valid sub-options are *name*, which is required, and *aliases* and *options*. Prior to API version 1.29, updating and removing networks is not supported. If changes are made the service will then be removed and recreated. Corresponds to the `--network` option of `docker service create`. | | **placement** dictionary | | Configures service placement preferences and constraints. | | | **constraints** list / elements=string | | List of the service constraints. Corresponds to the `--constraint` option of `docker service create`. | | | **preferences** list / elements=dictionary | | List of the placement preferences as key value pairs. Corresponds to the `--placement-pref` option of `docker service create`. Requires API version >= 1.27. | | | **replicas\_max\_per\_node** integer added in 1.3.0 of community.docker | | Maximum number of tasks per node. Corresponds to the `--replicas_max_per_node` option of `docker service create`. Requires API version >= 1.40 | | **publish** list / elements=dictionary | | List of dictionaries describing the service published ports. Corresponds to the `--publish` option of `docker service create`. Requires API version >= 1.25. | | | **mode** string | **Choices:*** ingress * host | What publish mode to use. Requires API version >= 1.32. | | | **protocol** string | **Choices:*** **tcp** ← * udp | What protocol to use. | | | **published\_port** integer | | The port to make externally available. | | | **target\_port** integer / required | | The port inside the container to expose. | | **read\_only** boolean | **Choices:*** no * yes | Mount the containers root filesystem as read only. Corresponds to the `--read-only` option of `docker service create`. | | **replicas** integer | **Default:**-1 | Number of containers instantiated in the service. Valid only if *mode* is `replicated`. If set to `-1`, and service is not present, service replicas will be set to `1`. If set to `-1`, and service is present, service replicas will be unchanged. Corresponds to the `--replicas` option of `docker service create`. | | **reservations** dictionary | | Configures service resource reservations. | | | **cpus** float | | Service CPU reservation. `0` equals no reservation. Corresponds to the `--reserve-cpu` option of `docker service create`. | | | **memory** string | | Service memory reservation in format `<number>[<unit>]`. Number is a positive integer. Unit can be `B` (byte), `K` (kibibyte, 1024B), `M` (mebibyte), `G` (gibibyte), `T` (tebibyte), or `P` (pebibyte). `0` equals no reservation. Omitting the unit defaults to bytes. Corresponds to the `--reserve-memory` option of `docker service create`. | | **resolve\_image** boolean | **Choices:*** **no** ← * yes | If the current image digest should be resolved from registry and updated if changed. Requires API version >= 1.30. | | **restart\_config** dictionary | | Configures if and how to restart containers when they exit. | | | **condition** string | **Choices:*** none * on-failure * any | Restart condition of the service. Corresponds to the `--restart-condition` option of `docker service create`. | | | **delay** string | | Delay between restarts. Accepts a a string in a format that look like: `5h34m56s`, `1m30s` etc. The supported units are `us`, `ms`, `s`, `m` and `h`. Corresponds to the `--restart-delay` option of `docker service create`. | | | **max\_attempts** integer | | Maximum number of service restarts. Corresponds to the `--restart-condition` option of `docker service create`. | | | **window** string | | Restart policy evaluation window. Accepts a string in a format that look like: `5h34m56s`, `1m30s` etc. The supported units are `us`, `ms`, `s`, `m` and `h`. Corresponds to the `--restart-window` option of `docker service create`. | | **rollback\_config** dictionary | | Configures how the service should be rolled back in case of a failing update. | | | **delay** string | | Delay between task rollbacks. Accepts a string in a format that look like: `5h34m56s`, `1m30s` etc. The supported units are `us`, `ms`, `s`, `m` and `h`. Corresponds to the `--rollback-delay` option of `docker service create`. Requires API version >= 1.28. | | | **failure\_action** string | **Choices:*** continue * pause | Action to take in case of rollback failure. Corresponds to the `--rollback-failure-action` option of `docker service create`. Requires API version >= 1.28. | | | **max\_failure\_ratio** float | | Fraction of tasks that may fail during a rollback. Corresponds to the `--rollback-max-failure-ratio` option of `docker service create`. Requires API version >= 1.28. | | | **monitor** string | | Duration after each task rollback to monitor for failure. Accepts a string in a format that look like: `5h34m56s`, `1m30s` etc. The supported units are `us`, `ms`, `s`, `m` and `h`. Corresponds to the `--rollback-monitor` option of `docker service create`. Requires API version >= 1.28. | | | **order** string | | Specifies the order of operations during rollbacks. Corresponds to the `--rollback-order` option of `docker service create`. Requires API version >= 1.29. | | | **parallelism** integer | | The number of containers to rollback at a time. If set to 0, all containers rollback simultaneously. Corresponds to the `--rollback-parallelism` option of `docker service create`. Requires API version >= 1.28. | | **secrets** list / elements=dictionary | | List of dictionaries describing the service secrets. Corresponds to the `--secret` option of `docker service create`. Requires API version >= 1.25. | | | **filename** string | | Name of the file containing the secret. Defaults to the *secret\_name* if not specified. Corresponds to the `target` key of `docker service create --secret`. | | | **gid** string | | GID of the secret file's group. | | | **mode** integer | | File access mode inside the container. Must be an octal number (like `0644` or `0444`). | | | **secret\_id** string | | Secret's ID. | | | **secret\_name** string / required | | Secret's name as defined at its creation. | | | **uid** string | | UID of the secret file's owner. | | **ssl\_version** string | | Provide a valid SSL version number. Default value determined by ssl.py module. If the value is not specified in the task, the value of environment variable `DOCKER_SSL_VERSION` will be used instead. | | **state** string | **Choices:*** **present** ← * absent | `absent` - A service matching the specified name will be removed and have its tasks stopped. `present` - Asserts the existence of a service matching the name and provided configuration parameters. Unspecified configuration parameters will be set to docker defaults. | | **stop\_grace\_period** string | | Time to wait before force killing a container. Accepts a duration as a string in a format that look like: `5h34m56s`, `1m30s` etc. The supported units are `us`, `ms`, `s`, `m` and `h`. Corresponds to the `--stop-grace-period` option of `docker service create`. | | **stop\_signal** string | | Override default signal used to stop the container. Corresponds to the `--stop-signal` option of `docker service create`. | | **timeout** integer | **Default:**60 | The maximum amount of time in seconds to wait on a response from the API. If the value is not specified in the task, the value of environment variable `DOCKER_TIMEOUT` will be used instead. If the environment variable is not set, the default value will be used. | | **tls** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS without verifying the authenticity of the Docker host server. Note that if *validate\_certs* is set to `yes` as well, it will take precedence. If the value is not specified in the task, the value of environment variable `DOCKER_TLS` will be used instead. If the environment variable is not set, the default value will be used. | | **tls\_hostname** string | | When verifying the authenticity of the Docker Host server, provide the expected name of the server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_HOSTNAME` will be used instead. If the environment variable is not set, the default value will be used. The current default value is `localhost`. This default is deprecated and will change in community.docker 2.0.0 to be a value computed from *docker\_host*. Explicitly specify `localhost` to make sure this value will still be used, and to disable the deprecation message which will be shown otherwise. | | **tty** boolean | **Choices:*** no * yes | Allocate a pseudo-TTY. Corresponds to the `--tty` option of `docker service create`. Requires API version >= 1.25. | | **update\_config** dictionary | | Configures how the service should be updated. Useful for configuring rolling updates. | | | **delay** string | | Rolling update delay. Accepts a string in a format that look like: `5h34m56s`, `1m30s` etc. The supported units are `us`, `ms`, `s`, `m` and `h`. Corresponds to the `--update-delay` option of `docker service create`. | | | **failure\_action** string | **Choices:*** continue * pause * rollback | Action to take in case of container failure. Corresponds to the `--update-failure-action` option of `docker service create`. Usage of *rollback* requires API version >= 1.29. | | | **max\_failure\_ratio** float | | Fraction of tasks that may fail during an update before the failure action is invoked. Corresponds to the `--update-max-failure-ratio` option of `docker service create`. Requires API version >= 1.25. | | | **monitor** string | | Time to monitor updated tasks for failures. Accepts a string in a format that look like: `5h34m56s`, `1m30s` etc. The supported units are `us`, `ms`, `s`, `m` and `h`. Corresponds to the `--update-monitor` option of `docker service create`. Requires API version >= 1.25. | | | **order** string | | Specifies the order of operations when rolling out an updated task. Corresponds to the `--update-order` option of `docker service create`. Requires API version >= 1.29. | | | **parallelism** integer | | Rolling update parallelism. Corresponds to the `--update-parallelism` option of `docker service create`. | | **use\_ssh\_client** boolean added in 1.5.0 of community.docker | **Choices:*** **no** ← * yes | For SSH transports, use the `ssh` CLI tool instead of paramiko. Requires Docker SDK for Python 4.4.0 or newer. | | **user** string | | Sets the username or UID used for the specified command. Before Ansible 2.8, the default value for this option was `root`. The default has been removed so that the user defined in the image is used if no user is specified here. Corresponds to the `--user` option of `docker service create`. | | **validate\_certs** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS and verifying the authenticity of the Docker host server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_VERIFY` will be used instead. If the environment variable is not set, the default value will be used. aliases: tls\_verify | | **working\_dir** string | | Path to the working directory. Corresponds to the `--workdir` option of `docker service create`. | Notes ----- Note * Images will only resolve to the latest digest when using Docker API >= 1.30 and Docker SDK for Python >= 3.2.0. When using older versions use `force_update: true` to trigger the swarm to resolve a new image. * Connect to the Docker daemon by providing parameters with each task or by defining environment variables. You can define `DOCKER_HOST`, `DOCKER_TLS_HOSTNAME`, `DOCKER_API_VERSION`, `DOCKER_CERT_PATH`, `DOCKER_SSL_VERSION`, `DOCKER_TLS`, `DOCKER_TLS_VERIFY` and `DOCKER_TIMEOUT`. If you are using docker machine, run the script shipped with the product that sets up the environment. It will set these variables for you. See <https://docs.docker.com/machine/reference/env/> for more details. * When connecting to Docker daemon with TLS, you might need to install additional Python packages. For the Docker SDK for Python, version 2.4 or newer, this can be done by installing `docker[tls]` with [ansible.builtin.pip](../../ansible/builtin/pip_module#ansible-collections-ansible-builtin-pip-module). * Note that the Docker SDK for Python only allows to specify the path to the Docker configuration for very few functions. In general, it will use `$HOME/.docker/config.json` if the `DOCKER_CONFIG` environment variable is not specified, and use `$DOCKER_CONFIG/config.json` otherwise. * This module uses the [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) to communicate with the Docker daemon. Examples -------- ``` - name: Set command and arguments community.docker.docker_swarm_service: name: myservice image: alpine command: sleep args: - "3600" - name: Set a bind mount community.docker.docker_swarm_service: name: myservice image: alpine mounts: - source: /tmp/ target: /remote_tmp/ type: bind - name: Set service labels community.docker.docker_swarm_service: name: myservice image: alpine labels: com.example.description: "Accounting webapp" com.example.department: "Finance" - name: Set environment variables community.docker.docker_swarm_service: name: myservice image: alpine env: ENVVAR1: envvar1 ENVVAR2: envvar2 env_files: - envs/common.env - envs/apps/web.env - name: Set fluentd logging community.docker.docker_swarm_service: name: myservice image: alpine logging: driver: fluentd options: fluentd-address: "127.0.0.1:24224" fluentd-async-connect: "true" tag: myservice - name: Set restart policies community.docker.docker_swarm_service: name: myservice image: alpine restart_config: condition: on-failure delay: 5s max_attempts: 3 window: 120s - name: Set update config community.docker.docker_swarm_service: name: myservice image: alpine update_config: parallelism: 2 delay: 10s order: stop-first - name: Set rollback config community.docker.docker_swarm_service: name: myservice image: alpine update_config: failure_action: rollback rollback_config: parallelism: 2 delay: 10s order: stop-first - name: Set placement preferences community.docker.docker_swarm_service: name: myservice image: alpine:edge placement: preferences: - spread: node.labels.mylabel constraints: - node.role == manager - engine.labels.operatingsystem == ubuntu 14.04 replicas_max_per_node: 2 - name: Set configs community.docker.docker_swarm_service: name: myservice image: alpine:edge configs: - config_name: myconfig_name filename: "/tmp/config.txt" - name: Set networks community.docker.docker_swarm_service: name: myservice image: alpine:edge networks: - mynetwork - name: Set networks as a dictionary community.docker.docker_swarm_service: name: myservice image: alpine:edge networks: - name: "mynetwork" aliases: - "mynetwork_alias" options: foo: bar - name: Set secrets community.docker.docker_swarm_service: name: myservice image: alpine:edge secrets: - secret_name: mysecret_name filename: "/run/secrets/secret.txt" - name: Start service with healthcheck community.docker.docker_swarm_service: name: myservice image: nginx:1.13 healthcheck: # Check if nginx server is healthy by curl'ing the server. # If this fails or timeouts, the healthcheck fails. test: ["CMD", "curl", "--fail", "http://nginx.host.com"] interval: 1m30s timeout: 10s retries: 3 start_period: 30s - name: Configure service resources community.docker.docker_swarm_service: name: myservice image: alpine:edge reservations: cpus: 0.25 memory: 20M limits: cpus: 0.50 memory: 50M - name: Remove service community.docker.docker_swarm_service: name: myservice 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 | | --- | --- | --- | | **changes** list / elements=string | always | List of changed service attributes if a service has been altered, [] otherwise. **Sample:** ['container\_labels', 'replicas'] | | **rebuilt** boolean | always | True if the service has been recreated (removed and created) **Sample:** True | | **swarm\_service** dictionary | always | Dictionary of variables representing the current state of the service. Matches the module parameters format. Note that facts are not part of registered vars but accessible directly. Note that before Ansible 2.7.9, the return variable was documented as `ansible_swarm_service`, while the module actually returned a variable called `ansible_docker_service`. The variable was renamed to `swarm_service` in both code and documentation for Ansible 2.7.9 and Ansible 2.8.0. In Ansible 2.7.x, the old name `ansible_docker_service` can still be used. **Sample:** { "args": [ "3600" ], "command": [ "sleep" ], "configs": null, "constraints": [ "node.role == manager", "engine.labels.operatingsystem == ubuntu 14.04" ], "container\_labels": null, "dns": null, "dns\_options": null, "dns\_search": null, "endpoint\_mode": null, "env": [ "ENVVAR1=envvar1", "ENVVAR2=envvar2" ], "force\_update": null, "groups": null, "healthcheck": { "interval": 90000000000, "retries": 3, "start\_period": 30000000000, "test": [ "CMD", "curl", "--fail", "http://nginx.host.com" ], "timeout": 10000000000 }, "healthcheck\_disabled": false, "hostname": null, "hosts": null, "image": "alpine:latest@sha256:b3dbf31b77fd99d9c08f780ce6f5282aba076d70a513a8be859d8d3a4d0c92b8", "labels": { "com.example.department": "Finance", "com.example.description": "Accounting webapp" }, "limit\_cpu": 0.5, "limit\_memory": 52428800, "log\_driver": "fluentd", "log\_driver\_options": { "fluentd-address": "127.0.0.1:24224", "fluentd-async-connect": "true", "tag": "myservice" }, "mode": "replicated", "mounts": [ { "readonly": false, "source": "/tmp/", "target": "/remote\_tmp/", "type": "bind", "labels": null, "propagation": null, "no\_copy": null, "driver\_config": null, "tmpfs\_size": null, "tmpfs\_mode": null } ], "networks": null, "placement\_preferences": [ { "spread": "node.labels.mylabel" } ], "publish": null, "read\_only": null, "replicas": 1, "replicas\_max\_per\_node": 1, "reserve\_cpu": 0.25, "reserve\_memory": 20971520, "restart\_policy": "on-failure", "restart\_policy\_attempts": 3, "restart\_policy\_delay": 5000000000, "restart\_policy\_window": 120000000000, "secrets": null, "stop\_grace\_period": null, "stop\_signal": null, "tty": null, "update\_delay": 10000000000, "update\_failure\_action": null, "update\_max\_failure\_ratio": null, "update\_monitor": null, "update\_order": "stop-first", "update\_parallelism": 2, "user": null, "working\_dir": null } | ### Authors * Dario Zanzico (@dariko) * Jason Witkowski (@jwitko) * Hannes Ljungberg (@hannseman) * Piotr Wojciechowski (@wojciechowskipiotr)
programming_docs
ansible community.docker.docker_volume_info – Retrieve facts about Docker volumes community.docker.docker\_volume\_info – Retrieve facts about Docker volumes =========================================================================== Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_volume_info`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Performs largely the same function as the “docker volume inspect” CLI subcommand. Requirements ------------ The below requirements are needed on the host that executes this module. * Docker API >= 1.21 * Docker SDK for Python: Please note that the [docker-py](https://pypi.org/project/docker-py/) Python module has been superseded by [docker](https://pypi.org/project/docker/) (see [here](https://github.com/docker/docker-py/issues/1310) for details). For Python 2.6, `docker-py` must be used. Otherwise, it is recommended to install the `docker` Python module. Note that both modules should *not* be installed at the same time. Also note that when both modules are installed and one of them is uninstalled, the other might no longer function and a reinstall of it is required. * [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) >= 1.8.0 (use [docker-py](https://pypi.org/project/docker-py/) for Python 2.6) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **api\_version** string | **Default:**"auto" | The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported by Docker SDK for Python and the docker daemon. If the value is not specified in the task, the value of environment variable `DOCKER_API_VERSION` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_api\_version | | **ca\_cert** path | | Use a CA certificate when performing server verification by providing the path to a CA certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `ca.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_ca\_cert, cacert\_path | | **client\_cert** path | | Path to the client's TLS certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `cert.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_cert, cert\_path | | **client\_key** path | | Path to the client's TLS key file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `key.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_key, key\_path | | **debug** boolean | **Choices:*** **no** ← * yes | Debug mode | | **docker\_host** string | **Default:**"unix://var/run/docker.sock" | The URL or Unix socket path used to connect to the Docker API. To connect to a remote host, provide the TCP connection string. For example, `tcp://192.0.2.23:2376`. If TLS is used to encrypt the connection, the module will automatically replace `tcp` in the connection URL with `https`. If the value is not specified in the task, the value of environment variable `DOCKER_HOST` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_url | | **name** string / required | | Name of the volume to inspect. aliases: volume\_name | | **ssl\_version** string | | Provide a valid SSL version number. Default value determined by ssl.py module. If the value is not specified in the task, the value of environment variable `DOCKER_SSL_VERSION` will be used instead. | | **timeout** integer | **Default:**60 | The maximum amount of time in seconds to wait on a response from the API. If the value is not specified in the task, the value of environment variable `DOCKER_TIMEOUT` will be used instead. If the environment variable is not set, the default value will be used. | | **tls** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS without verifying the authenticity of the Docker host server. Note that if *validate\_certs* is set to `yes` as well, it will take precedence. If the value is not specified in the task, the value of environment variable `DOCKER_TLS` will be used instead. If the environment variable is not set, the default value will be used. | | **tls\_hostname** string | | When verifying the authenticity of the Docker Host server, provide the expected name of the server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_HOSTNAME` will be used instead. If the environment variable is not set, the default value will be used. The current default value is `localhost`. This default is deprecated and will change in community.docker 2.0.0 to be a value computed from *docker\_host*. Explicitly specify `localhost` to make sure this value will still be used, and to disable the deprecation message which will be shown otherwise. | | **use\_ssh\_client** boolean added in 1.5.0 of community.docker | **Choices:*** **no** ← * yes | For SSH transports, use the `ssh` CLI tool instead of paramiko. Requires Docker SDK for Python 4.4.0 or newer. | | **validate\_certs** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS and verifying the authenticity of the Docker host server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_VERIFY` will be used instead. If the environment variable is not set, the default value will be used. aliases: tls\_verify | Notes ----- Note * Connect to the Docker daemon by providing parameters with each task or by defining environment variables. You can define `DOCKER_HOST`, `DOCKER_TLS_HOSTNAME`, `DOCKER_API_VERSION`, `DOCKER_CERT_PATH`, `DOCKER_SSL_VERSION`, `DOCKER_TLS`, `DOCKER_TLS_VERIFY` and `DOCKER_TIMEOUT`. If you are using docker machine, run the script shipped with the product that sets up the environment. It will set these variables for you. See <https://docs.docker.com/machine/reference/env/> for more details. * When connecting to Docker daemon with TLS, you might need to install additional Python packages. For the Docker SDK for Python, version 2.4 or newer, this can be done by installing `docker[tls]` with [ansible.builtin.pip](../../ansible/builtin/pip_module#ansible-collections-ansible-builtin-pip-module). * Note that the Docker SDK for Python only allows to specify the path to the Docker configuration for very few functions. In general, it will use `$HOME/.docker/config.json` if the `DOCKER_CONFIG` environment variable is not specified, and use `$DOCKER_CONFIG/config.json` otherwise. * This module uses the [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) to communicate with the Docker daemon. Examples -------- ``` - name: Get infos on volume community.docker.docker_volume_info: name: mydata register: result - name: Does volume exist? ansible.builtin.debug: msg: "The volume {{ 'exists' if result.exists else 'does not exist' }}" - name: Print information about volume ansible.builtin.debug: var: result.volume when: result.exists ``` 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 | Returns whether the volume exists. **Sample:** True | | **volume** dictionary | success | Volume inspection results for the affected volume. Will be `none` if volume does not exist. **Sample:** { "CreatedAt": "2018-12-09T17:43:44+01:00", "Driver": "local", "Labels": null, "Mountpoint": "/var/lib/docker/volumes/ansible-test-bd3f6172/\_data", "Name": "ansible-test-bd3f6172", "Options": {}, "Scope": "local" } | ### Authors * Felix Fontein (@felixfontein) ansible community.docker.docker_machine – Docker Machine inventory source community.docker.docker\_machine – Docker Machine inventory source ================================================================== Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_machine`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Examples](#examples) Synopsis -------- * Get inventory hosts from Docker Machine. * Uses a YAML configuration file that ends with docker\_machine.(yml|yaml). * The plugin sets standard host variables `ansible_host`, `ansible_port`, `ansible_user` and `ansible_ssh_private_key`. * The plugin stores the Docker Machine ‘env’ output variables in *dm\_* prefixed host variables. Requirements ------------ The below requirements are needed on the local controller node that executes this inventory. * [Docker Machine](https://docs.docker.com/machine/) Parameters ---------- | Parameter | Choices/Defaults | Configuration | Comments | | --- | --- | --- | --- | | **compose** dictionary | **Default:**{} | | Create vars from jinja2 expressions. | | **daemon\_env** string | **Choices:*** **require** ← * require-silently * optional * optional-silently * skip | | Whether docker daemon connection environment variables should be fetched, and how to behave if they cannot be fetched. With `require` and `require-silently`, fetch them and skip any host for which they cannot be fetched. A warning will be issued for any skipped host if the choice is `require`. With `optional` and `optional-silently`, fetch them and not skip hosts for which they cannot be fetched. A warning will be issued for hosts where they cannot be fetched if the choice is `optional`. With `skip`, do not attempt to fetch the docker daemon connection environment variables. If fetched successfully, the variables will be prefixed with *dm\_* and stored as host variables. | | **groups** dictionary | **Default:**{} | | Add hosts to group based on Jinja2 conditionals. | | **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. | | **plugin** string / required | **Choices:*** docker\_machine * community.docker.docker\_machine | | token that ensures this is a source file for the `docker_machine` plugin. | | **running\_required** boolean | **Choices:*** no * **yes** ← | | when true, hosts which Docker Machine indicates are in a state other than `running` will be skipped. | | **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). | | **verbose\_output** boolean | **Choices:*** no * **yes** ← | | when true, include all available nodes metadata (e.g. Image, Region, Size) as a JSON object named `docker_machine_node_attributes`. | Examples -------- ``` # Minimal example plugin: community.docker.docker_machine # Example using constructed features to create a group per Docker Machine driver # (https://docs.docker.com/machine/drivers/), e.g.: # $ docker-machine create --driver digitalocean ... mymachine # $ ansible-inventory -i ./path/to/docker-machine.yml --host=mymachine # { # ... # "digitalocean": { # "hosts": [ # "mymachine" # ] # ... # } strict: no keyed_groups: - separator: '' key: docker_machine_node_attributes.DriverName # Example grouping hosts by Digital Machine tag strict: no keyed_groups: - prefix: tag key: 'dm_tags' # Example using compose to override the default SSH behaviour of asking the user to accept the remote host key compose: ansible_ssh_common_args: '"-o StrictHostKeyChecking=accept-new"' ``` ### Authors * Ximon Eighteen (@ximon18) ansible community.docker.docker_image_info – Inspect docker images community.docker.docker\_image\_info – Inspect docker images ============================================================ Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_image_info`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Provide one or more image names, and the module will inspect each, returning an array of inspection results. * If an image does not exist locally, it will not appear in the results. If you want to check whether an image exists locally, you can call the module with the image name, then check whether the result list is empty (image does not exist) or has one element (the image exists locally). * The module will not attempt to pull images from registries. Use [community.docker.docker\_image](docker_image_module#ansible-collections-community-docker-docker-image-module) with *source* set to `pull` to ensure an image is pulled. Requirements ------------ The below requirements are needed on the host that executes this module. * Docker API >= 1.20 * Docker SDK for Python: Please note that the [docker-py](https://pypi.org/project/docker-py/) Python module has been superseded by [docker](https://pypi.org/project/docker/) (see [here](https://github.com/docker/docker-py/issues/1310) for details). For Python 2.6, `docker-py` must be used. Otherwise, it is recommended to install the `docker` Python module. Note that both modules should *not* be installed at the same time. Also note that when both modules are installed and one of them is uninstalled, the other might no longer function and a reinstall of it is required. * [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) >= 1.8.0 (use [docker-py](https://pypi.org/project/docker-py/) for Python 2.6) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **api\_version** string | **Default:**"auto" | The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported by Docker SDK for Python and the docker daemon. If the value is not specified in the task, the value of environment variable `DOCKER_API_VERSION` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_api\_version | | **ca\_cert** path | | Use a CA certificate when performing server verification by providing the path to a CA certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `ca.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_ca\_cert, cacert\_path | | **client\_cert** path | | Path to the client's TLS certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `cert.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_cert, cert\_path | | **client\_key** path | | Path to the client's TLS key file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `key.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_key, key\_path | | **debug** boolean | **Choices:*** **no** ← * yes | Debug mode | | **docker\_host** string | **Default:**"unix://var/run/docker.sock" | The URL or Unix socket path used to connect to the Docker API. To connect to a remote host, provide the TCP connection string. For example, `tcp://192.0.2.23:2376`. If TLS is used to encrypt the connection, the module will automatically replace `tcp` in the connection URL with `https`. If the value is not specified in the task, the value of environment variable `DOCKER_HOST` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_url | | **name** list / elements=string | | An image name or a list of image names. Name format will be `name[:tag]` or `repository/name[:tag]`, where `tag` is optional. If a tag is not provided, `latest` will be used. Instead of image names, also image IDs can be used. If no name is provided, a list of all images will be returned. | | **ssl\_version** string | | Provide a valid SSL version number. Default value determined by ssl.py module. If the value is not specified in the task, the value of environment variable `DOCKER_SSL_VERSION` will be used instead. | | **timeout** integer | **Default:**60 | The maximum amount of time in seconds to wait on a response from the API. If the value is not specified in the task, the value of environment variable `DOCKER_TIMEOUT` will be used instead. If the environment variable is not set, the default value will be used. | | **tls** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS without verifying the authenticity of the Docker host server. Note that if *validate\_certs* is set to `yes` as well, it will take precedence. If the value is not specified in the task, the value of environment variable `DOCKER_TLS` will be used instead. If the environment variable is not set, the default value will be used. | | **tls\_hostname** string | | When verifying the authenticity of the Docker Host server, provide the expected name of the server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_HOSTNAME` will be used instead. If the environment variable is not set, the default value will be used. The current default value is `localhost`. This default is deprecated and will change in community.docker 2.0.0 to be a value computed from *docker\_host*. Explicitly specify `localhost` to make sure this value will still be used, and to disable the deprecation message which will be shown otherwise. | | **use\_ssh\_client** boolean added in 1.5.0 of community.docker | **Choices:*** **no** ← * yes | For SSH transports, use the `ssh` CLI tool instead of paramiko. Requires Docker SDK for Python 4.4.0 or newer. | | **validate\_certs** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS and verifying the authenticity of the Docker host server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_VERIFY` will be used instead. If the environment variable is not set, the default value will be used. aliases: tls\_verify | Notes ----- Note * This module was called `docker_image_facts` before Ansible 2.8. The usage did not change. * Connect to the Docker daemon by providing parameters with each task or by defining environment variables. You can define `DOCKER_HOST`, `DOCKER_TLS_HOSTNAME`, `DOCKER_API_VERSION`, `DOCKER_CERT_PATH`, `DOCKER_SSL_VERSION`, `DOCKER_TLS`, `DOCKER_TLS_VERIFY` and `DOCKER_TIMEOUT`. If you are using docker machine, run the script shipped with the product that sets up the environment. It will set these variables for you. See <https://docs.docker.com/machine/reference/env/> for more details. * When connecting to Docker daemon with TLS, you might need to install additional Python packages. For the Docker SDK for Python, version 2.4 or newer, this can be done by installing `docker[tls]` with [ansible.builtin.pip](../../ansible/builtin/pip_module#ansible-collections-ansible-builtin-pip-module). * Note that the Docker SDK for Python only allows to specify the path to the Docker configuration for very few functions. In general, it will use `$HOME/.docker/config.json` if the `DOCKER_CONFIG` environment variable is not specified, and use `$DOCKER_CONFIG/config.json` otherwise. * This module uses the [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) to communicate with the Docker daemon. Examples -------- ``` - name: Inspect a single image community.docker.docker_image_info: name: pacur/centos-7 - name: Inspect multiple images community.docker.docker_image_info: name: - pacur/centos-7 - sinatra register: result - name: Make sure that both images pacur/centos-7 and sinatra exist locally ansible.builtin.assert: that: - result.images | length == 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 | | --- | --- | --- | | **images** list / elements=dictionary | always | Inspection results for the selected images. The list only contains inspection results of images existing locally. **Sample:** [{'Architecture': 'amd64', 'Author': '', 'Comment': '', 'Config': {'AttachStderr': False, 'AttachStdin': False, 'AttachStdout': False, 'Cmd': ['/etc/docker/registry/config.yml'], 'Domainname': '', 'Entrypoint': ['/bin/registry'], 'Env': ['PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'], 'ExposedPorts': {'5000/tcp': {}}, 'Hostname': 'e5c68db50333', 'Image': 'c72dce2618dc8f7b794d2b2c2b1e64e0205ead5befc294f8111da23bd6a2c799', 'Labels': {}, 'OnBuild': [], 'OpenStdin': False, 'StdinOnce': False, 'Tty': False, 'User': '', 'Volumes': {'/var/lib/registry': {}}, 'WorkingDir': ''}, 'Container': 'e83a452b8fb89d78a25a6739457050131ca5c863629a47639530d9ad2008d610', 'ContainerConfig': {'AttachStderr': False, 'AttachStdin': False, 'AttachStdout': False, 'Cmd': ['/bin/sh', '-c', '#(nop) CMD ["/etc/docker/registry/config.yml"]'], 'Domainname': '', 'Entrypoint': ['/bin/registry'], 'Env': ['PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'], 'ExposedPorts': {'5000/tcp': {}}, 'Hostname': 'e5c68db50333', 'Image': 'c72dce2618dc8f7b794d2b2c2b1e64e0205ead5befc294f8111da23bd6a2c799', 'Labels': {}, 'OnBuild': [], 'OpenStdin': False, 'StdinOnce': False, 'Tty': False, 'User': '', 'Volumes': {'/var/lib/registry': {}}, 'WorkingDir': ''}, 'Created': '2016-03-08T21:08:15.399680378Z', 'DockerVersion': '1.9.1', 'GraphDriver': {'Data': None, 'Name': 'aufs'}, 'Id': '53773d8552f07b730f3e19979e32499519807d67b344141d965463a950a66e08', 'Name': 'registry:2', 'Os': 'linux', 'Parent': 'f0b1f729f784b755e7bf9c8c2e65d8a0a35a533769c2588f02895f6781ac0805', 'RepoDigests': [], 'RepoTags': ['registry:2'], 'Size': 0, 'VirtualSize': 165808884}] | ### Authors * Chris Houseknecht (@chouseknecht)
programming_docs
ansible community.docker.docker_host_info – Retrieves facts about docker host and lists of objects of the services. community.docker.docker\_host\_info – Retrieves facts about docker host and lists of objects of the services. ============================================================================================================= Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_host_info`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Retrieves facts about a docker host. * Essentially returns the output of `docker system info`. * The module also allows to list object names for containers, images, networks and volumes. It also allows to query information on disk usage. * The output differs depending on API version of the docker daemon. * If the docker daemon cannot be contacted or does not meet the API version requirements, the module will fail. Requirements ------------ The below requirements are needed on the host that executes this module. * Docker API >= 1.21 * Docker SDK for Python: Please note that the [docker-py](https://pypi.org/project/docker-py/) Python module has been superseded by [docker](https://pypi.org/project/docker/) (see [here](https://github.com/docker/docker-py/issues/1310) for details). For Python 2.6, `docker-py` must be used. Otherwise, it is recommended to install the `docker` Python module. Note that both modules should *not* be installed at the same time. Also note that when both modules are installed and one of them is uninstalled, the other might no longer function and a reinstall of it is required. * [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) >= 1.10.0 (use [docker-py](https://pypi.org/project/docker-py/) for Python 2.6) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **api\_version** string | **Default:**"auto" | The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported by Docker SDK for Python and the docker daemon. If the value is not specified in the task, the value of environment variable `DOCKER_API_VERSION` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_api\_version | | **ca\_cert** path | | Use a CA certificate when performing server verification by providing the path to a CA certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `ca.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_ca\_cert, cacert\_path | | **client\_cert** path | | Path to the client's TLS certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `cert.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_cert, cert\_path | | **client\_key** path | | Path to the client's TLS key file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `key.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_key, key\_path | | **containers** boolean | **Choices:*** **no** ← * yes | Whether to list containers. | | **containers\_filters** dictionary | | A dictionary of filter values used for selecting containers to list. For example, `until: 24h`. `label` is a special case of filter which can be a string `<key>` matching when a label is present, a string `<key>=<value>` matching when a label has a particular value, or a list of strings `<key>`/`<key>=<value`. See [the docker documentation](https://docs.docker.com/engine/reference/commandline/container_prune/#filtering) for more information on possible filters. | | **debug** boolean | **Choices:*** **no** ← * yes | Debug mode | | **disk\_usage** boolean | **Choices:*** **no** ← * yes | Summary information on used disk space by all Docker layers. The output is a sum of images, volumes, containers and build cache. | | **docker\_host** string | **Default:**"unix://var/run/docker.sock" | The URL or Unix socket path used to connect to the Docker API. To connect to a remote host, provide the TCP connection string. For example, `tcp://192.0.2.23:2376`. If TLS is used to encrypt the connection, the module will automatically replace `tcp` in the connection URL with `https`. If the value is not specified in the task, the value of environment variable `DOCKER_HOST` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_url | | **images** boolean | **Choices:*** **no** ← * yes | Whether to list images. | | **images\_filters** dictionary | | A dictionary of filter values used for selecting images to list. For example, `dangling: true`. `label` is a special case of filter which can be a string `<key>` matching when a label is present, a string `<key>=<value>` matching when a label has a particular value, or a list of strings `<key>`/`<key>=<value`. See [the docker documentation](https://docs.docker.com/engine/reference/commandline/image_prune/#filtering) for more information on possible filters. | | **networks** boolean | **Choices:*** **no** ← * yes | Whether to list networks. | | **networks\_filters** dictionary | | A dictionary of filter values used for selecting networks to list. `label` is a special case of filter which can be a string `<key>` matching when a label is present, a string `<key>=<value>` matching when a label has a particular value, or a list of strings `<key>`/`<key>=<value`. See [the docker documentation](https://docs.docker.com/engine/reference/commandline/network_prune/#filtering) for more information on possible filters. | | **ssl\_version** string | | Provide a valid SSL version number. Default value determined by ssl.py module. If the value is not specified in the task, the value of environment variable `DOCKER_SSL_VERSION` will be used instead. | | **timeout** integer | **Default:**60 | The maximum amount of time in seconds to wait on a response from the API. If the value is not specified in the task, the value of environment variable `DOCKER_TIMEOUT` will be used instead. If the environment variable is not set, the default value will be used. | | **tls** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS without verifying the authenticity of the Docker host server. Note that if *validate\_certs* is set to `yes` as well, it will take precedence. If the value is not specified in the task, the value of environment variable `DOCKER_TLS` will be used instead. If the environment variable is not set, the default value will be used. | | **tls\_hostname** string | | When verifying the authenticity of the Docker Host server, provide the expected name of the server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_HOSTNAME` will be used instead. If the environment variable is not set, the default value will be used. The current default value is `localhost`. This default is deprecated and will change in community.docker 2.0.0 to be a value computed from *docker\_host*. Explicitly specify `localhost` to make sure this value will still be used, and to disable the deprecation message which will be shown otherwise. | | **use\_ssh\_client** boolean added in 1.5.0 of community.docker | **Choices:*** **no** ← * yes | For SSH transports, use the `ssh` CLI tool instead of paramiko. Requires Docker SDK for Python 4.4.0 or newer. | | **validate\_certs** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS and verifying the authenticity of the Docker host server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_VERIFY` will be used instead. If the environment variable is not set, the default value will be used. aliases: tls\_verify | | **verbose\_output** boolean | **Choices:*** **no** ← * yes | When set to `yes` and *networks*, *volumes*, *images*, *containers* or *disk\_usage* is set to `yes` then output will contain verbose information about objects matching the full output of API method. For details see the documentation of your version of Docker API at L(https://docs.docker.com/engine/api/). The verbose output in this module contains only subset of information returned by *\_info* module for each type of the objects. | | **volumes** boolean | **Choices:*** **no** ← * yes | Whether to list volumes. | | **volumes\_filters** dictionary | | A dictionary of filter values used for selecting volumes to list. `label` is a special case of filter which can be a string `<key>` matching when a label is present, a string `<key>=<value>` matching when a label has a particular value, or a list of strings `<key>`/`<key>=<value`. See [the docker documentation](https://docs.docker.com/engine/reference/commandline/volume_prune/#filtering) for more information on possible filters. | Notes ----- Note * Connect to the Docker daemon by providing parameters with each task or by defining environment variables. You can define `DOCKER_HOST`, `DOCKER_TLS_HOSTNAME`, `DOCKER_API_VERSION`, `DOCKER_CERT_PATH`, `DOCKER_SSL_VERSION`, `DOCKER_TLS`, `DOCKER_TLS_VERIFY` and `DOCKER_TIMEOUT`. If you are using docker machine, run the script shipped with the product that sets up the environment. It will set these variables for you. See <https://docs.docker.com/machine/reference/env/> for more details. * When connecting to Docker daemon with TLS, you might need to install additional Python packages. For the Docker SDK for Python, version 2.4 or newer, this can be done by installing `docker[tls]` with [ansible.builtin.pip](../../ansible/builtin/pip_module#ansible-collections-ansible-builtin-pip-module). * Note that the Docker SDK for Python only allows to specify the path to the Docker configuration for very few functions. In general, it will use `$HOME/.docker/config.json` if the `DOCKER_CONFIG` environment variable is not specified, and use `$DOCKER_CONFIG/config.json` otherwise. * This module uses the [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) to communicate with the Docker daemon. Examples -------- ``` - name: Get info on docker host community.docker.docker_host_info: register: result - name: Get info on docker host and list images community.docker.docker_host_info: images: yes register: result - name: Get info on docker host and list images matching the filter community.docker.docker_host_info: images: yes images_filters: label: "mylabel" register: result - name: Get info on docker host and verbose list images community.docker.docker_host_info: images: yes verbose_output: yes register: result - name: Get info on docker host and used disk space community.docker.docker_host_info: disk_usage: yes register: result - name: Get info on docker host and list containers matching the filter community.docker.docker_host_info: containers: yes containers_filters: label: - key1=value1 - key2=value2 register: result - ansible.builtin.debug: var: result.host_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 | | --- | --- | --- | | **can\_talk\_to\_docker** boolean | both on success and on error | Will be `true` if the module can talk to the docker daemon. | | **containers** list / elements=dictionary | When *containers* is `yes` | List of dict objects containing the basic information about each container. Keys matches the `docker container ls` output unless *verbose\_output=yes*. See description for *verbose\_output*. | | **disk\_usage** dictionary | When *disk\_usage* is `yes` | Information on summary disk usage by images, containers and volumes on docker host unless *verbose\_output=yes*. See description for *verbose\_output*. | | **host\_info** dictionary | always | Facts representing the basic state of the docker host. Matches the `docker system info` output. | | **images** list / elements=dictionary | When *images* is `yes` | List of dict objects containing the basic information about each image. Keys matches the `docker image ls` output unless *verbose\_output=yes*. See description for *verbose\_output*. | | **networks** list / elements=dictionary | When *networks* is `yes` | List of dict objects containing the basic information about each network. Keys matches the `docker network ls` output unless *verbose\_output=yes*. See description for *verbose\_output*. | | **volumes** list / elements=dictionary | When *volumes* is `yes` | List of dict objects containing the basic information about each volume. Keys matches the `docker volume ls` output unless *verbose\_output=yes*. See description for *verbose\_output*. | ### Authors * Piotr Wojciechowski (@WojciechowskiPiotr) ansible community.docker.docker_config – Manage docker configs. community.docker.docker\_config – Manage docker configs. ======================================================== Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_config`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Create and remove Docker configs in a Swarm environment. Similar to `docker config create` and `docker config rm`. * Adds to the metadata of new configs ‘ansible\_key’, an encrypted hash representation of the data, which is then used in future runs to test if a config has changed. If ‘ansible\_key’ is not present, then a config will not be updated unless the *force* option is set. * Updates to configs are performed by removing the config and creating it again. Requirements ------------ The below requirements are needed on the host that executes this module. * Docker API >= 1.30 * Docker SDK for Python: Please note that the [docker-py](https://pypi.org/project/docker-py/) Python module has been superseded by [docker](https://pypi.org/project/docker/) (see [here](https://github.com/docker/docker-py/issues/1310) for details). This module does *not* work with docker-py. * [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) >= 2.6.0 * Python >= 2.7 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **api\_version** string | **Default:**"auto" | The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported by Docker SDK for Python and the docker daemon. If the value is not specified in the task, the value of environment variable `DOCKER_API_VERSION` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_api\_version | | **ca\_cert** path | | Use a CA certificate when performing server verification by providing the path to a CA certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `ca.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_ca\_cert, cacert\_path | | **client\_cert** path | | Path to the client's TLS certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `cert.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_cert, cert\_path | | **client\_key** path | | Path to the client's TLS key file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `key.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_key, key\_path | | **data** string | | The value of the config. Mutually exclusive with *data\_src*. One of *data* and *data\_src* is required if *state=present*. | | **data\_is\_b64** boolean | **Choices:*** **no** ← * yes | If set to `true`, the data is assumed to be Base64 encoded and will be decoded before being used. To use binary *data*, it is better to keep it Base64 encoded and let it be decoded by this option. | | **data\_src** path added in 1.10.0 of community.docker | | The file on the target from which to read the config. Mutually exclusive with *data*. One of *data* and *data\_src* is required if *state=present*. | | **debug** boolean | **Choices:*** **no** ← * yes | Debug mode | | **docker\_host** string | **Default:**"unix://var/run/docker.sock" | The URL or Unix socket path used to connect to the Docker API. To connect to a remote host, provide the TCP connection string. For example, `tcp://192.0.2.23:2376`. If TLS is used to encrypt the connection, the module will automatically replace `tcp` in the connection URL with `https`. If the value is not specified in the task, the value of environment variable `DOCKER_HOST` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_url | | **force** boolean | **Choices:*** **no** ← * yes | Use with state `present` to always remove and recreate an existing config. If `true`, an existing config will be replaced, even if it has not been changed. | | **labels** dictionary | | A map of key:value meta data, where both the *key* and *value* are expected to be a string. If new meta data is provided, or existing meta data is modified, the config will be updated by removing it and creating it again. | | **name** string / required | | The name of the config. | | **ssl\_version** string | | Provide a valid SSL version number. Default value determined by ssl.py module. If the value is not specified in the task, the value of environment variable `DOCKER_SSL_VERSION` will be used instead. | | **state** string | **Choices:*** absent * **present** ← | Set to `present`, if the config should exist, and `absent`, if it should not. | | **timeout** integer | **Default:**60 | The maximum amount of time in seconds to wait on a response from the API. If the value is not specified in the task, the value of environment variable `DOCKER_TIMEOUT` will be used instead. If the environment variable is not set, the default value will be used. | | **tls** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS without verifying the authenticity of the Docker host server. Note that if *validate\_certs* is set to `yes` as well, it will take precedence. If the value is not specified in the task, the value of environment variable `DOCKER_TLS` will be used instead. If the environment variable is not set, the default value will be used. | | **tls\_hostname** string | | When verifying the authenticity of the Docker Host server, provide the expected name of the server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_HOSTNAME` will be used instead. If the environment variable is not set, the default value will be used. The current default value is `localhost`. This default is deprecated and will change in community.docker 2.0.0 to be a value computed from *docker\_host*. Explicitly specify `localhost` to make sure this value will still be used, and to disable the deprecation message which will be shown otherwise. | | **use\_ssh\_client** boolean added in 1.5.0 of community.docker | **Choices:*** **no** ← * yes | For SSH transports, use the `ssh` CLI tool instead of paramiko. Requires Docker SDK for Python 4.4.0 or newer. | | **validate\_certs** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS and verifying the authenticity of the Docker host server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_VERIFY` will be used instead. If the environment variable is not set, the default value will be used. aliases: tls\_verify | Notes ----- Note * Connect to the Docker daemon by providing parameters with each task or by defining environment variables. You can define `DOCKER_HOST`, `DOCKER_TLS_HOSTNAME`, `DOCKER_API_VERSION`, `DOCKER_CERT_PATH`, `DOCKER_SSL_VERSION`, `DOCKER_TLS`, `DOCKER_TLS_VERIFY` and `DOCKER_TIMEOUT`. If you are using docker machine, run the script shipped with the product that sets up the environment. It will set these variables for you. See <https://docs.docker.com/machine/reference/env/> for more details. * When connecting to Docker daemon with TLS, you might need to install additional Python packages. For the Docker SDK for Python, version 2.4 or newer, this can be done by installing `docker[tls]` with [ansible.builtin.pip](../../ansible/builtin/pip_module#ansible-collections-ansible-builtin-pip-module). * Note that the Docker SDK for Python only allows to specify the path to the Docker configuration for very few functions. In general, it will use `$HOME/.docker/config.json` if the `DOCKER_CONFIG` environment variable is not specified, and use `$DOCKER_CONFIG/config.json` otherwise. * This module uses the [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) to communicate with the Docker daemon. Examples -------- ``` - name: Create config foo (from a file on the control machine) community.docker.docker_config: name: foo # If the file is JSON or binary, Ansible might modify it (because # it is first decoded and later re-encoded). Base64-encoding the # file directly after reading it prevents this to happen. data: "{{ lookup('file', '/path/to/config/file') | b64encode }}" data_is_b64: true state: present - name: Create config foo (from a file on the target machine) community.docker.docker_config: name: foo data_src: /path/to/config/file state: present - name: Change the config data community.docker.docker_config: name: foo data: Goodnight everyone! labels: bar: baz one: '1' state: present - name: Add a new label community.docker.docker_config: name: foo data: Goodnight everyone! labels: bar: baz one: '1' # Adding a new label will cause a remove/create of the config two: '2' state: present - name: No change community.docker.docker_config: name: foo data: Goodnight everyone! labels: bar: baz one: '1' # Even though 'two' is missing, there is no change to the existing config state: present - name: Update an existing label community.docker.docker_config: name: foo data: Goodnight everyone! labels: bar: monkey # Changing a label will cause a remove/create of the config one: '1' state: present - name: Force the (re-)creation of the config community.docker.docker_config: name: foo data: Goodnight everyone! force: yes state: present - name: Remove config foo community.docker.docker_config: name: foo 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 | | --- | --- | --- | | **config\_id** string | success and *state* is `present` | The ID assigned by Docker to the config object. **Sample:** hzehrmyjigmcp2gb6nlhmjqcv | ### Authors * Chris Houseknecht (@chouseknecht) * John Hu (@ushuz)
programming_docs
ansible community.docker.docker_api – Run tasks in docker containers community.docker.docker\_api – Run tasks in docker containers ============================================================= Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_api`. New in version 1.1.0: of community.docker * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) Synopsis -------- * Run commands or put/fetch files to an existing docker container. * Uses Docker SDK for Python to interact directly with the Docker daemon instead of using the Docker CLI. Use the [community.docker.docker](docker_connection#ansible-collections-community-docker-docker-connection) connection plugin if you want to use the Docker CLI. Requirements ------------ The below requirements are needed on the local controller node that executes this connection. * Docker SDK for Python: Please note that the [docker-py](https://pypi.org/project/docker-py/) Python module has been superseded by [docker](https://pypi.org/project/docker/) (see [here](https://github.com/docker/docker-py/issues/1310) for details). For Python 2.6, `docker-py` must be used. Otherwise, it is recommended to install the `docker` Python module. Note that both modules should *not* be installed at the same time. Also note that when both modules are installed and one of them is uninstalled, the other might no longer function and a reinstall of it is required. Parameters ---------- | Parameter | Choices/Defaults | Configuration | Comments | | --- | --- | --- | --- | | **api\_version** string | **Default:**"auto" | var: ansible\_docker\_api\_version | The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported by Docker SDK for Python and the docker daemon. If the value is not specified in the task, the value of environment variable `DOCKER_API_VERSION` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_api\_version | | **ca\_cert** path | | var: ansible\_docker\_ca\_cert | Use a CA certificate when performing server verification by providing the path to a CA certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `ca.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_ca\_cert, cacert\_path | | **client\_cert** path | | var: ansible\_docker\_client\_cert | Path to the client's TLS certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `cert.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_cert, cert\_path | | **client\_key** path | | var: ansible\_docker\_client\_key | Path to the client's TLS key file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `key.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_key, key\_path | | **debug** boolean | **Choices:*** **no** ← * yes | | Debug mode | | **docker\_host** string | **Default:**"unix://var/run/docker.sock" | var: ansible\_docker\_docker\_host | The URL or Unix socket path used to connect to the Docker API. To connect to a remote host, provide the TCP connection string. For example, `tcp://192.0.2.23:2376`. If TLS is used to encrypt the connection, the module will automatically replace `tcp` in the connection URL with `https`. If the value is not specified in the task, the value of environment variable `DOCKER_HOST` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_url | | **remote\_addr** string | **Default:**"inventory\_hostname" | var: ansible\_host var: ansible\_docker\_host | The name of the container you want to access. | | **remote\_user** string | | var: ansible\_user var: ansible\_docker\_user | The user to execute as inside the container. | | **ssl\_version** string | | var: ansible\_docker\_ssl\_version | Provide a valid SSL version number. Default value determined by ssl.py module. If the value is not specified in the task, the value of environment variable `DOCKER_SSL_VERSION` will be used instead. | | **timeout** integer | **Default:**60 | var: ansible\_docker\_timeout | The maximum amount of time in seconds to wait on a response from the API. If the value is not specified in the task, the value of environment variable `DOCKER_TIMEOUT` will be used instead. If the environment variable is not set, the default value will be used. | | **tls** boolean | **Choices:*** **no** ← * yes | var: ansible\_docker\_tls | Secure the connection to the API by using TLS without verifying the authenticity of the Docker host server. Note that if *validate\_certs* is set to `yes` as well, it will take precedence. If the value is not specified in the task, the value of environment variable `DOCKER_TLS` will be used instead. If the environment variable is not set, the default value will be used. | | **tls\_hostname** string | | var: ansible\_docker\_tls\_hostname | When verifying the authenticity of the Docker Host server, provide the expected name of the server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_HOSTNAME` will be used instead. If the environment variable is not set, the default value will be used. The current default value is `localhost`. This default is deprecated and will change in community.docker 2.0.0 to be a value computed from *docker\_host*. Explicitly specify `localhost` to make sure this value will still be used, and to disable the deprecation message which will be shown otherwise. | | **use\_ssh\_client** boolean added in 1.5.0 of community.docker | **Choices:*** **no** ← * yes | | For SSH transports, use the `ssh` CLI tool instead of paramiko. Requires Docker SDK for Python 4.4.0 or newer. | | **validate\_certs** boolean | **Choices:*** **no** ← * yes | var: ansible\_docker\_validate\_certs | Secure the connection to the API by using TLS and verifying the authenticity of the Docker host server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_VERIFY` will be used instead. If the environment variable is not set, the default value will be used. aliases: tls\_verify | Notes ----- Note * Connect to the Docker daemon by providing parameters with each task or by defining environment variables. You can define `DOCKER_HOST`, `DOCKER_TLS_HOSTNAME`, `DOCKER_API_VERSION`, `DOCKER_CERT_PATH`, `DOCKER_SSL_VERSION`, `DOCKER_TLS`, `DOCKER_TLS_VERIFY` and `DOCKER_TIMEOUT`. If you are using docker machine, run the script shipped with the product that sets up the environment. It will set these variables for you. See <https://docs.docker.com/machine/reference/env/> for more details. * When connecting to Docker daemon with TLS, you might need to install additional Python packages. For the Docker SDK for Python, version 2.4 or newer, this can be done by installing `docker[tls]` with [ansible.builtin.pip](../../ansible/builtin/pip_module#ansible-collections-ansible-builtin-pip-module). * Note that the Docker SDK for Python only allows to specify the path to the Docker configuration for very few functions. In general, it will use `$HOME/.docker/config.json` if the `DOCKER_CONFIG` environment variable is not specified, and use `$DOCKER_CONFIG/config.json` otherwise. * This module uses the [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) to communicate with the Docker daemon. ### Authors * Felix Fontein (@felixfontein) ansible community.docker.docker_compose – Manage multi-container Docker applications with Docker Compose. community.docker.docker\_compose – Manage multi-container Docker applications with Docker Compose. ================================================================================================== Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_compose`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Uses Docker Compose to start, shutdown and scale services. **This module requires docker-compose < 2.0.0.** * Configuration can be read from a `docker-compose.yml` or `docker-compose.yaml` file or inline using the *definition* option. * See the examples for more details. * Supports check mode. * This module was called `docker_service` before Ansible 2.8. The usage did not change. Requirements ------------ The below requirements are needed on the host that executes this module. * Docker API >= 1.20 * Docker SDK for Python: Please note that the [docker-py](https://pypi.org/project/docker-py/) Python module has been superseded by [docker](https://pypi.org/project/docker/) (see [here](https://github.com/docker/docker-py/issues/1310) for details). For Python 2.6, `docker-py` must be used. Otherwise, it is recommended to install the `docker` Python module. Note that both modules should *not* be installed at the same time. Also note that when both modules are installed and one of them is uninstalled, the other might no longer function and a reinstall of it is required. * [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) >= 1.8.0 (use [docker-py](https://pypi.org/project/docker-py/) for Python 2.6) * PyYAML >= 3.11 * docker-compose >= 1.7.0, < 2.0.0 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **api\_version** string | **Default:**"auto" | The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported by Docker SDK for Python and the docker daemon. If the value is not specified in the task, the value of environment variable `DOCKER_API_VERSION` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_api\_version | | **build** boolean | **Choices:*** **no** ← * yes | Use with *state* `present` to always build images prior to starting the application. Same as running `docker-compose build` with the pull option. Images will only be rebuilt if Docker detects a change in the Dockerfile or build directory contents. Use the *nocache* option to ignore the image cache when performing the build. If an existing image is replaced, services using the image will be recreated unless *recreate* is `never`. | | **ca\_cert** path | | Use a CA certificate when performing server verification by providing the path to a CA certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `ca.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_ca\_cert, cacert\_path | | **client\_cert** path | | Path to the client's TLS certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `cert.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_cert, cert\_path | | **client\_key** path | | Path to the client's TLS key file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `key.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_key, key\_path | | **debug** boolean | **Choices:*** **no** ← * yes | Debug mode | | **definition** dictionary | | Compose file describing one or more services, networks and volumes. Mutually exclusive with *project\_src* and *files*. | | **dependencies** boolean | **Choices:*** no * **yes** ← | When *state* is `present` specify whether or not to include linked services. | | **docker\_host** string | **Default:**"unix://var/run/docker.sock" | The URL or Unix socket path used to connect to the Docker API. To connect to a remote host, provide the TCP connection string. For example, `tcp://192.0.2.23:2376`. If TLS is used to encrypt the connection, the module will automatically replace `tcp` in the connection URL with `https`. If the value is not specified in the task, the value of environment variable `DOCKER_HOST` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_url | | **env\_file** path added in 1.9.0 of community.docker | | By default environment files are loaded from a `.env` file located directly under the *project\_src* directory. *env\_file* can be used to specify the path of a custom environment file instead. The path is relative to the *project\_src* directory. Requires `docker-compose` version 1.25.0 or greater. Note: `docker-compose` versions `<=1.28` load the env file from the current working directory of the `docker-compose` command rather than *project\_src*. | | **files** list / elements=path | | List of Compose file names relative to *project\_src*. Overrides `docker-compose.yml` or `docker-compose.yaml`. Files are loaded and merged in the order given. | | **hostname\_check** boolean | **Choices:*** **no** ← * yes | Whether or not to check the Docker daemon's hostname against the name provided in the client certificate. | | **nocache** boolean | **Choices:*** **no** ← * yes | Use with the *build* option to ignore the cache during the image build process. | | **profiles** list / elements=string added in 1.8.0 of community.docker | | List of profiles to enable when starting services. Equivalent to `docker-compose --profile`. Requires `docker-compose` version 1.28.0 or greater. | | **project\_name** string | | Provide a project name. If not provided, the project name is taken from the basename of *project\_src*. Required when *definition* is provided. | | **project\_src** path | | Path to a directory containing a `docker-compose.yml` or `docker-compose.yaml` file. Mutually exclusive with *definition*. Required when no *definition* is provided. | | **pull** boolean | **Choices:*** **no** ← * yes | Use with *state* `present` to always pull images prior to starting the application. Same as running `docker-compose pull`. When a new image is pulled, services using the image will be recreated unless *recreate* is `never`. | | **recreate** string | **Choices:*** always * never * **smart** ← | By default containers will be recreated when their configuration differs from the service definition. Setting to `never` ignores configuration differences and leaves existing containers unchanged. Setting to `always` forces recreation of all existing containers. | | **remove\_images** string | **Choices:*** all * local | Use with *state* `absent` to remove all images or only local images. | | **remove\_orphans** boolean | **Choices:*** **no** ← * yes | Remove containers for services not defined in the Compose file. | | **remove\_volumes** boolean | **Choices:*** **no** ← * yes | Use with *state* `absent` to remove data volumes. | | **restarted** boolean | **Choices:*** **no** ← * yes | Use with *state* `present` to restart all containers defined in the Compose file. If *services* is defined, only the containers listed there will be restarted. | | **scale** dictionary | | When *state* is `present` scale services. Provide a dictionary of key/value pairs where the key is the name of the service and the value is an integer count for the number of containers. | | **services** list / elements=string | | When *state* is `present` run `docker-compose up` resp. `docker-compose stop` (with *stopped*) resp. `docker-compose restart` (with *restarted*) on a subset of services. If empty, which is the default, the operation will be performed on all services defined in the Compose file (or inline *definition*). | | **ssl\_version** string | | Provide a valid SSL version number. Default value determined by ssl.py module. If the value is not specified in the task, the value of environment variable `DOCKER_SSL_VERSION` will be used instead. | | **state** string | **Choices:*** absent * **present** ← | Desired state of the project. Specifying `present` is the same as running `docker-compose up` resp. `docker-compose stop` (with *stopped*) resp. `docker-compose restart` (with *restarted*). Specifying `absent` is the same as running `docker-compose down`. | | **stopped** boolean | **Choices:*** **no** ← * yes | Use with *state* `present` to stop all containers defined in the Compose file. If *services* is defined, only the containers listed there will be stopped. Requires `docker-compose` version 1.17.0 or greater for full support. For older versions, the services will first be started and then stopped when the service is supposed to be created as stopped. | | **timeout** integer | **Default:**10 | Timeout in seconds for container shutdown when attached or when containers are already running. | | **tls** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS without verifying the authenticity of the Docker host server. Note that if *validate\_certs* is set to `yes` as well, it will take precedence. If the value is not specified in the task, the value of environment variable `DOCKER_TLS` will be used instead. If the environment variable is not set, the default value will be used. | | **tls\_hostname** string | | When verifying the authenticity of the Docker Host server, provide the expected name of the server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_HOSTNAME` will be used instead. If the environment variable is not set, the default value will be used. The current default value is `localhost`. This default is deprecated and will change in community.docker 2.0.0 to be a value computed from *docker\_host*. Explicitly specify `localhost` to make sure this value will still be used, and to disable the deprecation message which will be shown otherwise. | | **use\_ssh\_client** boolean added in 1.5.0 of community.docker | **Choices:*** **no** ← * yes | Currently ignored for this module, but might suddenly be supported later on. | | **validate\_certs** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS and verifying the authenticity of the Docker host server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_VERIFY` will be used instead. If the environment variable is not set, the default value will be used. aliases: tls\_verify | Notes ----- Note * Connect to the Docker daemon by providing parameters with each task or by defining environment variables. You can define `DOCKER_HOST`, `DOCKER_TLS_HOSTNAME`, `DOCKER_API_VERSION`, `DOCKER_CERT_PATH`, `DOCKER_SSL_VERSION`, `DOCKER_TLS`, `DOCKER_TLS_VERIFY` and `DOCKER_TIMEOUT`. If you are using docker machine, run the script shipped with the product that sets up the environment. It will set these variables for you. See <https://docs.docker.com/machine/reference/env/> for more details. * When connecting to Docker daemon with TLS, you might need to install additional Python packages. For the Docker SDK for Python, version 2.4 or newer, this can be done by installing `docker[tls]` with [ansible.builtin.pip](../../ansible/builtin/pip_module#ansible-collections-ansible-builtin-pip-module). * Note that the Docker SDK for Python only allows to specify the path to the Docker configuration for very few functions. In general, it will use `$HOME/.docker/config.json` if the `DOCKER_CONFIG` environment variable is not specified, and use `$DOCKER_CONFIG/config.json` otherwise. * This module uses the [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) to communicate with the Docker daemon. Examples -------- ``` # Examples use the django example at https://docs.docker.com/compose/django. Follow it to create the # flask directory - name: Run using a project directory hosts: localhost gather_facts: no tasks: - name: Tear down existing services community.docker.docker_compose: project_src: flask state: absent - name: Create and start services community.docker.docker_compose: project_src: flask register: output - ansible.builtin.debug: var: output - name: Run `docker-compose up` again community.docker.docker_compose: project_src: flask build: no register: output - ansible.builtin.debug: var: output - ansible.builtin.assert: that: "not output.changed " - name: Stop all services community.docker.docker_compose: project_src: flask build: no stopped: yes register: output - ansible.builtin.debug: var: output - ansible.builtin.assert: that: - "not web.flask_web_1.state.running" - "not db.flask_db_1.state.running" - name: Restart services community.docker.docker_compose: project_src: flask build: no restarted: yes register: output - ansible.builtin.debug: var: output - ansible.builtin.assert: that: - "web.flask_web_1.state.running" - "db.flask_db_1.state.running" - name: Scale the web service to 2 hosts: localhost gather_facts: no tasks: - community.docker.docker_compose: project_src: flask scale: web: 2 register: output - ansible.builtin.debug: var: output - name: Run with inline v2 compose hosts: localhost gather_facts: no tasks: - community.docker.docker_compose: project_src: flask state: absent - community.docker.docker_compose: project_name: flask definition: version: '2' services: db: image: postgres web: build: "{{ playbook_dir }}/flask" command: "python manage.py runserver 0.0.0.0:8000" volumes: - "{{ playbook_dir }}/flask:/code" ports: - "8000:8000" depends_on: - db register: output - ansible.builtin.debug: var: output - ansible.builtin.assert: that: - "web.flask_web_1.state.running" - "db.flask_db_1.state.running" - name: Run with inline v1 compose hosts: localhost gather_facts: no tasks: - community.docker.docker_compose: project_src: flask state: absent - community.docker.docker_compose: project_name: flask definition: db: image: postgres web: build: "{{ playbook_dir }}/flask" command: "python manage.py runserver 0.0.0.0:8000" volumes: - "{{ playbook_dir }}/flask:/code" ports: - "8000:8000" links: - db register: output - ansible.builtin.debug: var: output - ansible.builtin.assert: that: - "web.flask_web_1.state.running" - "db.flask_db_1.state.running" ``` 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** complex | when in check mode or *debug* is `yes` | Provides the actions to be taken on each service as determined by compose. | | | **service\_name** complex | always | Name of the service. | | | | **action** list / elements=string | always | A descriptive name of the action to be performed on the service's containers. | | | | | **id** string | always | the container's long ID | | | | | **name** string | always | the container's name | | | | | **short\_id** string | always | the container's short ID | | | | **built\_image** complex | on image build | Provides image details when a new image is built for the service. | | | | | **id** string | always | image hash | | | | | **name** string | always | name of the image | | | | **pulled\_image** complex | on image pull | Provides image details when a new image is pulled for the service. | | | | | **id** string | always | image hash | | | | | **name** string | always | name of the image | | **services** complex | success | A dictionary mapping the service's name to a dictionary of containers. | | | **container\_name** complex | success | Name of the container. Format is `project_service_#`. | | | | **cmd** list / elements=string | success | One or more commands to be executed in the container. **Sample:** ['postgres'] | | | | **image** string | success | Name of the image from which the container was built. **Sample:** postgres | | | | **labels** dictionary | success | Meta data assigned to the container. **Sample:** {'...': None} | | | | **networks** list / elements=dictionary | success | Contains a dictionary for each network to which the container is a member. | | | | | **aliases** list / elements=string | success | Aliases assigned to the container by the network. **Sample:** ['db'] | | | | | **globalIPv6** string | success | IPv6 address assigned to the container. | | | | | **globalIPv6PrefixLen** integer | success | IPv6 subnet length. | | | | | **IPAddress** string | success | The IP address assigned to the container. **Sample:** 172.17.0.2 | | | | | **IPPrefixLen** integer | success | Number of bits used by the subnet. **Sample:** 16 | | | | | **links** list / elements=string | success | List of container names to which this container is linked. | | | | | **macAddress** string | success | Mac Address assigned to the virtual NIC. **Sample:** 02:42:ac:11:00:02 | | | | **state** dictionary | success | Information regarding the current disposition of the container. | | | | | **running** boolean | success | Whether or not the container is up with a running process. **Sample:** True | | | | | **status** string | success | Description of the running state. **Sample:** running | ### Authors * Chris Houseknecht (@chouseknecht)
programming_docs
ansible community.docker.docker – Run tasks in docker containers community.docker.docker – Run tasks in docker containers ======================================================== Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker`. * [Synopsis](#synopsis) * [Parameters](#parameters) Synopsis -------- * Run commands or put/fetch files to an existing docker container. * Uses the Docker CLI to execute commands in the container. If you prefer to directly connect to the Docker daemon, use the [community.docker.docker\_api](docker_api_connection#ansible-collections-community-docker-docker-api-connection) connection plugin. Parameters ---------- | Parameter | Choices/Defaults | Configuration | Comments | | --- | --- | --- | --- | | **docker\_extra\_args** string | **Default:**"" | | Extra arguments to pass to the docker command line | | **remote\_addr** string | **Default:**"inventory\_hostname" | var: ansible\_host var: ansible\_docker\_host | The name of the container you want to access. | | **remote\_user** string | | var: ansible\_user var: ansible\_docker\_user | The user to execute as inside the container | ### Authors * Lorin Hochestein (!UNKNOWN) * Leendert Brouwer (!UNKNOWN) ansible community.docker.docker_secret – Manage docker secrets. community.docker.docker\_secret – Manage docker secrets. ======================================================== Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_secret`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Create and remove Docker secrets in a Swarm environment. Similar to `docker secret create` and `docker secret rm`. * Adds to the metadata of new secrets ‘ansible\_key’, an encrypted hash representation of the data, which is then used in future runs to test if a secret has changed. If ‘ansible\_key is not present, then a secret will not be updated unless the *force* option is set. * Updates to secrets are performed by removing the secret and creating it again. Requirements ------------ The below requirements are needed on the host that executes this module. * Docker API >= 1.25 * Docker SDK for Python: Please note that the [docker-py](https://pypi.org/project/docker-py/) Python module has been superseded by [docker](https://pypi.org/project/docker/) (see [here](https://github.com/docker/docker-py/issues/1310) for details). This module does *not* work with docker-py. * [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) >= 2.1.0 * Python >= 2.7 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **api\_version** string | **Default:**"auto" | The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported by Docker SDK for Python and the docker daemon. If the value is not specified in the task, the value of environment variable `DOCKER_API_VERSION` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_api\_version | | **ca\_cert** path | | Use a CA certificate when performing server verification by providing the path to a CA certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `ca.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_ca\_cert, cacert\_path | | **client\_cert** path | | Path to the client's TLS certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `cert.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_cert, cert\_path | | **client\_key** path | | Path to the client's TLS key file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `key.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_key, key\_path | | **data** string | | The value of the secret. Mutually exclusive with *data\_src*. One of *data* and *data\_src* is required if *state=present*. | | **data\_is\_b64** boolean | **Choices:*** **no** ← * yes | If set to `true`, the data is assumed to be Base64 encoded and will be decoded before being used. To use binary *data*, it is better to keep it Base64 encoded and let it be decoded by this option. | | **data\_src** path added in 1.10.0 of community.docker | | The file on the target from which to read the secret. Mutually exclusive with *data*. One of *data* and *data\_src* is required if *state=present*. | | **debug** boolean | **Choices:*** **no** ← * yes | Debug mode | | **docker\_host** string | **Default:**"unix://var/run/docker.sock" | The URL or Unix socket path used to connect to the Docker API. To connect to a remote host, provide the TCP connection string. For example, `tcp://192.0.2.23:2376`. If TLS is used to encrypt the connection, the module will automatically replace `tcp` in the connection URL with `https`. If the value is not specified in the task, the value of environment variable `DOCKER_HOST` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_url | | **force** boolean | **Choices:*** **no** ← * yes | Use with state `present` to always remove and recreate an existing secret. If `true`, an existing secret will be replaced, even if it has not changed. | | **labels** dictionary | | A map of key:value meta data, where both key and value are expected to be strings. If new meta data is provided, or existing meta data is modified, the secret will be updated by removing it and creating it again. | | **name** string / required | | The name of the secret. | | **ssl\_version** string | | Provide a valid SSL version number. Default value determined by ssl.py module. If the value is not specified in the task, the value of environment variable `DOCKER_SSL_VERSION` will be used instead. | | **state** string | **Choices:*** absent * **present** ← | Set to `present`, if the secret should exist, and `absent`, if it should not. | | **timeout** integer | **Default:**60 | The maximum amount of time in seconds to wait on a response from the API. If the value is not specified in the task, the value of environment variable `DOCKER_TIMEOUT` will be used instead. If the environment variable is not set, the default value will be used. | | **tls** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS without verifying the authenticity of the Docker host server. Note that if *validate\_certs* is set to `yes` as well, it will take precedence. If the value is not specified in the task, the value of environment variable `DOCKER_TLS` will be used instead. If the environment variable is not set, the default value will be used. | | **tls\_hostname** string | | When verifying the authenticity of the Docker Host server, provide the expected name of the server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_HOSTNAME` will be used instead. If the environment variable is not set, the default value will be used. The current default value is `localhost`. This default is deprecated and will change in community.docker 2.0.0 to be a value computed from *docker\_host*. Explicitly specify `localhost` to make sure this value will still be used, and to disable the deprecation message which will be shown otherwise. | | **use\_ssh\_client** boolean added in 1.5.0 of community.docker | **Choices:*** **no** ← * yes | For SSH transports, use the `ssh` CLI tool instead of paramiko. Requires Docker SDK for Python 4.4.0 or newer. | | **validate\_certs** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS and verifying the authenticity of the Docker host server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_VERIFY` will be used instead. If the environment variable is not set, the default value will be used. aliases: tls\_verify | Notes ----- Note * Connect to the Docker daemon by providing parameters with each task or by defining environment variables. You can define `DOCKER_HOST`, `DOCKER_TLS_HOSTNAME`, `DOCKER_API_VERSION`, `DOCKER_CERT_PATH`, `DOCKER_SSL_VERSION`, `DOCKER_TLS`, `DOCKER_TLS_VERIFY` and `DOCKER_TIMEOUT`. If you are using docker machine, run the script shipped with the product that sets up the environment. It will set these variables for you. See <https://docs.docker.com/machine/reference/env/> for more details. * When connecting to Docker daemon with TLS, you might need to install additional Python packages. For the Docker SDK for Python, version 2.4 or newer, this can be done by installing `docker[tls]` with [ansible.builtin.pip](../../ansible/builtin/pip_module#ansible-collections-ansible-builtin-pip-module). * Note that the Docker SDK for Python only allows to specify the path to the Docker configuration for very few functions. In general, it will use `$HOME/.docker/config.json` if the `DOCKER_CONFIG` environment variable is not specified, and use `$DOCKER_CONFIG/config.json` otherwise. * This module uses the [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) to communicate with the Docker daemon. Examples -------- ``` - name: Create secret foo (from a file on the control machine) community.docker.docker_secret: name: foo # If the file is JSON or binary, Ansible might modify it (because # it is first decoded and later re-encoded). Base64-encoding the # file directly after reading it prevents this to happen. data: "{{ lookup('file', '/path/to/secret/file') | b64encode }}" data_is_b64: true state: present - name: Create secret foo (from a file on the target machine) community.docker.docker_secret: name: foo data_src: /path/to/secret/file state: present - name: Change the secret data community.docker.docker_secret: name: foo data: Goodnight everyone! labels: bar: baz one: '1' state: present - name: Add a new label community.docker.docker_secret: name: foo data: Goodnight everyone! labels: bar: baz one: '1' # Adding a new label will cause a remove/create of the secret two: '2' state: present - name: No change community.docker.docker_secret: name: foo data: Goodnight everyone! labels: bar: baz one: '1' # Even though 'two' is missing, there is no change to the existing secret state: present - name: Update an existing label community.docker.docker_secret: name: foo data: Goodnight everyone! labels: bar: monkey # Changing a label will cause a remove/create of the secret one: '1' state: present - name: Force the removal/creation of the secret community.docker.docker_secret: name: foo data: Goodnight everyone! force: yes state: present - name: Remove secret foo community.docker.docker_secret: name: foo 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 | | --- | --- | --- | | **secret\_id** string | success and *state* is `present` | The ID assigned by Docker to the secret object. **Sample:** hzehrmyjigmcp2gb6nlhmjqcv | ### Authors * Chris Houseknecht (@chouseknecht) ansible community.docker.docker_container_info – Retrieves facts about docker container community.docker.docker\_container\_info – Retrieves facts about docker container ================================================================================= Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_container_info`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Retrieves facts about a docker container. * Essentially returns the output of `docker inspect <name>`, similar to what [community.docker.docker\_container](docker_container_module#ansible-collections-community-docker-docker-container-module) returns for a non-absent container. Requirements ------------ The below requirements are needed on the host that executes this module. * Docker API >= 1.20 * Docker SDK for Python: Please note that the [docker-py](https://pypi.org/project/docker-py/) Python module has been superseded by [docker](https://pypi.org/project/docker/) (see [here](https://github.com/docker/docker-py/issues/1310) for details). For Python 2.6, `docker-py` must be used. Otherwise, it is recommended to install the `docker` Python module. Note that both modules should *not* be installed at the same time. Also note that when both modules are installed and one of them is uninstalled, the other might no longer function and a reinstall of it is required. * [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) >= 1.8.0 (use [docker-py](https://pypi.org/project/docker-py/) for Python 2.6) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **api\_version** string | **Default:**"auto" | The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported by Docker SDK for Python and the docker daemon. If the value is not specified in the task, the value of environment variable `DOCKER_API_VERSION` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_api\_version | | **ca\_cert** path | | Use a CA certificate when performing server verification by providing the path to a CA certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `ca.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_ca\_cert, cacert\_path | | **client\_cert** path | | Path to the client's TLS certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `cert.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_cert, cert\_path | | **client\_key** path | | Path to the client's TLS key file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `key.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_key, key\_path | | **debug** boolean | **Choices:*** **no** ← * yes | Debug mode | | **docker\_host** string | **Default:**"unix://var/run/docker.sock" | The URL or Unix socket path used to connect to the Docker API. To connect to a remote host, provide the TCP connection string. For example, `tcp://192.0.2.23:2376`. If TLS is used to encrypt the connection, the module will automatically replace `tcp` in the connection URL with `https`. If the value is not specified in the task, the value of environment variable `DOCKER_HOST` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_url | | **name** string / required | | The name of the container to inspect. When identifying an existing container name may be a name or a long or short container ID. | | **ssl\_version** string | | Provide a valid SSL version number. Default value determined by ssl.py module. If the value is not specified in the task, the value of environment variable `DOCKER_SSL_VERSION` will be used instead. | | **timeout** integer | **Default:**60 | The maximum amount of time in seconds to wait on a response from the API. If the value is not specified in the task, the value of environment variable `DOCKER_TIMEOUT` will be used instead. If the environment variable is not set, the default value will be used. | | **tls** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS without verifying the authenticity of the Docker host server. Note that if *validate\_certs* is set to `yes` as well, it will take precedence. If the value is not specified in the task, the value of environment variable `DOCKER_TLS` will be used instead. If the environment variable is not set, the default value will be used. | | **tls\_hostname** string | | When verifying the authenticity of the Docker Host server, provide the expected name of the server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_HOSTNAME` will be used instead. If the environment variable is not set, the default value will be used. The current default value is `localhost`. This default is deprecated and will change in community.docker 2.0.0 to be a value computed from *docker\_host*. Explicitly specify `localhost` to make sure this value will still be used, and to disable the deprecation message which will be shown otherwise. | | **use\_ssh\_client** boolean added in 1.5.0 of community.docker | **Choices:*** **no** ← * yes | For SSH transports, use the `ssh` CLI tool instead of paramiko. Requires Docker SDK for Python 4.4.0 or newer. | | **validate\_certs** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS and verifying the authenticity of the Docker host server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_VERIFY` will be used instead. If the environment variable is not set, the default value will be used. aliases: tls\_verify | Notes ----- Note * Connect to the Docker daemon by providing parameters with each task or by defining environment variables. You can define `DOCKER_HOST`, `DOCKER_TLS_HOSTNAME`, `DOCKER_API_VERSION`, `DOCKER_CERT_PATH`, `DOCKER_SSL_VERSION`, `DOCKER_TLS`, `DOCKER_TLS_VERIFY` and `DOCKER_TIMEOUT`. If you are using docker machine, run the script shipped with the product that sets up the environment. It will set these variables for you. See <https://docs.docker.com/machine/reference/env/> for more details. * When connecting to Docker daemon with TLS, you might need to install additional Python packages. For the Docker SDK for Python, version 2.4 or newer, this can be done by installing `docker[tls]` with [ansible.builtin.pip](../../ansible/builtin/pip_module#ansible-collections-ansible-builtin-pip-module). * Note that the Docker SDK for Python only allows to specify the path to the Docker configuration for very few functions. In general, it will use `$HOME/.docker/config.json` if the `DOCKER_CONFIG` environment variable is not specified, and use `$DOCKER_CONFIG/config.json` otherwise. * This module uses the [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) to communicate with the Docker daemon. Examples -------- ``` - name: Get infos on container community.docker.docker_container_info: name: mydata register: result - name: Does container exist? ansible.builtin.debug: msg: "The container {{ 'exists' if result.exists else 'does not exist' }}" - name: Print information about container ansible.builtin.debug: var: result.container when: result.exists ``` 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** dictionary | always | Facts representing the current state of the container. Matches the docker inspection output. Will be `none` if container does not exist. **Sample:** { "AppArmorProfile": "", "Args": [], "Config": { "AttachStderr": false, "AttachStdin": false, "AttachStdout": false, "Cmd": [ "/usr/bin/supervisord" ], "Domainname": "", "Entrypoint": null, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ], "ExposedPorts": { "443/tcp": {}, "80/tcp": {} }, "Hostname": "8e47bf643eb9", "Image": "lnmp\_nginx:v1", "Labels": {}, "OnBuild": null, "OpenStdin": false, "StdinOnce": false, "Tty": false, "User": "", "Volumes": { "/tmp/lnmp/nginx-sites/logs/": {} }, ... } | | **exists** boolean | always | Returns whether the container exists. **Sample:** True | ### Authors * Felix Fontein (@felixfontein)
programming_docs
ansible community.docker.docker_swarm – Ansible dynamic inventory plugin for Docker swarm nodes. community.docker.docker\_swarm – Ansible dynamic inventory plugin for Docker swarm nodes. ========================================================================================= Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_swarm`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Examples](#examples) Synopsis -------- * Reads inventories from the Docker swarm API. * Uses a YAML configuration file docker\_swarm.[yml|yaml]. * The plugin returns following groups of swarm nodes: *all* - all hosts; *workers* - all worker nodes; *managers* - all manager nodes; *leader* - the swarm leader node; *nonleaders* - all nodes except the swarm leader. Requirements ------------ The below requirements are needed on the local controller node that executes this inventory. * python >= 2.7 * [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) >= 1.10.0 Parameters ---------- | Parameter | Choices/Defaults | Configuration | Comments | | --- | --- | --- | --- | | **api\_version** string | | | The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported by docker-py. aliases: docker\_api\_version | | **ca\_cert** path | | | Use a CA certificate when performing server verification by providing the path to a CA certificate file. aliases: tls\_ca\_cert, cacert\_path | | **client\_cert** path | | | Path to the client's TLS certificate file. aliases: tls\_client\_cert, cert\_path | | **client\_key** path | | | Path to the client's TLS key file. aliases: tls\_client\_key, key\_path | | **compose** dictionary | **Default:**{} | | Create vars from jinja2 expressions. | | **docker\_host** string / required | | | Socket of a Docker swarm manager node (`tcp`, `unix`). Use `unix://var/run/docker.sock` to connect via local socket. aliases: docker\_url | | **groups** dictionary | **Default:**{} | | Add hosts to group based on Jinja2 conditionals. | | **include\_host\_uri** boolean | **Choices:*** **no** ← * yes | | Toggle to return the additional attribute `ansible_host_uri` which contains the URI of the swarm leader in format of `tcp://172.16.0.1:2376`. This value may be used without additional modification as value of option *docker\_host* in Docker Swarm modules when connecting via API. The port always defaults to `2376`. | | **include\_host\_uri\_port** integer | | | Override the detected port number included in *ansible\_host\_uri* | | **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. | | **plugin** string / required | **Choices:*** docker\_swarm * community.docker.docker\_swarm | | The name of this plugin, it should always be set to `community.docker.docker_swarm` for this plugin to recognize it as it's own. | | **ssl\_version** string | | | Provide a valid SSL version number. Default value determined by ssl.py module. | | **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:**60 | | The maximum amount of time in seconds to wait on a response from the API. If the value is not specified in the task, the value of environment variable `DOCKER_TIMEOUT` will be used instead. If the environment variable is not set, the default value will be used. aliases: time\_out | | **tls** boolean | **Choices:*** **no** ← * yes | | Connect using TLS without verifying the authenticity of the Docker host server. | | **tls\_hostname** string | | | When verifying the authenticity of the Docker host server, provide the expected name of the server. | | **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). | | **use\_ssh\_client** boolean added in 1.5.0 of community.docker | **Choices:*** **no** ← * yes | | For SSH transports, use the `ssh` CLI tool instead of paramiko. Requires Docker SDK for Python 4.4.0 or newer. | | **validate\_certs** boolean | **Choices:*** **no** ← * yes | | Toggle if connecting using TLS with or without verifying the authenticity of the Docker host server. aliases: tls\_verify | | **verbose\_output** boolean | **Choices:*** no * **yes** ← | | Toggle to (not) include all available nodes metadata (e.g. `Platform`, `Architecture`, `OS`, `EngineVersion`) | Examples -------- ``` # Minimal example using local docker plugin: community.docker.docker_swarm docker_host: unix://var/run/docker.sock # Minimal example using remote docker plugin: community.docker.docker_swarm docker_host: tcp://my-docker-host:2375 # Example using remote docker with unverified TLS plugin: community.docker.docker_swarm docker_host: tcp://my-docker-host:2376 tls: yes # Example using remote docker with verified TLS and client certificate verification plugin: community.docker.docker_swarm docker_host: tcp://my-docker-host:2376 validate_certs: yes ca_cert: /somewhere/ca.pem client_key: /somewhere/key.pem client_cert: /somewhere/cert.pem # Example using constructed features to create groups and set ansible_host plugin: community.docker.docker_swarm docker_host: tcp://my-docker-host:2375 strict: False keyed_groups: # add e.g. x86_64 hosts to an arch_x86_64 group - prefix: arch key: 'Description.Platform.Architecture' # add e.g. linux hosts to an os_linux group - prefix: os key: 'Description.Platform.OS' # create a group per node label # e.g. a node labeled w/ "production" ends up in group "label_production" # hint: labels containing special characters will be converted to safe names - key: 'Spec.Labels' prefix: label ``` ### Authors * Stefan Heitmüller (@morph027) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#deadaabbb8bfb0f8fdeae8e5b6bbb7aab3abbbb2b2bbacf8fdede9e5f8fdebece5f8fdeae6e5b9b3a6f8fdeae8e5bdb1b3)> ansible community.docker.docker_prune – Allows to prune various docker objects community.docker.docker\_prune – Allows to prune various docker objects ======================================================================= Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_prune`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Allows to run `docker container prune`, `docker image prune`, `docker network prune` and `docker volume prune` via the Docker API. Requirements ------------ The below requirements are needed on the host that executes this module. * Docker API >= 1.25 * Docker SDK for Python: Please note that the [docker-py](https://pypi.org/project/docker-py/) Python module has been superseded by [docker](https://pypi.org/project/docker/) (see [here](https://github.com/docker/docker-py/issues/1310) for details). This module does *not* work with docker-py. * [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) >= 2.1.0 * Python >= 2.7 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **api\_version** string | **Default:**"auto" | The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported by Docker SDK for Python and the docker daemon. If the value is not specified in the task, the value of environment variable `DOCKER_API_VERSION` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_api\_version | | **builder\_cache** boolean | **Choices:*** **no** ← * yes | Whether to prune the builder cache. Requires version 3.3.0 of the Docker SDK for Python or newer. | | **ca\_cert** path | | Use a CA certificate when performing server verification by providing the path to a CA certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `ca.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_ca\_cert, cacert\_path | | **client\_cert** path | | Path to the client's TLS certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `cert.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_cert, cert\_path | | **client\_key** path | | Path to the client's TLS key file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `key.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_key, key\_path | | **containers** boolean | **Choices:*** **no** ← * yes | Whether to prune containers. | | **containers\_filters** dictionary | | A dictionary of filter values used for selecting containers to delete. For example, `until: 24h`. See [the docker documentation](https://docs.docker.com/engine/reference/commandline/container_prune/#filtering) for more information on possible filters. | | **debug** boolean | **Choices:*** **no** ← * yes | Debug mode | | **docker\_host** string | **Default:**"unix://var/run/docker.sock" | The URL or Unix socket path used to connect to the Docker API. To connect to a remote host, provide the TCP connection string. For example, `tcp://192.0.2.23:2376`. If TLS is used to encrypt the connection, the module will automatically replace `tcp` in the connection URL with `https`. If the value is not specified in the task, the value of environment variable `DOCKER_HOST` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_url | | **images** boolean | **Choices:*** **no** ← * yes | Whether to prune images. | | **images\_filters** dictionary | | A dictionary of filter values used for selecting images to delete. For example, `dangling: true`. See [the docker documentation](https://docs.docker.com/engine/reference/commandline/image_prune/#filtering) for more information on possible filters. | | **networks** boolean | **Choices:*** **no** ← * yes | Whether to prune networks. | | **networks\_filters** dictionary | | A dictionary of filter values used for selecting networks to delete. See [the docker documentation](https://docs.docker.com/engine/reference/commandline/network_prune/#filtering) for more information on possible filters. | | **ssl\_version** string | | Provide a valid SSL version number. Default value determined by ssl.py module. If the value is not specified in the task, the value of environment variable `DOCKER_SSL_VERSION` will be used instead. | | **timeout** integer | **Default:**60 | The maximum amount of time in seconds to wait on a response from the API. If the value is not specified in the task, the value of environment variable `DOCKER_TIMEOUT` will be used instead. If the environment variable is not set, the default value will be used. | | **tls** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS without verifying the authenticity of the Docker host server. Note that if *validate\_certs* is set to `yes` as well, it will take precedence. If the value is not specified in the task, the value of environment variable `DOCKER_TLS` will be used instead. If the environment variable is not set, the default value will be used. | | **tls\_hostname** string | | When verifying the authenticity of the Docker Host server, provide the expected name of the server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_HOSTNAME` will be used instead. If the environment variable is not set, the default value will be used. The current default value is `localhost`. This default is deprecated and will change in community.docker 2.0.0 to be a value computed from *docker\_host*. Explicitly specify `localhost` to make sure this value will still be used, and to disable the deprecation message which will be shown otherwise. | | **use\_ssh\_client** boolean added in 1.5.0 of community.docker | **Choices:*** **no** ← * yes | For SSH transports, use the `ssh` CLI tool instead of paramiko. Requires Docker SDK for Python 4.4.0 or newer. | | **validate\_certs** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS and verifying the authenticity of the Docker host server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_VERIFY` will be used instead. If the environment variable is not set, the default value will be used. aliases: tls\_verify | | **volumes** boolean | **Choices:*** **no** ← * yes | Whether to prune volumes. | | **volumes\_filters** dictionary | | A dictionary of filter values used for selecting volumes to delete. See [the docker documentation](https://docs.docker.com/engine/reference/commandline/volume_prune/#filtering) for more information on possible filters. | Notes ----- Note * Connect to the Docker daemon by providing parameters with each task or by defining environment variables. You can define `DOCKER_HOST`, `DOCKER_TLS_HOSTNAME`, `DOCKER_API_VERSION`, `DOCKER_CERT_PATH`, `DOCKER_SSL_VERSION`, `DOCKER_TLS`, `DOCKER_TLS_VERIFY` and `DOCKER_TIMEOUT`. If you are using docker machine, run the script shipped with the product that sets up the environment. It will set these variables for you. See <https://docs.docker.com/machine/reference/env/> for more details. * When connecting to Docker daemon with TLS, you might need to install additional Python packages. For the Docker SDK for Python, version 2.4 or newer, this can be done by installing `docker[tls]` with [ansible.builtin.pip](../../ansible/builtin/pip_module#ansible-collections-ansible-builtin-pip-module). * Note that the Docker SDK for Python only allows to specify the path to the Docker configuration for very few functions. In general, it will use `$HOME/.docker/config.json` if the `DOCKER_CONFIG` environment variable is not specified, and use `$DOCKER_CONFIG/config.json` otherwise. * This module uses the [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) to communicate with the Docker daemon. Examples -------- ``` - name: Prune containers older than 24h community.docker.docker_prune: containers: yes containers_filters: # only consider containers created more than 24 hours ago until: 24h - name: Prune everything community.docker.docker_prune: containers: yes images: yes networks: yes volumes: yes builder_cache: yes - name: Prune everything (including non-dangling images) community.docker.docker_prune: containers: yes images: yes images_filters: dangling: false networks: yes volumes: yes builder_cache: 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 | | --- | --- | --- | | **builder\_cache\_space\_reclaimed** integer | *builder\_cache* is `true` | Amount of reclaimed disk space from builder cache pruning in bytes. **Sample:** 0 | | **containers** list / elements=string | *containers* is `true` | List of IDs of deleted containers. **Sample:** [] | | **containers\_space\_reclaimed** integer | *containers* is `true` | Amount of reclaimed disk space from container pruning in bytes. **Sample:** 0 | | **images** list / elements=string | *images* is `true` | List of IDs of deleted images. **Sample:** [] | | **images\_space\_reclaimed** integer | *images* is `true` | Amount of reclaimed disk space from image pruning in bytes. **Sample:** 0 | | **networks** list / elements=string | *networks* is `true` | List of IDs of deleted networks. **Sample:** [] | | **volumes** list / elements=string | *volumes* is `true` | List of IDs of deleted volumes. **Sample:** [] | | **volumes\_space\_reclaimed** integer | *volumes* is `true` | Amount of reclaimed disk space from volumes pruning in bytes. **Sample:** 0 | ### Authors * Felix Fontein (@felixfontein) ansible community.docker.docker_login – Log into a Docker registry. community.docker.docker\_login – Log into a Docker registry. ============================================================ Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_login`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Provides functionality similar to the “docker login” command. * Authenticate with a docker registry and add the credentials to your local Docker config file respectively the credentials store associated to the registry. Adding the credentials to the config files resp. the credential store allows future connections to the registry using tools such as Ansible’s Docker modules, the Docker CLI and Docker SDK for Python without needing to provide credentials. * Running in check mode will perform the authentication without updating the config file. Requirements ------------ The below requirements are needed on the host that executes this module. * Docker API >= 1.20 * Docker SDK for Python: Please note that the [docker-py](https://pypi.org/project/docker-py/) Python module has been superseded by [docker](https://pypi.org/project/docker/) (see [here](https://github.com/docker/docker-py/issues/1310) for details). For Python 2.6, `docker-py` must be used. Otherwise, it is recommended to install the `docker` Python module. Note that both modules should *not* be installed at the same time. Also note that when both modules are installed and one of them is uninstalled, the other might no longer function and a reinstall of it is required. * [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) >= 1.8.0 (use [docker-py](https://pypi.org/project/docker-py/) for Python 2.6) * L(Python bindings for docker credentials store API) >= 0.2.1 (use [docker-pycreds](https://pypi.org/project/docker-pycreds/) when using Docker SDK for Python < 4.0.0) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **api\_version** string | **Default:**"auto" | The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported by Docker SDK for Python and the docker daemon. If the value is not specified in the task, the value of environment variable `DOCKER_API_VERSION` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_api\_version | | **ca\_cert** path | | Use a CA certificate when performing server verification by providing the path to a CA certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `ca.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_ca\_cert, cacert\_path | | **client\_cert** path | | Path to the client's TLS certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `cert.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_cert, cert\_path | | **client\_key** path | | Path to the client's TLS key file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `key.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_key, key\_path | | **config\_path** path | **Default:**"~/.docker/config.json" | Custom path to the Docker CLI configuration file. aliases: dockercfg\_path | | **debug** boolean | **Choices:*** **no** ← * yes | Debug mode | | **docker\_host** string | **Default:**"unix://var/run/docker.sock" | The URL or Unix socket path used to connect to the Docker API. To connect to a remote host, provide the TCP connection string. For example, `tcp://192.0.2.23:2376`. If TLS is used to encrypt the connection, the module will automatically replace `tcp` in the connection URL with `https`. If the value is not specified in the task, the value of environment variable `DOCKER_HOST` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_url | | **email** string | | Does nothing, do not use. Will be removed in community.docker 2.0.0. | | **password** string | | The plaintext password for the registry account. Required when *state* is `present`. | | **reauthorize** boolean | **Choices:*** **no** ← * yes | Refresh existing authentication found in the configuration file. aliases: reauth | | **registry\_url** string | **Default:**"https://index.docker.io/v1/" | The registry URL. aliases: registry, url | | **ssl\_version** string | | Provide a valid SSL version number. Default value determined by ssl.py module. If the value is not specified in the task, the value of environment variable `DOCKER_SSL_VERSION` will be used instead. | | **state** string | **Choices:*** **present** ← * absent | This controls the current state of the user. `present` will login in a user, `absent` will log them out. To logout you only need the registry server, which defaults to DockerHub. Before 2.1 you could ONLY log in. Docker does not support 'logout' with a custom config file. | | **timeout** integer | **Default:**60 | The maximum amount of time in seconds to wait on a response from the API. If the value is not specified in the task, the value of environment variable `DOCKER_TIMEOUT` will be used instead. If the environment variable is not set, the default value will be used. | | **tls** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS without verifying the authenticity of the Docker host server. Note that if *validate\_certs* is set to `yes` as well, it will take precedence. If the value is not specified in the task, the value of environment variable `DOCKER_TLS` will be used instead. If the environment variable is not set, the default value will be used. | | **tls\_hostname** string | | When verifying the authenticity of the Docker Host server, provide the expected name of the server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_HOSTNAME` will be used instead. If the environment variable is not set, the default value will be used. The current default value is `localhost`. This default is deprecated and will change in community.docker 2.0.0 to be a value computed from *docker\_host*. Explicitly specify `localhost` to make sure this value will still be used, and to disable the deprecation message which will be shown otherwise. | | **use\_ssh\_client** boolean added in 1.5.0 of community.docker | **Choices:*** **no** ← * yes | For SSH transports, use the `ssh` CLI tool instead of paramiko. Requires Docker SDK for Python 4.4.0 or newer. | | **username** string | | The username for the registry account. Required when *state* is `present`. | | **validate\_certs** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS and verifying the authenticity of the Docker host server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_VERIFY` will be used instead. If the environment variable is not set, the default value will be used. aliases: tls\_verify | Notes ----- Note * Connect to the Docker daemon by providing parameters with each task or by defining environment variables. You can define `DOCKER_HOST`, `DOCKER_TLS_HOSTNAME`, `DOCKER_API_VERSION`, `DOCKER_CERT_PATH`, `DOCKER_SSL_VERSION`, `DOCKER_TLS`, `DOCKER_TLS_VERIFY` and `DOCKER_TIMEOUT`. If you are using docker machine, run the script shipped with the product that sets up the environment. It will set these variables for you. See <https://docs.docker.com/machine/reference/env/> for more details. * When connecting to Docker daemon with TLS, you might need to install additional Python packages. For the Docker SDK for Python, version 2.4 or newer, this can be done by installing `docker[tls]` with [ansible.builtin.pip](../../ansible/builtin/pip_module#ansible-collections-ansible-builtin-pip-module). * Note that the Docker SDK for Python only allows to specify the path to the Docker configuration for very few functions. In general, it will use `$HOME/.docker/config.json` if the `DOCKER_CONFIG` environment variable is not specified, and use `$DOCKER_CONFIG/config.json` otherwise. * This module uses the [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) to communicate with the Docker daemon. Examples -------- ``` - name: Log into DockerHub community.docker.docker_login: username: docker password: rekcod - name: Log into private registry and force re-authorization community.docker.docker_login: registry_url: your.private.registry.io username: yourself password: secrets3 reauthorize: yes - name: Log into DockerHub using a custom config file community.docker.docker_login: username: docker password: rekcod config_path: /tmp/.mydockercfg - name: Log out of DockerHub community.docker.docker_login: 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 | | --- | --- | --- | | **login\_results** dictionary | when state='present' | Results from the login. **Sample:** {'serveraddress': 'localhost:5000', 'username': 'testuser'} | ### Authors * Olaf Kilian (@olsaki) <[[email protected]](https://docs.ansible.com/cdn-cgi/l/email-protection#a7c8cbc6c1818493919ccccecbcec6c9818494909c818492959c8184939f9cd4decac6c9c2df818493919cc4c8ca)> * Chris Houseknecht (@chouseknecht)
programming_docs
ansible community.docker.docker_plugin – Manage Docker plugins community.docker.docker\_plugin – Manage Docker plugins ======================================================= Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_plugin`. New in version 1.3.0: of community.docker * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * This module allows to install, delete, enable and disable Docker plugins. * Performs largely the same function as the `docker plugin` CLI subcommand. Requirements ------------ The below requirements are needed on the host that executes this module. * Docker API >= 1.25 * Docker SDK for Python: Please note that the [docker-py](https://pypi.org/project/docker-py/) Python module has been superseded by [docker](https://pypi.org/project/docker/) (see [here](https://github.com/docker/docker-py/issues/1310) for details). This module does *not* work with docker-py. * [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) >= 2.6.0 * Python >= 2.7 * python >= 2.7 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **alias** string added in 1.8.0 of community.docker | | Local name for plugin. | | **api\_version** string | **Default:**"auto" | The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported by Docker SDK for Python and the docker daemon. If the value is not specified in the task, the value of environment variable `DOCKER_API_VERSION` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_api\_version | | **ca\_cert** path | | Use a CA certificate when performing server verification by providing the path to a CA certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `ca.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_ca\_cert, cacert\_path | | **client\_cert** path | | Path to the client's TLS certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `cert.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_cert, cert\_path | | **client\_key** path | | Path to the client's TLS key file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `key.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_key, key\_path | | **debug** boolean | **Choices:*** **no** ← * yes | Debug mode | | **docker\_host** string | **Default:**"unix://var/run/docker.sock" | The URL or Unix socket path used to connect to the Docker API. To connect to a remote host, provide the TCP connection string. For example, `tcp://192.0.2.23:2376`. If TLS is used to encrypt the connection, the module will automatically replace `tcp` in the connection URL with `https`. If the value is not specified in the task, the value of environment variable `DOCKER_HOST` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_url | | **enable\_timeout** integer | **Default:**0 | Timeout in seconds. | | **force\_remove** boolean | **Choices:*** **no** ← * yes | Remove even if the plugin is enabled. | | **plugin\_name** string / required | | Name of the plugin to operate on. | | **plugin\_options** dictionary | | Dictionary of plugin settings. | | **ssl\_version** string | | Provide a valid SSL version number. Default value determined by ssl.py module. If the value is not specified in the task, the value of environment variable `DOCKER_SSL_VERSION` will be used instead. | | **state** string | **Choices:*** absent * **present** ← * enable * disable | `absent` remove the plugin. `present` install the plugin, if it does not already exist. `enable` enable the plugin. `disable` disable the plugin. | | **timeout** integer | **Default:**60 | The maximum amount of time in seconds to wait on a response from the API. If the value is not specified in the task, the value of environment variable `DOCKER_TIMEOUT` will be used instead. If the environment variable is not set, the default value will be used. | | **tls** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS without verifying the authenticity of the Docker host server. Note that if *validate\_certs* is set to `yes` as well, it will take precedence. If the value is not specified in the task, the value of environment variable `DOCKER_TLS` will be used instead. If the environment variable is not set, the default value will be used. | | **tls\_hostname** string | | When verifying the authenticity of the Docker Host server, provide the expected name of the server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_HOSTNAME` will be used instead. If the environment variable is not set, the default value will be used. The current default value is `localhost`. This default is deprecated and will change in community.docker 2.0.0 to be a value computed from *docker\_host*. Explicitly specify `localhost` to make sure this value will still be used, and to disable the deprecation message which will be shown otherwise. | | **use\_ssh\_client** boolean added in 1.5.0 of community.docker | **Choices:*** **no** ← * yes | For SSH transports, use the `ssh` CLI tool instead of paramiko. Requires Docker SDK for Python 4.4.0 or newer. | | **validate\_certs** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS and verifying the authenticity of the Docker host server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_VERIFY` will be used instead. If the environment variable is not set, the default value will be used. aliases: tls\_verify | Notes ----- Note * Connect to the Docker daemon by providing parameters with each task or by defining environment variables. You can define `DOCKER_HOST`, `DOCKER_TLS_HOSTNAME`, `DOCKER_API_VERSION`, `DOCKER_CERT_PATH`, `DOCKER_SSL_VERSION`, `DOCKER_TLS`, `DOCKER_TLS_VERIFY` and `DOCKER_TIMEOUT`. If you are using docker machine, run the script shipped with the product that sets up the environment. It will set these variables for you. See <https://docs.docker.com/machine/reference/env/> for more details. * When connecting to Docker daemon with TLS, you might need to install additional Python packages. For the Docker SDK for Python, version 2.4 or newer, this can be done by installing `docker[tls]` with [ansible.builtin.pip](../../ansible/builtin/pip_module#ansible-collections-ansible-builtin-pip-module). * Note that the Docker SDK for Python only allows to specify the path to the Docker configuration for very few functions. In general, it will use `$HOME/.docker/config.json` if the `DOCKER_CONFIG` environment variable is not specified, and use `$DOCKER_CONFIG/config.json` otherwise. * This module uses the [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) to communicate with the Docker daemon. Examples -------- ``` - name: Install a plugin community.docker.docker_plugin: plugin_name: plugin_one state: present - name: Remove a plugin community.docker.docker_plugin: plugin_name: plugin_one state: absent - name: Enable the plugin community.docker.docker_plugin: plugin_name: plugin_one state: enable - name: Disable the plugin community.docker.docker_plugin: plugin_name: plugin_one state: disable - name: Install a plugin with options community.docker.docker_plugin: plugin_name: weaveworks/net-plugin:latest_release plugin_options: IPALLOC_RANGE: "10.32.0.0/12" WEAVE_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 module: | Key | Returned | Description | | --- | --- | --- | | **actions** list / elements=string | when *state!=absent* | List of actions performed during task execution. | | **plugin** dictionary | success | Plugin inspection results for the affected plugin. | ### Authors * Sakar Mehra (@sakar97) * Vladimir Porshkevich (@porshkevich) ansible community.docker.docker_swarm_info – Retrieves facts about Docker Swarm cluster. community.docker.docker\_swarm\_info – Retrieves facts about Docker Swarm cluster. ================================================================================== Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_swarm_info`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Retrieves facts about a Docker Swarm. * Returns lists of swarm objects names for the services - nodes, services, tasks. * The output differs depending on API version available on docker host. * Must be run on Swarm Manager node; otherwise module fails with error message. It does return boolean flags in on both error and success which indicate whether the docker daemon can be communicated with, whether it is in Swarm mode, and whether it is a Swarm Manager node. Requirements ------------ The below requirements are needed on the host that executes this module. * Docker API >= 1.24 * Docker SDK for Python: Please note that the [docker-py](https://pypi.org/project/docker-py/) Python module has been superseded by [docker](https://pypi.org/project/docker/) (see [here](https://github.com/docker/docker-py/issues/1310) for details). For Python 2.6, `docker-py` must be used. Otherwise, it is recommended to install the `docker` Python module. Note that both modules should *not* be installed at the same time. Also note that when both modules are installed and one of them is uninstalled, the other might no longer function and a reinstall of it is required. * [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) >= 1.10.0 (use [docker-py](https://pypi.org/project/docker-py/) for Python 2.6) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **api\_version** string | **Default:**"auto" | The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported by Docker SDK for Python and the docker daemon. If the value is not specified in the task, the value of environment variable `DOCKER_API_VERSION` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_api\_version | | **ca\_cert** path | | Use a CA certificate when performing server verification by providing the path to a CA certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `ca.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_ca\_cert, cacert\_path | | **client\_cert** path | | Path to the client's TLS certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `cert.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_cert, cert\_path | | **client\_key** path | | Path to the client's TLS key file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `key.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_key, key\_path | | **debug** boolean | **Choices:*** **no** ← * yes | Debug mode | | **docker\_host** string | **Default:**"unix://var/run/docker.sock" | The URL or Unix socket path used to connect to the Docker API. To connect to a remote host, provide the TCP connection string. For example, `tcp://192.0.2.23:2376`. If TLS is used to encrypt the connection, the module will automatically replace `tcp` in the connection URL with `https`. If the value is not specified in the task, the value of environment variable `DOCKER_HOST` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_url | | **nodes** boolean | **Choices:*** **no** ← * yes | Whether to list swarm nodes. | | **nodes\_filters** dictionary | | A dictionary of filter values used for selecting nodes to list. For example, `name: mynode`. See [the docker documentation](https://docs.docker.com/engine/reference/commandline/node_ls/#filtering) for more information on possible filters. | | **services** boolean | **Choices:*** **no** ← * yes | Whether to list swarm services. | | **services\_filters** dictionary | | A dictionary of filter values used for selecting services to list. For example, `name: myservice`. See [the docker documentation](https://docs.docker.com/engine/reference/commandline/service_ls/#filtering) for more information on possible filters. | | **ssl\_version** string | | Provide a valid SSL version number. Default value determined by ssl.py module. If the value is not specified in the task, the value of environment variable `DOCKER_SSL_VERSION` will be used instead. | | **tasks** boolean | **Choices:*** **no** ← * yes | Whether to list containers. | | **tasks\_filters** dictionary | | A dictionary of filter values used for selecting tasks to list. For example, `node: mynode-1`. See [the docker documentation](https://docs.docker.com/engine/reference/commandline/service_ps/#filtering) for more information on possible filters. | | **timeout** integer | **Default:**60 | The maximum amount of time in seconds to wait on a response from the API. If the value is not specified in the task, the value of environment variable `DOCKER_TIMEOUT` will be used instead. If the environment variable is not set, the default value will be used. | | **tls** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS without verifying the authenticity of the Docker host server. Note that if *validate\_certs* is set to `yes` as well, it will take precedence. If the value is not specified in the task, the value of environment variable `DOCKER_TLS` will be used instead. If the environment variable is not set, the default value will be used. | | **tls\_hostname** string | | When verifying the authenticity of the Docker Host server, provide the expected name of the server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_HOSTNAME` will be used instead. If the environment variable is not set, the default value will be used. The current default value is `localhost`. This default is deprecated and will change in community.docker 2.0.0 to be a value computed from *docker\_host*. Explicitly specify `localhost` to make sure this value will still be used, and to disable the deprecation message which will be shown otherwise. | | **unlock\_key** boolean | **Choices:*** **no** ← * yes | Whether to retrieve the swarm unlock key. | | **use\_ssh\_client** boolean added in 1.5.0 of community.docker | **Choices:*** **no** ← * yes | For SSH transports, use the `ssh` CLI tool instead of paramiko. Requires Docker SDK for Python 4.4.0 or newer. | | **validate\_certs** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS and verifying the authenticity of the Docker host server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_VERIFY` will be used instead. If the environment variable is not set, the default value will be used. aliases: tls\_verify | | **verbose\_output** boolean | **Choices:*** **no** ← * yes | When set to `yes` and *nodes*, *services* or *tasks* is set to `yes`, then the module output will contain verbose information about objects matching the full output of API method. For details see the documentation of your version of Docker API at <https://docs.docker.com/engine/api/>. The verbose output in this module contains only subset of information returned by *\_info* module for each type of the objects. | Notes ----- Note * Connect to the Docker daemon by providing parameters with each task or by defining environment variables. You can define `DOCKER_HOST`, `DOCKER_TLS_HOSTNAME`, `DOCKER_API_VERSION`, `DOCKER_CERT_PATH`, `DOCKER_SSL_VERSION`, `DOCKER_TLS`, `DOCKER_TLS_VERIFY` and `DOCKER_TIMEOUT`. If you are using docker machine, run the script shipped with the product that sets up the environment. It will set these variables for you. See <https://docs.docker.com/machine/reference/env/> for more details. * When connecting to Docker daemon with TLS, you might need to install additional Python packages. For the Docker SDK for Python, version 2.4 or newer, this can be done by installing `docker[tls]` with [ansible.builtin.pip](../../ansible/builtin/pip_module#ansible-collections-ansible-builtin-pip-module). * Note that the Docker SDK for Python only allows to specify the path to the Docker configuration for very few functions. In general, it will use `$HOME/.docker/config.json` if the `DOCKER_CONFIG` environment variable is not specified, and use `$DOCKER_CONFIG/config.json` otherwise. * This module uses the [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) to communicate with the Docker daemon. Examples -------- ``` - name: Get info on Docker Swarm community.docker.docker_swarm_info: ignore_errors: yes register: result - name: Inform about basic flags ansible.builtin.debug: msg: | Was able to talk to docker daemon: {{ result.can_talk_to_docker }} Docker in Swarm mode: {{ result.docker_swarm_active }} This is a Manager node: {{ result.docker_swarm_manager }} - block: - name: Get info on Docker Swarm and list of registered nodes community.docker.docker_swarm_info: nodes: yes register: result - name: Get info on Docker Swarm and extended list of registered nodes community.docker.docker_swarm_info: nodes: yes verbose_output: yes register: result - name: Get info on Docker Swarm and filtered list of registered nodes community.docker.docker_swarm_info: nodes: yes nodes_filters: name: mynode register: result - ansible.builtin.debug: var: result.swarm_facts - name: Get the swarm unlock key community.docker.docker_swarm_info: unlock_key: yes register: result - ansible.builtin.debug: var: result.swarm_unlock_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 | | --- | --- | --- | | **can\_talk\_to\_docker** boolean | both on success and on error | Will be `true` if the module can talk to the docker daemon. | | **docker\_swarm\_active** boolean | both on success and on error | Will be `true` if the module can talk to the docker daemon, and the docker daemon is in Swarm mode. | | **docker\_swarm\_manager** boolean | both on success and on error | Will be `true` if the module can talk to the docker daemon, the docker daemon is in Swarm mode, and the current node is a manager node. Only if this one is `true`, the module will not fail. | | **nodes** list / elements=dictionary | When *nodes* is `yes` | List of dict objects containing the basic information about each volume. Keys matches the `docker node ls` output unless *verbose\_output=yes*. See description for *verbose\_output*. | | **services** list / elements=dictionary | When *services* is `yes` | List of dict objects containing the basic information about each volume. Keys matches the `docker service ls` output unless *verbose\_output=yes*. See description for *verbose\_output*. | | **swarm\_facts** dictionary | always | Facts representing the basic state of the docker Swarm cluster. Contains tokens to connect to the Swarm | | **swarm\_unlock\_key** string | When *unlock\_key* is `true`. | Contains the key needed to unlock the swarm. | | **tasks** list / elements=dictionary | When *tasks* is `yes` | List of dict objects containing the basic information about each volume. Keys matches the `docker service ps` output unless *verbose\_output=yes*. See description for *verbose\_output*. | ### Authors * Piotr Wojciechowski (@WojciechowskiPiotr)
programming_docs
ansible community.docker.docker_image_load – Load docker image(s) from archives community.docker.docker\_image\_load – Load docker image(s) from archives ========================================================================= Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_image_load`. New in version 1.3.0: of community.docker * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Load one or multiple Docker images from a `.tar` archive, and return information on the loaded image(s). Requirements ------------ The below requirements are needed on the host that executes this module. * Docker API >= 1.23 * Docker SDK for Python: Please note that the [docker-py](https://pypi.org/project/docker-py/) Python module has been superseded by [docker](https://pypi.org/project/docker/) (see [here](https://github.com/docker/docker-py/issues/1310) for details). This module does *not* work with docker-py. * [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) >= 2.5.0 * Python >= 2.7 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **api\_version** string | **Default:**"auto" | The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported by Docker SDK for Python and the docker daemon. If the value is not specified in the task, the value of environment variable `DOCKER_API_VERSION` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_api\_version | | **ca\_cert** path | | Use a CA certificate when performing server verification by providing the path to a CA certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `ca.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_ca\_cert, cacert\_path | | **client\_cert** path | | Path to the client's TLS certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `cert.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_cert, cert\_path | | **client\_key** path | | Path to the client's TLS key file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `key.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_key, key\_path | | **debug** boolean | **Choices:*** **no** ← * yes | Debug mode | | **docker\_host** string | **Default:**"unix://var/run/docker.sock" | The URL or Unix socket path used to connect to the Docker API. To connect to a remote host, provide the TCP connection string. For example, `tcp://192.0.2.23:2376`. If TLS is used to encrypt the connection, the module will automatically replace `tcp` in the connection URL with `https`. If the value is not specified in the task, the value of environment variable `DOCKER_HOST` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_url | | **path** path / required | | The path to the `.tar` archive to load Docker image(s) from. | | **ssl\_version** string | | Provide a valid SSL version number. Default value determined by ssl.py module. If the value is not specified in the task, the value of environment variable `DOCKER_SSL_VERSION` will be used instead. | | **timeout** integer | **Default:**60 | The maximum amount of time in seconds to wait on a response from the API. If the value is not specified in the task, the value of environment variable `DOCKER_TIMEOUT` will be used instead. If the environment variable is not set, the default value will be used. | | **tls** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS without verifying the authenticity of the Docker host server. Note that if *validate\_certs* is set to `yes` as well, it will take precedence. If the value is not specified in the task, the value of environment variable `DOCKER_TLS` will be used instead. If the environment variable is not set, the default value will be used. | | **tls\_hostname** string | | When verifying the authenticity of the Docker Host server, provide the expected name of the server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_HOSTNAME` will be used instead. If the environment variable is not set, the default value will be used. The current default value is `localhost`. This default is deprecated and will change in community.docker 2.0.0 to be a value computed from *docker\_host*. Explicitly specify `localhost` to make sure this value will still be used, and to disable the deprecation message which will be shown otherwise. | | **use\_ssh\_client** boolean added in 1.5.0 of community.docker | **Choices:*** **no** ← * yes | For SSH transports, use the `ssh` CLI tool instead of paramiko. Requires Docker SDK for Python 4.4.0 or newer. | | **validate\_certs** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS and verifying the authenticity of the Docker host server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_VERIFY` will be used instead. If the environment variable is not set, the default value will be used. aliases: tls\_verify | Notes ----- Note * Does not support `check_mode`. * Connect to the Docker daemon by providing parameters with each task or by defining environment variables. You can define `DOCKER_HOST`, `DOCKER_TLS_HOSTNAME`, `DOCKER_API_VERSION`, `DOCKER_CERT_PATH`, `DOCKER_SSL_VERSION`, `DOCKER_TLS`, `DOCKER_TLS_VERIFY` and `DOCKER_TIMEOUT`. If you are using docker machine, run the script shipped with the product that sets up the environment. It will set these variables for you. See <https://docs.docker.com/machine/reference/env/> for more details. * When connecting to Docker daemon with TLS, you might need to install additional Python packages. For the Docker SDK for Python, version 2.4 or newer, this can be done by installing `docker[tls]` with [ansible.builtin.pip](../../ansible/builtin/pip_module#ansible-collections-ansible-builtin-pip-module). * Note that the Docker SDK for Python only allows to specify the path to the Docker configuration for very few functions. In general, it will use `$HOME/.docker/config.json` if the `DOCKER_CONFIG` environment variable is not specified, and use `$DOCKER_CONFIG/config.json` otherwise. * This module uses the [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) to communicate with the Docker daemon. Examples -------- ``` - name: Load all image(s) from the given tar file community.docker.docker_image_load: path: /path/to/images.tar register: result - name: Print the loaded image names ansible.builtin.debug: msg: "Loaded the following images: {{ result.image_names | join(', ') }}" ``` 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 | | --- | --- | --- | | **image\_names** list / elements=string | success | List of image names and IDs loaded from the archive. **Sample:** ['hello-world:latest', 'sha256:e004c2cc521c95383aebb1fb5893719aa7a8eae2e7a71f316a4410784edb00a9'] | | **images** list / elements=dictionary | success | Image inspection results for the loaded images. | ### Authors * Felix Fontein (@felixfontein) ansible community.docker.docker_stack_info – Return information on a docker stack community.docker.docker\_stack\_info – Return information on a docker stack =========================================================================== Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_stack_info`. * [Synopsis](#synopsis) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Retrieve information on docker stacks using the `docker stack` command on the target node (see examples). Examples -------- ``` - name: Shows stack info community.docker.docker_stack_info: register: result - name: Show results ansible.builtin.debug: var: result.results ``` 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** list / elements=string | always | List of dictionaries containing the list of stacks or tasks associated to a stack name. **Sample:** "results": [{"name":"grafana","namespace":"default","orchestrator":"Kubernetes","services":"2"}] | ### Authors * Jose Angel Munoz (@imjoseangel) ansible community.docker.docker_node – Manage Docker Swarm node community.docker.docker\_node – Manage Docker Swarm node ======================================================== Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_node`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Manages the Docker nodes via Swarm Manager. * This module allows to change the node’s role, its availability, and to modify, add or remove node labels. Requirements ------------ The below requirements are needed on the host that executes this module. * Docker API >= 1.25 * Docker SDK for Python: Please note that the [docker-py](https://pypi.org/project/docker-py/) Python module has been superseded by [docker](https://pypi.org/project/docker/) (see [here](https://github.com/docker/docker-py/issues/1310) for details). For Python 2.6, `docker-py` must be used. Otherwise, it is recommended to install the `docker` Python module. Note that both modules should *not* be installed at the same time. Also note that when both modules are installed and one of them is uninstalled, the other might no longer function and a reinstall of it is required. * [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) >= 2.4.0 Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **api\_version** string | **Default:**"auto" | The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported by Docker SDK for Python and the docker daemon. If the value is not specified in the task, the value of environment variable `DOCKER_API_VERSION` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_api\_version | | **availability** string | **Choices:*** active * pause * drain | Node availability to assign. If not provided then node availability remains unchanged. | | **ca\_cert** path | | Use a CA certificate when performing server verification by providing the path to a CA certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `ca.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_ca\_cert, cacert\_path | | **client\_cert** path | | Path to the client's TLS certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `cert.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_cert, cert\_path | | **client\_key** path | | Path to the client's TLS key file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `key.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_key, key\_path | | **debug** boolean | **Choices:*** **no** ← * yes | Debug mode | | **docker\_host** string | **Default:**"unix://var/run/docker.sock" | The URL or Unix socket path used to connect to the Docker API. To connect to a remote host, provide the TCP connection string. For example, `tcp://192.0.2.23:2376`. If TLS is used to encrypt the connection, the module will automatically replace `tcp` in the connection URL with `https`. If the value is not specified in the task, the value of environment variable `DOCKER_HOST` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_url | | **hostname** string / required | | The hostname or ID of node as registered in Swarm. If more than one node is registered using the same hostname the ID must be used, otherwise module will fail. | | **labels** dictionary | | User-defined key/value metadata that will be assigned as node attribute. Label operations in this module apply to the docker swarm node specified by *hostname*. Use [community.docker.docker\_swarm](docker_swarm_module) module to add/modify/remove swarm cluster labels. The actual state of labels assigned to the node when module completes its work depends on *labels\_state* and *labels\_to\_remove* parameters values. See description below. | | **labels\_state** string | **Choices:*** **merge** ← * replace | It defines the operation on the labels assigned to node and labels specified in *labels* option. Set to `merge` to combine labels provided in *labels* with those already assigned to the node. If no labels are assigned then it will add listed labels. For labels that are already assigned to the node, it will update their values. The labels not specified in *labels* will remain unchanged. If *labels* is empty then no changes will be made. Set to `replace` to replace all assigned labels with provided ones. If *labels* is empty then all labels assigned to the node will be removed. | | **labels\_to\_remove** list / elements=string | | List of labels that will be removed from the node configuration. The list has to contain only label names, not their values. If the label provided on the list is not assigned to the node, the entry is ignored. If the label is both on the *labels\_to\_remove* and *labels*, then value provided in *labels* remains assigned to the node. If *labels\_state* is `replace` and *labels* is not provided or empty then all labels assigned to node are removed and *labels\_to\_remove* is ignored. | | **role** string | **Choices:*** manager * worker | Node role to assign. If not provided then node role remains unchanged. | | **ssl\_version** string | | Provide a valid SSL version number. Default value determined by ssl.py module. If the value is not specified in the task, the value of environment variable `DOCKER_SSL_VERSION` will be used instead. | | **timeout** integer | **Default:**60 | The maximum amount of time in seconds to wait on a response from the API. If the value is not specified in the task, the value of environment variable `DOCKER_TIMEOUT` will be used instead. If the environment variable is not set, the default value will be used. | | **tls** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS without verifying the authenticity of the Docker host server. Note that if *validate\_certs* is set to `yes` as well, it will take precedence. If the value is not specified in the task, the value of environment variable `DOCKER_TLS` will be used instead. If the environment variable is not set, the default value will be used. | | **tls\_hostname** string | | When verifying the authenticity of the Docker Host server, provide the expected name of the server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_HOSTNAME` will be used instead. If the environment variable is not set, the default value will be used. The current default value is `localhost`. This default is deprecated and will change in community.docker 2.0.0 to be a value computed from *docker\_host*. Explicitly specify `localhost` to make sure this value will still be used, and to disable the deprecation message which will be shown otherwise. | | **use\_ssh\_client** boolean added in 1.5.0 of community.docker | **Choices:*** **no** ← * yes | For SSH transports, use the `ssh` CLI tool instead of paramiko. Requires Docker SDK for Python 4.4.0 or newer. | | **validate\_certs** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS and verifying the authenticity of the Docker host server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_VERIFY` will be used instead. If the environment variable is not set, the default value will be used. aliases: tls\_verify | Notes ----- Note * Connect to the Docker daemon by providing parameters with each task or by defining environment variables. You can define `DOCKER_HOST`, `DOCKER_TLS_HOSTNAME`, `DOCKER_API_VERSION`, `DOCKER_CERT_PATH`, `DOCKER_SSL_VERSION`, `DOCKER_TLS`, `DOCKER_TLS_VERIFY` and `DOCKER_TIMEOUT`. If you are using docker machine, run the script shipped with the product that sets up the environment. It will set these variables for you. See <https://docs.docker.com/machine/reference/env/> for more details. * When connecting to Docker daemon with TLS, you might need to install additional Python packages. For the Docker SDK for Python, version 2.4 or newer, this can be done by installing `docker[tls]` with [ansible.builtin.pip](../../ansible/builtin/pip_module#ansible-collections-ansible-builtin-pip-module). * Note that the Docker SDK for Python only allows to specify the path to the Docker configuration for very few functions. In general, it will use `$HOME/.docker/config.json` if the `DOCKER_CONFIG` environment variable is not specified, and use `$DOCKER_CONFIG/config.json` otherwise. * This module uses the [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) to communicate with the Docker daemon. Examples -------- ``` - name: Set node role community.docker.docker_node: hostname: mynode role: manager - name: Set node availability community.docker.docker_node: hostname: mynode availability: drain - name: Replace node labels with new labels community.docker.docker_node: hostname: mynode labels: key: value labels_state: replace - name: Merge node labels and new labels community.docker.docker_node: hostname: mynode labels: key: value - name: Remove all labels assigned to node community.docker.docker_node: hostname: mynode labels_state: replace - name: Remove selected labels from the node community.docker.docker_node: hostname: mynode labels_to_remove: - key1 - key2 ``` 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 | | --- | --- | --- | | **node** dictionary | success | Information about node after 'update' operation | ### Authors * Piotr Wojciechowski (@WojciechowskiPiotr) * Thierry Bouvet (@tbouvet)
programming_docs
ansible community.docker.docker_swarm – Manage Swarm cluster community.docker.docker\_swarm – Manage Swarm cluster ===================================================== Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_swarm`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Create a new Swarm cluster. * Add/Remove nodes or managers to an existing cluster. Requirements ------------ The below requirements are needed on the host that executes this module. * Docker API >= 1.25 * Docker SDK for Python: Please note that the [docker-py](https://pypi.org/project/docker-py/) Python module has been superseded by [docker](https://pypi.org/project/docker/) (see [here](https://github.com/docker/docker-py/issues/1310) for details). For Python 2.6, `docker-py` must be used. Otherwise, it is recommended to install the `docker` Python module. Note that both modules should *not* be installed at the same time. Also note that when both modules are installed and one of them is uninstalled, the other might no longer function and a reinstall of it is required. * [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) >= 1.10.0 (use [docker-py](https://pypi.org/project/docker-py/) for Python 2.6) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **advertise\_addr** string | | Externally reachable address advertised to other nodes. This can either be an address/port combination in the form `192.168.1.1:4567`, or an interface followed by a port number, like `eth0:4567`. If the port number is omitted, the port number from the listen address is used. If *advertise\_addr* is not specified, it will be automatically detected when possible. Only used when swarm is initialised or joined. Because of this it's not considered for idempotency checking. | | **api\_version** string | **Default:**"auto" | The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported by Docker SDK for Python and the docker daemon. If the value is not specified in the task, the value of environment variable `DOCKER_API_VERSION` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_api\_version | | **autolock\_managers** boolean | **Choices:*** no * yes | If set, generate a key and use it to lock data stored on the managers. Docker default value is `no`. [community.docker.docker\_swarm\_info](docker_swarm_info_module) can be used to retrieve the unlock key. | | **ca\_cert** path | | Use a CA certificate when performing server verification by providing the path to a CA certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `ca.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_ca\_cert, cacert\_path | | **ca\_force\_rotate** integer | | An integer whose purpose is to force swarm to generate a new signing CA certificate and key, if none have been specified. Docker default value is `0`. Requires API version >= 1.30. | | **client\_cert** path | | Path to the client's TLS certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `cert.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_cert, cert\_path | | **client\_key** path | | Path to the client's TLS key file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `key.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_key, key\_path | | **debug** boolean | **Choices:*** **no** ← * yes | Debug mode | | **default\_addr\_pool** list / elements=string | | Default address pool in CIDR format. Only used when swarm is initialised. Because of this it's not considered for idempotency checking. Requires API version >= 1.39. | | **dispatcher\_heartbeat\_period** integer | | The delay for an agent to send a heartbeat to the dispatcher. Docker default value is `5s`. | | **docker\_host** string | **Default:**"unix://var/run/docker.sock" | The URL or Unix socket path used to connect to the Docker API. To connect to a remote host, provide the TCP connection string. For example, `tcp://192.0.2.23:2376`. If TLS is used to encrypt the connection, the module will automatically replace `tcp` in the connection URL with `https`. If the value is not specified in the task, the value of environment variable `DOCKER_HOST` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_url | | **election\_tick** integer | | Amount of ticks (in seconds) needed without a leader to trigger a new election. Docker default value is `10s`. | | **force** boolean | **Choices:*** **no** ← * yes | Use with state `present` to force creating a new Swarm, even if already part of one. Use with state `absent` to Leave the swarm even if this node is a manager. | | **heartbeat\_tick** integer | | Amount of ticks (in seconds) between each heartbeat. Docker default value is `1s`. | | **join\_token** string | | Swarm token used to join a swarm cluster. Used with *state=join*. If this value is specified, the corresponding value in the return values will be censored by Ansible. This is a side-effect of this value not being logged. | | **keep\_old\_snapshots** integer | | Number of snapshots to keep beyond the current snapshot. Docker default value is `0`. | | **labels** dictionary | | User-defined key/value metadata. Label operations in this module apply to the docker swarm cluster. Use [community.docker.docker\_node](docker_node_module) module to add/modify/remove swarm node labels. Requires API version >= 1.32. | | **listen\_addr** string | **Default:**"0.0.0.0:2377" | Listen address used for inter-manager communication. This can either be an address/port combination in the form `192.168.1.1:4567`, or an interface followed by a port number, like `eth0:4567`. If the port number is omitted, the default swarm listening port is used. Only used when swarm is initialised or joined. Because of this it's not considered for idempotency checking. | | **log\_entries\_for\_slow\_followers** integer | | Number of log entries to keep around to sync up slow followers after a snapshot is created. | | **name** string | | The name of the swarm. | | **node\_cert\_expiry** integer | | Automatic expiry for nodes certificates. Docker default value is `3months`. | | **node\_id** string | | Swarm id of the node to remove. Used with *state=remove*. | | **remote\_addrs** list / elements=string | | Remote address of one or more manager nodes of an existing Swarm to connect to. Used with *state=join*. | | **rotate\_manager\_token** boolean | **Choices:*** **no** ← * yes | Rotate the manager join token. | | **rotate\_worker\_token** boolean | **Choices:*** **no** ← * yes | Rotate the worker join token. | | **signing\_ca\_cert** string | | The desired signing CA certificate for all swarm node TLS leaf certificates, in PEM format. This must not be a path to a certificate, but the contents of the certificate. Requires API version >= 1.30. | | **signing\_ca\_key** string | | The desired signing CA key for all swarm node TLS leaf certificates, in PEM format. This must not be a path to a key, but the contents of the key. Requires API version >= 1.30. | | **snapshot\_interval** integer | | Number of logs entries between snapshot. Docker default value is `10000`. | | **ssl\_version** string | | Provide a valid SSL version number. Default value determined by ssl.py module. If the value is not specified in the task, the value of environment variable `DOCKER_SSL_VERSION` will be used instead. | | **state** string | **Choices:*** **present** ← * join * absent * remove | Set to `present`, to create/update a new cluster. Set to `join`, to join an existing cluster. Set to `absent`, to leave an existing cluster. Set to `remove`, to remove an absent node from the cluster. Note that removing requires Docker SDK for Python >= 2.4.0. | | **subnet\_size** integer | | Default address pool subnet mask length. Only used when swarm is initialised. Because of this it's not considered for idempotency checking. Requires API version >= 1.39. | | **task\_history\_retention\_limit** integer | | Maximum number of tasks history stored. Docker default value is `5`. | | **timeout** integer | **Default:**60 | The maximum amount of time in seconds to wait on a response from the API. If the value is not specified in the task, the value of environment variable `DOCKER_TIMEOUT` will be used instead. If the environment variable is not set, the default value will be used. | | **tls** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS without verifying the authenticity of the Docker host server. Note that if *validate\_certs* is set to `yes` as well, it will take precedence. If the value is not specified in the task, the value of environment variable `DOCKER_TLS` will be used instead. If the environment variable is not set, the default value will be used. | | **tls\_hostname** string | | When verifying the authenticity of the Docker Host server, provide the expected name of the server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_HOSTNAME` will be used instead. If the environment variable is not set, the default value will be used. The current default value is `localhost`. This default is deprecated and will change in community.docker 2.0.0 to be a value computed from *docker\_host*. Explicitly specify `localhost` to make sure this value will still be used, and to disable the deprecation message which will be shown otherwise. | | **use\_ssh\_client** boolean added in 1.5.0 of community.docker | **Choices:*** **no** ← * yes | For SSH transports, use the `ssh` CLI tool instead of paramiko. Requires Docker SDK for Python 4.4.0 or newer. | | **validate\_certs** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS and verifying the authenticity of the Docker host server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_VERIFY` will be used instead. If the environment variable is not set, the default value will be used. aliases: tls\_verify | Notes ----- Note * Connect to the Docker daemon by providing parameters with each task or by defining environment variables. You can define `DOCKER_HOST`, `DOCKER_TLS_HOSTNAME`, `DOCKER_API_VERSION`, `DOCKER_CERT_PATH`, `DOCKER_SSL_VERSION`, `DOCKER_TLS`, `DOCKER_TLS_VERIFY` and `DOCKER_TIMEOUT`. If you are using docker machine, run the script shipped with the product that sets up the environment. It will set these variables for you. See <https://docs.docker.com/machine/reference/env/> for more details. * When connecting to Docker daemon with TLS, you might need to install additional Python packages. For the Docker SDK for Python, version 2.4 or newer, this can be done by installing `docker[tls]` with [ansible.builtin.pip](../../ansible/builtin/pip_module#ansible-collections-ansible-builtin-pip-module). * Note that the Docker SDK for Python only allows to specify the path to the Docker configuration for very few functions. In general, it will use `$HOME/.docker/config.json` if the `DOCKER_CONFIG` environment variable is not specified, and use `$DOCKER_CONFIG/config.json` otherwise. * This module uses the [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) to communicate with the Docker daemon. Examples -------- ``` - name: Init a new swarm with default parameters community.docker.docker_swarm: state: present - name: Update swarm configuration community.docker.docker_swarm: state: present election_tick: 5 - name: Add nodes community.docker.docker_swarm: state: join advertise_addr: 192.168.1.2 join_token: SWMTKN-1--xxxxx remote_addrs: [ '192.168.1.1:2377' ] - name: Leave swarm for a node community.docker.docker_swarm: state: absent - name: Remove a swarm manager community.docker.docker_swarm: state: absent force: true - name: Remove node from swarm community.docker.docker_swarm: state: remove node_id: mynode ``` 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 | when action failed. | Provides the actions done on the swarm. **Sample:** ['This cluster is already a swarm cluster'] | | **swarm\_facts** dictionary | success | Informations about swarm. | | | **JoinTokens** dictionary | success | Tokens to connect to the Swarm. | | | | **Manager** string | success | Token to join the cluster as a new \*manager\* node. **Note:** if this value has been specified as *join\_token*, the value here will not be the token, but `VALUE_SPECIFIED_IN_NO_LOG_PARAMETER`. If you pass *join\_token*, make sure your playbook/role does not depend on this return value! **Sample:** SWMTKN-1--xxxxx | | | | **Worker** string | success | Token to join the cluster as a new \*worker\* node. **Note:** if this value has been specified as *join\_token*, the value here will not be the token, but `VALUE_SPECIFIED_IN_NO_LOG_PARAMETER`. If you pass *join\_token*, make sure your playbook/role does not depend on this return value! **Sample:** SWMTKN-1--xxxxx | | | **UnlockKey** string | on success if *autolock\_managers* is `true` and swarm is initialised, or if *autolock\_managers* has changed. | The swarm unlock-key if *autolock\_managers* is `true`. **Sample:** SWMKEY-1-xxx | ### Authors * Thierry Bouvet (@tbouvet) * Piotr Wojciechowski (@WojciechowskiPiotr) ansible community.docker.docker_image – Manage docker images community.docker.docker\_image – Manage docker images ===================================================== Note This plugin is part of the [community.docker collection](https://galaxy.ansible.com/community/docker) (version 1.10.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.docker`. To use it in a playbook, specify: `community.docker.docker_image`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Build, load or pull an image, making the image available for creating containers. Also supports tagging an image, pushing an image, and archiving an image to a `.tar` file. Requirements ------------ The below requirements are needed on the host that executes this module. * Docker API >= 1.20 * Docker SDK for Python: Please note that the [docker-py](https://pypi.org/project/docker-py/) Python module has been superseded by [docker](https://pypi.org/project/docker/) (see [here](https://github.com/docker/docker-py/issues/1310) for details). For Python 2.6, `docker-py` must be used. Otherwise, it is recommended to install the `docker` Python module. Note that both modules should *not* be installed at the same time. Also note that when both modules are installed and one of them is uninstalled, the other might no longer function and a reinstall of it is required. * [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) >= 1.8.0 (use [docker-py](https://pypi.org/project/docker-py/) for Python 2.6) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **api\_version** string | **Default:**"auto" | The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported by Docker SDK for Python and the docker daemon. If the value is not specified in the task, the value of environment variable `DOCKER_API_VERSION` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_api\_version | | **archive\_path** path | | Use with state `present` to archive an image to a .tar file. | | **build** dictionary | | Specifies options used for building images. | | | **args** dictionary | | Provide a dictionary of `key:value` build arguments that map to Dockerfile ARG directive. Docker expects the value to be a string. For convenience any non-string values will be converted to strings. Requires Docker API >= 1.21. | | | **cache\_from** list / elements=string | | List of image names to consider as cache source. | | | **container\_limits** dictionary | | A dictionary of limits applied to each container created by the build process. | | | | **cpusetcpus** string | | CPUs in which to allow execution, e.g., "0-3", "0,1". | | | | **cpushares** integer | | CPU shares (relative weight). | | | | **memory** integer | | Set memory limit for build. | | | | **memswap** integer | | Total memory (memory + swap), -1 to disable swap. | | | **dockerfile** string | | Use with state `present` and source `build` to provide an alternate name for the Dockerfile to use when building an image. This can also include a relative path (relative to *path*). | | | **etc\_hosts** dictionary | | Extra hosts to add to `/etc/hosts` in building containers, as a mapping of hostname to IP address. | | | **http\_timeout** integer | | Timeout for HTTP requests during the image build operation. Provide a positive integer value for the number of seconds. | | | **network** string | | The network to use for `RUN` build instructions. | | | **nocache** boolean | **Choices:*** **no** ← * yes | Do not use cache when building an image. | | | **path** path / required | | Use with state 'present' to build an image. Will be the path to a directory containing the context and Dockerfile for building an image. | | | **platform** string added in 1.1.0 of community.docker | | Platform in the format `os[/arch[/variant]]`. | | | **pull** boolean | **Choices:*** **no** ← * yes | When building an image downloads any updates to the FROM image in Dockerfile. | | | **rm** boolean | **Choices:*** no * **yes** ← | Remove intermediate containers after build. | | | **target** string | | When building an image specifies an intermediate build stage by name as a final stage for the resulting image. | | | **use\_config\_proxy** boolean | **Choices:*** no * yes | If set to `yes` and a proxy configuration is specified in the docker client configuration (by default `$HOME/.docker/config.json`), the corresponding environment variables will be set in the container being built. Needs Docker SDK for Python >= 3.7.0. | | **ca\_cert** path | | Use a CA certificate when performing server verification by providing the path to a CA certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `ca.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_ca\_cert, cacert\_path | | **client\_cert** path | | Path to the client's TLS certificate file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `cert.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_cert, cert\_path | | **client\_key** path | | Path to the client's TLS key file. If the value is not specified in the task and the environment variable `DOCKER_CERT_PATH` is set, the file `key.pem` from the directory specified in the environment variable `DOCKER_CERT_PATH` will be used. aliases: tls\_client\_key, key\_path | | **debug** boolean | **Choices:*** **no** ← * yes | Debug mode | | **docker\_host** string | **Default:**"unix://var/run/docker.sock" | The URL or Unix socket path used to connect to the Docker API. To connect to a remote host, provide the TCP connection string. For example, `tcp://192.0.2.23:2376`. If TLS is used to encrypt the connection, the module will automatically replace `tcp` in the connection URL with `https`. If the value is not specified in the task, the value of environment variable `DOCKER_HOST` will be used instead. If the environment variable is not set, the default value will be used. aliases: docker\_url | | **force\_absent** boolean | **Choices:*** **no** ← * yes | Use with state *absent* to un-tag and remove all images matching the specified name. | | **force\_source** boolean | **Choices:*** **no** ← * yes | Use with state `present` to build, load or pull an image (depending on the value of the *source* option) when the image already exists. | | **force\_tag** boolean | **Choices:*** **no** ← * yes | Use with state `present` to force tagging an image. | | **load\_path** path | | Use with state `present` to load an image from a .tar file. Set *source* to `load` if you want to load the image. | | **name** string / required | | Image name. Name format will be one of: `name`, `repository/name`, `registry_server:port/name`. When pushing or pulling an image the name can optionally include the tag by appending `:tag_name`. Note that image IDs (hashes) are only supported for *state=absent*, for *state=present* with *source=load*, and for *state=present* with *source=local*. | | **pull** dictionary added in 1.3.0 of community.docker | | Specifies options used for pulling images. | | | **platform** string | | When pulling an image, ask for this specific platform. Note that this value is not used to determine whether the image needs to be pulled. This might change in the future in a minor release, though. | | **push** boolean | **Choices:*** **no** ← * yes | Push the image to the registry. Specify the registry as part of the *name* or *repository* parameter. | | **repository** string | | Use with state `present` to tag the image. Expects format `repository:tag`. If no tag is provided, will use the value of the *tag* parameter or `latest`. If *push=true*, *repository* must either include a registry, or will be assumed to belong to the default registry (Docker Hub). | | **source** string | **Choices:*** build * load * pull * local | Determines where the module will try to retrieve the image from. Use `build` to build the image from a `Dockerfile`. *build.path* must be specified when this value is used. Use `load` to load the image from a `.tar` file. *load\_path* must be specified when this value is used. Use `pull` to pull the image from a registry. Use `local` to make sure that the image is already available on the local docker daemon, i.e. do not try to build, pull or load the image. | | **ssl\_version** string | | Provide a valid SSL version number. Default value determined by ssl.py module. If the value is not specified in the task, the value of environment variable `DOCKER_SSL_VERSION` will be used instead. | | **state** string | **Choices:*** absent * **present** ← | Make assertions about the state of an image. When `absent` an image will be removed. Use the force option to un-tag and remove all images matching the provided name. When `present` check if an image exists using the provided name and tag. If the image is not found or the force option is used, the image will either be pulled, built or loaded, depending on the *source* option. | | **tag** string | **Default:**"latest" | Used to select an image when pulling. Will be added to the image when pushing, tagging or building. Defaults to *latest*. If *name* parameter format is *name:tag*, then tag value from *name* will take precedence. | | **timeout** integer | **Default:**60 | The maximum amount of time in seconds to wait on a response from the API. If the value is not specified in the task, the value of environment variable `DOCKER_TIMEOUT` will be used instead. If the environment variable is not set, the default value will be used. | | **tls** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS without verifying the authenticity of the Docker host server. Note that if *validate\_certs* is set to `yes` as well, it will take precedence. If the value is not specified in the task, the value of environment variable `DOCKER_TLS` will be used instead. If the environment variable is not set, the default value will be used. | | **tls\_hostname** string | | When verifying the authenticity of the Docker Host server, provide the expected name of the server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_HOSTNAME` will be used instead. If the environment variable is not set, the default value will be used. The current default value is `localhost`. This default is deprecated and will change in community.docker 2.0.0 to be a value computed from *docker\_host*. Explicitly specify `localhost` to make sure this value will still be used, and to disable the deprecation message which will be shown otherwise. | | **use\_ssh\_client** boolean added in 1.5.0 of community.docker | **Choices:*** **no** ← * yes | For SSH transports, use the `ssh` CLI tool instead of paramiko. Requires Docker SDK for Python 4.4.0 or newer. | | **validate\_certs** boolean | **Choices:*** **no** ← * yes | Secure the connection to the API by using TLS and verifying the authenticity of the Docker host server. If the value is not specified in the task, the value of environment variable `DOCKER_TLS_VERIFY` will be used instead. If the environment variable is not set, the default value will be used. aliases: tls\_verify | Notes ----- Note * Connect to the Docker daemon by providing parameters with each task or by defining environment variables. You can define `DOCKER_HOST`, `DOCKER_TLS_HOSTNAME`, `DOCKER_API_VERSION`, `DOCKER_CERT_PATH`, `DOCKER_SSL_VERSION`, `DOCKER_TLS`, `DOCKER_TLS_VERIFY` and `DOCKER_TIMEOUT`. If you are using docker machine, run the script shipped with the product that sets up the environment. It will set these variables for you. See <https://docs.docker.com/machine/reference/env/> for more details. * When connecting to Docker daemon with TLS, you might need to install additional Python packages. For the Docker SDK for Python, version 2.4 or newer, this can be done by installing `docker[tls]` with [ansible.builtin.pip](../../ansible/builtin/pip_module#ansible-collections-ansible-builtin-pip-module). * Note that the Docker SDK for Python only allows to specify the path to the Docker configuration for very few functions. In general, it will use `$HOME/.docker/config.json` if the `DOCKER_CONFIG` environment variable is not specified, and use `$DOCKER_CONFIG/config.json` otherwise. * This module uses the [Docker SDK for Python](https://docker-py.readthedocs.io/en/stable/) to communicate with the Docker daemon. Examples -------- ``` - name: Pull an image community.docker.docker_image: name: pacur/centos-7 source: pull # Select platform for pulling. If not specified, will pull whatever docker prefers. pull: platform: amd64 - name: Tag and push to docker hub community.docker.docker_image: name: pacur/centos-7:56 repository: dcoppenhagan/myimage:7.56 push: yes source: local - name: Tag and push to local registry community.docker.docker_image: # Image will be centos:7 name: centos # Will be pushed to localhost:5000/centos:7 repository: localhost:5000/centos tag: 7 push: yes source: local - name: Add tag latest to image community.docker.docker_image: name: myimage:7.1.2 repository: myimage:latest # As 'latest' usually already is present, we need to enable overwriting of existing tags: force_tag: yes source: local - name: Remove image community.docker.docker_image: state: absent name: registry.ansible.com/chouseknecht/sinatra tag: v1 - name: Build an image and push it to a private repo community.docker.docker_image: build: path: ./sinatra name: registry.ansible.com/chouseknecht/sinatra tag: v1 push: yes source: build - name: Archive image community.docker.docker_image: name: registry.ansible.com/chouseknecht/sinatra tag: v1 archive_path: my_sinatra.tar source: local - name: Load image from archive and push to a private registry community.docker.docker_image: name: localhost:5000/myimages/sinatra tag: v1 push: yes load_path: my_sinatra.tar source: load - name: Build image and with build args community.docker.docker_image: name: myimage build: path: /path/to/build/dir args: log_volume: /var/log/myapp listen_port: 8080 source: build - name: Build image using cache source community.docker.docker_image: name: myimage:latest build: path: /path/to/build/dir # Use as cache source for building myimage cache_from: - nginx:latest - alpine:3.8 source: build ``` 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 | | --- | --- | --- | | **image** dictionary | success | Image inspection results for the affected image. | | **stdout** string added in 1.0.0 of community.docker | success | Docker build output when building an image. | ### Authors * Pavel Antonov (@softzilla) * Chris Houseknecht (@chouseknecht) * Sorin Sbarnea (@ssbarnea)
programming_docs
ansible Community.Routeros Community.Routeros ================== Collection version 1.2.0 Guides ------ * [How to connect to RouterOS devices with the RouterOS API](docsite/api-guide) * [How to connect to RouterOS devices with SSH](docsite/ssh-guide) Plugin Index ------------ These are the plugins in the community.routeros collection ### Cliconf Plugins * [routeros](routeros_cliconf#ansible-collections-community-routeros-routeros-cliconf) – Use routeros cliconf to run command on MikroTik RouterOS platform ### Modules * [api](api_module#ansible-collections-community-routeros-api-module) – Ansible module for RouterOS API * [command](command_module#ansible-collections-community-routeros-command-module) – Run commands on remote devices running MikroTik RouterOS * [facts](facts_module#ansible-collections-community-routeros-facts-module) – Collect facts from remote devices running MikroTik RouterOS See also List of [collections](../../index#list-of-collections) with docs hosted here. ansible community.routeros.api – Ansible module for RouterOS API community.routeros.api – Ansible module for RouterOS API ======================================================== Note This plugin is part of the [community.routeros collection](https://galaxy.ansible.com/community/routeros) (version 1.2.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.routeros`. To use it in a playbook, specify: `community.routeros.api`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Ansible module for RouterOS API with python librouteros. * This module can add, remove, update, query and execute arbitrary command in routeros via API. Requirements ------------ The below requirements are needed on the host that executes this module. * librouteros * Python >= 3.6 (for librouteros) Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **add** string | | Will add selected arguments in selected path to RouterOS config. Example `address=1.1.1.1/32 interface=ether1`. Equivalent in RouterOS CLI `/ip address add address=1.1.1.1/32 interface=ether1`. | | **ca\_path** path added in 1.2.0 of community.routeros | | PEM formatted file that contains a CA certificate to be used for certificate validation. See also *validate\_cert\_hostname*. Only used when *tls=true* and *validate\_certs=true*. | | **cmd** string | | Execute any/arbitrary command in selected path, after the command we can add `.id`. Example path `system script` and cmd `run .id=*03` is equivalent in RouterOS CLI `/system script run number=0`. Example path `ip address` and cmd `print` is equivalent in RouterOS CLI `/ip address print`. | | **hostname** string / required | | RouterOS hostname API. | | **password** string / required | | RouterOS user password. | | **path** string / required | | Main path for all other arguments. If other arguments are not set, api will return all items in selected path. Example `ip address`. Equivalent of RouterOS CLI `/ip address print`. | | **port** integer | | RouterOS api port. If *tls* is set, port will apply to TLS/SSL connection. Defaults are `8728` for the HTTP API, and `8729` for the HTTPS API. | | **query** string | | Query given path for selected query attributes from RouterOS aip and return '.id'. WHERE is key word which extend query. WHERE format is key operator value - with spaces. WHERE valid operators are `==`, `!=`, `>`, `<`. Example path `ip address` and query `.id address` will return only `.id` and `address` for all items in `ip address` path. Example path `ip address` and query `.id address WHERE address == 1.1.1.3/32`. will return only `.id` and `address` for items in `ip address` path, where address is eq to 1.1.1.3/32. Example path `interface` and query `mtu name WHERE mut > 1400` will return only interfaces `mtu,name` where mtu is bigger than 1400. Equivalent in RouterOS CLI `/interface print where mtu > 1400`. | | **remove** string | | Remove config/value from RouterOS by '.id'. Example `*03` will remove config/value with `id=*03` in selected path. Equivalent in RouterOS CLI `/ip address remove numbers=1`. Note `number` in RouterOS CLI is different from `.id`. | | **tls** boolean | **Choices:*** **no** ← * yes | If is set TLS will be used for RouterOS API connection. aliases: ssl | | **update** string | | Update config/value in RouterOS by '.id' in selected path. Example `.id=*03 address=1.1.1.3/32` and path `ip address` will replace existing ip address with `.id=*03`. Equivalent in RouterOS CLI `/ip address set address=1.1.1.3/32 numbers=1`. Note `number` in RouterOS CLI is different from `.id`. | | **username** string / required | | RouterOS login user. | | **validate\_cert\_hostname** boolean added in 1.2.0 of community.routeros | **Choices:*** **no** ← * yes | Set to `true` to validate hostnames in certificates. See also *validate\_certs*. Only used when *tls=true* and *validate\_certs=true*. | | **validate\_certs** boolean added in 1.2.0 of community.routeros | **Choices:*** no * **yes** ← | Set to `false` to skip validation of TLS certificates. See also *validate\_cert\_hostname*. Only used when *tls=true*. **Note:** instead of simply deactivating certificate validations to "make things work", please consider creating your own CA certificate and using it to sign certificates used for your router. You can tell the module about your CA certificate with the *ca\_path* option. | Notes ----- Note * *add*, *remove*, *update*, *cmd* and *query* are mutually exclusive. * *check\_mode* is not supported. Examples -------- ``` --- - name: Use RouterOS API hosts: localhost gather_facts: no vars: hostname: "ros_api_hostname/ip" username: "admin" password: "secret_password" path: "ip address" nic: "ether2" ip1: "1.1.1.1/32" ip2: "2.2.2.2/32" ip3: "3.3.3.3/32" tasks: - name: Get "{{ path }} print" community.routeros.api: hostname: "{{ hostname }}" password: "{{ password }}" username: "{{ username }}" path: "{{ path }}" register: print_path - name: Dump "{{ path }} print" output ansible.builtin.debug: msg: '{{ print_path }}' - name: Add ip address "{{ ip1 }}" and "{{ ip2 }}" community.routeros.api: hostname: "{{ hostname }}" password: "{{ password }}" username: "{{ username }}" path: "{{ path }}" add: "{{ item }}" loop: - "address={{ ip1 }} interface={{ nic }}" - "address={{ ip2 }} interface={{ nic }}" register: addout - name: Dump "Add ip address" output - ".id" for new added items ansible.builtin.debug: msg: '{{ addout }}' - name: Query for ".id" in "{{ path }} WHERE address == {{ ip2 }}" community.routeros.api: hostname: "{{ hostname }}" password: "{{ password }}" username: "{{ username }}" path: "{{ path }}" query: ".id address WHERE address == {{ ip2 }}" register: queryout - name: Dump "Query for" output and set fact with ".id" for "{{ ip2 }}" ansible.builtin.debug: msg: '{{ queryout }}' - name: Store query_id for later usage ansible.builtin.set_fact: query_id: "{{ queryout['msg'][0]['.id'] }}" - name: Update ".id = {{ query_id }}" taken with custom fact "fquery_id" community.routeros.api: hostname: "{{ hostname }}" password: "{{ password }}" username: "{{ username }}" path: "{{ path }}" update: ".id={{ query_id }} address={{ ip3 }}" register: updateout - name: Dump "Update" output ansible.builtin.debug: msg: '{{ updateout }}' - name: Remove ips - stage 1 - query ".id" for "{{ ip2 }}" and "{{ ip3 }}" community.routeros.api: hostname: "{{ hostname }}" password: "{{ password }}" username: "{{ username }}" path: "{{ path }}" query: ".id address WHERE address == {{ item }}" register: id_to_remove loop: - "{{ ip2 }}" - "{{ ip3 }}" - name: Set fact for ".id" from "Remove ips - stage 1 - query" ansible.builtin.set_fact: to_be_remove: "{{ to_be_remove |default([]) + [item['msg'][0]['.id']] }}" loop: "{{ id_to_remove.results }}" - name: Dump "Remove ips - stage 1 - query" output ansible.builtin.debug: msg: '{{ to_be_remove }}' # Remove "{{ rmips }}" with ".id" by "to_be_remove" from query - name: Remove ips - stage 2 - remove "{{ ip2 }}" and "{{ ip3 }}" by '.id' community.routeros.api: hostname: "{{ hostname }}" password: "{{ password }}" username: "{{ username }}" path: "{{ path }}" remove: "{{ item }}" register: remove loop: "{{ to_be_remove }}" - name: Dump "Remove ips - stage 2 - remove" output ansible.builtin.debug: msg: '{{ remove }}' - name: Arbitrary command example "/system identity print" community.routeros.api: hostname: "{{ hostname }}" password: "{{ password }}" username: "{{ username }}" path: "system identity" cmd: "print" register: cmdout - name: Dump "Arbitrary command example" output ansible.builtin.debug: msg: "{{ cmdout }}" ``` 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** list / elements=string | always | All outputs are in list with dictionary elements returned from RouterOS api. **Sample:** `[{...},{...}]` | ### Authors * Nikolay Dachev (@NikolayDachev) ansible community.routeros.facts – Collect facts from remote devices running MikroTik RouterOS community.routeros.facts – Collect facts from remote devices running MikroTik RouterOS ====================================================================================== Note This plugin is part of the [community.routeros collection](https://galaxy.ansible.com/community/routeros) (version 1.2.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.routeros`. To use it in a playbook, specify: `community.routeros.facts`. * [Synopsis](#synopsis) * [Parameters](#parameters) * [Examples](#examples) * [Returned Facts](#returned-facts) Synopsis -------- * Collects a base set of device facts from a remote device that is running RotuerOS. This module prepends all of the base network fact keys with `ansible_net_<fact>`. The facts module will always collect a base set of facts from the device and can enable or disable collection of additional facts. Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **gather\_subset** string | **Default:**"!config" | When supplied, this argument will restrict the facts collected to a given subset. Possible values for this argument include `all`, `hardware`, `config`, and `interfaces`. Can specify a list of values to include a larger subset. Values can also be used with an initial `!` to specify that a specific subset should not be collected. | Examples -------- ``` - name: Collect all facts from the device community.routeros.facts: gather_subset: all - name: Collect only the config and default facts community.routeros.facts: gather_subset: - config - name: Do not collect hardware facts community.routeros.facts: gather_subset: - "!hardware" ``` 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\_net\_all\_ipv4\_addresses** list / elements=string | when interfaces is configured | All IPv4 addresses configured on the device | | **ansible\_net\_all\_ipv6\_addresses** list / elements=string | when interfaces is configured | All IPv6 addresses configured on the device | | **ansible\_net\_arch** string / elements=string | always | The CPU architecture of the device | | **ansible\_net\_bgp\_instance** dictionary / elements=string | bgp instance information | The dict bgp instance | | **ansible\_net\_bgp\_peer** dictionary / elements=string | peer information | The dict bgp peer | | **ansible\_net\_bgp\_vpnv4\_route** dictionary / elements=string | vpnv4 route information | The dict bgp vpnv4 route | | **ansible\_net\_config** string / elements=string | when config is configured | The current active config from the device | | **ansible\_net\_config\_nonverbose** string / elements=string added in 1.2.0 of community.routeros | when config is configured | The current active config from the device in minimal form. This value is idempotent in the sense that if the facts module is run twice and the device's config was not changed between the runs, the value is identical. This is achieved by running `/export` and stripping the timestamp from the comment in the first line. | | **ansible\_net\_cpu\_load** string / elements=string | always | Current CPU load | | **ansible\_net\_gather\_subset** list / elements=string | always | The list of fact subsets collected from the device | | **ansible\_net\_hostname** string / elements=string | always | The configured hostname of the device | | **ansible\_net\_interfaces** dictionary / elements=string | when interfaces is configured | A hash of all interfaces running on the system | | **ansible\_net\_memfree\_mb** integer / elements=string | when hardware is configured | The available free memory on the remote device in MiB | | **ansible\_net\_memtotal\_mb** integer / elements=string | when hardware is configured | The total memory on the remote device in MiB | | **ansible\_net\_model** string / elements=string | always | The model name returned from the device | | **ansible\_net\_neighbors** dictionary / elements=string | when interfaces is configured | The list of neighbors from the remote device | | **ansible\_net\_ospf\_instance** dictionary / elements=string | ospf instance information | The dict ospf instance | | **ansible\_net\_ospf\_neighbor** dictionary / elements=string | ospf neighbor information | The dict ospf neighbor | | **ansible\_net\_route** dictionary / elements=string | routes information in all routing table | The dict routes in all routing table | | **ansible\_net\_serialnum** string / elements=string | always | The serial number of the remote device | | **ansible\_net\_spacefree\_mb** dictionary / elements=string | when hardware is configured | The available disk space on the remote device in MiB | | **ansible\_net\_spacetotal\_mb** dictionary / elements=string | when hardware is configured | The total disk space on the remote device in MiB | | **ansible\_net\_uptime** string / elements=string | always | The uptime of the device | | **ansible\_net\_version** string / elements=string | always | The operating system version running on the remote device | ### Authors * Egor Zaitsev (@heuels) ansible community.routeros.command – Run commands on remote devices running MikroTik RouterOS community.routeros.command – Run commands on remote devices running MikroTik RouterOS ===================================================================================== Note This plugin is part of the [community.routeros collection](https://galaxy.ansible.com/community/routeros) (version 1.2.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.routeros`. To use it in a playbook, specify: `community.routeros.command`. * [Synopsis](#synopsis) * [Parameters](#parameters) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Sends arbitrary commands to an RouterOS node and returns the results read from the device. This module includes an argument that will cause the module to wait for a specific condition before returning or timing out if the condition is not met. Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **commands** string / required | | List of commands to send to the remote RouterOS device over the configured provider. The resulting output from the command is returned. If the *wait\_for* argument is provided, the module is not returned until the condition is satisfied or the number of retries has expired. | | **interval** string | **Default:**1 | Configures the interval in seconds to wait between retries of the command. If the command does not pass the specified conditions, the interval indicates how long to wait before trying the command again. | | **match** string | **Choices:*** any * **all** ← | The *match* argument is used in conjunction with the *wait\_for* argument to specify the match policy. Valid values are `all` or `any`. If the value is set to `all` then all conditionals in the wait\_for must be satisfied. If the value is set to `any` then only one of the values must be satisfied. | | **retries** string | **Default:**10 | Specifies the number of retries a command should by tried before it is considered failed. The command is run on the target device every retry and evaluated against the *wait\_for* conditions. | | **wait\_for** string | | List of conditions to evaluate against the output of the command. The task will wait for each condition to be true before moving forward. If the conditional is not true within the configured number of retries, the task fails. See examples. | Examples -------- ``` - name: Run command on remote devices community.routeros.command: commands: /system routerboard print - name: Run command and check to see if output contains routeros community.routeros.command: commands: /system resource print wait_for: result[0] contains MikroTik - name: Run multiple commands on remote nodes community.routeros.command: commands: - /system routerboard print - /system identity print - name: Run multiple commands and evaluate the output community.routeros.command: commands: - /system routerboard print - /interface ethernet print wait_for: - result[0] contains x86 - result[1] contains ether1 ``` 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 | | --- | --- | --- | | **failed\_conditions** list / elements=string | failed | The list of conditionals that have failed **Sample:** ['...', '...'] | | **stdout** list / elements=string | always apart from low level errors (such as action plugin) | The set of responses from the commands **Sample:** ['...', '...'] | | **stdout\_lines** list / elements=string | always apart from low level errors (such as action plugin) | The value of stdout split into a list **Sample:** [['...', '...'], ['...'], ['...']] | ### Authors * Egor Zaitsev (@heuels)
programming_docs
ansible community.routeros.routeros – Use routeros cliconf to run command on MikroTik RouterOS platform community.routeros.routeros – Use routeros cliconf to run command on MikroTik RouterOS platform =============================================================================================== Note This plugin is part of the [community.routeros collection](https://galaxy.ansible.com/community/routeros) (version 1.2.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.routeros`. To use it in a playbook, specify: `community.routeros.routeros`. Synopsis -------- * This routeros plugin provides low level abstraction apis for sending and receiving CLI commands from MikroTik RouterOS network devices. ### Authors * Egor Zaitsev (@heuels) ansible community.hrobot.robot – Hetzner Robot inventory source community.hrobot.robot – Hetzner Robot inventory source ======================================================= Note This plugin is part of the [community.hrobot collection](https://galaxy.ansible.com/community/hrobot) (version 1.2.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.hrobot`. To use it in a playbook, specify: `community.hrobot.robot`. New in version 1.1.0: of community.hrobot * [Synopsis](#synopsis) * [Parameters](#parameters) * [Examples](#examples) Synopsis -------- * Reads servers from Hetzner Robot API. * Uses a YAML configuration file that ends with `robot.yml` or `robot.yaml`. * The inventory plugin adds all values from <https://robot.your-server.de/doc/webservice/en.html#get-server> prepended with `hrobot_` to the server’s inventory. For example, the variable `hrobot_dc` contains the data center the server is located in. 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** dictionary | **Default:**{} | | A dictionary of filter value pairs. Available filters are listed here are keys of server like `status` or `server_ip`. See <https://robot.your-server.de/doc/webservice/en.html#get-server> for all values that can be used. | | **groups** dictionary | **Default:**{} | | Add hosts to group based on Jinja2 conditionals. | | **hetzner\_password** string / required | | env:HROBOT\_API\_PASSWORD | The password for the Robot webservice user. | | **hetzner\_user** string / required | | env:HROBOT\_API\_USER | The username for the Robot webservice user. | | **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. | | **plugin** string / required | **Choices:*** community.hrobot.robot | | Token that ensures this is a source file for the plugin. | | **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). | Examples -------- ``` # Fetch all hosts in Hetzner Robot plugin: community.hrobot.robot # Filters all servers in ready state filters: status: ready # Example using constructed features to create groups plugin: community.hrobot.robot filters: status: ready traffic: unlimited # keyed_groups may be used to create custom groups strict: false keyed_groups: # Add e.g. groups for every data center - key: hrobot_dc separator: "" # Use the IP address to connect to the host compose: server_name_ip: hrobot_server_name ~ '-' ~ hrobot_server_ip ``` ### Authors * Oleksandr Stepanov (@alexandrst88) ansible community.hrobot.ssh_key – Add, remove or update SSH key community.hrobot.ssh\_key – Add, remove or update SSH key ========================================================= Note This plugin is part of the [community.hrobot collection](https://galaxy.ansible.com/community/hrobot) (version 1.2.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.hrobot`. To use it in a playbook, specify: `community.hrobot.ssh_key`. New in version 1.2.0: of community.hrobot * [Synopsis](#synopsis) * [Parameters](#parameters) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Add, remove or update an SSH key stored in Hetzner’s Robot. Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **fingerprint** string | | The MD5 fingerprint of the public SSH key to remove. One of *public\_key* and *fingerprint* are required if *state=absent*. | | **hetzner\_password** string / required | | The password for the Robot webservice user. | | **hetzner\_user** string / required | | The username for the Robot webservice user. | | **name** string | | The public key's name. Required if *state=present*, and ignored if *state=absent*. | | **public\_key** string | | The public key data in OpenSSH format. Example: `ssh-rsa AAAAB3NzaC1yc+...` One of *public\_key* and *fingerprint* are required if *state=absent*. Required if *state=present*. | | **state** string / required | **Choices:*** present * absent | Whether to make sure a public SSH key is present or absent. `present` makes sure that the SSH key is available, and potentially updates names for existing SHS public keys. `absent` makes sure that the SSH key is not available. The fingerprint or public key data is used for matching the key. | See Also -------- See also [community.hrobot.ssh\_key\_info](ssh_key_info_module#ansible-collections-community-hrobot-ssh-key-info-module) Query information on SSH keys Examples -------- ``` - name: Add an SSH key community.hrobot.ssh_key: hetzner_user: foo hetzner_password: bar state: present name: newKey public_key: ssh-rsa AAAAB3NzaC1yc+... - name: Remove a SSH key by fingerprint community.hrobot.ssh_key: hetzner_user: foo hetzner_password: bar state: absent fingerprint: cb:8b:ef:a7:fe:04:87:3f:e5:55:cd:12:e3:e8:9f:99 ``` 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 | | --- | --- | --- | | **fingerprint** string | success | The MD5 fingerprint of the key. This is the value used to reference the SSH public key, for example in the [community.hrobot.boot](boot_module) module. **Sample:** cb:8b:ef:a7:fe:04:87:3f:e5:55:cd:12:e3:e8:9f:99 | ### Authors * Felix Fontein (@felixfontein) ansible Community.Hrobot Community.Hrobot ================ Collection version 1.2.0 Plugin Index ------------ These are the plugins in the community.hrobot collection ### Inventory Plugins * [robot](robot_inventory#ansible-collections-community-hrobot-robot-inventory) – Hetzner Robot inventory source ### Modules * [boot](boot_module#ansible-collections-community-hrobot-boot-module) – Set boot configuration * [failover\_ip](failover_ip_module#ansible-collections-community-hrobot-failover-ip-module) – Manage Hetzner’s failover IPs * [failover\_ip\_info](failover_ip_info_module#ansible-collections-community-hrobot-failover-ip-info-module) – Retrieve information on Hetzner’s failover IPs * [firewall](firewall_module#ansible-collections-community-hrobot-firewall-module) – Manage Hetzner’s dedicated server firewall * [firewall\_info](firewall_info_module#ansible-collections-community-hrobot-firewall-info-module) – Manage Hetzner’s dedicated server firewall * [reset](reset_module#ansible-collections-community-hrobot-reset-module) – Reset a dedicated server * [reverse\_dns](reverse_dns_module#ansible-collections-community-hrobot-reverse-dns-module) – Set or remove reverse DNS entry for IP * [server](server_module#ansible-collections-community-hrobot-server-module) – Update server information * [server\_info](server_info_module#ansible-collections-community-hrobot-server-info-module) – Query information on one or more servers * [ssh\_key](ssh_key_module#ansible-collections-community-hrobot-ssh-key-module) – Add, remove or update SSH key * [ssh\_key\_info](ssh_key_info_module#ansible-collections-community-hrobot-ssh-key-info-module) – Query information on SSH keys See also List of [collections](../../index#list-of-collections) with docs hosted here. ansible community.hrobot.boot – Set boot configuration community.hrobot.boot – Set boot configuration ============================================== Note This plugin is part of the [community.hrobot collection](https://galaxy.ansible.com/community/hrobot) (version 1.2.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.hrobot`. To use it in a playbook, specify: `community.hrobot.boot`. New in version 1.2.0: of community.hrobot * [Synopsis](#synopsis) * [Parameters](#parameters) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Set the boot configuration for a dedicated server. Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **hetzner\_password** string / required | | The password for the Robot webservice user. | | **hetzner\_user** string / required | | The username for the Robot webservice user. | | **install\_cpanel** dictionary | | If this option is provided, a cPanel installation will be activated for the next boot. Precisely one of *regular\_boot*, *rescue*, *install\_linux*, *install\_vnc*, *install\_windows*, *install\_plesk*, and *install\_cpanel* must be provided. | | | **arch** integer | **Choices:*** 32 * 64 | The architecture to use for the install. Not all architectures are available for all distributions. Defaults to `64`. | | | **dist** string / required | | The distribution to install. | | | **hostname** string / required | | The hostname. | | | **lang** string / required | | The language to use for the operating system. | | **install\_linux** dictionary | | If this option is provided, a Linux system install will be activated for the next boot. Precisely one of *regular\_boot*, *rescue*, *install\_linux*, *install\_vnc*, *install\_windows*, *install\_plesk*, and *install\_cpanel* must be provided. | | | **arch** integer | **Choices:*** 32 * 64 | The architecture to use for the install. Not all architectures are available for all distributions. Defaults to `64`. | | | **authorized\_keys** list / elements=string | | One or more SSH key fingerprints to equip the rescue system with. Only fingerprints for SSH keys deposited in the Robot API can be used. You can use the [community.hrobot.ssh\_key\_info](ssh_key_info_module) module to query the SSH keys you can use, and the [community.hrobot.ssh\_key](ssh_key_module) module to add or update SSH keys. | | | **dist** string / required | | The distribution to install. | | | **lang** string / required | | The language to use for the operating system. | | **install\_plesk** dictionary | | If this option is provided, a Plesk installation will be activated for the next boot. Precisely one of *regular\_boot*, *rescue*, *install\_linux*, *install\_vnc*, *install\_windows*, *install\_plesk*, and *install\_cpanel* must be provided. | | | **arch** integer | **Choices:*** 32 * 64 | The architecture to use for the install. Not all architectures are available for all distributions. Defaults to `64`. | | | **dist** string / required | | The distribution to install. | | | **hostname** string / required | | The hostname. | | | **lang** string / required | | The language to use for the operating system. | | **install\_vnc** dictionary | | If this option is provided, a VNC installation will be activated for the next boot. Precisely one of *regular\_boot*, *rescue*, *install\_linux*, *install\_vnc*, *install\_windows*, *install\_plesk*, and *install\_cpanel* must be provided. | | | **arch** integer | **Choices:*** 32 * 64 | The architecture to use for the install. Not all architectures are available for all distributions. Defaults to `64`. | | | **dist** string / required | | The distribution to install. | | | **lang** string / required | | The language to use for the operating system. | | **install\_windows** dictionary | | If this option is provided, a Windows installation will be activated for the next boot. Precisely one of *regular\_boot*, *rescue*, *install\_linux*, *install\_vnc*, *install\_windows*, *install\_plesk*, and *install\_cpanel* must be provided. | | | **lang** string / required | | The language to use for Windows. | | **regular\_boot** boolean | **Choices:*** no * yes | If this option is provided, all special boot configurations are removed and the installed operating system will be booted up next (assuming it is bootable). Precisely one of *regular\_boot*, *rescue*, *install\_linux*, *install\_vnc*, *install\_windows*, *install\_plesk*, and *install\_cpanel* must be provided. | | **rescue** dictionary | | If this option is provided, the rescue system will be activated for the next boot. Precisely one of *regular\_boot*, *rescue*, *install\_linux*, *install\_vnc*, *install\_windows*, *install\_plesk*, and *install\_cpanel* must be provided. | | | **arch** integer | **Choices:*** 32 * 64 | The architecture to use for the rescue system. Not all architectures are available for all operating systems. Defaults to `64`. | | | **authorized\_keys** list / elements=string | | One or more SSH key fingerprints to equip the rescue system with. Only fingerprints for SSH keys deposited in the Robot API can be used. You can use the [community.hrobot.ssh\_key\_info](ssh_key_info_module) module to query the SSH keys you can use, and the [community.hrobot.ssh\_key](ssh_key_module) module to add or update SSH keys. | | | **os** string / required | | The operating system to use for the rescue system. Possible choices can change over time. Currently, `linux`, `linuxold`, `freebsd`, `freebsdold`, `freebsdax`, `freebsdbetaax`, `vkvm`, and `vkvmold` seem to be available. | | **server\_number** integer / required | | The server number of the server whose boot configuration to adjust. | See Also -------- See also [community.hrobot.ssh\_key](ssh_key_module#ansible-collections-community-hrobot-ssh-key-module) Add, remove or update SSH key [community.hrobot.ssh\_key\_info](ssh_key_info_module#ansible-collections-community-hrobot-ssh-key-info-module) Query information on SSH keys Examples -------- ``` - name: Disable all special boot configurations community.hrobot.boot: hetzner_user: foo hetzner_password: bar regular_boot: true - name: Enable a rescue system (64bit Linux) for the next boot community.hrobot.reset: hetzner_user: foo hetzner_password: bar rescue: os: linux - name: Enable a Linux install for the next boot community.hrobot.reset: hetzner_user: foo hetzner_password: bar install_linux: dist: CentOS 5.5 minimal lang: en authorized_keys: - 56:29:99:a4:5d:ed:ac:95:c1:f5:88:82:90:5d:dd:10 - 15:28:b0:03:95:f0:77:b3:10:56:15:6b:77:22:a5:bb ``` 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 | | --- | --- | --- | | **configuration\_type** string | success | Describes the active boot configuration. **Can only return:** regular\_boot, rescue, install\_linux, install\_vnc, install\_windows, install\_plesk, install\_cpanel | | **password** string | success and if a boot configuration other than `regular_boot` is active | The root password for the active boot configuration, if available. For non-rescue boot configurations, it is avised to change the root password as soon as possible. | ### Authors * Felix Fontein (@felixfontein) ansible community.hrobot.reset – Reset a dedicated server community.hrobot.reset – Reset a dedicated server ================================================= Note This plugin is part of the [community.hrobot collection](https://galaxy.ansible.com/community/hrobot) (version 1.2.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.hrobot`. To use it in a playbook, specify: `community.hrobot.reset`. New in version 1.2.0: of community.hrobot * [Synopsis](#synopsis) * [Parameters](#parameters) * [Examples](#examples) Synopsis -------- * Reset a dedicated server with a software or hardware reset, or by requesting a manual reset. Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **hetzner\_password** string / required | | The password for the Robot webservice user. | | **hetzner\_user** string / required | | The username for the Robot webservice user. | | **reset\_type** string / required | **Choices:*** software * hardware * power * manual | How to reset the server. `software` is a software reset. This should be similar to pressing Ctrl+Alt+Del on the keyboard. `power` is a hardware reset similar to pressing the Power button. An ACPI signal is sent, and if the server is configured correctly, this will trigger a regular shutdown. `hardware` is a hardware reset similar to pressing the Restart button. The power is cycled for the server. `manual` is a manual reset. This requests a technician to manually do the shutdown while looking at the screen output. **Be careful** and only use this when really necessary! Note that not every server supports every reset method! | | **server\_number** integer / required | | The server number of the server to reset. | Examples -------- ``` - name: Send ACPI signal to server to request controlled shutdown community.hrobot.reset: hetzner_user: foo hetzner_password: bar failover_ip: 1.2.3.4 state: power - name: Make sure that the server supports manual reset community.hrobot.reset: hetzner_user: foo hetzner_password: bar server_number: 1234 reset_type: manual check_mode: true - name: Request a manual reset (by a technican) community.hrobot.reset: hetzner_user: foo hetzner_password: bar server_number: 1234 reset_type: manual ``` ### Authors * Felix Fontein (@felixfontein)
programming_docs
ansible community.hrobot.failover_ip – Manage Hetzner’s failover IPs community.hrobot.failover\_ip – Manage Hetzner’s failover IPs ============================================================= Note This plugin is part of the [community.hrobot collection](https://galaxy.ansible.com/community/hrobot) (version 1.2.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.hrobot`. To use it in a playbook, specify: `community.hrobot.failover_ip`. * [Synopsis](#synopsis) * [Parameters](#parameters) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Manage Hetzner’s failover IPs. Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **failover\_ip** string / required | | The failover IP address. | | **hetzner\_password** string / required | | The password for the Robot webservice user. | | **hetzner\_user** string / required | | The username for the Robot webservice user. | | **state** string | **Choices:*** **routed** ← * unrouted | Defines whether the IP will be routed or not. If set to `routed`, *value* must be specified. | | **timeout** integer | **Default:**180 | Timeout to use when routing or unrouting the failover IP. Note that the API call returns when the failover IP has been successfully routed to the new address, respectively successfully unrouted. | | **value** string | | The new value for the failover IP address. Required when setting *state* to `routed`. | See Also -------- See also [Failover IP documentation](https://docs.hetzner.com/robot/dedicated-server/ip/failover/) Hetzner’s documentation on failover IPs. [community.hrobot.failover\_ip\_info](failover_ip_info_module#ansible-collections-community-hrobot-failover-ip-info-module) Retrieve information on failover IPs. Examples -------- ``` - name: Set value of failover IP 1.2.3.4 to 5.6.7.8 community.hrobot.failover_ip: hetzner_user: foo hetzner_password: bar failover_ip: 1.2.3.4 value: 5.6.7.8 - name: Set value of failover IP 1.2.3.4 to unrouted community.hrobot.failover_ip: hetzner_user: foo hetzner_password: bar failover_ip: 1.2.3.4 state: unrouted ``` 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** string | success | Will be `routed` or `unrouted`. | | **value** string | success | The value of the failover IP. Will be `none` if the IP is unrouted. | ### Authors * Felix Fontein (@felixfontein) ansible community.hrobot.server_info – Query information on one or more servers community.hrobot.server\_info – Query information on one or more servers ======================================================================== Note This plugin is part of the [community.hrobot collection](https://galaxy.ansible.com/community/hrobot) (version 1.2.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.hrobot`. To use it in a playbook, specify: `community.hrobot.server_info`. New in version 1.2.0: of community.hrobot * [Synopsis](#synopsis) * [Parameters](#parameters) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Query information on one or more servers. Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **full\_info** boolean | **Choices:*** **no** ← * yes | Whether to provide full information for every server. Setting this to `true` requires one REST call per server, which is slow and reduces your rate limit. Use with care. When *server\_number* is specified, this option is set to `true`. | | **hetzner\_password** string / required | | The password for the Robot webservice user. | | **hetzner\_user** string / required | | The username for the Robot webservice user. | | **server\_name** string | | Limit result list to servers of this name. | | **server\_number** integer | | Limit result list to server with this number. | Examples -------- ``` - name: Query a list of all servers community.hrobot.server_info: hetzner_user: foo hetzner_password: bar register: result - name: Query a specific server community.hrobot.server_info: hetzner_user: foo hetzner_password: bar server_number: 23 register: result - name: Output data on specific server ansible.builtin.debug: msg: "Server name: {{ result.servers[0].server_name }}" ``` 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 | | --- | --- | --- | | **servers** list / elements=dictionary | success | List of servers matching the provided options. | | | **cancelled** boolean | success | Whether the server is cancelled. | | | **cpanel** boolean | when *full\_info=true* | Flag of cPanel installation availability. **Sample:** True | | | **dc** string | success | The data center the server is located in. **Sample:** NBG1-DC1 | | | **hot\_swap** boolean | when *full\_info=true* | Flag of Hot Swap availability. **Sample:** True | | | **ip** list / elements=string | success | List of assigned single IP addresses. **Sample:** ['123.123.123.123'] | | | **linked\_storagebox** integer | when *full\_info=true* | Linked Storage Box ID. **Sample:** 12345 | | | **paid\_until** string | success | The date until the server has been paid. **Sample:** 2018-08-04 | | | **plesk** boolean | when *full\_info=true* | Flag of Plesk installation availability. **Sample:** True | | | **product** string | success | The server product name. **Sample:** EQ 8 | | | **rescue** boolean | when *full\_info=true* | Whether the rescue system is available. | | | **reset** boolean | when *full\_info=true* | Whether the server can be automatically reset. **Sample:** True | | | **server\_ip** string | success | The server's main IP address. **Sample:** 123.123.123.123 | | | **server\_ipv6\_net** string | success | The server's main IPv6 network address. **Sample:** 2a01:f48:111:4221:: | | | **server\_name** string | success | The user-defined server's name. **Sample:** server1 | | | **server\_number** integer | success | The server's numeric ID. **Sample:** 321 | | | **status** string | success | Server status. **Can only return:** ready, in process **Sample:** ready | | | **subnet** list / elements=string | success | List of assigned subnets. **Sample:** [{'ip': '2a01:4f8:111:4221::', 'mask': 64}] | | | | **ip** string | success | The first IP in the subnet. **Sample:** 2a01:4f8:111:4221:: | | | | **mask** string | success | The masks bitlength. **Sample:** 64 | | | **traffic** string | success | Free traffic quota. `unlimited` in case of unlimited traffic. **Sample:** 5 TB | | | **vnc** boolean | when *full\_info=true* | Flag of VNC installation availability. **Sample:** True | | | **windows** boolean | when *full\_info=true* | Flag of Windows installation availability. **Sample:** True | | | **wol** boolean | when *full\_info=true* | Flag of Wake On Lan availability. **Sample:** True | ### Authors * Felix Fontein (@felixfontein) ansible community.hrobot.server – Update server information community.hrobot.server – Update server information =================================================== Note This plugin is part of the [community.hrobot collection](https://galaxy.ansible.com/community/hrobot) (version 1.2.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.hrobot`. To use it in a playbook, specify: `community.hrobot.server`. New in version 1.2.0: of community.hrobot * [Synopsis](#synopsis) * [Parameters](#parameters) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Allows to update server information. * Right now the API only supports updating the server’s name. Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **hetzner\_password** string / required | | The password for the Robot webservice user. | | **hetzner\_user** string / required | | The username for the Robot webservice user. | | **server\_name** string | | The server's name. If this option is not provided, it will not be adjusted. | | **server\_number** integer / required | | The server number of the server to update. | Examples -------- ``` - name: Set server's name to foo.example.com community.hrobot.server: hetzner_user: foo hetzner_password: bar server_number: 123 server_name: foo.example.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 | | --- | --- | --- | | **server** dictionary | success | Information on the server. | | | **cancelled** boolean | success | Whether the server is cancelled. | | | **cpanel** boolean | success | Flag of cPanel installation availability. **Sample:** True | | | **dc** string | success | The data center the server is located in. **Sample:** NBG1-DC1 | | | **hot\_swap** boolean | success | Flag of Hot Swap availability. **Sample:** True | | | **ip** list / elements=string | success | List of assigned single IP addresses. **Sample:** ['123.123.123.123'] | | | **linked\_storagebox** integer | success | Linked Storage Box ID. **Sample:** 12345 | | | **paid\_until** string | success | The date until the server has been paid. **Sample:** 2018-08-04 | | | **plesk** boolean | success | Flag of Plesk installation availability. **Sample:** True | | | **product** string | success | The server product name. **Sample:** EQ 8 | | | **rescue** boolean | success | Whether the rescue system is available. | | | **reset** boolean | success | Whether the server can be automatically reset. **Sample:** True | | | **server\_ip** string | success | The server's main IP address. **Sample:** 123.123.123.123 | | | **server\_ipv6\_net** string | success | The server's main IPv6 network address. **Sample:** 2a01:f48:111:4221:: | | | **server\_name** string | success | The user-defined server's name. **Sample:** server1 | | | **server\_number** integer | success | The server's numeric ID. **Sample:** 321 | | | **status** string | success | Server status. **Can only return:** ready, in process **Sample:** ready | | | **subnet** list / elements=string | success | List of assigned subnets. **Sample:** [{'ip': '2a01:4f8:111:4221::', 'mask': 64}] | | | | **ip** string | success | The first IP in the subnet. **Sample:** 2a01:4f8:111:4221:: | | | | **mask** string | success | The masks bitlength. **Sample:** 64 | | | **traffic** string | success | Free traffic quota. `unlimited` in case of unlimited traffic. **Sample:** 5 TB | | | **vnc** boolean | success | Flag of VNC installation availability. **Sample:** True | | | **windows** boolean | success | Flag of Windows installation availability. **Sample:** True | | | **wol** boolean | success | Flag of Wake On Lan availability. **Sample:** True | ### Authors * Felix Fontein (@felixfontein) ansible community.hrobot.failover_ip_info – Retrieve information on Hetzner’s failover IPs community.hrobot.failover\_ip\_info – Retrieve information on Hetzner’s failover IPs ==================================================================================== Note This plugin is part of the [community.hrobot collection](https://galaxy.ansible.com/community/hrobot) (version 1.2.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.hrobot`. To use it in a playbook, specify: `community.hrobot.failover_ip_info`. * [Synopsis](#synopsis) * [Parameters](#parameters) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Retrieve information on Hetzner’s failover IPs. Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **failover\_ip** string / required | | The failover IP address. | | **hetzner\_password** string / required | | The password for the Robot webservice user. | | **hetzner\_user** string / required | | The username for the Robot webservice user. | See Also -------- See also [Failover IP documentation](https://docs.hetzner.com/robot/dedicated-server/ip/failover/) Hetzner’s documentation on failover IPs. [community.hrobot.failover\_ip](failover_ip_module#ansible-collections-community-hrobot-failover-ip-module) Manage failover IPs. Examples -------- ``` - name: Get value of failover IP 1.2.3.4 community.hrobot.failover_ip_info: hetzner_user: foo hetzner_password: bar failover_ip: 1.2.3.4 value: 5.6.7.8 register: result - name: Print value of failover IP 1.2.3.4 in case it is routed ansible.builtin.debug: msg: "1.2.3.4 routes to {{ result.value }}" when: result.state == 'routed' ``` 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 | | --- | --- | --- | | **failover\_ip** string | success | The failover IP. **Sample:** 1.2.3.4 | | **failover\_netmask** string | success | The netmask for the failover IP. **Sample:** 255.255.255.255 | | **server\_ip** string | success | The main IP of the server this failover IP is associated to. This is *not* the server the failover IP is routed to. | | **server\_number** integer | success | The number of the server this failover IP is associated to. This is *not* the server the failover IP is routed to. | | **state** string | success | Will be `routed` or `unrouted`. | | **value** string | success | The value of the failover IP. Will be `none` if the IP is unrouted. | ### Authors * Felix Fontein (@felixfontein) ansible community.hrobot.firewall – Manage Hetzner’s dedicated server firewall community.hrobot.firewall – Manage Hetzner’s dedicated server firewall ====================================================================== Note This plugin is part of the [community.hrobot collection](https://galaxy.ansible.com/community/hrobot) (version 1.2.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.hrobot`. To use it in a playbook, specify: `community.hrobot.firewall`. * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Manage Hetzner’s dedicated server firewall. * Note that idempotency check for TCP flags simply compares strings and doesn’t try to interpret the rules. This might change in the future. Requirements ------------ The below requirements are needed on the host that executes this module. * ipaddress Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **allowlist\_hos** boolean | **Choices:*** no * yes | Whether Hetzner services have access. aliases: whitelist\_hos | | **hetzner\_password** string / required | | The password for the Robot webservice user. | | **hetzner\_user** string / required | | The username for the Robot webservice user. | | **port** string | **Choices:*** **main** ← * kvm | Switch port of firewall. | | **rules** dictionary | | Firewall rules. | | | **input** list / elements=dictionary | | Input firewall rules. | | | | **action** string / required | **Choices:*** accept * discard | Action if rule matches. | | | | **dst\_ip** string | | Destination IP address or subnet address. CIDR notation. | | | | **dst\_port** string | | Destination port or port range. | | | | **ip\_version** string / required | **Choices:*** ipv4 * ipv6 | Internet protocol version. Note that currently, only IPv4 is supported by Hetzner. | | | | **name** string | | Name of the firewall rule. | | | | **protocol** string | | Protocol above IP layer | | | | **src\_ip** string | | Source IP address or subnet address. CIDR notation. | | | | **src\_port** string | | Source port or port range. | | | | **tcp\_flags** string | | TCP flags or logical combination of flags. Flags supported by Hetzner are `syn`, `fin`, `rst`, `psh` and `urg`. They can be combined with `|` (logical or) and `&` (logical and). See [the documentation](https://wiki.hetzner.de/index.php/Robot_Firewall/en#Parameter) for more information. | | **server\_ip** string / required | | The server's main IP address. | | **state** string | **Choices:*** **present** ← * absent | Status of the firewall. Firewall is active if state is `present`, and disabled if state is `absent`. | | **timeout** integer | **Default:**180 | Timeout (in seconds) for waiting for firewall to be configured. | | **update\_timeout** integer | **Default:**30 | Timeout to use when configuring the firewall. Note that the API call returns before the firewall has been successfully set up. | | **wait\_delay** integer | **Default:**10 | Delay to wait (in seconds) before checking again whether the firewall has been configured. | | **wait\_for\_configured** boolean | **Choices:*** no * **yes** ← | Whether to wait until the firewall has been successfully configured before determining what to do, and before returning from the module. The API returns status `in progress` when the firewall is currently being configured. If this happens, the module will try again until the status changes to `active` or `disabled`. Please note that there is a request limit. If you have to do multiple updates, it can be better to disable waiting, and regularly use [community.hrobot.firewall\_info](firewall_info_module) to query status. | See Also -------- See also [Firewall documentation](https://docs.hetzner.com/robot/dedicated-server/firewall/) Hetzner’s documentation on the stateless firewall for dedicated servers [community.hrobot.firewall\_info](firewall_info_module#ansible-collections-community-hrobot-firewall-info-module) Retrieve information on firewall configuration. Examples -------- ``` - name: Configure firewall for server with main IP 1.2.3.4 community.hrobot.firewall: hetzner_user: foo hetzner_password: bar server_ip: 1.2.3.4 state: present allowlist_hos: yes rules: input: - name: Allow everything to ports 20-23 from 4.3.2.1/24 ip_version: ipv4 src_ip: 4.3.2.1/24 dst_port: '20-23' action: accept - name: Allow everything to port 443 ip_version: ipv4 dst_port: '443' action: accept - name: Drop everything else ip_version: ipv4 action: discard register: result - ansible.builtin.debug: msg: "{{ 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 | | --- | --- | --- | | **firewall** dictionary | success | The firewall configuration. | | | **allowlist\_hos** boolean added in 1.2.0 of community.hrobot | success | Whether Hetzner services have access. **Sample:** True | | | **port** string | success | Switch port of firewall. `main` or `kvm`. **Sample:** main | | | **rules** dictionary | success | Firewall rules. | | | | **input** list / elements=dictionary | success | Input firewall rules. | | | | | **action** string | success | Action if rule matches. `accept` or `discard`. **Sample:** accept | | | | | **dst\_ip** string | success | Destination IP address or subnet address. CIDR notation. **Sample:** 1.2.3.4/32 | | | | | **dst\_port** string | success | Destination port or port range. **Sample:** 443 | | | | | **ip\_version** string | success | Internet protocol version. **Sample:** ipv4 | | | | | **name** string | success | Name of the firewall rule. **Sample:** Allow HTTP access to server | | | | | **protocol** string | success | Protocol above IP layer **Sample:** tcp | | | | | **src\_ip** string | success | Source IP address or subnet address. CIDR notation. | | | | | **src\_port** string | success | Source port or port range. | | | | | **tcp\_flags** string | success | TCP flags or logical combination of flags. | | | **server\_ip** string | success | Server's main IP address. **Sample:** 1.2.3.4 | | | **server\_number** integer | success | Hetzner's internal server number. **Sample:** 12345 | | | **status** string | success | Status of the firewall. `active` or `disabled`. Will be `in process` if the firewall is currently updated, and *wait\_for\_configured* is set to `no` or *timeout* to a too small value. **Sample:** active | | | **whitelist\_hos** boolean | success | Whether Hetzner services have access. Old name of return value `allowlist_hos`, will be removed eventually. **Sample:** True | ### Authors * Felix Fontein (@felixfontein)
programming_docs
ansible community.hrobot.ssh_key_info – Query information on SSH keys community.hrobot.ssh\_key\_info – Query information on SSH keys =============================================================== Note This plugin is part of the [community.hrobot collection](https://galaxy.ansible.com/community/hrobot) (version 1.2.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.hrobot`. To use it in a playbook, specify: `community.hrobot.ssh_key_info`. New in version 1.2.0: of community.hrobot * [Synopsis](#synopsis) * [Parameters](#parameters) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * List information on all your SSH keys stored in Hetzner’s Robot. Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **hetzner\_password** string / required | | The password for the Robot webservice user. | | **hetzner\_user** string / required | | The username for the Robot webservice user. | See Also -------- See also [community.hrobot.ssh\_key](ssh_key_module#ansible-collections-community-hrobot-ssh-key-module) Add, remove or update SSH key Examples -------- ``` - name: List all SSH keys community.hrobot.ssh_key_info: hetzner_user: foo hetzner_password: bar register: ssh_keys - name: Show how many keys were found ansible.builtin.debug: msg: "Found {{ ssh_keys.ssh_keys | length }} keys" ``` 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 | | --- | --- | --- | | **ssh\_keys** list / elements=dictionary | success | The list of all SSH keys stored in Hetzner's Robot for your user. | | | **data** string | success | The key data in OpenSSH's format. **Sample:** ecdsa-sha2-nistp521 AAAAE2VjZHNh ... | | | **fingerprint** string | success | The key's MD5 fingerprint. **Sample:** 56:29:99:a4:5d:ed:ac:95:c1:f5:88:82:90:5d:dd:10 | | | **name** string | success | The key's name shown in the UI. **Sample:** key1 | | | **size** integer | success | The key's size in bits. **Sample:** 521 | | | **type** string | success | The key's algorithm type. **Sample:** ECDSA | ### Authors * Felix Fontein (@felixfontein) ansible community.hrobot.reverse_dns – Set or remove reverse DNS entry for IP community.hrobot.reverse\_dns – Set or remove reverse DNS entry for IP ====================================================================== Note This plugin is part of the [community.hrobot collection](https://galaxy.ansible.com/community/hrobot) (version 1.2.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.hrobot`. To use it in a playbook, specify: `community.hrobot.reverse_dns`. New in version 1.2.0: of community.hrobot * [Synopsis](#synopsis) * [Parameters](#parameters) * [Notes](#notes) * [Examples](#examples) Synopsis -------- * Allows to set, update or remove a reverse DNS entry for an IP address. Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **hetzner\_password** string / required | | The password for the Robot webservice user. | | **hetzner\_user** string / required | | The username for the Robot webservice user. | | **ip** string / required | | The IP address to set or remove a reverse DNS entry for. | | **state** string | **Choices:*** **present** ← * absent | Whether to set or update (`present`) or delete (`absent`) the reverse DNS entry for *ip*. | | **value** string | | The reverse DNS entry for *ip*. Required if *state=present*. | Notes ----- Note * For the main IPv4 address of a server, deleting it actually sets it to a default hostname like `static.X.Y.Z.W.clients.your-server.de`. This substitution (delete is replaced by changing to this value) is done automatically by the API and results in the module not being idempotent in this case. Examples -------- ``` - name: Set reverse DNS entry for 1.2.3.4 community.hrobot.reverse_dns: hetzner_user: foo hetzner_password: bar ip: 1.2.3.4 value: foo.example.com - name: Remove reverse DNS entry for 2a01:f48:111:4221::1 community.hrobot.reverse_dns: hetzner_user: foo hetzner_password: bar ip: 2a01:f48:111:4221::1 state: absent ``` ### Authors * Felix Fontein (@felixfontein) ansible community.hrobot.firewall_info – Manage Hetzner’s dedicated server firewall community.hrobot.firewall\_info – Manage Hetzner’s dedicated server firewall ============================================================================ Note This plugin is part of the [community.hrobot collection](https://galaxy.ansible.com/community/hrobot) (version 1.2.0). You might already have this collection installed if you are using the `ansible` package. It is not included in `ansible-core`. To check whether it is installed, run `ansible-galaxy collection list`. To install it, use: `ansible-galaxy collection install community.hrobot`. To use it in a playbook, specify: `community.hrobot.firewall_info`. * [Synopsis](#synopsis) * [Parameters](#parameters) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) Synopsis -------- * Manage Hetzner’s dedicated server firewall. Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **hetzner\_password** string / required | | The password for the Robot webservice user. | | **hetzner\_user** string / required | | The username for the Robot webservice user. | | **server\_ip** string / required | | The server's main IP address. | | **timeout** integer | **Default:**180 | Timeout (in seconds) for waiting for firewall to be configured. | | **wait\_delay** integer | **Default:**10 | Delay to wait (in seconds) before checking again whether the firewall has been configured. | | **wait\_for\_configured** boolean | **Choices:*** no * **yes** ← | Whether to wait until the firewall has been successfully configured before returning from the module. The API returns status `in progress` when the firewall is currently being configured. If this happens, the module will try again until the status changes to `active` or `disabled`. Please note that there is a request limit. If you have to do multiple updates, it can be better to disable waiting, and regularly use [community.hrobot.firewall\_info](firewall_info_module) to query status. | See Also -------- See also [Firewall documentation](https://docs.hetzner.com/robot/dedicated-server/firewall/) Hetzner’s documentation on the stateless firewall for dedicated servers [community.hrobot.firewall](firewall_module#ansible-collections-community-hrobot-firewall-module) Configure firewall. Examples -------- ``` - name: Get firewall configuration for server with main IP 1.2.3.4 community.hrobot.firewall_info: hetzner_user: foo hetzner_password: bar server_ip: 1.2.3.4 register: result - ansible.builtin.debug: msg: "{{ result.firewall }}" ``` 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 | | --- | --- | --- | | **firewall** dictionary | success | The firewall configuration. | | | **allowlist\_hos** boolean added in 1.2.0 of community.hrobot | success | Whether Hetzner services have access. **Sample:** True | | | **port** string | success | Switch port of firewall. `main` or `kvm`. **Sample:** main | | | **rules** dictionary | success | Firewall rules. | | | | **input** list / elements=dictionary | success | Input firewall rules. | | | | | **action** string | success | Action if rule matches. `accept` or `discard`. **Sample:** accept | | | | | **dst\_ip** string | success | Destination IP address or subnet address. CIDR notation. **Sample:** 1.2.3.4/32 | | | | | **dst\_port** string | success | Destination port or port range. **Sample:** 443 | | | | | **ip\_version** string | success | Internet protocol version. **Sample:** ipv4 | | | | | **name** string | success | Name of the firewall rule. **Sample:** Allow HTTP access to server | | | | | **protocol** string | success | Protocol above IP layer **Sample:** tcp | | | | | **src\_ip** string | success | Source IP address or subnet address. CIDR notation. | | | | | **src\_port** string | success | Source port or port range. | | | | | **tcp\_flags** string | success | TCP flags or logical combination of flags. | | | **server\_ip** string | success | Server's main IP address. **Sample:** 1.2.3.4 | | | **server\_number** integer | success | Hetzner's internal server number. **Sample:** 12345 | | | **status** string | success | Status of the firewall. `active` or `disabled`. Will be `in process` if the firewall is currently updated, and *wait\_for\_configured* is set to `no` or *timeout* to a too small value. **Sample:** active | | | **whitelist\_hos** boolean | success | Whether Hetzner services have access. Old name of return value `allowlist_hos`, will be removed eventually. **Sample:** True | ### Authors * Felix Fontein (@felixfontein) ansible community.azure.azure_rm_virtualmachinescaleset – Manage Azure virtual machine scale sets community.azure.azure\_rm\_virtualmachinescaleset – Manage Azure virtual machine scale sets =========================================================================================== Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_virtualmachinescaleset`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_virtualmachinescaleset](../../azure/azcollection/azure_rm_virtualmachinescaleset_module#ansible-collections-azure-azcollection-azure-rm-virtualmachinescaleset-module) instead. Synopsis -------- * Create and update a virtual machine scale set. * Note that this module was called [community.azure.azure\_rm\_virtualmachine\_scaleset](azure_rm_virtualmachine_scaleset_module#ansible-collections-community-azure-azure-rm-virtualmachine-scaleset-module) before Ansible 2.8. The usage did not change. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **admin\_password** string | | Password for the admin username. Not required if the os\_type is Linux and SSH password authentication is disabled by setting *ssh\_password\_enabled=false*. | | **admin\_username** string | | Admin username used to access the host after it is created. Required when creating a VM. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **append\_tags** boolean | **Choices:*** no * **yes** ← | Use to control if tags field is canonical or just appends to existing tags. When canonical, any tags not found in the tags parameter will be removed from the object's metadata. | | **application\_gateway** string | | Application gateway name. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **capacity** string | **Default:**1 | Capacity of VMSS. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **custom\_data** string | | Data which is made available to the virtual machine and used by e.g., `cloud-init`. Many images in the marketplace are not cloud-init ready. Thus, data sent to *custom\_data* would be ignored. If the image you are attempting to use is not listed in <https://docs.microsoft.com/en-us/azure/virtual-machines/linux/using-cloud-init#cloud-init-overview>, follow these steps <https://docs.microsoft.com/en-us/azure/virtual-machines/linux/cloudinit-prepare-custom-image>. | | **data\_disks** string | | Describes list of data disks. | | | **caching** string | **Choices:*** **ReadOnly** ← * ReadWrite | Type of data disk caching. | | | **create\_option** string | **Choices:*** Empty * FromImage | Specify whether disk should be created Empty or FromImage. This is required to allow custom images with data disks to be used. | | | **disk\_size\_gb** string | | The initial disk size in GB for blank data disks. | | | **lun** string | **Default:**0 | The logical unit number for data disk. | | | **managed\_disk\_type** string | **Choices:*** Standard\_LRS * Premium\_LRS | Managed data disk type. | | **enable\_accelerated\_networking** boolean | **Choices:*** no * yes | Indicates whether user wants to allow accelerated networking for virtual machines in scaleset being created. | | **image** string / required | | Specifies the image used to build the VM. If a string, the image is sourced from a custom image based on the name. If a dict with the keys *publisher*, *offer*, *sku*, and *version*, the image is sourced from a Marketplace image. Note that set *version=latest* to get the most recent version of a given image. If a dict with the keys *name* and *resource\_group*, the image is sourced from a custom image based on the *name* and *resource\_group* set. Note that the key *resource\_group* is optional and if omitted, all images in the subscription will be searched for by *name*. Custom image support was added in Ansible 2.5. | | **load\_balancer** string | | Load balancer name. | | **location** string | | Valid Azure location. Defaults to location of the resource group. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **managed\_disk\_type** string | **Choices:*** Standard\_LRS * Premium\_LRS | Managed disk type. | | **name** string / required | | Name of the virtual machine. | | **os\_disk\_caching** string | **Choices:*** **ReadOnly** ← * ReadWrite | Type of OS disk caching. aliases: disk\_caching | | **os\_type** string | **Choices:*** Windows * **Linux** ← | Base type of operating system. | | **overprovision** boolean | **Choices:*** no * **yes** ← | Specifies whether the Virtual Machine Scale Set should be overprovisioned. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **plan** dictionary | | Third-party billing plan for the VM. | | | **name** string / required | | Billing plan name. | | | **product** string / required | | Product name. | | | **promotion\_code** string | | Optional promotion code. | | | **publisher** string / required | | Publisher offering the plan. | | **priority** string | **Choices:*** **Regular** ← * Low | If you want to request low-priority VMs for the VMSS, set this to "Low". The default is "Regular" | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **remove\_on\_absent** string | **Default:**["all"] | When removing a VM using *state=absent*, also remove associated resources. It can be `all` or a list with any of the following ['network\_interfaces', 'virtual\_storage', 'public\_ips']. Any other input will be ignored. | | **resource\_group** string / required | | Name of the resource group containing the virtual machine scale set. | | **scale\_in\_policy** string | **Choices:*** Default * NewestVM * OldestVM | define the order in which vmss instances are scaled-in | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **security\_group** string | | Existing security group with which to associate the subnet. It can be the security group name which is in the same resource group. It can be the resource ID. It can be a dict which contains *name* and *resource\_group* of the security group. aliases: security\_group\_name | | **short\_hostname** string | | Short host name. | | **single\_placement\_group** boolean | **Choices:*** no * **yes** ← | When true this limits the scale set to a single placement group, of max size 100 virtual machines. | | **ssh\_password\_enabled** boolean | **Choices:*** no * **yes** ← | When the os\_type is Linux, setting *ssh\_password\_enabled=false* will disable SSH password authentication and require use of SSH keys. | | **ssh\_public\_keys** string | | For *os\_type=Linux* provide a list of SSH keys. Each item in the list should be a dictionary where the dictionary contains two keys, `path` and `key_data`. Set the `path` to the default location of the authorized\_keys files. On an Enterprise Linux host, for example, the *path=/home/<admin username>/.ssh/authorized\_keys*. Set `key_data` to the actual value of the public key. | | **state** string | **Choices:*** absent * **present** ← | Assert the state of the virtual machine scale set. State `present` will check that the machine exists with the requested configuration. If the configuration of the existing machine does not match, the machine will be updated. State `absent` will remove the virtual machine scale set. | | **subnet\_name** string | | Subnet name. aliases: subnet | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** dictionary | | Dictionary of string:string pairs to assign as metadata to the object. Metadata tags on the object will be updated with any provided values. To remove tags set append\_tags option to false. Currently, Azure DNS zones and Traffic Manager services also don't allow the use of spaces in the tag. Azure Front Door doesn't support the use of Azure Automation and Azure CDN only support 15 tags on resources. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | | **terminate\_event\_timeout\_minutes** string | | timeout time for termination notification event in range between 5 and 15 | | **tier** string | **Choices:*** Basic * Standard | SKU Tier. | | **upgrade\_policy** string | **Choices:*** Manual * Automatic | Upgrade policy. Required when creating the Azure virtual machine scale sets. | | **virtual\_network\_name** string | | Virtual Network name. aliases: virtual\_network | | **virtual\_network\_resource\_group** string | | When creating a virtual machine, if a specific virtual network from another resource group should be used. Use this parameter to specify the resource group to use. | | **vm\_size** string | | A valid Azure VM size value. For example, `Standard_D4`. The list of choices varies depending on the subscription and location. Check your subscription for available choices. | | **zones** list / elements=string | | A list of Availability Zones for your virtual machine scale set. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Create VMSS community.azure.azure_rm_virtualmachinescaleset: resource_group: myResourceGroup name: testvmss vm_size: Standard_DS1_v2 capacity: 2 virtual_network_name: testvnet upgrade_policy: Manual subnet_name: testsubnet terminate_event_timeout_minutes: 10 scale_in_policy: NewestVM admin_username: adminUser ssh_password_enabled: false ssh_public_keys: - path: /home/adminUser/.ssh/authorized_keys key_data: < insert yor ssh public key here... > managed_disk_type: Standard_LRS image: offer: CoreOS publisher: CoreOS sku: Stable version: latest data_disks: - lun: 0 disk_size_gb: 64 caching: ReadWrite managed_disk_type: Standard_LRS - name: Create VMSS with an image that requires plan information community.azure.azure_rm_virtualmachinescaleset: resource_group: myResourceGroup name: testvmss vm_size: Standard_DS1_v2 capacity: 3 virtual_network_name: testvnet upgrade_policy: Manual subnet_name: testsubnet admin_username: adminUser ssh_password_enabled: false ssh_public_keys: - path: /home/adminUser/.ssh/authorized_keys key_data: < insert yor ssh public key here... > managed_disk_type: Standard_LRS image: offer: cis-ubuntu-linux-1804-l1 publisher: center-for-internet-security-inc sku: Stable version: latest plan: name: cis-ubuntu-linux-1804-l1 product: cis-ubuntu-linux-1804-l1 publisher: center-for-internet-security-inc data_disks: - lun: 0 disk_size_gb: 64 caching: ReadWrite managed_disk_type: Standard_LRS - name: Create a VMSS with a custom image community.azure.azure_rm_virtualmachinescaleset: resource_group: myResourceGroup name: testvmss vm_size: Standard_DS1_v2 capacity: 2 virtual_network_name: testvnet upgrade_policy: Manual subnet_name: testsubnet admin_username: adminUser admin_password: password01 managed_disk_type: Standard_LRS image: customimage001 - name: Create a VMSS with a custom image and override data disk community.azure.azure_rm_virtualmachinescaleset: resource_group: myResourceGroup name: testvmss vm_size: Standard_DS1_v2 capacity: 2 virtual_network_name: testvnet upgrade_policy: Manual subnet_name: testsubnet admin_username: adminUser admin_password: password01 managed_disk_type: Standard_LRS image: customimage001 data_disks: - lun: 0 disk_size_gb: 64 caching: ReadWrite managed_disk_type: Standard_LRS create_option: FromImage - name: Create a VMSS with over 100 instances community.azure.azure_rm_virtualmachinescaleset: resource_group: myResourceGroup name: testvmss vm_size: Standard_DS1_v2 capacity: 120 single_placement_group: False virtual_network_name: testvnet upgrade_policy: Manual subnet_name: testsubnet admin_username: adminUser admin_password: password01 managed_disk_type: Standard_LRS image: customimage001 - name: Create a VMSS with a custom image from a particular resource group community.azure.azure_rm_virtualmachinescaleset: resource_group: myResourceGroup name: testvmss vm_size: Standard_DS1_v2 capacity: 2 virtual_network_name: testvnet upgrade_policy: Manual subnet_name: testsubnet admin_username: adminUser admin_password: password01 managed_disk_type: Standard_LRS image: name: customimage001 resource_group: myResourceGroup ``` 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 | | --- | --- | --- | | **azure\_vmss** dictionary | always | Facts about the current state of the object. Note that facts are not part of the registered output but available directly. **Sample:** {'properties': {'overprovision': True, 'scaleInPolicy': {'rules': ['NewestVM']}, 'singlePlacementGroup': True, 'upgradePolicy': {'mode': 'Manual'}, 'virtualMachineProfile': {'networkProfile': {'networkInterfaceConfigurations': [{'name': 'testvmss', 'properties': {'dnsSettings': {'dnsServers': []}, 'enableAcceleratedNetworking': False, 'ipConfigurations': [{'name': 'default', 'properties': {'privateIPAddressVersion': 'IPv4', 'subnet': {'id': '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet'}}}], 'primary': True}}]}, 'osProfile': {'adminUsername': 'testuser', 'computerNamePrefix': 'testvmss', 'linuxConfiguration': {'disablePasswordAuthentication': True, 'ssh': {'publicKeys': [{'keyData': '', 'path': '/home/testuser/.ssh/authorized\_keys'}]}}, 'secrets': []}, 'scheduledEventsProfile': {'terminateNotificationProfile': {'enable': True, 'notBeforeTimeout': 'PT10M'}}, 'storageProfile': {'dataDisks': [{'caching': 'ReadWrite', 'createOption': 'empty', 'diskSizeGB': 64, 'lun': 0, 'managedDisk': {'storageAccountType': 'Standard\_LRS'}}], 'imageReference': {'offer': 'CoreOS', 'publisher': 'CoreOS', 'sku': 'Stable', 'version': '899.17.0'}, 'osDisk': {'caching': 'ReadWrite', 'createOption': 'fromImage', 'managedDisk': {'storageAccountType': 'Standard\_LRS'}}}}}, 'sku': {'capacity': 2, 'name': 'Standard\_DS1\_v2', 'tier': 'Standard'}, 'tags': None, 'type': 'Microsoft.Compute/virtualMachineScaleSets'} | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Sertac Ozercan (@sozercan)
programming_docs
ansible community.azure.azure_rm_image_info – Get facts about azure custom images community.azure.azure\_rm\_image\_info – Get facts about azure custom images ============================================================================ Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_image_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_image\_info](../../azure/azcollection/azure_rm_image_info_module#ansible-collections-azure-azcollection-azure-rm-image-info-module) instead. Synopsis -------- * List azure custom images. The images can be listed where scope of listing can be based on subscription, resource group, name or tags. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | Name of the image to filter from existing images. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string | | Name of resource group. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** string | | List of tags to be matched. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: List images with name community.azure.azure_rm_image_info: name: test-image resource_group: myResourceGroup - name: List images by resource group community.azure.azure_rm_image_info: resource_group: myResourceGroup tags: - testing - foo:bar - name: List all available images under current subscription community.azure.azure_rm_image_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 | | --- | --- | --- | | **images** complex | always | List of image dicts. | | | **data\_disks** complex | always | List of data disks associated with the image. | | | | **blob\_uri** string | success | The virtual hard disk. | | | | **caching** string | success | Type of caching of data disk. **Sample:** read\_only | | | | **disk\_size\_gb** integer | always | Specifies the size of empty data disks in gigabytes. **Sample:** 50 | | | | **lun** integer | always | Specifies the logical unit number of the data disk. | | | | **managed\_disk\_id** string | success | Id of managed disk. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/xx | | | | **storage\_account\_type** string | success | Specifies the storage account type for the managed disk data disk. **Sample:** Standard\_LRS | | | **id** string | always | Id of the image. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/xx | | | **location** string | always | Location of the image. | | | **name** string | always | Name of the image. | | | **os\_disk** string | success | Id of os disk for image. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/xx | | | **os\_disk\_caching** string | always | Specifies caching requirements for the image. | | | **os\_state** string | always | Specifies image operating system state. Possible values are `Generalized` or `Specialized`. **Sample:** Generalized | | | **os\_storage\_account\_type** string | success | Specifies the storage account type for the managed disk. **Sample:** Standard\_LRS | | | **os\_type** string | always | Type of OS for image. **Sample:** Linux | | | **provisioning\_state** string | always | State of image. **Sample:** Succeeded | | | **resource\_group** string | always | Resource group of the image. **Sample:** myResourceGroup | | | **source** string | success | Resource id of source VM from which the image is created. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/xx | | | **tags** complex | success | Dictionary of tags associated with the image. | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Madhura Naniwadekar (@Madhura-CSI) ansible community.azure.azure_rm_mariadbconfiguration_info – Get Azure MariaDB Configuration facts community.azure.azure\_rm\_mariadbconfiguration\_info – Get Azure MariaDB Configuration facts ============================================================================================= Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_mariadbconfiguration_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_mariadbconfiguration\_info](../../azure/azcollection/azure_rm_mariadbconfiguration_info_module#ansible-collections-azure-azcollection-azure-rm-mariadbconfiguration-info-module) instead. Synopsis -------- * Get facts of Azure MariaDB Configuration. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | Setting name. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string / required | | The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **server\_name** string / required | | The name of the server. | | **subscription\_id** string | | Your Azure subscription Id. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get specific setting of MariaDB Server community.azure.azure_rm_mariadbconfiguration_info: resource_group: myResourceGroup server_name: testserver name: deadlock_timeout - name: Get all settings of MariaDB Server community.azure.azure_rm_mariadbconfiguration_info: resource_group: myResourceGroup server_name: server_name ``` 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 | | --- | --- | --- | | **settings** complex | always | A list of dictionaries containing MariaDB Server settings. | | | **description** string | always | Description of the configuration. **Sample:** Deadlock timeout. | | | **id** string | always | Setting resource ID. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DBforMariaDB/servers/testserver /configurations/deadlock\_timeout | | | **name** string | always | Setting name. **Sample:** deadlock\_timeout | | | **source** string | always | Source of the configuration. **Sample:** system-default | | | **value** any | always | Setting value. **Sample:** 1000 | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Zim Kalinowski (@zikalino) * Matti Ranta (@techknowlogick) ansible community.azure.azure_rm_managed_disk community.azure.azure\_rm\_managed\_disk ======================================== Note This redirect is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (version 1.1.0). * This redirect has been **deprecated**. Please update your tasks to use the new name `community.azure.azure_rm_manageddisk` instead. It will be removed in version 2.0.0 of community.azure. * This is a redirect to the [community.azure.azure\_rm\_manageddisk module](azure_rm_manageddisk_module#ansible-collections-community-azure-azure-rm-manageddisk-module). * This redirect also works with Ansible 2.9. * The collection contains the following information on this deprecation: Use azure.azcollection.azure\_rm\_manageddisk instead. ansible community.azure.azure_rm_postgresqlserver_info – Get Azure PostgreSQL Server facts community.azure.azure\_rm\_postgresqlserver\_info – Get Azure PostgreSQL Server facts ===================================================================================== Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_postgresqlserver_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_postgresqlserver\_info](../../azure/azcollection/azure_rm_postgresqlserver_info_module#ansible-collections-azure-azcollection-azure-rm-postgresqlserver-info-module) instead. Synopsis -------- * Get facts of PostgreSQL Server. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | The name of the server. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string / required | | The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** list / elements=string | | Limit results by providing a list of tags. Format tags as 'key' or 'key:value'. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get instance of PostgreSQL Server community.azure.azure_rm_postgresqlserver_info: resource_group: myResourceGroup name: server_name - name: List instances of PostgreSQL Server community.azure.azure_rm_postgresqlserver_info: resource_group: myResourceGroup ``` 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 | | --- | --- | --- | | **servers** complex | always | A list of dictionaries containing facts for PostgreSQL servers. | | | **admin\_username** string | always | The administrator's login name of a server. **Sample:** serveradmin | | | **enforce\_ssl** boolean | always | Enable SSL enforcement. | | | **fully\_qualified\_domain\_name** string | always | The fully qualified domain name of a server. **Sample:** postgreabdud1223.postgres.database.azure.com | | | **id** string | always | Resource ID. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/po stgreabdud1223 | | | **location** string | always | The location the resource resides in. **Sample:** eastus | | | **name** string | always | Resource name. **Sample:** postgreabdud1223 | | | **resource\_group** string | always | Resource group name. **Sample:** myResourceGroup | | | **sku** complex | always | The SKU of the server. | | | | **capacity** integer | always | The scale capacity. **Sample:** 2 | | | | **name** string | always | The name of the SKU. **Sample:** GP\_Gen4\_2 | | | | **tier** string | always | The tier of the particular SKU. **Sample:** GeneralPurpose | | | **storage\_mb** integer | always | The maximum storage allowed for a server. **Sample:** 128000 | | | **tags** dictionary | success | Tags assigned to the resource. Dictionary of string:string pairs. **Sample:** {'tag1': 'abc'} | | | **user\_visible\_state** string | always | A state of a server that is visible to user. **Sample:** Ready | | | **version** string | always | Server version. **Sample:** 9.6 | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Zim Kalinowski (@zikalino)
programming_docs
ansible community.azure.azure_rm_loganalyticsworkspace_info – Get facts of Azure Log Analytics workspaces community.azure.azure\_rm\_loganalyticsworkspace\_info – Get facts of Azure Log Analytics workspaces ==================================================================================================== Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_loganalyticsworkspace_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_loganalyticsworkspace\_info](../../azure/azcollection/azure_rm_loganalyticsworkspace_info_module#ansible-collections-azure-azcollection-azure-rm-loganalyticsworkspace-info-module) instead. Synopsis -------- * Get, query Azure Log Analytics workspaces. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | Name of the workspace. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string / required | | Name of resource group. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **show\_intelligence\_packs** string | | Show the intelligence packs for a workspace. Note this will cost one more network overhead for each workspace, expected slow response. | | **show\_management\_groups** string | | Show the management groups for a workspace. Note this will cost one more network overhead for each workspace, expected slow response. | | **show\_shared\_keys** string | | Show the shared keys for a workspace. Note this will cost one more network overhead for each workspace, expected slow response. | | **show\_usages** string | | Show the list of usages for a workspace. Note this will cost one more network overhead for each workspace, expected slow response. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** string | | Limit results by providing a list of tags. Format tags as 'key' or 'key:value'. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Query a workspace community.azure.azure_rm_loganalyticsworkspace_info: resource_group: myResourceGroup name: myLogAnalyticsWorkspace show_intelligence_packs: true show_management_groups: true show_shared_keys: true show_usages: 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 | | --- | --- | --- | | **id** string | success | Workspace resource path. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/m yLogAnalyticsWorkspace | | **intelligence\_packs** list / elements=string | success | Lists all the intelligence packs possible and whether they are enabled or disabled for a given workspace. **Sample:** [{'enabled': True, 'name': 'CapacityPerformance'}] | | **location** string | success | Resource location. **Sample:** eastus | | **management\_groups** dictionary | success | Management groups connected to the workspace. **Sample:** {'value': []} | | **retention\_in\_days** integer | success | The workspace data retention in days. -1 means Unlimited retention for *sku=unlimited*. 730 days is the maximum allowed for all other SKUs. **Sample:** 40 | | **shared\_keys** dictionary | success | Shared keys for the workspace. **Sample:** {'primarySharedKey': 'BozLY1JnZbxu0jWUQSY8iRPEM8ObmpP8rW+8bUl3+HpDJI+n689SxXgTgU7k1qdxo/WugRLxechxbolAfHM5uA==', 'secondarySharedKey': '7tDt5W0JBrCQKtQA3igfFltLSzJeyr9LmuT+B/ibzd8cdC1neZ1ePOQLBx5NUzc0q2VUIK0cLhWNyFvo/hT8Ww=='} | | **sku** string | success | The SKU of the workspace. **Sample:** per\_gb2018 | | **usages** dictionary | success | Usage metrics for the workspace. **Sample:** {'value': [{'currentValue': 0, 'limit': 524288000, 'name': {'localizedValue': 'Data Analyzed', 'value': 'DataAnalyzed'}, 'nextResetTime': '2017-10-03T00:00:00Z', 'quotaPeriod': 'P1D', 'unit': 'Bytes'}]} | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Yuwei Zhou (@yuwzho) ansible community.azure.azure_rm_containerinstance_info – Get Azure Container Instance facts community.azure.azure\_rm\_containerinstance\_info – Get Azure Container Instance facts ======================================================================================= Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_containerinstance_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_containerinstance\_info](../../azure/azcollection/azure_rm_containerinstance_info_module#ansible-collections-azure-azcollection-azure-rm-containerinstance-info-module) instead. Synopsis -------- * Get facts of Container Instance. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | The name of the container instance. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string / required | | The name of the resource group. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** string | | Limit results by providing a list of tags. Format tags as 'key' or 'key:value'. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get specific Container Instance facts community.azure.azure_rm_containerinstance_info: resource_group: myResourceGroup name: myContainer - name: List Container Instances in a specified resource group name community.azure.azure_rm_containerinstance_info: resource_group: myResourceGroup ``` 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\_groups** complex | always | A list of Container Instance dictionaries. | | | **containers** complex | always | The containers within the container group. **Sample:** containers | | | | **commands** list / elements=string | always | List of commands to execute within the container instance in exec form. **Sample:** ['pip install abc'] | | | | **cpu** integer | always | The required number of CPU cores of the containers. **Sample:** 1 | | | | **environment\_variables** complex | success | List of container environment variables. | | | | | **name** string | success | Environment variable name. | | | | | **value** string | success | Environment variable value. | | | | **image** string | always | The container image name. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ContainerInstance /containerGroups/myContainer | | | | **memory** float | always | The required memory of the containers in GB. **Sample:** 1.5 | | | | **name** string | always | The name of the container instance. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ContainerInstance /containerGroups/myContainer | | | | **ports** list / elements=string | always | List of ports exposed within the container group. **Sample:** [80, 81] | | | **dns\_name\_label** string | always | The Dns name label for the IP. **Sample:** mydomain | | | **id** string | always | The resource id. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ContainerInstance/contain erGroups/myContainer | | | **ip\_address** string | always | IP address of the container instance. **Sample:** 173.15.18.1 | | | **location** string | always | The resource location. **Sample:** westus | | | **name** string | always | The resource name. **Sample:** mycontainers | | | **os\_type** string | always | The OS type of containers. **Sample:** linux | | | **ports** list / elements=string | always | List of ports exposed by the container instance. **Sample:** [80, 81] | | | **resource\_group** string | always | Resource group where the container exists. **Sample:** testrg | | | **tags** dictionary | success | Tags assigned to the resource. Dictionary of string:string pairs. **Sample:** {'tag1': 'abc'} | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Zim Kalinowski (@zikalino) ansible community.azure.azure_rm_roleassignment_info – Gets Azure Role Assignment facts community.azure.azure\_rm\_roleassignment\_info – Gets Azure Role Assignment facts ================================================================================== Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_roleassignment_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_roleassignment\_info](../../azure/azcollection/azure_rm_roleassignment_info_module#ansible-collections-azure-azcollection-azure-rm-roleassignment-info-module) instead. Synopsis -------- * Gets facts of Azure Role Assignment. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **assignee** string | | Object id of a user, group or service principal. Mutually exclusive with *name*. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | Name of role assignment. Mutual exclusive with *assignee*. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **role\_definition\_id** string | | Resource id of role definition. | | **scope** string | | The scope that the role assignment applies to. For example, use /subscriptions/{subscription-id}/ for a subscription. /subscriptions/{subscription-id}/resourceGroups/{resourcegroup-name} for a resource group. /subscriptions/{subscription-id}/resourceGroups/{resourcegroup-name}/providers/{resource-provider}/{resource-type}/{resource-name} for a resource. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get role assignments for specific service principal community.azure.azure_rm_roleassignment_info: assignee: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - name: Get role assignments for specific scope community.azure.azure_rm_roleassignment_info: scope: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx ``` 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 | | --- | --- | --- | | **roleassignments** complex | always | List of role assignments. | | | **id** string | always | Id of role assignment. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/providers/Microsoft.Authorization/roleAssignments/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | | | **name** string | always | Name of role assignment. **Sample:** myRoleAssignment | | | **principal\_id** string | always | Principal Id of the role assigned to. **Sample:** xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | | | **role\_definition\_id** string | always | Role definition id that was assigned to principal\_id. **Sample:** xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | | | **scope** string | always | The role assignment scope. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | | | **type** string | always | Type of role assignment. **Sample:** custom | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Yunge Zhu(@yungezz)
programming_docs
ansible community.azure.azure_rm_virtualmachine_info – Get virtual machine facts community.azure.azure\_rm\_virtualmachine\_info – Get virtual machine facts =========================================================================== Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_virtualmachine_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_virtualmachine\_info](../../azure/azcollection/azure_rm_virtualmachine_info_module#ansible-collections-azure-azcollection-azure-rm-virtualmachine-info-module) instead. Synopsis -------- * Get facts for one or all virtual machines in a resource group. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | Name of the virtual machine. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string | | Name of the resource group containing the virtual machines (required when filtering by vm name). | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** string | | Limit results by providing a list of tags. Format tags as 'key' or 'key:value'. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get facts for all virtual machines of a resource group community.azure.azure_rm_virtualmachine_info: resource_group: myResourceGroup - name: Get facts by name community.azure.azure_rm_virtualmachine_info: resource_group: myResourceGroup name: myVm - name: Get facts by tags community.azure.azure_rm_virtualmachine_info: resource_group: myResourceGroup tags: - testing - foo:bar ``` 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 | | --- | --- | --- | | **vms** complex | always | List of virtual machines. | | | **admin\_username** string | always | Administrator user name. **Sample:** admin | | | **boot\_diagnostics** complex | always | Information about the boot diagnostics settings. | | | | **console\_screenshot\_uri** string | always | Contains a URI to grab a console screenshot. Only present if enabled. **Sample:** https://mystorageaccountname.blob.core.windows.net/bootdiagnostics-myvm01-a4db09a6-ab7f-4d80-9da8-fbceaef9288a/ myVm.a4db09a6-ab7f-4d80-9da8-fbceaef9288a.screenshot.bmp | | | | **enabled** boolean | always | Indicates if boot diagnostics are enabled. **Sample:** True | | | | **serial\_console\_log\_uri** string | always | Contains a URI to grab the serial console log. Only present if enabled. **Sample:** https://mystorageaccountname.blob.core.windows.net/bootdiagnostics-myvm01-a4db09a6-ab7f-4d80-9da8-fbceaef9288a/ myVm.a4db09a6-ab7f-4d80-9da8-fbceaef9288a.serialconsole.log | | | | **storage\_uri** string | always | Indicates the storage account used by boot diagnostics. **Sample:** https://mystorageaccountname.blob.core.windows.net/ | | | **data\_disks** complex | always | List of attached data disks. | | | | **caching** string | always | Type of data disk caching. **Sample:** ReadOnly | | | | **disk\_size\_gb** integer | always | The initial disk size in GB for blank data disks. **Sample:** 64 | | | | **lun** integer | always | The logical unit number for data disk. | | | | **managed\_disk\_type** string | always | Managed data disk type. **Sample:** Standard\_LRS | | | **id** string | always | Resource ID. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm | | | **image** complex | always | Image specification. | | | | **id** string | when created from custom image | Custom image resource ID. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/myImage | | | | **offer** string | when created from marketplace image | The offer of the platform image or marketplace image used to create the virtual machine. **Sample:** RHEL | | | | **publisher** string | when created from marketplace image | Publisher name. **Sample:** RedHat | | | | **sku** string | when created from marketplace image | SKU name. **Sample:** 7-RAW | | | | **version** string | when created from marketplace image | Image version. **Sample:** 7.5.2018050901 | | | **location** string | always | Resource location. **Sample:** japaneast | | | **name** string | always | Resource name. **Sample:** myVm | | | **network\_interface\_names** list / elements=string | always | List of attached network interfaces. **Sample:** ['myNetworkInterface'] | | | **os\_disk\_caching** string | always | Type of OS disk caching. **Sample:** ReadOnly | | | **os\_type** string | always | Base type of operating system. **Sample:** Linux | | | **power\_state** string | always | Power state of the virtual machine. **Sample:** running | | | **resource\_group** string | always | Resource group. **Sample:** myResourceGroup | | | **state** string | always | State of the resource. **Sample:** present | | | **tags** dictionary | always | Resource tags. **Sample:** {'key1': 'value1'} | | | **vm\_size** string | always | Virtual machine size. **Sample:** Standard\_D4 | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Gustavo Muniz do Carmo (@gustavomcarmo) * Zim Kalinowski (@zikalino) ansible community.azure.azure_rm_virtualmachinescaleset_info – Get Virtual Machine Scale Set facts community.azure.azure\_rm\_virtualmachinescaleset\_info – Get Virtual Machine Scale Set facts ============================================================================================= Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_virtualmachinescaleset_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_virtualmachinescaleset\_info](../../azure/azcollection/azure_rm_virtualmachinescaleset_info_module#ansible-collections-azure-azcollection-azure-rm-virtualmachinescaleset-info-module) instead. Synopsis -------- * Get facts for a virtual machine scale set. * Note that this module was called [community.azure.azure\_rm\_virtualmachine\_scaleset\_facts](azure_rm_virtualmachine_scaleset_facts_module#ansible-collections-community-azure-azure-rm-virtualmachine-scaleset-facts-module) before Ansible 2.8. The usage did not change. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **format** string | **Choices:*** curated * **raw** ← | Format of the data returned. If `raw` is selected information will be returned in raw format from Azure Python SDK. If `curated` is selected the structure will be identical to input parameters of [community.azure.azure\_rm\_virtualmachinescaleset](azure_rm_virtualmachinescaleset_module) module. In Ansible 2.5 and lower facts are always returned in raw format. Please note that this option will be deprecated in 2.10 when curated format will become the only supported format. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | Limit results to a specific virtual machine scale set. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string | | The resource group to search for the desired virtual machine scale set. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** string | | List of tags to be matched. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get facts for a virtual machine scale set community.azure.azure_rm_virtualmachinescaleset_info: resource_group: myResourceGroup name: testvmss001 format: curated - name: Get facts for all virtual networks community.azure.azure_rm_virtualmachinescaleset_info: resource_group: myResourceGroup - name: Get facts by tags community.azure.azure_rm_virtualmachinescaleset_info: resource_group: myResourceGroup tags: - 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 | | --- | --- | --- | | **vmss** complex | always | List of virtual machine scale sets. | | | **admin\_username** string | always | Admin username used to access the host after it is created. **Sample:** adminuser | | | **capacity** integer | always | Capacity of VMSS. **Sample:** 2 | | | **data\_disks** complex | always | List of attached data disks. | | | | **caching** string | always | Type of data disk caching. **Sample:** ReadOnly | | | | **disk\_size\_gb** integer | always | The initial disk size in GB for blank data disks. **Sample:** 64 | | | | **lun** integer | always | The logical unit number for data disk. | | | | **managed\_disk\_type** string | always | Managed data disk type. **Sample:** Standard\_LRS | | | **id** string | always | Resource ID. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/scalesets/myscaleset | | | **image** complex | always | Image specification. | | | | **offer** string | always | The offer of the platform image or marketplace image used to create the virtual machine. **Sample:** RHEL | | | | **publisher** string | always | Publisher name. **Sample:** RedHat | | | | **sku** string | always | SKU name. **Sample:** 7-RAW | | | | **version** string | always | Image version. **Sample:** 7.5.2018050901 | | | **load\_balancer** string | always | Load balancer name. **Sample:** testlb | | | **location** string | always | Resource location. **Sample:** japaneast | | | **managed\_disk\_type** string | always | Managed data disk type. **Sample:** Standard\_LRS | | | **name** string | always | Resource name. **Sample:** myvmss | | | **os\_disk\_caching** string | always | Type of OS disk caching. **Sample:** ReadOnly | | | **os\_type** string | always | Base type of operating system. **Sample:** Linux | | | **overprovision** boolean | success | Specifies whether the Virtual Machine Scale Set should be overprovisioned. **Sample:** True | | | **resource\_group** string | always | Resource group. **Sample:** myResourceGroup | | | **ssh\_password\_enabled** boolean | always | Is SSH password authentication enabled. Valid only for Linux. **Sample:** True | | | **subnet\_name** string | always | Subnet name. **Sample:** testsubnet | | | **tags** dictionary | always | Tags assigned to the resource. Dictionary of string:string pairs. **Sample:** {'tag1': 'abc'} | | | **tier** string | always | SKU Tier. **Sample:** Basic | | | **upgrade\_policy** string | always | Upgrade policy. **Sample:** Manual | | | **virtual\_network\_name** string | always | Associated virtual network name. **Sample:** testvn | | | **vm\_size** string | always | Virtual machine size. **Sample:** Standard\_D4 | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Sertac Ozercan (@sozercan)
programming_docs
ansible community.azure.azure_rm_devtestlabvirtualnetwork_info – Get Azure DevTest Lab Virtual Network facts community.azure.azure\_rm\_devtestlabvirtualnetwork\_info – Get Azure DevTest Lab Virtual Network facts ======================================================================================================= Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_devtestlabvirtualnetwork_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_devtestlabvirtualnetwork\_info](../../azure/azcollection/azure_rm_devtestlabvirtualnetwork_info_module#ansible-collections-azure-azcollection-azure-rm-devtestlabvirtualnetwork-info-module) instead. Synopsis -------- * Get facts of Azure DevTest Lab Virtual Network. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **lab\_name** string / required | | The name of DevTest Lab. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | The name of DevTest Lab Virtual Network. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string / required | | The name of the resource group. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get instance of DevTest Lab Virtual Network community.azure.azure_rm_devtestlabvirtualnetwork_info: resource_group: myResourceGroup lab_name: myLab name: myVirtualNetwork - name: List all Virtual Networks in DevTest Lab community.azure.azure_rm_devtestlabvirtualnetwork_info: resource_group: myResourceGroup lab_name: myLab name: myVirtualNetwork ``` 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 | | --- | --- | --- | | **virtualnetworks** complex | always | A list of dictionaries containing facts for DevTest Lab Virtual Network. | | | **description** string | always | Description of the virtual network. **Sample:** My Virtual Network | | | **external\_provider\_resource\_id** string | always | Resource id of an external virtual network. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/my VirtualNetwork | | | **id** string | always | The identifier of the virtual network. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myResourceGroup/providers/microsoft.devtestlab/labs/myLab/virt ualnetworks/myVirtualNetwork | | | **lab\_name** string | always | Name of the lab. **Sample:** myLab | | | **name** string | always | Name of the virtual network. **Sample:** myVirtualNetwork | | | **provisioning\_state** string | always | Provisioning state of the virtual network. **Sample:** Succeeded | | | **resource\_group** string | always | Name of the resource group. **Sample:** myResourceGroup | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Zim Kalinowski (@zikalino) ansible community.azure.azure_rm_virtualmachine_scaleset_facts community.azure.azure\_rm\_virtualmachine\_scaleset\_facts ========================================================== Note This redirect is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (version 1.1.0). * This redirect has been **deprecated**. Please update your tasks to use the new name `community.azure.azure_rm_virtualmachinescaleset_info` instead. It will be removed in version 2.0.0 of community.azure. * This is a redirect to the [community.azure.azure\_rm\_virtualmachinescaleset\_info module](azure_rm_virtualmachinescaleset_info_module#ansible-collections-community-azure-azure-rm-virtualmachinescaleset-info-module). * This redirect also works with Ansible 2.9. * The collection contains the following information on this deprecation: Use azure.azcollection.azure\_rm\_virtualmachinescaleset\_info instead. ansible community.azure.azure_rm_resource_info – Generic facts of Azure resources community.azure.azure\_rm\_resource\_info – Generic facts of Azure resources ============================================================================ Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_resource_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_resource\_info](../../azure/azcollection/azure_rm_resource_info_module#ansible-collections-azure-azcollection-azure-rm-resource-info-module) instead. Synopsis -------- * Obtain facts of any resource using Azure REST API. * This module gives access to resources that are not supported via Ansible modules. * Refer to <https://docs.microsoft.com/en-us/rest/api/> regarding details related to specific resource REST API. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **api\_version** string | | Specific API version to be used. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **provider** string | | Provider type, should be specified in no URL is given. | | **resource\_group** string | | Resource group to be used. Required if URL is not specified. | | **resource\_name** string | | Resource name. | | **resource\_type** string | | Resource type. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subresource** string | | List of subresources. | | | **name** string | | Subresource name. | | | **namespace** string | | Subresource namespace. | | | **type** string | | Subresource type. | | **subscription\_id** string | | Your Azure subscription Id. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | | **url** string | | Azure RM Resource URL. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get scaleset info community.azure.azure_rm_resource_info: resource_group: myResourceGroup provider: compute resource_type: virtualmachinescalesets resource_name: myVmss api_version: "2017-12-01" - name: Query all the resources in the resource group community.azure.azure_rm_resource_info: resource_group: "{{ resource_group }}" resource_type: resources ``` 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 | | --- | --- | --- | | **response** complex | always | Response specific to resource type. | | | **id** string | always | Id of the Azure resource. **Sample:** /subscriptions/xxxx...xxxx/resourceGroups/v-xisuRG/providers/Microsoft.Compute/virtualMachines/myVM | | | **location** string | always | Resource location. **Sample:** eastus | | | **name** string | always | Resource name. **Sample:** myVM | | | **properties** complex | always | Specifies the virtual machine's property. | | | | **diagnosticsProfile** complex | always | Specifies the boot diagnostic settings state. | | | | | **bootDiagnostics** dictionary | always | A debugging feature, which to view Console Output and Screenshot to diagnose VM status. **Sample:** {'enabled': True, 'storageUri': 'https://vxisurgdiag.blob.core.windows.net/'} | | | | **hardwareProfile** dictionary | always | Specifies the hardware settings for the virtual machine. **Sample:** {'vmSize': 'Standard\_D2s\_v3'} | | | | **networkProfile** complex | always | Specifies the network interfaces of the virtual machine. | | | | | **networkInterfaces** list / elements=string | always | Describes a network interface reference. **Sample:** [{'id': '/subscriptions/xxxx...xxxx/resourceGroups/v-xisuRG/providers/Microsoft.Network/networkInterfaces/myvm441'}] | | | | **osProfile** complex | always | Specifies the operating system settings for the virtual machine. | | | | | **adminUsername** string | always | Specifies the name of the administrator account. **Sample:** azureuser | | | | | **allowExtensionOperations** boolean | always | Specifies whether extension operations should be allowed on the virtual machine. This may only be set to False when no extensions are present on the virtual machine. **Sample:** True | | | | | **computerName** string | always | Specifies the host OS name of the virtual machine. **Sample:** myVM | | | | | **linuxConfiguration** dictionary | when OS type is Linux | Specifies the Linux operating system settings on the virtual machine. **Sample:** {'disablePasswordAuthentication': False, 'provisionVMAgent': True} | | | | | **requireGuestProvisionSignale** boolean | always | Specifies the host require guest provision signal or not. **Sample:** True | | | | | **secrets** list / elements=string | always | Specifies set of certificates that should be installed onto the virtual machine. | | | | **provisioningState** string | always | The provisioning state. **Sample:** Succeeded | | | | **storageProfile** complex | always | Specifies the storage account type for the managed disk. | | | | | **dataDisks** list / elements=string | always | Specifies the parameters that are used to add a data disk to virtual machine. **Sample:** [{'caching': 'None', 'createOption': 'Attach', 'diskSizeGB': 1023, 'lun': 2, 'managedDisk': {'id': '/subscriptions/xxxx....xxxx/resourceGroups/V-XISURG/providers/Microsoft.Compute/disks/testdisk2', 'storageAccountType': 'StandardSSD\_LRS'}, 'name': 'testdisk2'}, {'caching': 'None', 'createOption': 'Attach', 'diskSizeGB': 1023, 'lun': 1, 'managedDisk': {'id': '/subscriptions/xxxx...xxxx/resourceGroups/V-XISURG/providers/Microsoft.Compute/disks/testdisk3', 'storageAccountType': 'StandardSSD\_LRS'}, 'name': 'testdisk3'}] | | | | | **imageReference** dictionary | always | Specifies information about the image to use. **Sample:** {'offer': 'UbuntuServer', 'publisher': 'Canonical', 'sku': '18.04-LTS', 'version': 'latest'} | | | | | **osDisk** dictionary | always | Specifies information about the operating system disk used by the virtual machine. **Sample:** {'caching': 'ReadWrite', 'createOption': 'FromImage', 'diskSizeGB': 30, 'managedDisk': {'id': '/subscriptions/xxx...xxxx/resourceGroups/v-xisuRG/providers/Microsoft.Compute/disks/myVM\_disk1\_xxx', 'storageAccountType': 'Premium\_LRS'}, 'name': 'myVM\_disk1\_xxx', 'osType': 'Linux'} | | | | **vmID** string | always | Specifies the VM unique ID which is a 128-bits identifier that is encoded and stored in all Azure laaS VMs SMBIOS. It can be read using platform BIOS commands. **Sample:** eb86d9bb-6725-4787-a487-2e497d5b340c | | | **type** string | always | The type of identity used for the virtual machine. **Sample:** Microsoft.Compute/virtualMachines | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Zim Kalinowski (@zikalino)
programming_docs
ansible Community.Azure Community.Azure =============== Collection version 1.1.0 Plugin Index ------------ These are the plugins in the community.azure collection ### Modules * [azure\_rm\_aks\_info](azure_rm_aks_info_module#ansible-collections-community-azure-azure-rm-aks-info-module) – Get Azure Kubernetes Service facts * [azure\_rm\_aksversion\_info](azure_rm_aksversion_info_module#ansible-collections-community-azure-azure-rm-aksversion-info-module) – Get available kubernetes versions supported by Azure Kubernetes Service * [azure\_rm\_applicationsecuritygroup\_info](azure_rm_applicationsecuritygroup_info_module#ansible-collections-community-azure-azure-rm-applicationsecuritygroup-info-module) – Get Azure Application Security Group facts * [azure\_rm\_appserviceplan\_info](azure_rm_appserviceplan_info_module#ansible-collections-community-azure-azure-rm-appserviceplan-info-module) – Get azure app service plan facts * [azure\_rm\_automationaccount\_info](azure_rm_automationaccount_info_module#ansible-collections-community-azure-azure-rm-automationaccount-info-module) – Get Azure automation account facts * [azure\_rm\_autoscale\_info](azure_rm_autoscale_info_module#ansible-collections-community-azure-azure-rm-autoscale-info-module) – Get Azure Auto Scale Setting facts * [azure\_rm\_availabilityset\_info](azure_rm_availabilityset_info_module#ansible-collections-community-azure-azure-rm-availabilityset-info-module) – Get Azure Availability Set facts * [azure\_rm\_cdnendpoint\_info](azure_rm_cdnendpoint_info_module#ansible-collections-community-azure-azure-rm-cdnendpoint-info-module) – Get Azure CDN endpoint facts * [azure\_rm\_cdnprofile\_info](azure_rm_cdnprofile_info_module#ansible-collections-community-azure-azure-rm-cdnprofile-info-module) – Get Azure CDN profile facts * [azure\_rm\_containerinstance\_info](azure_rm_containerinstance_info_module#ansible-collections-community-azure-azure-rm-containerinstance-info-module) – Get Azure Container Instance facts * [azure\_rm\_containerregistry\_info](azure_rm_containerregistry_info_module#ansible-collections-community-azure-azure-rm-containerregistry-info-module) – Get Azure Container Registry facts * [azure\_rm\_cosmosdbaccount\_info](azure_rm_cosmosdbaccount_info_module#ansible-collections-community-azure-azure-rm-cosmosdbaccount-info-module) – Get Azure Cosmos DB Account facts * [azure\_rm\_deployment\_info](azure_rm_deployment_info_module#ansible-collections-community-azure-azure-rm-deployment-info-module) – Get Azure Deployment facts * [azure\_rm\_devtestlab\_info](azure_rm_devtestlab_info_module#ansible-collections-community-azure-azure-rm-devtestlab-info-module) – Get Azure DevTest Lab facts * [azure\_rm\_devtestlabarmtemplate\_info](azure_rm_devtestlabarmtemplate_info_module#ansible-collections-community-azure-azure-rm-devtestlabarmtemplate-info-module) – Get Azure DevTest Lab ARM Template facts * [azure\_rm\_devtestlabartifact\_info](azure_rm_devtestlabartifact_info_module#ansible-collections-community-azure-azure-rm-devtestlabartifact-info-module) – Get Azure DevTest Lab Artifact facts * [azure\_rm\_devtestlabartifactsource\_info](azure_rm_devtestlabartifactsource_info_module#ansible-collections-community-azure-azure-rm-devtestlabartifactsource-info-module) – Get Azure DevTest Lab Artifact Source facts * [azure\_rm\_devtestlabcustomimage\_info](azure_rm_devtestlabcustomimage_info_module#ansible-collections-community-azure-azure-rm-devtestlabcustomimage-info-module) – Get Azure DevTest Lab Custom Image facts * [azure\_rm\_devtestlabenvironment\_info](azure_rm_devtestlabenvironment_info_module#ansible-collections-community-azure-azure-rm-devtestlabenvironment-info-module) – Get Azure Environment facts * [azure\_rm\_devtestlabpolicy\_info](azure_rm_devtestlabpolicy_info_module#ansible-collections-community-azure-azure-rm-devtestlabpolicy-info-module) – Get Azure DTL Policy facts * [azure\_rm\_devtestlabschedule\_info](azure_rm_devtestlabschedule_info_module#ansible-collections-community-azure-azure-rm-devtestlabschedule-info-module) – Get Azure Schedule facts * [azure\_rm\_devtestlabvirtualmachine\_info](azure_rm_devtestlabvirtualmachine_info_module#ansible-collections-community-azure-azure-rm-devtestlabvirtualmachine-info-module) – Get Azure DevTest Lab Virtual Machine facts * [azure\_rm\_devtestlabvirtualnetwork\_info](azure_rm_devtestlabvirtualnetwork_info_module#ansible-collections-community-azure-azure-rm-devtestlabvirtualnetwork-info-module) – Get Azure DevTest Lab Virtual Network facts * [azure\_rm\_dnsrecordset\_info](azure_rm_dnsrecordset_info_module#ansible-collections-community-azure-azure-rm-dnsrecordset-info-module) – Get DNS Record Set facts * [azure\_rm\_dnszone\_info](azure_rm_dnszone_info_module#ansible-collections-community-azure-azure-rm-dnszone-info-module) – Get DNS zone facts * [azure\_rm\_functionapp\_info](azure_rm_functionapp_info_module#ansible-collections-community-azure-azure-rm-functionapp-info-module) – Get Azure Function App facts * [azure\_rm\_hdinsightcluster\_info](azure_rm_hdinsightcluster_info_module#ansible-collections-community-azure-azure-rm-hdinsightcluster-info-module) – Get Azure HDInsight Cluster facts * [azure\_rm\_image\_info](azure_rm_image_info_module#ansible-collections-community-azure-azure-rm-image-info-module) – Get facts about azure custom images * [azure\_rm\_loadbalancer\_info](azure_rm_loadbalancer_info_module#ansible-collections-community-azure-azure-rm-loadbalancer-info-module) – Get load balancer facts * [azure\_rm\_lock\_info](azure_rm_lock_info_module#ansible-collections-community-azure-azure-rm-lock-info-module) – Manage Azure locks * [azure\_rm\_loganalyticsworkspace\_info](azure_rm_loganalyticsworkspace_info_module#ansible-collections-community-azure-azure-rm-loganalyticsworkspace-info-module) – Get facts of Azure Log Analytics workspaces * [azure\_rm\_manageddisk](azure_rm_manageddisk_module#ansible-collections-community-azure-azure-rm-manageddisk-module) – Manage Azure Manage Disks * [azure\_rm\_manageddisk\_info](azure_rm_manageddisk_info_module#ansible-collections-community-azure-azure-rm-manageddisk-info-module) – Get managed disk facts * [azure\_rm\_mariadbconfiguration\_info](azure_rm_mariadbconfiguration_info_module#ansible-collections-community-azure-azure-rm-mariadbconfiguration-info-module) – Get Azure MariaDB Configuration facts * [azure\_rm\_mariadbdatabase\_info](azure_rm_mariadbdatabase_info_module#ansible-collections-community-azure-azure-rm-mariadbdatabase-info-module) – Get Azure MariaDB Database facts * [azure\_rm\_mariadbfirewallrule\_info](azure_rm_mariadbfirewallrule_info_module#ansible-collections-community-azure-azure-rm-mariadbfirewallrule-info-module) – Get Azure MariaDB Firewall Rule facts * [azure\_rm\_mariadbserver\_info](azure_rm_mariadbserver_info_module#ansible-collections-community-azure-azure-rm-mariadbserver-info-module) – Get Azure MariaDB Server facts * [azure\_rm\_mysqlconfiguration\_info](azure_rm_mysqlconfiguration_info_module#ansible-collections-community-azure-azure-rm-mysqlconfiguration-info-module) – Get Azure MySQL Configuration facts * [azure\_rm\_mysqldatabase\_info](azure_rm_mysqldatabase_info_module#ansible-collections-community-azure-azure-rm-mysqldatabase-info-module) – Get Azure MySQL Database facts * [azure\_rm\_mysqlfirewallrule\_info](azure_rm_mysqlfirewallrule_info_module#ansible-collections-community-azure-azure-rm-mysqlfirewallrule-info-module) – Get Azure MySQL Firewall Rule facts * [azure\_rm\_mysqlserver\_info](azure_rm_mysqlserver_info_module#ansible-collections-community-azure-azure-rm-mysqlserver-info-module) – Get Azure MySQL Server facts * [azure\_rm\_networkinterface\_info](azure_rm_networkinterface_info_module#ansible-collections-community-azure-azure-rm-networkinterface-info-module) – Get network interface facts * [azure\_rm\_postgresqlconfiguration\_info](azure_rm_postgresqlconfiguration_info_module#ansible-collections-community-azure-azure-rm-postgresqlconfiguration-info-module) – Get Azure PostgreSQL Configuration facts * [azure\_rm\_postgresqldatabase\_info](azure_rm_postgresqldatabase_info_module#ansible-collections-community-azure-azure-rm-postgresqldatabase-info-module) – Get Azure PostgreSQL Database facts * [azure\_rm\_postgresqlfirewallrule\_info](azure_rm_postgresqlfirewallrule_info_module#ansible-collections-community-azure-azure-rm-postgresqlfirewallrule-info-module) – Get Azure PostgreSQL Firewall Rule facts * [azure\_rm\_postgresqlserver\_info](azure_rm_postgresqlserver_info_module#ansible-collections-community-azure-azure-rm-postgresqlserver-info-module) – Get Azure PostgreSQL Server facts * [azure\_rm\_publicipaddress\_info](azure_rm_publicipaddress_info_module#ansible-collections-community-azure-azure-rm-publicipaddress-info-module) – Get public IP facts * [azure\_rm\_rediscache\_info](azure_rm_rediscache_info_module#ansible-collections-community-azure-azure-rm-rediscache-info-module) – Get Azure Cache for Redis instance facts * [azure\_rm\_resource\_info](azure_rm_resource_info_module#ansible-collections-community-azure-azure-rm-resource-info-module) – Generic facts of Azure resources * [azure\_rm\_resourcegroup\_info](azure_rm_resourcegroup_info_module#ansible-collections-community-azure-azure-rm-resourcegroup-info-module) – Get resource group facts * [azure\_rm\_roleassignment\_info](azure_rm_roleassignment_info_module#ansible-collections-community-azure-azure-rm-roleassignment-info-module) – Gets Azure Role Assignment facts * [azure\_rm\_roledefinition\_info](azure_rm_roledefinition_info_module#ansible-collections-community-azure-azure-rm-roledefinition-info-module) – Get Azure Role Definition facts * [azure\_rm\_routetable\_info](azure_rm_routetable_info_module#ansible-collections-community-azure-azure-rm-routetable-info-module) – Get route table facts * [azure\_rm\_securitygroup\_info](azure_rm_securitygroup_info_module#ansible-collections-community-azure-azure-rm-securitygroup-info-module) – Get security group facts * [azure\_rm\_servicebus\_info](azure_rm_servicebus_info_module#ansible-collections-community-azure-azure-rm-servicebus-info-module) – Get servicebus facts * [azure\_rm\_sqldatabase\_info](azure_rm_sqldatabase_info_module#ansible-collections-community-azure-azure-rm-sqldatabase-info-module) – Get Azure SQL Database facts * [azure\_rm\_sqlfirewallrule\_info](azure_rm_sqlfirewallrule_info_module#ansible-collections-community-azure-azure-rm-sqlfirewallrule-info-module) – Get Azure SQL Firewall Rule facts * [azure\_rm\_sqlserver\_info](azure_rm_sqlserver_info_module#ansible-collections-community-azure-azure-rm-sqlserver-info-module) – Get SQL Server facts * [azure\_rm\_storageaccount\_info](azure_rm_storageaccount_info_module#ansible-collections-community-azure-azure-rm-storageaccount-info-module) – Get storage account facts * [azure\_rm\_subnet\_info](azure_rm_subnet_info_module#ansible-collections-community-azure-azure-rm-subnet-info-module) – Get Azure Subnet facts * [azure\_rm\_trafficmanagerendpoint\_info](azure_rm_trafficmanagerendpoint_info_module#ansible-collections-community-azure-azure-rm-trafficmanagerendpoint-info-module) – Get Azure Traffic Manager endpoint facts * [azure\_rm\_trafficmanagerprofile\_info](azure_rm_trafficmanagerprofile_info_module#ansible-collections-community-azure-azure-rm-trafficmanagerprofile-info-module) – Get Azure Traffic Manager profile facts * [azure\_rm\_virtualmachine\_info](azure_rm_virtualmachine_info_module#ansible-collections-community-azure-azure-rm-virtualmachine-info-module) – Get virtual machine facts * [azure\_rm\_virtualmachineextension](azure_rm_virtualmachineextension_module#ansible-collections-community-azure-azure-rm-virtualmachineextension-module) – Managed Azure Virtual Machine extension * [azure\_rm\_virtualmachineextension\_info](azure_rm_virtualmachineextension_info_module#ansible-collections-community-azure-azure-rm-virtualmachineextension-info-module) – Get Azure Virtual Machine Extension facts * [azure\_rm\_virtualmachineimage\_info](azure_rm_virtualmachineimage_info_module#ansible-collections-community-azure-azure-rm-virtualmachineimage-info-module) – Get virtual machine image facts * [azure\_rm\_virtualmachinescaleset](azure_rm_virtualmachinescaleset_module#ansible-collections-community-azure-azure-rm-virtualmachinescaleset-module) – Manage Azure virtual machine scale sets * [azure\_rm\_virtualmachinescaleset\_info](azure_rm_virtualmachinescaleset_info_module#ansible-collections-community-azure-azure-rm-virtualmachinescaleset-info-module) – Get Virtual Machine Scale Set facts * [azure\_rm\_virtualmachinescalesetextension\_info](azure_rm_virtualmachinescalesetextension_info_module#ansible-collections-community-azure-azure-rm-virtualmachinescalesetextension-info-module) – Get Azure Virtual Machine Scale Set Extension facts * [azure\_rm\_virtualmachinescalesetinstance\_info](azure_rm_virtualmachinescalesetinstance_info_module#ansible-collections-community-azure-azure-rm-virtualmachinescalesetinstance-info-module) – Get Azure Virtual Machine Scale Set Instance facts * [azure\_rm\_virtualnetwork\_info](azure_rm_virtualnetwork_info_module#ansible-collections-community-azure-azure-rm-virtualnetwork-info-module) – Get virtual network facts * [azure\_rm\_virtualnetworkpeering\_info](azure_rm_virtualnetworkpeering_info_module#ansible-collections-community-azure-azure-rm-virtualnetworkpeering-info-module) – Get facts of Azure Virtual Network Peering * [azure\_rm\_webapp\_info](azure_rm_webapp_info_module#ansible-collections-community-azure-azure-rm-webapp-info-module) – Get Azure web app facts See also List of [collections](../../index#list-of-collections) with docs hosted here. ansible community.azure.azure_rm_mysqlserver_info – Get Azure MySQL Server facts community.azure.azure\_rm\_mysqlserver\_info – Get Azure MySQL Server facts =========================================================================== Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_mysqlserver_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_mysqlserver\_info](../../azure/azcollection/azure_rm_mysqlserver_info_module#ansible-collections-azure-azcollection-azure-rm-mysqlserver-info-module) instead. Synopsis -------- * Get facts of MySQL Server. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | The name of the server. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string / required | | The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** list / elements=string | | Limit results by providing a list of tags. Format tags as 'key' or 'key:value'. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get instance of MySQL Server community.azure.azure_rm_mysqlserver_info: resource_group: myResourceGroup name: server_name - name: List instances of MySQL Server community.azure.azure_rm_mysqlserver_info: resource_group: myResourceGroup ``` 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 | | --- | --- | --- | | **servers** complex | always | A list of dictionaries containing facts for MySQL servers. | | | **admin\_username** string | always | The administrator's login name of a server. **Sample:** serveradmin | | | **enforce\_ssl** boolean | always | Enable SSL enforcement. | | | **fully\_qualified\_domain\_name** string | always | The fully qualified domain name of a server. **Sample:** myabdud1223.mys.database.azure.com | | | **id** string | always | Resource ID. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DBforMySQL/servers/myabdud1223 | | | **location** string | always | The location the resource resides in. **Sample:** eastus | | | **name** string | always | Resource name. **Sample:** myabdud1223 | | | **resource\_group** string | always | Resource group name. **Sample:** myResourceGroup | | | **sku** complex | always | The SKU of the server. | | | | **capacity** integer | always | The scale capacity. **Sample:** 2 | | | | **name** string | always | The name of the SKU. **Sample:** GP\_Gen4\_2 | | | | **tier** string | always | The tier of the particular SKU. **Sample:** GeneralPurpose | | | **storage\_mb** integer | always | The maximum storage allowed for a server. **Sample:** 128000 | | | **tags** dictionary | success | Tags assigned to the resource. Dictionary of string:string pairs. **Sample:** {'tag1': 'abc'} | | | **user\_visible\_state** string | always | A state of a server that is visible to user. **Sample:** Ready | | | **version** string | always | Server version. **Sample:** 9.6 | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Zim Kalinowski (@zikalino)
programming_docs
ansible community.azure.azure_rm_manageddisk – Manage Azure Manage Disks community.azure.azure\_rm\_manageddisk – Manage Azure Manage Disks ================================================================== Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_manageddisk`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_manageddisk](../../azure/azcollection/azure_rm_manageddisk_module#ansible-collections-azure-azcollection-azure-rm-manageddisk-module) instead. Synopsis -------- * Create, update and delete an Azure Managed Disk. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **append\_tags** boolean | **Choices:*** no * **yes** ← | Use to control if tags field is canonical or just appends to existing tags. When canonical, any tags not found in the tags parameter will be removed from the object's metadata. | | **attach\_caching** string | **Choices:*** * read\_only * read\_write | Disk caching policy controlled by VM. Will be used when attached to the VM defined by `managed_by`. If this option is different from the current caching policy, the managed disk will be deattached and attached with current caching option again. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **create\_option** string | **Choices:*** empty * import * copy | `import` from a VHD file in *source\_uri* and `copy` from previous managed disk *source\_uri*. | | **disk\_size\_gb** string | | Size in GB of the managed disk to be created. If *create\_option=copy* then the value must be greater than or equal to the source's size. | | **location** string | | Valid Azure location. Defaults to location of the resource group. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **lun** integer | | The logical unit number for data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. | | **managed\_by** string | | Name of an existing virtual machine with which the disk is or will be associated, this VM should be in the same resource group. To detach a disk from a vm, explicitly set to ''. If this option is unset, the value will not be changed. | | **name** string / required | | Name of the managed disk. | | **os\_type** string | **Choices:*** linux * windows | Type of Operating System. Used when *create\_option=copy* or *create\_option=import* and the source is an OS disk. If omitted during creation, no value is set. If omitted during an update, no change is made. Once set, this value cannot be cleared. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string / required | | Name of a resource group where the managed disk exists or will be created. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **source\_uri** string | | URI to a valid VHD file to be used or the resource ID of the managed disk to copy. aliases: source\_resource\_uri | | **state** string | **Choices:*** absent * **present** ← | Assert the state of the managed disk. Use `present` to create or update a managed disk and `absent` to delete a managed disk. | | **storage\_account\_type** string | **Choices:*** Standard\_LRS * StandardSSD\_LRS * Premium\_LRS * UltraSSD\_LRS | Type of storage for the managed disk. If not specified, the disk is created as `Standard_LRS`. `Standard_LRS` is for Standard HDD. `StandardSSD_LRS` (added in 2.8) is for Standard SSD. `Premium_LRS` is for Premium SSD. `UltraSSD_LRS` (added in 2.8) is for Ultra SSD, which is in preview mode, and only available on select instance types. See <https://docs.microsoft.com/en-us/azure/virtual-machines/windows/disks-types> for more information about disk types. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** dictionary | | Tags to assign to the managed disk. Format tags as 'key' or 'key:value'. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | | **zone** string | **Choices:*** 1 * 2 * 3 * | The Azure managed disk's zone. Allowed values are `1`, `2`, `3` and `' '`. | Notes ----- Note * This module was called [community.azure.azure\_rm\_managed\_disk](azure_rm_managed_disk_module#ansible-collections-community-azure-azure-rm-managed-disk-module) before Ansible 2.8. The usage did not change. * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Create managed disk community.azure.azure_rm_manageddisk: name: mymanageddisk location: eastus resource_group: myResourceGroup disk_size_gb: 4 - name: Create managed operating system disk from page blob community.azure.azure_rm_manageddisk: name: mymanageddisk location: eastus2 resource_group: myResourceGroup create_option: import source_uri: https://storageaccountname.blob.core.windows.net/containername/blob-name.vhd os_type: windows storage_account_type: Premium_LRS - name: Mount the managed disk to VM community.azure.azure_rm_manageddisk: name: mymanageddisk location: eastus resource_group: myResourceGroup disk_size_gb: 4 managed_by: testvm001 attach_caching: read_only - name: Unmount the managed disk to VM community.azure.azure_rm_manageddisk: name: mymanageddisk location: eastus resource_group: myResourceGroup disk_size_gb: 4 - name: Delete managed disk community.azure.azure_rm_manageddisk: name: mymanageddisk location: eastus resource_group: myResourceGroup 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 or not the resource has changed. | | **id** dictionary | always | The managed disk resource ID. | | **state** dictionary | always | Current state of the managed disk. | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Bruno Medina (@brusMX) ansible community.azure.azure_rm_hdinsightcluster_info – Get Azure HDInsight Cluster facts community.azure.azure\_rm\_hdinsightcluster\_info – Get Azure HDInsight Cluster facts ===================================================================================== Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_hdinsightcluster_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_hdinsightcluster\_info](../../azure/azcollection/azure_rm_hdinsightcluster_info_module#ansible-collections-azure-azcollection-azure-rm-hdinsightcluster-info-module) instead. Synopsis -------- * Get facts of Azure HDInsight Cluster. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | HDInsight cluster name. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string | | Name of an Azure resource group. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** string | | Limit results by providing a list of tags. Format tags as 'key' or 'key:value'. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get instance of HDInsight Cluster community.azure.azure_rm_hdinsightcluster_info: resource_group: myResourceGroup name: myCluster - name: List instances of HDInsight Cluster community.azure.azure_rm_hdinsightcluster_info: resource_group: myResourceGroup ``` 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** complex | always | A list of dictionaries containing facts for HDInsight Cluster. | | | **cluster\_definition** string | success | The cluster definition. | | | | **kind** string | always | The type of cluster. **Sample:** spark | | | **cluster\_version** string | always | The version of the cluster. **Sample:** 3.6.1000.67 | | | **compute\_profile\_roles** list / elements=string | success | The list of roles in the cluster. | | | | **linux\_profile** string | success | The Linux OS profile. | | | | | **username** string | always | User name. **Sample:** myuser | | | | **name** string | always | The name of the role. **Sample:** headnode | | | | **target\_instance\_count** integer | always | The instance count of the cluster. **Sample:** 2 | | | | **vm\_size** string | always | The size of the VM. **Sample:** Standard\_D3 | | | **connectivity\_endpoints** list / elements=string | success | Cluster's connectivity endpoints. | | | | **location** string | always | Endpoint location. **Sample:** myCluster-ssh.azurehdinsight.net | | | | **name** string | always | Endpoint name. **Sample:** SSH | | | | **port** integer | always | Endpoint port. **Sample:** 22 | | | | **protocol** string | always | Endpoint protocol. **Sample:** TCP | | | **id** string | always | The unique resource identifier of the HDInsight Cluster. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.HDInsight/clusters/myCluster | | | **location** string | always | The location of the resource group to which the resource belongs. **Sample:** westus | | | **name** string | always | The name of the HDInsight Cluster. **Sample:** testaccount | | | **os\_type** string | always | The type of operating system. **Sample:** linux | | | **resource\_group** string | always | Name of an Azure resource group. **Sample:** myResourceGroup | | | **tags** complex | always | The tags of the resource. | | | **tier** string | always | The cluster tier. **Sample:** standard | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Zim Kalinowski (@zikalino)
programming_docs
ansible community.azure.azure_rm_devtestlab_info – Get Azure DevTest Lab facts community.azure.azure\_rm\_devtestlab\_info – Get Azure DevTest Lab facts ========================================================================= Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_devtestlab_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_devtestlab\_info](../../azure/azcollection/azure_rm_devtestlab_info_module#ansible-collections-azure-azcollection-azure-rm-devtestlab-info-module) instead. Synopsis -------- * Get facts of Azure DevTest Lab. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | The name of the lab. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string | | The name of the resource group. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** list / elements=string | | Limit results by providing a list of tags. Format tags as 'key' or 'key:value'. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: List instances of DevTest Lab by resource group community.azure.azure_rm_devtestlab_info: resource_group: testrg - name: List instances of DevTest Lab in subscription community.azure.azure_rm_devtestlab_info: - name: Get instance of DevTest Lab community.azure.azure_rm_devtestlab_info: resource_group: testrg name: testlab ``` 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 | | --- | --- | --- | | **labs** complex | always | A list of dictionaries containing facts for Lab. | | | **artifacts\_storage\_account** string | always | Artifacts storage account ID. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myLab6346 | | | **default\_premium\_storage\_account** string | always | Default premium storage account ID. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myLab6346 | | | **default\_storage\_account** string | always | Default storage account ID. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myLab6346 | | | **id** string | always | The identifier of the resource. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myResourceGroup/providers/microsoft.devtestlab/labs/myLab | | | **location** string | always | The location of the resource. **Sample:** eastus | | | **name** string | always | The name of the resource. **Sample:** testlab | | | **premium\_data\_disk\_storage\_account** string | always | Default storage account ID. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myLab6346 | | | **premium\_data\_disks** boolean | always | Are premium data disks allowed. | | | **provisioning\_state** string | always | Lab provisioning state. **Sample:** Succeeded | | | **resource\_group** string | always | The name of the resource. **Sample:** testrg | | | **storage\_type** string | always | Lab storage type. **Sample:** standard | | | **tags** complex | always | The tags of the resource. **Sample:** { 'MyTag': 'MyValue' } | | | **vault\_name** string | always | Key vault ID. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myLab6788 | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Zim Kalinowski (@zikalino) ansible community.azure.azure_rm_securitygroup_info – Get security group facts community.azure.azure\_rm\_securitygroup\_info – Get security group facts ========================================================================= Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_securitygroup_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_securitygroup\_info](../../azure/azcollection/azure_rm_securitygroup_info_module#ansible-collections-azure-azcollection-azure-rm-securitygroup-info-module) instead. Synopsis -------- * Get facts for a specific security group or all security groups within a resource group. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | Only show results for a specific security group. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string / required | | Name of the resource group to use. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** string | | Limit results by providing a list of tags. Format tags as 'key' or 'key:value'. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get facts for one security group community.azure.azure_rm_securitygroup_info: resource_group: myResourceGroup name: secgroup001 - name: Get facts for all security groups community.azure.azure_rm_securitygroup_info: resource_group: myResourceGroup ``` 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 | | --- | --- | --- | | **securitygroups** complex | always | List containing security group dicts. | | | **etag** string | always | A unique read-only string that changes whenever the resource is updated. **Sample:** W/"d036f4d7-d977-429a-a8c6-879bc2523399" | | | **id** string | always | Resource ID. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/secgroup001 | | | **location** string | always | Resource location. **Sample:** eastus2 | | | **name** string | always | Resource name. **Sample:** secgroup001 | | | **properties** dictionary | always | List of security group's properties. **Sample:** {'defaultSecurityRules': [{'etag': 'W/"d036f4d7-d977-429a-a8c6-879bc2523399"', 'id': '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/secgroup001/defaultSecurityRules/AllowVnetInBound', 'name': 'AllowVnetInBound', 'properties': {'access': 'Allow', 'description': 'Allow inbound traffic from all VMs in VNET', 'destinationAddressPrefix': 'VirtualNetwork', 'destinationPortRange': '\*', 'direction': 'Inbound', 'priority': 65000, 'protocol': '\*', 'provisioningState': 'Succeeded', 'sourceAddressPrefix': 'VirtualNetwork', 'sourcePortRange': '\*'}}, {'etag': 'W/"d036f4d7-d977-429a-a8c6-879bc2523399"', 'id': '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/secgroup001/defaultSecurityRules/AllowAzureLoadBalancerInBound', 'name': 'AllowAzureLoadBalancerInBound', 'properties': {'access': 'Allow', 'description': 'Allow inbound traffic from azure load balancer', 'destinationAddressPrefix': '\*', 'destinationPortRange': '\*', 'direction': 'Inbound', 'priority': 65001, 'protocol': '\*', 'provisioningState': 'Succeeded', 'sourceAddressPrefix': 'AzureLoadBalancer', 'sourcePortRange': '\*'}}, {'etag': 'W/"d036f4d7-d977-429a-a8c6-879bc2523399"', 'id': '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/secgroup001/defaultSecurityRules/DenyAllInBound', 'name': 'DenyAllInBound', 'properties': {'access': 'Deny', 'description': 'Deny all inbound traffic', 'destinationAddressPrefix': '\*', 'destinationPortRange': '\*', 'direction': 'Inbound', 'priority': 65500, 'protocol': '\*', 'provisioningState': 'Succeeded', 'sourceAddressPrefix': '\*', 'sourcePortRange': '\*'}}, {'etag': 'W/"d036f4d7-d977-429a-a8c6-879bc2523399"', 'id': '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/secgroup001/defaultSecurityRules/AllowVnetOutBound', 'name': 'AllowVnetOutBound', 'properties': {'access': 'Allow', 'description': 'Allow outbound traffic from all VMs to all VMs in VNET', 'destinationAddressPrefix': 'VirtualNetwork', 'destinationPortRange': '\*', 'direction': 'Outbound', 'priority': 65000, 'protocol': '\*', 'provisioningState': 'Succeeded', 'sourceAddressPrefix': 'VirtualNetwork', 'sourcePortRange': '\*'}}, {'etag': 'W/"d036f4d7-d977-429a-a8c6-879bc2523399"', 'id': '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/secgroup001/defaultSecurityRules/AllowInternetOutBound', 'name': 'AllowInternetOutBound', 'properties': {'access': 'Allow', 'description': 'Allow outbound traffic from all VMs to Internet', 'destinationAddressPrefix': 'Internet', 'destinationPortRange': '\*', 'direction': 'Outbound', 'priority': 65001, 'protocol': '\*', 'provisioningState': 'Succeeded', 'sourceAddressPrefix': '\*', 'sourcePortRange': '\*'}}, {'etag': 'W/"d036f4d7-d977-429a-a8c6-879bc2523399"', 'id': '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/secgroup001/defaultSecurityRules/DenyAllOutBound', 'name': 'DenyAllOutBound', 'properties': {'access': 'Deny', 'description': 'Deny all outbound traffic', 'destinationAddressPrefix': '\*', 'destinationPortRange': '\*', 'direction': 'Outbound', 'priority': 65500, 'protocol': '\*', 'provisioningState': 'Succeeded', 'sourceAddressPrefix': '\*', 'sourcePortRange': '\*'}}], 'networkInterfaces': [{'id': '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nic004'}], 'provisioningState': 'Succeeded', 'resourceGuid': 'ebd00afa-5dc8-446f-810a-50dd6f671588', 'securityRules': []} | | | **tags** dictionary | always | Tags to assign to the security group. **Sample:** {'tag': 'value'} | | | **type** string | always | Type of the resource. **Sample:** Microsoft.Network/networkSecurityGroups | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Chris Houseknecht (@chouseknecht) * Matt Davis (@nitzmahone)
programming_docs
ansible community.azure.azure_rm_cdnprofile_info – Get Azure CDN profile facts community.azure.azure\_rm\_cdnprofile\_info – Get Azure CDN profile facts ========================================================================= Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_cdnprofile_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_cdnprofile\_info](../../azure/azcollection/azure_rm_cdnprofile_info_module#ansible-collections-azure-azcollection-azure-rm-cdnprofile-info-module) instead. Synopsis -------- * Get facts for a specific Azure CDN profile or all CDN profiles. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | Limit results to a specific CDN profile. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string | | The resource group to search for the desired CDN profile. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** string | | Limit results by providing a list of tags. Format tags as 'key' or 'key:value'. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get facts for one CDN profile community.azure.azure_rm_cdnprofile_info: name: Testing resource_group: myResourceGroup - name: Get facts for all CDN profiles community.azure.azure_rm_cdnprofile_info: - name: Get facts by tags community.azure.azure_rm_cdnprofile_info: tags: - Environment:Test ``` 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 | | --- | --- | --- | | **cdnprofiles** complex | always | List of CDN profiles. | | | **id** string | success | ID of the CDN profile. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myResourceGroup/providers/Microsoft.Cdn/profiles/myCDN | | | **location** string | success | Location of the CDN profile. **Sample:** WestUS | | | **name** string | always | Name of the CDN profile. **Sample:** Testing | | | **provisioning\_state** string | success | Provisioning status of the profile. **Sample:** Succeeded | | | **resource\_group** string | always | Name of a resource group where the CDN profile exists. **Sample:** myResourceGroup | | | **resource\_state** string | success | Resource status of the profile. **Sample:** Active | | | **sku** string | success | The pricing tier, defines a CDN provider, feature list and rate of the CDN profile. **Sample:** standard\_verizon | | | **tags** list / elements=string | success | The tags of the CDN profile. **Sample:** [{'foo': 'bar'}] | | | **type** string | success | The type of the CDN profile. **Sample:** Microsoft.Cdn/profiles | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Hai Cao (@caohai) * Yunge Zhu (@yungezz) ansible community.azure.azure_rm_devtestlabcustomimage_info – Get Azure DevTest Lab Custom Image facts community.azure.azure\_rm\_devtestlabcustomimage\_info – Get Azure DevTest Lab Custom Image facts ================================================================================================= Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_devtestlabcustomimage_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_devtestlabcustomimage\_info](../../azure/azcollection/azure_rm_devtestlabcustomimage_info_module#ansible-collections-azure-azcollection-azure-rm-devtestlabcustomimage-info-module) instead. Synopsis -------- * Get facts of Azure Azure DevTest Lab Custom Image. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **lab\_name** string / required | | The name of the lab. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | The name of the custom image. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string / required | | The name of the resource group. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** list / elements=string | | Limit results by providing a list of tags. Format tags as 'key' or 'key:value'. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get instance of Custom Image community.azure.azure_rm_devtestlabcustomimage_info: resource_group: myResourceGroup lab_name: myLab name: myImage - name: List instances of Custom Image in the lab community.azure.azure_rm_devtestlabcustomimage_info: resource_group: myResourceGroup lab_name: myLab name: myImage ``` 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\_images** complex | always | A list of dictionaries containing facts for Custom Image. | | | **id** string | always | The identifier of the artifact source. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DevTestLab/labs/myLab/cu stomimages/myImage | | | **lab\_name** string | always | Name of the lab. **Sample:** myLab | | | **managed\_shapshot\_id** string | always | Managed snapshot id. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourcegroups/myResourceGroup/providers/microsoft.compute/snapshots/myImage | | | **name** string | always | The name of the image. **Sample:** myImage | | | **resource\_group** string | always | Name of the resource group. **Sample:** myResourceGroup | | | **source\_vm\_id** string | always | Source VM id. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx//resourcegroups/myResourceGroup/providers/microsoft.devtestlab/labs/myLab/v irtualmachines/myLabVm | | | **tags** complex | always | The tags of the resource. **Sample:** { 'MyTag':'MyValue' } | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Zim Kalinowski (@zikalino) ansible community.azure.azure_rm_aksversion_info – Get available kubernetes versions supported by Azure Kubernetes Service community.azure.azure\_rm\_aksversion\_info – Get available kubernetes versions supported by Azure Kubernetes Service ===================================================================================================================== Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_aksversion_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_aksversion\_info](../../azure/azcollection/azure_rm_aksversion_info_module#ansible-collections-azure-azcollection-azure-rm-aksversion-info-module) instead. Synopsis -------- * Get available kubernetes versions supported by Azure Kubernetes Service. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **location** string / required | | Get the versions available for creating a managed Kubernetes cluster. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | | **version** string | | Get the upgrade versions available for a managed Kubernetes cluster version. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get available versions for AKS in location eastus community.azure.azure_rm_aksversion_info: location: eastus - name: Get available versions an AKS can be upgrade to community.azure.azure_rm_aksversion_info: location: eastis version: 1.11.6 ``` 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 | | --- | --- | --- | | **azure\_aks\_versions** list / elements=string | always | List of supported kubernetes versions. | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Yuwei Zhou (@yuwzho)
programming_docs
ansible community.azure.azure_rm_mysqlconfiguration_info – Get Azure MySQL Configuration facts community.azure.azure\_rm\_mysqlconfiguration\_info – Get Azure MySQL Configuration facts ========================================================================================= Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_mysqlconfiguration_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_mysqlconfiguration\_info](../../azure/azcollection/azure_rm_mysqlconfiguration_info_module#ansible-collections-azure-azcollection-azure-rm-mysqlconfiguration-info-module) instead. Synopsis -------- * Get facts of Azure MySQL Configuration. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | Setting name. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string / required | | The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **server\_name** string / required | | The name of the server. | | **subscription\_id** string | | Your Azure subscription Id. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get specific setting of MySQL Server community.azure.azure_rm_mysqlconfiguration_info: resource_group: myResourceGroup server_name: testmysqlserver name: deadlock_timeout - name: Get all settings of MySQL Server community.azure.azure_rm_mysqlconfiguration_info: resource_group: myResourceGroup server_name: server_name ``` 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 | | --- | --- | --- | | **settings** complex | always | A list of dictionaries containing MySQL Server settings. | | | **description** string | always | Description of the configuration. **Sample:** Deadlock timeout. | | | **id** string | always | Setting resource ID. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DBforMySQL/servers/testmysqlser ver/configurations/deadlock\_timeout | | | **name** string | always | Setting name. **Sample:** deadlock\_timeout | | | **source** string | always | Source of the configuration. **Sample:** system-default | | | **value** any | always | Setting value. **Sample:** 1000 | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Zim Kalinowski (@zikalino) ansible community.azure.azure_rm_aks_info – Get Azure Kubernetes Service facts community.azure.azure\_rm\_aks\_info – Get Azure Kubernetes Service facts ========================================================================= Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_aks_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_aks\_info](../../azure/azcollection/azure_rm_aks_info_module#ansible-collections-azure-azcollection-azure-rm-aks-info-module) instead. Synopsis -------- * Get facts for a specific Azure Kubernetes Service or all Azure Kubernetes Services. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | Limit results to a specific resource group. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string | | The resource group to search for the desired Azure Kubernetes Service. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **show\_kubeconfig** string | **Choices:*** user * admin | Show kubeconfig of the AKS cluster. Note the operation will cost more network overhead, not recommended when listing AKS. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** string | | Limit results by providing a list of tags. Format tags as 'key' or 'key:value'. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get facts for one Azure Kubernetes Service community.azure.azure_rm_aks_info: name: Testing resource_group: myResourceGroup - name: Get facts for all Azure Kubernetes Services community.azure.azure_rm_aks_info: - name: Get facts by tags community.azure.azure_rm_aks_info: tags: - 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 | | --- | --- | --- | | **azure\_aks** list / elements=string | always | List of Azure Kubernetes Service dicts. | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Yuwei Zhou (@yuwzho) ansible community.azure.azure_rm_servicebus_info – Get servicebus facts community.azure.azure\_rm\_servicebus\_info – Get servicebus facts ================================================================== Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_servicebus_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_servicebus\_info](../../azure/azcollection/azure_rm_servicebus_info_module#ansible-collections-azure-azcollection-azure-rm-servicebus-info-module) instead. Synopsis -------- * Get facts for a specific servicebus or all servicebus in a resource group or subscription. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | Limit results to a specific servicebus. | | **namespace** string | | Servicebus namespace name. A namespace is a scoping container for all messaging components. Multiple queues and topics can reside within a single namespace, and namespaces often serve as application containers. Required when *type=namespace*. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string | | Limit results in a specific resource group. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **show\_sas\_policies** boolean | **Choices:*** no * yes | Whether to show the SAS policies. Not support when *type=subscription*. Note if enable this option, the facts module will raise two more HTTP call for each resources, need more network overhead. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** string | | Limit results by providing a list of tags. Format tags as 'key' or 'key:value'. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | | **topic** string | | Topic name. Required when *type=subscription*. | | **type** string | **Choices:*** namespace * queue * topic * subscription | Type of the resource. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get all namespaces under a resource group community.azure.azure_rm_servicebus_info: resource_group: myResourceGroup type: namespace - name: Get all topics under a namespace community.azure.azure_rm_servicebus_info: resource_group: myResourceGroup namespace: bar type: topic - name: Get a single queue with SAS policies community.azure.azure_rm_servicebus_info: resource_group: myResourceGroup namespace: bar type: queue name: sbqueue show_sas_policies: true - name: Get all subscriptions under a resource group community.azure.azure_rm_servicebus_info: resource_group: myResourceGroup type: subscription namespace: bar topic: sbtopic ``` 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 | | --- | --- | --- | | **servicebuses** complex | always | List of servicebus dicts. | | | **accessed\_at** string | always | Last time the message was sent, or a request was received for this topic. **Sample:** 2019-01-25 02:46:55.543953+00:00 | | | **auto\_delete\_on\_idle\_in\_seconds** integer | always | ISO 8061 timeSpan idle interval after which the queue or topic is automatically deleted. The minimum duration is 5 minutes. **Sample:** True | | | **count\_details** complex | always | Message count details. | | | | **active\_message\_count** integer | always | Number of active messages in the `queue`, `topic`, or `subscription`. | | | | **dead\_letter\_message\_count** integer | always | Number of messages that are dead lettered. | | | | **scheduled\_message\_count** integer | always | Number of scheduled messages. | | | | **transfer\_dead\_letter\_message\_count** integer | always | Number of messages transferred into dead letters. | | | | **transfer\_message\_count** integer | always | Number of messages transferred to another `queue`, `topic`, or `subscription`. | | | **created\_at** string | always | Exact time the message was created. **Sample:** 2019-01-25 02:46:55.543953+00:00 | | | **dead\_lettering\_on\_filter\_evaluation\_exceptions** integer | always | Value that indicates whether a subscription has dead letter support on filter evaluation exceptions. | | | **dead\_lettering\_on\_message\_expiration** integer | always | A value that indicates whether this `queue` or `topic` has dead letter support when a message expires. | | | **default\_message\_time\_to\_live\_seconds** integer | always | ISO 8061 Default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. | | | **duplicate\_detection\_time\_in\_seconds** integer | always | ISO 8601 timeSpan structure that defines the duration of the duplicate detection history. **Sample:** 600 | | | **enable\_batched\_operations** boolean | always | Value that indicates whether server-side batched operations are enabled. **Sample:** True | | | **enable\_express** boolean | always | Value that indicates whether Express Entities are enabled. An express topic holds a message in memory temporarily before writing it to persistent storage. **Sample:** True | | | **enable\_partitioning** boolean | always | Value that indicates whether the `queue` or `topic` to be partitioned across multiple message brokers is enabled. **Sample:** True | | | **forward\_dead\_lettered\_messages\_to** string | always | `queue` or `topic` name to forward the Dead Letter message. **Sample:** corge | | | **forward\_to** string | always | `queue` or `topic` name to forward the messages. **Sample:** quux | | | **id** string | always | Resource ID. **Sample:** /subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/foo/providers/Microsoft.ServiceBus/ namespaces/bar/topics/baz/subscriptions/qux | | | **location** string | always | The Geo-location where the resource lives. **Sample:** eastus | | | **lock\_duration\_in\_seconds** integer | always | ISO 8601 timespan duration of a peek-lock. The amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes. **Sample:** 60 | | | **max\_delivery\_count** integer | always | The maximum delivery count. A message is automatically deadlettered after this number of deliveries. **Sample:** 10 | | | **max\_size\_in\_mb** integer | always | Maximum size of the `queue` or `topic` in megabytes, which is the size of the memory allocated for the `topic`. **Sample:** 5120 | | | **message\_count** integer | always | Number of messages. **Sample:** 10 | | | **metric\_id** string | always | Identifier for Azure Insights metrics of namespace. **Sample:** XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX:bar | | | **name** string | always | Resource name. **Sample:** qux | | | **namespace** string | always | *namespace* name of the `queue` or `topic`, `subscription`. **Sample:** bar | | | **provisioning\_state** string | always | Provisioning state of the namespace. **Sample:** Succeeded | | | **requires\_duplicate\_detection** boolean | always | A value indicating if this `queue` or `topic` requires duplicate detection. **Sample:** True | | | **requires\_session** boolean | always | A value that indicates whether the `queue` or `topic` supports the concept of sessions. **Sample:** True | | | **sas\_policies** dictionary | always | Dict of SAS policies. Will not be returned until *show\_sas\_policy* set. **Sample:** {'testpolicy1': {'id': '/subscriptions/XXXXXXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/ foo/providers/Microsoft.ServiceBus/namespaces/bar/queues/qux/authorizationRules/testpolicy1', 'keys': {'key\_name': 'testpolicy1', 'primary\_connection\_string': 'Endpoint=sb://bar.servicebus.windows.net/; SharedAccessKeyName=testpolicy1;SharedAccessKey=XXXXXXXXXXXXXXXXX;EntityPath=qux', 'primary\_key': 'XXXXXXXXXXXXXXXXX', 'secondary\_connection\_string': 'Endpoint=sb://bar.servicebus.windows.net/; SharedAccessKeyName=testpolicy1;SharedAccessKey=XXXXXXXXXXXXXXX;EntityPath=qux', 'secondary\_key': 'XXXXXXXXXXXXXXX'}, 'name': 'testpolicy1', 'rights': 'listen\_send', 'type': 'Microsoft.ServiceBus/Namespaces/Queues/AuthorizationRules'}} | | | **service\_bus\_endpoint** string | always | Endpoint you can use to perform Service Bus operations. **Sample:** https://bar.servicebus.windows.net:443/ | | | **size\_in\_bytes** integer | always | The size of the `queue` or `topic` in bytes. | | | **sku** string | always | Properties of namespace's SKU. **Sample:** Standard | | | **status** string | always | The status of a messaging entity. **Sample:** active | | | **subscription\_count** integer | always | Number of subscriptions under a topic. **Sample:** 1 | | | **support\_ordering** boolean | always | Value that indicates whether the `topic` supports ordering. **Sample:** True | | | **tags** dictionary | always | Resource tags. **Sample:** {'env': 'sandbox'} | | | **topic** string | always | Topic name of a subscription. **Sample:** baz | | | **type** string | always | Resource type. Namespace is a scoping container for all messaging components. Queue enables you to store messages until the receiving application is available to receive and process them. Topic and subscriptions enable 1:n relationships between publishers and subscribers. **Sample:** Microsoft.ServiceBus/Namespaces/Topics | | | **updated\_at** string | always | The exact time the message was updated. **Sample:** 2019-01-25 02:46:55.543953+00:00 | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Yuwei Zhou (@yuwzho)
programming_docs
ansible community.azure.azure_rm_dnszone_info – Get DNS zone facts community.azure.azure\_rm\_dnszone\_info – Get DNS zone facts ============================================================= Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_dnszone_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_dnszone\_info](../../azure/azcollection/azure_rm_dnszone_info_module#ansible-collections-azure-azcollection-azure-rm-dnszone-info-module) instead. Synopsis -------- * Get facts for a specific DNS zone or all DNS zones within a resource group. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **append\_tags** boolean | **Choices:*** no * **yes** ← | Use to control if tags field is canonical or just appends to existing tags. When canonical, any tags not found in the tags parameter will be removed from the object's metadata. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | Only show results for a specific zone. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string | | Limit results by resource group. Required when filtering by name. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** dictionary | | Limit results by providing a list of tags. Format tags as 'key' or 'key:value'. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get facts for one zone community.azure.azure_rm_dnszone_info: resource_group: myResourceGroup name: foobar22 - name: Get facts for all zones in a resource group community.azure.azure_rm_dnszone_info: resource_group: myResourceGroup - name: Get facts by tags community.azure.azure_rm_dnszone_info: tags: - 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 | | --- | --- | --- | | **azure\_dnszones** list / elements=string | always | List of zone dicts. **Sample:** [{'etag': '00000002-0000-0000-0dcb-df5776efd201', 'location': 'global', 'properties': {'maxNumberOfRecordSets': 5000, 'numberOfRecordSets': 15}, 'tags': {}}] | | **dnszones** list / elements=string | always | List of zone dicts, which share the same layout as azure\_rm\_dnszone module parameter. | | | **id** string | success | id of the DNS Zone. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/dnszones/azure.com | | | **max\_number\_of\_record\_sets** integer | success | The maximum number of record sets that can be created in this DNS zone. **Sample:** 5000 | | | **name** string | success | name of the DNS zone. **Sample:** azure.com | | | **name\_servers** list / elements=string | success | The name servers for this DNS zone. **Sample:** ['ns1-03.azure-dns.com.', 'ns2-03.azure-dns.net.', 'ns3-03.azure-dns.org.', 'ns4-03.azure-dns.info.'] | | | **number\_of\_record\_sets** integer | success | The current number of record sets in this DNS zone. **Sample:** 2 | | | **registration\_virtual\_networks** list / elements=string | success | A list of references to virtual networks that register hostnames in this DNS zone. **Sample:** ['/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/bar'] | | | **resolution\_virtual\_networks** list / elements=string | success | A list of references to virtual networks that resolve records in this DNS zone. **Sample:** ['/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/deadbeef'] | | | **type** string | success | The type of this DNS zone (`public` or `private`). **Sample:** private | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Obezimnaka Boms (@ozboms) ansible community.azure.azure_rm_virtualmachineextension_info – Get Azure Virtual Machine Extension facts community.azure.azure\_rm\_virtualmachineextension\_info – Get Azure Virtual Machine Extension facts ==================================================================================================== Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_virtualmachineextension_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_virtualmachineextension\_info](../../azure/azcollection/azure_rm_virtualmachineextension_info_module#ansible-collections-azure-azcollection-azure-rm-virtualmachineextension-info-module) instead. Synopsis -------- * Get facts of Azure Virtual Machine Extension. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | The name of the virtual machine extension. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string / required | | The name of the resource group. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** string | | Limit results by providing a list of tags. Format tags as 'key' or 'key:value'. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | | **virtual\_machine\_name** string / required | | The name of the virtual machine containing the extension. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get information on specific Virtual Machine Extension community.azure.azure_rm_virtualmachineextension_info: resource_group: myResourceGroup virtual_machine_name: myvm name: myextension - name: List installed Virtual Machine Extensions community.azure.azure_rm_virtualmachineextension_info: resource_group: myResourceGroup virtual_machine_name: myvm ``` 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 | | --- | --- | --- | | **extensions** complex | always | A list of dictionaries containing facts for Virtual Machine Extension. | | | **auto\_upgrade\_minor\_version** boolean | always | Autoupgrade minor version flag. **Sample:** True | | | **id** string | always | Resource ID. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/myvm/testVM/extens ions/myextension | | | **location** string | always | The resource location. **Sample:** eastus | | | **name** string | always | Virtual machine name. **Sample:** myextension | | | **provisioning\_state** string | always | Provisioning state of the extension. **Sample:** Succeeded | | | **publisher** string | always | Extension publisher. **Sample:** Microsoft.Azure.Extensions | | | **resource\_group** string | always | Resource group name. **Sample:** myResourceGroup | | | **settings** dictionary | always | Extension specific settings dictionary. **Sample:** {'commandToExecute': 'hostname'} | | | **tags** dictionary | always | Resource tags. **Sample:** {'mytag': 'abc'} | | | **type** string | always | Extension type. **Sample:** CustomScript | | | **virtual\_machine\_name** string | always | Virtual machine name. **Sample:** myvm | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Zim Kalinowski (@zikalino) ansible community.azure.azure_rm_cosmosdbaccount_info – Get Azure Cosmos DB Account facts community.azure.azure\_rm\_cosmosdbaccount\_info – Get Azure Cosmos DB Account facts ==================================================================================== Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_cosmosdbaccount_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_cosmosdbaccount\_info](../../azure/azcollection/azure_rm_cosmosdbaccount_info_module#ansible-collections-azure-azcollection-azure-rm-cosmosdbaccount-info-module) instead. Synopsis -------- * Get facts of Azure Cosmos DB Account. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | Cosmos DB database account name. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string | | Name of an Azure resource group. | | **retrieve\_connection\_strings** boolean | **Choices:*** no * yes | Retrieve connection strings. | | **retrieve\_keys** string | **Choices:*** all * readonly | Retrieve keys and connection strings. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** string | | Limit results by providing a list of tags. Format tags as 'key' or 'key:value'. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get instance of Database Account community.azure.azure_rm_cosmosdbaccount_info: resource_group: myResourceGroup name: testaccount - name: List instances of Database Account azure_rm_cosmosdbaccousnt_info: resource_group: myResourceGroup ``` 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 | | --- | --- | --- | | **accounts** complex | always | A list of dictionaries containing facts for Database Account. | | | **connection\_strings** list / elements=string | when requested | List of connection strings. | | | | **connection\_string** string | always | Description of connection string. **Sample:** Primary SQL Connection String | | | | **description** string | always | Connection string. **Sample:** AccountEndpoint=https://testaccount.documents.azure.com:443/;AccountKey=fSEjathnk6ZeBTrXkud9j5kfhtSEQ q3dpJxJga76h9BZkK2BJJrDzSO6DDn6yKads017OZBZ1YZWyq1cW4iuvA== | | | **consistency\_policy** complex | always | Consistency policy. | | | | **default\_consistency\_level** string | always | Default consistency level. **Sample:** session | | | | **max\_interval\_in\_seconds** integer | always | Maximum interval in seconds. **Sample:** 5 | | | | **max\_staleness\_prefix** integer | always | Maximum staleness prefix. **Sample:** 100 | | | **database\_account\_offer\_type** string | always | Offer type. **Sample:** Standard | | | **document\_endpoint** string | always | Document endpoint. **Sample:** https://testaccount.documents.azure.com:443/ | | | **enable\_automatic\_failover** boolean | always | Enable automatic failover. **Sample:** True | | | **enable\_cassandra** boolean | always | Enable Cassandra. **Sample:** True | | | **enable\_gremlin** boolean | always | Enable Gremlin. **Sample:** True | | | **enable\_multiple\_write\_locations** boolean | always | Enable multiple write locations. **Sample:** True | | | **enable\_table** boolean | always | Enable Table. **Sample:** True | | | **failover\_policies** complex | always | The list of new failover policies for the failover priority change. | | | | **failover\_priority** integer | always | Failover priority. | | | | **id** string | always | Read location ID. **Sample:** testaccount-eastus | | | | **name** string | always | Location name. **Sample:** eastus | | | **id** string | always | The unique resource identifier of the database account. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DocumentDB/databaseAccount s/testaccount | | | **ip\_range\_filter** string | always | Enable IP range filter. **Sample:** 10.10.10.10 | | | **is\_virtual\_network\_filter\_enabled** boolean | always | Enable virtual network filter. **Sample:** True | | | **kind** string | always | Indicates the type of database account. **Sample:** global\_document\_db | | | **location** string | always | The location of the resource group to which the resource belongs. **Sample:** westus | | | **name** string | always | The name of the database account. **Sample:** testaccount | | | **primary\_master\_key** string | when requested | Primary master key. **Sample:** UIWoYD4YaD4LxW6k3Jy69qcHDMLX4aSttECQkEcwWF1RflLd6crWSGJs0R9kJwujehtfLGeQx4ISVSJfTpJkYw== | | | **primary\_readonly\_master\_key** string | when requested | Primary master key. **Sample:** UIWoYD4YaD4LxW6k3Jy69qcHDMLX4aSttECQkEcwWF1RflLd6crWSGJs0R9kJwujehtfLGeQx4ISVSJfTpJkYw== | | | **provisioning\_state** string | always | Provisioning state of Cosmos DB. **Sample:** Succeeded | | | **read\_locations** complex | always | Read locations. | | | | **document\_endpoint** string | always | Document endpoint. **Sample:** https://testaccount-eastus.documents.azure.com:443/ | | | | **failover\_priority** integer | always | Failover priority. | | | | **id** string | always | Read location ID. **Sample:** testaccount-eastus | | | | **name** string | always | Location name. **Sample:** eastus | | | | **provisioning\_state** string | always | Provisioning state. **Sample:** Succeeded | | | **resource\_group** string | always | Name of an Azure resource group. **Sample:** myResourceGroup | | | **secondary\_master\_key** string | when requested | Primary master key. **Sample:** UIWoYD4YaD4LxW6k3Jy69qcHDMLX4aSttECQkEcwWF1RflLd6crWSGJs0R9kJwujehtfLGeQx4ISVSJfTpJkYw== | | | **secondary\_readonly\_master\_key** string | when requested | Primary master key. **Sample:** UIWoYD4YaD4LxW6k3Jy69qcHDMLX4aSttECQkEcwWF1RflLd6crWSGJs0R9kJwujehtfLGeQx4ISVSJfTpJkYw== | | | **tags** dictionary | always | Tags assigned to the resource. Dictionary of "string":"string" pairs. **Sample:** {'tag1': 'abc'} | | | **virtual\_network\_rules** list / elements=string | success | List of Virtual Network ACL rules configured for the Cosmos DB account. | | | | **ignore\_missing\_vnet\_service\_endpoint** boolean | success | Create Cosmos DB account without existing virtual network service endpoint. | | | | **subnet** string | success | Resource id of a subnet. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNet works/testvnet/subnets/testsubnet1 | | | **write\_locations** complex | always | Write locations. | | | | **document\_endpoint** string | always | Document endpoint. **Sample:** https://testaccount-eastus.documents.azure.com:443/ | | | | **failover\_priority** integer | always | Failover priority. | | | | **id** string | always | Read location ID. **Sample:** testaccount-eastus | | | | **name** string | always | Location name. **Sample:** eastus | | | | **provisioning\_state** string | always | Provisioning state. **Sample:** Succeeded | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Zim Kalinowski (@zikalino)
programming_docs
ansible community.azure.azure_rm_trafficmanagerendpoint_info – Get Azure Traffic Manager endpoint facts community.azure.azure\_rm\_trafficmanagerendpoint\_info – Get Azure Traffic Manager endpoint facts ================================================================================================== Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_trafficmanagerendpoint_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_trafficmanagerendpoint\_info](../../azure/azcollection/azure_rm_trafficmanagerendpoint_info_module#ansible-collections-azure-azcollection-azure-rm-trafficmanagerendpoint-info-module) instead. Synopsis -------- * Get facts for a specific Traffic Manager endpoints or all endpoints in a Traffic Manager profile. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | Limit results to a specific Traffic Manager endpoint. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **profile\_name** string / required | | Name of Traffic Manager Profile. | | **resource\_group** string / required | | The resource group to search for the desired Traffic Manager profile. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | | **type** string | **Choices:*** azure\_endpoints * external\_endpoints * nested\_endpoints | Type of endpoint. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get endpoints facts of a Traffic Manager profile community.azure.azure_rm_trafficmanagerendpoint_info: resource_group: myResourceGroup profile_name: Testing - name: Get specific endpoint of a Traffic Manager profile azure_rm_trafficmanager_info: resource_group: myResourceGroup profile_name: Testing name: test_external_endpoint ``` 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 | | --- | --- | --- | | **endpoints** complex | always | List of Traffic Manager endpoints. | | | **enabled** string | always | The status of the endpoint. **Sample:** Enabled | | | **geo\_mapping** list / elements=string | always | The list of countries/regions mapped to this endpoint when using the 'Geographic' traffic routing method. **Sample:** ['GEO-NA', 'GEO-AS'] | | | **location** string | always | The location of the external or nested endpoints when using the 'Performance' traffic routing method. **Sample:** East US | | | **min\_child\_endpoints** integer | always | The minimum number of endpoints that must be available in the child profile to make the parent profile available. **Sample:** 3 | | | **name** string | always | Name of the Traffic Manager endpoint. **Sample:** testendpoint | | | **priority** string | always | The priority of this endpoint when using the 'Priority' traffic routing method. **Sample:** 3 | | | **resource\_group** string | always | Name of a resource group. **Sample:** myResourceGroup | | | **target** string | always | The fully-qualified DNS name of the endpoint. **Sample:** 8.8.8.8 | | | **target\_resource\_id** string | always | The Azure Resource URI of the of the endpoint. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ClassicCompute/domainNames/vscjavaci | | | **type** string | always | The type of the endpoint. **Sample:** external\_endpoints | | | **weight** integer | always | The weight of this endpoint when using the 'Weighted' traffic routing method. **Sample:** 10 | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Hai Cao (@caohai) * Yunge Zhu (@yungezz) ansible community.azure.azure_rm_appserviceplan_info – Get azure app service plan facts community.azure.azure\_rm\_appserviceplan\_info – Get azure app service plan facts ================================================================================== Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_appserviceplan_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_appserviceplan\_info](../../azure/azcollection/azure_rm_appserviceplan_info_module#ansible-collections-azure-azcollection-azure-rm-appserviceplan-info-module) instead. Synopsis -------- * Get facts for a specific app service plan or all app service plans in a resource group, or all app service plan in current subscription. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | Only show results for a specific app service plan. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string | | Limit results by resource group. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** string | | Limit results by providing a list of tags. Format tags as 'key' or 'key:value'. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get facts for app service plan by name community.azure.azure_rm_appserviceplan_info: resource_group: myResourceGroup name: myAppServicePlan - name: Get azure_rm_appserviceplan_facts for app service plan in resource group community.azure.azure_rm_appserviceplan_info: resource_group: myResourceGroup - name: Get facts for app service plan with tags community.azure.azure_rm_appserviceplan_info: tags: - testtag - foo:bar ``` 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 | | --- | --- | --- | | **appserviceplans** complex | always | List of app service plans. | | | **id** string | always | Id of the app service plan. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Web/serverfarms/myPlan | | | **kind** string | always | Kind of the app service plan. **Sample:** app | | | **location** string | always | Location of the app service plan. | | | **name** string | always | Name of the app service plan. | | | **resource\_group** string | always | Resource group of the app service plan. **Sample:** myResourceGroup | | | **sku** complex | always | Sku of the app service plan. | | | | **capacity** integer | always | Capacity of sku. **Sample:** 1 | | | | **family** string | always | Family of sku. **Sample:** S | | | | **name** string | always | Name of sku. **Sample:** S1 | | | | **size** string | always | Size of sku. **Sample:** S1 | | | | **tier** string | always | Tier of sku. **Sample:** Standard | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Yunge Zhu (@yungezz) ansible community.azure.azure_rm_devtestlabenvironment_info – Get Azure Environment facts community.azure.azure\_rm\_devtestlabenvironment\_info – Get Azure Environment facts ==================================================================================== Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_devtestlabenvironment_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_devtestlabenvironment\_info](../../azure/azcollection/azure_rm_devtestlabenvironment_info_module#ansible-collections-azure-azcollection-azure-rm-devtestlabenvironment-info-module) instead. Synopsis -------- * Get facts of Azure Environment. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **lab\_name** string / required | | The name of the lab. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | The name of the environment. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string / required | | The name of the resource group. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** list / elements=string | | Limit results by providing a list of tags. Format tags as 'key' or 'key:value'. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | | **user\_name** string / required | | The name of the user profile. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get instance of Environment community.azure.azure_rm_devtestlabenvironment_info: resource_group: myResourceGroup lab_name: myLab user_name: myUser name: myEnvironment ``` 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 | | --- | --- | --- | | **environments** complex | always | A list of dictionaries containing facts for Environment. | | | **deployment\_template** string | always | The identifier of the artifact source. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myResourceGroup/providers/microsoft.devtestlab/labs/mylab/art ifactSources/public environment repo/armTemplates/WebApp | | | **id** string | always | The identifier of the artifact source. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DevTestLab/labs/myLab/sc hedules/xxxxxxxx-xxxx-xxxx-xxxxx-xxxxxxxxxxxxx/environments/myEnvironment | | | **lab\_name** string | always | Name of the lab. **Sample:** myLab | | | **name** string | always | The name of the environment. **Sample:** myEnvironment | | | **resource\_group** string | always | Name of the resource group. **Sample:** myResourceGroup | | | **resource\_group\_id** string | always | Target resource group id. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myLab-myEnvironment-982571 | | | **state** string | always | Deployment state. **Sample:** Succeeded | | | **tags** complex | always | The tags of the resource. **Sample:** { 'MyTag': 'MyValue' } | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Zim Kalinowski (@zikalino)
programming_docs
ansible community.azure.azure_rm_networkinterface_info – Get network interface facts community.azure.azure\_rm\_networkinterface\_info – Get network interface facts =============================================================================== Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_networkinterface_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_networkinterface\_info](../../azure/azcollection/azure_rm_networkinterface_info_module#ansible-collections-azure-azcollection-azure-rm-networkinterface-info-module) instead. Synopsis -------- * Get facts for a specific network interface or all network interfaces within a resource group. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | Only show results for a specific network interface. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string | | Name of the resource group containing the network interface(s). Required when searching by name. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** string | | Limit results by providing a list of tags. Format tags as 'key' or 'key:value'. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get facts for one network interface community.azure.azure_rm_networkinterface_info: resource_group: myResourceGroup name: nic001 - name: Get network interfaces within a resource group community.azure.azure_rm_networkinterface_info: resource_group: myResourceGroup - name: Get network interfaces by tag community.azure.azure_rm_networkinterface_info: resource_group: myResourceGroup tags: - testing - foo:bar ``` 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 | | --- | --- | --- | | **azure\_networkinterfaces** list / elements=string | always | List of network interface dicts. **Sample:** [{'dns\_settings': {'applied\_dns\_servers': [], 'dns\_servers': [], 'internal\_dns\_name\_label': None, 'internal\_fqdn': None}, 'enable\_ip\_forwarding': False, 'etag': 'W/"59726bfc-08c4-44ed-b900-f6a559876a9d"', 'id': '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nic003', 'ip\_configuration': {'name': 'default', 'private\_ip\_address': '10.10.0.4', 'private\_ip\_allocation\_method': 'Dynamic', 'public\_ip\_address': {'id': '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/publicIPAddresses/publicip001', 'name': 'publicip001'}, 'subnet': {'id': '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet001/subnets/subnet001', 'name': 'subnet001', 'virtual\_network\_name': 'vnet001'}}, 'location': 'westus', 'mac\_address': None, 'name': 'nic003', 'network\_security\_group': {'id': '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/secgroup001', 'name': 'secgroup001'}, 'primary': None, 'provisioning\_state': 'Succeeded', 'tags': {}, 'type': 'Microsoft.Network/networkInterfaces'}] | | **networkinterfaces** list / elements=string | always | List of network interface dicts. Each dict contains parameters can be passed to [community.azure.azure\_rm\_networkinterface](azure_rm_networkinterface_module) module. | | | **create\_with\_security\_group** boolean | success | Specifies whether a default security group should be be created with the NIC. Only applies when creating a new NIC. | | | **dns\_servers** string | success | Which DNS servers should the NIC lookup. List of IP addresses. | | | **dns\_settings** string | success | The DNS settings in network interface. | | | | **applied\_dns\_servers** string | success | If the VM that uses this NIC is part of an Availability Set, then this list will have the union of all DNS servers from all NICs that are part of the Availability Set. This property is what is configured on each of those VMs. | | | | **dns\_servers** string | success | List of DNS servers IP addresses. | | | | **internal\_dns\_name\_label** string | success | Relative DNS name for this NIC used for internal communications between VMs in the same virtual network. | | | | **internal\_fqdn** string | success | Fully qualified DNS name supporting internal communications between VMs in the same virtual network. | | | **enable\_accelerated\_networking** string | success | Specifies whether the network interface should be created with the accelerated networking feature or not. | | | **enable\_ip\_forwarding** string | success | Whether to enable IP forwarding | | | **id** string | success | Id of the network interface. | | | **ip\_configurations** string | success | List of IP configurations, if contains multiple configurations. | | | | **application\_security\_groups** string | success | List of Application security groups. **Sample:** /subscriptions/<subsid>/resourceGroups/<rg>/providers/Microsoft.Network/applicationSecurityGroups/myASG | | | | **load\_balancer\_backend\_address\_pools** string | success | List of existing load-balancer backend address pools to associate with the network interface. | | | | **name** string | success | Name of the IP configuration. | | | | **primary** string | success | Whether the IP configuration is the primary one in the list. | | | | **private\_ip\_address** string | success | Private IP address for the IP configuration. | | | | **private\_ip\_allocation\_method** string | success | Private IP allocation method. | | | | **public\_ip\_address** string | success | Name of the public IP address. None for disable IP address. | | | | **public\_ip\_allocation\_method** string | success | Public IP allocation method. | | | **location** string | success | Azure location. | | | **mac\_address** string | success | The MAC address of the network interface. | | | **name** string | success | Name of the network interface. | | | **provisioning\_state** string | success | The provisioning state of the network interface. | | | **resource\_group** string | success | Name of a resource group where the network interface exists. | | | **security\_group** string | success | A security group resource ID with which to associate the network interface. | | | **subnet** string | success | Name of an existing subnet within the specified virtual network. | | | **tags** string | success | Tags of the network interface. | | | **virtual\_network** string | success | An existing virtual network with which the network interface will be associated. It is a dict which contains *name* and *resource\_group* of the virtual network. | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Chris Houseknecht (@chouseknecht) * Matt Davis (@nitzmahone) ansible community.azure.azure_rm_routetable_info – Get route table facts community.azure.azure\_rm\_routetable\_info – Get route table facts =================================================================== Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_routetable_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_routetable\_info](../../azure/azcollection/azure_rm_routetable_info_module#ansible-collections-azure-azcollection-azure-rm-routetable-info-module) instead. Synopsis -------- * Get facts for a specific route table or all route table in a resource group or subscription. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | Limit results to a specific route table. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string | | Limit results in a specific resource group. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** string | | Limit results by providing a list of tags. Format tags as 'key' or 'key:value'. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get facts for one route table community.azure.azure_rm_routetable_info: name: Testing resource_group: myResourceGroup - name: Get facts for all route tables community.azure.azure_rm_routetable_info: resource_group: myResourceGroup - name: Get facts by tags community.azure.azure_rm_routetable_info: tags: - testing - foo:bar ``` 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 | | --- | --- | --- | | **disable\_bgp\_route\_propagation** boolean | success | Whether the routes learned by BGP on that route table disabled. | | **id** string | success | Resource ID. **Sample:** /subscriptions/xxxx...xxxx/resourceGroups/v-xisuRG/providers/Microsoft.Network/routeTables/tableb57dc95236 | | **name** string | success | Name of the resource. **Sample:** tableb57dc95236 | | **resource\_group** string | success | Resource group of the route table. **Sample:** v-xisuRG | | **routes** list / elements=string | success | Current routes of the route table. **Sample:** [{'address\_prefix': '10.1.0.0/24', 'id': '/subscriptions/xxx...xxx/resourceGroups/v-xisuRG/providers/Microsoft.Network/routeTables/tableb57dc95236/routes/routeb57dc95540', 'name': 'routeb57dc95540', 'next\_hop\_ip\_address': None, 'next\_hop\_type': 'virtual\_network\_gateway', 'resource\_group': 'v-xisuRG', 'route\_table\_name': 'tableb57dc95236'}] | | **tags** dictionary | success | Tags of the route table. **Sample:** {'key1': 'value1', 'key2': 'value2'} | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Yuwei Zhou (@yuwzho)
programming_docs
ansible community.azure.azure_rm_virtualmachine_extension community.azure.azure\_rm\_virtualmachine\_extension ==================================================== Note This redirect is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (version 1.1.0). * This redirect has been **deprecated**. Please update your tasks to use the new name `community.azure.azure_rm_virtualmachineextension` instead. It will be removed in version 2.0.0 of community.azure. * This is a redirect to the [community.azure.azure\_rm\_virtualmachineextension module](azure_rm_virtualmachineextension_module#ansible-collections-community-azure-azure-rm-virtualmachineextension-module). * This redirect also works with Ansible 2.9. * The collection contains the following information on this deprecation: Use azure.azcollection.azure\_rm\_virtualmachineextension instead. ansible community.azure.azure_rm_devtestlabpolicy_info – Get Azure DTL Policy facts community.azure.azure\_rm\_devtestlabpolicy\_info – Get Azure DTL Policy facts ============================================================================== Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_devtestlabpolicy_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_devtestlabpolicy\_info](../../azure/azcollection/azure_rm_devtestlabpolicy_info_module#ansible-collections-azure-azcollection-azure-rm-devtestlabpolicy-info-module) instead. Synopsis -------- * Get facts of Azure DTL Policy. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **lab\_name** string / required | | The name of the lab. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | The name of the policy. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **policy\_set\_name** string / required | | The name of the policy set. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string / required | | The name of the resource group. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** list / elements=string | | Limit results by providing a list of tags. Format tags as 'key' or 'key:value'. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get instance of Policy community.azure.azure_rm_devtestlabpolicy_info: resource_group: myResourceGroup lab_name: myLab policy_set_name: myPolicySet name: myPolicy ``` 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** complex | always | A list of dictionaries containing facts for Policy. | | | **evaluator\_type** string | always | Evaluator type for policy fact. **Sample:** MaxValuePolicy | | | **fact\_name** string | always | The name of the policy fact. **Sample:** UserOwnedLabVmCount | | | **id** string | always | The identifier of the artifact source. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DevTestLab/labs/myLab/po licysets/myPolicySet/policies/myPolicy | | | **lab\_name** string | always | Name of the lab. **Sample:** myLab | | | **name** string | always | The name of the artifact source. **Sample:** myArtifactSource | | | **resource\_group** string | always | Name of the resource group. **Sample:** myResourceGroup | | | **tags** complex | always | The tags of the resource. **Sample:** { 'MyTag': 'MyValue' } | | | **threshold** string | always | Fact's threshold. **Sample:** 5 | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Zim Kalinowski (@zikalino) ansible community.azure.azure_rm_storageaccount_info – Get storage account facts community.azure.azure\_rm\_storageaccount\_info – Get storage account facts =========================================================================== Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_storageaccount_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_storageaccount\_info](../../azure/azcollection/azure_rm_storageaccount_info_module#ansible-collections-azure-azcollection-azure-rm-storageaccount-info-module) instead. Synopsis -------- * Get facts for one storage account or all storage accounts within a resource group. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | Only show results for a specific account. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string | | Limit results to a resource group. Required when filtering by name. aliases: resource\_group\_name | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **show\_blob\_cors** boolean | **Choices:*** no * yes | Show the blob CORS settings for each blob related to the storage account. Querying all storage accounts will take a long time. | | **show\_connection\_string** boolean | **Choices:*** no * yes | Show the connection string for each of the storageaccount's endpoints. For convenient usage, `show_connection_string` will also show the access keys for each of the storageaccount's endpoints. Note that it will cost a lot of time when list all storageaccount rather than query a single one. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** string | | Limit results by providing a list of tags. Format tags as 'key' or 'key:value'. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get facts for one account community.azure.azure_rm_storageaccount_info: resource_group: myResourceGroup name: clh0002 - name: Get facts for all accounts in a resource group community.azure.azure_rm_storageaccount_info: resource_group: myResourceGroup - name: Get facts for all accounts by tags community.azure.azure_rm_storageaccount_info: tags: - testing - foo:bar ``` 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 | | --- | --- | --- | | **azure\_storageaccounts** list / elements=string | always | List of storage account dicts. **Sample:** [{'id': '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/myResourceGroups/testing/providers/Microsoft.Storage/storageAccounts/testaccount001', 'location': 'eastus2', 'name': 'testaccount001', 'properties': {'accountType': 'Standard\_LRS', 'creationTime': '2016-03-28T02:46:58.290113Z', 'primaryEndpoints': {'blob': 'https://testaccount001.blob.core.windows.net/', 'file': 'https://testaccount001.file.core.windows.net/', 'queue': 'https://testaccount001.queue.core.windows.net/', 'table': 'https://testaccount001.table.core.windows.net/'}, 'primaryLocation': 'eastus2', 'provisioningState': 'Succeeded', 'statusOfPrimary': 'Available'}, 'tags': {}, 'type': 'Microsoft.Storage/storageAccounts'}] | | **storageaccounts** complex | always | List of storage account dicts in resource module's parameter format. | | | **access\_tier** string | always | The access tier for this storage account. **Sample:** Hot | | | **account\_type** string | always | Type of storage account. `Standard_ZRS` and `Premium_LRS` accounts cannot be changed to other account types. Other account types cannot be changed to `Standard_ZRS` or `Premium_LRS`. **Sample:** Standard\_ZRS | | | **custom\_domain** complex | always | User domain assigned to the storage account. Must be a dictionary with *name* and *use\_sub\_domain* keys where *name* is the CNAME source. | | | | **name** string | always | CNAME source. **Sample:** testaccount | | | | **use\_sub\_domain** boolean | always | Whether to use sub domain. **Sample:** True | | | **https\_only** boolean | always | Allows https traffic only to storage service when set to `true`. | | | **id** string | always | Resource ID. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/t estaccount001 | | | **kind** string | always | The kind of storage. **Sample:** Storage | | | **location** string | always | Valid Azure location. Defaults to location of the resource group. **Sample:** eastus | | | **name** string | always | Name of the storage account to update or create. **Sample:** testaccount001 | | | **primary\_endpoints** complex | always | URLs to retrieve a public *blob*, *queue*, or *table* object. Note that `Standard_ZRS` and `Premium_LRS` accounts only return the blob endpoint. | | | | **blob** complex | always | The primary blob endpoint and connection string. | | | | | **connectionstring** string | always | Connectionstring of the blob endpoint. **Sample:** DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=X;AccountKey=X;BlobEndpoint=X | | | | | **endpoint** string | always | The primary blob endpoint. **Sample:** https://testaccount001.blob.core.windows.net/ | | | | **key** string | always | The account key for the primary\_endpoints **Sample:** xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | | | | **queue** complex | always | The primary queue endpoint and connection string. | | | | | **connectionstring** string | always | Connectionstring of the queue endpoint. **Sample:** DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=X;AccountKey=X;QueueEndpoint=X | | | | | **endpoint** string | always | The primary queue endpoint. **Sample:** https://testaccount001.queue.core.windows.net/ | | | | **table** complex | always | The primary table endpoint and connection string. | | | | | **connectionstring** string | always | Connectionstring of the table endpoint. **Sample:** DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=X;AccountKey=X;TableEndpoint=X | | | | | **endpoint** string | always | The primary table endpoint. **Sample:** https://testaccount001.table.core.windows.net/ | | | **primary\_location** string | always | The location of the primary data center for the storage account. **Sample:** eastus | | | **provisioning\_state** string | always | The status of the storage account at the time the operation was called. Possible values include `Creating`, `ResolvingDNS`, `Succeeded`. **Sample:** Succeeded | | | **secondary\_endpoints** complex | always | The URLs to retrieve a public *blob*, *queue*, or *table* object from the secondary location. Only available if the SKU *name=Standard\_RAGRS*. | | | | **blob** complex | always | The secondary blob endpoint and connection string. | | | | | **connectionstring** string | always | Connectionstring of the blob endpoint. **Sample:** DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=X;AccountKey=X;BlobEndpoint=X | | | | | **endpoint** string | always | The secondary blob endpoint. **Sample:** https://testaccount001.blob.core.windows.net/ | | | | **key** string | success | The account key for the secondary\_endpoints **Sample:** xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | | | | **queue** complex | always | The secondary queue endpoint and connection string. | | | | | **connectionstring** string | always | Connectionstring of the queue endpoint. **Sample:** DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=X;AccountKey=X;QueueEndpoint=X | | | | | **endpoint** string | always | The secondary queue endpoint. **Sample:** https://testaccount001.queue.core.windows.net/ | | | | **table** complex | always | The secondary table endpoint and connection string. | | | | | **connectionstring** string | always | Connectionstring of the table endpoint. **Sample:** DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=X;AccountKey=X;TableEndpoint=X | | | | | **endpoint** string | always | The secondary table endpoint. **Sample:** https://testaccount001.table.core.windows.net/ | | | **secondary\_location** string | always | The location of the geo-replicated secondary for the storage account. Only available if the *account\_type=Standard\_GRS* or *account\_type=Standard\_RAGRS*. **Sample:** westus | | | **status\_of\_primary** string | always | Status of the primary location of the storage account; either `available` or `unavailable`. **Sample:** available | | | **status\_of\_secondary** string | always | Status of the secondary location of the storage account; either `available` or `unavailable`. **Sample:** available | | | **tags** dictionary | always | Resource tags. **Sample:** {'tag1': 'abc'} | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Chris Houseknecht (@chouseknecht) * Matt Davis (@nitzmahone)
programming_docs
ansible community.azure.azure_rm_roledefinition_info – Get Azure Role Definition facts community.azure.azure\_rm\_roledefinition\_info – Get Azure Role Definition facts ================================================================================= Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_roledefinition_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_roledefinition\_info](../../azure/azcollection/azure_rm_roledefinition_info_module#ansible-collections-azure-azcollection-azure-rm-roledefinition-info-module) instead. Synopsis -------- * Get facts of Azure Role Definition. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **id** string | | Role definition id. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **role\_name** string | | Role name. | | **scope** string / required | | The scope of role definition. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | | **type** string | **Choices:*** system * custom | Type of role. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: List Role Definitions in scope community.azure.azure_rm_roledefinition_info: scope: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup - name: Get Role Definition by name community.azure.azure_rm_roledefinition_info: scope: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup name: myRoleDefinition ``` 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 | | --- | --- | --- | | **roledefinitions** complex | always | A list of Role Definition facts. | | | **assignable\_scopes** list / elements=string | always | List of assignable scopes of this definition. **Sample:** ['/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup'] | | | **id** string | always | Role Definition ID. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/providers/Microsoft.Authorization/roleDefinitions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | | | **name** string | always | System assigned role name. **Sample:** xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | | | **permissions** string | always | List of Role Definition permissions. | | | | **actions** list / elements=string | always | List of allowed actions. **Sample:** ['Microsoft.Compute/virtualMachines/read'] | | | | **data\_actions** list / elements=string | always | List of allowed data actions. **Sample:** ['Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read'] | | | | **not\_actions** list / elements=string | always | List of denied actions. **Sample:** ['Microsoft.Compute/virtualMachines/write'] | | | | **not\_data\_actions** list / elements=string | always | List of denied data actions. **Sample:** ['Microsoft.Storage/storageAccounts/blobServices/containers/blobs/write'] | | | **role\_name** string | always | Role name. **Sample:** myCustomRoleDefinition | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Yunge Zhu(@yungezz) ansible community.azure.azure_rm_resourcegroup_info – Get resource group facts community.azure.azure\_rm\_resourcegroup\_info – Get resource group facts ========================================================================= Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_resourcegroup_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_resourcegroup\_info](../../azure/azcollection/azure_rm_resourcegroup_info_module#ansible-collections-azure-azcollection-azure-rm-resourcegroup-info-module) instead. Synopsis -------- * Get facts for a specific resource group or all resource groups. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **list\_resources** string | | List all resources under the resource group. Note this will cost network overhead for each resource group. Suggest use this when *name* set. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | Limit results to a specific resource group. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** string | | Limit results by providing a list of tags. Format tags as 'key' or 'key:value'. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get facts for one resource group community.azure.azure_rm_resourcegroup_info: name: myResourceGroup - name: Get facts for all resource groups community.azure.azure_rm_resourcegroup_info: - name: Get facts by tags community.azure.azure_rm_resourcegroup_info: tags: - testing - foo:bar - name: Get facts for one resource group including resources it contains community.azure.azure_rm_resourcegroup_info: name: myResourceGroup list_resources: 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 | | --- | --- | --- | | **azure\_resourcegroups** list / elements=string | always | List of resource group dicts. | | | **id** string | always | Resource id. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup | | | **name** string | always | Resource group name. **Sample:** foo | | | **resources** list / elements=string | when *list\_resources=yes*. | List of resources under the resource group. | | | | **id** string | always | Resource id. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMa chines/myVirtualMachine | | | | **location** string | always | Resource region. **Sample:** eastus | | | | **name** string | always | Resource name. **Sample:** myVirtualMachine | | | | **tags** dictionary | always | Tags to assign to the managed disk. **Sample:** {'tag': 'value'} | | | | **type** string | always | Resource type. **Sample:** Microsoft.Compute/virtualMachines | | | **tags** dictionary | always | Tags assigned to resource group. **Sample:** {'tag': 'value'} | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Chris Houseknecht (@chouseknecht) * Matt Davis (@nitzmahone) ansible community.azure.azure_rm_publicipaddress_info – Get public IP facts community.azure.azure\_rm\_publicipaddress\_info – Get public IP facts ====================================================================== Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_publicipaddress_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_publicipaddress\_info](../../azure/azcollection/azure_rm_publicipaddress_info_module#ansible-collections-azure-azcollection-azure-rm-publicipaddress-info-module) instead. Synopsis -------- * Get facts for a specific public IP or all public IPs within a resource group. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | Only show results for a specific Public IP. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string | | Limit results by resource group. Required when using name parameter. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** string | | Limit results by providing a list of tags. Format tags as 'key' or 'key:value'. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get facts for one Public IP community.azure.azure_rm_publicipaddress_info: resource_group: myResourceGroup name: publicip001 - name: Get facts for all Public IPs within a resource groups community.azure.azure_rm_publicipaddress_info: resource_group: myResourceGroup ``` 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 | | --- | --- | --- | | **azure\_publicipaddresses** list / elements=string | always | List of public IP address dicts. Please note that this option will be deprecated in 2.10 when curated format will become the only supported format. **Sample:** [{'etag': 'W/"a31a6d7d-cb18-40a5-b16d-9f4a36c1b18a"', 'id': '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/publicIPAddresses/pip2001', 'location': 'eastus2', 'name': 'pip2001', 'properties': {'idleTimeoutInMinutes': 4, 'provisioningState': 'Succeeded', 'publicIPAllocationMethod': 'Dynamic', 'resourceGuid': '29de82f4-a7da-440e-bd3d-9cabb79af95a'}, 'type': 'Microsoft.Network/publicIPAddresses'}] | | **publicipaddresses** complex | always | List of publicipaddress. Contains the detail which matches azure\_rm\_publicipaddress parameters. Returned when the format parameter set to curated. | | | **allocation\_method** string | always | The public IP allocation method. Possible values are `static` and `dynamic`. **Sample:** static | | | **dns\_settings** dictionary | always | The FQDN of the DNS record associated with the public IP address. **Sample:** {'domain\_name\_label': 'ansible-b57dc95985712e45eb8b9c2e', 'fqdn': 'ansible-b57dc95985712e45eb8b9c2e.eastus.cloudapp.azure.com', 'reverse\_fqdn': None} | | | **etag** string | always | A unique read-only string that changes whenever the resource is updated. **Sample:** W/'1905ee13-7623-45b1-bc6b-4a12b2fb9d15' | | | **id** string | always | Resource ID. **Sample:** /subscriptions/xxx---xxxxx/resourceGroups/v-xisuRG/providers/Microsoft.Network/publicIPAddresses/pipb57dc95224 | | | **idle\_timeout** integer | always | The idle timeout of the public IP address. **Sample:** 4 | | | **ip\_address** string | always | The Public IP Prefix this Public IP Address should be allocated from. **Sample:** 40.121.144.14 | | | **ip\_tags** list / elements=string | always | The list of tags associated with the public IP address. **Sample:** [{'type': 'FirstPartyUsage', 'value': 'Storage'}] | | | **location** string | always | Resource location. **Sample:** eastus | | | **name** string | always | Name of the public IP address. **Sample:** pipb57dc95224 | | | **provisioning\_state** string | always | The provisioning state of the PublicIP resource. Possible values is `Succeeded`. **Sample:** Succeeded | | | **sku** string | always | The public IP address SKU. **Sample:** Basic | | | **tags** dictionary | always | Resource tags. **Sample:** {'delete': 'on-exit', 'testing': 'testing'} | | | **type** string | always | Resource type. **Sample:** Microsoft.Network/publicIPAddresses | | | **version** string | always | The public IP address version. Possible values are `ipv4` and `ipv6`. **Sample:** ipv4 | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Chris Houseknecht (@chouseknecht) * Matt Davis (@nitzmahone)
programming_docs
ansible community.azure.azure_rm_devtestlabarmtemplate_info – Get Azure DevTest Lab ARM Template facts community.azure.azure\_rm\_devtestlabarmtemplate\_info – Get Azure DevTest Lab ARM Template facts ================================================================================================= Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_devtestlabarmtemplate_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_devtestlabarmtemplate\_info](../../azure/azcollection/azure_rm_devtestlabarmtemplate_info_module#ansible-collections-azure-azcollection-azure-rm-devtestlabarmtemplate-info-module) instead. Synopsis -------- * Get facts of Azure DevTest Lab ARM Template. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **artifact\_source\_name** string / required | | The name of the artifact source. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **lab\_name** string / required | | The name of the lab. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | The name of the ARM template. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string / required | | The name of the resource group. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get information on DevTest Lab ARM Template community.azure.azure_rm_devtestlabarmtemplate_info: resource_group: myResourceGroup lab_name: myLab artifact_source_name: public environment repo name: WebApp ``` 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 | | --- | --- | --- | | **arm\_templates** complex | always | A list of dictionaries containing facts for DevTest Lab ARM Template. | | | **artifact\_source\_name** string | always | Artifact source name. **Sample:** public environment repo | | | **description** string | always | The tags of the resource. **Sample:** This template creates an Azure Web App without a data store. | | | **display\_name** string | always | The tags of the resource. **Sample:** Web App | | | **id** string | always | The identifier of the resource. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DevTestLab/labs/myLab/art ifactSources/public environment repo/armTemplates/WebApp | | | **lab\_name** string | always | DevTest Lab name. **Sample:** myLab | | | **name** string | always | ARM Template name. **Sample:** WebApp | | | **publisher** string | always | The tags of the resource. **Sample:** Microsoft | | | **resource\_group** string | always | Resource group name. **Sample:** myResourceGroup | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Zim Kalinowski (@zikalino) ansible community.azure.azure_rm_virtualmachineextension – Managed Azure Virtual Machine extension community.azure.azure\_rm\_virtualmachineextension – Managed Azure Virtual Machine extension ============================================================================================ Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_virtualmachineextension`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_virtualmachineextension](../../azure/azcollection/azure_rm_virtualmachineextension_module#ansible-collections-azure-azcollection-azure-rm-virtualmachineextension-module) instead. Synopsis -------- * Create, update and delete Azure Virtual Machine Extension. * Note that this module was called [community.azure.azure\_rm\_virtualmachine\_extension](azure_rm_virtualmachine_extension_module#ansible-collections-community-azure-azure-rm-virtualmachine-extension-module) before Ansible 2.8. The usage did not change. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **auto\_upgrade\_minor\_version** boolean | **Choices:*** no * yes | Whether the extension handler should be automatically upgraded across minor versions. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **location** string | | Valid Azure location. Defaults to location of the resource group. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string / required | | Name of the vm extension. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **protected\_settings** string | | Json formatted protected settings for the extension. | | **publisher** string | | The name of the extension handler publisher. | | **resource\_group** string / required | | Name of a resource group where the vm extension exists or will be created. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **settings** string | | Json formatted public settings for the extension. | | **state** string | **Choices:*** absent * **present** ← | State of the vm extension. Use `present` to create or update a vm extension and `absent` to delete a vm extension. | | **subscription\_id** string | | Your Azure subscription Id. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | | **type\_handler\_version** string | | The type version of the extension handler. | | **virtual\_machine\_extension\_type** string | | The type of the extension handler. | | **virtual\_machine\_name** string | | The name of the virtual machine where the extension should be create or updated. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Create VM Extension community.azure.azure_rm_virtualmachineextension: name: myvmextension location: eastus resource_group: myResourceGroup virtual_machine_name: myvm publisher: Microsoft.Azure.Extensions virtual_machine_extension_type: CustomScript type_handler_version: 2.0 settings: '{"commandToExecute": "hostname"}' auto_upgrade_minor_version: true - name: Delete VM Extension community.azure.azure_rm_virtualmachineextension: name: myvmextension location: eastus resource_group: myResourceGroup virtual_machine_name: myvm 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 or not the resource has changed. **Sample:** True | | **state** dictionary | always | Current state of the vm extension. **Sample:** {'state': 'Deleted'} | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Sertac Ozercan (@sozercan) * Julien Stroheker (@julienstroheker) ansible community.azure.azure_rm_dnsrecordset_info – Get DNS Record Set facts community.azure.azure\_rm\_dnsrecordset\_info – Get DNS Record Set facts ======================================================================== Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_dnsrecordset_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_dnsrecordset\_info](../../azure/azcollection/azure_rm_dnsrecordset_info_module#ansible-collections-azure-azcollection-azure-rm-dnsrecordset-info-module) instead. Synopsis -------- * Get facts for a specific DNS Record Set in a Zone, or a specific type in all Zones or in one Zone etc. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **append\_tags** boolean | **Choices:*** no * **yes** ← | Use to control if tags field is canonical or just appends to existing tags. When canonical, any tags not found in the tags parameter will be removed from the object's metadata. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **record\_type** string | | Limit record sets by record type. | | **relative\_name** string | | Only show results for a Record Set. | | **resource\_group** string | | Limit results by resource group. Required when filtering by name or type. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** dictionary | | Dictionary of string:string pairs to assign as metadata to the object. Metadata tags on the object will be updated with any provided values. To remove tags set append\_tags option to false. Currently, Azure DNS zones and Traffic Manager services also don't allow the use of spaces in the tag. Azure Front Door doesn't support the use of Azure Automation and Azure CDN only support 15 tags on resources. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | | **top** integer | | Limit the maximum number of record sets to return. | | **zone\_name** string | | Limit results by zones. Required when filtering by name or type. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get facts for one Record Set community.azure.azure_rm_dnsrecordset_info: resource_group: myResourceGroup zone_name: example.com relative_name: server10 record_type: A - name: Get facts for all Type A Record Sets in a Zone community.azure.azure_rm_dnsrecordset_info: resource_group: myResourceGroup zone_name: example.com record_type: A - name: Get all record sets in one zone community.azure.azure_rm_dnsrecordset_info: resource_group: myResourceGroup zone_name: example.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 | | --- | --- | --- | | **azure\_dnsrecordset** list / elements=string | always | List of record set dicts. **Sample:** [{'etag': '60ac0480-44dd-4881-a2ed-680d20b3978e', 'id': '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/dnszones/newzone.com/A/servera', 'name': 'servera', 'properties': {'ARecords': [{'ipv4Address': '10.4.5.7'}, {'ipv4Address': '2.4.5.8'}], 'TTL': 12900}, 'type': 'Microsoft.Network/dnszones/A'}] | | **dnsrecordsets** list / elements=string | always | List of record set dicts, which shares the same hierarchy as [community.azure.azure\_rm\_dnsrecordset](azure_rm_dnsrecordset_module) module's parameter. | | | **fqdn** string | success | Fully qualified domain name of the record set. **Sample:** www.newzone.com | | | **id** string | success | ID of the dns recordset. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/dnszones/newzone. com/A/servera | | | **provisioning\_state** string | success | Provision state of the resource. **Sample:** Successed | | | **record\_type** string | success | The type of the record set. Can be `A`, `AAAA`, `CNAME`, `MX`, `NS`, `SRV`, `TXT`, `PTR`. **Sample:** A | | | **records** string | success | List of records depending on the type of recordset. **Sample:** [{'ipv4Address': '10.4.5.7'}, {'ipv4Address': '2.4.5.8'}] | | | **relative\_name** string | success | Name of the dns recordset. **Sample:** servera | | | **time\_to\_live** string | success | Time to live of the record set in seconds. **Sample:** 12900 | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Ozi Boms (@ozboms)
programming_docs
ansible community.azure.azure_rm_cdnendpoint_info – Get Azure CDN endpoint facts community.azure.azure\_rm\_cdnendpoint\_info – Get Azure CDN endpoint facts =========================================================================== Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_cdnendpoint_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_cdnendpoint\_info](../../azure/azcollection/azure_rm_cdnendpoint_info_module#ansible-collections-azure-azcollection-azure-rm-cdnendpoint-info-module) instead. Synopsis -------- * Get facts for a specific Azure CDN endpoint or all Azure CDN endpoints. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | Limit results to a specific Azure CDN endpoint. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **profile\_name** string / required | | Name of CDN profile. | | **resource\_group** string / required | | Name of resource group where this CDN profile belongs to. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** string | | Limit results by providing a list of tags. Format tags as 'key' or 'key:value'. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get facts for all endpoints in CDN profile community.azure.azure_rm_cdnendpoint_info: resource_group: myResourceGroup profile_name: myCDNProfile - name: Get facts of specific CDN endpoint community.azure.azure_rm_cdnendpoint_info: resource_group: myResourceGroup profile_name: myCDNProfile name: myEndpoint1 ``` 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 | | --- | --- | --- | | **cdnendpoints** complex | always | List of Azure CDN endpoints. | | | **content\_types\_to\_compress** list / elements=string | success | List of content types on which compression applies. **Sample:** ['text/plain', 'text/html', 'text/css', 'text/javascript', 'application/x-javascript', 'application/javascript', 'application/json', 'application/xml'] | | | **id** string | success | ID of the Azure CDN endpoint. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myCDN/providers/Microsoft.Cdn/profiles/myProfile/endpoints/myEndpoint1 | | | **is\_compression\_enabled** boolean | success | Indicates whether content compression is enabled on CDN. **Sample:** True | | | **is\_http\_allowed** boolean | success | Indicates whether HTTP traffic is allowed on the endpoint. **Sample:** True | | | **is\_https\_allowed** boolean | success | Indicates whether HTTPS traffic is allowed on the endpoint. **Sample:** True | | | **location** string | success | Location of the Azure CDN endpoint. **Sample:** WestUS | | | **name** string | always | Name of the Azure CDN endpoint. **Sample:** myEndpoint | | | **origin\_host\_header** string | success | The host header value sent to the origin with each request. **Sample:** xxxxxxxx.blob.core.windows.net | | | **origin\_path** string | success | A directory path on the origin that CDN can use to retrieve content from. **Sample:** /pic/ | | | **origins** string | success | The source of the content being delivered via CDN. **Sample:** {'host\_name': 'xxxxxxxx.blob.core.windows.net', 'http\_port': None, 'https\_port': None, 'name': 'xxxxxxxx-blob-core-windows-net'} | | | **profile\_name** string | always | Name of the Azure CDN profile that this endpoint is attached to. **Sample:** myProfile | | | **provisioning\_state** string | success | Provisioning status of the Azure CDN endpoint. **Sample:** Succeeded | | | **query\_string\_caching\_behavior** string | success | Defines how CDN caches requests that include query strings. **Sample:** IgnoreQueryString | | | **resource\_group** string | always | Name of a resource group where the Azure CDN endpoint exists. **Sample:** myResourceGroup | | | **resource\_state** string | success | Resource status of the profile. **Sample:** Running | | | **tags** list / elements=string | success | The tags of the Azure CDN endpoint. **Sample:** foo | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Hai Cao (@caohai) * Yunge zhu (@yungezz) ansible community.azure.azure_rm_managed_disk_facts community.azure.azure\_rm\_managed\_disk\_facts =============================================== Note This redirect is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (version 1.1.0). * This redirect has been **deprecated**. Please update your tasks to use the new name `community.azure.azure_rm_manageddisk_info` instead. It will be removed in version 2.0.0 of community.azure. * This is a redirect to the [community.azure.azure\_rm\_manageddisk\_info module](azure_rm_manageddisk_info_module#ansible-collections-community-azure-azure-rm-manageddisk-info-module). * This redirect also works with Ansible 2.9. * The collection contains the following information on this deprecation: Use azure.azcollection.azure\_rm\_manageddisk\_info instead. ansible community.azure.azure_rm_postgresqldatabase_info – Get Azure PostgreSQL Database facts community.azure.azure\_rm\_postgresqldatabase\_info – Get Azure PostgreSQL Database facts ========================================================================================= Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_postgresqldatabase_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_postgresqldatabase\_info](../../azure/azcollection/azure_rm_postgresqldatabase_info_module#ansible-collections-azure-azcollection-azure-rm-postgresqldatabase-info-module) instead. Synopsis -------- * Get facts of PostgreSQL Database. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | The name of the database. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string / required | | The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **server\_name** string / required | | The name of the server. | | **subscription\_id** string | | Your Azure subscription Id. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get instance of PostgreSQL Database community.azure.azure_rm_postgresqldatabase_info: resource_group: myResourceGroup server_name: server_name name: database_name - name: List instances of PostgreSQL Database community.azure.azure_rm_postgresqldatabase_info: resource_group: myResourceGroup server_name: server_name ``` 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 | | --- | --- | --- | | **databases** complex | always | A list of dict results where the key is the name of the PostgreSQL Database and the values are the facts for that PostgreSQL Database. | | | **charset** string | always | The charset of the database. **Sample:** UTF8 | | | **collation** string | always | The collation of the database. **Sample:** English\_United States.1252 | | | **id** string | always | Resource ID. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/testser ver/databases/db1 | | | **name** string | always | Resource name. **Sample:** db1 | | | **resource\_group** string | always | Resource group name. **Sample:** testrg | | | **server\_name** string | always | Server name. **Sample:** testserver | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Zim Kalinowski (@zikalino) ansible community.azure.azure_rm_trafficmanagerprofile_info – Get Azure Traffic Manager profile facts community.azure.azure\_rm\_trafficmanagerprofile\_info – Get Azure Traffic Manager profile facts ================================================================================================ Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_trafficmanagerprofile_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_trafficmanagerprofile\_info](../../azure/azcollection/azure_rm_trafficmanagerprofile_info_module#ansible-collections-azure-azcollection-azure-rm-trafficmanagerprofile-info-module) instead. Synopsis -------- * Get facts for a Azure specific Traffic Manager profile or all Traffic Manager profiles. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | Limit results to a specific Traffic Manager profile. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string | | The resource group to search for the desired Traffic Manager profile. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** string | | Limit results by providing a list of tags. Format tags as 'key' or 'key:value'. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get facts for one Traffic Manager profile azure_rm_trafficmanager_info: name: Testing resource_group: myResourceGroup - name: Get facts for all Traffic Manager profiles azure_rm_trafficmanager_info: - name: Get facts by tags azure_rm_trafficmanager_info: tags: - Environment:Test ``` 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 | | --- | --- | --- | | **tms** complex | always | List of Traffic Manager profiles. | | | **dns\_config** complex | always | The DNS settings of the Traffic Manager profile. | | | | **fqdn** string | always | The fully-qualified domain name(FQDN) of the Traffic Manager profile. **Sample:** testTm.trafficmanager.net | | | | **relative\_name** string | always | The relative DNS name provided by the Traffic Manager profile. **Sample:** testTm | | | | **ttl** integer | always | The DNS Time-To-Live(TTL), in seconds. **Sample:** 60 | | | **endpoints** complex | always | The list of endpoints in the Traffic Manager profile. | | | | **geo\_mapping** list / elements=string | always | The list of countries/regions mapped to this endpoint when the profile has routing\_method `geographic`. **Sample:** ['GEO-NA', 'GEO-AS'] | | | | **id** string | always | Fully qualified resource ID for the resource. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/trafficMan agerProfiles/tmtest/externalEndpoints/e1 | | | | **location** string | always | The location of endpoints when *type=external\_endpoints* or *type=nested\_endpoints*, and profile *routing\_method=performance*. **Sample:** East US | | | | **min\_child\_endpoints** integer | always | The minimum number of endpoints that must be available in the child profile to make the parent profile available. **Sample:** 3 | | | | **name** string | always | The name of the endpoint. **Sample:** e1 | | | | **priority** string | always | The priority of this endpoint when the profile has *routing\_method=priority*. **Sample:** 3 | | | | **status** string | always | The status of the endpoint. **Sample:** Enabled | | | | **target** string | always | The fully-qualified DNS name of the endpoint. **Sample:** 8.8.8.8 | | | | **target\_resource\_id** string | always | The Azure Resource URI of the of the endpoint. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ClassicCompute/dom ainNames/vscjavaci | | | | **type** string | always | The type of the endpoint. **Sample:** external\_endpoints | | | | **weight** integer | always | The weight of this endpoint when the profile has *routing\_method=weighted*. **Sample:** 10 | | | **location** string | always | Location of the Traffic Manager profile. **Sample:** global | | | **monitor\_config** complex | always | The endpoint monitoring settings of the Traffic Manager profile. | | | | **interval** integer | always | The monitor interval for endpoints in this profile in seconds. **Sample:** 10 | | | | **path** string | always | The path relative to the endpoint domain name used to probe for endpoint health. **Sample:** / | | | | **port** integer | always | The TCP port used to probe for endpoint health. **Sample:** 80 | | | | **protocol** string | always | The protocol `HTTP`, `HTTPS` or `TCP` used to probe for endpoint health. **Sample:** HTTP | | | | **timeout** integer | always | The monitor timeout for endpoints in this profile in seconds. **Sample:** 30 | | | | **tolerated\_failures** integer | always | The number of consecutive failed health check before declaring an endpoint Degraded after the next failed health check. **Sample:** 3 | | | **name** string | always | Name of the Traffic Manager profile. **Sample:** testTm | | | **profile\_status** string | always | The status of the Traffic Manager profile. **Sample:** Enabled | | | **resource\_group** string | always | Name of a resource group where the Traffic Manager profile exists. **Sample:** testGroup | | | **routing\_method** string | always | The traffic routing method of the Traffic Manager profile. **Sample:** performance | | | **state** string | always | The state of the Traffic Manager profile. **Sample:** present | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Hai Cao (@caohai) * Yunge Zhu (@yungezz)
programming_docs
ansible community.azure.azure_rm_virtualmachineimage_info – Get virtual machine image facts community.azure.azure\_rm\_virtualmachineimage\_info – Get virtual machine image facts ====================================================================================== Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_virtualmachineimage_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_virtualmachineimage\_info](../../azure/azcollection/azure_rm_virtualmachineimage_info_module#ansible-collections-azure-azcollection-azure-rm-virtualmachineimage-info-module) instead. Synopsis -------- * Get facts for virtual machine images. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **location** string / required | | Azure location value, for example `westus`, `eastus`, `eastus2`, `northcentralus`, etc. Supplying only a location value will yield a list of available publishers for the location. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **offer** string | | Name of an image offering. Combine with SKU to see a list of available image versions. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **publisher** string | | Name of an image publisher. List image offerings associated with a particular publisher. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **sku** string | | Image offering SKU. Combine with offer to see a list of available versions. | | **subscription\_id** string | | Your Azure subscription Id. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | | **version** string | | Specific version number of an image. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get facts for a specific image community.azure.azure_rm_virtualmachineimage_info: location: eastus publisher: OpenLogic offer: CentOS sku: '7.1' version: '7.1.20160308' - name: List available versions community.azure.azure_rm_virtualmachineimage_info: location: eastus publisher: OpenLogic offer: CentOS sku: '7.1' - name: List available offers community.azure.azure_rm_virtualmachineimage_info: location: eastus publisher: OpenLogic - name: List available publishers community.azure.azure_rm_virtualmachineimage_info: location: eastus ``` 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 | | --- | --- | --- | | **azure\_vmimages** list / elements=string | always | List of image dicts. **Sample:** [{'id': '/Subscriptions/xxx...xxx/Providers/Microsoft.Compute/Locations/eastus/ Publishers/OpenLogic/ArtifactTypes/VMImage/Offers/CentOS/Skus/7.1/Versions/7.1.20150410', 'location': 'eastus', 'name': '7.1.20150410'}, {'id': '/Subscriptions/xxx...xxx/Providers/Microsoft.Compute/Locations/eastus/ Publishers/OpenLogic/ArtifactTypes/VMImage/Offers/CentOS/Skus/7.1/Versions/7.1.20150605', 'location': 'eastus', 'name': '7.1.20150605'}, {'id': '/Subscriptions/xxx...xxx/Providers/Microsoft.Compute/Locations/eastus/ Publishers/OpenLogic/ArtifactTypes/VMImage/Offers/CentOS/Skus/7.1/Versions/7.1.20150731', 'location': 'eastus', 'name': '7.1.20150731'}, {'id': '/Subscriptions/xxx...xxx/Providers/Microsoft.Compute/Locations/eastus/ Publishers/OpenLogic/ArtifactTypes/VMImage/Offers/CentOS/Skus/7.1/Versions/7.1.20160308', 'location': 'eastus', 'name': '7.1.20160308'}] | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Chris Houseknecht (@chouseknecht) * Matt Davis (@nitzmahone) ansible community.azure.azure_rm_webapp_info – Get Azure web app facts community.azure.azure\_rm\_webapp\_info – Get Azure web app facts ================================================================= Note This plugin is part of the [community.azure collection](https://galaxy.ansible.com/community/azure) (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.azure`. To use it in a playbook, specify: `community.azure.azure_rm_webapp_info`. * [DEPRECATED](#deprecated) * [Synopsis](#synopsis) * [Requirements](#requirements) * [Parameters](#parameters) * [Notes](#notes) * [See Also](#see-also) * [Examples](#examples) * [Return Values](#return-values) * [Status](#status) DEPRECATED ---------- Removed in version 2.0.0 Why The Ansible collection community.azure is deprecated. Use azure.azcollection instead. Alternative Use [azure.azcollection.azure\_rm\_webapp\_info](../../azure/azcollection/azure_rm_webapp_info_module#ansible-collections-azure-azcollection-azure-rm-webapp-info-module) instead. Synopsis -------- * Get facts for a specific web app or all web app in a resource group, or all web app in current subscription. Requirements ------------ The below requirements are needed on the host that executes this module. * python >= 2.7 * The host that executes this module must have the azure.azcollection collection installed via galaxy * All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection * Full installation instructions may be found <https://galaxy.ansible.com/azure/azcollection> Parameters ---------- | Parameter | Choices/Defaults | Comments | | --- | --- | --- | | **ad\_user** string | | Active Directory username. Use when authenticating with an Active Directory user rather than service principal. | | **adfs\_authority\_url** string added in 0.0.1 of azure.azcollection | | Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. | | **api\_profile** string added in 0.0.1 of azure.azcollection | **Default:**"latest" | Selects an API profile to use when communicating with Azure services. Default value of `latest` is appropriate for public clouds; future values will allow use with Azure Stack. | | **auth\_source** string added in 0.0.1 of azure.azcollection | **Choices:*** **auto** ← * cli * credential\_file * env * msi | Controls the source of the credentials to use for authentication. Can also be set via the `ANSIBLE_AZURE_AUTH_SOURCE` environment variable. When set to `auto` (the default) the precedence is module parameters -> `env` -> `credential_file` -> `cli`. When set to `env`, the credentials will be read from the environment variables When set to `credential_file`, it will read the profile from `~/.azure/credentials`. When set to `cli`, the credentials will be sources from the Azure CLI profile. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. When set to `msi`, the host machine must be an azure resource with an enabled MSI extension. `subscription_id` or the environment variable `AZURE_SUBSCRIPTION_ID` can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. The `msi` was added in Ansible 2.6. | | **cert\_validation\_mode** string added in 0.0.1 of azure.azcollection | **Choices:*** ignore * validate | Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing `ignore`. Can also be set via credential file profile or the `AZURE_CERT_VALIDATION` environment variable. | | **client\_id** string | | Azure client ID. Use when authenticating with a Service Principal. | | **cloud\_environment** string added in 0.0.1 of azure.azcollection | **Default:**"AzureCloud" | For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, `AzureChinaCloud`, `AzureUSGovernment`), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the `AZURE_CLOUD_ENVIRONMENT` environment variable. | | **log\_mode** string | | Parent argument. | | **log\_path** string | | Parent argument. | | **name** string | | Only show results for a specific web app. | | **password** string | | Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. | | **profile** string | | Security profile found in ~/.azure/credentials file. | | **resource\_group** string | | Limit results by resource group. | | **return\_publish\_profile** boolean | **Choices:*** **no** ← * yes | Indicate whether to return publishing profile of the web app. | | **secret** string | | Azure client secret. Use when authenticating with a Service Principal. | | **subscription\_id** string | | Your Azure subscription Id. | | **tags** string | | Limit results by providing a list of tags. Format tags as 'key' or 'key:value'. | | **tenant** string | | Azure tenant ID. Use when authenticating with a Service Principal. | Notes ----- Note * For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with `az login`. * Authentication is also possible using a service principal or Active Directory user. * To authenticate via service principal, pass subscription\_id, client\_id, secret and tenant or set environment variables AZURE\_SUBSCRIPTION\_ID, AZURE\_CLIENT\_ID, AZURE\_SECRET and AZURE\_TENANT. * To authenticate via Active Directory user, pass ad\_user and password, or set AZURE\_AD\_USER and AZURE\_PASSWORD in the environment. * Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription\_id, client\_id, secret and tenant or subscription\_id, ad\_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE\_PROFILE in the environment. See Also -------- See also [Sign in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest) How to authenticate using the `az login` command. Examples -------- ``` - name: Get facts for web app by name community.azure.azure_rm_webapp_info: resource_group: myResourceGroup name: winwebapp1 - name: Get facts for web apps in resource group community.azure.azure_rm_webapp_info: resource_group: myResourceGroup - name: Get facts for web apps with tags community.azure.azure_rm_webapp_info: tags: - testtag - foo:bar ``` 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 | | --- | --- | --- | | **webapps** complex | always | List of web apps. | | | **app\_settings** dictionary | always | App settings of the application. Only returned when web app has app settings. **Sample:** {'testkey': 'testvalue', 'testkey2': 'testvalue2'} | | | **availability\_state** string | always | Availability of this web app. **Sample:** Normal | | | **default\_host\_name** string | always | Host name of the web app. **Sample:** vxxisurg397winapp4.azurewebsites.net | | | **enabled** boolean | always | Indicates the web app enabled or not. **Sample:** True | | | **enabled\_host\_names** list / elements=string | always | Enabled host names of the web app. **Sample:** ['vxxisurg397winapp4.azurewebsites.net', 'vxxisurg397winapp4.scm.azurewebsites.net'] | | | **frameworks** list / elements=string | always | Frameworks of the application. Only returned when web app has frameworks. **Sample:** [{'name': 'net\_framework', 'version': 'v4.0'}, {'name': 'java', 'settings': {'java\_container': 'tomcat', 'java\_container\_version': '8.5'}, 'version': '1.7'}, {'name': 'php', 'version': '5.6'}] | | | **ftp\_publish\_url** string | always | Publishing URL of the web app when deployment type is FTP. **Sample:** ftp://xxxx.ftp.azurewebsites.windows.net | | | **host\_name\_ssl\_states** list / elements=string | always | SSL state per host names of the web app. **Sample:** [{'hostType': 'Standard', 'name': 'vxxisurg397winapp4.azurewebsites.net', 'sslState': 'Disabled'}, {'hostType': 'Repository', 'name': 'vxxisurg397winapp4.scm.azurewebsites.net', 'sslState': 'Disabled'}] | | | **host\_names** list / elements=string | always | Host names of the web app. **Sample:** ['vxxisurg397winapp4.azurewebsites.net'] | | | **id** string | always | ID of the web app. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp | | | **location** string | always | Location of the web app. **Sample:** eastus | | | **name** string | always | Name of the web app. **Sample:** winwebapp1 | | | **outbound\_ip\_addresses** string | always | Outbound IP address of the web app. **Sample:** 40.71.11.131,40.85.166.200,168.62.166.67,137.135.126.248,137.135.121.45 | | | **plan** string | always | ID of app service plan used by the web app. **Sample:** /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Web/serverfarms/myAppServicePlan | | | **publishing\_password** string | only when *return\_publish\_profile=True*. | Publishing profile password. **Sample:** uvANsPQpGjWJmrFfm4Ssd5rpBSqGhjMk11pMSgW2vCsQtNx9tcgZ0xN26s9A | | | **publishing\_username** string | only when *return\_publish\_profile=True*. | Publishing profile user name. **Sample:** $vxxisuRG397winapp4 | | | **resource\_group** string | always | Resource group of the web app. **Sample:** myResourceGroup | | | **state** string | always | State of the web app. **Sample:** running | | | **tags** dictionary | always | Tags assigned to the resource. Dictionary of string:string pairs. **Sample:** {'tag1': 'abc'} | Status ------ * This module will be removed in version 2.0.0. *[deprecated]* * For more information see [DEPRECATED](#deprecated). ### Authors * Yunge Zhu (@yungezz)
programming_docs