ci(ovn): add verification tests for database (#1048)

Signed-off-by: Mohammed Naser <mnaser@vexxhost.com>
diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml
index f67102a..30f6b93 100644
--- a/zuul.d/jobs.yaml
+++ b/zuul.d/jobs.yaml
@@ -17,6 +17,8 @@
     parent: tox
     abstract: true
     pre-run: zuul.d/playbooks/molecule/pre.yml
+    run: zuul.d/playbooks/molecule/run.yml
+    post-run: zuul.d/playbooks/molecule/post.yml
 
 - job:
     name: atmosphere-molecule-keycloak
@@ -28,20 +30,19 @@
 - job:
     name: atmosphere-molecule-csi
     parent: atmosphere-molecule
-    run: zuul.d/playbooks/molecule-csi/run.yml
     abstract: true
 
 - job:
     name: atmosphere-molecule-csi-local-path-provisioner
     parent: atmosphere-molecule-csi
     vars:
-      csi_driver: local-path-provisioner
+      tox_envlist: molecule-csi-local-path-provisioner
 
 - job:
     name: atmosphere-molecule-csi-rbd
     parent: atmosphere-molecule-csi
     vars:
-      csi_driver: rbd
+      tox_envlist: molecule-csi-rbd
 
 - job:
     name: atmosphere-molecule-aio
@@ -49,7 +50,6 @@
     abstract: true
     timeout: 7200
     pre-run: zuul.d/playbooks/molecule-aio/pre.yml
-    run: zuul.d/playbooks/molecule-aio/run.yml
     post-run: zuul.d/playbooks/molecule-aio/post.yml
     roles:
       - zuul: openstack/openstack-helm-infra
@@ -62,10 +62,10 @@
     name: atmosphere-molecule-aio-openvswitch
     parent: atmosphere-molecule-aio
     vars:
-      network_backend: openvswitch
+      tox_envlist: molecule-aio-openvswitch
 
 - job:
     name: atmosphere-molecule-aio-ovn
     parent: atmosphere-molecule-aio
     vars:
-      network_backend: ovn
+      tox_envlist: molecule-aio-ovn
diff --git a/zuul.d/playbooks/molecule-aio/run.yml b/zuul.d/playbooks/molecule-aio/run.yml
deleted file mode 100644
index 92bdf0c..0000000
--- a/zuul.d/playbooks/molecule-aio/run.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright (c) 2024 VEXXHOST, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-- hosts: all
-  become: true
-  roles:
-    - tox
-  vars:
-    tox_envlist: "molecule-aio-{{ network_backend }}"
diff --git a/zuul.d/playbooks/molecule/post.yml b/zuul.d/playbooks/molecule/post.yml
new file mode 100644
index 0000000..0ededc5
--- /dev/null
+++ b/zuul.d/playbooks/molecule/post.yml
@@ -0,0 +1,29 @@
+# Copyright (c) 2024 VEXXHOST, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+- name: Finalize Molecule tests
+  hosts: all
+  tasks:
+    # NOTE(mnaser): Since we need to run Molecule using `sudo` because
+    #               of a bug with the Kubernetes collection, we need to
+    #               restore the permissions of the repository to the
+    #               user that is running the tests.
+    - name: Fix permissions for repository
+      become: true
+      ansible.builtin.file:
+        path: "{{ zuul.project.src_dir }}"
+        state: directory
+        recurse: yes
+        owner: "{{ ansible_user }}"
+        group: "{{ ansible_user }}"
diff --git a/zuul.d/playbooks/molecule/pre.yml b/zuul.d/playbooks/molecule/pre.yml
index 447f05e..ef5bc95 100644
--- a/zuul.d/playbooks/molecule/pre.yml
+++ b/zuul.d/playbooks/molecule/pre.yml
@@ -25,3 +25,11 @@
         sed -i 's/  \(.*\): \(.*\)$/  \1: registry.atmosphere.dev\/\2/' roles/defaults/vars/main.yml
       args:
         chdir: "{{ zuul.project.src_dir }}"
+
+    # TODO(mnaser): Drop this when we move to PBR
+    - name: Add current folder to Git's safe directories
+      become: true
+      ansible.builtin.shell: |
+        git config --global --add safe.directory $(pwd)
+      args:
+        chdir: "{{ zuul.project.src_dir }}"
diff --git a/zuul.d/playbooks/molecule-csi/run.yml b/zuul.d/playbooks/molecule/run.yml
similarity index 91%
rename from zuul.d/playbooks/molecule-csi/run.yml
rename to zuul.d/playbooks/molecule/run.yml
index ce4465e..dc852f7 100644
--- a/zuul.d/playbooks/molecule-csi/run.yml
+++ b/zuul.d/playbooks/molecule/run.yml
@@ -16,5 +16,3 @@
   become: true
   roles:
     - tox
-  vars:
-    tox_envlist: "molecule-csi-{{ csi_driver }}"