ntc_show_command

Synopsis

This module offers structured data for CLI enabled devices by using the TextFSM library for templating and netmiko for SSH connectivity

Options

parameter required default choices comments
command yes
    Command to execute on target device
    connection no ssh
    • ssh
    • offline
    connect to device using netmiko or read from offline file for testing
    delay no 1
      Wait for command output from target device
      file no
        If using connection=offline, this is the file (with path) of a file that contains raw text output, i.e. 'show command' and then the contents of the file will be rendered with the the TextFSM template
        host no
          IP Address or hostname (resolvable by Ansible control host)
          index_file no index
            name of index file. file location must be relative to the template_dir
            password no
              Password used to login to the target device
              platform yes ssh
                Platform FROM the index file
                port no 22
                  SSH port to use to connect to the target device
                  secret no
                    Password used to enter a privileged mode on the target device
                    template_dir no ntc_templates
                      path where TextFSM templates are stored. Default path is ntc with ntc in the same working dir as the playbook being run
                      username no
                        Username used to login to the target device

                        Important

                        Requires netmiko

                        Important

                        Requires textfsm

                        Important

                        Requires terminal

                        Examples


                        # get vlan data
                        - ntc_show_command:
                            connection=ssh
                            platform=cisco_nxos
                            command='show vlan'
                            host={{ inventory_hostname }}
                            username={{ username }}
                            password={{ password }}
                        
                        # get snmp community
                        - ntc_show_command:
                            connection=ssh
                            platform=cisco_nxos
                            command='show snmp community'
                            host={{ inventory_hostname }}
                            username={{ username }}
                            password={{ password }}
                            secret:{{ secret }}