Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rulebook with action run_playbook #1197

Open
3 tasks done
gurv opened this issue Jan 24, 2025 · 2 comments
Open
3 tasks done

Rulebook with action run_playbook #1197

gurv opened this issue Jan 24, 2025 · 2 comments

Comments

@gurv
Copy link

gurv commented Jan 24, 2025

Please confirm the following

  • I agree to follow this project's code of conduct.
  • I have checked the current issues for duplicates.
  • I understand that EDA-Controller is open source software provided for free and that I might not receive a timely response.

Bug Summary

Hello. Sorry for my bad English

  1. Run docker-compose-mac.yml

  2. Created a project

rulebooks/nothing.yml:

---
- name: Nothing
  hosts: all
  sources:
    - ansible.eda.range:
        limit: 5
  rules:
    - name: Nothing
      condition: event.i == 1
      action:
        run_playbook:
          name: playbooks/nothing.yml
          copy_files: true

playbooks/nothing.yml:

---
- name: Nothing
  hosts: localhost
  tasks:
    - name: Nothing
      meta: noop

inventory/hosts.yml:

---
all:
  hosts:
    localhost:
      ansible_connection: local
  1. In the logs I see:
2025-01-24 07:54:10,770 Pulling image quay.io/ansible/ansible-rulebook
2025-01-24 07:54:13,414 Starting Container
2025-01-24 07:54:13,417 Container args ['ansible-rulebook', '--worker', '--websocket-ssl-verify', 'no', '--websocket-url', 'ws://host.containers.internal:8001/api/eda/ws/ansible-rulebook', '--websocket-access-token', '******', '--websocket-refresh-token', '******', '--websocket-token-url', 'http://host.containers.internal:8001/api/eda/v1/auth/token/refresh/', '--id', '24', '--heartbeat', '300']
2025-01-24 07:54:13,550 Container 72b899197ed68d20508a450be796bf4471d85b912c2b2b33f07ede2e3df5f0db is running.
2025-01-24 07:54:14,574 - ansible_rulebook.cli - ERROR - Terminating Rule Nothing has an action run_playbook which needs inventory to be defined

How to use run_playbook?

Environment


Steps to reproduce


Actual results


Expected results


Additional information

No response

@mkanoor
Copy link
Contributor

mkanoor commented Jan 24, 2025

@gurv run-playbook can only be used when using ansible-rulebook CLI it can't be used when run as an Activation from eda-server. When run from eda-server we only support run_job_template so you would need a different rulebook. e.g. https://github.com/ansible/event-driven-ansible/blob/main/extensions/eda/rulebooks/demo_controller_rulebook.yml

@gurv
Copy link
Author

gurv commented Jan 25, 2025

@mkanoor thanks, good luck to this project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants