ansible/event-driven-ansible

Missing dependencies and JAVA_HOME

ahussey-redhat opened this issue · 13 comments

Hello,

After running ansible-galaxy collection install ansible.eda and ansible-playbook ansible.eda.install_rulebook_cli -i localhost, -vK -c local the first time I run a rulebook it says that aiohttp is missing.

I can see in the requirements.txt that it is listed, so not sure why it isn't being installed.

I also get an error that JAVA_HOME isn't set. I can see in the install_ansible_rulebook role that it sets it in ~/.bashrc, but it isn't sourced automatically, and there's no warning to the user to source it either.

This affects users who install ansible.eda and want to try and use it straight away, from the same shell.

It is there, but I was following the README directly from this repo
https://github.com/ansible/event-driven-ansible/blob/main/README.md

The following looks more like dependencies for actually developing the module, rather than just using the module.

Like, jinja2 should be installed as part of ansible-core?
And are gcc, maven, python3-devel required just to run ansible-rulebook

export JAVA_HOME=/usr/lib/jvm/java-17-openjdk is already added to the users ~/.bashrc by the install_ansible_rulebook role, it just needs to be sourced after the playbook is run.

The below snippet doesn't install aiohttp

dnf --assumeyes install gcc java-17-openjdk maven python3-devel python3-pip
export JDK_HOME=/usr/lib/jvm/java-17-openjdk
export JAVA_HOME=$JDK_HOME
pip3 install -U Jinja2
pip3 install ansible ansible-rulebook ansible-runner wheel

Yeah, there's a lot of dependencies since it uses drools, which is Java and requires maven.

I use https://github.com/konstruktoid/ansible-event-otx/blob/main/Vagrantfile as my go-to installation source,
and it does (on Fedora):

sudo dnf --assumeyes upgrade
sudo dnf --assumeyes install gcc java-17-openjdk maven python3-devel python3-pip

echo "
export JDK_HOME=/usr/lib/jvm/java-17-openjdk
export JAVA_HOME=\$JDK_HOME
export PIP_NO_BINARY=jpy
" >> ~/.bashrc

pip3 install -U Jinja2
pip3 install ansible ansible-rulebook ansible-runner

Hi @ahussey-redhat . ansible-collection doesn't install the requirements, you must install them manually, as is described in https://github.com/ansible/event-driven-ansible/blob/main/COLLECTION.md

Hi @ahussey-redhat, regarding the sourcing of bashrc - are you using an Ansible/ssh config with persistent SSH connections?

Yeah, there's a lot of dependencies since it uses drools, which is Java and requires maven.

I use https://github.com/konstruktoid/ansible-event-otx/blob/main/Vagrantfile as my go-to installation source, and it does (on Fedora):

sudo dnf --assumeyes upgrade
sudo dnf --assumeyes install gcc java-17-openjdk maven python3-devel python3-pip

echo "
export JDK_HOME=/usr/lib/jvm/java-17-openjdk
export JAVA_HOME=\$JDK_HOME
export PIP_NO_BINARY=jpy
" >> ~/.bashrc

pip3 install -U Jinja2
pip3 install ansible ansible-rulebook ansible-runner

Hi @konstruktoid,
That makes sense 🙂
But those dependencies seem to be related more to the development of the module, than using the module as an end user

Hi @ahussey-redhat . ansible-collection doesn't install the requirements, you must install them manually, as is described in https://github.com/ansible/event-driven-ansible/blob/main/COLLECTION.md

Hi @Alex-Izquierdo
The install_ansible_rulebook role seems to, but doesn't install aiohttp

- name: Ensure dependencies are installed
become: "{{ 'false' if ansible_distribution == 'MacOSX' else 'true' }}"
ansible.builtin.package:
name: "{{ package_list }}"

- name: Ensure ansible dependencies
ansible.builtin.pip:
name:
- ansible
- ansible-runner
state: present

Hi @ahussey-redhat, regarding the sourcing of bashrc - are you using an Ansible/ssh config with persistent SSH connections?

Hi @ttuffin , I'm using both, but none of them specify persistent connections. The ssh config primarily just specifies users for different hosts, and the ansible config just specifies the inventory and stdout_callback plugin

install_ansible_rulebook is for ansible rulebook not for the collection. But in the end we are installing the collection, so it should install it's requirements as well. This is a mistake.

The recommended way to install ansible-rulebook is the described one in the documentation. https://ansible-rulebook.readthedocs.io/en/latest/installation.html
And for the collection: https://github.com/ansible/event-driven-ansible/blob/main/COLLECTION.md

The readme of this repository must be updated accordingly.

Thanks for your feedback @ahussey-redhat

We have decommissioned the ansible-rulebook installer. The installation guide can be followed in the ansible-rulebook documentation.

Out of curiosity why was the ansible-rulebook installer removed?

I just discovered ansible-rulebook and I really want to built it into my project as the primary way to manage event-driven flows.

Unfortunately right now the java dependency is just a bit too difficult to ask my users to install manually (I package for Ubuntu/Debian/macOS), so it would be awesome if there were a cross-platform playbook I could run to do the initial setup automatically when the project is first installed.

Hi @pirate It is just a clear definition of the scope of this collection, which is intended to provide the set of plugins to start and integrate with Event Driven Ansible. For a straightforward way to use Ansible-Rulebook, I can recommend our public image of Ansible-Rulebook that can be used as the Decision Environment for your projects in eda-server.

For any other type of installation, please follow the instructions of our documentation.