使用ansible删除思科IOS用户



我正在尝试使用ansible删除Cisco IOS交换机和路由器上的一些旧用户。由于 IOS 在 CLI 上提示用户确认是否要删除用户名,因此 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

使用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

最新更新