使用 ansible 将配置推送到瞻博网络设备



我正在尝试使用 ansible 将瞻博网络上的配置推送到瞻博网络设备。我正在使用下面的剧本,使用网络进行连接。我收到错误消息:无法加载配置:配置加载错误(严重性:错误,bad_element:设置,消息:错误:语法错误)

    ---
    - 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命令,我所要做的就是使用文件名作为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

最新更新