【问题标题】:Removing Cisco IOS users with ansible使用 ansible 删除 Cisco IOS 用户
【发布时间】:2019-08-21 01:56:04
【问题描述】:

我正在尝试使用 ansible 删除 Cisco IOS 交换机和路由器上的一些老用户。由于 IOS 在 CLI 上提示用户确认他们是否要删除用户名,因此 ansible 任务当前失败。用ansible有什么办法吗?

这是一个 CLI 示例

SW01(config)#no username admin
This operation will remove all username related configurations with same name.Do you want to continue? [confirm]

可靠的任务

  tasks:
    - name: Remove username
      ios_command:
         commands: no username admin

【问题讨论】:

    标签: ansible cisco cisco-ios


    【解决方案1】:

    使用ios_user 模块。更多详情请看这里:https://docs.ansible.com/ansible/latest/modules/ios_user_module.html#ios-user-module

    例子:

    - name: Delete a user account
      ios_user:
        name: "neo"
        state: absent
    

    【讨论】:

    • 完美!像魅力一样工作!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-09-23
    • 2017-02-24
    • 2021-08-02
    • 1970-01-01
    • 2021-12-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多