Skip to content

Instantly share code, notes, and snippets.

@samdoran
Last active August 2, 2018 21:02
Show Gist options
  • Select an option

  • Save samdoran/308dee10a45f4d8c7b99c10fed7acd35 to your computer and use it in GitHub Desktop.

Select an option

Save samdoran/308dee10a45f4d8c7b99c10fed7acd35 to your computer and use it in GitHub Desktop.
Ansible lookup table
# In vars/main.yml inside a role
build_commands:
docker: docker build
buildah: buildah bud
# In tasks/modify_image.yml
- name: Modify image
command: {{ build_commands[container_build_tool] }} --tag {{ target_image | default(source_image) }}{{ modified_append_tag }} --file Dockerfile.modified --network host ./
args:
chdir: "{{ modify_dir_path }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment