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