404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.23.102.79: ~ $
3

\�me�"�
@s�UdZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZddl
mZddlmZddlmZmZdd	lmZmZdd
lmZddlmZmZddlmZmZd
ddeegdge
d�e
d�e
d�gd�Zeee�Zej e!�Z"dZ#Gdd�dej$�Z%Gdd�de%�Z&Gdd�de%�Z'e(eee)dd�dd�Z*e+d�d d!�Z,e+e+d"�d#d$�Z-e%e+d%�d&d'�Z.e+e%d(�d)d*�Z/e+e%d(�d+d,�Z0dS)-z9ansible enables running on first boot either ansible-pull�N)�deepcopy)�dedent)�Optional)�Cloud)�Config)�
MetaSchema�get_meta_doc)�ALL_DISTROS�Distro)�PER_INSTANCE)�subp�which)�Version�get_cfg_by_pathZ
cc_ansibleZAnsiblezConfigure ansible for instance�ansiblea        This module provides ``ansible`` integration for
        augmenting cloud-init's configuration of the local
        node.


        This module installs ansible during boot and
        then uses ``ansible-pull`` to run the playbook
        repository at the remote URL.
        z�            ansible:
              package_name: ansible-core
              install_method: distro
              pull:
                url: "https://github.com/holmanb/vmboot.git"
                playbook_name: ubuntu.yml
            z�            ansible:
              package_name: ansible-core
              install_method: pip
              pull:
                url: "https://github.com/holmanb/vmboot.git"
                playbook_name: ubuntu.yml
            )�id�name�titleZ	frequencyZdistrosZactivate_by_schema_keys�descriptionZexamples�ansible_configc@szeZdZed�dd�Zeed�dd�Zed�dd�Z	d	d
�Z
ed�dd
�Zdd�Z
ejdd��Zejed�dd��ZdS)�AnsiblePull)�distrocCs>dg|_ddg|_||_tj|_d|_|jjdd�|jd<dS)Nzansible-pullz	--version�HOMEz/root)�cmd_pull�cmd_versionr�os�environ�env�run_user�get)�selfr�r!� /usr/lib/python3.6/cc_ansible.py�__init__Es
zAnsiblePull.__init__)�returncCsF|j|j�\}}|j�jd�}tjd|�}|rB|jd�}tj|�SdS)Nrz	([\d\.]+))	�do_asr�
splitlines�pop�re�search�grouprZfrom_str)r �stdout�_Z
first_lineZmatches�versionr!r!r"�get_versionPs

zAnsiblePull.get_versioncGs|j|j|��\}}|S)N)r%r)r �argsr+r,r!r!r"�pullYszAnsiblePull.pullcCs|j�std��dS)Nz!command: ansible is not installed)�is_installed�
ValueError)r r!r!r"�
check_deps]szAnsiblePull.check_deps)�commandcKs(|js|j|f|�S|jj||jf|�S)N)rrrr%)r r4�kwargsr!r!r"r%aszAnsiblePull.do_ascKst|fd|ji|��S)Nr)rr)r r4r5r!r!r"rfszAnsiblePull.subpcCsdS)Nr!)r r!r!r"r1iszAnsiblePull.is_installed)�pkg_namecCsdS)Nr!)r r6r!r!r"�installmszAnsiblePull.installN)�__name__�
__module__�__qualname__r
r#rrr.�strr0r3�listr%r�abc�abstractmethodr1r7r!r!r!r"rDs	rcsDeZdZeeed��fdd�Zed�dd�Zed�dd	�Z	�Z
S)
�AnsiblePullPip)r�usercsft�j|�||_|jtjddg�\}}|�d�}|jjd�}|rXdj||g�|jd<n
||jd<dS)Nz-cz('import site; print(site.getuserbase())'z/bin/�PATH�:)	�superr#rr%�sys�
executablerr�join)r rr@�	user_baser,Zansible_pathZold_path)�	__class__r!r"r#ss
zAnsiblePullPip.__init__)r6cCs�|j�s�yddl}Wn&tk
r:|jj|jjg�YnXtjdddg}tj	j
tj	jtj
d�d��rp|jd�|jr�|jd	�|j|d��|j||f��dS)zishould cloud-init grow an interface for non-distro package
        managers? this seems reusable
        rNz-m�pipr7�stdlibzEXTERNALLY-MANAGEDz--break-system-packagesz--user�	--upgrade)rKrI)r1rI�ImportErrorr�install_packagesZpip_package_namerDrEr�path�existsrF�	sysconfig�get_path�appendrr%)r r6rI�cmdr!r!r"r7�s"

