# How to fix Ansible with LXD error "Ansible\_loop\_var attribute error: nonetype object has no attribute items" leading to lxd\_container.py"

**URL:** <https://forum.ansible.com/t/how-to-fix-ansible-with-lxd-error-ansible-loop-var-attribute-error-nonetype-object-has-no-attribute-items-leading-to-lxd-container-py/10001>\
**Category:** Get Help\
**Tags:** howto, galaxy-ng\
**Created:** [October 8, 2024, 9:11am UTC](https://forum.ansible.com/t/how-to-fix-ansible-with-lxd-error-ansible-loop-var-attribute-error-nonetype-object-has-no-attribute-items-leading-to-lxd-container-py/10001 "2024-10-08T09:11:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![53xit13298](https://avatars.discourse-cdn.com/v4/letter/5/b5e925/32.png) [@53xit13298](https://forum.ansible.com/u/53xit13298)\
**Post date:** [October 8, 2024, 9:11am UTC](https://forum.ansible.com/t/how-to-fix-ansible-with-lxd-error-ansible-loop-var-attribute-error-nonetype-object-has-no-attribute-items-leading-to-lxd-container-py/10001/1 "2024-10-08T09:11:39Z")

</div>

I was struggling with Ansible trying to install Xroad for a few days here’s the log:

```auto
<localhost> EXEC /bin/sh -c 'rm -f -r /home/vboxuser/.ansible/tmp/ansible-tmp-17 28036128.1841958-3528-129319791180256/> /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
File "/home/vboxuser/.ansible/tmp/ansible-tmp-1728036128.1841958-3528-12931979 1180256/Ansiballz_lxd_container.py", line 107, in <module>
_ansiballz_main()
File "/home/vboxuser/.ansible/tmp/ansible-tmp-1728036128.1841958-3528-12931979 1180256/Ansiballz_lxd_container.py", line 99, in _ansiballz_main invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/home/vboxuser/.ansible/tmp/ansible-tmp-1728036128.1841958-3528-12931979 1180256/Ansiballz_lxd_container.py", line 47, in invoke_module runpy.run_module(mod_name='ansible_collections.community.general.plugins.mod
ules.lxd_container', init_globals-dict(_module_fqn='ansible_collections.communit y.general.plugins.modules.lxd_container', _modlib_path=modlib_path), File "/usr/lib/python3.10/runpy.py", line 224, in run_module return _run_module_code(code, init_globals, run_name, mod_spec) File "/usr/lib/python3.10/runpy.py", line 96, in _run_module_code _run_code(code, mod_globals, init_globals,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals)
File "/tmp/ansible_lxd_container_payload_g1eotpsb/ansible_lxd_container_payloa d.zip/ansible_collections/community/general/plugins/modules/lxd_container.py", l ine 901, in <module>

```

My steps were:

```auto
sudo snap install lxd
newgrp lxd
sudo lxd init

sudo apt update
sudo apt install software-properties-common
sudo apt-add-repository --yes --update ppa:ansible/ansible
sudo apt install ansible

ansible-playbook -i hosts/lxd_hosts.txt xroad_init.yml

```

First time i did the steps above, i didnt have any problems at all but 2nd time and later, all fails.

Turns out, all it was needed was:

`ansible-galaxy collection install community.general -f`
