HEX
Server: LiteSpeed
System: Linux kapuas.iixcp.rumahweb.net 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: mirz4654 (1666)
PHP: 8.1.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
File: //usr/lib/python3.9/site-packages/ansible/playbook/__pycache__/play.cpython-39.pyc
a

�)ge=�@sddlmZmZmZeZddlmZddlm	Z	ddl
mZmZddl
mZddlmZddlmZmZmZddlmZdd	lmZdd
lmZddlmZddlmZmZdd
l m!Z!ddl"m#Z#ddl$m%Z%ddl&m'Z'ddl(m)Z)e)�Z*dgZ+Gdd�dee%e�Z,dS)�)�absolute_import�division�print_function)�	constants)�context)�AnsibleParserError�AnsibleAssertionError)�	to_native)�is_sequence)�binary_type�string_types�	text_type)�NonInheritableFieldAttribute)�Base)�Block)�CollectionSearch)�load_list_of_blocks�load_list_of_roles)�Role)�Task)�Taggable)�preprocess_vars)�Display�Playcs�eZdZdZeddeddd�Zedddd�Zedd	d
�edd�Zede	j
dd�Zed
e	jd�Z
ededd�Zededd�Zededd�Zededd�Zededd�Zededd�Zededd�Zede�d�dd�Zeddd�Zededd�Zed
e	jdd�Zed
dd�Z�fdd�Zdd�Zdd�Z dd�Z!e"dEdd ��Z#�fd!d"�Z$d#d$�Z%d%d&�Z&d'd(�Z'd)d*�Z(d+d,�Z)d-d.�Z*d/d0�Z+d1d2�Z,d3d4�Z-d5d6�Z.d7d8�Z/d9d:�Z0d;d<�Z1d=d>�Z2�fd?d@�Z3�fdAdB�Z4�fdCdD�Z5�Z6S)Frz�
    A play is a language feature that represents a list of roles and/or
    task/handler blocks to execute on a given set of hosts.

    Usage:

       Play.load(datastructure) -> Play
       Play.something(...)
    �listT���)�isa�required�listof�always_post_validate�priority�boolN)r�defaultrcCstjS�N)�CZDEFAULT_GATHER_SUBSET�r%r%�9/usr/lib/python3.9/site-packages/ansible/playbook/play.py�<lambda>@�z
Play.<lambda>)rr"rr�int�string)rr"�c)rr"r F�Z����force_handlers�percent)rrcsftt|���d|_d|_g|_i|_ttj	�
dg��p>td�|_ttj	�
dg��|_
i|_i|_dS)N�tags)�all�	skip_tags)�superr�__init__�_included_conditional�_included_pathZ_removed_hosts�
ROLE_CACHE�setrZCLIARGS�get�	frozensetZ	only_tagsr2�_action_groups�_group_actions��self��	__class__r%r&r4Zsz
Play.__init__cCs|��Sr#)�get_namer=r%r%r&�__repr__hsz
Play.__repr__cCstd|jvrp|std��t|�rZ|D]4}|dur8td��q"t|ttf�s"tdj|d���q"nt|ttf�sptd��dS)N�hostsz6Hosts list cannot be empty. Please check your playbookzFHosts list cannot contain values of 'None'. Please check your playbookz5Hosts list contains an invalid host value: '{host!s}')�hostzDHosts list must be a sequence or string. Please check your playbook.)�_dsrr
�
isinstancerr
�format)r>Z	attribute�name�value�entryr%r%r&�_validate_hostsks

zPlay._validate_hostscCs8|jr|jSt|j�r&d�|j�|_n|jp.d|_|jS)z return the name of the Play �,�)rHr
rC�joinr=r%r%r&rA|s
z
Play.get_namecCs$t�}|r|��|_|j|||d�S)N)�variable_manager�loader)r�copy�varsZ	load_data)�datarOrPrR�pr%r%r&�load�s
z	Play.loadcs\t|t�std|t|�f��d|vrLd|vr:td|d��|d|d<|d=tt|��|�S)zH
        Adjusts play datastructure to cleanup old/legacy items
        z?while preprocessing data (%s), ds should be a dict but was a %s�userZremote_userzkboth 'user' and 'remote_user' are set for this play. The use of 'user' is deprecated, and should be removed��obj)rF�dictr�typerr3r�preprocess_data)r>�dsr?r%r&r[�s
�zPlay.preprocess_datac
CsXzt|||j|jd�WStyR}z$tdt|�|j|d��WYd}~n
d}~00dS)��
        Loads a list of blocks from a list which may be mixed tasks/blocks.
        Bare tasks outside of a block are given an implicit block.
        �r\�playrOrPz9A malformed block was encountered while loading tasks: %s�rXZorig_excN)r�_variable_manager�_loader�AssertionErrorrr	rE�r>�attrr\�er%r%r&�_load_tasks�szPlay._load_tasksc
CsPzt|||j|jd�WStyJ}ztd|j|d��WYd}~n
d}~00dS)r]r^z9A malformed block was encountered while loading pre_tasksr`N�rrarbrcrrErdr%r%r&�_load_pre_tasks�szPlay._load_pre_tasksc
CsPzt|||j|jd�WStyJ}ztd|j|d��WYd}~n
d}~00dS)r]r^z:A malformed block was encountered while loading post_tasksr`Nrhrdr%r%r&�_load_post_tasks�szPlay._load_post_tasksc
Cs`z&|j|jt||d|j|jd�dd�WStyZ}ztd|j|d��WYd}~n
d}~00dS)z�
        Loads a list of blocks from a list which may be mixed handlers/blocks.
        Bare handlers outside of a block are given an implicit block.
        T)r\r_Zuse_handlersrOrP)Zprependz8A malformed block was encountered while loading handlersr`N)Z
