Ansible Error: "These fields have problems: folder", "fields": {"folder": ["The folder \''/OMDServer\'' could not be found."]}}'', '

CMK version: 2.1.0p36
OS version: ubuntu 20.04LTS

Error message:
Error calling API. HTTP code 400. Details: b’‘{“title”: “Bad Request”, “status”: 400, “detail”: “These fields have problems: folder”, “fields”: {“folder”: ["The folder '’/OMDServer'’ could not be found."]}}‘’, ’

Hello !
I started a first test with the latest checkmk.general. I simply want to create a folder “OMDServer” and insert a localhost within this folder. I created this Playbook:

---
  - name: "Create folders"
    checkmk.general.folder:
      server_url: "{{ checkmk_var_server_url }}"
      site: "{{ checkmk_var_site }}"
      automation_user: "{{ checkmk_var_automation_user }}"
      automation_secret: "{{ checkmk_var_automation_secret }}"
      path: "/OMD"
      name: "OMDServer"
      state: "present"
    delegate_to: localhost
#    run_once: true  # noqa run-once[task]

  - name: "Create localhosts"
    checkmk.general.host:
      server_url: "{{ checkmk_var_server_url }}"
      site: "{{ checkmk_var_site }}"
      automation_user: "{{ checkmk_var_automation_user }}"
      automation_secret: "{{ checkmk_var_automation_secret }}"
      name: "cmk_localhost"
      folder: "OMDServer"
      attributes:
        site: "{{ checkmk_var_site }}"
        ipaddress: 127.0.0.1
      state: "present"
    delegate_to: localhost

The Folder is created but the creation of the hosts throws above error. What am i doing wrong ?
Creating the host under root “/” is working fine. Can you push me to the right direcion, how to set the folder in checkmk.general.host correctly ?

Folder names are lowercase. Only the shown name inside GUI can have uppercase letters.

1 Like

Thank you Andreas. Sometimes you don´t see the trees in the forest :slight_smile: Got it work now and can continue testing…