-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Any proper way to use ansible-bender on base images without a Python runtime? #260
Comments
I RTFM'd and found that a Python interpreter is a requirement of the base image. However what I can't understand is why it is required in the first place as Ansible playbooks don't necessarily require Python on the managed node to run (for instance, a playbook only calling the raw module to do the job, or using it to install a Python runtime before doing other tasks that requiring one). If the only reason that requires ansible-bender to locate a Python interpreter is to tell Ansible the proper one to use one can always provide it via the |
I found a workaround to make ansible-bender happy for the Build command: ansible-bender build --python-interpreter /usr/bin/python3 playbooks/build-container.yml Refined playbook: ---
- name: Build latest-bash container using ansible-bender
hosts: all
# Alpine doesn't have Python installation by default we collect these
# later after we have one
gather_facts: False
vars:
ansible_bender:
base_image: alpine:latest
target_image:
name: latest-bash
cmd: bash
pre_tasks:
- name: Install Python for Ansible runtime
raw: apk add python3
- name: Gather facts after Python runtime is available
setup:
post_tasks:
- name: Remove unneeded Python
raw: apk del python3
- name: Drop apk cache
raw: ash -c 'rm /var/cache/apk/*'
tasks:
- name: Install GNU Bash
apk:
name: bash
|
there is an epic which discuss this precise issue #49 the thing is that ansible actually requires python interpreter to be available in the target container |
Thank you @Lin-Buo-Ren . |
Hello, just trying to test ansible-bender on a official alpine base image on Docker Hub but encountered the following error:
Then, I tried to install a Python3 runtime beforehand in my playbook but it didn't work:
Is there anyway to do so, without preparing a custom image?
The text was updated successfully, but these errors were encountered: