diff options
author | Sachin Prabhu <sprabhu@redhat.com> | 2020-07-17 17:12:30 +0100 |
---|---|---|
committer | spuiuk <sachin.prabhu@gmail.com> | 2020-08-24 12:26:57 +0100 |
commit | edc1659267596a285d56cd4854f4cab3dcf23d52 (patch) | |
tree | 010167ea2ea1c7b0aed7e86fe0f6cf6e22c9139a /vagrant/ansible | |
parent | b023fb0d43cd194db4810fb675a94a64e50ddb4c (diff) | |
download | samba-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>
Diffstat (limited to 'vagrant/ansible')
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 + |