The Ansible Datacom DmOS collection includes a variety of Ansible content to help automate the management of Datacom DmOS equipment.
- dmos_commands
- dmos_l2_interface
- dmos_l3 interface
- dmos_linkagg
- dmos_lldp
- dmos_log
- dmos_sntp
- dmos_twamp
- dmos_vlan
sudo pip3 install ansible
sudo pip3 install paramiko
ansible-galaxy collection install datacom.dmos
git clone https://github.com/datacom-teracom/ansible_collections.dmos.git
cd ansible_collections.dmos
ansible-galaxy collection build
ansible-galaxy collection install datacom-dmos-*.tar.gz
ansible-doc datacom.dmos.dmos_vlan
Basic example need two files:
- hosts
- vlan.yml
Change xxx.xxx.xxx.xxx to Datacom DmOS switch ip.
hosts
[all:vars]
ansible_connection=ansible.netcommon.network_cli
[dmos]
DM4170 ansible_host=xxx.xxx.xxx.xxx
[dmos:vars]
ansible_user=admin
ansible_ssh_pass=admin
ansible_network_os=datacom.dmos.dmos
vlan.yml
---
- hosts: dmos
gather_facts: no
collections:
- datacom.dmos
tasks:
- name: Configure vlan_ids
dmos_vlan:
config:
- vlan_id: 2019
interface:
- name: gigabit-ethernet-1/1/1
tagged: true
name: null
- vlan_id: 2020
name: dmos_vlan
interface:
- name: gigabit-ethernet-1/1/2
tagged: false
- vlan_id: 2021
- name: Remove vlan_ids
dmos_vlan:
config: []
state: deleted
ansible-playbook -i hosts vlan.yml