2017-08-11 76 views
-1

我把這本手冊在一個運行Ansible 2.3.1的虛擬機上運行,​​沒有任何錯誤,但是我遇到了其他版本2.3.0及更早版本中的第一個字符問題,我沒有看到我出錯的地方。Ansible中的YAML問題2.3.0

格式嚴格遵循cl-license文檔中給出的示例,這非常簡單,因爲沒有邏輯或條件語句或此YAML的任何內容。

--- 
- hosts: accton_as6712_32x 
    tasks: 
    - name: install_license_for_6712 
     cl_license: 
     src: "http://10.43.255.182/cumulus/license-4x5712-4x6712.txt" 

- hosts: accton_as4610_54 
    tasks: 
    - name: install_license_for_4610 
     cl_license: 
     src: "http://10.43.255.182/cumulus/license-2x4600.txt" 

- hosts: mlnx_x86_MSN2410B 
    tasks: 
    - name: install_license_for_2410 
     cl_license: 
     src: "http://10.43.255.182/cumulus/license-2x2410.txt" 

- hosts: mlnx_x86_MSN2700 
    tasks: 
    - name: install_license_for_2700 
     cl_license: 
     src: "http://10.43.255.182/cumulus/license-mellanox-demo-2700.txt" 

這是我從詹金斯/ Ansible得到錯誤:

The offending line appears to be: 
--- 
- hosts: accton_as6712_32x 
^here 

如果我用YAML林特,我得到這個錯誤:

(<unknown>): did not find expected '-' indicator while parsing a block collection at line 2 column 1 

我是相當新的Ansible如果有人能指出我出錯的地方,會很樂意。

+0

檢查損壞的縮進。該錯誤表示它無法解析第一個列表,因爲可能有一些縮進或意外字符(可能位於文件的最後),但錯誤指針被設置爲破碎元素的開頭。 –

回答

0

我不是說cl-license模塊是錯誤的方式,但是您是否考慮過使用ZTP在您的Cumulus交換機上安裝許可證?

順便說一下,縮進看起來是正確的,但要確保在文件中有實際的空格而不是製表符。此外,檢查是否有任何奇怪的尾隨空格。