No project description provided
Project description
Net Command
Net Command 是一个类似 Ansible 的批量 SSH 操作工具,使用 netmiko 作为核心库。它支持通过 YAML 配置文件管理设备清单和批量配置文件,并支持多进程执行任务。
安装
使用 poetry 安装依赖:
poetry install
使用方法
查看设备清单
使用 --list 参数查看设备清单的字典输出:
netcmd -i inventory.yaml --list
执行 Playbook
指定设备清单和 Playbook 文件来执行任务:
netcmd -i inventory.yaml playbook.yaml
配置文件格式
设备清单 (inventory.yaml)
设备清单文件使用 YAML 格式,示例如下:
all:
vars:
port: 22
user: 'admin'
password: 'password@123456'
vendor: 'hp_comware'
box_as:
hosts:
192.168.56.2:
192.168.56.3:
192.168.56.4:
Playbook (playbook.yaml)
Playbook 文件使用 YAML 格式,示例如下:
- name: H3C NTP Configuration
hosts: box_as
num_processes: 2
vars:
host: "{{ host }}"
port: "{{ port }}"
username: "{{ user }}"
password: "{{ password }}"
tasks:
- name: Check NTP status on H3C devices
when: vendor == 'hp_comware'
commands:
- display ntp status
测试
使用 pytest 运行测试:
pytest
贡献
欢迎提交问题和贡献代码!
许可证
本项目使用 MIT 许可证。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
net_command-0.1.0.tar.gz
(3.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file net_command-0.1.0.tar.gz.
File metadata
- Download URL: net_command-0.1.0.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.8.18 Linux/6.8.0-1021-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59276b685884efa1a84c140677e10f30bf503e1967be50348b765fbedd2c6532
|
|
| MD5 |
50ee47195b0293755d0ca9760c91e779
|
|
| BLAKE2b-256 |
509c22718a5296b9ac749738714c39ca1e771684d1f335345cbe539df01dde83
|
File details
Details for the file net_command-0.1.0-py3-none-any.whl.
File metadata
- Download URL: net_command-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.8.18 Linux/6.8.0-1021-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a70d67bcc08906cf541c4f90fe0516e530a7a36940fcd46bc8b22559c0882ec
|
|
| MD5 |
6e421239449931d3146e0d7afe94e673
|
|
| BLAKE2b-256 |
20b047756c661c72275529f6ef2f385f0452ead30577f19102e95fd516387fff
|