diff --git a/openstack/intel-worker/playbooks/intel-worker-cleanup-image-flavor-playbook.yml b/openstack/intel-worker/playbooks/intel-worker-cleanup-image-flavor-playbook.yml new file mode 100644 index 0000000..0054ba4 --- /dev/null +++ b/openstack/intel-worker/playbooks/intel-worker-cleanup-image-flavor-playbook.yml @@ -0,0 +1,10 @@ +--- +- name: Intel worker flavor create + hosts: localhost + roles: + - custom_flavor_delete + +- name: Create RHCHOS image + hosts: localhost + roles: + - rhcos_delete_image diff --git a/openstack/intel-worker/playbooks/intel-worker-cleanup-playbook.yml b/openstack/intel-worker/playbooks/intel-worker-cleanup-playbook.yml index f9d940d..3914698 100644 --- a/openstack/intel-worker/playbooks/intel-worker-cleanup-playbook.yml +++ b/openstack/intel-worker/playbooks/intel-worker-cleanup-playbook.yml @@ -19,13 +19,3 @@ loop_var: iteration vars: vm_delete_name: "rdr-mac-worker-openstack-{{ iteration }}" - -- name: Intel worker flavor create - hosts: localhost - roles: - - custom_flavor_delete - -- name: Create RHCHOS image - hosts: localhost - roles: - - rhcos_delete_image diff --git a/openstack/intel-worker/playbooks/intel-worker-add-playbook.yml b/openstack/intel-worker/playbooks/intel-worker-create-add-playbook.yml similarity index 61% rename from openstack/intel-worker/playbooks/intel-worker-add-playbook.yml rename to openstack/intel-worker/playbooks/intel-worker-create-add-playbook.yml index 1730f51..284a8a3 100644 --- a/openstack/intel-worker/playbooks/intel-worker-add-playbook.yml +++ b/openstack/intel-worker/playbooks/intel-worker-create-add-playbook.yml @@ -1,14 +1,4 @@ --- -- name: Create RHCHOS image - hosts: localhost - roles: - - rhcos_create_image - -- name: Intel worker flavor create - hosts: localhost - roles: - - custom_flavor_create - - name: Loop over virtual machine create role in the playbook with dynamic variable names hosts: localhost vars: @@ -30,17 +20,3 @@ - csr_approve vars: csr_approve_intel_count: 3 - -- name: Intel worker vitrual_machine create - hosts: localhost - roles: - - vm_action - vars: - vm_action_name: stop - -- name: Intel worker vitrual_machine create - hosts: localhost - roles: - - vm_action - vars: - vm_action_name: start diff --git a/openstack/intel-worker/playbooks/intel-worker-create-image-flavor-playbook.yml b/openstack/intel-worker/playbooks/intel-worker-create-image-flavor-playbook.yml new file mode 100644 index 0000000..54586f6 --- /dev/null +++ b/openstack/intel-worker/playbooks/intel-worker-create-image-flavor-playbook.yml @@ -0,0 +1,10 @@ +--- +- name: Create RHCHOS image + hosts: localhost + roles: + - rhcos_create_image + +- name: Intel worker flavor create + hosts: localhost + roles: + - custom_flavor_create diff --git a/openstack/intel-worker/playbooks/intel-worker-stop-start-playbook.yml b/openstack/intel-worker/playbooks/intel-worker-stop-start-playbook.yml new file mode 100644 index 0000000..892ecc5 --- /dev/null +++ b/openstack/intel-worker/playbooks/intel-worker-stop-start-playbook.yml @@ -0,0 +1,14 @@ +--- +- name: Intel worker vitrual_machine create + hosts: localhost + roles: + - vm_action + vars: + vm_action_name: stop + +- name: Intel worker vitrual_machine create + hosts: localhost + roles: + - vm_action + vars: + vm_action_name: start diff --git a/openstack/intel-worker/playbooks/roles/vm_create/defaults/main.yml b/openstack/intel-worker/playbooks/roles/vm_create/defaults/main.yml index d5d0c0b..40d97ae 100644 --- a/openstack/intel-worker/playbooks/roles/vm_create/defaults/main.yml +++ b/openstack/intel-worker/playbooks/roles/vm_create/defaults/main.yml @@ -3,12 +3,12 @@ vm_create_name: rdr-mac-worker-openstack vm_create_region_name: RegionOne vm_create_availability_zone: Test -vm_create_image_name: 4df699b6-6877-4b77-9ddb-0d6dc9cefb68 +vm_create_image_name: d424a441-6b4c-4e22-adb7-69935b398579 vm_create_flavor: "m1.medium" vm_create_volume_size: 80 vm_create_keypair_name: pun_keypair vm_create_network_name: provider -vm_create_userdata: "{{ lookup('template', 'worker-amd64.ign.j2') }}" +vm_create_userdata: "{{ lookup('file', '/tmp/worker-amd64.ign') | string }}" vm_create_timeout: 300 vm_create_count: 3 diff --git a/openstack/intel-worker/playbooks/roles/vm_create/tasks/get_vm.yml b/openstack/intel-worker/playbooks/roles/vm_create/tasks/get_vm.yml index 0172fe9..7c62a9c 100644 --- a/openstack/intel-worker/playbooks/roles/vm_create/tasks/get_vm.yml +++ b/openstack/intel-worker/playbooks/roles/vm_create/tasks/get_vm.yml @@ -4,19 +4,10 @@ cloud: openstack name: "{{ vm_create_name }}" register: vm_info + until: vm_info.servers[0].status == "ACTIVE" + retries: 60 + delay: 10 - name: Print virtual machine vm_info ansible.builtin.debug: var: vm_info - -- name: Wait for instance to become active - ansible.builtin.wait_for: - timeout: 300 - delay: 5 - host: "{{ vm_info.servers[0].name }}" - port: "{{ vm_info.servers[0].addresses['private'].ipv4 }}" - state: started - search_regex: active - until: vm_info.servers[0].status == 'ACTIVE' - retries: 60 - delay: 10