diff --git a/ansible/playbooks/openstack-vms.yml b/ansible/playbooks/openstack-vms.yml index 7733d27..16e3685 100644 --- a/ansible/playbooks/openstack-vms.yml +++ b/ansible/playbooks/openstack-vms.yml @@ -1,9 +1,16 @@ --- - hosts: localhost + vars: + vm_status: "{{ lookup('file', '/deployments/{{ os_project }}-{{ win_project }}/VM_STATUS') }}" vars_files: - ../vars/common.yml - ../vars/{{ project_zone }}.yml tasks: + - name: End early if VM already created + block: + - meta: end_play + when: vm_status == 'created' + - name: Create workbench VMs (ASYNCHRONUS) tags: teardown os_server: @@ -298,4 +305,14 @@ type: server variant: web_proxy os: linux - when: project_zone == 'protected' \ No newline at end of file + when: project_zone == 'protected' + + - name: Set VM Status + vars: + ansible_connection: local + replace: + path: /deployments/{{ os_project }}-{{ win_project }}/VM_STATUS + regexp: '^pending$' + replace: 'created' + delegate_to: localhost + run_once: True \ No newline at end of file