需要Ansible的行动手册来计算当前登录VPN的用户数量



为"计数当前登录到VPN的用户的数量";。按照网络团队的建议使用Junos模块。我在安装了Ansible 2.9版本的RHEL 7机器上安装了以下软件。

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

错误:-

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

我只是在探索易理解的网络命令&得到以上错误。请建议使用junos需要什么配置。

请查看以下行动手册,查看当前登录VPN的用户数量:-

  • name:获取当前登录的系统用户主机:全部连接:本地gather_facts:no角色:
    • Juniper.junos任务:
      • name:从运行Junos OS的设备中检索事实juniper_junos_facts:
      • name:打印版本调试:var:junos.fqdn
      • name:运行RPC命令juniper_junos_command:commands=";显示安全动态vpn用户";format=文本dest={{junos.fqdn}}.输出

最新更新