diff options
author | Lila Yasin <lyasin@redhat.com> | 2023-06-30 22:53:58 +0200 |
---|---|---|
committer | Seth Foster <fosterseth@users.noreply.github.com> | 2023-08-29 19:06:54 +0200 |
commit | 54894c14dce863689447e4644719c06a39921652 (patch) | |
tree | 6ffc7996f1dec92160b828d3551af882b36b4dbe /awx_collection/plugins | |
parent | Add functional API tests (diff) | |
download | awx-54894c14dce863689447e4644719c06a39921652.tar.xz awx-54894c14dce863689447e4644719c06a39921652.zip |
Hop node AWX Collection Updates (#14153)
Add hop node support to awx collections
- add peers and peers_from_control_nodes fields
- show new node_type "hop"
- add tests for adding hop nodes via collections
Co-authored-by: Seth Foster <fosterseth@users.noreply.github.com>
Diffstat (limited to 'awx_collection/plugins')
-rw-r--r-- | awx_collection/plugins/modules/instance.py | 26 |
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, |