Skip to content

Commit 2e6d097

Browse files
committed
add fss code to ocne2
1 parent c34d812 commit 2e6d097

File tree

8 files changed

+220
-1
lines changed

8 files changed

+220
-1
lines changed

ocne2/create_fss.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
# Copyright (c) 2024 Oracle and/or its affiliates.
3+
# This software is made available to you under the terms of the Universal Permissive License (UPL), Version 1.0.
4+
# The Universal Permissive License (UPL), Version 1.0 (see COPYING or https://oss.oracle.com/licenses/upl)
5+
# See LICENSE.TXT for details.
6+
7+
- name: Set file_system mount target
8+
oracle.oci.oci_file_storage_mount_target:
9+
availability_domain: "{{ my_availability_domain }}"
10+
compartment_id: "{{ my_compartment_id }}"
11+
subnet_id: "{{ my_subnet_id }}"
12+
display_name: "mt-ocne"
13+
hostname_label: "ocne-fss"
14+
state: present
15+
register: result
16+
retries: 10
17+
delay: 30
18+
until: result is not failed
19+
20+
- name: Print file_system mount target
21+
ansible.builtin.debug:
22+
var: result
23+
when: debug_enabled
24+
25+
- name: Get file_system mount target facts
26+
ansible.builtin.set_fact:
27+
mount_target_id: "{{ result.mount_target.id }}"
28+
export_set_id: "{{ result.mount_target.export_set_id }}"
29+
mount_target_private_ip_id: "{{ result.mount_target.private_ip_ids[0] }}"
30+
31+
- name: Get file_system mount target private ip facts
32+
oracle.oci.oci_network_private_ip_facts:
33+
id: "{{ mount_target_private_ip_id }}"
34+
register: result
35+
retries: 10
36+
delay: 30
37+
until: result is not failed
38+
39+
- name: Set file_system mount target private ip
40+
ansible.builtin.set_fact:
41+
mount_target_ip_address: "{{ result.private_ips[0].ip_address }}"
42+
43+
- name: Print file_system mount target private ip
44+
ansible.builtin.debug:
45+
msg: "Mount Target Ip Address: {{ mount_target_ip_address }}"
46+
when: debug_enabled
47+
48+
- name: Set file_system
49+
oracle.oci.oci_file_storage_file_system:
50+
availability_domain: "{{ my_availability_domain }}"
51+
compartment_id: "{{ my_compartment_id }}"
52+
display_name: "fss-ocne"
53+
state: present
54+
register: result
55+
retries: 10
56+
delay: 30
57+
until: result is not failed
58+
59+
- name: Get file_system id
60+
ansible.builtin.set_fact:
61+
file_system_id: "{{ result.file_system.id }}"
62+
63+
- name: Set file_system export
64+
oracle.oci.oci_file_storage_export:
65+
export_set_id: "{{ export_set_id }}"
66+
file_system_id: "{{ file_system_id }}"
67+
export_options:
68+
- source: "0.0.0.0/0"
69+
require_privileged_source_port: false
70+
access: "READ_WRITE"
71+
identity_squash: "NONE"
72+
path: "/fss-ocne"
73+
state: present
74+
register: result
75+
retries: 10
76+
delay: 30
77+
until: result is not failed
78+
79+
- name: Get file_system export id and path
80+
ansible.builtin.set_fact:
81+
export_id: "{{ result.export.id }}"
82+
export_path: "{{ result.export.path }}"
83+
84+
- name: Set file_system vars file
85+
ansible.builtin.template:
86+
src: fss_vars.j2
87+
dest: fss_vars.yml
88+
mode: "0664"

ocne2/default_vars.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ ocne_cluster_name: "ocne"
2828
num_cp_nodes: 3
2929
num_wk_nodes: 3
3030
update_all: false
31-
#oci_yum_region: ".uk-london-1"
31+
#oci_yum_region: ".uk-london-1"
32+
use_fss: false

ocne2/delete_fss.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
# Copyright (c) 2024 Oracle and/or its affiliates.
3+
# This software is made available to you under the terms of the Universal Permissive License (UPL), Version 1.0.
4+
# The Universal Permissive License (UPL), Version 1.0 (see COPYING or https://oss.oracle.com/licenses/upl)
5+
# See LICENSE.TXT for details.
6+
7+
- name: Delete Export
8+
oracle.oci.oci_file_storage_export:
9+
id: "{{ export_id }}"
10+
state: 'absent'
11+
12+
- name: Delete Mount Target
13+
oracle.oci.oci_file_storage_mount_target:
14+
id: "{{ mount_target_id }}"
15+
state: 'absent'
16+
17+
- name: Delete File System
18+
oracle.oci.oci_file_storage_file_system:
19+
id: "{{ file_system_id }}"
20+
state: 'absent'

