首页 文章

使用ansible将配置推送到juniper设备

提问于
浏览
0

我正在尝试使用ansible将配置推送到juniper设备 . 我使用下面的playbook,使用netconf进行连接 . 我收到错误 msg: Unable to load config: ConfigLoadError(severity: error , bad_element: set, message: error: syntax error)

---
    - name: Load merge config
      connection: local
      gather_facts: no
      hosts: juniper

      roles:
       - Juniper.junos

      tasks:
      - name: Checking NETCONF connectivity
        wait_for: host={{ inventory_hostname }} port=830

      - name: Push config
        junos_install_config:
         host={{ inventory_hostname }}
         file=push.conf 
         replace_config=true

我的配置文件包含所有set命令 .

1 回答

  • 0

    谢谢,它现在有效 . 实际上我的配置文件是使用set命令,我所要做的就是使用文件名作为push.set . 并且还必须在主机下包含用户 . 有效的最终剧本 .

    ---
        - hosts: Juniper
          gather_facts: no
          connection: local
    
          roles:
           - Juniper.junos
    
          tasks:
          - name: Push config
            junos_install_config:
             host={{ ansible_ssh_host }}          
             user={{ ansible_user }}
             file=push.set
    

相关问题