Provision instance and add receptor address

The mesh role now calls
1. awx-manage provision instance to register the hop
node to the database
2. awx-manage add_receptor_address to register the
internal address
3. awx-manage add_receptor_address to register the
external address (to be used by remote nodes)

CRD expanded to include external_ipaddress and
external_hostname

external_ipaddress is added as ipaddress in the
hop node certificate

external_hostname is added as dnsname in the
hop node certificate

the mesh role now checks for is_openshift and
only creates a Route if true. Otherwise it
will use external_hostname set in the spec
file in place of Route name.

Signed-off-by: Seth Foster <fosterbseth@gmail.com>
This commit is contained in:
Seth Foster
2023-10-05 12:38:23 -04:00
committed by Christian Adams
parent 3fe42ed4b9
commit 6ef4aed024
4 changed files with 45 additions and 11 deletions

View File

@@ -1,4 +1,12 @@
---
- name: Import common role
import_role:
name: common
- name: Debug is_openshift
debug:
msg: "is_openshift={{ is_openshift }}"
- name: Check for presence of AWX instance that we will use to create the Mesh Ingress for.
k8s_info:
api_version: awx.ansible.com/v1beta1
@@ -37,12 +45,14 @@
wait: yes
wait_timeout: "120"
register: route
when: is_openshift | bool
# TODO: need to wait until the route is ready before we can get the hostname
- name: Set external_hostname
set_fact:
external_hostname: "{{ route.result.status.ingress[0].host }}"
when: is_openshift | bool
- name: Create other resources
k8s:
@@ -81,12 +91,27 @@
set_fact:
awx_task_pod_name: "{{ awx_task_pod['metadata']['name'] | default('') }}"
## TODO: awx-manage provision_instance does not currently support peer from control nodes
## !!!dependent on API/CLI changes!!!
# - name: Add new instance to AWX
# k8s_exec:
# namespace: "{{ ansible_operator_meta.namespace }}"
# pod: "{{ awx_task_pod_name }}"
# container: "{{ deployment_name }}-task"
# command: awx-manage provision_instance ...
# register: result
# TODO: awx-manage provision_instance does not currently support peer from control nodes
# !!!dependent on API/CLI changes!!!
- name: Add new instance to AWX
kubernetes.core.k8s_exec:
namespace: "{{ ansible_operator_meta.namespace }}"
pod: "{{ awx_task_pod_name }}"
container: "{{ deployment_name }}-task"
command: "awx-manage provision_instance --hostname {{ ansible_operator_meta.name }} --node_type hop --listener_port 6667 --peers_from_control_nodes"
register: result
- name: Add internal receptor address
kubernetes.core.k8s_exec:
namespace: "{{ ansible_operator_meta.namespace }}"
pod: "{{ awx_task_pod_name }}"
container: "{{ deployment_name }}-task"
command: "awx-manage add_receptor_address --hostname {{ ansible_operator_meta.name }} --address {{ ansible_operator_meta.name }} --port 27199 --protocol ws --is_internal"
- name: Add external receptor address
kubernetes.core.k8s_exec:
namespace: "{{ ansible_operator_meta.namespace }}"
pod: "{{ awx_task_pod_name }}"
container: "{{ deployment_name }}-task"
command: "awx-manage add_receptor_address --hostname {{ ansible_operator_meta.name }} --address {{ external_hostname }} --protocol ws"