9a7fae1973
Logs are sent to stderr as of pike.
46 lines
1.7 KiB
YAML
46 lines
1.7 KiB
YAML
---
|
|
- name: Ensure Kolla container images are built
|
|
hosts: seed:controllers
|
|
vars:
|
|
# Set this to True to push images to the registry when built.
|
|
push_images: False
|
|
# Set this variable to a space-separated list of regexes to override the
|
|
# default set of images.
|
|
container_image_regexes: ""
|
|
kolla_venv: "{{ ansible_env['PWD'] }}/kolla-venv"
|
|
kolla_build_log_path: "/var/log/kolla-build.log"
|
|
tasks:
|
|
- name: Set the container image sets to build if images regexes specified
|
|
set_fact:
|
|
container_image_sets:
|
|
- regexes: "{{ container_image_regexes }}"
|
|
when: "{{ container_image_regexes != '' }}"
|
|
|
|
- name: Display the regexes for container images that will be built
|
|
debug:
|
|
msg: >
|
|
Building container images of type
|
|
'{{ item.type | default(kolla_install_type) }}' matching
|
|
'{{ item.regexes }}'. Build logs will be appended to
|
|
{{ kolla_build_log_path }}.
|
|
with_items: "{{ container_image_sets }}"
|
|
|
|
- name: Ensure Kolla build log file exists
|
|
file:
|
|
path: "{{ kolla_build_log_path }}"
|
|
state: touch
|
|
owner: "{{ ansible_user }}"
|
|
group: "{{ ansible_user }}"
|
|
become: True
|
|
|
|
- name: Ensure Kolla container images are built
|
|
shell: >
|
|
set -o pipefail &&
|
|
source {{ kolla_venv }}/bin/activate &&
|
|
kolla-build \
|
|
--config-dir {{ kolla_config_path }} \
|
|
{% if item.type is defined %}--type {{ item.type }}{% endif %} \
|
|
{% if push_images | bool %}--push{% endif %} \
|
|
{{ item.regexes }} 2>&1 | tee --append {{ kolla_build_log_path }}
|
|
with_items: "{{ container_image_sets }}"
|