From 6c4f179b6efcf1d5e548ed142f80e6286519fdc5 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Tue, 21 Nov 2017 17:25:15 +0000 Subject: [PATCH] Add support for free-form configuration of kolla-build.conf Provide extra configuration of kolla-build.conf via $KAYOBE_CONFIG_PATH/kolla/kolla-build.conf. --- ansible/kolla-build.yml | 1 + ansible/roles/kolla-build/defaults/main.yml | 6 ++++++ ansible/roles/kolla-build/tasks/main.yml | 14 ++++++++++++++ .../kolla-build/templates/kolla-build.conf.j2 | 8 ++++++++ 4 files changed, 29 insertions(+) diff --git a/ansible/kolla-build.yml b/ansible/kolla-build.yml index 4a5a4aa5c..227a883f7 100644 --- a/ansible/kolla-build.yml +++ b/ansible/kolla-build.yml @@ -4,3 +4,4 @@ roles: - role: kolla - role: kolla-build + kolla_build_extra_config_path: "{{ kayobe_config_path }}/kolla/kolla-build.conf" diff --git a/ansible/roles/kolla-build/defaults/main.yml b/ansible/roles/kolla-build/defaults/main.yml index cd0d6d4ad..3987c3add 100644 --- a/ansible/roles/kolla-build/defaults/main.yml +++ b/ansible/roles/kolla-build/defaults/main.yml @@ -2,6 +2,9 @@ # Directory where Kolla config files will be installed. kolla_build_config_path: +# Path to extra kolla configuration files. +kolla_build_extra_config_path: + # Valid options are [ centos, fedora, oraclelinux, ubuntu ] kolla_base_distro: @@ -34,3 +37,6 @@ kolla_build_blocks: {} # most commonly packages. The operation should be one of override, append or # remove. The value should be a list. kolla_build_customizations: {} + +# Free-form extra configuration for kolla-build. +kolla_extra_build: {} diff --git a/ansible/roles/kolla-build/tasks/main.yml b/ansible/roles/kolla-build/tasks/main.yml index 766588fb3..08d6a74a2 100644 --- a/ansible/roles/kolla-build/tasks/main.yml +++ b/ansible/roles/kolla-build/tasks/main.yml @@ -1,4 +1,18 @@ --- +- name: Check whether a Kolla build extra configuration file exists + local_action: + module: stat + path: "{{ kolla_build_extra_config_path }}" + get_checksum: False + get_md5: False + mime: False + register: stat_result + +- name: Set a fact containing extra configuration + set_fact: + kolla_build_extra_config: "{{ lookup('template', kolla_build_extra_config_path) }}" + when: stat_result.stat.exists + - name: Ensure the Kolla build configuration files exist template: src: "{{ item.src }}" diff --git a/ansible/roles/kolla-build/templates/kolla-build.conf.j2 b/ansible/roles/kolla-build/templates/kolla-build.conf.j2 index c4cd7fefc..704dc070c 100644 --- a/ansible/roles/kolla-build/templates/kolla-build.conf.j2 +++ b/ansible/roles/kolla-build/templates/kolla-build.conf.j2 @@ -33,3 +33,11 @@ reference = {{ source_def.reference }} {% endif %} {% endfor %} + +{% if kolla_build_extra_config is defined %} +####################### +# Extra configuration +####################### + +{{ kolla_build_extra_config }} +{% endif %}