Drivenets DNOS Ansible Collection - Local Install Guide
This guide documents a reproducible local install in the workspace virtual environment, including the ansible.netcommon dependency, and how to verify that Ansible sees the DNOS collection and plugins. We will keep this file updated as we iterate.
Prerequisites
- Python 3.9+ on macOS (zsh)
- This workspace path:
/Users/abisheksureshkumar/Cursor Local/Ansible
- Create and activate a virtual environment
cd "/Users/abisheksureshkumar/Cursor Local/Ansible"
python3 -m venv .venv
source .venv/bin/activate
python -V
pip install --upgrade pip- Install Ansible Core in the venv (fresh install)
- Clean slate: remove any existing Ansible packages first
pip freeze | grep -i ansible | xargs pip uninstall -y || echo "No ansible packages to remove"
pip install --upgrade pip
pip install "ansible-core>=2.15,<2.16"
ansible --version- Prepare a local collections path
export ANSIBLE_COLLECTIONS_PATHS="$(pwd)/collections"
mkdir -p "$ANSIBLE_COLLECTIONS_PATHS"- Install ansible.netcommon into the local collections path
- Online:
ansible-galaxy collection install ansible.netcommon -p "$ANSIBLE_COLLECTIONS_PATHS"- Offline (when you have the tarball):
ansible-galaxy collection install /path/to/ansible-netcommon-<ver>.tar.gz -p "$ANSIBLE_COLLECTIONS_PATHS"- Build and install the Drivenets DNOS collection locally
# Build (optional if you already have the tarball in drivenets.dnos-main/)
ansible-galaxy collection build ./drivenets.dnos-main
# Install the built tarball
ansible-galaxy collection install ./drivenets.dnos-main/drivenets-dnos-1.0.0.tar.gz \
-p "$ANSIBLE_COLLECTIONS_PATHS" --force- Verify installation and discovery
# Confirm ansible and collection paths
ansible --version
ansible-galaxy collection list | grep -E "(drivenets.dnos|ansible.netcommon)"
# Verify modules and plugins are visible
ansible-doc -t module -l | grep -i "drivenets.dnos.dnos_config"
ansible-doc -t cliconf -l | grep -i dnos # should list: drivenets.dnos.dnos
ansible-doc -t netconf -l | grep -i dnos # should list: drivenets.dnos.dnos- Network OS name and basic usage
- Use this exact network OS string in inventories and playbooks:
drivenets.dnos.dnos - Minimal inventory example (network_cli):
[dnos_devices]
router1 ansible_host=192.0.2.10 \
ansible_user=dnroot ansible_password=dnroot \
ansible_connection=ansible.netcommon.network_cli \
ansible_network_os=drivenets.dnos.dnos- Minimal playbook example (CLI) – change hosts/credentials as needed:
---
- name: DNOS quick verification
hosts: dnos_devices
gather_facts: false
tasks:
- name: Show version (example)
drivenets.dnos.dnos_command:
commands:
- show system versionOffline notes
- For strictly offline installs, place all required tarballs in a known folder and replace the Galaxy URLs with local paths in step 4 and 5.
- Keep
ANSIBLE_COLLECTIONS_PATHSexported in the shell where you run Ansible commands, so the locally installed collections are discovered.
Troubleshooting
- If you see warnings about version support, they are usually non-fatal. You can adjust
ansible-core(e.g., 2.14.x or 2.16.x) if needed. - If a plugin is listed by
ansible-doc -lbutansible-doc <FQCN>does not render, the plugin still loads; this is typically a documentation block formatting issue and does not affect runtime.
✅ Collection Build: SUCCESS
✅ Collection Install: SUCCESS
✅ Plugin Discovery: SUCCESS (cliconf, netconf)
✅ Module Documentation: SUCCESS
✅ Compile Sanity Tests: SUCCESS (0 errors)
- Create inventory files for DNOS devices
- Set up connection variables (ansible_network_os: drivenets.dnos.dnos)
- Write playbooks using the available modules
- Test with actual DNOS devices or simulators
- Optional: Install
ansible.netcommontarball for fully offline setup