ansible-collections / dellemc.os10

GNU General Public License v3.0
40 stars 49 forks source link

[question] Is there any collection role to configure the PTP transport method for an interface? #122

Closed leo8a closed 12 months ago

leo8a commented 2 years ago

I was checking on the list of Network Collection Roles for Dell EMC SmartFabric OS10 for a role to configure the PTP transport method in an interface, but couldn't find much.

Is this feature ^^ available in this collection? If not, is there any ETA to get it included? Thanks!

prasadapr commented 12 months ago

Hi @leo8a, collection role is not supporting for PTP module. As of now no idea for ETA. But without collection roles, same thing can be achieved by CLI commands using OS10_Config module.

Pls find the enclosed working playbook using OS10_Config module and execution log for the same:

root@ubuntu22-vm-38-27:~/OS10-Collections# cat  Issue-122.yaml 
---
- name: configurep ptp configuration
  hosts: leaf1
  gather_facts: false
  connection: network_cli
  collections:
   - dellemc.os10

  tasks:
    - name: "configure PTP config"
      os10_config:
        commands:
          - interface ethernet 1/1/13
          - ptp enable
          - ptp transport layer2
          - sync-e enable
          - sync-e esmc tx-only
root@ubuntu22-vm-38-27:~/OS10-Collections# 

root@ubuntu22-vm-38-27:~/OS10-Collections# 
root@ubuntu22-vm-38-27:~/OS10-Collections# ansible-playbook -i inventory.yaml Issue-122.yaml -vvv
ansible-playbook [core 2.14.0]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.10/dist-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0] (/usr/bin/python3)
  jinja version = 3.0.3
  libyaml = True
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /root/OS10-Collections/inventory.yaml as it did not pass its verify_file() method
script declined parsing /root/OS10-Collections/inventory.yaml as it did not pass its verify_file() method
Parsed /root/OS10-Collections/inventory.yaml inventory source with ini plugin
redirecting (type: action) dellemc.os10.os10_config to dellemc.os10.os10
redirecting (type: callback) ansible.builtin.profile_tasks to ansible.posix.profile_tasks
[WARNING]: Skipping callback plugin 'profile_tasks', unable to load
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.

PLAYBOOK: Issue-122.yaml *******************************************************************************************************************************************************************
1 plays in Issue-122.yaml

PLAY [configurep ptp configuration] ********************************************************************************************************************************************************
redirecting (type: action) dellemc.os10.os10_config to dellemc.os10.os10

TASK [configure PTP config] ****************************************************************************************************************************************************************
task path: /root/OS10-Collections/Issue-122.yaml:10
redirecting (type: connection) ansible.builtin.network_cli to ansible.netcommon.network_cli
redirecting (type: action) dellemc.os10.os10_config to dellemc.os10.os10
redirecting (type: action) dellemc.os10.os10_config to dellemc.os10.os10
<100.104.94.221> ESTABLISH LOCAL CONNECTION FOR USER: root
<100.104.94.221> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-local-18905755qof7fp_ `"&& mkdir "` echo /root/.ansible/tmp/ansible-local-18905755qof7fp_/ansible-tmp-1700499413.5072846-1890579-45808984623598 `" && echo ansible-tmp-1700499413.5072846-1890579-45808984623598="` echo /root/.ansible/tmp/ansible-local-18905755qof7fp_/ansible-tmp-1700499413.5072846-1890579-45808984623598 `" ) && sleep 0'
Using module file /root/.ansible/collections/ansible_collections/dellemc/os10/plugins/modules/os10_config.py
<100.104.94.221> PUT /root/.ansible/tmp/ansible-local-18905755qof7fp_/tmpbmkuku2w TO /root/.ansible/tmp/ansible-local-18905755qof7fp_/ansible-tmp-1700499413.5072846-1890579-45808984623598/AnsiballZ_os10_config.py
<100.104.94.221> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-18905755qof7fp_/ansible-tmp-1700499413.5072846-1890579-45808984623598/ /root/.ansible/tmp/ansible-local-18905755qof7fp_/ansible-tmp-1700499413.5072846-1890579-45808984623598/AnsiballZ_os10_config.py && sleep 0'
<100.104.94.221> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-local-18905755qof7fp_/ansible-tmp-1700499413.5072846-1890579-45808984623598/AnsiballZ_os10_config.py && sleep 0'
<100.104.94.221> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-18905755qof7fp_/ansible-tmp-1700499413.5072846-1890579-45808984623598/ > /dev/null 2>&1 && sleep 0'
changed: [leaf1] => {
    "changed": true,
    "commands": [
        "interface ethernet 1/1/13",
        "ptp enable",
        "ptp transport layer2",
        "sync-e enable",
        "sync-e esmc tx-only",
        "commit"
    ],
    "invocation": {
        "module_args": {
            "after": null,
            "backup": false,
            "backup_options": null,
            "before": null,
            "commands": [
                "interface ethernet 1/1/13",
                "ptp enable",
                "ptp transport layer2",
                "sync-e enable",
                "sync-e esmc tx-only"
            ],
            "config": null,
            "lines": [
                "interface ethernet 1/1/13",
                "ptp enable",
                "ptp transport layer2",
                "sync-e enable",
                "sync-e esmc tx-only"
            ],
            "match": "line",
            "parents": null,
            "provider": null,
            "replace": "line",
            "save": false,
            "src": null,
            "update": "merge"
        }
    },
    "saved": false,
    "updates": [
        "interface ethernet 1/1/13",
        "ptp enable",
        "ptp transport layer2",
        "sync-e enable",
        "sync-e esmc tx-only",
        "commit"
    ]
}

PLAY RECAP *********************************************************************************************************************************************************************************
leaf1                      : ok=1    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

root@ubuntu22-vm-38-27:~/OS10-Collections# 

Device side configuration:

OS10(conf-if-eth1/1/13)# show configuration 
!
interface ethernet1/1/13
 no shutdown
 switchport access vlan 1
 flowcontrol receive off
 sync-e enable
 sync-e esmc tx-only
 ptp enable
 ptp transport layer2
OS10(conf-if-eth1/1/13)# 
leo8a commented 12 months ago

k, thanks for sharing @prasadapr!

prasadapr commented 12 months ago

Hi @leo8a, shall we close this issue.