Networking 需要Ansible playbook以计算当前登录到VPN的用户数
为“统计当前登录VPN的用户数”编写ansible playbook。按照网络团队的建议使用Junos模块。我已在我的RHEL 7机器上安装了以下软件,并安装了ansible 2.9版本Networking 需要Ansible playbook以计算当前登录到VPN的用户数,networking,ansible,junos-automation,Networking,Ansible,Junos Automation,为“统计当前登录VPN的用户数”编写ansible playbook。按照网络团队的建议使用Junos模块。我已在我的RHEL 7机器上安装了以下软件,并安装了ansible 2.9版本 Junos Ansible Requirements =============================== -->Install Dependencies # pip install ncclient # pip install junos-eznc --> Install Juni
Junos Ansible Requirements
===============================
-->Install Dependencies
# pip install ncclient
# pip install junos-eznc
--> Install Juniper.junos Galaxy role
ansible-galaxy install juniper.junos
---> Have NETCONF enabled on Juniper devices over SSH
# set system services netconf ssh
--->(Optional)
#pip install junos-netconify (python lib for juniper console)
每当我写剧本的时候,我都会犯错误 剧本:-
---
- name: Get device uptime
hosts:
- dc1
roles:
- Juniper.junos
connection: local
gather_facts: no
vars_prompt:
- name: username
prompt: Junos Username
private: no
- name: password
prompt: Junos Password
private: yes
tasks:
- name: get uptime using galaxy module
junos_command:
commands: show system uptime
register: uptime
- name: display uptimes
debug: var=uptime
错误:-
我刚刚研究了ansible网络命令,发现了上述错误。请建议使用junos时需要的配置。请查找下面的剧本,以检查当前登录到VPN的用户数:-
- 名称:获取当前登录的系统用户
主持人:全部
连接:本地
收集事实:不
角色:
- Juniper.junos
任务:
- 名称:从运行Junos的设备检索事实 juniper_junos_事实:
- 名称:印刷版 调试: 变量:junos.fqdn
- 名称:运行RPC命令 juniper_junos_命令: commands=“显示安全动态vpn用户” 格式=文本 dest={{junos.fqdn}}.output
- Juniper.junos
任务:
PLAY [Get device uptime] **************************************************************************************************************
TASK [get uptime using galaxy module] *************************************************************************************************
fatal: [172.16.130.1]: FAILED! => {"changed": false, "msg": "invalid rpc for running in check_mode"}
PLAY RECAP ****************************************************************************************************************************
172.16.130.1 : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0