Eda-server not importing runbooks on project import/sync

Greetings folks,

I’m jumping onto the EDA band wagon. I’ve authored some fairly simple runbooks and a couple of custom event source plugins and all works well on the command-line via ansible-runbook. So now I want a server to do this (much like I have an AWX server for scheduled playbook runs).

I found the eda-server-operator project, which seems to function much like the awx-operator project. Using it, I was able to deploy EDA to my existing K8S cluster that runs AWX…nice!

I can login to the GUI and I’ve created various Credentials (for accessing git-based projects and Decision Environment images). I created a couple of Projects (using a credential) and the project successfully “syncs”. I also created a Decision Environment (I assume that is pulled when an activation is triggered?).

Now the last part (the one that isn’t working). I’m trying to create my first Activation. I specify various details, choose the project, etc. There is a drop-down list to pick the rulebook to use (assuming the rulebook comes from the imported Project). However this drop-down is always empty for me. Also, unlike AWX where there was a drop-down with free-form text, there is no free-form text for me to specify which rulebook to use (manually) for this activation.

If I look at the logs of the “default workers” running in the cluster at Project import/sync time, I can see messages like this:

The “Task started” / “Task complete” messages happen in under a second, which makes me think something is wrong or being skipped in the import/sync process (just cloning a repo could take a second). Alas, I don’t see anywhere else in the code where logging would show me anything nor do I know how to turn up the logging level.

I fully understand that EDA operator and various sub components (eda-server, eda-ui, etc.) are probably still alpha/beta at this time. Just thought I’d share some feedback, solicit some help, and see if I can help further my understanding and the project itself.

Thanks,

Ben

1 Like

Hi,

EDA Server only searches rulebooks under rulebooks/ and extensions/eda/rulebooks on your project root.

Ensure your rulebooks are placed under rulebooks/ or extensions/eda/rulebooks and try again.

See also:

The rulebooks of a project must be located in the /rulebooks folder at the root of the project or at the path defined for Event-Driven Ansible content in Ansible collections: /extensions/eda/rulebooks .
Chapter 3. Projects Red Hat Ansible Automation Platform 2.4 | Red Hat Customer Portal

2 Likes

My project tree structure looks like this:

.
├── ansible.cfg
├── bindep.txt
├── collections
│   └── requirements.yml
├── extensions
│   └── eda
├── playbooks
│   ├── inventory.yml
│   └── print_alert_details.yml
├── README.md
├── requirements.txt
├── rulebooks
│   ├── new_alert_rulebook_awx_collection.yml
│   ├── new_alert_rulebook_awx_repo.yml
│   ├── new_alert_rulebook_collection.yml
│   └── new_alert_rulebook_repo.yml
└── VERSION.md

I’d expect it to pick up four (4) rulebooks in this case, no? For what it’s worth, I used operator version “main” and it has been running for approximately 48 hours.

1 Like

Correct, your four rulebooks should be detected.

I can’t reproduce your issue on my side with the following fresh setup:

  • quay.io/ansible/eda-server-operator:main
  • quay.io/ansible/eda-server:main
  • quay.io/ansible/eda-ui:latest

This is my log from my default worker:

2023-10-26 11:50:59,276 INFO     default: aap_eda.tasks.project.import_project(project_id=1) (eb64b02f-fb1d-4ddc-9720-57b531876180)
2023-10-26 11:50:59,287 INFO     Task started: Import project ( project_id=1 )
2023-10-26 11:51:00,118 INFO     Task complete: Import project ( project_id=1 )
2023-10-26 11:51:00,120 INFO     default: Job OK (eb64b02f-fb1d-4ddc-9720-57b531876180)
2023-10-26 11:51:00,120 INFO     Result is kept for 500 seconds

Could you test with my example repository that contains two rulebooks?: https://github.com/kurokobo/awx-on-k3s

Also, try super-reloading (Shift + F5) on the page to add rulebook activations, or using incognito tab.

1 Like

Interesting. I mirrored your repo over to my private GitLab instance and imported it into EDA and I can, in fact, see your two rulebooks available for activations. The one glaring difference I see immediately is that you’ve suffixed your files as *.yaml whereas I always use *.yml. Is there any content inspection done on the EDA side to see that the content of the rulebook is “valid”?

Alright, I figured it out. Because I had both of these paths in my repo:

1 ./extensions/eda/rulebooks
2 ./rulebooks

And because #1 was empty, the project import must have skipped #2 given the presence of #1. Seems these paths are mutually exclusive (one OR the other, but not both).

I was using this repo to both develop a custom EDA source plugin and to have some rulebooks for testing (all worked great on the command line). Later I moved my custom source plugins into an Ansible collection (tested with the FQCN of the plugin on the command-line and that worked too). Now that collection is in my custom Decision Environment, so I probably should have cleaned out the extensions folder altogether.

Might be worth updating docs to account for this behavior or support discovery of rulebooks from both directories.

2 Likes

Ah good find, make great sense. Agree, this should be documented, or discovery should be improved. Could you please open new issue for this RFE?

1 Like

Done.

2 Likes

An important information is provided by @Alex-Izquierdo on above issue on GitHub, so I’m duplicating his comment here for future references:

The /rulebooks layout originates from the earliest versions of the application. It’s an old path that we’ve kept for backward compatibility. However, it’s slated for deprecation in the future, and we don’t have plans to support both paths concurrently. The only supported path is the ansible-collection official one: /extensions/eda/rulebooks and I recommend to migrate your projects accordingly.
discover rulebooks from both paths (or document first path found and implications) · Issue #465 · ansible/eda-server · GitHub

2 Likes

Yes, I saw the update. Whilst I don’t necessarily agree with it, it is early yet and won’t impact me too much.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.