|
7 | 7 | - name: Launch an instance using PV BV
|
8 | 8 | when: volume_type != "iscsi"
|
9 | 9 | block:
|
10 |
| - - name: Launch an instance |
11 |
| - oracle.oci.oci_compute_instance: |
12 |
| - availability_domain: "{{ my_availability_domain }}" |
13 |
| - compartment_id: "{{ my_compartment_id }}" |
14 |
| - name: "{{ item.value.instance_name | default('instance-'~timestamp) }}" |
15 |
| - source_details: |
16 |
| - image_id: "{{ ol_image_id }}" |
17 |
| - source_type: image |
18 |
| - boot_volume_size_in_gbs: "{{ item.value.boot_volume_size_in_gbs | default(50) | int }}" |
19 |
| - shape: "{{ instance_shape }}" |
20 |
| - shape_config: |
21 |
| - ocpus: "{{ instance_ocpus }}" |
22 |
| - memory_in_gbs: "{{ instance_memory }}" |
23 |
| - create_vnic_details: |
24 |
| - assign_public_ip: true |
25 |
| - hostname_label: "{{ item.value.instance_name | default('instance-'~timestamp) }}" |
26 |
| - subnet_id: "{{ my_subnet_id }}" |
27 |
| - metadata: |
28 |
| - ssh_authorized_keys: "{{ lookup('file', lookup('env', 'HOME') + '/.ssh/' + private_key + '.pub') }}" |
29 |
| - agent_config: |
30 |
| - is_monitoring_disabled: false |
31 |
| - is_management_disabled: false |
32 |
| - are_all_plugins_disabled: false |
33 |
| - plugins_config: |
34 |
| - - |
35 |
| - name: "OS Management Service Agent" |
36 |
| - desired_state: DISABLED |
37 |
| - key_by: [compartment_id, availability_domain, display_name] |
38 |
| - register: result |
39 |
| - vars: |
40 |
| - timestamp: "{{ now().strftime('%Y%m%d-%H%M%S') }}" |
41 |
| - retries: 10 |
42 |
| - delay: 30 |
43 |
| - until: result is not failed |
44 |
| - |
45 |
| - - name: Print instance details |
46 |
| - ansible.builtin.debug: |
47 |
| - msg: |
48 |
| - - "Launched a new instance:" |
49 |
| - - "{{ result }}" |
50 |
| - when: debug_enabled |
51 |
| - |
52 |
| - - name: Set the compute instance id |
53 |
| - ansible.builtin.set_fact: |
54 |
| - instance_id: "{{ result.instance.id }}" |
55 |
| - |
56 |
| - - name: Set the compute instance display_name |
57 |
| - ansible.builtin.set_fact: |
58 |
| - instance_display_name: "{{ result.instance.display_name }}" |
| 10 | + - name: Launch an instance |
| 11 | + oracle.oci.oci_compute_instance: |
| 12 | + availability_domain: "{{ my_availability_domain }}" |
| 13 | + compartment_id: "{{ my_compartment_id }}" |
| 14 | + name: "{{ item.value.instance_name | default('instance-'~timestamp) }}" |
| 15 | + source_details: |
| 16 | + image_id: "{{ ol_image_id }}" |
| 17 | + source_type: image |
| 18 | + boot_volume_size_in_gbs: "{{ item.value.boot_volume_size_in_gbs | default(50) | int }}" |
| 19 | + shape: "{{ instance_shape }}" |
| 20 | + shape_config: |
| 21 | + ocpus: "{{ instance_ocpus }}" |
| 22 | + memory_in_gbs: "{{ instance_memory }}" |
| 23 | + create_vnic_details: |
| 24 | + assign_public_ip: true |
| 25 | + hostname_label: "{{ item.value.instance_name | default('instance-'~timestamp) }}" |
| 26 | + subnet_id: "{{ my_subnet_id }}" |
| 27 | + metadata: |
| 28 | + ssh_authorized_keys: "{{ lookup('file', lookup('env', 'HOME') + '/.ssh/' + private_key + '.pub') }}" |
| 29 | + agent_config: |
| 30 | + is_monitoring_disabled: false |
| 31 | + is_management_disabled: false |
| 32 | + are_all_plugins_disabled: false |
| 33 | + plugins_config: |
| 34 | + - |
| 35 | + name: "OS Management Service Agent" |
| 36 | + desired_state: DISABLED |
| 37 | + key_by: [compartment_id, availability_domain, display_name] |
| 38 | + register: result |
| 39 | + vars: |
| 40 | + timestamp: "{{ now().strftime('%Y%m%d-%H%M%S') }}" |
| 41 | + retries: 10 |
| 42 | + delay: 30 |
| 43 | + until: result is not failed |
| 44 | + |
| 45 | + - name: Print instance details |
| 46 | + ansible.builtin.debug: |
| 47 | + msg: |
| 48 | + - "Launched a new instance:" |
| 49 | + - "{{ result }}" |
| 50 | + when: debug_enabled |
| 51 | + |
| 52 | + - name: Set the compute instance id |
| 53 | + ansible.builtin.set_fact: |
| 54 | + instance_id: "{{ result.instance.id }}" |
| 55 | + |
| 56 | + - name: Set the compute instance display_name |
| 57 | + ansible.builtin.set_fact: |
| 58 | + instance_display_name: "{{ result.instance.display_name }}" |
59 | 59 |
|
60 | 60 | - name: Launch an instance using iSCSI BV
|
61 | 61 | when: volume_type == "iscsi"
|
62 | 62 | block:
|
63 |
| - - name: Launch an instance |
64 |
| - oracle.oci.oci_compute_instance: |
65 |
| - availability_domain: "{{ my_availability_domain }}" |
66 |
| - compartment_id: "{{ my_compartment_id }}" |
67 |
| - name: "{{ item.value.instance_name | default('instance-'~timestamp) }}" |
68 |
| - source_details: |
69 |
| - image_id: "{{ ol_image_id }}" |
70 |
| - source_type: image |
71 |
| - boot_volume_size_in_gbs: "{{ item.value.boot_volume_size_in_gbs | default(50) | int }}" |
72 |
| - shape: "{{ instance_shape }}" |
73 |
| - shape_config: |
74 |
| - ocpus: "{{ instance_ocpus }}" |
75 |
| - memory_in_gbs: "{{ instance_memory }}" |
76 |
| - create_vnic_details: |
77 |
| - assign_public_ip: true |
78 |
| - hostname_label: "{{ item.value.instance_name | default('instance-'~timestamp) }}" |
79 |
| - subnet_id: "{{ my_subnet_id }}" |
80 |
| - metadata: |
81 |
| - ssh_authorized_keys: "{{ lookup('file', lookup('env', 'HOME') + '/.ssh/' + private_key + '.pub') }}" |
82 |
| - agent_config: |
83 |
| - is_monitoring_disabled: false |
84 |
| - is_management_disabled: false |
85 |
| - are_all_plugins_disabled: false |
86 |
| - plugins_config: |
87 |
| - - name: "OS Management Service Agent" |
88 |
| - desired_state: DISABLED |
89 |
| - - name: "Block Volume Management" |
90 |
| - desired_state: ENABLED |
91 |
| - key_by: [compartment_id, availability_domain, display_name] |
92 |
| - register: result |
93 |
| - vars: |
94 |
| - timestamp: "{{ now().strftime('%Y%m%d-%H%M%S') }}" |
95 |
| - retries: 10 |
96 |
| - delay: 30 |
97 |
| - until: result is not failed |
98 |
| - |
99 |
| - - name: Print instance details |
100 |
| - ansible.builtin.debug: |
101 |
| - msg: |
102 |
| - - "Launched a new instance:" |
103 |
| - - "{{ result }}" |
104 |
| - when: debug_enabled |
105 |
| - |
106 |
| - - name: Set the compute instance id |
107 |
| - ansible.builtin.set_fact: |
108 |
| - instance_id: "{{ result.instance.id }}" |
109 |
| - |
110 |
| - - name: Set the compute instance display_name |
111 |
| - ansible.builtin.set_fact: |
112 |
| - instance_display_name: "{{ result.instance.display_name }}" |
| 63 | + - name: Launch an instance |
| 64 | + oracle.oci.oci_compute_instance: |
| 65 | + availability_domain: "{{ my_availability_domain }}" |
| 66 | + compartment_id: "{{ my_compartment_id }}" |
| 67 | + name: "{{ item.value.instance_name | default('instance-'~timestamp) }}" |
| 68 | + source_details: |
| 69 | + image_id: "{{ ol_image_id }}" |
| 70 | + source_type: image |
| 71 | + boot_volume_size_in_gbs: "{{ item.value.boot_volume_size_in_gbs | default(50) | int }}" |
| 72 | + shape: "{{ instance_shape }}" |
| 73 | + shape_config: |
| 74 | + ocpus: "{{ instance_ocpus }}" |
| 75 | + memory_in_gbs: "{{ instance_memory }}" |
| 76 | + create_vnic_details: |
| 77 | + assign_public_ip: true |
| 78 | + hostname_label: "{{ item.value.instance_name | default('instance-'~timestamp) }}" |
| 79 | + subnet_id: "{{ my_subnet_id }}" |
| 80 | + metadata: |
| 81 | + ssh_authorized_keys: "{{ lookup('file', lookup('env', 'HOME') + '/.ssh/' + private_key + '.pub') }}" |
| 82 | + agent_config: |
| 83 | + is_monitoring_disabled: false |
| 84 | + is_management_disabled: false |
| 85 | + are_all_plugins_disabled: false |
| 86 | + plugins_config: |
| 87 | + - name: "OS Management Service Agent" |
| 88 | + desired_state: DISABLED |
| 89 | + - name: "Block Volume Management" |
| 90 | + desired_state: ENABLED |
| 91 | + key_by: [compartment_id, availability_domain, display_name] |
| 92 | + register: result |
| 93 | + vars: |
| 94 | + timestamp: "{{ now().strftime('%Y%m%d-%H%M%S') }}" |
| 95 | + retries: 10 |
| 96 | + delay: 30 |
| 97 | + until: result is not failed |
| 98 | + |
| 99 | + - name: Print instance details |
| 100 | + ansible.builtin.debug: |
| 101 | + msg: |
| 102 | + - "Launched a new instance:" |
| 103 | + - "{{ result }}" |
| 104 | + when: debug_enabled |
| 105 | + |
| 106 | + - name: Set the compute instance id |
| 107 | + ansible.builtin.set_fact: |
| 108 | + instance_id: "{{ result.instance.id }}" |
| 109 | + |
| 110 | + - name: Set the compute instance display_name |
| 111 | + ansible.builtin.set_fact: |
| 112 | + instance_display_name: "{{ result.instance.display_name }}" |
113 | 113 |
|
114 | 114 | - name: Get the vnic attachment details of instance
|
115 | 115 | oracle.oci.oci_compute_vnic_attachment_facts:
|
|
0 commit comments