telekom-mms/ansible-collection-icinga-director

[Bug] Using variables adds a space in icinga director entries using static information works fine

Closed this issue · 4 comments

Description

We're using this module to automate some server deployment steps and we noticed that if we use "{{machine_name}}" for names and "{{ip_address}}" type variables in the code it's adding a space in front of the name and ip address. if we just "actual_name" and "actual_ip_address" it's fine and doesn't add any spaces.

Reproduction steps

Reference variables in code to add a host to director instead of using any static entires

Current Behavior

Adds a space to the front only of entries in director

Expected Behavior

No spaces in hostname and address fields in director

Additional information

No response

Can you please provide an example-playbook that reproduces the problem?

Also can you please provide the colection-version and director-version you're using?

Thanks!

---
- hosts: localhost
  gather_facts: true
  vars:
    director_api_user: "ansible"
    director_api_password: "passwordisnice"
    director_hostname: "{{ machine_name }}"
    icinga_host_ip: "{{ ip_address }}"
    icinga_host_name: "{{ machine_name }}"

  tasks:

     - name: Create a host in icinga
       t_systems_mms.icinga_director.icinga_host:
         state: present
         accept_config: true
         url: "https://servername/icingaweb2"
         url_username: "{{ director_api_user }}"
         url_password: "{{ director_api_password}}"
         object_name: "{{ director_hostname }}"
         address: "{{ icinga_host_ip }}"
         display_name: "{{ icinga_host_name }}"
         imports:
           - "Host_Default_Linux_Template"
         vars:
           dnscheck: "no"
         validate_certs: false
         force_basic_auth: true
         has_agent: true
         command_endpoint: "servername"

We're using 1.33.1 of this collection
We're on version 1.9.1 of director
Also the variables are defined via cli/imports. Thanks,

We found the issue. Someone didn't notice a space in a variable. I apologize for the extra noise.

Glad you worked it out. :)