summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSachin Prabhu <sprabhu@redhat.com>2020-07-17 17:12:30 +0100
committerspuiuk <sachin.prabhu@gmail.com>2020-08-24 12:26:57 +0100
commitedc1659267596a285d56cd4854f4cab3dcf23d52 (patch)
tree010167ea2ea1c7b0aed7e86fe0f6cf6e22c9139a
parentb023fb0d43cd194db4810fb675a94a64e50ddb4c (diff)
downloadsamba-integration-edc1659267596a285d56cd4854f4cab3dcf23d52.tar.gz
samba-integration-edc1659267596a285d56cd4854f4cab3dcf23d52.tar.xz
samba-integration-edc1659267596a285d56cd4854f4cab3dcf23d52.zip
Move smb share configuration out of smb.conf template
Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
-rw-r--r--vagrant/ansible/roles/samba-glusterfs.setup/tasks/main.yml27
-rw-r--r--vagrant/ansible/roles/samba-glusterfs.setup/templates/smb.conf.j28
-rw-r--r--vagrant/ansible/roles/samba-glusterfs.setup/templates/smb_share.conf.j29
3 files changed, 35 insertions, 9 deletions
diff --git a/vagrant/ansible/roles/samba-glusterfs.setup/tasks/main.yml b/vagrant/ansible/roles/samba-glusterfs.setup/tasks/main.yml
index dfd6fdf..15963e8 100644
--- a/vagrant/ansible/roles/samba-glusterfs.setup/tasks/main.yml
+++ b/vagrant/ansible/roles/samba-glusterfs.setup/tasks/main.yml
@@ -21,7 +21,17 @@
state: yes
persistent: yes
-- name: Copy over smb.conf
+- name: Create fresh directory /etc/samba/smb.shares to contain share definition
+ block:
+ - file:
+ path: /etc/samba/smb.shares/
+ state: absent
+ - file:
+ path: /etc/samba/smb.shares/
+ state: directory
+ mode: '0755'
+
+- name: Create smb.conf
template:
src: smb.conf.j2
dest: /etc/samba/smb.conf
@@ -29,6 +39,21 @@
group: root
mode: '0644'
+- name: Add share configuration
+ block:
+ - name: Create share conf file
+ template:
+ src: smb_share.conf.j2
+ dest: "/etc/samba/smb.shares/{{ samba_share }}.conf"
+ vars:
+ cluster_volume: "{{ gluster_cluster_volume }}"
+
+- name: Include share configuration into smb.conf
+ lineinfile:
+ path: "/etc/samba/smb.conf"
+ line: "include = /etc/samba/smb.shares/{{ samba_share }}.conf"
+ insertafter: EOF
+
- name: Set volume options
gluster_volume:
state: present
diff --git a/vagrant/ansible/roles/samba-glusterfs.setup/templates/smb.conf.j2 b/vagrant/ansible/roles/samba-glusterfs.setup/templates/smb.conf.j2
index 81aaba3..7b40adc 100644
--- a/vagrant/ansible/roles/samba-glusterfs.setup/templates/smb.conf.j2
+++ b/vagrant/ansible/roles/samba-glusterfs.setup/templates/smb.conf.j2
@@ -18,11 +18,3 @@ disable spoolss = yes
printing = bsd
show add printer wizard = no
-[{{ samba_share }}]
-comment = For samba share of volume {{ gluster_cluster_volume }}
-vfs objects = acl_xattr glusterfs
-glusterfs:volume = {{ gluster_cluster_volume }}
-glusterfs:logfile = /var/log/samba/{{ samba_share }}.%M.log
-glusterfs:loglevel = 7
-path = /
-read only = no
diff --git a/vagrant/ansible/roles/samba-glusterfs.setup/templates/smb_share.conf.j2 b/vagrant/ansible/roles/samba-glusterfs.setup/templates/smb_share.conf.j2
new file mode 100644
index 0000000..7354ab6
--- /dev/null
+++ b/vagrant/ansible/roles/samba-glusterfs.setup/templates/smb_share.conf.j2
@@ -0,0 +1,9 @@
+[{{ samba_share }}]
+comment = For samba share of volume {{ cluster_volume }}
+vfs objects = acl_xattr glusterfs
+glusterfs:volume = {{ cluster_volume }}
+glusterfs:logfile = /var/log/samba/{{ samba_share }}.%M.log
+glusterfs:loglevel = 7
+path = /
+read only = no
+