-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_nova_ceph_rescue.yaml
95 lines (81 loc) · 1.96 KB
/
test_nova_ceph_rescue.yaml
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
83
84
85
86
87
88
89
90
91
92
- include: auth.yml
- hosts: undercloud-0
vars:
ansible_python_interpreter: "/var/tmp/venv_shade/bin/python"
environment: "{{ env }}"
tasks:
- include_vars:
file: images.yml
name: images
- name: download cirros image
get_url:
url: "{{ images.cirros_url }}"
dest: /tmp/cirros-0.3.4-x86_64-disk.img
- name: upload an image
os_image:
auth: "{{ os_creds }}"
name: cirros
container_format: bare
disk_format: qcow2
state: present
filename: /tmp/cirros-0.3.4-x86_64-disk.img
kernel: cirros-vmlinuz
ramdisk: cirros-initrd
properties:
cpu_arch: x86_64
distro: ubuntu
register: cirrosimage
- set_fact: testimage={{ cirrosimage }}
- name: create flavor
os_nova_flavor:
auth: "{{ os_creds }}"
state: present
name: tiny
ram: 1024
vcpus: 1
disk: 10
- name: lunch instance from volume2
os_server:
name: test_vm1
state: present
auth: "{{ os_creds }}"
image: "{{ testimage.id }}"
flavor: tiny
- name: rescue nova instance
shell: openstack server rescue test_vm1
- hosts: ceph-0
become: true
tasks:
- name: verify image on ceph
shell: rbd -p image ls
register: volumeinfo
- debug: var=volumeinfo
- name: unrescue nova instance
shell: openstack server unrescue test_vm1
- hosts: ceph-0
become: true
tasks:
- name: verify image on ceph
shell: rbd -p images ls
register: volumeinfo
- debug: var=volumeinfo
- hosts: undercloud-0
vars:
ansible_python_interpreter: "/var/tmp/venv_shade/bin/python"
environment: "{{ env }}"
tasks:
- name: remove instance
os_server:
name: test_vm1
state: absent
auth: "{{ os_creds }}"
- name: delete image
os_image:
auth: "{{ os_creds }}"
name: cirros
state: absent
- name: delete flavor
os_nova_flavor:
auth: "{{ os_creds }}"
state: absent
name: tiny