From adcdb7ed4d9cc643eebf95bbf6d6103a8e4969ba Mon Sep 17 00:00:00 2001 From: alextricity25 Date: Sun, 23 Apr 2017 22:33:21 -0500 Subject: [PATCH] Add variable for template filename The current logic for constructing the template filename does not allow custom scenario names. For example, if an outside playbook defines ``boostrap_host_scenario`` to be "swift" or "awesome_scenario", then the task would try to look for the user_variables.swlft.yml.j2 template within the role. This commit allows the user to define a template filename using the variable bootstrap_user_variables_template. Change-Id: I9fc98ea9b7d68623cb42c5fa3b9d5383fadb82d8 --- .../notes/add-template-file-var-cac35a99a3faf563.yaml | 6 ++++++ tests/roles/bootstrap-host/defaults/main.yml | 3 +++ tests/roles/bootstrap-host/tasks/prepare_aio_config.yml | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/add-template-file-var-cac35a99a3faf563.yaml diff --git a/releasenotes/notes/add-template-file-var-cac35a99a3faf563.yaml b/releasenotes/notes/add-template-file-var-cac35a99a3faf563.yaml new file mode 100644 index 0000000000..0d2dcc5799 --- /dev/null +++ b/releasenotes/notes/add-template-file-var-cac35a99a3faf563.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + A variable named ``bootstrap_user_variables_template`` has been added + to the bootstrap-host role so the user can define the user variable + template filename for AIO deployments diff --git a/tests/roles/bootstrap-host/defaults/main.yml b/tests/roles/bootstrap-host/defaults/main.yml index 24c012595b..4103055ba6 100644 --- a/tests/roles/bootstrap-host/defaults/main.yml +++ b/tests/roles/bootstrap-host/defaults/main.yml @@ -31,6 +31,9 @@ bootstrap_host_aio_script_path: "{{ playbook_dir }}/../scripts" bootstrap_host_user_variables_filename: "user_variables.yml" bootstrap_host_user_secrets_filename: "user_secrets.yml" +# The user variables template to use +bootstrap_user_variables_template: "user_variables.{{ bootstrap_host_scenario }}.yml.j2" + ## Swap memory # If there is no swap memory present, the bootstrap will create a loopback disk # for the purpose of having swap memory available. Swap is required for some of diff --git a/tests/roles/bootstrap-host/tasks/prepare_aio_config.yml b/tests/roles/bootstrap-host/tasks/prepare_aio_config.yml index 43982e3d7c..b89edbd3dc 100644 --- a/tests/roles/bootstrap-host/tasks/prepare_aio_config.yml +++ b/tests/roles/bootstrap-host/tasks/prepare_aio_config.yml @@ -113,7 +113,7 @@ - name: Set the user_variables config_template: - src: "user_variables.{{ bootstrap_host_scenario }}.yml.j2" + src: "{{ bootstrap_user_variables_template }}" dest: "/etc/openstack_deploy/{{ bootstrap_host_user_variables_filename }}" config_overrides: "{{ user_variables_overrides | default({}) }}" config_type: yaml