diff --git a/awx/main/models/receptor_address.py b/awx/main/models/receptor_address.py index 2fac6af094..d4377823d7 100644 --- a/awx/main/models/receptor_address.py +++ b/awx/main/models/receptor_address.py @@ -27,3 +27,11 @@ class ReceptorAddress(models.Model): port = f":{self.port}" return f"{scheme}{self.address}{port}{path}" + + def get_peer_type(self): + if self.protocol == 'tcp': + return 'tcp-peer' + elif self.protocol in ['ws', 'wss']: + return 'ws-peer' + else: + return None diff --git a/awx/main/tasks/receptor.py b/awx/main/tasks/receptor.py index 7cd79c85e7..ce4049e6ab 100644 --- a/awx/main/tasks/receptor.py +++ b/awx/main/tasks/receptor.py @@ -703,8 +703,20 @@ def generate_config_data(): receptor_config = list(RECEPTOR_CONFIG_STARTER) for instance in instances: - peer = {'tcp-peer': {'address': f'{instance.hostname}:{instance.listener_port}', 'tls': 'tlsclient'}} - receptor_config.append(peer) + if instance.listener_port: + peer = {'tcp-peer': {'address': f'{instance.hostname}:{instance.listener_port}', 'tls': 'tlsclient'}} + receptor_config.append(peer) + for address in instance.receptor_addresses.all(): + if address.get_peer_type() and address.is_internal: + peer = { + f'{address.get_peer_type()}': { + 'address': f'{address.get_full_address()}', + 'tls': 'tlsclient', + } + } + receptor_config.append(peer) + else: + logger.warning(f"Receptor address {address} has unsupported peer type, skipping.") should_update = should_update_config(instances) return receptor_config, should_update