Skip to content

Commit 2422c16

Browse files
jensrudolfJens Rudolf
andauthored
Add command_endpoint parameter to host and host_template (#143)
Co-authored-by: Jens Rudolf <jens.rudolf@aida.de>
1 parent 3c149ca commit 2422c16

12 files changed

Lines changed: 24 additions & 0 deletions

examples/icinga_host.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@
2222
has_agent: true
2323
master_should_connect: true
2424
accept_config: true
25+
command_endpoint: fooendpoint

examples/icinga_host_template.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@
2121
master_should_connect: true
2222
max_check_attempts: 3
2323
accept_config: true
24+
command_endpoint: fooendpoint

plugins/modules/icinga_host.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@
128128
type: bool
129129
choices: [True, False]
130130
version_added: '1.9.0'
131+
command_endpoint:
132+
description:
133+
- The endpoint where commands are executed on.
134+
type: str
131135
"""
132136

133137
EXAMPLES = """
@@ -154,6 +158,7 @@
154158
has_agent: true
155159
master_should_connect: true
156160
accept_config: true
161+
command_endpoint: fooendpoint
157162
"""
158163

159164
RETURN = r""" # """
@@ -190,6 +195,7 @@ def main():
190195
has_agent=dict(type="bool", choices=[True, False]),
191196
master_should_connect=dict(type="bool", choices=[True, False]),
192197
accept_config=dict(type="bool", choices=[True, False]),
198+
command_endpoint=dict(type="str", required=False),
193199
)
194200

195201
# When deleting objects, only the name is necessary, so we cannot use
@@ -221,6 +227,7 @@ def main():
221227
"has_agent": module.params["has_agent"],
222228
"master_should_connect": module.params["master_should_connect"],
223229
"accept_config": module.params["accept_config"],
230+
"command_endpoint": module.params["command_endpoint"],
224231
}
225232

226233
icinga_object = Icinga2APIObject(module=module, path="/host", data=data)

plugins/modules/icinga_host_template.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@
145145
type: bool
146146
choices: [True, False]
147147
version_added: '1.9.0'
148+
command_endpoint:
149+
description:
150+
- The endpoint where commands are executed on.
151+
type: str
148152
"""
149153

150154
EXAMPLES = """
@@ -170,6 +174,7 @@
170174
master_should_connect: true
171175
max_check_attempts: 3
172176
accept_config: true
177+
command_endpoint: fooendpoint
173178
"""
174179

175180
RETURN = r""" # """
@@ -210,6 +215,7 @@ def main():
210215
max_check_attempts=dict(required=False),
211216
accept_config=dict(type="bool", choices=[True, False]),
212217
event_command=dict(type="str", required=False),
218+
command_endpoint=dict(type="str", required=False),
213219
)
214220

215221
# Define the main module
@@ -238,6 +244,7 @@ def main():
238244
"max_check_attempts": module.params["max_check_attempts"],
239245
"accept_config": module.params["accept_config"],
240246
"event_command": module.params["event_command"],
247+
"command_endpoint": module.params["command_endpoint"],
241248
}
242249

243250
icinga_object = Icinga2APIObject(module=module, path="/host", data=data)

tests/integration/targets/icinga/roles/icinga/tasks/absent_icinga_host.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@
2020
has_agent: true
2121
master_should_connect: true
2222
accept_config: true
23+
command_endpoint: fooendpoint

tests/integration/targets/icinga/roles/icinga/tasks/absent_icinga_host_template.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@
1919
master_should_connect: true
2020
max_check_attempts: 3
2121
accept_config: true
22+
command_endpoint: fooendpoint

tests/integration/targets/icinga/roles/icinga/tasks/icinga_host.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@
2222
has_agent: true
2323
master_should_connect: true
2424
accept_config: true
25+
command_endpoint: fooendpoint

tests/integration/targets/icinga/roles/icinga/tasks/icinga_host_template.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@
2121
master_should_connect: true
2222
max_check_attempts: 3
2323
accept_config: true
24+
command_endpoint: fooendpoint

tests/integration/targets/icinga/roles/icinga/tasks/wrong_host_icinga_host.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
has_agent: true
2323
master_should_connect: true
2424
accept_config: true
25+
command_endpoint: fooendpoint
2526
ignore_errors: true
2627
register: result
2728
- assert:

tests/integration/targets/icinga/roles/icinga/tasks/wrong_host_icinga_host_template.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
master_should_connect: true
2222
max_check_attempts: 3
2323
accept_config: true
24+
command_endpoint: fooendpoint
2425
ignore_errors: true
2526
register: result
2627
- assert:

0 commit comments

Comments
 (0)