我似乎在 Ansible 中创建最基本的剧本时遇到了问题,我不确定如何解决我的问题。我收到以下错误...
"致命:[10.1.3.1]:失败!=> 更改=假 消息:操作需要权限提升 致命: [10.1.3.49]:失败!=> 更改=假 msg:操作需要权限提升">
下面是我的"ansible.cfg"文件-
[defaults]
inventory = hosts
stdout_callback = yaml
host_key_checking = False
retry_files_enabled = False
interpreter_python = auto_silent
[persistent_connection]
connect_timeout = 60
command_timeout = 60
以下是我的"config.yml"剧本-
---
- name: General Config
hosts: Network_Devices
tasks:
- name: Add Banner
ios_banner:
banner: login
text: |
Nicolas Cage is the
Tiger King
state: present
- name: Add loopback
ios_interface:
name: Loopback21
state: present
最后下面是我的"主机"文件-
[Network_Devices]
10.1.3.49
10.1.3.1
[Network_Devices:vars]
ansible_user=root
ansible_password=cisco
ansible_connection = network_cli
ansible_network_os=ios
在过去的几个月里,我一直在使用 ansible。在清单中设置"ansible_become_password"连接变量对我有用。来源- https://docs.ansible.com/ansible/latest/user_guide/become.html#become-network