Skip to content

Instantly share code, notes, and snippets.

@pkunc
Last active February 20, 2023 09:09
Show Gist options
  • Save pkunc/454dde10aa062ac449802f57e97e82c2 to your computer and use it in GitHub Desktop.
Save pkunc/454dde10aa062ac449802f57e97e82c2 to your computer and use it in GitHub Desktop.
Ansible: Extract domain from the server name

Ansible: Extract domain from a server name

- debug:
    msg: 'domain only: {{ ("server.domain.com" | split(".", 1))[1] }}'

Output:

domain only: domain.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment