Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ol/block.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
- name: Attach the block volume
oracle.oci.oci_compute_volume_attachment:
instance_id: "{{ instance_id }}"
type: paravirtualized
type: "{{ volume_type }}"
volume_id: "{{ volume_id }}"
compartment_id: "{{ my_compartment_id }}"
device: "/dev/oracleoci/oraclevd{{ block_devices[ansible_loop.index0] }}"
Expand Down
76 changes: 75 additions & 1 deletion ol/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# The Universal Permissive License (UPL), Version 1.0 (see COPYING or https://oss.oracle.com/licenses/upl)
# See LICENSE.TXT for details.

- name: Launch an instance
- name: Launch an instance using PV BV
oracle.oci.oci_compute_instance:
availability_domain: "{{ my_availability_domain }}"
compartment_id: "{{ my_compartment_id }}"
Expand Down Expand Up @@ -33,6 +33,44 @@
desired_state: DISABLED
key_by: [compartment_id, availability_domain, display_name]
register: result
when: volume_type != "iscsi"
vars:
timestamp: "{{ now().strftime('%Y%m%d-%H%M%S') }}"
retries: 10
delay: 30
until: result is not failed

- name: Launch an instance using iSCSI BV
oracle.oci.oci_compute_instance:
availability_domain: "{{ my_availability_domain }}"
compartment_id: "{{ my_compartment_id }}"
name: "{{ item.value.instance_name | default('instance-'~timestamp) }}"
source_details:
image_id: "{{ ol_image_id }}"
source_type: image
boot_volume_size_in_gbs: "{{ item.value.boot_volume_size_in_gbs | default(50) | int }}"
shape: "{{ instance_shape }}"
shape_config:
ocpus: "{{ instance_ocpus }}"
memory_in_gbs: "{{ instance_memory }}"
create_vnic_details:
assign_public_ip: true
hostname_label: "{{ item.value.instance_name | default('instance-'~timestamp) }}"
subnet_id: "{{ my_subnet_id }}"
metadata:
ssh_authorized_keys: "{{ lookup('file', lookup('env', 'HOME') + '/.ssh/' + private_key + '.pub') }}"
agent_config:
is_monitoring_disabled: false
is_management_disabled: false
are_all_plugins_disabled: false
plugins_config:
- name: "OS Management Service Agent"
desired_state: DISABLED
- name: "Block Volume Management"
desired_state: ENABLED
key_by: [compartment_id, availability_domain, display_name]
register: result
when: volume_type == "iscsi"
vars:
timestamp: "{{ now().strftime('%Y%m%d-%H%M%S') }}"
retries: 10
Expand Down Expand Up @@ -96,6 +134,42 @@
- h
- i

- name: Add host level block volume
when: item.value.add_bv | default('false') | bool
block:
- name: Create block volume
oracle.oci.oci_blockstorage_volume:
compartment_id: "{{ my_compartment_id }}"
availability_domain: "{{ my_availability_domain }}"
display_name: "bv-ocfs2"
size_in_gbs: "{{ block_volume_size_in_gbs }}"
key_by: [compartment_id, display_name]
register: create_bv
retries: 10
delay: 30
until: create_bv is not failed

- name: Set the block volume id
ansible.builtin.set_fact:
volume_id: "{{ create_bv.volume.id }}"

- name: Attach the block volume
oracle.oci.oci_compute_volume_attachment:
instance_id: "{{ instance_id }}"
type: "{{ volume_type }}"
volume_id: "{{ volume_id }}"
compartment_id: "{{ my_compartment_id }}"
device: "/dev/oracleoci/oraclevdo"
display_name: "blockvolume-vdo"
is_agent_auto_iscsi_login_enabled: true
is_read_only: false
is_shareable: true
register: attach_bv
retries: 10
delay: 30
until: attach_bv is not failed


- name: Print the public and private ip of the newly created instance
ansible.builtin.debug:
msg:
Expand Down
3 changes: 3 additions & 0 deletions ol/default_vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ compute_instances:
instance_name: "ol-node-01"
type: "server"
boot_volume_size_in_gbs: 50
add_bv: false
os: "Oracle Linux"
os_version: "8"
instance_shape: "VM.Standard.E4.Flex"
Expand All @@ -17,6 +18,7 @@ debug_enabled: false
add_block_storage: false
block_volume_size_in_gbs: 50
block_count: 1
volume_type: "paravirtualized"

use_vnc: false
vnc_port: "1"
Expand Down Expand Up @@ -47,6 +49,7 @@ use_nginx: false
use_nfs: false
use_quay_ha: false
use_pcp: false
use_ocfs2: false

use_vbox: false
virtualbox_version: "7.1"
Expand Down
26 changes: 26 additions & 0 deletions ol/templates/ingress_security_rules.j2
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,30 @@ instance_ingress_security_rules:
destination_port_range:
max: 44321
min: 44321
{% endif %}
{% if use_ocfs2 %}
- source: "10.0.0.0/24"
protocol: 6
tcp_options:
destination_port_range:
max: 7777
min: 7777
- source: "10.0.0.0/24"
protocol: 17
udp_options:
destination_port_range:
max: 7777
min: 7777
- source: "10.0.0.0/24"
protocol: 6
tcp_options:
destination_port_range:
max: 3260
min: 3260
- source: "10.0.0.0/24"
protocol: 17
udp_options:
destination_port_range:
max: 3260
min: 3260
{% endif %}