From 453cbda541c5f875ca83052e15e4522cdda44f58 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Thu, 30 Mar 2017 11:07:58 +0100 Subject: [PATCH] Add support for configuration of Jinja2 blocks in kolla images --- ansible/group_vars/all/kolla | 3 +++ ansible/roles/kolla-build/defaults/main.yml | 3 +++ .../roles/kolla-build/templates/template-override.j2.j2 | 7 +++++++ etc/kayobe/kolla.yml | 6 ++++++ 4 files changed, 19 insertions(+) diff --git a/ansible/group_vars/all/kolla b/ansible/group_vars/all/kolla index a51b460a3..0f47af823 100644 --- a/ansible/group_vars/all/kolla +++ b/ansible/group_vars/all/kolla @@ -131,6 +131,9 @@ controller_container_image_regexes: "{{ controller_container_image_regex_map | s controller_container_image_sets: - regexes: "{{ controller_container_image_regexes | join(' ') }}" +# Dict mapping Jinja2 block names in kolla's Docker images to their contents. +kolla_build_blocks: {} + ############################################################################### # Kolla-ansible configuration. diff --git a/ansible/roles/kolla-build/defaults/main.yml b/ansible/roles/kolla-build/defaults/main.yml index df2cf3e89..8c1012c34 100644 --- a/ansible/roles/kolla-build/defaults/main.yml +++ b/ansible/roles/kolla-build/defaults/main.yml @@ -23,3 +23,6 @@ kolla_openstack_release: # location: https://github.com/openstack/ironic # reference: master kolla_sources: {} + +# Dict mapping Jinja2 block names in kolla's Docker images to their contents. +kolla_build_blocks: {} diff --git a/ansible/roles/kolla-build/templates/template-override.j2.j2 b/ansible/roles/kolla-build/templates/template-override.j2.j2 index fb7ab8daf..eb45061dd 100644 --- a/ansible/roles/kolla-build/templates/template-override.j2.j2 +++ b/ansible/roles/kolla-build/templates/template-override.j2.j2 @@ -3,3 +3,10 @@ {% raw %} {% extends parent_template %} {% endraw %} + +{% for block_name, block_contents in kolla_build_blocks.items() %} +{{ '{% block ' ~ block_name ~ ' %}' }} +{{ block_contents }} +{{ '{% endblock %}' }} + +{% endfor %} diff --git a/etc/kayobe/kolla.yml b/etc/kayobe/kolla.yml index c3a73d095..c467e7eb9 100644 --- a/etc/kayobe/kolla.yml +++ b/etc/kayobe/kolla.yml @@ -49,6 +49,12 @@ # reference: master #kolla_sources: +############################################################################### +# Kolla image build configuration. + +# Dict mapping Jinja2 block names in kolla's Docker images to their contents. +#kolla_build_blocks: + ############################################################################### # Kolla-ansible configuration.