summaryrefslogtreecommitdiff
path: root/roles/run-evacuate-hook/tasks/main.yaml
blob: 184b9d18f988d5e4ff159c16f734e6c979876fe1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
- name: Setup resources and mark the subnode as forced down
  become: true
  become_user: stack
  shell: "/opt/stack/nova/roles/run-evacuate-hook/files/setup_evacuate_resources.sh"
  environment:
    SUBNODE_HOSTNAME: "{{ hostvars['compute1']['ansible_hostname'] }}"

- name: Fence subnode by stopping q-agt and n-cpu
  delegate_to: compute1
  become: true
  systemd:
    name: "{{ item }}"
    state: stopped
  with_items:
    - devstack@q-agt
    - devstack@n-cpu

- name: Register running domains on subnode
  delegate_to: compute1
  become: true
  virt:
    command: list_vms
    state: running
  register: subnode_vms

- name: Destroy running domains on subnode
  delegate_to: compute1
  become: true
  virt:
    name: "{{ item }}"
    state: destroyed
  with_items: "{{ subnode_vms.list_vms }}"

- name: Stop libvirtd on "{{ inventory_hostname }}"
  become: true
  systemd:
    name: "{{ item }}"
    state: stopped
    enabled: no
  with_items:
    - libvirtd.service
    - libvirtd.socket
    - libvirtd-admin.socket
    - libvirtd-ro.socket
    - virtlogd.service
    - virtlogd-admin.socket
    - virtlogd.socket
    - virtlockd.service
    - virtlockd-admin.socket
    - virtlockd.socket

- name: Run negative evacuate tests
  become: true
  become_user: stack
  shell: "/opt/stack/nova/roles/run-evacuate-hook/files/test_negative_evacuate.sh"
  environment:
    CONTROLLER_HOSTNAME: "{{ hostvars['controller']['ansible_hostname'] }}"

- name: Start libvirtd on "{{ inventory_hostname }}"
  become: true
  systemd:
    name: "{{ item }}"
    state: started
    enabled: yes
  with_items:
    - libvirtd.service
    - libvirtd.socket
    - libvirtd-admin.socket
    - libvirtd-ro.socket
    - virtlogd.service
    - virtlogd-admin.socket
    - virtlogd.socket
    - virtlockd.service
    - virtlockd-admin.socket
    - virtlockd.socket

- name: Run evacuate tests
  become: true
  become_user: stack
  shell: "/opt/stack/nova/roles/run-evacuate-hook/files/test_evacuate.sh"
  environment:
    CONTROLLER_HOSTNAME: "{{ hostvars['controller']['ansible_hostname'] }}"