此错误表示在Ansible库中的某些组件试图使用无效的操作系统来配置网络设备。解决此问题的方法是升级到最新版本,并使用正确的操作系统配置网络设备。
以下是使用“junos”作为操作系统的代码示例:
inventory/host_vars/myhost.yaml 文件:
---
ansible_network_os: junos
ansible_become: true
ansible_user: user1
ansible_ssh_pass: mypassword
playbook.yml 文件:
---
- name: Configure Juniper Switches
hosts: switches
gather_facts: no
roles:
- juniper.junos
此代码配置Juniper交换机,并使用ansible_network_os属性来指定操作系统。确保ansible.cfg文件中的“[defaults]”部分中存在正确设置的路径和库。