diff options
author | Sachin Prabhu <sprabhu@redhat.com> | 2020-03-26 17:38:50 +0000 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2020-03-30 20:07:15 +0200 |
commit | 1556430faa44439602b65336a07e830319c29cfa (patch) | |
tree | a897babb962d6c8e23d7db33a4dda7cb83bc1bdf | |
parent | fef09b97c480f0c6fcc938f17de1b6f59a3005b6 (diff) | |
download | samba-integration-1556430faa44439602b65336a07e830319c29cfa.tar.gz samba-integration-1556430faa44439602b65336a07e830319c29cfa.tar.xz samba-integration-1556430faa44439602b65336a07e830319c29cfa.zip |
Add ctdb service to the newly created servers
Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
-rw-r--r-- | vagrant/ansible/cluster-vars.yml | 11 | ||||
-rw-r--r-- | vagrant/ansible/roles/ctdb.setup/tasks/main.yml | 72 | ||||
-rw-r--r-- | vagrant/ansible/roles/node.setup/tasks/main.yml | 2 | ||||
-rw-r--r-- | vagrant/ansible/setup-cluster.yml | 1 |
4 files changed, 86 insertions, 0 deletions
diff --git a/vagrant/ansible/cluster-vars.yml b/vagrant/ansible/cluster-vars.yml index 9104e8d..10f9147 100644 --- a/vagrant/ansible/cluster-vars.yml +++ b/vagrant/ansible/cluster-vars.yml @@ -1,3 +1,5 @@ +ctdb_brick_location: '/bricks/ctdb-brick' + gluster_infra_volume_groups: - { vgname: 'vg_vdb', pvname: '/dev/vdb' } - { vgname: 'vg_vdc', pvname: '/dev/vdc' } @@ -9,10 +11,12 @@ gluster_infra_thinpools: gluster_infra_lv_logicalvols: - { vgname: 'vg_vdb', thinpool: 'vg_vdb_thinpool', lvname: 'vg_vdb_thinlv', lvsize: '9G' } - { vgname: 'vg_vdc', thinpool: 'vg_vdc_thinpool', lvname: 'vg_vdc_thinlv', lvsize: '9G' } + - { vgname: 'vg_vdc', thinpool: 'vg_vdc_thinpool', lvname: 'ctdblv', lvsize: '20M' } gluster_infra_mount_devices: - { path: '/bricks/brick0', vgname: 'vg_vdb', lvname: 'vg_vdb_thinlv' } - { path: '/bricks/brick1', vgname: 'vg_vdc', lvname: 'vg_vdc_thinlv' } + - { path: "{{ ctdb_brick_location }}", vgname: 'vg_vdc', lvname: 'ctdblv' } gluster_infra_fw_ports: - 2049/tcp @@ -21,6 +25,8 @@ gluster_infra_fw_ports: - 5900-6923/tcp - 5666/tcp - 16514/tcp + - 4379/tcp + gluster_infra_fw_permanent: true gluster_infra_fw_state: enabled gluster_infra_fw_zone: public @@ -37,3 +43,8 @@ gluster_cluster_volume: vol gluster_cluster_replica_count: 2 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 diff --git a/vagrant/ansible/roles/ctdb.setup/tasks/main.yml b/vagrant/ansible/roles/ctdb.setup/tasks/main.yml new file mode 100644 index 0000000..c64056a --- /dev/null +++ b/vagrant/ansible/roles/ctdb.setup/tasks/main.yml @@ -0,0 +1,72 @@ +--- +- name: Create the ctdb replicated volume + gluster_volume: + state: present + name: "{{ gluster_features_ctdb_volume }}" + bricks: '{{ ctdb_brick_location }}/ctdb' + cluster: "{{ gluster_cluster_hosts }}" + replicas: "{{ gluster_cluster_replica_count }}" + run_once: yes + +- name: Add ctdb package + yum: + name: ctdb + state: present + +- name: Add ctdb rules to firewalld + firewalld: + service: ctdb + permanent: yes + state: present + state: enabled + +- name: Add recovery lock to ctdb.conf + lineinfile: + dest: /etc/ctdb/ctdb.conf + line: "\trecovery lock = /gluster/lock/recovery.lock" + regexp: "recovery lock" + insertafter: '\[cluster\]' + +# Check bz 1656777 +- name: Temporary workaround the bugs in the ctdb package provided with centos 7. + block: + - name: Create missing directories for ctdb package + file: + path: "{{ item }}" + state: directory + owner: root + group: root + with_items: + - /etc/ctdb/events/legacy + - /var/lib/ctdb/state + - /var/lib/ctdb/persistent/ + - /var/lib/ctdb/volatile/ + + - name: Apply SELinux file context to new directories + command: restorecon -irv /etc/ctdb/events/legacy /var/lib/ctdb/state + + - name: Put SELinux in permissive mode, logging actions that would be blocked. + selinux: + policy: targeted + state: permissive + + - name: Enable check consistency of databases during startup + command: '/bin/ctdb event script enable legacy 00.ctdb' + + - name: Enable check consistency of databases during startup + command: '/bin/ctdb event script enable legacy 01.reclock' + + - name: Enable monitor system resources + command: '/bin/ctdb event script enable legacy 05.system' + + - name: Enable network interface management by ctdb + command: '/bin/ctdb event script enable legacy 10.interface' + + - name: Enable samba management by ctdb + command: '/bin/ctdb event script enable legacy 50.samba' + +- include_role: + name: gluster.features + +- name: Restart ctdb + service: name=ctdb state=restarted enabled=yes diff --git a/vagrant/ansible/roles/node.setup/tasks/main.yml b/vagrant/ansible/roles/node.setup/tasks/main.yml index ec3f880..896870c 100644 --- a/vagrant/ansible/roles/node.setup/tasks/main.yml +++ b/vagrant/ansible/roles/node.setup/tasks/main.yml @@ -26,3 +26,5 @@ vars: tools: - lvm2 + - firewalld + - libselinux-python diff --git a/vagrant/ansible/setup-cluster.yml b/vagrant/ansible/setup-cluster.yml index be1b062..6855cb7 100644 --- a/vagrant/ansible/setup-cluster.yml +++ b/vagrant/ansible/setup-cluster.yml @@ -9,3 +9,4 @@ - node.setup - gluster.infra - gluster.cluster + - ctdb.setup |