Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ansible列表给出了弃用警告_Ansible - Fatal编程技术网

Ansible列表给出了弃用警告

Ansible列表给出了弃用警告,ansible,Ansible,我已经为更新iLO固件创建了一个Ansible playbook,它运行良好。然而,它给了我一个逗号分隔的列表值已被弃用的警告(我的其他剧本都没有给出这个警告)。我假设这与iLO_Models变量有关,因此我尝试将变量更改为只有一个模型,但仍然得到警告 Ansible版本是2.3.2.0。我只想修复我的代码,以删除警告,并确保它不会中断 --- - name: iLO Firmware Upgrade for Standalone Servers hosts: testing gathe

我已经为更新iLO固件创建了一个Ansible playbook,它运行良好。然而,它给了我一个逗号分隔的列表值已被弃用的警告(我的其他剧本都没有给出这个警告)。我假设这与iLO_Models变量有关,因此我尝试将变量更改为只有一个模型,但仍然得到警告

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.

这是因为
gather\u subset:hardware

替换为:

gather_subset: [hardware]
或:


这是因为
gather\u subset:hardware

替换为:

gather_subset: [hardware]
或: