5
5
# See LICENSE.TXT for details.
6
6
7
7
- name : Add block volumes to the instance
8
- when :
9
- - add_block_storage
8
+ when : add_block_storage
10
9
block :
11
10
- name : Create block volume
12
11
oracle.oci.oci_blockstorage_volume :
40
39
retries : 10
41
40
delay : 30
42
41
until : result is not failed
42
+
43
+ - name : Add block volumes to the instance
44
+ when : item.value.add_bv | default('false') | bool
45
+ block :
46
+ - name : Create block volume
47
+ oracle.oci.oci_blockstorage_volume :
48
+ compartment_id : " {{ my_compartment_id }}"
49
+ availability_domain : " {{ my_availability_domain }}"
50
+ display_name : " blockvolume-vd{{ block_devices[ansible_loop.index0] }}"
51
+ size_in_gbs : " {{ block_volume_size_in_gbs }}"
52
+ key_by : [compartment_id, display_name]
53
+ register : result
54
+ vars :
55
+ timestamp : " {{ now().strftime('%Y%m%d-%H%M%S') }}"
56
+ retries : 10
57
+ delay : 30
58
+ until : result is not failed
59
+
60
+ - name : Set the block volume id
61
+ ansible.builtin.set_fact :
62
+ volume_id : " {{ result.volume.id }}"
63
+
64
+ - name : Attach the block volume
65
+ oracle.oci.oci_compute_volume_attachment :
66
+ instance_id : " {{ instance_id }}"
67
+ type : " {{ volume_type }}"
68
+ volume_id : " {{ volume_id }}"
69
+ compartment_id : " {{ my_compartment_id }}"
70
+ device : " /dev/oracleoci/oraclevd{{ block_devices[ansible_loop.index0] }}"
71
+ display_name : " blockvolume-vd{{ block_devices[ansible_loop.index0] }}"
72
+ is_read_only : false
73
+ is_shareable : false
74
+ key_by : [compartment_id, display_name]
75
+ retries : 10
76
+ delay : 30
77
+ until : result is not failed
0 commit comments