mirror of
https://github.com/ansible/awx-operator.git
synced 2026-05-07 05:42:55 +00:00
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:
committed by
Christian Adams
parent
3fe42ed4b9
commit
6ef4aed024
@@ -41,6 +41,12 @@ spec:
|
|||||||
deployment_name:
|
deployment_name:
|
||||||
description: Name of the AWX deployment to create the Mesh Ingress for.
|
description: Name of the AWX deployment to create the Mesh Ingress for.
|
||||||
type: string
|
type: string
|
||||||
|
external_hostname:
|
||||||
|
description: External hostname to use for the Mesh Ingress.
|
||||||
|
type: string
|
||||||
|
external_ipaddress:
|
||||||
|
description: External IP address to use for the Mesh Ingress.
|
||||||
|
type: string
|
||||||
status:
|
status:
|
||||||
description: Status defines the observed state of AWXMeshIngress
|
description: Status defines the observed state of AWXMeshIngress
|
||||||
type: object
|
type: object
|
||||||
|
|||||||
@@ -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.
|
- name: Check for presence of AWX instance that we will use to create the Mesh Ingress for.
|
||||||
k8s_info:
|
k8s_info:
|
||||||
api_version: awx.ansible.com/v1beta1
|
api_version: awx.ansible.com/v1beta1
|
||||||
@@ -37,12 +45,14 @@
|
|||||||
wait: yes
|
wait: yes
|
||||||
wait_timeout: "120"
|
wait_timeout: "120"
|
||||||
register: route
|
register: route
|
||||||
|
when: is_openshift | bool
|
||||||
|
|
||||||
# TODO: need to wait until the route is ready before we can get the hostname
|
# TODO: need to wait until the route is ready before we can get the hostname
|
||||||
|
|
||||||
- name: Set external_hostname
|
- name: Set external_hostname
|
||||||
set_fact:
|
set_fact:
|
||||||
external_hostname: "{{ route.result.status.ingress[0].host }}"
|
external_hostname: "{{ route.result.status.ingress[0].host }}"
|
||||||
|
when: is_openshift | bool
|
||||||
|
|
||||||
- name: Create other resources
|
- name: Create other resources
|
||||||
k8s:
|
k8s:
|
||||||
@@ -81,12 +91,27 @@
|
|||||||
set_fact:
|
set_fact:
|
||||||
awx_task_pod_name: "{{ awx_task_pod['metadata']['name'] | default('') }}"
|
awx_task_pod_name: "{{ awx_task_pod['metadata']['name'] | default('') }}"
|
||||||
|
|
||||||
## TODO: awx-manage provision_instance does not currently support peer from control nodes
|
# TODO: awx-manage provision_instance does not currently support peer from control nodes
|
||||||
## !!!dependent on API/CLI changes!!!
|
# !!!dependent on API/CLI changes!!!
|
||||||
# - name: Add new instance to AWX
|
- name: Add new instance to AWX
|
||||||
# k8s_exec:
|
kubernetes.core.k8s_exec:
|
||||||
# namespace: "{{ ansible_operator_meta.namespace }}"
|
namespace: "{{ ansible_operator_meta.namespace }}"
|
||||||
# pod: "{{ awx_task_pod_name }}"
|
pod: "{{ awx_task_pod_name }}"
|
||||||
# container: "{{ deployment_name }}-task"
|
container: "{{ deployment_name }}-task"
|
||||||
# command: awx-manage provision_instance ...
|
command: "awx-manage provision_instance --hostname {{ ansible_operator_meta.name }} --node_type hop --listener_port 6667 --peers_from_control_nodes"
|
||||||
# register: result
|
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"
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ data:
|
|||||||
- node:
|
- node:
|
||||||
id: {{ ansible_operator_meta.name }}
|
id: {{ ansible_operator_meta.name }}
|
||||||
- log-level: debug
|
- log-level: debug
|
||||||
|
- control-service:
|
||||||
|
service: control
|
||||||
- ws-listener:
|
- ws-listener:
|
||||||
port: 27199
|
port: 27199
|
||||||
tls: tlsserver
|
tls: tlsserver
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ spec:
|
|||||||
- |
|
- |
|
||||||
internal_hostname={{ ansible_operator_meta.name }}
|
internal_hostname={{ ansible_operator_meta.name }}
|
||||||
external_hostname={{ external_hostname }}
|
external_hostname={{ external_hostname }}
|
||||||
receptor --cert-makereq bits=2048 commonname=$internal_hostname dnsname=$internal_hostname dnsname=$external_hostname nodeid=$internal_hostname outreq=/etc/receptor/tls/receptor.req outkey=/etc/receptor/tls/receptor.key
|
external_ipaddress={{ external_ipaddress }}
|
||||||
|
receptor --cert-makereq bits=2048 commonname=$internal_hostname dnsname=$internal_hostname dnsname=$external_hostname nodeid=$internal_hostname ipaddress=$external_ipaddress outreq=/etc/receptor/tls/receptor.req outkey=/etc/receptor/tls/receptor.key
|
||||||
receptor --cert-signreq req=/etc/receptor/tls/receptor.req cacert=/etc/receptor/tls/ca/mesh-CA.crt cakey=/etc/receptor/tls/ca/mesh-CA.key outcert=/etc/receptor/tls/receptor.crt verify=yes
|
receptor --cert-signreq req=/etc/receptor/tls/receptor.req cacert=/etc/receptor/tls/ca/mesh-CA.crt cakey=/etc/receptor/tls/ca/mesh-CA.key outcert=/etc/receptor/tls/receptor.crt verify=yes
|
||||||
exec receptor --config /etc/receptor/receptor.conf
|
exec receptor --config /etc/receptor/receptor.conf
|
||||||
image: '{{ _control_plane_ee_image }}'
|
image: '{{ _control_plane_ee_image }}'
|
||||||
|
|||||||
Reference in New Issue
Block a user