semaphore icon indicating copy to clipboard operation
semaphore copied to clipboard

Dynamic inventory module and docker

Open d11ahirst opened this issue 1 year ago • 8 comments
trafficstars

Hi, I am looking for some guidance with plugin setup and docker, I have managed to get the plugin working correctly locally but when I try and run from within semaphore it fails with the following

image

As you can see its missing linode-api4 so I created a new docker image with the following and deployed it.

FROM semaphoreui/semaphore
USER root
RUN /sbin/apk add py3-pip
USER semaphore
RUN pip install linode-api4

However it still fails to find the module with the same error as above

If I exec into the running container it can clearly see the installation...

image

Is there another way of achieving this via ansible?

It would be good to get this problem sorted as its not clear what you are supposed to do in the documentation or online.

Thanks for an help.

d11ahirst avatar Feb 09 '24 14:02 d11ahirst

From my testing, the better way to get the dependencies for the linode API is to install the galaxy collection linode.cloud and then installing the requirements from: {galaxy-collections-path}/ansible_collections/linode/cloud/requirements.txt

andreas-marschke avatar Feb 11 '24 07:02 andreas-marschke

Thanks @andreas-marschke would you be able to elaborate a bit more? I usually run very simple scripts in ansible and I'm not very familiar with galaxy

Thanks

d11ahirst avatar Feb 11 '24 15:02 d11ahirst

@d11ahirst Ansible Galaxy is another tool provided by the ansible project allowing you to use collections of integrations such as additional task types eg. interactions with Linode or other Clouds and shared roles allowing for easy setup of common infrastructure. Browse around and you will find the Linode.Cloud collection allowing you to work with the Linode Cloud services.

Review the galaxy user guide for general information: https://docs.ansible.com/ansible/latest/galaxy/user_guide.html

This is out of scope for Semaphore as we're not directly associated with the Ansible project.

andreas-marschke avatar Feb 11 '24 16:02 andreas-marschke

Thanks @andreas-marschke i have created a file called collections/requirements.yml with the following contents

---
collections:
  - name: linode.cloud
    version: ">=0.25.1"

unfortunately it is unable to find this file on running the playbook

No collections/requirements.yml file found. Skip galaxy install process.

my task resides as playbooks/task.yml

d11ahirst avatar Feb 11 '24 17:02 d11ahirst

The collections directory needs to be under playbooks it's a longer standing peculiarity with Semaphore.

andreas-marschke avatar Feb 12 '24 11:02 andreas-marschke

Thanks andreas

d11ahirst avatar Feb 12 '24 12:02 d11ahirst

@d11ahirst Assuming the patches helped, do we need to keep the ticket open?

andreas-marschke avatar Feb 16 '24 13:02 andreas-marschke

They didn't help due to the plugin needed before main playbooks for grabbing the dyanmic inventory but please feel free to close this issue, Thanks

d11ahirst avatar Feb 16 '24 13:02 d11ahirst

With recent container versions you are able to mount a requirements.txt file into /etc/semaphore which installs the define list of pypi dependencies into the container.

tboerger avatar May 08 '24 10:05 tboerger