%PDF- %PDF-
| Direktori : /lib/python3.9/site-packages/ansible/plugins/lookup/__pycache__/ |
| Current File : //lib/python3.9/site-packages/ansible/plugins/lookup/__pycache__/random_choice.cpython-39.pyc |
a
�)g& � @ sd d dl mZmZmZ eZdZdZdZd dl Z d dl
mZ d dlm
Z
d dlmZ G d d
� d
e�ZdS )� )�absolute_import�division�print_functiona�
name: random_choice
author: Michael DeHaan
version_added: "1.1"
short_description: return random element from list
description:
- The 'random_choice' feature can be used to pick something at random. While it's not a load balancer (there are modules for those),
it can somewhat be used as a poor man's load balancer in a MacGyver like situation.
- At a more basic level, they can be used to add chaos and excitement to otherwise predictable automation environments.
z�
- name: Magic 8 ball for MUDs
ansible.builtin.debug:
msg: "{{ item }}"
with_random_choice:
- "go through the door"
- "drink from the goblet"
- "press the red button"
- "do nothing"
z<
_raw:
description:
- random item
type: raw
N)�AnsibleError)� to_native)�
LookupBasec @ s e Zd Zddd�ZdS )�LookupModuleNc
K sR |}|rNzt �|�g}W n4 tyL } ztdt|� ��W Y d }~n
d }~0 0 |S )Nz Unable to choose random term: %s)�random�choice� Exceptionr r )�selfZtermsZinject�kwargs�ret�e� r �H/usr/lib/python3.9/site-packages/ansible/plugins/lookup/random_choice.py�run, s &zLookupModule.run)N)�__name__�
__module__�__qualname__r r r r r r * s r )Z
__future__r r r �typeZ
__metaclass__Z
DOCUMENTATIONZEXAMPLESZRETURNr Zansible.errorsr Zansible.module_utils._textr Zansible.plugins.lookupr r r r r r �<module> s