W3cubDocs

/Ansible

nxos_install_os - Set boot options like boot image and kickstart image.

New in version 2.2.

Synopsis

Install an operating system by setting the boot options like boot image and kickstart image.

Options

parameter required default choices comments
kickstart_image_file
no
Name of the kickstart image file on flash.
system_image_file
yes
Name of the system (or combined) image file on flash.

Examples

- block:
    - name: Install OS
      nxos_install_os:
        system_image_file: nxos.7.0.3.I2.2d.bin
        host: "{{ inventory_hostname }}"
        username: "{{ un }}"
        password: "{{ pwd }}"
        transport: nxapi
    rescue:
      - name: Wait for device to perform checks
        wait_for:
          port: 22
          state: stopped
          timeout: 300
          delay: 60
          host: "{{ inventory_hostname }}"
      - name: Wait for device to come back up
        wait_for:
          port: 22
          state: started
          timeout: 300
          delay: 60
          host: "{{ inventory_hostname }}"
      - name: Check installed OS
        nxos_command:
          commands:
            - show version
          username: "{{ un }}"
          password: "{{ pwd }}"
          host: "{{ inventory_hostname }}"
          transport: nxapi
        register: output
      - assert:
          that:
            - output['stdout'][0]['kickstart_ver_str'] == '7.0(3)I4(1)'

Return Values

Common return values are documented here Common Return Values, the following are the fields unique to this module:

name description returned type sample
install_state always dictionary {'sys': 'n5000-uk9.7.2.1.N1.1.bin', 'status': 'This is the log of last installation.\nContinuing with installation process, please wait.\nThe login will be disabled until the installation is completed.\nPerforming supervisor state verification.\nSUCCESS\nSupervisor non-disruptive upgrade successful.\nInstall has been successful. ', 'kick': 'n5000-uk9-kickstart.7.2.1.N1.1.bin'}
contains:
name description returned type sample

Notes

Note

The module will fail due to timeout issues, but the install will go on anyway. Ansible’s block and rescue can be leveraged to handle this kind of failure and check actual module results. See EXAMPLE for more about this. The first task on the rescue block is needed to make sure the device has completed all checks and it started to reboot. The second task is needed to wait for the device to come back up. The last two tasks are used to verify the installation process was successful.

Note

Do not include full file paths, just the name of the file(s) stored on the top level flash directory.

Note

You must know if your platform supports taking a kickstart image as a parameter. If supplied but not supported, errors may occur.

Note

This module attempts to install the software immediately, which may trigger a reboot.

Note

In check mode, the module tells you if the current boot images are set to the desired images.

This is a Core Module

For more information on what this means please read Core Modules

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, developing_test_pr and Developing Modules.

© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/nxos_install_os_module.html