community_fabric.ansible.table_info lookup – Queries and returns IP Fabric information.

Note

This lookup plugin is part of the community_fabric.ansible collection (version 0.0.8).

To install it, use: ansible-galaxy collection install community_fabric.ansible. You need further requirements to be able to use this lookup plugin, see Requirements for details.

To use it in a playbook, specify: community_fabric.ansible.table_info.

Synopsis

  • Queries IP Fabric via its API and returns information.

Requirements

The below requirements are needed on the local controller node that executes this lookup.

  • ipfabric

Terms

Parameter

Comments

Terms

string / required

The IP Fabric technology and table to query.

Keyword parameters

This describes keyword parameters of the lookup. These are the values key1=value1, key2=value2 and so on in the following examples: lookup('community_fabric.ansible.table_info', key1=value1, key2=value2, ...) and query('community_fabric.ansible.table_info', key1=value1, key2=value2, ...)

Parameter

Comments

auth

string

IP Fabric API token to be able to gather device information.

Configuration:

base_url

string

Url of the IP Fabric API

Configuration:

columns

list / elements=string

Return specific columns from IP Fabric API.

filter

dictionary

Filter applied to the API call to IP Fabric.

ipf_version

string

The version of the IP Fabric REST API.

report

string

Return report information when filtering by report.

sort

dictionary

Sort IP Fabric API response.

verify

boolean

Allows connection when SSL certificates are not valid. Set to false when certificated are not trusted.

Choices:

  • false

  • true

Notes

Note

  • When keyword and positional parameters are used together, positional parameters must be listed before keyword parameters: lookup('community_fabric.ansible.table_info', term1, term2, key1=value1, key2=value2) and query('community_fabric.ansible.table_info', term1, term2, key1=value1, key2=value2)

Examples

- name: Get devices using lookup inventory plugin (IPF_URL and IPF_TOKEN environment variables set)
  ansible.builtin.debug:
    msg: "{{ lookup('community_fabric.ansible.table_info', 'inventory', 'devices') }}"

- name: Get devices using lookup inventory plugin
  ansible.builtin.debug:
    msg: "{{ lookup('community_fabric.ansible.table_info', 'inventory', 'devices', base_url='https://<url_here>/', auth='<token_here>') }}"

- name: Get sites and sort by name.
  ansible.builtin.debug:
    msg: "{{ lookup('community_fabric.ansible.table_info', 'inventory', 'sites', sort={'order': 'asc', 'column': 'siteName'}) }}"

- name: Get interfaces filtered by device (if technology is not specified the default is inventory)
  ansible.builtin.debug:
    msg: "{{ lookup('community_fabric.ansible.table_info', 'interfaces', filter={'hostname': ['eq', 'L38AC20']}, sort={'order': 'asc', 'column':'intName'})}}"

- name: Get interface that match intent verification rule
  ansible.builtin.debug:
    msg: "{{ lookup('community_fabric.ansible.table_info', 'inventory', 'interfaces', filter={'duplex':['color','eq','20']}, report='/inventory/interfaces')}}"

Return Value

Key

Description

Return value

list / elements=string

list of composed dictionaries with key and value

Returned: success

Authors

  • Alex Gittings (@minitriga)

Hint

Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.