diff options
author | Sachin Prabhu <sprabhu@redhat.com> | 2020-03-30 10:26:24 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2020-04-14 11:45:58 +0200 |
commit | d9e4ac474b164ea75a886fc03fe7905e31cd912e (patch) | |
tree | de789c5efed28621df8227b3234ef91c11901f41 /vagrant | |
parent | 868291a908f7d89f358cc39f8f4179282285c562 (diff) | |
download | samba-integration-d9e4ac474b164ea75a886fc03fe7905e31cd912e.tar.gz samba-integration-d9e4ac474b164ea75a886fc03fe7905e31cd912e.tar.xz samba-integration-d9e4ac474b164ea75a886fc03fe7905e31cd912e.zip |
Change the way we specify ip addresses in ansible
This makes it easier to reuse the ip address list for other purposes.
Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Diffstat (limited to 'vagrant')
-rw-r--r-- | vagrant/ansible/cluster-vars.yml | 12 | ||||
-rw-r--r-- | vagrant/ansible/roles/ctdb.setup/tasks/main.yml | 24 |
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 |