From 90aba7ea275908a33781166a519a475e6ad24e35 Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Tue, 24 Apr 2018 16:46:06 +0200 Subject: [PATCH] Fix path and wire-in UC deploy role data file It had been missing for some places and now that technical debt gets addressed. Depends-on: Iaef2671acf516b7e89358984a0d8a59555fc91f0 Change-Id: I887d5bccc6bd5c514348d8ebfc7c13f0bcdc217d Signed-off-by: Bogdan Dobrelya --- .../custom-undercloud-roles-file-3603a5e98e2b12d5.yaml | 10 ++++++++++ roles/undercloud-deploy/README.md | 10 +++++----- roles/undercloud-deploy/defaults/main.yml | 5 ----- .../templates/undercloud-deploy.sh.j2 | 6 +++--- .../templates/undercloud-prep-containers.sh.j2 | 2 +- roles/undercloud-deploy/templates/undercloud.conf.j2 | 4 ++++ 6 files changed, 23 insertions(+), 14 deletions(-) create mode 100644 releasenotes/notes/custom-undercloud-roles-file-3603a5e98e2b12d5.yaml diff --git a/releasenotes/notes/custom-undercloud-roles-file-3603a5e98e2b12d5.yaml b/releasenotes/notes/custom-undercloud-roles-file-3603a5e98e2b12d5.yaml new file mode 100644 index 000000000..35fbcde6a --- /dev/null +++ b/releasenotes/notes/custom-undercloud-roles-file-3603a5e98e2b12d5.yaml @@ -0,0 +1,10 @@ +--- +fixes: + - | + Fix `undercloud_roles_data` to contain a relative path as tripleoclient + expects it. +other: + - | + ``undercloud deploy`` CLI now supports `undercloud_roles_data`. + It can also be defined in `undercloud.conf` as `roles_file` to be + used with ``undercloud install --use-heat`` as well. diff --git a/roles/undercloud-deploy/README.md b/roles/undercloud-deploy/README.md index 9a1dfde7a..9bab5f6e2 100644 --- a/roles/undercloud-deploy/README.md +++ b/roles/undercloud-deploy/README.md @@ -96,6 +96,8 @@ https://docs.openstack.org/tripleo-quickstart/latest/accessing-libvirt.html - `undercloud_upgrade_cleanup`: -- controls post upgrade cleanup after we containerize the undercloud. - update_containers: -- whether to update containers from the local registry. - `undercloud_enable_tempest`: -- The tempest container will be available on the undercloud. +- `undercloud_roles_data`: -- A custom t-h-t roles file (the path must be relative to + ``overcloud_templates_path``). Role Network Variables ---------------------- @@ -274,11 +276,9 @@ Mistral). If you need a lightweight undercloud, make sure your custom undercloud installation script template omits those services and the `environments/docker.yaml` defaults. -Also note, if you want to override the undercloud roles data, you should -provide a custom roles file and put it in place of the default -`./roles_data_undercloud.yaml` by the given ``overcloud_templates_path``. -This can be done with a ``cp`` command in the custom undercloud deploy -script. For the example above, custom undercloud roles may look like: +You may also override ``undercloud_roles_data`` with a custom roles file +(the path must be relative to the t-h-t templates ``overcloud_templates_path``). +For the example above, custom undercloud roles may look like: ``` - name: Undercloud diff --git a/roles/undercloud-deploy/defaults/main.yml b/roles/undercloud-deploy/defaults/main.yml index b637039f7..f2c0f9fc0 100644 --- a/roles/undercloud-deploy/defaults/main.yml +++ b/roles/undercloud-deploy/defaults/main.yml @@ -14,11 +14,6 @@ undercloud_docker_registry_namespace: "{{ docker_registry_namespace }}" undercloud_docker_image_tag: "{{ docker_image_tag }}" undercloud_install_script: undercloud-install.sh.j2 -# defines a custom undercloud roles file should be used with -# openstack overcloud container image prepare (and undercloud deploy, in future) -# FIXME(bogdando): do not attempt to change it yet the client's hardcode is fixed -undercloud_roles_data: "{{overcloud_templates_path}}/roles_data_undercloud.yaml" - # defines extra args for the undercloud deploy command undercloud_extra_args: "" diff --git a/roles/undercloud-deploy/templates/undercloud-deploy.sh.j2 b/roles/undercloud-deploy/templates/undercloud-deploy.sh.j2 index 7ca7cfb18..bed032cf8 100644 --- a/roles/undercloud-deploy/templates/undercloud-deploy.sh.j2 +++ b/roles/undercloud-deploy/templates/undercloud-deploy.sh.j2 @@ -32,9 +32,6 @@ undercloud_local_ip={{ hostvars['undercloud'].undercloud_ip }} ## * Deploy the undercloud ## :: -# TODO(bogdando) add '-r {{undercloud_roles_data}}' once the client -# starts supporting 'openstack undercloud deploy -r' option. - {% if release in ['pike', 'queens'] -%} {%- set env_files_path='services-docker' -%} {%- else -%} @@ -83,6 +80,9 @@ sudo openstack undercloud deploy \ -e {{ f }} \ {% endfor %} {% endif %} +{% if release not in ['pike', 'queens'] and undercloud_roles_data is defined -%} + -r {{undercloud_roles_data}} \ +{% endif %} {% if undercloud_extra_args %} {{ undercloud_extra_args }} \ {% endif %} diff --git a/roles/undercloud-deploy/templates/undercloud-prep-containers.sh.j2 b/roles/undercloud-deploy/templates/undercloud-prep-containers.sh.j2 index 4039221e1..a3b80c5e1 100644 --- a/roles/undercloud-deploy/templates/undercloud-prep-containers.sh.j2 +++ b/roles/undercloud-deploy/templates/undercloud-prep-containers.sh.j2 @@ -64,7 +64,7 @@ openstack overcloud container image prepare \ {% endfor %} -e {{ working_dir }}/undercloud-parameter-defaults.yaml \ {% endif %} - -r {{undercloud_roles_data}} \ + -r {{undercloud_roles_data|default('roles_data_undercloud.yaml')}} \ --namespace {{ undercloud_docker_registry_host }}{% if undercloud_docker_registry_port is defined %}:{{ undercloud_docker_registry_port }}{% endif%}/{{ undercloud_docker_registry_namespace }} \ --tag $BUILD_ID diff --git a/roles/undercloud-deploy/templates/undercloud.conf.j2 b/roles/undercloud-deploy/templates/undercloud.conf.j2 index ac72f5168..cc8eecb4c 100644 --- a/roles/undercloud-deploy/templates/undercloud.conf.j2 +++ b/roles/undercloud-deploy/templates/undercloud.conf.j2 @@ -311,6 +311,10 @@ templates = {{overcloud_templates_path}} enable_routed_networks = {{undercloud_enable_routed_networks}} {% endif %} +{% if undercloud_roles_data is defined %} +roles_file = {{undercloud_roles_data}} +{% endif %} + # Whether to clean overcloud nodes (wipe the hard drive) between # deployments and after the introspection. {% if undercloud_clean_nodes is defined %}