Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jorgenspange opened this issue Nov 28, 2023 · 3 comments
Open

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

jorgenspange opened this issue Nov 28, 2023 · 3 comments
Assignees
Labels
needs_info This issue requires further information. Please answer any outstanding questions.

Comments

@jorgenspange
Copy link

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".

@KB-perByte
Copy link
Collaborator

@NilashishC CC

@NilashishC NilashishC self-assigned this Nov 29, 2023
@jorgenspange
Copy link
Author

    - 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.

@NilashishC
Copy link
Collaborator

@jorgenspange Seems like the problem here is two-folded. The fact that this did not work even with nxos_install_os tells me that something else might be broken. If the terminal prompt not being answered was the only issue, executing terminal dont-ask before the install all kickstart .. command should have fixed it, which is something that the nxos_install_os module does internally.

We've had image upgrade issues in the past with N7Ks and the fixes varied on a case by case basis. For this particular issue, we can start off with adding terminal dont-ask before the image upgrade command in the first playbook you shared, just to confirm if it's actually a prompt issue. If the issue continues to persist even after that, then please update this thread, and I'll share the next steps.

Thank you!

@NilashishC NilashishC added the needs_info This issue requires further information. Please answer any outstanding questions. label Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs_info This issue requires further information. Please answer any outstanding questions.
Projects
None yet
Development

No branches or pull requests

3 participants