zAnsiblePullPip.install)r$cCs |jtjdddg�\}}d|kS)Nz-mrIr<r)r%rDrE)r r+r,r!r!r"r1�szAnsiblePullPip.is_installed)r8r9r:r
rr;r#r7�boolr1�
__classcell__r!r!)rHr"r?rsr?c@s(eZdZed�dd�Zed�dd�ZdS)�AnsiblePullDistro)r6cCs|j�s|jj|g�dS)N)r1rrM)r r6r!r!r"r7�szAnsiblePullDistro.install)r$cCsttd��S)Nr)rTr
)r r!r!r"r1�szAnsiblePullDistro.is_installedN)r8r9r:r;r7rTr1r!r!r!r"rV�srV)r�cfg�cloudr/r$cCs�|jdi�}|jd�}|jd�}|jd�}|jd�}|jd�}	|jdd�}
|r�t|�|j}|d	krpt||�}nt|�}|j|
�|j�|jd
d�}
|
r�|
|jt<|r�t	||�|	r�t
|t|	��|r�t||�dS)Nrr�install_method�setup_controllerZgalaxyr0�package_name�rIr)
r�validate_configrr?rVr7r3r�CFG_OVERRIDE�ansible_galaxy�run_ansible_pullr�ansible_controller)rrWrXr/Zansible_cfgZansible_userrYrZZ
galaxy_cfgZpull_cfgr[rrrr!r!r"�handle�s0







rb)rWcCs�d}x*|D]"}t||�s
td|�d|����q
W|jd�rfx*dD]"}t||�s@td|�d|����q@W|jd�}|r�t|jd	�|jd
�g�s�td|����|d}|dkr�td��dS)NrYr[zMissing required key 'z' from r0�pull/url�pull/playbook_namerZ�repositories�run_ansiblezMissing required key from rIrz Invalid install method {install})rYr[)rcrd)rIr)rr2r�any)rWZ
required_keys�keyZcontroller_cfgr7r!r!r"r]�s$





r])rWr$cCsdd�|j�D�S)zremove boolean false valuescSs&i|]\}}|dk	r||jdd��qS)Fr,�-)�replace)�.0rh�valuer!r!r"�
<dictcomp>�szfilter_args.<locals>.<dictcomp>)�items)rWr!r!r"�filter_args�sro)r0rWcCs�|jd�}|j�}|s"tjd�n<|tddd�kr^|jd�r^td|j�d|j�d|j	�d	���|j
d
d�t|�j�D�|f��}|r�t
jj|��dS)N�
playbook_namezCannot parse ansible version��rZdiffzAnsible version �.z%doesn't support --diff flag, exiting.cSs2g|]*\}}|dk	r$d|�d|��nd|���qS)Tz--�=r!)rkrhrlr!r!r"�
<listcomp>sz$run_ansible_pull.<locals>.<listcomp>)r'r.�LOG�warningrrr2�major�minorZpatchr0rornrDr+�write)r0rWrp�vr+r!r!r"r`�s

 
r`)rWrcCs8|jdg�}|stjd|�x|D]}|j|�q"WdS)N�actionszInvalid config: %s)rrvrwr%)rWrr|r4r!r!r"r_
s

r_cCs�x.|jdg�D]}|jdd|d|dg�qWxT|jdg�D]D}|jd�}|jd�}d	|fd
d�t|�j�D��}|j||d�q>WdS)
NreZgitZclone�sourcerNrf�playbook_dirrpzansible-playbookcSs g|]\}}d|�d|���qS)z--rtr!)rkrhrlr!r!r"ru!sz&ansible_controller.<locals>.<listcomp>)�cwd)rr%r'rorn)rWrZ
repositoryr/r~rpr4r!r!r"ras

ra)1�__doc__r=Zloggingrr(rDrP�copyr�textwraprZtypingrZcloudinit.cloudrZcloudinit.configrZcloudinit.config.schemarrZcloudinit.distrosr	r
Zcloudinit.settingsrZcloudinit.subprr
Zcloudinit.utilrr�metaZ	getLoggerr8rvr^�ABCrr?rVr;r<rb�dictr]ror`r_rar!r!r!r"�<module>sP

.0	%		

Filemanager

Name Type Size Permission Actions
__init__.cpython-36.opt-1.pyc File 128 B 0644
__init__.cpython-36.pyc File 128 B 0644
cc_ansible.cpython-36.opt-1.pyc File 8.63 KB 0644
cc_ansible.cpython-36.pyc File 8.63 KB 0644
cc_apk_configure.cpython-36.opt-1.pyc File 4.51 KB 0644
cc_apk_configure.cpython-36.pyc File 4.51 KB 0644
cc_apt_configure.cpython-36.opt-1.pyc File 30.42 KB 0644
cc_apt_configure.cpython-36.pyc File 30.42 KB 0644
cc_apt_pipelining.cpython-36.opt-1.pyc File 2.44 KB 0644
cc_apt_pipelining.cpython-36.pyc File 2.44 KB 0644
cc_bootcmd.cpython-36.opt-1.pyc File 2.51 KB 0644
cc_bootcmd.cpython-36.pyc File 2.51 KB 0644
cc_byobu.cpython-36.opt-1.pyc File 3.04 KB 0644
cc_byobu.cpython-36.pyc File 3.04 KB 0644
cc_ca_certs.cpython-36.opt-1.pyc File 7.05 KB 0644
cc_ca_certs.cpython-36.pyc File 7.05 KB 0644
cc_chef.cpython-36.opt-1.pyc File 9.13 KB 0644
cc_chef.cpython-36.pyc File 9.13 KB 0644
cc_disable_ec2_metadata.cpython-36.opt-1.pyc File 1.72 KB 0644
cc_disable_ec2_metadata.cpython-36.pyc File 1.72 KB 0644
cc_disk_setup.cpython-36.opt-1.pyc File 23.1 KB 0644
cc_disk_setup.cpython-36.pyc File 23.1 KB 0644
cc_fan.cpython-36.opt-1.pyc File 2.74 KB 0644
cc_fan.cpython-36.pyc File 2.74 KB 0644
cc_final_message.cpython-36.opt-1.pyc File 3.07 KB 0644
cc_final_message.cpython-36.pyc File 3.07 KB 0644
cc_growpart.cpython-36.opt-1.pyc File 15.91 KB 0644
cc_growpart.cpython-36.pyc File 15.91 KB 0644
cc_grub_dpkg.cpython-36.opt-1.pyc File 4.92 KB 0644
cc_grub_dpkg.cpython-36.pyc File 4.92 KB 0644
cc_install_hotplug.cpython-36.opt-1.pyc File 3.25 KB 0644
cc_install_hotplug.cpython-36.pyc File 3.25 KB 0644
cc_keyboard.cpython-36.opt-1.pyc File 1.98 KB 0644
cc_keyboard.cpython-36.pyc File 1.98 KB 0644
cc_keys_to_console.cpython-36.opt-1.pyc File 3.11 KB 0644
cc_keys_to_console.cpython-36.pyc File 3.11 KB 0644
cc_landscape.cpython-36.opt-1.pyc File 4.71 KB 0644
cc_landscape.cpython-36.pyc File 4.71 KB 0644
cc_locale.cpython-36.opt-1.pyc File 1.58 KB 0644
cc_locale.cpython-36.pyc File 1.58 KB 0644
cc_lxd.cpython-36.opt-1.pyc File 13.04 KB 0644
cc_lxd.cpython-36.pyc File 13.04 KB 0644
cc_mcollective.cpython-36.opt-1.pyc File 4.24 KB 0644
cc_mcollective.cpython-36.pyc File 4.24 KB 0644
cc_migrator.cpython-36.opt-1.pyc File 2.92 KB 0644
cc_migrator.cpython-36.pyc File 2.92 KB 0644
cc_mounts.cpython-36.opt-1.pyc File 14.08 KB 0644
cc_mounts.cpython-36.pyc File 14.08 KB 0644
cc_ntp.cpython-36.opt-1.pyc File 13.15 KB 0644
cc_ntp.cpython-36.pyc File 13.15 KB 0644
cc_package_update_upgrade_install.cpython-36.opt-1.pyc File 3.78 KB 0644
cc_package_update_upgrade_install.cpython-36.pyc File 3.78 KB 0644
cc_phone_home.cpython-36.opt-1.pyc File 4.1 KB 0644
cc_phone_home.cpython-36.pyc File 4.1 KB 0644
cc_power_state_change.cpython-36.opt-1.pyc File 6.24 KB 0644
cc_power_state_change.cpython-36.pyc File 6.24 KB 0644
cc_puppet.cpython-36.opt-1.pyc File 9.46 KB 0644
cc_puppet.cpython-36.pyc File 9.46 KB 0644
cc_reset_rmc.cpython-36.opt-1.pyc File 3.59 KB 0644
cc_reset_rmc.cpython-36.pyc File 3.59 KB 0644
cc_resizefs.cpython-36.opt-1.pyc File 7.02 KB 0644
cc_resizefs.cpython-36.pyc File 7.02 KB 0644
cc_resolv_conf.cpython-36.opt-1.pyc File 4.27 KB 0644
cc_resolv_conf.cpython-36.pyc File 4.27 KB 0644
cc_rh_subscription.cpython-36.opt-1.pyc File 12.06 KB 0644
cc_rh_subscription.cpython-36.pyc File 12.06 KB 0644
cc_rightscale_userdata.cpython-36.opt-1.pyc File 2.77 KB 0644
cc_rightscale_userdata.cpython-36.pyc File 2.77 KB 0644
cc_rsyslog.cpython-36.opt-1.pyc File 10.34 KB 0644
cc_rsyslog.cpython-36.pyc File 10.34 KB 0644
cc_runcmd.cpython-36.opt-1.pyc File 2.43 KB 0644
cc_runcmd.cpython-36.pyc File 2.43 KB 0644
cc_salt_minion.cpython-36.opt-1.pyc File 4.36 KB 0644
cc_salt_minion.cpython-36.pyc File 4.36 KB 0644
cc_scripts_per_boot.cpython-36.opt-1.pyc File 1.4 KB 0644
cc_scripts_per_boot.cpython-36.pyc File 1.4 KB 0644
cc_scripts_per_instance.cpython-36.opt-1.pyc File 1.57 KB 0644
cc_scripts_per_instance.cpython-36.pyc File 1.57 KB 0644
cc_scripts_per_once.cpython-36.opt-1.pyc File 1.51 KB 0644
cc_scripts_per_once.cpython-36.pyc File 1.51 KB 0644
cc_scripts_user.cpython-36.opt-1.pyc File 1.58 KB 0644
cc_scripts_user.cpython-36.pyc File 1.58 KB 0644
cc_scripts_vendor.cpython-36.opt-1.pyc File 2.04 KB 0644
cc_scripts_vendor.cpython-36.pyc File 2.04 KB 0644
cc_seed_random.cpython-36.opt-1.pyc File 4.07 KB 0644
cc_seed_random.cpython-36.pyc File 4.07 KB 0644
cc_set_hostname.cpython-36.opt-1.pyc File 4 KB 0644
cc_set_hostname.cpython-36.pyc File 4 KB 0644
cc_set_passwords.cpython-36.opt-1.pyc File 8.4 KB 0644
cc_set_passwords.cpython-36.pyc File 8.4 KB 0644
cc_snap.cpython-36.opt-1.pyc File 5.94 KB 0644
cc_snap.cpython-36.pyc File 5.94 KB 0644
cc_spacewalk.cpython-36.opt-1.pyc File 2.87 KB 0644
cc_spacewalk.cpython-36.pyc File 2.87 KB 0644
cc_ssh.cpython-36.opt-1.pyc File 11.02 KB 0644
cc_ssh.cpython-36.pyc File 11.02 KB 0644
cc_ssh_authkey_fingerprints.cpython-36.opt-1.pyc File 3.54 KB 0644
cc_ssh_authkey_fingerprints.cpython-36.pyc File 3.54 KB 0644
cc_ssh_import_id.cpython-36.opt-1.pyc File 3.85 KB 0644
cc_ssh_import_id.cpython-36.pyc File 3.85 KB 0644
cc_timezone.cpython-36.opt-1.pyc File 1.24 KB 0644
cc_timezone.cpython-36.pyc File 1.24 KB 0644
cc_ubuntu_advantage.cpython-36.opt-1.pyc File 12.42 KB 0644
cc_ubuntu_advantage.cpython-36.pyc File 12.42 KB 0644
cc_ubuntu_autoinstall.cpython-36.opt-1.pyc File 3.89 KB 0644
cc_ubuntu_autoinstall.cpython-36.pyc File 3.89 KB 0644
cc_ubuntu_drivers.cpython-36.opt-1.pyc File 3.63 KB 0644
cc_ubuntu_drivers.cpython-36.pyc File 3.63 KB 0644
cc_update_etc_hosts.cpython-36.opt-1.pyc File 4.3 KB 0644
cc_update_etc_hosts.cpython-36.pyc File 4.3 KB 0644
cc_update_hostname.cpython-36.opt-1.pyc File 3.01 KB 0644
cc_update_hostname.cpython-36.pyc File 3.01 KB 0644
cc_users_groups.cpython-36.opt-1.pyc File 7.58 KB 0644
cc_users_groups.cpython-36.pyc File 7.58 KB 0644
cc_wireguard.cpython-36.opt-1.pyc File 8.39 KB 0644
cc_wireguard.cpython-36.pyc File 8.39 KB 0644
cc_write_files.cpython-36.opt-1.pyc File 5.61 KB 0644
cc_write_files.cpython-36.pyc File 5.61 KB 0644
cc_write_files_deferred.cpython-36.opt-1.pyc File 1.73 KB 0644
cc_write_files_deferred.cpython-36.pyc File 1.73 KB 0644
cc_yum_add_repo.cpython-36.opt-1.pyc File 6.03 KB 0644
cc_yum_add_repo.cpython-36.pyc File 6.03 KB 0644
cc_zypper_add_repo.cpython-36.opt-1.pyc File 5.66 KB 0644
cc_zypper_add_repo.cpython-36.pyc File 5.66 KB 0644
modules.cpython-36.opt-1.pyc File 7.31 KB 0644
modules.cpython-36.pyc File 7.31 KB 0644
schema.cpython-36.opt-1.pyc File 39.45 KB 0644
schema.cpython-36.pyc File 39.45 KB 0644