diff --git a/ansible/roles/public-openrc/tasks/main.yml b/ansible/roles/public-openrc/tasks/main.yml
index b805e8660739b57b7643eec0d72c0ac4deb87198..baee4d995d9923d493252fc97b9c8307deb1f1aa 100644
--- a/ansible/roles/public-openrc/tasks/main.yml
+++ b/ansible/roles/public-openrc/tasks/main.yml
@@ -3,8 +3,10 @@
   slurp:
     src: "{{ kolla_config_path }}/admin-openrc.sh"
   register: admin_openrc
+  when: (kolla_config_path ~ '/admin-openrc.sh') is exists
 
 - name: Ensure a public OpenStack API environment file exists
   template:
     src: public-openrc.sh.j2
     dest: "{{ public_openrc_kolla_config_path }}/public-openrc.sh"
+  when: admin_openrc is not skipped
diff --git a/releasenotes/notes/fix-failure-to-generate-openrc-when-using-tags-c8e554173e0b9ac3.yaml b/releasenotes/notes/fix-failure-to-generate-openrc-when-using-tags-c8e554173e0b9ac3.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..5c564192fc99014526da7f4b22da4862762f0934
--- /dev/null
+++ b/releasenotes/notes/fix-failure-to-generate-openrc-when-using-tags-c8e554173e0b9ac3.yaml
@@ -0,0 +1,8 @@
+---
+fixes:
+  - |
+    ``public-openrc.sh`` is now only generated if the ``admin-openrc.sh`` file
+    generated by Kolla Ansible exists. This fixes an issue where the task would
+    fail, when running in a clean environment, with a set of Kolla Ansible tags
+    that did not include the generation of ``admin-openrc.sh``. See `story
+    2009323 <https://storyboard.openstack.org/#!/story/2009323>`__.