diff --git a/awx/api/templates/instance_install_bundle/group_vars/all.yml b/awx/api/templates/instance_install_bundle/group_vars/all.yml index 5d38519a1b..7c7c815d67 100644 --- a/awx/api/templates/instance_install_bundle/group_vars/all.yml +++ b/awx/api/templates/instance_install_bundle/group_vars/all.yml @@ -18,7 +18,7 @@ custom_tls_certfile: receptor/tls/receptor.crt custom_tls_keyfile: receptor/tls/receptor.key custom_ca_certfile: receptor/tls/ca/mesh-CA.crt {% if listener_port %} -receptor_protocol: tcp +receptor_protocol: {{ listener_protocol }} receptor_listener: true receptor_port: {{ listener_port }} {% else %} @@ -28,7 +28,7 @@ receptor_listener: false receptor_peers: {% for peer in peers %} - address: {{ peer.address }} - protocol: {{ peer.protocol}} + protocol: {{ peer.protocol }} {% endfor %} {% endif %} {% verbatim %} diff --git a/awx/api/views/instance_install_bundle.py b/awx/api/views/instance_install_bundle.py index 521eae1e23..481febe257 100644 --- a/awx/api/views/instance_install_bundle.py +++ b/awx/api/views/instance_install_bundle.py @@ -130,9 +130,10 @@ def generate_group_vars_all_yml(instance_obj): peers.append(dict(address=addr.get_full_address(), protocol=addr.protocol)) context = dict(instance=instance_obj, peers=peers) - listener_port = instance_obj.canonical_address_port - if listener_port: - context['listener_port'] = listener_port + canonical_addr = instance_obj.canonical_address + if canonical_addr: + context['listener_port'] = canonical_addr.port + context['listener_protocol'] = canonical_addr.protocol all_yaml = render_to_string("instance_install_bundle/group_vars/all.yml", context=context) # convert consecutive newlines with a single newline diff --git a/awx/main/models/ha.py b/awx/main/models/ha.py index b9c22d355b..2c237fbefd 100644 --- a/awx/main/models/ha.py +++ b/awx/main/models/ha.py @@ -234,6 +234,10 @@ class Instance(HasPolicyEditsMixin, BaseModel): return True return self.health_check_started > self.last_health_check + @property + def canonical_address(self): + return self.receptor_addresses.filter(canonical=True).first() + @property def canonical_address_port(self): # note: don't create a different query for receptor addresses, as this is prefetched on the View for optimization