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.

Revisions

  1. jms created this gist Aug 5, 2022.
    33 changes: 33 additions & 0 deletions ansible-bender-no-python
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    # 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