diff --git a/ansible/kolla-ansible.yml b/ansible/kolla-ansible.yml
index f445c4f6357e9e4355d8cd31aef9d3cd7fdc30f1..7a5f9e499adb6436a63308a7d6f8cd09d78bd96d 100644
--- a/ansible/kolla-ansible.yml
+++ b/ansible/kolla-ansible.yml
@@ -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' }}"
diff --git a/ansible/roles/kolla-ansible/tasks/config.yml b/ansible/roles/kolla-ansible/tasks/config.yml
index 8e9accd4e751525ac6e996af312aaf77902c038d..79f61c638f1f267611031977a565d46f12d82d16 100644
--- a/ansible/roles/kolla-ansible/tasks/config.yml
+++ b/ansible/roles/kolla-ansible/tasks/config.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"