diff options
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 + |