Ansible playbook driver options
Ansible playbook driver options specification
A builder provides relevant information about how to build a Docker image. It is defined using a YAML data structure, and its schema is described on Keywords reference for builders configuration.
There are two types of builders: global and in-line. Global builders are defined in the builders configuration file and can be used by any image. Information on how to set the location path for the builders configuration file can be found in the configuration documentation.
In-line builders, on the other hand, are defined within the image definition itself.
A global builder must be defined under the builders
block inside the Stevedore configuration. It means that Stevedore looks for the builders
block within the file defined in builder_path configuration parameter.
|
|
builder1
, builder2
and builder3
, all of them are defined within the builders
block.Through Stevedore CLI command, you can retrieve the value of the builder_path configuration parameter.
$ stevedore get configuration
PARAMETER VALUE
tree_path stevedore.yaml
builder_path stevedore.yaml
log_path /dev/null
num_workers 4
push_images true
build_on_cascade false
docker_registry_credentials_dir ~/.config/stevedore/credentials
semantic_version_tags_enabled false
semantic_version_tags_templates [{{ .Major }}.{{ .Minor }}.{{ .Patch }}]
When you want to create an image using an ad-hoc builder, you can provide it in the image definition itself. In that case, the builder is known as an in-line builder.
In-line builders are defined following the Keywords reference for builders configuration as well.
|
|
The coming section describes the keyword attributes required to define a builder.
Keyword | Type | Description | Value |
---|---|---|---|
name | string | Name of the builder optional | When you create a global builder, by default its name is inherited from the key used within the builders’ data structure. If the builder is defined as an in-line builder, its name is set as the image’s name. |
driver | string | Driver to be used to build the image mandatory | The allowed values are: - ansible-playbook - docker |
options | map | Options hold those parameters required by the driver mandatory | Each driver requires its own configuration parameters. Refer to the options reference for a detailed description. |
variables_mapping | map | Stevedore creates automatically a bunch of parameters, such as the image name or image version. The variables mapping is a key-value data structure where you can override the name of those variables that Stevedore creates and passes to drivers. optional | Each driver requires its own variables mapping. Refer to the variables mapping for a detailed description. |
Builder options are defined in a YAML data structure, and each driver has its own unique set of options. To learn more about which options are accepted by a particular driver, refer to the corresponding section:
Stevedore always sends a set of parameters to the driver when building a Docker image. These parameters are organized in a key-value data structure called variables_mapping
. Importantly, these parameters are sent to the driver by Stevedore regardless of whether they have been explicitly specified in the image definition or as a CLI flag.
When Stevedore sets a parameter, it looks for the corresponding argument-name in the variables_mapping
block within the builder’s definition. Users can override the default value of the argument-name by setting a new value for the argument in the variables_mapping
block.
It’s important to understand the concepts within the variables-mapping context, such as the key name, argument name, and argument value:
Each drivers receives a distinct set of parameters comming from variables-mapping. Refer to the following links to know more about variables that each driver receives:
The following example demonstrates how to define a builder that uses Docker as the driver, with a local build context and a Dockerfile located at build/Dockerfile
:
|
|
The following example demonstrates how to define a builder that uses Docker as the driver, with a remote Git repository as the build context and a Dockerfile located at build/Dockerfile
. In this example, the Git repository https://github.com/apenella/simple-go-helloworld.git
is used as the build context with the reference v0.0.0
.
|
|
The following example shows how to define a builder that uses the ansible-playbook driver. In this example, the builder optiosn defines the ansible inventory and playbook, pointing to the Ansible inventory file located at inventory/all and the playbook file located at build_applications.yml.
|
|
Ansible playbook driver options specification
Docker driver options specification