mirror of
https://github.com/ansible/awx.git
synced 2026-02-20 20:50:06 -03:30
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>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user