summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSachin Prabhu <sprabhu@redhat.com>2020-08-15 16:52:48 +0100
committerspuiuk <sachin.prabhu@gmail.com>2020-08-24 12:26:57 +0100
commitbc8bd8045dcb9e6a2df8f8ac327739934f190e2c (patch)
treebacd9915ba61603cca1455632f0395fa1f01d5b7
parent47f4bd3d99292ca5c93c010f4abbc6036ecb44c5 (diff)
Replace variable samba_share with a list
Replace samba_share with a dict samba_shares. This allows us to have multiple samba shares exporting multiple cluster volumes. Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
-rw-r--r--vagrant/ansible/cluster-vars.yml4
-rw-r--r--vagrant/ansible/roles/client.prep/tasks/main.yml3
-rw-r--r--vagrant/ansible/roles/samba-glusterfs.setup/tasks/main.yml21
3 files changed, 16 insertions, 12 deletions
diff --git a/vagrant/ansible/cluster-vars.yml b/vagrant/ansible/cluster-vars.yml
index dc47866..00281f7 100644
--- a/vagrant/ansible/cluster-vars.yml
+++ b/vagrant/ansible/cluster-vars.yml
@@ -70,4 +70,6 @@ samba_netbios_name: "GLUSTERTEST"
samba_users:
- { username: 'test1', password: 'x', uid: '2001' }
- { username: 'test2', password: 'x', uid: '2002' }
-samba_share: "gluster-{{ replicate_cluster_volume }}"
+
+samba_shares:
+ - { cluster_volume: "vol-replicate", share_name: "gluster-vol-replicate" }
diff --git a/vagrant/ansible/roles/client.prep/tasks/main.yml b/vagrant/ansible/roles/client.prep/tasks/main.yml
index 41e1c0b..2a78698 100644
--- a/vagrant/ansible/roles/client.prep/tasks/main.yml
+++ b/vagrant/ansible/roles/client.prep/tasks/main.yml
@@ -33,6 +33,5 @@
vars:
private_interfaces: "{{ ctdb_network_private_interfaces }}"
public_interfaces: "{{ ctdb_network_public_interfaces }}"
- exported_sharenames:
- - "{{ samba_share }}"
+ exported_sharenames: "{{ samba_shares| map(attribute='share_name') | list }}"
test_users: "{{ samba_users }}"
diff --git a/vagrant/ansible/roles/samba-glusterfs.setup/tasks/main.yml b/vagrant/ansible/roles/samba-glusterfs.setup/tasks/main.yml
index 2d71157..58617f2 100644
--- a/vagrant/ansible/roles/samba-glusterfs.setup/tasks/main.yml
+++ b/vagrant/ansible/roles/samba-glusterfs.setup/tasks/main.yml
@@ -45,20 +45,23 @@
template:
src: smb_share.conf.j2
dest: "/etc/samba/smb.shares/{{ samba_share }}.conf"
- vars:
- cluster_volume: "{{ replicated_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
+ vars:
+ cluster_volume: "{{ item.cluster_volume }}"
+ samba_share: "{{ item.share_name }}"
+ with_items: "{{ samba_shares }}"
+ - name: Include share configuration into smb.conf
+ lineinfile:
+ path: "/etc/samba/smb.conf"
+ line: "include = /etc/samba/smb.shares/{{ item.share_name }}.conf"
+ insertafter: EOF
+ with_items: "{{ samba_shares }}"
- name: Mount glusterfs using fuse mount and set world writable permissions
include_tasks:
file: "fix_share_permissions.yml"
vars:
- volume: "localhost:/{{ replicated_cluster_volume }}"
+ volume: "localhost:/{{ item.cluster_volume }}"
+ with_items: "{{ samba_shares }}"
run_once: true
- name: Create test users