博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Ansible:操作Juniper设备
阅读量:3927 次
发布时间:2019-05-23

本文共 895 字,大约阅读时间需要 2 分钟。

Ansible:操作Juniper设备

一、安装

1、控制节点中pip安装依赖:

  • junos-eznc
  • jxmlease
pip3 install junos-ezncpip3 install jxmlease

2、Ansible安装JunOS角色

ansible-galaxy install juniper.junos或者是ansible-galaxy install Juniper.junos大小写都行反正你这里怎么安装的下面就怎么引用

二、如何使用

1、引用Ansible角色

roles:    - role: juniper.junos

2、实例

主机清单

[junos]ex2300 ansible_host:
#根据自你的设备地址来填[junos:vars]ansible_connection: localansible_network_os: junos#这里一定要声明操作系统哦ansible_user:
#根据自你的设备地址来填ansible_ssh_pass:
#根据自你的设备地址来填

输出当前juniper设备的配置

---- name: get junos configuration  hosts: all  gather_facts: no  roles:    - Juniper.junos  tasks:    - name: show      juniper_junos_command:        provider:          host: "XXXX"        commands:           - "show configuration | display set"      register: result    - name: debug output      debug:         msg: "{
{result}}"

3、其他模块的使用模块参考

根据实例,可以可以参考一下Juniper的官方文档中的其他模块:

转载地址:http://cqugn.baihongyu.com/

你可能感兴趣的文章
spring有三种启动方式
查看>>
大型电子商务网站架构
查看>>
小型电子商务网站设计原则
查看>>
大型Java多用户商城系统设计开发的心得和困难
查看>>
CGLib与JDK的动态代理
查看>>
Java单元测试(Junit+Mock+代码覆盖率)
查看>>
怎样使用 Junit Framework 进行单元测试的编写
查看>>
MAVEN常用命令+基本配置详解 2015
查看>>
java:快速文件分割及合并
查看>>
redis 学习笔记(1)-编译、启动、停止
查看>>
redis 学习笔记(2)-client端示例代码
查看>>
redis 学习笔记(3)-master/slave(主/从模式)
查看>>
redis 学习笔记(4)-HA高可用方案Sentinel配置
查看>>
redis 学习笔记(5)-Spring与Jedis的集成
查看>>
nginx学习(1):编译、安装、启动
查看>>
nginx学习(2):启动gzip、虚拟主机、请求转发、负载均衡
查看>>
企业应用通用架构图
查看>>
深入理解Java:注解(Annotation)基本概念
查看>>
深入理解Java:注解(Annotation)自定义注解入门
查看>>
深入理解Java:注解(Annotation)--注解处理器
查看>>