Skip to content

Commit 2954a8d

Browse files
authored
Merge pull request #57 from bgraef/main
add code for ocfs2 ol deploy
2 parents 6a7ddd0 + 28e9290 commit 2954a8d

File tree

4 files changed

+105
-2
lines changed

4 files changed

+105
-2
lines changed

ol/block.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
- name: Attach the block volume
3030
oracle.oci.oci_compute_volume_attachment:
3131
instance_id: "{{ instance_id }}"
32-
type: paravirtualized
32+
type: "{{ volume_type }}"
3333
volume_id: "{{ volume_id }}"
3434
compartment_id: "{{ my_compartment_id }}"
3535
device: "/dev/oracleoci/oraclevd{{ block_devices[ansible_loop.index0] }}"

ol/build.yml

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# The Universal Permissive License (UPL), Version 1.0 (see COPYING or https://oss.oracle.com/licenses/upl)
55
# See LICENSE.TXT for details.
66

7-
- name: Launch an instance
7+
- name: Launch an instance using PV BV
88
oracle.oci.oci_compute_instance:
99
availability_domain: "{{ my_availability_domain }}"
1010
compartment_id: "{{ my_compartment_id }}"
@@ -33,6 +33,44 @@
3333
desired_state: DISABLED
3434
key_by: [compartment_id, availability_domain, display_name]
3535
register: result
36+
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
42+
43+
- 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+
when: volume_type == "iscsi"
3674
vars:
3775
timestamp: "{{ now().strftime('%Y%m%d-%H%M%S') }}"
3876
retries: 10
@@ -96,6 +134,42 @@
96134
- h
97135
- i
98136

137+
- name: Add host level block volume
138+
when: item.value.add_bv | default('false') | bool
139+
block:
140+
- name: Create block volume
141+
oracle.oci.oci_blockstorage_volume:
142+
compartment_id: "{{ my_compartment_id }}"
143+
availability_domain: "{{ my_availability_domain }}"
144+
display_name: "bv-ocfs2"
145+
size_in_gbs: "{{ block_volume_size_in_gbs }}"
146+
key_by: [compartment_id, display_name]
147+
register: create_bv
148+
retries: 10
149+
delay: 30
150+
until: create_bv is not failed
151+
152+
- name: Set the block volume id
153+
ansible.builtin.set_fact:
154+
volume_id: "{{ create_bv.volume.id }}"
155+
156+
- name: Attach the block volume
157+
oracle.oci.oci_compute_volume_attachment:
158+
instance_id: "{{ instance_id }}"
159+
type: "{{ volume_type }}"
160+
volume_id: "{{ volume_id }}"
161+
compartment_id: "{{ my_compartment_id }}"
162+
device: "/dev/oracleoci/oraclevdo"
163+
display_name: "blockvolume-vdo"
164+
is_agent_auto_iscsi_login_enabled: true
165+
is_read_only: false
166+
is_shareable: true
167+
register: attach_bv
168+
retries: 10
169+
delay: 30
170+
until: attach_bv is not failed
171+
172+
99173
- name: Print the public and private ip of the newly created instance
100174
ansible.builtin.debug:
101175
msg:

ol/default_vars.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ compute_instances:
33
instance_name: "ol-node-01"
44
type: "server"
55
boot_volume_size_in_gbs: 50
6+
add_bv: false
67
os: "Oracle Linux"
78
os_version: "8"
89
instance_shape: "VM.Standard.E4.Flex"
@@ -17,6 +18,7 @@ debug_enabled: false
1718
add_block_storage: false
1819
block_volume_size_in_gbs: 50
1920
block_count: 1
21+
volume_type: "paravirtualized"
2022

2123
use_vnc: false
2224
vnc_port: "1"
@@ -47,6 +49,7 @@ use_nginx: false
4749
use_nfs: false
4850
use_quay_ha: false
4951
use_pcp: false
52+
use_ocfs2: false
5053

5154
use_vbox: false
5255
virtualbox_version: "7.1"

ol/templates/ingress_security_rules.j2

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,30 @@ instance_ingress_security_rules:
9393
destination_port_range:
9494
max: 44321
9595
min: 44321
96+
{% endif %}
97+
{% if use_ocfs2 %}
98+
- source: "10.0.0.0/24"
99+
protocol: 6
100+
tcp_options:
101+
destination_port_range:
102+
max: 7777
103+
min: 7777
104+
- source: "10.0.0.0/24"
105+
protocol: 17
106+
udp_options:
107+
destination_port_range:
108+
max: 7777
109+
min: 7777
110+
- source: "10.0.0.0/24"
111+
protocol: 6
112+
tcp_options:
113+
destination_port_range:
114+
max: 3260
115+
min: 3260
116+
- source: "10.0.0.0/24"
117+
protocol: 17
118+
udp_options:
119+
destination_port_range:
120+
max: 3260
121+
min: 3260
96122
{% endif %}

0 commit comments

Comments
 (0)