sap.sap_operations.valid_fqdn test – Verify that value provided is valid fqdn

Note

This test plugin is part of the sap.sap_operations collection.

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install sap.sap_operations.

To use it in a playbook, specify: sap.sap_operations.valid_fqdn.

New in sap.sap_operations 2.14.0

Synopsis

  • Verify that value provided is valid fqdn (fully qualified domain name)

  • Valid fqdn is not longer than 253 characters

  • Valid fqdn if split by ‘.’ contains list of valid hostnames

  • Each hostname that valid fqdn contains is not longer than 63 characters

  • Each hostname that valid fqdn contains is valid hostname

Keyword parameters

This describes keyword parameters of the test. These are the values key1=value1, key2=value2 and so on in the following examples: input is sap.sap_operations.valid_fqdn(key1=value1, key2=value2, ...) and input is not sap.sap_operations.valid_fqdn(key1=value1, key2=value2, ...)

Parameter

Comments

value

string / required

Value to check if valid fqdn

Notes

Note

  • This module is community supported

  • Module interface (parameters, output) expected to be stable but not guaranteed

  • Module planned to be released on Ansible Automation Hub after collecting some feedback

  • There is no guarantee that this module will be officially supported by Red Hat

Examples

---
- name: This is valid fqdn
  ansible.builtin.assert:
    that: ('hostname13.domain.com' is sap.sap_operations.valid_fqdn)

- name: Valid hostname is also valid fqdn
  ansible.builtin.assert:
    that: ('hostname13' is sap.sap_operations.valid_fqdn)

- name: Valid hostname is also valid fqdn, but it can be up to 63 characters
  ansible.builtin.assert:
    that: ('hostname1234567890123456789012345678901234567890' is sap.sap_operations.valid_fqdn)

- name: Fqdn cannot contain two dots in a sequence
  ansible.builtin.assert:
    that: ('hostname13..domain.com' is not sap.sap_operations.valid_fqdn)

- name: This is not valid fqdn
  ansible.builtin.assert:
    that: ('hostname13-.domain.com' is not sap.sap_operations.valid_fqdn)

- name: Fqdn cannot end in dot
  ansible.builtin.assert:
    that: ('hostname13.domain.com.' is not sap.sap_operations.valid_fqdn)

Return Value

Key

Description

Return value

boolean

True if value provided is valid sap fqdn

Returned: success

Authors

  • Kirill Satarin (@kksat)

Hint

Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.