Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions plugins/modules/cml_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,24 @@ def run_module():
if cml.params['state'] == 'present':
if node is None:
node = lab.create_node(label=cml.params['name'], node_definition=cml.params['node_definition'])
# set coordinates when defined
if cml.params['x'] is not None:
node.x = cml.params['x']
if cml.params['y'] is not None:
node.y = cml.params['y']
cml.result['changed'] = True
else:
# check coordinates of existing node when defined
if cml.params['x'] is not None and cml.params['x'] != node.x:
cml.result['changed'] = True
if module.check_mode:
cml.exit_json()
node.x = cml.params['x']
if cml.params['y'] is not None and cml.params['y'] != node.y:
cml.result['changed'] = True
if module.check_mode:
cml.exit_json()
node.y = cml.params['y']
elif cml.params['state'] == 'started':
if node is None:
cml.fail_json("Node must be created before it is started")
Expand Down