%PDF- %PDF-
| Direktori : /proc/self/root/proc/self/root/usr/lib/python2.7/site-packages/salt/states/ |
| Current File : //proc/self/root/proc/self/root/usr/lib/python2.7/site-packages/salt/states/win_servermanager.pyo |
�
���^c @@ sq d Z d d l m Z m Z m Z d d l Z d d l Z d � Z d e
e
d d d � Z d e
e
d � Z d S( u
Manage Windows features via the ServerManager powershell module. Can install and
remove roles/features.
:maintainer: Shane Lee <slee@saltstack.com>
:platform: Windows Server 2008R2 or greater
:depends: win_servermanager.install
:depends: win_servermanager.remove
i ( t absolute_importt unicode_literalst print_functionNc C@ s d t k r d St S( u2
Load only if win_servermanager is loaded
u win_servermanager.installu win_servermanager( t __salt__t False( ( ( sA /usr/lib/python2.7/site-packages/salt/states/win_servermanager.pyt __virtual__ s c
K@ s� d | k r2 t j j j d d � | j d � n i | d 6t d 6i d 6d d 6} | d k rr | j d � } n t | t � s� | j d � } n t
d
� } g } xX | D]P }
|
| k r� d j | � | d |
<q� | r� d | d |
<q� | j |
� q� W| r-| j
d
d � d j | � | d <n | d s;| St d rSd | d <| St
d | d | d | d | d | �} | d | d <g } g }
g } x� | d D]� }
| d |
j d t � s�| j d j |
� � q�d | d |
d k r|
j d j |
� � q�d | d |
d k r�| j d j |
� � q�q�W| r^| j
d
d � n |
rw|
j
d
d � n | r�| j
d
d � n d j | |
| � | d <t
d
� } t j j j | | � | d <| S( ua
Install the windows feature. To install a single feature, use the ``name``
parameter. To install multiple features, use the ``features`` parameter.
.. note::
Some features require reboot after un/installation. If so, until the
server is restarted other features can not be installed!
Args:
name (str):
Short name of the feature (the right column in
win_servermanager.list_available). This can be a single feature or a
string of features in a comma delimited list (no spaces)
.. note::
A list is not allowed in the name parameter of any state. Use
the ``features`` parameter if you want to pass the features as a
list
features (Optional[list]):
A list of features to install. If this is passed it will be used
instead of the ``name`` parameter.
.. versionadded:: 2018.3.0
recurse (Optional[bool]):
Install all sub-features as well. If the feature is installed but
one of its sub-features are not installed set this will install
additional sub-features
source (Optional[str]):
Path to the source files if missing from the target system. None
means that the system will use windows update services to find the
required files. Default is None
restart (Optional[bool]):
Restarts the computer when installation is complete, if required by
the role/feature installed. Default is False
exclude (Optional[str]):
The name of the feature to exclude when installing the named
feature. This can be a single feature, a string of features in a
comma-delimited list (no spaces), or a list of features.
.. warning::
As there is no exclude option for the ``Add-WindowsFeature``
or ``Install-WindowsFeature`` PowerShell commands the features
named in ``exclude`` will be installed with other sub-features
and will then be removed. **If the feature named in ``exclude``
is not a sub-feature of one of the installed items it will still
be removed.**
Example:
Do not use the role or feature names mentioned in the PKGMGR
documentation. To get a list of available roles and features run the
following command:
.. code-block:: bash
salt <minion_name> win_servermanager.list_available
Use the name in the right column of the results.
.. code-block:: yaml
# Installs the IIS Web Server Role (Web-Server)
IIS-WebServerRole:
win_servermanager.installed:
- recurse: True
- name: Web-Server
# Install multiple features, exclude the Web-Service
install_multiple_features:
win_servermanager.installed:
- recurse: True
- features:
- RemoteAccess
- XPS-Viewer
- SNMP-Service
- exclude:
- Web-Server
u forceu Neonu� Parameter 'force' has been detected in the argument list. Thisparameter is no longer used and has been replaced by 'recurse'as of Salt 2018.3.0. This warning will be removed in Salt Neon.u nameu resultu changesu u commentu ,u win_servermanager.list_installedu Will be installed recurse={0}u0 Already installed but might install sub-featuresi u- The following features are already installed:u
- u testu win_servermanager.installt recurset restartt sourcet excludeu Successu Featuresu - {0}u (exclude)u Messageu Failed to install the following:u Installed the following:u Removed the following (exclude):u
N( t saltt utilst versionst
warn_untilt popt Truet Nonet splitt
isinstancet listR t formatt appendt insertt joint __opts__t gett datat
compare_dicts( t namet featuresR R R R t kwargst rett oldt cur_featt featuret statust fail_featt new_featt rem_featt new( ( sA /usr/lib/python2.7/site-packages/salt/states/win_servermanager.pyt installed sj [
c C@ s i | d 6t d 6i d 6d d 6} | d k r@ | j d � } n t | t � sa | j d � } n t d � } g } x8 | D]0 } | | k r� d | d | <q{ | j | � q{ W| r� | j d d
� d j | � | d <n | d s� | St d rd | d <| St d
| d | d | �} | d | d <g } g } x[ | d D]O } | d | j
d t � s{| j d j | � � qB| j d j | � � qBW| r�| j d d � n | r�| j d d � n d j | | � | d <t d � }
t j
j j | |
� | d <| S( ua
Remove the windows feature To remove a single feature, use the ``name``
parameter. To remove multiple features, use the ``features`` parameter.
Args:
name (str):
Short name of the feature (the right column in
win_servermanager.list_available). This can be a single feature or a
string of features in a comma-delimited list (no spaces)
.. note::
A list is not allowed in the name parameter of any state. Use
the ``features`` parameter if you want to pass the features as a
list
features (Optional[list]):
A list of features to remove. If this is passed it will be used
instead of the ``name`` parameter.
.. versionadded:: 2018.3.0
remove_payload (Optional[bool]):
True will cause the feature to be removed from the side-by-side
store. To install the feature in the future you will need to
specify the ``source``
restart (Optional[bool]):
Restarts the computer when uninstall is complete if required by the
role/feature uninstall. Default is False
.. note::
Some features require a reboot after uninstall. If so the feature will
not be completely uninstalled until the server is restarted.
Example:
Do not use the role or feature names mentioned in the PKGMGR
documentation. To get a list of available roles and features run the
following command:
.. code-block:: bash
salt <minion_name> win_servermanager.list_available
Use the name in the right column of the results.
.. code-block:: yaml
# Uninstall the IIS Web Server Rol (Web-Server)
IIS-WebserverRole:
win_servermanager.removed:
- name: Web-Server
# Uninstall multiple features, reboot if required
uninstall_multiple_features:
win_servermanager.removed:
- features:
- RemoteAccess
- XPX-Viewer
- SNMP-Service
- restart: True
u nameu resultu changesu u commentu ,u win_servermanager.list_installedu Will be removedi u) The following features are not installed:u
- u testu win_servermanager.removet remove_payloadR u Successu Featuresu - {0}u Failed to remove the following:u Removed the following:u
N( R R R R R R R R R R R R R
R R R ( R R R) R R R R&