# Error creating API user using Icinga Ansible Playbook using icinga2\_objects variable

**URL:** <https://community.icinga.com/t/error-creating-api-user-using-icinga-ansible-playbook-using-icinga2-objects-variable/14451>\
**Category:** Automation & Infrastructure\
**Created:** [January 10, 2025, 12:52pm UTC](https://community.icinga.com/t/error-creating-api-user-using-icinga-ansible-playbook-using-icinga2-objects-variable/14451 "2025-01-10T12:52:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![david-ungurean](https://community.icinga.com/user_avatar/community.icinga.com/david-ungurean/32/6122_2.png) [@david-ungurean](https://community.icinga.com/u/david-ungurean)\
**Post date:** [January 10, 2025, 12:52pm UTC](https://community.icinga.com/t/error-creating-api-user-using-icinga-ansible-playbook-using-icinga2-objects-variable/14451/1 "2025-01-10T12:52:24Z")

</div>

Hi,  
I’m trying to deploy Icinga2 using the Ansible playbook` icinga.icinga.icinga2`.

I’m facing an issue regarding the icinga2\_objects variable.

I want to create an API user.

My code is:

> icinga2\_objects:
> 
> - name: “{{ api\_user }}”  
> type: ApiUser  
> file: “local.d/apiuser.conf”  
> password: “{{ api\_pass }}”  
> permissions:
> - “objects/query/Host”
> - “objects/query/Service”

and my error is:

```auto
TASK [icinga.icinga.icinga2 : assemble config files] *******************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: FileNotFoundError: [Errno 2] No such file or directory: b'/root/.ansible/tmp/ansible-tmp-1736512448.4066305-179598-170832090452365/tmpwj1qdm7v' -> b'/etc/icinga2/local.d/apiuser.conf'

```

Any help will be appreciated.  
Thank you.

---

<div class="post-metadata">

**Author:** ![rivad](https://community.icinga.com/user_avatar/community.icinga.com/rivad/32/5852_2.png) [@rivad](https://community.icinga.com/u/rivad)\
**Post date:** [January 10, 2025, 3:39pm UTC](https://community.icinga.com/t/error-creating-api-user-using-icinga-ansible-playbook-using-icinga2-objects-variable/14451/2 "2025-01-10T15:39:15Z")

</div>

The error tells you to add `-vvv` to get debug information.  
What do you get if you do it?

---

<div class="post-metadata">

**Author:** ![david-ungurean](https://community.icinga.com/user_avatar/community.icinga.com/david-ungurean/32/6122_2.png) [@david-ungurean](https://community.icinga.com/u/david-ungurean)\
**Post date:** [January 13, 2025, 8:33am UTC](https://community.icinga.com/t/error-creating-api-user-using-icinga-ansible-playbook-using-icinga2-objects-variable/14451/3 "2025-01-13T08:33:33Z")

</div>

Using verbosity 3 (-vvv) I noticed that the role was failing because Ansible was trying to copy a template file into a non existing folder.

Specifically, the folder: /etc/icinga2/local.d was missing.

I’ve created that folder, and now everything is working perfectly.

Thanks,  
David
