Skip to content

Commit

Permalink
Add an XFS backend
Browse files Browse the repository at this point in the history
Signed-off-by: Xavi Hernandez <[email protected]>
  • Loading branch information
xhernandez committed Jul 25, 2023
1 parent 756b618 commit 46402ac
Show file tree
Hide file tree
Showing 11 changed files with 134 additions and 0 deletions.
27 changes: 27 additions & 0 deletions vagrant/ansible/cluster-xfs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
ctdb_network_private_interfaces: >-
{{
config.nodes |
dict2items |
selectattr('value.groups', 'contains', 'cluster') |
map(attribute='value.networks.private') |
list
}}
ctdb_network_public_interfaces: >-
{{
config.nodes |
dict2items |
selectattr('value.groups', 'contains', 'cluster') |
map(attribute='value.ctdb.public') |
list
}}
ctdb_network_public_interface_subnet_mask: "24"
ctdb_network_public_interface_name: "eth2"

samba_netbios_name: "GLUSTERTEST"
samba_users:
- { username: 'test1', password: 'x', uid: '2001' }
- { username: 'test2', password: 'x', uid: '2002' }

samba_shares:
- { cluster_volume: "/samba", share_name: "xfs-share", device: "/dev/vdb" }
14 changes: 14 additions & 0 deletions vagrant/ansible/roles/ctdb.setup/tasks/xfs/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- name: Create CTDB directory
file:
path: /ctdb/lock
state: directory

- name: SELinux - Allow CTDB to access recovery lockfile
sefcontext:
target: '/ctdb/lock(/.*)?'
setype: ctdbd_var_lib_t
state: present

- name: SELinux - Apply changes
command: restorecon -R /ctdb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
- name: Mount XFS
mount:
path: "{{ path }}"
src: "{{ volume }}"
fstype: xfs
state: mounted

- name: Set permission of volume root to 0777
file:
path: "{{ path }}"
mode: '0777'

- name: SELinux - Allow access to mount point
sefcontext:
target: "{{ path }}"
setype: mnt_t
state: present

- name: SELinux - Apply changes
command: restorecon -R "{{ path }}"
20 changes: 20 additions & 0 deletions vagrant/ansible/roles/samba.setup/tasks/xfs/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
- name: Install Samba
yum:
name: samba
state: present

- name: Make shares world writable
include_tasks:
file: "xfs/fix_share_permissions.yml"
vars:
path: "{{ item.cluster_volume }}"
volume: "{{ item.device }}"
with_items: "{{ samba_shares }}"
run_once: true

- name: Selinux - Allow exporting everything
seboolean:
name: samba_export_all_rw
state: yes
persistent: yes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[{{ samba_share }}]
comment = For samba share of volume {{ cluster_volume }}
vfs objects = acl_xattr
path = {{ cluster_volume }}
read only = no
1 change: 1 addition & 0 deletions vagrant/ansible/roles/sit.xfs/tasks/client/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
---
1 change: 1 addition & 0 deletions vagrant/ansible/roles/sit.xfs/tasks/common/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
---
7 changes: 7 additions & 0 deletions vagrant/ansible/roles/sit.xfs/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- name: Create the XFS filesystem
filesystem:
dev: "{{ item.device }}"
force: true
fstype: xfs
loop: "{{ samba_shares }}"
1 change: 1 addition & 0 deletions vagrant/ansible/roles/sit.xfs/tasks/server/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
---
29 changes: 29 additions & 0 deletions vagrant/roles/local.defaults/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ os_includes:
# constant name.
be_names:
glusterfs: glusterfs
xfs: xfs

# Vagrant/VM global settings
vagrant:
Expand Down Expand Up @@ -105,3 +106,31 @@ environments:
ctdb:
public: 10
groups: [cluster]

xfs:
# Default number of CPUs per VM
cpus: 2

# Default amount of memory per VM (in MiB)
memory: 1024

# List of nodes to create
nodes:
setup:
networks:
private: 200
groups: [admin]

storage:
disks: [10]
networks:
private: 100
public: 100
ctdb:
public: 10
groups: [cluster]

client:
networks:
public: 5
groups: [clients]
8 changes: 8 additions & 0 deletions vagrant/roles/sit.xfs/tasks/setup/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
- name: Install ansible
yum:
name:
- ansible-core
- ansible-collection-ansible-posix
- ansible-collection-community-general
state: latest

0 comments on commit 46402ac

Please sign in to comment.