Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPENSHIFTP-122: Refactor the get_vm file and image id #27

Merged
merged 2 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
10 changes: 0 additions & 10 deletions openstack/intel-worker/playbooks/intel-worker-cleanup-playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack

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

Expand Down
15 changes: 3 additions & 12 deletions openstack/intel-worker/playbooks/roles/vm_create/tasks/get_vm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading