summaryrefslogtreecommitdiffstats
path: root/awx_collection/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'awx_collection/plugins')
-rw-r--r--awx_collection/plugins/modules/instance.py26
1 files changed, 24 insertions, 2 deletions
diff --git a/awx_collection/plugins/modules/instance.py b/awx_collection/plugins/modules/instance.py
index 049dd976dd..432dca4a39 100644
--- a/awx_collection/plugins/modules/instance.py
+++ b/awx_collection/plugins/modules/instance.py
@@ -47,6 +47,7 @@ options:
- Role that this node plays in the mesh.
choices:
- execution
+ - hop
required: False
type: str
node_state:
@@ -62,6 +63,18 @@ options:
- Port that Receptor will listen for incoming connections on.
required: False
type: int
+ peers:
+ description:
+ - List of peers to connect outbound to. Only configurable for hop and execution nodes.
+ - To remove all current peers, set value to an empty list, [].
+ required: False
+ type: list
+ elements: str
+ peers_from_control_nodes:
+ description:
+ - If enabled, control plane nodes will automatically peer to this node.
+ required: False
+ type: bool
extends_documentation_fragment: awx.awx.auth
'''
@@ -88,9 +101,11 @@ def main():
capacity_adjustment=dict(type='float'),
enabled=dict(type='bool'),
managed_by_policy=dict(type='bool'),
- node_type=dict(type='str', choices=['execution']),
+ node_type=dict(type='str', choices=['execution', 'hop']),
node_state=dict(type='str', choices=['deprovisioning', 'installed']),
listener_port=dict(type='int'),
+ peers=dict(required=False, type='list', elements='str'),
+ peers_from_control_nodes=dict(required=False, type='bool'),
)
# Create a module for ourselves
@@ -104,7 +119,8 @@ def main():
node_type = module.params.get('node_type')
node_state = module.params.get('node_state')
listener_port = module.params.get('listener_port')
-
+ peers = module.params.get('peers')
+ peers_from_control_nodes = module.params.get('peers_from_control_nodes')
# Attempt to look up an existing item based on the provided data
existing_item = module.get_one('instances', name_or_id=hostname)
@@ -122,6 +138,12 @@ def main():
new_fields['node_state'] = node_state
if listener_port is not None:
new_fields['listener_port'] = listener_port
+ if peers is not None:
+ new_fields['peers'] = peers
+ if peers is None:
+ peers = ['']
+ if peers_from_control_nodes is not None:
+ new_fields['peers_from_control_nodes'] = peers_from_control_nodes
module.create_or_update_if_needed(
existing_item,