From 0eb358d3e4419a6079a81dd0cdc99e208e4614b2 Mon Sep 17 00:00:00 2001 From: Jack Hodgkiss Date: Fri, 21 Feb 2025 15:53:39 +0000 Subject: [PATCH] Add support for making `Bifrost` optional Add `kolla_enable_bifrost` to make deploying Bifrost optional. It defaults to `true` maintaining the current behavior. Change-Id: I7c5ac03b3ceb3f558480044f385636936df90f8f --- ansible/inventory/group_vars/all/bifrost | 3 + ansible/kolla-bifrost.yml | 2 + ansible/roles/kolla-ansible/defaults/main.yml | 6 ++ ansible/roles/kolla-ansible/templates/seed.j2 | 2 + ansible/seed-credentials.yml | 69 ++++++++++--------- ansible/seed-introspection-rules.yml | 1 + etc/kayobe/bifrost.yml | 3 + etc/kayobe/kolla.yml | 1 + ...ake-bifrost-optional-32d89388cb2e578e.yaml | 5 ++ 9 files changed, 59 insertions(+), 33 deletions(-) create mode 100644 releasenotes/notes/make-bifrost-optional-32d89388cb2e578e.yaml diff --git a/ansible/inventory/group_vars/all/bifrost b/ansible/inventory/group_vars/all/bifrost index 4d2e41aec..d9bfe0013 100644 --- a/ansible/inventory/group_vars/all/bifrost +++ b/ansible/inventory/group_vars/all/bifrost @@ -4,6 +4,9 @@ ############################################################################### # Bifrost installation. +# Whether to install Bifrost. Default is true. +kolla_enable_bifrost: true + # URL of Bifrost source code repository. kolla_bifrost_source_url: "https://opendev.org/openstack/bifrost" diff --git a/ansible/kolla-bifrost.yml b/ansible/kolla-bifrost.yml index b22c9eb42..ea2029098 100644 --- a/ansible/kolla-bifrost.yml +++ b/ansible/kolla-bifrost.yml @@ -17,3 +17,5 @@ kolla_bifrost_config_paths_static: - "{{ kayobe_config_path }}" kolla_bifrost_config_paths_extra: "{{ kolla_bifrost_config_paths_static + kayobe_env_search_paths }}" + kolla_bifrost_config_files: + when: kolla_enable_bifrost | bool diff --git a/ansible/roles/kolla-ansible/defaults/main.yml b/ansible/roles/kolla-ansible/defaults/main.yml index 340060844..cd215c020 100644 --- a/ansible/roles/kolla-ansible/defaults/main.yml +++ b/ansible/roles/kolla-ansible/defaults/main.yml @@ -317,3 +317,9 @@ kolla_https_proxy: # List of domains, hostnames, IP addresses and networks for which no proxy is # used. kolla_no_proxy: + +############################################################################### +# Bifrost configuration + +# Whether to install Bifrost. Default is true. +kolla_enable_bifrost: true diff --git a/ansible/roles/kolla-ansible/templates/seed.j2 b/ansible/roles/kolla-ansible/templates/seed.j2 index 18aa56610..c19398c7b 100644 --- a/ansible/roles/kolla-ansible/templates/seed.j2 +++ b/ansible/roles/kolla-ansible/templates/seed.j2 @@ -15,4 +15,6 @@ ansible_python_interpreter={{ kolla_ansible_target_venv }}/bin/python seed [bifrost:children] +{% if kolla_enable_bifrost | bool %} seed +{% endif %} diff --git a/ansible/seed-credentials.yml b/ansible/seed-credentials.yml index a5f6e393c..7d8cadf7e 100644 --- a/ansible/seed-credentials.yml +++ b/ansible/seed-credentials.yml @@ -9,39 +9,42 @@ vars: openstack_config_dir: "{{ ansible_facts.env.HOME }}/.config/openstack" tasks: - - name: Ensure OpenStack config directory exists - file: - path: "{{ openstack_config_dir }}" - state: directory - mode: 0700 + - name: Ensure credentials are available on the host + when: kolla_enable_bifrost | bool + block: + - name: Ensure OpenStack config directory exists + file: + path: "{{ openstack_config_dir }}" + state: directory + mode: 0700 - - name: Get clouds.yaml from Bifrost container - command: - cmd: "{{ container_engine }} exec bifrost_deploy cat /root/.config/openstack/clouds.yaml" - changed_when: false - register: clouds_yaml - no_log: true - become: "{{ container_engine == 'podman' }}" + - name: Get clouds.yaml from Bifrost container + command: + cmd: "{{ container_engine }} exec bifrost_deploy cat /root/.config/openstack/clouds.yaml" + changed_when: false + register: clouds_yaml + no_log: true + become: "{{ container_engine == 'podman' }}" - - name: Write clouds.yaml - copy: - content: | - {%- set clouds = clouds_yaml.stdout | from_yaml -%} - {%- for cloud in clouds.clouds.keys() | list -%} - {%- if 'cacert' in clouds.clouds[cloud] -%} - {%- set _ = clouds.clouds[cloud].update({'cacert': openstack_config_dir ~ '/bifrost.crt'}) -%} - {%- endif -%} - {%- endfor -%} - {{ clouds | to_nice_yaml }} - dest: "{{ openstack_config_dir }}/clouds.yaml" - mode: 0600 + - name: Write clouds.yaml + copy: + content: | + {%- set clouds = clouds_yaml.stdout | from_yaml -%} + {%- for cloud in clouds.clouds.keys() | list -%} + {%- if 'cacert' in clouds.clouds[cloud] -%} + {%- set _ = clouds.clouds[cloud].update({'cacert': openstack_config_dir ~ '/bifrost.crt'}) -%} + {%- endif -%} + {%- endfor -%} + {{ clouds | to_nice_yaml }} + dest: "{{ openstack_config_dir }}/clouds.yaml" + mode: 0600 - - name: Copy CA certificate from Bifrost container - vars: - clouds: "{{ clouds_yaml.stdout | from_yaml }}" - cacerts: "{{ clouds.clouds.values() | selectattr('cacert', 'defined') | map(attribute='cacert') | list }}" - command: - cmd: "{{ container_engine }} cp bifrost_deploy:{{ cacerts[0] }} {{ openstack_config_dir }}/bifrost.crt" - changed_when: false - when: cacerts | length > 0 - become: "{{ container_engine == 'podman' }}" + - name: Copy CA certificate from Bifrost container + vars: + clouds: "{{ clouds_yaml.stdout | from_yaml }}" + cacerts: "{{ clouds.clouds.values() | selectattr('cacert', 'defined') | map(attribute='cacert') | list }}" + command: + cmd: "{{ container_engine }} cp bifrost_deploy:{{ cacerts[0] }} {{ openstack_config_dir }}/bifrost.crt" + changed_when: false + when: cacerts | length > 0 + become: "{{ container_engine == 'podman' }}" diff --git a/ansible/seed-introspection-rules.yml b/ansible/seed-introspection-rules.yml index 2ceb050cb..577cb6861 100644 --- a/ansible/seed-introspection-rules.yml +++ b/ansible/seed-introspection-rules.yml @@ -20,3 +20,4 @@ inspector_rule_var_deploy_kernel: "{{ kolla_bifrost_inspector_deploy_kernel }}" inspector_rule_var_deploy_ramdisk: "{{ kolla_bifrost_inspector_deploy_ramdisk }}" inspector_rule_var_legacy_deploy_kernel: "{{ kolla_bifrost_inspector_legacy_deploy_kernel }}" + when: kolla_enable_bifrost | bool diff --git a/etc/kayobe/bifrost.yml b/etc/kayobe/bifrost.yml index 741bbd8ca..d9c2e1e9a 100644 --- a/etc/kayobe/bifrost.yml +++ b/etc/kayobe/bifrost.yml @@ -4,6 +4,9 @@ ############################################################################### # Bifrost installation. +# Whether to install Bifrost. Default is true. +#kolla_enable_bifrost: + # URL of Bifrost source code repository. #kolla_bifrost_source_url: diff --git a/etc/kayobe/kolla.yml b/etc/kayobe/kolla.yml index df44161d8..ce69e6ce1 100644 --- a/etc/kayobe/kolla.yml +++ b/etc/kayobe/kolla.yml @@ -280,6 +280,7 @@ #kolla_enable_aodh: #kolla_enable_barbican: +#kolla_enable_bifrost: #kolla_enable_blazar: #kolla_enable_ceilometer: #kolla_enable_ceilometer_horizon_policy_file: diff --git a/releasenotes/notes/make-bifrost-optional-32d89388cb2e578e.yaml b/releasenotes/notes/make-bifrost-optional-32d89388cb2e578e.yaml new file mode 100644 index 000000000..296146988 --- /dev/null +++ b/releasenotes/notes/make-bifrost-optional-32d89388cb2e578e.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Add `kolla_enable_bifrost` to make deploying Bifrost optional. It + defaults to `true` maintaining the current behavior.