Your IP : 216.73.217.13


Current Path : /usr/lib/python3/dist-packages/cloudinit/config/__pycache__/
Upload File :
Current File : //usr/lib/python3/dist-packages/cloudinit/config/__pycache__/cc_salt_minion.cpython-38.pyc

U

�Ad$�	@s�UdZddlZddlmZddlmZddlmZmZm	Z	ddl
mZddlm
Z
ddlmZmZdd	lmZmZdd
lmZdZdd
deegeed�gdgd�Zeed<ee�ZGdd�d�Zee
eeedd�dd�ZdS)z&Salt Minion: Setup and run salt minion�N)�Logger)�dedent)�safeyaml�subp�util)�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.
Zcc_salt_minionzSalt 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-------
                    <key data>
                    ------END PUBLIC KEY-------
                private_key: |
                    ------BEGIN PRIVATE KEY------
                    <key data>
                    ------END PRIVATE KEY-------
                pki_dir: /etc/salt/pki/minion
            �salt_minion)�id�name�titleZdescriptionZdistrosZ	frequencyZexamplesZactivate_by_schema_keys�metac@seZdZdZdd�ZdS)�
SaltConstantsz>
    defines default distribution specific salt variables
    cCsht��rd|_d|_d|_nd|_d|_d|_t�|d|j�|_t�|d|j�|_t�|d|j�|_dS)	Nzpy-saltrz/usr/local/etc/saltzsalt-minionz	/etc/salt�pkg_nameZ
config_dirZservice_name)rZ
is_FreeBSDr�srv_name�conf_dirZget_cfg_option_str)�self�cfg�r�A/usr/lib/python3/dist-packages/cloudinit/config/cc_salt_minion.py�__init__Ns$��zSaltConstants.__init__N)�__name__�
__module__�__qualname__�__doc__rrrrrrIsr)rr�cloud�log�args�returnc	Cs�d|kr|�d|�dS|d}t|d�}|j�|j�t�|j�d|krxtj	�
|jd�}t�|�
d��}t�||�d|kr�tj	�
|jd�}	t�|�
d��}
t�|	|
�d|k�rTd|k�rTtj	�
|jd	�}tj	�|�s�tj	�
|jd
�}|�
d|�}t�d��Lt�|�tj	�
|d
�}
tj	�
|d�}t�|
|d�t�||d�W5QRX|jjdk�rnt�dd�tjd|jdgdd�dS)Nrz?Skipping module named %s, no 'salt_minion' key in configuration)r�confZminionZgrainsZ
public_keyZprivate_keyz
pki/minionZpki�pki_dir�?z
minion.pubz
minion.pemZfreebsdZsalt_minion_enableZYES�serviceZrestartF)Zcapture)�debugrZdistroZinstall_packagesrrZ
ensure_dirr�os�path�joinr�dumps�getZ
write_file�isdir�umaskZosfamilyrZset_rc_config_valuerr)rrr r!r"Zs_cfgZconstZ
minion_configZminion_dataZ
grains_configZgrains_dataZpki_dir_defaultr%Zpub_nameZpem_namerrr�handlees@�

r0)rr)Zloggingr�textwraprZ	cloudinitrrrZcloudinit.cloudrZcloudinit.configrZcloudinit.config.schemar	r
Zcloudinit.distrosrrZcloudinit.settingsr
ZMODULE_DESCRIPTIONr�__annotations__r�str�listr0rrrr�<module>s>���"