Role - tripleo_container_image_build

Role Documentation

Welcome to the “tripleo_container_image_build” role documentation.

Role Defaults

This section highlights all of the defaults and variables set within the “tripleo_container_image_build” role.

# All variables intended for modification should be placed in this file.
tcib_path: "{{ lookup('env', 'HOME') }}"

# Dictionary, single level key:value pairs, optional, implements https://docs.docker.com/engine/reference/builder/#arg
tcib_args: {}

# String, required, 'item', implements https://docs.docker.com/engine/reference/builder/#from
tcib_from: quay.io/centos/centos:stream8

# Dictionary, single level key:value pairs, optional, implements https://docs.docker.com/engine/reference/builder/#label
tcib_labels: {}

# Dictionary, single level key:value pairs, optional, implements https://docs.docker.com/engine/reference/builder/#env
tcib_envs: {}

# List of Strings, optional, <item>, implements https://docs.docker.com/engine/reference/builder/#onbuild
tcib_onbuilds: []

# List of Strings, optional, <item>, implements https://docs.docker.com/engine/reference/builder/#volume
tcib_volumes: []

# String, optional, 'item', implements https://docs.docker.com/engine/reference/builder/#workdir
tcib_workdir: ''

# List of Strings, optional, <item>, implements https://docs.docker.com/engine/reference/builder/#add
tcib_adds: []

# List of Strings, optional, <item>, implements https://docs.docker.com/engine/reference/builder/#copy
tcib_copies: []

# List of Strings, optional, <item>, implements https://docs.docker.com/engine/reference/builder/#expose
tcib_exposes: []

# String, optional, 'item', implements https://docs.docker.com/engine/reference/builder/#user
tcib_user: ''

# String, optional, 'item', implements https://docs.docker.com/engine/reference/builder/#shell
tcib_shell: ''

# List of Strings, optional, <item>, implements https://docs.docker.com/engine/reference/builder/#run
tcib_runs: []

# String, optional, 'item', implements https://docs.docker.com/engine/reference/builder/#healthcheck
tcib_healthcheck: ''

# String, optional, 'item', implements https://docs.docker.com/engine/reference/builder/#stopsignal
tcib_stopsignal: ''

# String, optional, 'item', implements https://docs.docker.com/engine/reference/builder/#entrypoint
tcib_entrypoint: ''

# String, optional, 'item', implements https://docs.docker.com/engine/reference/builder/#cmd
tcib_cmd: ''

# List of Dictionaries, single level key:value pairs, key=VERB, value=verb action.
# NOTE(cloudnull): This allows for arbitrary docker verbs and maintains ordering.
#                  all available verbs can be found here: https://docs.docker.com/engine/reference/builder
tcib_actions: []

# List of Strings, optional, <item>, Collects file from the host and stores them in the build directory.
tcib_gather_files: []

Molecule Scenarios

Molecule is being used to test the “tripleo_container_image_build” role. The following section highlights the drivers in service and provides an example playbook showing how the role is leveraged.

Scenario: default

Driver: podman
Molecule Inventory
hosts:
  all:
    hosts:
      centos:
        ansible_python_interpreter: /usr/bin/python3
Example default playbook
- name: Converge
  hosts: all
  roles:
  - role: tripleo_container_image_build

This is an example application variable file.

---

# FROM
tcib_from: "ubi8"

# Path where container file be generated
tcib_path: "{{ lookup('env', 'HOME') }}/tripleo-base"

# this ends up being a LABEL
tcib_labels:
  maintainer: "TripleO"

# ENTRYPOINT
tcib_entrypoint: "dumb-init --single-child --"

# STOPSIGNAL
tcib_stopsignal: "SIGTERM"

# ENV
tcib_envs:
  LANG: en_US.UTF-8

# RUN commands
tcib_runs:
  - mkdir -p /etc/ssh
  - touch /etc/ssh/ssh_known_host
  - mkdir -p /openstack
  - dnf install -y crudini curl

# COPY
tcib_copies:
  - /usr/share/tripleo-common/healthcheck/common.sh /openstack/common.sh

This role can be used with the TripleO playbook, cli-generate-containerfile.yaml.

ansible-playbook -i 'localhost,' /usr/share/ansible/tripleo-playbooks/cli-generate-containerfile.yaml -e @~/tripleo-base.yaml