diff --git a/tasks/nova_db_setup.yml b/tasks/nova_db_setup.yml index 62c6bf47..21d0dd16 100644 --- a/tasks/nova_db_setup.yml +++ b/tasks/nova_db_setup.yml @@ -13,11 +13,24 @@ # See the License for the specific language governing permissions and # limitations under the License. +- name: Get the api_db version + command: "{{ nova_bin }}/nova-manage api_db version" + become: yes + become_user: "{{ nova_system_user_name }}" + register: nova_api_db_version + changed_when: false + tags: + - nova-db-setup + - nova-setup + - nova-command-bin + - name: Perform a Nova API DB sync command: "{{ nova_bin }}/nova-manage --config-file /etc/nova/nova.conf api_db sync" become: yes become_user: "{{ nova_system_user_name }}" changed_when: false + when: + - nova_api_db_version.stdout == "0" tags: - nova-db-setup - nova-setup @@ -45,6 +58,16 @@ - nova-setup - nova-command-bin +- name: Perform a Nova API DB sync + command: "{{ nova_bin }}/nova-manage --config-file /etc/nova/nova.conf api_db sync" + become: yes + become_user: "{{ nova_system_user_name }}" + changed_when: false + tags: + - nova-db-setup + - nova-setup + - nova-command-bin + - name: Perform a Nova DB sync command: "{{ nova_bin }}/nova-manage --config-file /etc/nova/nova.conf db sync" become: yes