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

docker: install ansible-galaxy contents if desired #1970

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

commx
Copy link
Contributor

@commx commx commented Apr 24, 2024

This PR adds the ability to install ansible-galaxy collections and roles on Semaphore startup when using the Docker image, so collections and/or roles don't need to be installed every time a task is launched.

The approach is very similar to what can be accomplished with the "pre-commands" in the systemd service as described in the manual installation section of the administration guide.

Assuming you have the following requirements.yml:

---
collections:
  - name: ansible.posix
    version: "1.5.4"

roles:
  - name: geeringguy.node_exporter
    version: "2.1.0"

Mount it to the Semaphore container with the docker compose service entry:

---
services:
  semaphore:
    image: semaphoreui/semaphore:latest
    environment: {}
    volumes:
      - path/to/requirements.yml:/etc/semaphore/requirements.yml:ro

@fiftin fiftin requested a review from tboerger April 28, 2024 17:22
@tboerger
Copy link
Collaborator

Really unsure about this feature. Installing python dependencies totally makes sense because they are required by collections, but collections itself could also be easily installed as part of the jobs within semaphore.

@commx
Copy link
Contributor Author

commx commented Apr 28, 2024

Really unsure about this feature. Installing python dependencies totally makes sense because they are required by collections, but collections itself could also be easily installed as part of the jobs within semaphore.

Yes indeed and that's what we currently do. This feature is basically based on a customer scenario where a lot of collections/roles have to be installed for each task invocation. This takes a few minutes before the actual playbook runs, because their internet bandwidth capacity is quite limited. Installing those during semaphore startup can save quite some time and bandwith, especially in situations where galaxy contents are reused often so they don't need to get installed over and over again.

@andreas-marschke
Copy link
Collaborator

@commx I use semaphore in a similar scenario. We've simply revised the container as a whole, depend on the original and build our dependencies into the container we build:

FROM semaphoreui/semaphore:latest

USER root

RUN apk update && apk add py3-pip py3-setuptools alpine-sdk make gcc \
         wget python3-dev jq postgresql-libs postgresql-client

RUN apk add --virtual .build-deps gcc musl-dev postgresql-dev

COPY ./requirements.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt

# More to do requirements from galaxy etc. etc. etc.

WORKDIR /home/semaphore
USER semaphore

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

Successfully merging this pull request may close these issues.

None yet

3 participants