The detect
role enables users to identify configuration drifts between the current running configurations and the desired state provided in a local or remote inventory. This role ensures that network devices remain compliant with their intended configurations.
- Detect configuration drifts between running configurations and host variables.
- Support for local and remote data stores.
- Provide detailed reports of detected changes.
Variable Name | Default Value | Required | Type | Description | Example |
---|---|---|---|---|---|
ansible_network_os |
"" |
no | str | Network OS to be used during detection. | "cisco.ios.ios" |
resources |
[all] |
no | list | List of resources to check for configuration drift. | ['interfaces', 'vlans'] |
data_store |
"" |
yes | dict | Specifies the data store to be used (local or SCM). | See examples below. |
Below are examples demonstrating how to use the detect
role:
This example detects drifts by comparing the running configuration with data stored in a local directory:
---
- name: Detect configuration drifts from local data store
hosts: all
gather_facts: true
tasks:
- name: Invoke detect role
ansible.builtin.include_role:
name: network.base.detect
vars:
resources:
- 'interfaces'
- 'l2_interfaces'
- 'l3_interfaces'
data_store:
local: "~/data/network"
Example Output When the playbook is executed successfully, the role will output a report highlighting the detected configuration drifts.
This example detects drifts by comparing the running configuration with data stored in a local directory:
---
- name: Detect configuration drifts from SCM repository
hosts: rtr1
gather_facts: true
tasks:
- name: Invoke detect role
ansible.builtin.include_role:
name: network.base.detect
vars:
operation: detect
data_store:
scm:
origin:
url: "{{ gh_scm_url }}"
token: "{{ gh_token }}"
user:
name: "{{ gh_username }}"
email: "{{ gh_email }}"
Example Output When the playbook is executed successfully, the role will output a report highlighting the detected configuration drifts.
GNU General Public License v3.0 or later.
See LICENSE to see the full text.
- Ansible Network Content Team