community.general.random_pet lookup – Generates random pet names
Note
This lookup plugin is part of the community.general collection (version 4.8.3).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.general
.
To use it in a playbook, specify: community.general.random_pet
.
New in version 3.1.0: of community.general
Requirements
The below requirements are needed on the local controller node that executes this lookup.
Parameters
Parameter |
Comments |
---|---|
The maximal length of every component of the pet name. Values below 3 will be set to 3 by petname. Default: 6 |
|
A string to prefix with the name. |
|
The character to separate words in the pet name. Default: “-“ |
|
The number of words in the pet name. Default: 2 |
Examples
- name: Generate pet name
ansible.builtin.debug:
var: lookup('community.general.random_pet')
# Example result: 'loving-raptor'
- name: Generate pet name with 3 words
ansible.builtin.debug:
var: lookup('community.general.random_pet', words=3)
# Example result: 'fully-fresh-macaw'
- name: Generate pet name with separator
ansible.builtin.debug:
var: lookup('community.general.random_pet', separator="_")
# Example result: 'causal_snipe'
- name: Generate pet name with length
ansible.builtin.debug:
var: lookup('community.general.random_pet', length=7)
# Example result: 'natural-peacock'
Return Values
Common return values are documented here, the following are the fields unique to this lookup:
Key |
Description |
---|---|
A one-element list containing a random pet name Returned: success |
Authors
Abhijeet Kasurde (@Akasurde)
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.
Collection links
Issue Tracker Repository (Sources) Submit a bug report Request a feature Communication