_extend_value�handlersrrarbrcrrErdr%r%r&�_load_handlers�s�zPlay._load_handlersc
Cs�|durg}zt|||j|j|jd�}Wn4ty\}ztd|j|d��WYd}~n
d}~00g}|D]}|�tj	||d��qf||j
dd�<|j
S)z�
        Loads and returns a list of RoleInclude objects from the datastructure
        list of role definitions and creates the Role from those objects
        N)r_rOrPZcollection_search_listz-A malformed role declaration was encountered.r`�r_r)rrarb�collectionsrcrrE�appendrrU�roles)r>rer\Z
role_includesrfrpZrir%r%r&�_load_roles�s
�
&zPlay._load_rolescCsbt|�}g}|dur^|D]D}d|vr0td|d��|D]}|dvr4td||d��q4|�|�q|S)NrHz6Invalid vars_prompt data structure, missing 'name' keyrW)	rH�promptr"ZprivateZconfirmZencryptZ	salt_sizeZsaltZunsafez>Invalid vars_prompt data structure, found unsupported key '%s')rrro)r>rer\Znew_dsZvars_promptsZprompt_data�keyr%r%r&�_load_vars_prompt�szPlay._load_vars_promptcCs<g}t|j�dkr8|jD]}|jr$q|�|j|d��q|S)a|
        Handles the role compilation step, returning a flat list of tasks
        with the lowest level dependencies first. For example, if a role R
        has a dependency D1, which also has a dependency D2, the tasks from
        D2 are merged first, followed by D1, and lastly by the tasks from
        the parent role R last. This is done for all roles in the Play.
        rrm)�lenrp�from_include�extend�compile�r>�
block_list�rr%r%r&�_compile_roles�s	
zPlay._compile_rolescCs<g}t|j�dkr8|jD]}|jr$q|�|j|d��q|S)z�
        Handles the role handler compilation step, returning a flat list of Handlers
        This is done for all roles in the Play.
        rrm)rurprvrwZget_handler_blocksryr%r%r&�compile_roles_handlerss
zPlay.compile_roles_handlerscCs@tjddi||j|jd�}|jD]
}d|_q g}|jr�t�}d|_d|j	d<d|_|�
|j�t|d�}|jpr|g|_|g|_|�
|�|��|j}t|d�}|p�|g|_|g|_|�
|�t|d�}|jp�|g|_|g|_|�
|�|S|�|j�|�
|�|�|���|�|j�|�
|�|�|j�|�
|�|S)z�
        Compiles and returns the task list for this play, compiled from the
        roles (which are themselves compiled recursively) and/or the list of
        tasks specified in the play.
        �metaZflush_handlers)rSr_rOrPTZnoopZ_raw_paramsrm)rrUrarb�blockZimplicitr.r�action�args�
set_loader�	pre_tasks�alwaysror|�tasks�
post_tasksrw)r>Zflush_block�taskrzZ	noop_task�br�r%r%r&rxsJ
�










zPlay.compilecCs
|j��Sr#)rRrQr=r%r%r&�get_varsSsz
Play.get_varscCs(|jdurgSt|jt�s"|jgS|jSr#)�
vars_filesrFrr=r%r%r&�get_vars_filesVs

zPlay.get_vars_filescCs|jdd�Sr#)rkr=r%r%r&�get_handlers]szPlay.get_handlerscCs|jdd�Sr#)rpr=r%r%r&�	get_roles`szPlay.get_rolescCsNg}|j|j|jD]2}t|t�r>|�|j|j|j�q|�|�q|Sr#)	r�r�r�rFrrorZrescuer�)r>Ztasklistr�r%r%r&�	get_taskscs
zPlay.get_taskscsXtt|���}g}|��D]}|�|���q||d<|j|d<|j|d<|j|d<|S)Nrp�
included_path�
action_groups�
group_actions)r3r�	serializer�ror6r;r<)r>rSrp�roler?r%r&r�ls


zPlay.serializecs�tt|��|�|�dd�|_|�di�|_|�di�|_d|vr�|�dg�}g}|D]}t�}|�|�|�|�qVt	|d|�|d=dS)Nr�r�r�rp)
r3r�deserializer9r6r;r<rro�setattr)r>rSZ	role_datarpr�r{r?r%r&r�ys
zPlay.deserializecs>tt|���}|j��|_|j|_|j|_|j|_|j|_|Sr#)r3rrQr7r5r6r;r<)r>Znew_mer?r%r&rQ�sz	Play.copy)NNN)7�__name__�
__module__�__qualname__�__doc__rrrCZgather_factsZ
gather_subsetr$ZDEFAULT_GATHER_TIMEOUTZgather_timeoutZDEFAULT_FACT_PATHZ	fact_pathrr�Zvars_promptrprkr�r�r�rZcliargs_deferred_getr.Zmax_fail_percentage�serialZDEFAULT_STRATEGYZstrategy�orderr4rBrKrA�staticmethodrUr[rgrirjrlrqrtr|r}rxr�r�r�r�r�r�r�rQ�
__classcell__r%r%r?r&r-sT



8	
N)-Z
__future__rrrrZZ
__metaclass__Zansiblerr$rZansible.errorsrrZansible.module_utils._textr	Z'ansible.module_utils.common.collectionsr
Zansible.module_utils.sixrrr
Zansible.playbook.attributerZansible.playbook.baserZansible.playbook.blockrZ!ansible.playbook.collectionsearchrZansible.playbook.helpersrrZansible.playbook.rolerZansible.playbook.taskrZansible.playbook.taggablerZansible.vars.managerrZansible.utils.displayrZdisplay�__all__rr%r%r%r&�<module>s(