open ebs zfs
This commit is contained in:
@ -10,6 +10,6 @@ metadata:
|
||||
value: "hostpath"
|
||||
- name: BasePath
|
||||
value: "/ebs/{{ item }}/"
|
||||
volumeBindingMode: Immediate
|
||||
allowVolumeExpansion: true
|
||||
volumeBindingMode: WaitForFirstConsumer
|
||||
reclaimPolicy: Retain
|
@ -0,0 +1,11 @@
|
||||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
name: ssd-zfs
|
||||
parameters:
|
||||
poolname: ssd/data/open-ebs
|
||||
fstype: zfs
|
||||
provisioner: zfs.csi.openebs.io
|
||||
allowVolumeExpansion: true
|
||||
volumeBindingMode: WaitForFirstConsumer
|
||||
reclaimPolicy: Retain
|
2404
ansible/roles/k8s_storage_ebs_zfs_deploy/files/zfs-operator.yaml
Normal file
2404
ansible/roles/k8s_storage_ebs_zfs_deploy/files/zfs-operator.yaml
Normal file
File diff suppressed because it is too large
Load Diff
23
ansible/roles/k8s_storage_ebs_zfs_deploy/tasks/main.yaml
Normal file
23
ansible/roles/k8s_storage_ebs_zfs_deploy/tasks/main.yaml
Normal file
@ -0,0 +1,23 @@
|
||||
---
|
||||
- name: download zfs operator manifest
|
||||
ansible.builtin.uri:
|
||||
url: https://openebs.github.io/charts/zfs-operator.yaml
|
||||
dest: "{{ ansible_search_path[0] }}/files/zfs-operator.yaml"
|
||||
creates: "{{ ansible_search_path[0] }}/files/zfs-operator.yaml"
|
||||
|
||||
- name: install zfs operator to cluster
|
||||
kubernetes.core.k8s:
|
||||
src: "{{ ansible_search_path[0] }}/files/zfs-operator.yaml"
|
||||
state: present
|
||||
|
||||
- name: template out the storage classes
|
||||
ansible.builtin.template:
|
||||
src: sc-zfs.yaml.j2
|
||||
dest: "{{ ansible_search_path[0] }}/files/sc_{{ item.name }}.yaml"
|
||||
loop: "{{ ebs_zfs_storage_classes }}"
|
||||
|
||||
- name: install zfs storage classes to cluster
|
||||
kubernetes.core.k8s:
|
||||
src: "{{ ansible_search_path[0] }}/files/sc_{{ item.name }}.yaml"
|
||||
state: present
|
||||
loop: "{{ ebs_zfs_storage_classes }}"
|
@ -0,0 +1,11 @@
|
||||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
name: {{ item.name }}
|
||||
parameters:
|
||||
poolname: {{ item.dataset }}
|
||||
fstype: zfs
|
||||
provisioner: zfs.csi.openebs.io
|
||||
allowVolumeExpansion: true
|
||||
volumeBindingMode: WaitForFirstConsumer
|
||||
reclaimPolicy: Retain
|
@ -23,7 +23,7 @@
|
||||
ansible.builtin.uri:
|
||||
dest: "/tmp/{{ zfs_key_id }}"
|
||||
url: https://archzfs.com/archzfs.gpg
|
||||
creates: "/tmp/{{ zfs_key_id }}"
|
||||
creates: "/tmp/{{ zfs_key_id }}"
|
||||
|
||||
- name: install and lsign zfs key
|
||||
ansible.builtin.shell:
|
||||
@ -41,34 +41,35 @@
|
||||
community.general.pacman:
|
||||
name: "{{ zfs_packages }}"
|
||||
state: latest
|
||||
|
||||
- name: set zfs module parameters
|
||||
ansible.builtin.template:
|
||||
src: zfs.conf.j2
|
||||
dest: /etc/modprobe.d/zfs.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0664
|
||||
|
||||
- name: load zfs module
|
||||
community.general.modprobe:
|
||||
name: zfs
|
||||
state: present
|
||||
|
||||
- name: enable zfs services
|
||||
become: true
|
||||
ansible.builtin.service:
|
||||
name: "{{ item }}"
|
||||
state: started
|
||||
enabled: yes
|
||||
loop:
|
||||
- zfs-import-cache.service
|
||||
- zfs-mount.service
|
||||
- zfs.target
|
||||
register: zfs_installed
|
||||
|
||||
- name: reboot system
|
||||
ansible.builtin.reboot:
|
||||
post_reboot_delay: 90
|
||||
when: zfs_installed is changed
|
||||
|
||||
- name: set zfs module parameters
|
||||
ansible.builtin.template:
|
||||
src: zfs.conf.j2
|
||||
dest: /etc/modprobe.d/zfs.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0664
|
||||
|
||||
- name: load zfs module
|
||||
community.general.modprobe:
|
||||
name: zfs
|
||||
state: present
|
||||
|
||||
- name: enable zfs services
|
||||
ansible.builtin.service:
|
||||
name: "{{ item }}"
|
||||
state: started
|
||||
enabled: yes
|
||||
loop:
|
||||
- zfs-import-cache.service
|
||||
- zfs-mount.service
|
||||
- zfs.target
|
||||
|
||||
- name: gather existing zpool facts
|
||||
community.general.zpool_facts:
|
||||
@ -97,19 +98,14 @@
|
||||
-O canmount=off \
|
||||
-O devices=off \
|
||||
-O compression={{ item.compression }} \
|
||||
-O reservation=none \
|
||||
-O refreservation=none \
|
||||
-O recordsize={{ item.recordsize }} \
|
||||
{{ item.name }} {{ item.type }} {{ item.disks }}
|
||||
when: item.name not in ( ansible_zfs_pools | selectattr("name") | list )
|
||||
with_items:
|
||||
"{{ zfs_pools }}"
|
||||
|
||||
- name: gather existing zfs dataset facts
|
||||
community.general.zfs_facts:
|
||||
name: "{{ item.name }}"
|
||||
recurse: true
|
||||
type: filesystem
|
||||
with_items:
|
||||
"{{ zfs_pools }}"
|
||||
|
||||
- name: create zfs datasets
|
||||
loop: "{{ zfs_pools | subelements('datasets') }}"
|
||||
community.general.zfs:
|
||||
@ -118,16 +114,16 @@
|
||||
extra_zfs_properties:
|
||||
canmount: off
|
||||
mountpoint: none
|
||||
primarycache: none
|
||||
primarycache: metadata
|
||||
secondarycache: none
|
||||
reservation: none
|
||||
refreservation: none
|
||||
dedup: off
|
||||
encryption: off
|
||||
compression: off
|
||||
volmode: dev
|
||||
devices: off
|
||||
atime: off
|
||||
when: item.1.name not in ( ansible_zfs_datasets | selectattr("name") | list )
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user