HTTP Regel mit Check_MK Ansbiel Collection erstellen

Hallo Zusammen,

ich möchte gerne mittels der Check_MK Ansible Collection mehrere HTTP Regeln erstellen.
Die CMK Version ist: Checkmk Enterprise Edition 2.2.0p23

Hier mein Playbook:

---
- hosts: blub
  gather_facts: false
  collections:
    - checkmk.general
  vars:
    cmk_user: blub
    cmk_pass: blub
    checkmk_var_site: blub
    checkmk_var_server_url: blub
    cmk_rule_http:
      location:
        folder: "/"
        position: "bottom"
      conditions: {
        "host_name": {
          "match_on": [
            "blub"
          ],
          "operator": "one_of"
        },
        "host_labels": [],
        "host_tags": [],
        "service_labels": []
      }
      properties: {
        "comment": "{{ ansible_date_time.iso8601 }} - Ansible managed",
        "description": "",
        "disabled": false
      }
      value_raw: "{'name': 'certificate blub', 'host': {'address': ('direct', 'google.de'), 'port': 443, 'address_family': None}, 'mode': ('cert', {'cert_days': (25, 7)})}"
      #value_raw: "{'name': 'certificate {{ inventory_hostname }}', 'host': {'address': ('direct', '{{ inventory_hostname }}'), 'port': 443, 'address_family': None}, 'mode': ('cert', {'cert_days': (25, 7)})}"

  tasks:
    - name: "Gather Date and Time Facts"
      ansible.builtin.setup:
        gather_subset:
          - date_time
      delegate_to: localhost
      run_once: true

    - name: "Create rules."
      rule:
        server_url: "{{ checkmk_var_server_url }}"
        site: "{{ checkmk_var_site }}"
        automation_user: "{{ cmk_user }}"
        automation_secret: "{{ cmk_pass }}"
        ruleset: active_checks:http
        rule: "{{ cmk_rule_http }}"
        state: "present"
      delegate_to: localhost

Führe ich das ganze mit der Variable “value_raw” ohne die “inventory_hostname” aus, werden mir 10 Regeln erstellt (10 Hosts sind in der passenden Gruppe")

Ändere ich die “value.raw”, dass dort “{{ inventory_hostname }}” benuzt wird, wird die Rest-API einen Fehler:

fatal: [blub -> localhost]: FAILED! => {"changed": false, "id": "", "msg": "Error calling API. HTTP code 400. Details: b'{\"title\": \"Problem in (sub-)field \\'hostaddress_sel\\'\", \"status\": 400, \"detail\": \"Value [\\'direct\\', \\'blub\\'] is not allowed here.\"}', "}

Hat vlt jemand eine Idee?

Ohne mir den Code anzusehen, oder lange drüber nachzudenken: Pack mal folgende Option an den Task: run_once: true. Dann läuft der Task nur einmal anstatt pro Host einmal.