# python3.8 with ansible2.10.4 “with items” error

**URL:** <https://forum.ansible.com/t/python3-8-with-ansible2-10-4-with-items-error/34426>\
**Category:** Ansible Project\
**Created:** [January 12, 2021, 9:15am UTC](https://forum.ansible.com/t/python3-8-with-ansible2-10-4-with-items-error/34426 "2021-01-12T09:15:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![liyo](https://avatars.discourse-cdn.com/v4/letter/l/5fc32e/32.png) [@liyo](https://forum.ansible.com/u/liyo)\
**Post date:** [January 12, 2021, 9:15am UTC](https://forum.ansible.com/t/python3-8-with-ansible2-10-4-with-items-error/34426/1 "2021-01-12T09:15:32Z")

</div>

versions

ansible version： 2.10.4  
system version： CentOS7.9  
kernel version: 3.10.0-1160.11.1.el7.x86\_64

bug errorswhen I use the ansible-playbook ,the yml file is below:- name: List images  
shell: ls /tmp/images  
register: lists

- name: show lists  
debug:  
var: lists.stdout\_lines

- name: Load docker images  
shell:  
chdir: /tmp/images  
cmd: docker load -i {{ item }}  
with\_items: “{{ lists.stdout\_lines }}”

run command is : ansible-playbook -i hosts cluster.yml  
until the loadimage.yml step have error

PLAY [nodes] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [Gathering Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*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*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [k8s001]  
ok: [k8s003]  
ok: [k8s002]

TASK [kubeadm : Install rpm] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
changed: [k8s002]  
changed: [k8s003]  
changed: [k8s001]

TASK [kubeadm : Start kubelet.service] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [k8s002]  
ok: [k8s001]  
ok: [k8s003]

TASK [kubeadm : modeprobe netfilter] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
changed: [k8s002]  
changed: [k8s001]  
changed: [k8s003]

TASK [kubeadm : Load ipvs nodules] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
changed: [k8s002]  
changed: [k8s001]  
changed: [k8s003]

TASK [kubeadm : List images] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
changed: [k8s002]  
changed: [k8s003]  
changed: [k8s001]

TASK [kubeadm : show lists] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [k8s001] =\> {  
“lists.stdout\_lines”: [  
“coredns\_1.7.0.tar”,  
“etcd\_3.4.13-0.tar”,  
“kube-apiserver\_v1.19.6.tar”,  
“kube-controller-manager\_v1.19.6.tar”,  
“kube-proxy\_v1.19.6.tar”,  
“kube-scheduler\_v1.19.6.tar”,  
“pause\_3.2.tar”  
]  
}  
ok: [k8s002] =\> {  
“lists.stdout\_lines”: [  
“coredns\_1.7.0.tar”,  
“etcd\_3.4.13-0.tar”,  
“kube-apiserver\_v1.19.6.tar”,  
“kube-controller-manager\_v1.19.6.tar”,  
“kube-proxy\_v1.19.6.tar”,  
“kube-scheduler\_v1.19.6.tar”,  
“pause\_3.2.tar”  
]  
}  
ok: [k8s003] =\> {  
“lists.stdout\_lines”: [  
“coredns\_1.7.0.tar”,  
“etcd\_3.4.13-0.tar”,  
“kube-apiserver\_v1.19.6.tar”,  
“kube-controller-manager\_v1.19.6.tar”,  
“kube-proxy\_v1.19.6.tar”,  
“kube-scheduler\_v1.19.6.tar”,  
“pause\_3.2.tar”  
]  
}

TASK [kubeadm : Load docker images] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [k8s001]: FAILED! =\> {“msg”: “The task includes an option with an undefined variable. The error was: ‘item’ is undefined\n\nThe error appears to be in ‘/mnt/d/automation/kubegis/roles/kubeadm/tasks/loadimage.yml’: line 10, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Load docker images\n ^ here\n”}  
fatal: [k8s002]: FAILED! =\> {“msg”: “The task includes an option with an undefined variable. The error was: ‘item’ is undefined\n\nThe error appears to be in ‘/mnt/d/automation/kubegis/roles/kubeadm/tasks/loadimage.yml’: line 10, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Load docker images\n ^ here\n”}  
fatal: [k8s003]: FAILED! =\> {“msg”: “The task includes an option with an undefined variable. The error was: ‘item’ is undefined\n\nThe error appears to be in ‘/mnt/d/automation/kubegis/roles/kubeadm/tasks/loadimage.yml’: line 10, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Load docker images\n ^ here\n”}

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
k8s001 : ok=11 changed=4 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0  
k8s002 : ok=11 changed=4 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0  
k8s003 : ok=11 changed=4 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

help

please help me ? how to write right ?

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [January 12, 2021, 10:24am UTC](https://forum.ansible.com/t/python3-8-with-ansible2-10-4-with-items-error/34426/2 "2021-01-12T10:24:31Z")

</div>

The indentation looks wrong here.

---

<div class="post-metadata">

**Author:** ![liyo](https://avatars.discourse-cdn.com/v4/letter/l/5fc32e/32.png) [@liyo](https://forum.ansible.com/u/liyo)\
**Post date:** [January 13, 2021, 1:08am UTC](https://forum.ansible.com/t/python3-8-with-ansible2-10-4-with-items-error/34426/3 "2021-01-13T01:08:18Z")

</div>

- name: Load docker images  
shell:  
cmd: docker load -i {{ item }}  
chdir: /tmp/images  
with\_items: “{{ lists.stdout\_lines }}”

在2021年1月12日星期二 UTC+8 下午6:24:57[dick....@geant.org](mailto:dick....@geant.org) 写道：
