# What the heck is this?!?

**URL:** <https://forum.ansible.com/t/what-the-heck-is-this/28463>\
**Category:** Ansible Project\
**Created:** [August 30, 2018, 2:07am UTC](https://forum.ansible.com/t/what-the-heck-is-this/28463 "2018-08-30T02:07:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karl\_Auer](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@Karl\_Auer](https://forum.ansible.com/u/Karl_Auer)\
**Post date:** [August 30, 2018, 2:07am UTC](https://forum.ansible.com/t/what-the-heck-is-this/28463/1 "2018-08-30T02:07:15Z")

</div>

This may be the most incomprehensible Ansible error message I ave seen yet 🙂

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: KeyError: ‘HealthCheckPath’  
fatal: [localhost]: FAILED! =\> {“changed”: false, “module\_stderr”: “Traceback (most recent call last):\n File "/tmp/ansible\_sNNqfv/ansible\_module\_elb\_target\_group.py", line 705, in \n main()\n File "/tmp/ansible\_sNNqfv/ansible\_module\_elb\_target\_group.py", line 699, in main\n create\_or\_update\_target\_group(connection, module)\n File "/tmp/ansible\_sNNqfv/ansible\_module\_elb\_target\_group.py", line 444, in create\_or\_update\_target\_group\n if 'HealthCheckPath’in params and tg[‘HealthCheckPath’] != params[‘HealthCheckPath’]:\nKeyError: ‘HealthCheckPath’\n”, “module\_stdout”: “”, “msg”: “MODULE FAILURE”, “rc”: 1}

The main bit seems to be: this test:

if 'HealthCheckPath’in params and tg[‘HealthCheckPath’] != params[‘HealthCheckPath’]

I have no idea how to fix this.

I have a parameter that looks like this:

tg\_health\_check:

path: “/ADFS/probe”  
port: 80  
timeout: 5  
protocol: HTTP  
interval: 30  
threshold\_count: 3

Which I pass into a role that looks like this:

- elb\_target\_group:  
state: present  
region: “{{ tg\_region }}”  
vpc\_id: “{{ tg\_vpc\_id }}”  
name: “{{ tg\_name }}”  
port: “{{ tg\_port }}”  
protocol: “{{ tg\_protocol }}”  
targets: “{{ tg\_targets }}”  
target\_type: “{{ tg\_target\_type }}”  
health\_check\_protocol: “{{ tg\_health\_check.protocol }}”  
health\_check\_port: “{{ tg\_health\_check.port }}”  
health\_check\_path: “{{ tg\_health\_check.path }}”  
health\_check\_timeout: “{{ tg\_health\_check.timeout }}”  
health\_check\_interval: “{{ tg\_health\_check.interval }}”  
healthy\_threshold\_count: “{{ tg\_health\_check.threshold\_count }}”  
tags: “{{ all\_tags }}”  
register: tg

---

<div class="post-metadata">

**Author:** ![Karl\_Auer](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@Karl\_Auer](https://forum.ansible.com/u/Karl_Auer)\
**Post date:** [August 30, 2018, 3:08am UTC](https://forum.ansible.com/t/what-the-heck-is-this/28463/2 "2018-08-30T03:08:39Z")

</div>

I figured it out - it was because I was trying to change the protocol on a target group, and that isn’t allowed.

It’s a very poor error message though.

Regards, K.

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [August 30, 2018, 5:03am UTC](https://forum.ansible.com/t/what-the-heck-is-this/28463/3 "2018-08-30T05:03:07Z")

</div>

Hi,

> I figured it out - it was because I was trying to change the protocol  
> on a target group, and that isn't allowed.
> 
> It's a very poor error message though.

well, that's because it is a bug in the module 🙂 Please create an  
issue on github for the elb\_target\_group module and explain what you  
were doing, so the maintainers can add some code which catches this  
error and prints something nicer for the users 🙂

Cheers,  
Felix
