summaryrefslogtreecommitdiffstats
path: root/vagrant
diff options
context:
space:
mode:
Diffstat (limited to 'vagrant')
-rw-r--r--vagrant/ansible/cluster-vars.yml12
-rw-r--r--vagrant/ansible/roles/ctdb.setup/tasks/main.yml24
2 files changed, 32 insertions, 4 deletions
diff --git a/vagrant/ansible/cluster-vars.yml b/vagrant/ansible/cluster-vars.yml
index 76808ce..7280276 100644
--- a/vagrant/ansible/cluster-vars.yml
+++ b/vagrant/ansible/cluster-vars.yml
@@ -45,9 +45,15 @@ gluster_cluster_transport: 'tcp'
gluster_cluster_bricks: '/bricks/brick0/vol,/bricks/brick1/vol'
#Autogenerate these values containing ip addresses
-gluster_features_ctdb_nodes: 192.168.122.100,192.168.122.101
-gluster_features_ctdb_publicaddr: '192.168.123.10/24 eth2,192.168.123.11/24 eth2'
-gluster_features_ctdb_volume: ctdb
+ctdb_network_private_interfaces:
+ - "192.168.122.100"
+ - "192.168.122.101"
+ctdb_network_public_interfaces:
+ - "192.168.123.10"
+ - "192.168.123.11"
+ctdb_network_public_interface_subnet_mask: "24"
+ctdb_network_public_interface_name: "eth2"
+ctdb_glusterfs_volume: "ctdb"
samba_netbios_name: "GLUSTERTEST"
samba_users:
diff --git a/vagrant/ansible/roles/ctdb.setup/tasks/main.yml b/vagrant/ansible/roles/ctdb.setup/tasks/main.yml
index 099374a..6bcea4b 100644
--- a/vagrant/ansible/roles/ctdb.setup/tasks/main.yml
+++ b/vagrant/ansible/roles/ctdb.setup/tasks/main.yml
@@ -1,8 +1,26 @@
---
+- name: Check for required variables
+ block:
+ - fail:
+ msg: "Please provide required variable: ctdb_network_private_interfaces"
+ when: ctdb_network_private_interfaces is undefined
+ - fail:
+ msg: "Please provide these required variable: ctdb_network_public_interfaces"
+ when: ctdb_network_public_interfaces is undefined
+ - fail:
+ msg: "Please provide these required variable: ctdb_network_public_interface_subnet_mask"
+ when: ctdb_network_public_interface_subnet_mask is undefined
+ - fail:
+ msg: "Please provide these required variable: ctdb_network_public_interface_name"
+ when: ctdb_network_public_interface_name is undefined
+ - fail:
+ msg: "Please provide these required variable: ctdb_glusterfs_volume"
+ when: ctdb_glusterfs_volume is undefined
+
- name: Create the ctdb replicated volume
gluster_volume:
state: present
- name: "{{ gluster_features_ctdb_volume }}"
+ name: "{{ ctdb_glusterfs_volume }}"
bricks: '{{ ctdb_brick_location }}/ctdb'
cluster: "{{ gluster_cluster_hosts }}"
replicas: "{{ gluster_cluster_replica_count }}"
@@ -52,6 +70,10 @@
- include_role:
name: gluster.features
+ vars:
+ gluster_features_ctdb_nodes: "{{ ctdb_network_private_interfaces | join(',') }}"
+ gluster_features_ctdb_publicaddr: "{{ ctdb_network_public_interfaces | map('regex_replace','(^.*$)','\\1/' + ctdb_network_public_interface_subnet_mask + ' ' + ctdb_network_public_interface_name) | list |join (',') }}"
+ gluster_features_ctdb_volume: "{{ ctdb_glusterfs_volume }}"
- name: Restart ctdb
service: name=ctdb state=restarted enabled=yes