ocne2/fss_deployments.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
# Copyright (c) 2024 Oracle and/or its affiliates.
3+
# This software is made available to you under the terms of the Universal Permissive License (UPL), Version 1.0.
4+
# The Universal Permissive License (UPL), Version 1.0 (see COPYING or https://oss.oracle.com/licenses/upl)
5+
# See LICENSE.TXT for details.
6+
7+
- name: Include file_system vars
8+
ansible.builtin.include_vars:
9+
file: fss_vars.yml
10+
11+
- name: Create file fss-pv.yaml
12+
ansible.builtin.template:
13+
src: fss_pv.j2
14+
dest: ~/fss-pv.yaml
15+
mode: "0644"
16+
become: true
17+
become_user: "{{ username }}"
18+
delegate_to: "{{ item }}"
19+
loop: "{{ groups['controlplane'] }}"
20+
21+
- name: Create file fss-pvc.yaml
22+
ansible.builtin.template:
23+
src: fss_pvc.j2
24+
dest: ~/fss-pvc.yaml
25+
mode: "0644"
26+
become: true
27+
become_user: "{{ username }}"
28+
delegate_to: "{{ item }}"
29+
loop: "{{ groups['controlplane'] }}"
30+
31+
- name: Create file fss-pod.yaml
32+
ansible.builtin.template:
33+
src: fss_pod.j2
34+
dest: ~/fss-pod.yaml
35+
mode: "0644"
36+
become: true
37+
become_user: "{{ username }}"
38+
delegate_to: "{{ item }}"
39+
loop: "{{ groups['controlplane'] }}"

ocne2/templates/fss_pod.j2

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
# Copyright (c) 2024 Oracle and/or its affiliates.
3+
# This software is made available to you under the terms of the Universal Permissive License (UPL), Version 1.0.
4+
# The Universal Permissive License (UPL), Version 1.0 (see COPYING or https://oss.oracle.com/licenses/upl)
5+
# See LICENSE.TXT for details.
6+
7+
apiVersion: v1
8+
kind: Pod
9+
metadata:
10+
name: app
11+
spec:
12+
containers:
13+
- name: app
14+
image: ghcr.io/oracle/oraclelinux:8
15+
command: ["/bin/bash"]
16+
args: ["-c", "while true; do echo $(date -u) >> /data/out.txt; sleep 5; done"]
17+
volumeMounts:
18+
- name: persistent-storage
19+
mountPath: /data
20+
volumes:
21+
- name: persistent-storage
22+
persistentVolumeClaim:
23+
claimName: fss-pvc

ocne2/templates/fss_pv.j2

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
# Copyright (c) 2024 Oracle and/or its affiliates.
3+
# This software is made available to you under the terms of the Universal Permissive License (UPL), Version 1.0.
4+
# The Universal Permissive License (UPL), Version 1.0 (see COPYING or https://oss.oracle.com/licenses/upl)
5+
# See LICENSE.TXT for details.
6+
7+
apiVersion: v1
8+
kind: PersistentVolume
9+
metadata:
10+
name: fss-pv
11+
spec:
12+
capacity:
13+
storage: 50Gi
14+
volumeMode: Filesystem
15+
accessModes:
16+
- ReadWriteMany
17+
persistentVolumeReclaimPolicy: Retain
18+
csi:
19+
driver: fss.csi.oraclecloud.com
20+
volumeHandle: {{ file_system_id }}:{{ mount_target_ip_address }}:{{ export_path }}

ocne2/templates/fss_pvc.j2

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
# Copyright (c) 2024 Oracle and/or its affiliates.
3+
# This software is made available to you under the terms of the Universal Permissive License (UPL), Version 1.0.
4+
# The Universal Permissive License (UPL), Version 1.0 (see COPYING or https://oss.oracle.com/licenses/upl)
5+
# See LICENSE.TXT for details.
6+
7+
apiVersion: v1
8+
kind: PersistentVolumeClaim
9+
metadata:
10+
name: fss-pvc
11+
spec:
12+
accessModes:
13+
- ReadWriteMany
14+
storageClassName: ""
15+
resources:
16+
requests:
17+
storage: 50Gi
18+
volumeName: fss-pv
19+

ocne2/templates/fss_vars.j2

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
# Copyright (c) 2024 Oracle and/or its affiliates.
3+
# This software is made available to you under the terms of the Universal Permissive License (UPL), Version 1.0.
4+
# The Universal Permissive License (UPL), Version 1.0 (see COPYING or https://oss.oracle.com/licenses/upl)
5+
# See LICENSE.TXT for details.
6+
7+
file_system_id: {{ file_system_id }}
8+
mount_target_ip_address: {{ mount_target_ip_address }}
9+
export_path: {{ export_path }}

0 commit comments

Comments
 (0)