0

Relatively new to Ansible but I'm just wondering what the syntax looks like if I want to run a command on an ASA like show run | i opmanager and then print the output. I have put a pause in because after the output is printed I want it to wait before continuing.

I have an ASA I want to configure with the playbook to see if i can deploy new SNMPv3 credentials to whilst also removing an old set.

This task removes any existing ManageEngine config for SNMP
  tasks:
    - name: Show remainging opmanager config
    asa_command:
      commands: show run | i opmanager 
      register: ManageEngine
      pause:
        prompt: "Do you want to proceed? (yes/no)"
        register: confirm
tlo
  • 1,571
  • 1
  • 25
  • 38
  • 2
    First you would have to fix the above yaml because there are many erros in a few line. Please make sure your indentation is correct for each parameter and seperate each task in its own list item (i.e. `pause` and `asa_command` should be separate tasks for example. As is, it is quite difficult to make sure what you're trying to do exactly and the exact intent. Then, as a quick solution to see more output from a task, you can run ansible in verbose (e.g. `-vvv`) mode. But a better long term solution is to simply add a debug task to display your registered value (i.e. `ManageEngine`). – Zeitounator Feb 01 '22 at 15:55

1 Answers1

1

Regarding your question

I'm just wondering what the syntax looks like

you may have a look into the Ansible Collections documentation Run arbitrary commands on Cisco ASA devices, the documentation of debug_module to Print statements during execution and the pause_module to Pause playbook execution.

  # This task removes any existing ManageEngine config for SNMP

  tasks:

    - name: Show remaining opmanager config
      asa_command:
        commands: show run | i opmanager 
      register: ManageEngine

    - name: Show result
      debug:
        msg: "{{ ManageEngine }}"

    - name: Pause until confirmation
      pause:
        prompt: "Do you want to proceed? (yes/no)"
U880D
  • 8,601
  • 6
  • 24
  • 40