mirror of
https://github.com/ansible/awx.git
synced 2026-01-10 15:32:07 -03:30
Template the listener protocol into the receptor install bundle (#14792)
Previously we were hard-coding tcp, now we need to also support ws/wss.
This commit is contained in:
parent
cd9dd43be7
commit
8ddb604bf1
@ -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 %}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user