ansible-collections/cisco.nxos

cisco.nxos.nxos_config - prompt/answer not working properly

jorgenspange opened this issue · 3 comments

SUMMARY

My prompt/answer in cisco.nxos.nxos_command does not do anything

ISSUE TYPE
  • Bug Report
COMPONENT NAME

cisco.nxos.nxos_command

ANSIBLE VERSION
ansible [core 2.16.0]
  config file = /Users/jorgenspange/Documents/git/ansible-network-automation/ansible.cfg
  configured module search path = ['/Users/jorgenspange/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/homebrew/Cellar/ansible/9.0.1/libexec/lib/python3.12/site-packages/ansible
  ansible collection location = /Users/jorgenspange/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/homebrew/bin/ansible
  python version = 3.12.0 (main, Oct  2 2023, 12:03:24) [Clang 15.0.0 (clang-1500.0.40.1)] (/opt/homebrew/Cellar/ansible/9.0.1/libexec/bin/python)
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
[jorgenspange@Jorgens-MBP git/ansible-network-automation (main) ]$ ansible-galaxy collection list cisco.nxos

# /Users/jorgenspange/.ansible/collections/ansible_collections
Collection Version
---------- -------
cisco.nxos 5.2.1

# /opt/homebrew/Cellar/ansible/9.0.1/libexec/lib/python3.12/site-packages/ansible_collections
Collection Version
---------- -------
cisco.nxos 5.2.1

CONFIGURATION
[jorgenspange@Jorgens-MBP git/ansible-network-automation (main) ]$ ansible-config dump --only-changed
ANSIBLE_COW_PATH(/Users/jorgenspange/Documents/git/ansible-network-automation/ansible.cfg) = /opt/homebrew/bin/cowsay
ANSIBLE_COW_SELECTION(/Users/jorgenspange/Documents/git/ansible-network-automation/ansible.cfg) = small
ANSIBLE_NOCOWS(/Users/jorgenspange/Documents/git/ansible-network-automation/ansible.cfg) = False
ANSIBLE_PIPELINING(/Users/jorgenspange/Documents/git/ansible-network-automation/ansible.cfg) = True
CONFIG_FILE() = /Users/jorgenspange/Documents/git/ansible-network-automation/ansible.cfg
DEFAULT_FORKS(/Users/jorgenspange/Documents/git/ansible-network-automation/ansible.cfg) = 10
DEFAULT_GATHERING(/Users/jorgenspange/Documents/git/ansible-network-automation/ansible.cfg) = smart
DEFAULT_HOST_LIST(/Users/jorgenspange/Documents/git/ansible-network-automation/ansible.cfg) = ['/Users/jorgenspange/Documents/git/ansible-network-automation/inventory/S-TEST']
DEFAULT_ROLES_PATH(/Users/jorgenspange/Documents/git/ansible-network-automation/ansible.cfg) = ['/Users/jorgenspange/Documents/git/ansible-network-automation/roles']
DEFAULT_STDOUT_CALLBACK(/Users/jorgenspange/Documents/git/ansible-network-automation/ansible.cfg) = yaml
DEFAULT_TIMEOUT(/Users/jorgenspange/Documents/git/ansible-network-automation/ansible.cfg) = 120
DEFAULT_VAULT_PASSWORD_FILE(/Users/jorgenspange/Documents/git/ansible-network-automation/ansible.cfg) = /Users/jorgenspange/Documents/git/ansible-network-automation/.secret/vault_pass.txt
DISPLAY_SKIPPED_HOSTS(/Users/jorgenspange/Documents/git/ansible-network-automation/ansible.cfg) = False
HOST_KEY_CHECKING(/Users/jorgenspange/Documents/git/ansible-network-automation/ansible.cfg) = False
OS / ENVIRONMENT

Macbook PRO M1 Pro 2021
Sonoma 14.1.1

STEPS TO REPRODUCE

When upgrading Cisco Nexus 7k this does not work

    - name: cisco.nxos.nxos_install | Disruptively install compliant OS and Kickstart image.
      when: software_kickstart is defined
      cisco.nxos.nxos_command:
        commands:
          - command: install all kickstart bootflash:///{{ software_kickstart }} system bootflash:///{{ software_image }}
            prompt: Do you want to continue with the installation (y/n)?  [n]
            answer: y
      vars:
        ansible_command_timeout: 3600
      register: software_installed

  rescue:

    - name: cisco.nxos.nxos_install | Reset the connection.
      ansible.builtin.meta: reset_connection

  always:

    - name: cisco.nxos.nxos_install | Wait for device to reboot.
      ansible.builtin.wait_for_connection:
        delay: 90
        timeout: 600

When running that it stops here:

N7K# show install all status
There is an on-going installation...
Enter Ctrl-C to go back to the prompt.


<Tue Nov 28 14:41:19>
 Verifying image bootflash:/n7000-s2-kickstart.8.4.6a.bin for boot variable "kickstart".
 -- SUCCESS

<Tue Nov 28 14:41:26>
 Verifying image bootflash:/n7000-s2-dk9.8.4.6a.bin for boot variable "system".
 -- SUCCESS

<Tue Nov 28 14:42:41>
 Performing module support checks.
 -- SUCCESS

<Tue Nov 28 14:44:01>
 Verifying image type.
 -- SUCCESS

<Tue Nov 28 14:45:54>
 Extracting "system" version from image bootflash:/n7000-s2-dk9.8.4.6a.bin.
 -- SUCCESS

<Tue Nov 28 14:45:55>
 Extracting "kickstart" version from image bootflash:/n7000-s2-kickstart.8.4.6a.bin.
 -- SUCCESS

<Tue Nov 28 14:45:56>
 Extracting "bios" version from image bootflash:/n7000-s2-dk9.8.4.6a.bin.
 -- SUCCESS

<Tue Nov 28 14:46:14>
 Extracting "lc1n7k" version from image bootflash:/n7000-s2-dk9.8.4.6a.bin.
 -- SUCCESS

<Tue Nov 28 14:49:42>
 Notifying services about system upgrade.
 -- SUCCESS



Compatibility check is done:
Module  bootable          Impact  Install-type  Reason
------  --------  --------------  ------------  ------
     1       yes      disruptive         reset  Reset due to single supervisor
     3       yes      disruptive         reset  Reset due to single supervisor



Images will be upgraded according to following table:
Module       Image                  Running-Version(pri:alt)           New-Version  Upg-Required
------  ----------  ----------------------------------------  --------------------  ------------
     1      system                                   6.2(14)               8.4(6a)           yes
     1   kickstart                                   6.2(14)               8.4(6a)           yes
     1        bios   v2.19.0(04/23/2021):v2.19.0(04/23/2021)   v2.19.0(04/23/2021)            no
     3      lc1n7k                                   6.2(14)               8.4(6a)           yes
     3        bios       v2.0.32(12/16/13):v2.0.32(12/16/13)     v2.0.33(04/06/20)           yes


Switch will be reloaded for disruptive upgrade.
EXPECTED RESULTS

but when i do it manually it goes further like this:

N7K# show install all status
There is an on-going installation...
Enter Ctrl-C to go back to the prompt.


<Tue Nov 28 14:41:19>
 Verifying image bootflash:/n7000-s2-kickstart.8.4.6a.bin for boot variable "kickstart".
 -- SUCCESS

<Tue Nov 28 14:41:26>
 Verifying image bootflash:/n7000-s2-dk9.8.4.6a.bin for boot variable "system".
 -- SUCCESS

<Tue Nov 28 14:42:41>
 Performing module support checks.
 -- SUCCESS

<Tue Nov 28 14:44:01>
 Verifying image type.
 -- SUCCESS

<Tue Nov 28 14:45:54>
 Extracting "system" version from image bootflash:/n7000-s2-dk9.8.4.6a.bin.
 -- SUCCESS

<Tue Nov 28 14:45:55>
 Extracting "kickstart" version from image bootflash:/n7000-s2-kickstart.8.4.6a.bin.
 -- SUCCESS

<Tue Nov 28 14:45:56>
 Extracting "bios" version from image bootflash:/n7000-s2-dk9.8.4.6a.bin.
 -- SUCCESS

<Tue Nov 28 14:46:14>
 Extracting "lc1n7k" version from image bootflash:/n7000-s2-dk9.8.4.6a.bin.
 -- SUCCESS

<Tue Nov 28 14:49:42>
 Notifying services about system upgrade.
 -- SUCCESS



Compatibility check is done:
Module  bootable          Impact  Install-type  Reason
------  --------  --------------  ------------  ------
     1       yes      disruptive         reset  Reset due to single supervisor
     3       yes      disruptive         reset  Reset due to single supervisor



Images will be upgraded according to following table:
Module       Image                  Running-Version(pri:alt)           New-Version  Upg-Required
------  ----------  ----------------------------------------  --------------------  ------------
     1      system                                   6.2(14)               8.4(6a)           yes
     1   kickstart                                   6.2(14)               8.4(6a)           yes
     1        bios   v2.19.0(04/23/2021):v2.19.0(04/23/2021)   v2.19.0(04/23/2021)            no
     3      lc1n7k                                   6.2(14)               8.4(6a)           yes
     3        bios       v2.0.32(12/16/13):v2.0.32(12/16/13)     v2.0.33(04/06/20)           yes


Switch will be reloaded for disruptive upgrade.

Install is in progress, please wait.

<Tue Nov 28 14:50:05>
 Performing runtime checks.
 -- SUCCESS

<Tue Nov 28 14:50:46>
 Setting boot variables.
 -- SUCCESS

<Tue Nov 28 14:51:24>
 Performing configuration copy.
 -- SUCCESS

Module 1: <Tue Nov 28 14:51:37>
  Upgrading bios/loader/bootrom.
Warning: please do not remove or power off the module at this time.
 -- SUCCESS

Module 3: <Tue Nov 28 14:51:38>
  Upgrading bios/loader/bootrom.
Warning: please do not remove or power off the module at this time.
 -- SUCCESS

Finishing the upgrade, switch will reboot in 10 seconds.

This is what the prompt looks like when running the installation

Compatibility check is done:
Module  bootable          Impact  Install-type  Reason
------  --------  --------------  ------------  ------
     1       yes      disruptive         reset  Reset due to single supervisor
     3       yes      disruptive         reset  Reset due to single supervisor



Images will be upgraded according to following table:
Module       Image                  Running-Version(pri:alt)           New-Version  Upg-Required
------  ----------  ----------------------------------------  --------------------  ------------
     1      system                                   6.2(14)               8.4(6a)           yes
     1   kickstart                                   6.2(14)               8.4(6a)           yes
     1        bios   v2.19.0(04/23/2021):v2.19.0(04/23/2021)   v2.19.0(04/23/2021)            no
     3      lc1n7k                                   6.2(14)               8.4(6a)           yes
     3        bios       v2.0.32(12/16/13):v2.0.32(12/16/13)     v2.0.33(04/06/20)           yes


Switch will be reloaded for disruptive upgrade.
Do you want to continue with the installation (y/n)?  [n] y

Install is in progress, please wait.

Performing runtime checks.
[####################] 100% -- SUCCESS

Setting boot variables.
[####################] 100% -- SUCCESS

Performing configuration copy.
[####################] 100% -- SUCCESS

Module 1:  Upgrading bios/loader/bootrom.
Warning: please do not remove or power off the module at this time.
[####################] 100% -- SUCCESS

Module 3:  Upgrading bios/loader/bootrom.
Warning: please do not remove or power off the module at this time.
[####################] 100% -- SUCCESS

Finishing the upgrade, switch will reboot in 10 seconds.
ACTUAL RESULTS

Just hangs on the "switch will be reloaded for disruptive upgrade".

    - name: cisco.nxos.nxos_install | Test
      when: software_kickstart is defined
      cisco.nxos.nxos_install_os:
        kickstart_image_file: "{{ software_kickstart }}"
        system_image_file: "{{ software_image }}"
        issu: false
      register: software_installed
      vars:
        ansible_command_timeout: 600
        ansible_connect_timeout: 600

Tried doing it with the cisco.nxos.nxos_install_os aswell, but did not seem to start the installation either.