Error creating API user using Icinga Ansible Playbook using icinga2_objects variable

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:

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.

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

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

1 Like