�
�Udac @ s i d d 6d g d 6d d 6Z d Z d Z d Z d d
l Z d d l m Z d d l m Z m Z d d
l m
Z
m Z d d l m
Z
d d l m Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z e d k re � n d
S( s 1.1t metadata_versiont previewt statust networkt supported_bys`
---
module: nxos_rpm
extends_documentation_fragment: nxos
version_added: "2.7"
short_description: Install patch or feature rpms on Cisco NX-OS devices.
description:
- Install software maintenance upgrade (smu) RPMS and
3rd party RPMS on Cisco NX-OS devices.
author: Sai Chintalapudi (@saichint)
notes:
- Tested against NXOSv 7.0(3)I2(5), 7.0(3)I4(6), 7.0(3)I5(3),
7.0(3)I6(1), 7.0(3)I7(3)
- For patches, the minimum platform version needed is 7.0(3)I2(5)
- For feature rpms, the minimum platform version needed is 7.0(3)I6(1)
- The module manages the entire RPM lifecycle (Add, activate, commit, deactivate, remove)
- For reload patches, this module is NOT idempotent until the patch is
committed.
options:
pkg:
description:
- Name of the RPM 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.
default: bootflash
aggregate:
description:
- List of RPM/patch definitions.
state:
description:
- If the state is present, the rpm will be installed,
If the state is absent, it will be removed.
default: present
choices: ['present', 'absent']
sM
- nxos_rpm:
pkg: "nxos.sample-n9k_ALL-1.0.0-7.0.3.I7.3.lib32_n9000.rpm"
sg
commands:
description: commands sent to the device
returned: always
type: list
sample: ["install add bootflash:nxos.sample-n9k_ALL-1.0.0-7.0.3.I7.3.lib32_n9000.rpm forced",
"install activate nxos.sample-n9k_ALL-1.0.0-7.0.3.I7.3.lib32_n9000 forced",
"install commit nxos.sample-n9k_ALL-1.0.0-7.0.3.I7.3.lib32_n9000"]
i����N( t deepcopy( t load_configt run_commands( t nxos_argument_spect
check_args( t
AnsibleModule( t remove_default_specc C sh d } i | d 6d d 6g } xD | d k rc t | | � d } | rI | St j d � | d 7} q Wd S( Ni t commandt textt outputi
i i ( R t timet sleep( R t modulet iterationt cmdst body( ( sI /usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_rpm.pyt execute_show_commandZ s
c C s5 d j | | � } t | | � } d | k r1 t St S( Ns dir {0}:/{1}s No such file( t formatR t Falset True( R t dstt file_systemR R ( ( sI /usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_rpm.pyt remote_file_existsj s
c C s� d } x| | d k r� t | | g t � } | r} d | d j � k s\ d | d j � k rv t j d � | d 7} q� d Sq d Sq Wd S( Ni i
s( another install operation is in progresst failedi i ( R R t lowerR R ( R t cmdR t msg( ( sI /usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_rpm.pyt config_cmd_operationr s ,
c C s� d } x_ | d k rg t | | � } | r= | | k rM d Sn | | k rM d St j d � | d 7} q Wd j | � } | j d | � d S( Ni i
i i s Operation "{0}" FailedR ( R R R R t fail_json( R t show_cmdt cfg_cmdt pkgt pkg_not_presentR R t err( ( sI /usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_rpm.pyt validate_operation� s
c C s9 d j | | � } t | | � t | | | | t � | S( Ns install add {0}:{1}( R R R'