如何将列表与ansible 2.6.3合并

如何将列表与ansible 2.6.3合并,ansible,Ansible,过去我使用ansible 2.3.1.0,现在我想使用ansible 2.6.3 我现在想用apt安装一些软件包。因此,我必须修改源代码列表,并将它们合并到一个列表中。在ansible 2.3.1.0中,我只使用了以下内容: apt_packages: - "{{ packages_list1 + packages_list2 }}" 我得到了以下错误: Traceback (most recent call last):\r\n File \"/tmp/ansible_k0tmag/ans

过去我使用ansible 2.3.1.0,现在我想使用ansible 2.6.3

我现在想用apt安装一些软件包。因此,我必须修改源代码列表,并将它们合并到一个列表中。在ansible 2.3.1.0中,我只使用了以下内容:

apt_packages:
- "{{ packages_list1 + packages_list2 }}"
我得到了以下错误:

Traceback (most recent call last):\r\n  File \"/tmp/ansible_k0tmag/ansible_module_apt.py\", line 1128, in <module>\r\n    main()\r\n  File \"/tmp/ansible_k0tmag/ansible_module_apt.py\", line 1106, in main\r\n
   allow_unauthenticated=allow_unauthenticated\r\n  File \"/tmp/ansible_k0tmag/ansible_module_apt.py\", line 521, in install\r\n    pkgspec = expand_pkgspec_from_fnmatches(m, pkgspec, cache)\r\n  File \"/tmp/ansible_k0tmag/ansible_module_apt.py\", line 439, in expand_pkgspec_from_fnmatches\r\n
pkgname_pattern, version = package_split(pkgspec_pattern)\r\n  File \"/tmp/ansible_k0tmag/ansible_module_apt.py\", line 312, in package_split\r\n
parts = pkgspec.split('=', 1)\r\nAttributeError: 'list' object has no attribute 'split'\r\n", "msg": "MODULE FAILURE", "rc": 1}
使用
apt_-packages:“{packages_-list1+packages_-list2}”
(没有
-
),它将工作

工作样本:

- hosts: localhost
  gather_facts: no

  vars:
    pkgs1: 
      - perl
      - python
    pkgs2:
      - vim
      - tar
    packages: "{{ pkgs1 + pkgs2 }}"

  tasks:
    -  apt:
         name: "{{ packages }}"
         state: present

你能分享更多信息吗,比如调试日志和playbook的更多内容你好playbook没什么特别的只是一个apt安装,但我会将其编辑到原始位置我还编辑了更长的错误代码输出
- hosts: localhost
  gather_facts: no

  vars:
    pkgs1: 
      - perl
      - python
    pkgs2:
      - vim
      - tar
    packages: "{{ pkgs1 + pkgs2 }}"

  tasks:
    -  apt:
         name: "{{ packages }}"
         state: present