Exit when environment clashes are detected
When running kolla-ansible using a Kayobe environment, write the environment name to $KOLLA_CONFIG_PATH/.environment. In later executions, check that the environment name is the same. Warn user to clean up $KOLLA_CONFIG_PATH otherwise. Change-Id: Ibbb1fdcad4034620ff8fbfe184d803bcc86f53f9 Story: 2002009 Task: 42185
This commit is contained in:
parent
ea54f82299
commit
18a25fdb05
@ -28,8 +28,30 @@
|
||||
- kolla-ansible
|
||||
gather_facts: false
|
||||
pre_tasks:
|
||||
# Configuration of extra user-provided Kolla globals.
|
||||
- block:
|
||||
- name: Look for environment file in Kolla configuration path
|
||||
stat:
|
||||
path: "{{ kolla_config_path ~ '/.environment' }}"
|
||||
get_checksum: False
|
||||
get_md5: False
|
||||
mime: False
|
||||
register: kolla_environment_file
|
||||
|
||||
- name: Flag that the Kolla configuration path has been used by another environment
|
||||
vars:
|
||||
kolla_environment: "{{ lookup('file', kolla_config_path ~ '/.environment') }}"
|
||||
fail:
|
||||
msg: >
|
||||
The Kolla configuration path at {{ kolla_config_path }} was
|
||||
already used by environment {{ kolla_environment }}. You should
|
||||
clean up this directory, including the environment file located
|
||||
at {{ kolla_config_path ~ '/.environment' }}, before running
|
||||
Kayobe again.
|
||||
when:
|
||||
- kolla_environment_file.stat.exists
|
||||
- kolla_environment != kayobe_environment
|
||||
|
||||
# Configuration of extra user-provided Kolla globals.
|
||||
- name: Check whether a Kolla extra globals configuration file exists
|
||||
stat:
|
||||
path: "{{ kayobe_env_config_path ~ '/kolla/globals.yml' }}"
|
||||
|
@ -40,6 +40,13 @@
|
||||
- "{{ kolla_overcloud_inventory_path }}/group_vars"
|
||||
- "{{ kolla_node_custom_config_path }}"
|
||||
|
||||
- name: Write environment file into Kolla configuration path
|
||||
copy:
|
||||
dest: "{{ kolla_config_path ~ '/.environment' }}"
|
||||
content: |
|
||||
{{ kayobe_environment }}
|
||||
when: (kayobe_environment | default('')) | length > 0
|
||||
|
||||
- name: Ensure the Kolla global configuration file exists
|
||||
template:
|
||||
src: "globals.yml.j2"
|
||||
|
Loading…
Reference in New Issue
Block a user