summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSachin Prabhu <sprabhu@redhat.com>2020-03-26 17:38:50 +0000
committerMichael Adam <obnox@samba.org>2020-03-30 20:07:15 +0200
commit256c3c9dffb47e82ad581ff9527dbfbe2a037e4f (patch)
treea605ad6f0675b0179b446ae1cbb365e66c06f4b0
parent1556430faa44439602b65336a07e830319c29cfa (diff)
downloadsamba-integration-256c3c9dffb47e82ad581ff9527dbfbe2a037e4f.tar.gz
samba-integration-256c3c9dffb47e82ad581ff9527dbfbe2a037e4f.tar.xz
samba-integration-256c3c9dffb47e82ad581ff9527dbfbe2a037e4f.zip
Add Samba-Gluster setup ansible files
Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
-rw-r--r--vagrant/ansible/cluster-vars.yml5
-rw-r--r--vagrant/ansible/roles/samba-glusterfs.setup/tasks/main.yml80
-rw-r--r--vagrant/ansible/roles/samba-glusterfs.setup/templates/smb.conf.j219
-rw-r--r--vagrant/ansible/setup-cluster.yml1
4 files changed, 105 insertions, 0 deletions
diff --git a/vagrant/ansible/cluster-vars.yml b/vagrant/ansible/cluster-vars.yml
index 10f9147..76808ce 100644
--- a/vagrant/ansible/cluster-vars.yml
+++ b/vagrant/ansible/cluster-vars.yml
@@ -48,3 +48,8 @@ gluster_cluster_bricks: '/bricks/brick0/vol,/bricks/brick1/vol'
gluster_features_ctdb_nodes: 192.168.122.100,192.168.122.101
gluster_features_ctdb_publicaddr: '192.168.123.10/24 eth2,192.168.123.11/24 eth2'
gluster_features_ctdb_volume: ctdb
+
+samba_netbios_name: "GLUSTERTEST"
+samba_users:
+ - { username: 'test1', password: 'x', uid: '2001' }
+ - { username: 'test2', password: 'x', uid: '2002' }
diff --git a/vagrant/ansible/roles/samba-glusterfs.setup/tasks/main.yml b/vagrant/ansible/roles/samba-glusterfs.setup/tasks/main.yml
new file mode 100644
index 0000000..465ff24
--- /dev/null
+++ b/vagrant/ansible/roles/samba-glusterfs.setup/tasks/main.yml
@@ -0,0 +1,80 @@
+---
+- name: Install samba and samba-vfs-glusterfs packages
+ yum:
+ name:
+ - samba
+ - samba-vfs-glusterfs
+ state: present
+
+- name: Enable firewall for samba
+ firewalld:
+ service: samba
+ permanent: yes
+ state: enabled
+
+- name: Install libsemanage-python. This is needed for the seboolean ansible command
+ yum: name=libsemanage-python state=present
+
+- name: Selinux - Allow Samba to access glusterfs services
+ seboolean:
+ name: samba_load_libgfapi
+ state: yes
+ persistent: yes
+
+- name: Copy over smb.conf
+ template:
+ src: smb.conf.j2
+ dest: /etc/samba/smb.conf
+ owner: root
+ group: root
+ mode: '0644'
+
+- name: Set Volume options and restart volume in a single host
+ block:
+ - name: Setup Gluster volume settings
+ gluster_volume:
+ state: present
+ name: "{{ gluster_cluster_volume }}"
+ options:
+ {
+ server.allow-insecure: 'on',
+ performance.cache-samba-metadata: 'on',
+ storage.batch-fsync-delay-usec: '0',
+ user.smb: 'on'
+ }
+ run_once: true
+
+- name: Mount glusterfs using fuse mount and set world writable permissions
+ block:
+ - name: Mount gluster volume using glusterfs
+ mount:
+ path: /mnt-fuse
+ src: 'localhost:/vol'
+ fstype: glusterfs
+ state: mounted
+
+ - name: Set permission of share root to 0777
+ file:
+ path: /mnt-fuse
+ mode: '0777'
+
+ - name: Unmount mounted fuse glusterfs mount
+ mount:
+ path: /mnt-fuse
+ state: absent
+ run_once: true
+
+- name: Create test users
+ user:
+ name: "{{ item.username }}"
+ uid: "{{ item.uid }}"
+ state: present
+ with_items: "{{ samba_users }}"
+
+- name: Create test users with smbpasswd
+ shell: (echo {{ item.password }}; echo {{ item.password }})|smbpasswd -a {{ item.username }}
+ with_items: "{{ samba_users }}"
+ run_once: yes
+
+- name: Enable smbd service
+ service: name=smb state=started enabled=yes
diff --git a/vagrant/ansible/roles/samba-glusterfs.setup/templates/smb.conf.j2 b/vagrant/ansible/roles/samba-glusterfs.setup/templates/smb.conf.j2
new file mode 100644
index 0000000..2f577c8
--- /dev/null
+++ b/vagrant/ansible/roles/samba-glusterfs.setup/templates/smb.conf.j2
@@ -0,0 +1,19 @@
+[global]
+netbios name = {{ samba_netbios_name }}
+clustering = yes
+passdb backend = tdbsam
+
+host msdfs = yes
+msdfs root = yes
+msdfs shuffle referrals = yes
+
+client signing = auto
+
+kernel share modes = No
+map archive = No
+posix locking = No
+
+load printers = no
+printcap name = /dev/null
+disable spoolss = yes
+printing = bsd
diff --git a/vagrant/ansible/setup-cluster.yml b/vagrant/ansible/setup-cluster.yml
index 6855cb7..3cbfcd1 100644
--- a/vagrant/ansible/setup-cluster.yml
+++ b/vagrant/ansible/setup-cluster.yml
@@ -10,3 +10,4 @@
- gluster.infra
- gluster.cluster
- ctdb.setup
+ - samba-glusterfs.setup