telekom-mms/ansible-collection-icinga-director

Can't append existing host

TheCry opened this issue · 1 comments

I'd tried to update an existing host:

- name: "Set server {{ srv_icinga_hostname }} Basic Monitoring Template Debian"
  connection: local
  t_systems_mms.icinga_director.icinga_host:
    state: present
    url: "{{ cco_icinga_url }}"
    url_username: "{{ cco_api_icinga_user }}"
    url_password: "{{ cco_api_icinga_pass }}"
    object_name: "{{ srv_icinga_hostname }}"
    imports:
      - "--- 3 - Addon Template - Debian Basic Monitoring - Customer CU (Endpoint)"
      - "---- 4 - Addon Picture - Debian"
    append: true
  when: srv_icinga_os_family == "debian"

and got this error:
bad return code while creating: 422. Error message: Trying to recreate icinga_host (\"hostname\")
The icinga api user has full credentials. The version of the director is: 1.10.2

Adding a host is no problem. Here i use:

- name: "Add server {{ srv_icinga_hostname }} for CU Management with ICINGA director"
  connection: local
  t_systems_mms.icinga_director.icinga_host:
    state: present
    url: "{{ cco_icinga_url }}"
    url_username: "{{ cco_api_icinga_user }}"
    url_password: "{{ cco_api_icinga_pass }}"
    validate_certs: no
    object_name: "{{ srv_icinga_hostname }}"
    display_name: "{{ srv_icinga_displayname }}"
    address: "{{ srv_icinga_ipaddress }}"
    icon_image_alt: "{{ srv_icinga_displayname }}"
    disabled: false
    vars:
      os: "{{ srv_icinga_var_os }}"
    imports:
      - "- 1 - Master Template - Server (Virtuell)"
      - "-- 2 - Hostgroup Template - CU Management"
      - "-- 2 - Icinga Agent Endpoint"
  when: srv_icinga_hostgroup == "cu-mgmt"

Regards
Sascha

Ohhhh... I'd found the issue. I had a restriction in there with the host groups. Sorry .