From b25e3330762de656a3fd9b5a368ab4e61df9e204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Mon, 18 Dec 2017 22:40:56 +0100 Subject: [PATCH] icinga2_host: Don't set template attribute on modification, it's not permitted (#33989) --- lib/ansible/modules/monitoring/icinga2_host.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/ansible/modules/monitoring/icinga2_host.py b/lib/ansible/modules/monitoring/icinga2_host.py index f570499324..8e1bcff230 100644 --- a/lib/ansible/modules/monitoring/icinga2_host.py +++ b/lib/ansible/modules/monitoring/icinga2_host.py @@ -81,6 +81,7 @@ options: template: description: - The template used to define the host. + - Template cannot be modified after object creation. required: false default: None check_command: @@ -294,7 +295,12 @@ def main(): elif icinga.diff(name, data): if module.check_mode: module.exit_json(changed=False, name=name, data=data) + + # Template attribute is not allowed in modification + del data['attrs']['templates'] + ret = icinga.modify(name, data) + if ret['code'] == 200: changed = True else: