docs: rename eda controller to eda server

This commit is contained in:
kurokobo 2023-09-26 23:54:05 +09:00
parent 33e9534b44
commit cbe9e86439
4 changed files with 47 additions and 47 deletions

View file

@ -1,11 +1,11 @@
<!-- omit in toc -->
# [Experimental] Integrate AWX with EDA Controller
# [Experimental] Integrate AWX with EDA Server
The guide to deploy and use Event Driven Ansible Controller (EDA Controller) with AWX on K3s.
The guide to deploy and use EDA Server with AWX on K3s.
In this guide, [EDA Controller Operator](https://github.com/ansible/eda-server-operator) is used to deploy EDA Controller.
In this guide, [EDA Server Operator](https://github.com/ansible/eda-server-operator) is used to deploy EDA Server.
**Note that [EDA Controller Operator](https://github.com/ansible/eda-server-operator) is not a fully supported installation method for EDA Controller since it's not listed in [the deployment guide](https://github.com/ansible/eda-server/blob/main/docs/deployment.md).**
**Note that [EDA Server Operator](https://github.com/ansible/eda-server-operator) is not a fully supported installation method for EDA Server since it's not listed in [the deployment guide](https://github.com/ansible/eda-server/blob/main/docs/deployment.md).**
- [Ansible Blog | Ansible.com | Event-Driven Ansible](https://www.ansible.com/blog)
- [Welcome to Ansible Rulebook documentation — Ansible Rulebook Documentation](https://ansible.readthedocs.io/projects/rulebook/en/latest/)
@ -17,14 +17,14 @@ In this guide, [EDA Controller Operator](https://github.com/ansible/eda-server-o
- [Prerequisites](#prerequisites)
- [Deployment Instruction](#deployment-instruction)
- [Install EDA Controller Operator](#install-eda-controller-operator)
- [Prepare required files to deploy EDA Controller](#prepare-required-files-to-deploy-eda-controller)
- [Deploy EDA Controller](#deploy-eda-controller)
- [Demo: Use EDA Controller](#demo-use-eda-controller)
- [Configure EDA Controller](#configure-eda-controller)
- [Issue new token for AWX and add it on EDA Controller](#issue-new-token-for-awx-and-add-it-on-eda-controller)
- [Add Decision Environment on EDA Controller](#add-decision-environment-on-eda-controller)
- [Add Project on EDA Controller](#add-project-on-eda-controller)
- [Install EDA Server Operator](#install-eda-server-operator)
- [Prepare required files to deploy EDA Server](#prepare-required-files-to-deploy-eda-server)
- [Deploy EDA Server](#deploy-eda-server)
- [Demo: Use EDA Server](#demo-use-eda-server)
- [Configure EDA Server](#configure-eda-server)
- [Issue new token for AWX and add it on EDA Server](#issue-new-token-for-awx-and-add-it-on-eda-server)
- [Add Decision Environment on EDA Server](#add-decision-environment-on-eda-server)
- [Add Project on EDA Server](#add-project-on-eda-server)
- [Activate Rulebook](#activate-rulebook)
- [Deploy Ingress resource for the webhook](#deploy-ingress-resource-for-the-webhook)
- [Trigger Rule using Webhook](#trigger-rule-using-webhook)
@ -32,11 +32,11 @@ In this guide, [EDA Controller Operator](https://github.com/ansible/eda-server-o
## Prerequisites
EDA Controller is designed to use with AWX, so we have to have working AWX instance. Refer to [the main guide on this repository](../README.md) to deploy AWX on K3s.
EDA Server is designed to use with AWX, so we have to have working AWX instance. Refer to [the main guide on this repository](../README.md) to deploy AWX on K3s.
## Deployment Instruction
### Install EDA Controller Operator
### Install EDA Server Operator
Clone this repository and change directory.
@ -46,13 +46,13 @@ git clone https://github.com/kurokobo/awx-on-k3s.git
cd awx-on-k3s
```
Then invoke `kubectl apply -k rulebooks/operator` to deploy EDA Controller Operator.
Then invoke `kubectl apply -k rulebooks/operator` to deploy EDA Server Operator.
```bash
kubectl apply -k rulebooks/operator
```
The EDA Controller Operator will be deployed to the namespace `eda`.
The EDA Server Operator will be deployed to the namespace `eda`.
```bash
$ kubectl -n eda get all
@ -69,16 +69,16 @@ NAME DESIRED CU
replicaset.apps/eda-server-operator-controller-manager-7bf7578d44 1 1 1 12s
```
### Prepare required files to deploy EDA Controller
### Prepare required files to deploy EDA Server
Generate a Self-Signed certificate for the Web UI and API for EDA Controller. Note that IP address can't be specified.
Generate a Self-Signed certificate for the Web UI and API for EDA Server. Note that IP address can't be specified.
```bash
EDA_HOST="eda.example.com"
openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -out ./rulebooks/controller/tls.crt -keyout ./rulebooks/controller/tls.key -subj "/CN=${EDA_HOST}/O=${EDA_HOST}" -addext "subjectAltName = DNS:${EDA_HOST}"
openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -out ./rulebooks/server/tls.crt -keyout ./rulebooks/server/tls.key -subj "/CN=${EDA_HOST}/O=${EDA_HOST}" -addext "subjectAltName = DNS:${EDA_HOST}"
```
Modify `hostname` and `automation_server_url` in `rulebooks/controller/eda.yaml`. Note `hostname` is the hostname for your EDA Controller instance, and `automation_server_url` is the URL for your AWX instance that accessible from EDA Controller.
Modify `hostname` and `automation_server_url` in `rulebooks/server/eda.yaml`. Note `hostname` is the hostname for your EDA Server instance, and `automation_server_url` is the URL for your AWX instance that accessible from EDA Server.
```yaml
...
@ -93,7 +93,7 @@ spec:
...
```
Modify two `password`s in `rulebooks/controller/kustomization.yaml`.
Modify two `password`s in `rulebooks/server/kustomization.yaml`.
```yaml
...
@ -122,12 +122,12 @@ sudo chmod 755 /data/eda/postgres-13/data
sudo chown 26:0 /data/eda/postgres-13/data
```
### Deploy EDA Controller
### Deploy EDA Server
Deploy EDA Controller, this takes few minutes to complete.
Deploy EDA Server, this takes few minutes to complete.
```bash
kubectl apply -k rulebooks/controller
kubectl apply -k rulebooks/server
```
To monitor the progress of the deployment, check the logs of `deployment/eda-server-operator-controller-manager`:
@ -213,11 +213,11 @@ secret/eda-secret-tls kubernetes.io/tls 2 4m2s
secret/eda-db-fields-encryption-secret Opaque 1 3m4s
```
Now your EDA Controller is available at `https://eda.example.com/` or the hostname you specified.
Now your EDA Server is available at `https://eda.example.com/` or the hostname you specified.
## Demo: Use EDA Controller
## Demo: Use EDA Server
Here is a demo of configuring a webhook on the EDA Controller side, and triggering a Job Template on AWX by posting payload that contains a specific `message` to the webhook.
Here is a demo of configuring a webhook on the EDA Server side, and triggering a Job Template on AWX by posting payload that contains a specific `message` to the webhook.
In this demo, following example Rulebook is used. Review the Rulebook.
@ -231,19 +231,19 @@ In addition to the webhook demo, a quick demo to use MQTT as a source is also pr
- As a source of the Ruleset, subscribing MQTT topic on the MQTT broker is defined. Actual connection information for MQTT can be defined by Rulebook Variables.
- This Ruleset has a rule that if the received data contains `message` field with the body `Hello EDA`, trigger `Demo Job Template` in `Default` organization on AWX.
### Configure EDA Controller
### Configure EDA Server
In order to the webhook to be ready to receive messages, the following tasks need to be done.
- Issue new token for AWX and add it on EDA Controller
- Add Decision Environment on EDA Controller
- Add Project on EDA Controller
- Issue new token for AWX and add it on EDA Server
- Add Decision Environment on EDA Server
- Add Project on EDA Server
- Activate Rulebook
- Deploy Ingress resource for the webhook
#### Issue new token for AWX and add it on EDA Controller
#### Issue new token for AWX and add it on EDA Server
EDA Controller uses a token to access AWX. This token has to be issued by AWX and registered on EDA Controller.
EDA Server uses a token to access AWX. This token has to be issued by AWX and registered on EDA Server.
To issue new token by AWX, in the Web UI for AWX, open `User Details` page (accessible by user icon at the upper right corner), follow to the `Tokens` tab, and then click `Add` button. Specify `Write` as `Scope` and click `Save`, then keep the issued token in the safe place.
@ -254,7 +254,7 @@ $ kubectl -n awx exec deployment/awx-task -- awx-manage create_oauth2_token --us
4sIZrWXi**************8xChmahb
```
To register the token on EDA Controller, in the Web UI for EDA Controller, open `User details` page (accessible by user icon at the upper right corner), follow to the `Controller Tokens` tab, and then click `Create controller token` button.
To register the token on EDA Server, in the Web UI for EDA Server, open `User details` page (accessible by user icon at the upper right corner), follow to the `Controller Tokens` tab, and then click `Create controller token` button.
Fill the form as follows, then click `Create controller token` button on the bottom of the page:
@ -263,13 +263,13 @@ Fill the form as follows, then click `Create controller token` button on the bot
| Name | `awx.example.com` |
| Token | `<YOUR_TOKEN>` |
#### Add Decision Environment on EDA Controller
#### Add Decision Environment on EDA Server
Decision Environment (DE) is an environment for running Ansible Rulebook (`ansible-rulebook`) by the EDA Controller, like Execution Environment (EE) for running Ansible Runner (`ansible-runner`) by the AWX.
Decision Environment (DE) is an environment for running Ansible Rulebook (`ansible-rulebook`) by the EDA Server, like Execution Environment (EE) for running Ansible Runner (`ansible-runner`) by the AWX.
There is no default DE on EDA Controller, so we have to register new one.
There is no default DE on EDA Server, so we have to register new one.
Open `Decision Environments` under `Resources` on Web UI for EDA Controller, then click `Create decision environment` button.
Open `Decision Environments` under `Resources` on Web UI for EDA Server, then click `Create decision environment` button.
Fill the form as follows, then click `Create decision environment` button on the bottom of the page:
@ -278,13 +278,13 @@ Fill the form as follows, then click `Create decision environment` button on the
| Name | `Minimal DE` |
| Image | `quay.io/ansible/ansible-rulebook:latest` |
#### Add Project on EDA Controller
#### Add Project on EDA Server
To run Ansible Rulebook by EDA Controller, the repository on SCM that contains Rulebooks have to be registered as Project on EDA Controller.
To run Ansible Rulebook by EDA Server, the repository on SCM that contains Rulebooks have to be registered as Project on EDA Server.
This repository contains some example Rulebooks under [rulebooks](./) directory, so we can register this repository as Project.
Open `Projects` under `Resources` on Web UI for EDA Controller, then click `Create project` button.
Open `Projects` under `Resources` on Web UI for EDA Server, then click `Create project` button.
Fill the form as follows, then click `Create project` button on the bottom of the page:
@ -297,9 +297,9 @@ Refresh the page and wait for the `Status` for the project to be `Completed`.
#### Activate Rulebook
To run Ansible Rulebook by EDA Controller, activate the Rulebook.
To run Ansible Rulebook by EDA Server, activate the Rulebook.
Open `Rulebook Activations` under `Views` on Web UI for EDA Controller, then click `Create rulebook activation` button.
Open `Rulebook Activations` under `Views` on Web UI for EDA Server, then click `Create rulebook activation` button.
Fill the form as follows, then click `Create rulebook activation` button on the bottom of the page:
@ -332,7 +332,7 @@ NAME READY STATUS RESTARTS AGE
activation-job-1-h9kjt 1/1 Running 0 11m
```
The new Service is also created by EDA Controller. This service provides the endpoint for the webhook.
The new Service is also created by EDA Server. This service provides the endpoint for the webhook.
```bash
$ kubectl -n eda get service -l job-name=${JOB_NAME}
@ -342,11 +342,11 @@ activation-job-1-5000 ClusterIP 10.43.221.234 <none> 5000/TCP 11m
#### Deploy Ingress resource for the webhook
To make the webhook externally accessible, we have to expose the Service that created by EDA Controller.
To make the webhook externally accessible, we have to expose the Service that created by EDA Server.
To achieve this, in this example, we create new Ingress.
Modify `hosts`, `host`, and `name` under `service` in `rulebooks/webhook/ingress.yaml`. Here, the same hostname as the EDA Controller are specified so that the endpoint for webhook can be accessed under the same URL as the EDA Controller. Note that the `name` of the `service` has to be the name of the Service that created by EDA Controller, as reviewed above.
Modify `hosts`, `host`, and `name` under `service` in `rulebooks/webhook/ingress.yaml`. Here, the same hostname as the EDA Server are specified so that the endpoint for webhook can be accessed under the same URL as the EDA Server. Note that the `name` of the `service` has to be the name of the Service that created by EDA Server, as reviewed above.
```yaml
...
@ -404,7 +404,7 @@ $ curl -k \
https://eda.example.com/webhooks/demo
```
Review `Rule Audit` page under `Views` on the Web UI for EDA Controller, and `Jobs` page under `Views` on the Web UI for AWX.
Review `Rule Audit` page under `Views` on the Web UI for EDA Server, and `Jobs` page under `Views` on the Web UI for AWX.
### Appendix: Use MQTT as a source