�
�Udac @ s� i d d 6d g d 6d d 6Z d Z d Z d Z d d
l Z d d
l Z d d
l Z d d l m Z m Z m
Z
d d l m Z m Z d d
l
m Z d � Z d d � Z d � Z d � Z d � Z e d k r� e � n d
S( s 1.1t metadata_versiont previewt statust networkt supported_bys
---
module: nxos_smu
extends_documentation_fragment: nxos
version_added: "2.2"
short_description: Perform SMUs on Cisco NX-OS devices.
description:
- Perform software maintenance upgrades (SMUs) on Cisco NX-OS devices.
author: Gabriele Gerbino (@GGabriele)
notes:
- Tested against NXOSv 7.3.(0)D1(1) on VIRL
- The module can only activate and commit a package,
not remove or deactivate it.
- Use C(transport=nxapi) to avoid connection timeout
options:
pkg:
description:
- Name of the remote package.
required: true
file_system:
description:
- The remote file system of the device. If omitted,
devices that support a file_system parameter will use
their default values.
sR
- nxos_smu:
pkg: "nxos.CSCuz65185-n9k_EOR-1.0.0-7.0.3.I2.2d.lib32_n9000.rpm"
s�
commands:
description: commands sent to the device
returned: always
type: list
sample: ["install add bootflash:nxos.CSCuz65185-n9k_EOR-1.0.0-7.0.3.I2.2d.lib32_n9000.rpm",
"install activate bootflash:nxos.CSCuz65185-n9k_EOR-1.0.0-7.0.3.I2.2d.lib32_n9000.rpm force",
"install commit bootflash:nxos.CSCuz65185-n9k_EOR-1.0.0-7.0.3.I2.2d.lib32_n9000.rpm"]
i����N( t
get_configt load_configt run_commands( t nxos_argument_spect
check_args( t
AnsibleModulec C s$ i | d 6d d 6g } t | | � S( Nt commandt textt output( R ( R t modulet cmds( ( sI /usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_smu.pyt execute_show_commandK s
s
bootflash:c C s9 d j | | � } t | | � } d | d k r5 t St S( Ns dir {0}/{1}s No such filei ( t formatR t Falset True( R t dstt file_systemR t body( ( sI /usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_smu.pyt remote_file_existsT s
c C s2 x+ | D]# } t | | g � t j d � q Wd S( Ni ( R t timet sleep( R t commandsR ( ( sI /usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_smu.pyt apply_patch\ s
c
C s g } | j d � } d j | d d !� } d } t | | � } d } t | | � } | | d k r� | | d k r� | j d j | | � � n | | d k r� | j d j | | � � n d } t | | � } | | d k r� | j d j | | � � n | S(
Nt .i i����s show install inactives show install actives install add {0}{1}s install activate {0}{1} forces show install committeds install commit {0}{1}( t splitt joinR t appendR (
R t pkgR R t splitted_pkgt fixed_pkgR t
inactive_bodyt active_bodyt install_body( ( sI /usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_smu.pyt get_commandsb s"