napalm_get_facts
Gathers facts from a network device via the Python module napalm
Parameters
Parameter |
Required |
Default |
Choices |
Description |
args |
False |
N/A |
N/A |
dictionary of kwargs arguments to pass to the filter. The outer key is the name of the getter (same as the filter) |
dev_os |
False |
N/A |
N/A |
OS of the device |
filter |
False |
N/A |
N/A |
A list of facts to retreive from a device and provided though C(ansible_facts) The list of facts available are maintained at: http://napalm.readthedocs.io/en/latest/support/ Note- not all getters are implemented on all supported device types |
hostname |
False |
N/A |
N/A |
IP or FQDN of the device you want to connect to |
ignore_notimplemented |
False |
N/A |
N/A |
Ignores NotImplementedError for filters which aren't supported by the driver. Returns invalid filters in a list called: not_implemented |
optional_args |
False |
N/A |
N/A |
Dictionary of additional arguments passed to underlying driver |
password |
False |
N/A |
N/A |
Password |
provider |
False |
N/A |
N/A |
Dictionary which acts as a collection of arguments used to define the characteristics of how to connect to the device. Note - hostname, username, password and dev_os must be defined in either provider or local param Note - local param takes precedence, e.g. hostname is preferred to provider['hostname'] |
timeout |
False |
N/A |
N/A |
Time in seconds to wait for the device to respond |
username |
False |
N/A |
N/A |
Username |
Examples
- name: get facts from device
napalm_get_facts:
hostname: '{{ inventory_hostname }}'
username: '{{ user }}'
dev_os: '{{ os }}'
password: '{{ passwd }}'
filter: ['facts']
register: result
- name: print data
debug:
var: result
- name: Getters
napalm_get_facts:
provider: "{{ ios_provider }}"
filter:
- "lldp_neighbors_detail"
- "interfaces"
- name: get facts from device
napalm_get_facts:
hostname: "{{ host }}"
username: "{{ user }}"
dev_os: "{{ os }}"
password: "{{ password }}"
optional_args:
port: "{{ port }}"
filter: ['facts', 'route_to', 'interfaces']
args:
route_to:
protocol: static
destination: 8.8.8.8
Return
Name |
Description |
Returned |
Type |
Sample |
changed |
whether the command has been executed on the device |
always |
bool |
True |
ansible_facts |
Facts gathered on the device provided via C(ansible_facts) |
certain keys are returned depending on filter |
dict |
|