2017-08-17 69 views
0

我已經創建了用於更新iLO固件的Ansible操作手冊,並且它工作正常。然而,它給了我一個逗號分隔值的列表已被棄用警告(我的其他劇本沒有給出這個警告)。我假設這必須與iLO_Models變量,所以我試圖改變變量只有一個模型,仍然得到警告。Ansible list給出了棄用警告

Ansible版本是2.3.2.0。我只想修復我的代碼以刪除警告並確保它不會中斷。

--- 
- name: iLO Firmware Upgrade for Standalone Servers 
    hosts: testing 
    gather_facts: true 
    gather_subset: hardware 
    become: true 
    vars: 
    firmware_directory: /firmware 
    iLO4: iLO4-2.54-CP032620.scexe 
    iLO4_Models: 
     - 'ProLiant DL320e Gen8 v2' 
     - 'ProLiant DL380 Gen9' 
     - 'ProLiant DL580 G9' 
     - 'ProLiant BL460c Gen8' 
     - 'ProLiant BL460c Gen9' 
    tasks: 
    - name: Copy iLO4 update 
     copy: > 
      src={{ firmware_directory }}/{{ iLO4 }} 
      dest=/tmp/ 
      owner=root 
      group=root 
      mode=0640 
     when: ansible_product_name in iLO4_Models 

    - name: Install iLO4 Update 
     shell: /bin/bash /tmp/{{ iLO4 }} -s 
     when: ansible_product_name in iLO4_Models 
     register: ilo_result 
     changed_when: ilo_result.rc == 0 
     failed_when: ilo_result.rc == 1 or ilo_result.rc == 4 

我得到以下警告:

[DEPRECATION WARNING]: Using comma separated values for a list has been deprecated. You should instead use the correct YAML syntax for lists. . 
This feature will be removed in a future release. Deprecation warnings can be disabled by setting 
deprecation_warnings=False in ansible.cfg. 

回答

1

這是因爲gather_subset: hardware

替換:

gather_subset: [hardware] 

或:

gather_subset: 
    - hardware