summaryrefslogtreecommitdiffstats
path: root/vagrant/ansible/roles/samba-glusterfs.setup/tasks/main.yml
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 /vagrant/ansible/roles/samba-glusterfs.setup/tasks/main.yml
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>
Diffstat (limited to 'vagrant/ansible/roles/samba-glusterfs.setup/tasks/main.yml')
-rw-r--r--vagrant/ansible/roles/samba-glusterfs.setup/tasks/main.yml80
1 files changed, 80 insertions, 0 deletions
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