File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/pillar/__pycache__/foreman.cpython-310.pyc
o
�N�g� �
@ sp d Z ddlZzddlZdZW n ey dZY nw dddddddddd � Ze�e�Zd
Z dd� Z
ddd�ZdS )a�
A module to pull data from Foreman via its API into the Pillar dictionary
Configuring the Foreman ext_pillar
==================================
Set the following Salt config to setup Foreman as external pillar source:
.. code-block:: yaml
ext_pillar:
- foreman:
key: foreman # Nest results within this key
only: ['hostgroup_name', 'parameters'] # Add only these keys to pillar
foreman.url: https://example.com/foreman_api
foreman.user: username # default is admin
foreman.password: password # default is changeme
The following options are optional:
.. code-block:: yaml
foreman.api: apiversion # default is 2 (1 is not supported yet)
foreman.verifyssl: False # default is True
foreman.certfile: /etc/ssl/certs/mycert.pem # default is None
foreman.keyfile: /etc/ssl/private/mykey.pem # default is None
foreman.cafile: /etc/ssl/certs/mycert.ca.pem # default is None
foreman.lookup_parameters: True # default is True
An alternative would be to use the Foreman modules integrating Salt features
in the Smart Proxy and the webinterface.
Further information can be found on `GitHub <https://github.com/theforeman/foreman_salt>`_.
Module Documentation
====================
� NTFzhttp://foreman/apiZadminZchangeme� ) �foreman.url�foreman.user�foreman.password�foreman.api�foreman.verifyssl�foreman.certfile�foreman.keyfile�foreman.cafile�foreman.lookup_parametersZforemanc C s t sdS tS )z6
Only return if all the modules are available
F)�HAS_REQUESTS�__virtualname__� r r �G/opt/saltstack/salt/lib/python3.10/site-packages/salt/pillar/foreman.py�__virtual__F s r r c sL t d }t d }t d }t d }t d }t d } t d }
t d }t d }t�d
|| � zb|dkr7t�d� t�d
dt|� d i}
|rI|durI|}tj|d | ||f|
|| |
fdd�}|�� � t� d� � |r�t
� }� d D ]
}|�|d |d i� qo|� d<