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/cli/__pycache__/playbook.cpython-39.pyc
a

�)g�(�@s�ddlmZmZmZeZddlmZddlZddl	Z	ddl
mZddl
m
Z
ddlmZddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZmZddl m!Z!e!�Z"Gdd�de�Z#ddd�Z$e%dkr�e$�dS)�)�absolute_import�division�print_function)�CLIN)�	constants)�context)�option_helpers)�AnsibleError)�PlaybookExecutor)�to_bytes)�Block)�add_all_plugin_dirs)�AnsibleCollectionConfig)�_get_collection_name_from_path�_get_collection_playbook_path)�DisplaycsHeZdZdZdZ�fdd�Z�fdd�Z�fdd�Zed	d
��Z	�Z
S)�PlaybookCLIz� the tool to run *Ansible playbooks*, which are a configuration and multinode deployment system.
        See the project home page (https://docs.ansible.com) for more information. zansible-playbookcstt|�jddd�t�|j�t�|j�t�|j�t�|j�t�	|j�t�
|j�t�|j�t�|j�t�
|j�t�|j�|jjddddd�|jjd	d
ddd�|jjdd
ddd�|jjddddd�|jjdddd�|jjddddd�dS)Nz,%prog [options] playbook.yml [playbook2 ...]zJRuns Ansible playbooks, executing the defined tasks on the targeted hosts.)�usageZdescz--syntax-check�syntax�
store_truez=perform a syntax check on the playbook, but do not execute it)�dest�action�helpz--list-tasks�	listtasksz%list all tasks that would be executedz--list-tags�listtagszlist all available tagsz--step�stepz4one-step-at-a-time: confirm each task before runningz--start-at-taskZ
start_at_taskz1start the playbook at the task matching this name)rr�argszPlaybook(s)�playbook�+)r�metavar�nargs)�superr�init_parser�opt_helpZadd_connect_options�parserZadd_meta_optionsZadd_runas_optionsZadd_subset_optionsZadd_check_optionsZadd_inventory_optionsZadd_runtask_optionsZadd_vault_optionsZadd_fork_optionsZadd_module_options�add_argument)�self��	__class__��8/usr/lib/python3.9/site-packages/ansible/cli/playbook.pyr"&s<
�����
�zPlaybookCLI.init_parsercs,tt|��|�}|jt_|j|ddd�|S)NT)Z
runas_optsZ	fork_opts)r!r�post_process_args�	verbosity�displayZvalidate_conflicts)r&�optionsr'r)r*r+EszPlaybookCLI.post_process_argsc
shtt|���d}d}i}g}tjdD]�}t|�}|durF|d}nJtj�|�s^t	d|��tj�
|�s�t�t�|�j
�s�t	d|��t|�}|s(tj�tj�t|dd���}t|�|�|�q(|r�|t_tjd�stjd�stjd	�stjd
�s|��\}}||d�}|��\}	}
}t�|
tjd�tjd
�rL|�|
|�ttjd|
||	|d�}|��}
t|
t��r`|
D�]�}t�d|d�t|d�D�]�\}}|j du�r�|	�!|j �n"tj�"tj�|d��}|	�!|�zd�#|j$�}Wnt%�yd}Yn0d|d||j&f}t'|j(��|dd�#��7}tjd�r�t'|
�)|j$��}|d|j$t*|�f7}|D]}|d|7}�qvt�|�t'��tjd	�s�tjd�r�d}tjd�r�d}���fdd��|j+|d�}|�,�D]*}|�-|�}|�.��s�q�|�|�7}�q�tjd	�rJt��/���}|�0�|dd�#|�7}t�|��q��q|dS|
SdS) Nr�z#the playbook: %s could not be foundz-the playbook: %s does not appear to be a fileZsurrogate_or_strict)�errorsZ	listhostsrrr)Z	conn_passZbecome_passZsubsetZflush_cache)Z	playbooks�	inventory�variable_manager�loader�	passwordsz
playbook: %srZplays�,�z
  play #%d (%s): %s�z	TAGS: [%s]z 
    pattern: %s
    hosts (%d):z	
      %sz    tasks:
cs�d}|jD]�}t|t�r&|�|�7}q
|jtjvr:|jr:q
��|j�t	j
dr
t��t
|j���}|��|jr�|d|��7}n|d|j7}|dd�|�7}q
|S)Nr6rz      %sz	TAGS: [%s]
�, )�block�
isinstancerr�CZ_ACTION_METAZimplicit�update�tagsr�CLIARGS�list�union�set�sort�name�get_name�join)�b�taskmsgZtask�cur_tags��_process_blockZall_tagsZmytagsr)r*rJ�s


z'PlaybookCLI.run.<locals>._process_block)�playz      TASK TAGS: [%s]
r8r)1r!r�runrr>r�os�path�existsr	�isfile�stat�S_ISFIFO�st_moder�dirname�abspathrr
�appendrZplaybook_pathsZ
ask_passwordsZ
_play_prereqsrZ
get_host_list�_flush_cacher
r:r?r-�	enumerateZ_included_pathZset_basedir�realpathrE�hosts�	TypeErrorrCrAr=Z	get_hosts�lenZget_vars�compileZfilter_tagged_tasksZ	has_tasksr@rB)r&ZsshpassZ
becomepassr4Zb_playbook_dirsr�resourceZplaybook_collectionZb_playbook_dirr3r1r2Zpbex�results�p�idxrKZpb_dirZ	host_list�msgZ	playhosts�hostrGZall_varsr9rHr'rIr*rLMs�
��
�






zPlaybookCLI.runcCs$|��D]}|��}|�|�qdS�N)Z
list_hostsrDZclear_facts)r1r2rc�hostnamer)r)r*rW�szPlaybookCLI._flush_cache)�__name__�
__module__�__qualname__�__doc__rCr"r+rL�staticmethodrW�
__classcell__r)r)r'r*r srcCst�|�dSrd)rZcli_executor)rr)r)r*�main�srl�__main__)N)&Z
__future__rrr�typeZ
__metaclass__Zansible.clirrMrQZansiblerr;rZansible.cli.argumentsrr#Zansible.errorsr	Z"ansible.executor.playbook_executorr
Zansible.module_utils._textrZansible.playbook.blockrZansible.plugins.loaderr
Zansible.utils.collection_loaderrZ2ansible.utils.collection_loader._collection_finderrrZansible.utils.displayrr-rrlrfr)r)r)r*�<module>s*E