Skip to content

Commit

Permalink
playbooks for ffu resource creation
Browse files Browse the repository at this point in the history
after ffu all created vms resides on the same compute added playbooks to move back all vms to original compute

Change-Id: I96f0238b06858533d17f551df2b50305dab5f7a1
  • Loading branch information
eshulman2 committed Dec 30, 2021
1 parent 9222bbe commit 5f144a6
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
25 changes: 25 additions & 0 deletions playbooks/tripleo/ffu/migrate_back.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---

- name: Tempest deployment and execution
hosts: "{{ tester | default('undercloud') }}"
gather_facts: False
tasks:

- name: Read old vms locations
command: cat /tmp/vms_locations
delegate_to: hypervisor
register: locations

- name: Migrate instances back to place
shell: |
source /home/stack/overcloudrc ;
openstack server migrate --live-migration \
--host "{{ item.split(':')[1] }}" --block-migration \
"{{ item.split(':')[0] }}" --wait
loop: "{{ locations.stdout_lines }}"

- name: Remove vms locations file
file:
state: absent
path: /tmp/vms_locations
delegate_to: hypervisor
31 changes: 31 additions & 0 deletions playbooks/tripleo/ffu/save_overcloud_vms_locations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
- name: Tempest deployment and execution
hosts: "{{ tester | default('undercloud') }}"
gather_facts: False
tasks:

- name: Collect info about deployed instances
os_server_info:
cloud: overcloud
server: instance*
filters:
vm_state: active
all_projects: yes
register: result

- name: Touch file for vm locations
file:
state: touch
path: /tmp/vms_locations
mode: '0664'
delegate_to: hypervisor

- name: save vm locations data to file
lineinfile:
path: /tmp/vms_locations
line: "{{ item.id }}:{{ item.properties['OS-EXT-SRV-ATTR:host'] }}"
owner: stack
group: stack
mode: '0644'
loop: "{{ result.openstack_servers }}"
delegate_to: hypervisor

0 comments on commit 5f144a6

Please sign in to comment.