Skip to content

Instantly share code, notes, and snippets.

@jms
Created August 5, 2022 02:54
Show Gist options
  • Save jms/5788b90fbeb1f5bc51ab8c055c0537a1 to your computer and use it in GitHub Desktop.
Save jms/5788b90fbeb1f5bc51ab8c055c0537a1 to your computer and use it in GitHub Desktop.
ansible-bender-no-python
# ansible-bender build --python-interpreter /usr/bin/python3 playbooks/build-container.yml
---
- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment