܍~c$ UdZddlZddlmZddlmZddlmZmZm Z ddl m Z ddl m Z ddlmZmZdd lmZmZdd lmZd Zd d deegeedgdgdZeed<eeZGddZdede de dededdf dZdS)z&Salt Minion: Setup and run salt minionN)Logger)dedent)safeyamlsubputil)Cloud)Config) MetaSchema get_meta_doc) ALL_DISTROS bsd_utils) PER_INSTANCEa.This module installs, configures and starts salt minion. If the ``salt_minion`` key is present in the config parts, then salt minion will be installed and started. Configuration for salt minion can be specified in the ``conf`` key under ``salt_minion``. Any conf values present there will be assigned in ``/etc/salt/minion``. The public and private keys to use for salt minion can be specified with ``public_key`` and ``private_key`` respectively. Optionally if you have a custom package name, service name or config directory you can specify them with ``pkg_name``, ``service_name`` and ``config_dir``. Salt keys can be manually generated by: ``salt-key --gen-keys=GEN_KEYS``, where ``GEN_KEYS`` is the name of the keypair, e.g. 'minion'. The keypair will be copied to ``/etc/salt/pki`` on the minion instance. cc_salt_minionz Salt MinionzSetup and run salt miniona salt_minion: pkg_name: salt-minion service_name: salt-minion config_dir: /etc/salt conf: master: salt.example.com grains: role: - web public_key: | ------BEGIN PUBLIC KEY------- ------END PUBLIC KEY------- private_key: | ------BEGIN PRIVATE KEY------ ------END PRIVATE KEY------- pki_dir: /etc/salt/pki/minion salt_minion)idnametitle descriptiondistros frequencyexamplesactivate_by_schema_keysmetaceZdZdZdZdS) SaltConstantsz> defines default distribution specific salt variables cBtjrd|_d|_d|_nd|_d|_d|_tj|d|j|_tj|d|j|_tj|d|j|_dS) Nzpy-saltrz/usr/local/etc/saltz salt-minionz /etc/saltpkg_name config_dir service_name)r is_FreeBSDrsrv_nameconf_dirget_cfg_option_str)selfcfgs A/usr/lib/python3/dist-packages/cloudinit/config/cc_salt_minion.py__init__zSaltConstants.__init__Ns ?   (%DM)DM1DMM*DM)DM'DM/ZOO / t}   /    N)__name__ __module__ __qualname____doc__r'r(r&rrIs-     r(rrr%cloudlogargsreturncvd|vr|d|dS|d}t|}|j|jt j|jd|vratj |jd}tj | d}t j||d|vratj |jd} tj | d} t j| | d|vr:d|vr5tj |jd } tj | s%tj |jd } | d | } t jd 5t j| tj | d } tj | d}t j| |dt j||ddddn #1swxYwY|jjdkrt%jddt)jd|jdgddS)Nrz?Skipping module named %s, no 'salt_minion' key in configuration)r%confminiongrains public_key private_keyz pki/minionpkipki_dir?z minion.pubz minion.pemfreebsdsalt_minion_enableYESservicerestartF)capture)debugrdistroinstall_packagesrr ensure_dirr"ospathjoinrdumpsget write_fileisdirumaskosfamilyr set_rc_config_valuerr!)rr%r.r/r0s_cfgconst minion_config minion_data grains_config grains_datapki_dir_defaultr9pub_namepem_names r&handlerXesC M       E e $ $ $E L!!%.111 OEN### U^X>> nUYYv%6%677   {3335 U^X>> nUYYx%8%899   {333u%!7!7',,u~|DDw}}_-- B gll5>5AAO))I77 Z   < < OG $ $ $w||G\::Hw||G\::H OHeL&9 : : : OHeM&: ; ; ;  < < < < < < < < < < < < < < < | ))%&:EBBB Iy%.)4eDDDDDDsB I++I/2I/)r,rEloggingrtextwrapr cloudinitrrrcloudinit.cloudrcloudinit.configr cloudinit.config.schemar r cloudinit.distrosr r cloudinit.settingsrMODULE_DESCRIPTIONr__annotations__rstrlistrXr-r(r&res -,, **********!!!!!!######<<<<<<<<44444444++++++    (%}   0!.?  j   D ,t           86E 6E6E#(6E/56E=A6E 6E6E6E6E6E6Er(