-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from 116davinder/feature/mtls-support
zookeeper quorum sasl + mtls support
- Loading branch information
Showing
27 changed files
with
683 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,5 @@ pulumi/__pycache__ | |
pulumi/*/*.pyc | ||
pulumi/*/venv | ||
pulumi/*/__pycache__ | ||
files/certs | ||
*.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,26 @@ | ||
--- | ||
|
||
# Command to check Cron: crontab -u root -l | ||
#Ansible: zookeeper metric collector | ||
#* * * * * python3 /zookeeper/zooki.py /zookeeper /zookeeper/zookeeper-logs/ | ||
# Command to check Cron: crontab -u zookeeper -l | ||
# Ansible: zookeeper metric collector | ||
# * * * * * python3 /zookeeper/zooki.py /zookeeper /zookeeper/zookeeper-logs/ false | ||
|
||
- hosts: clusterNodes | ||
become: false | ||
gather_facts: false | ||
become: true | ||
gather_facts: true | ||
pre_tasks: | ||
- name: install common utils | ||
ansible.builtin.include_role: | ||
name: common | ||
tasks_from: commonUtils.yml | ||
|
||
- name: copy python requirements.txt | ||
ansible.builtin.copy: | ||
src: "roles/customMetricExporter/files/requirements.txt" | ||
dest: "/tmp/requirements.txt" | ||
|
||
- name: installing requirements.txt with pip3 | ||
ansible.builtin.pip: | ||
requirements: "/tmp/requirements.txt" | ||
executable: pip3 | ||
roles: | ||
- customMetricExporter |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
--- | ||
|
||
# Note: | ||
# this is one-time playbook to migrate non-mtls cluster to tls cluster config | ||
# Ref: https://zookeeper.apache.org/doc/r3.8.0/zookeeperAdmin.html#Upgrading+existing+nonTLS+cluster | ||
|
||
- hosts: clusterNodes | ||
gather_facts: true | ||
tasks: | ||
- name: MigrateToMtls | upload tls keystore and truststore to all nodes | ||
ansible.builtin.include_role: | ||
name: copyFiles | ||
|
||
- hosts: clusterNodes | ||
gather_facts: true | ||
become: true | ||
serial: 1 | ||
tasks: | ||
- name: MigrateToMtls | sslQuourm basic settings in zoo.cfg | ||
ansible.builtin.lineinfile: | ||
path: "{{ zookeeperInstallDir }}/zookeeper-{{ zookeeperVersion }}/conf/zoo.cfg" | ||
regexp: "{{ item.regex }}" | ||
line: "{{ item.line }}" | ||
loop: | ||
- { regex: "^sslQuorum=", line: "sslQuorum=false" } | ||
- { regex: "^portUnification=", line: "portUnification=true" } | ||
- { regex: "^serverCnxnFactory=", line: "serverCnxnFactory=org.apache.zookeeper.server.NettyServerCnxnFactory" } | ||
- { regex: "^ssl.quorum.keyStore.password=", line: "ssl.quorum.keyStore.password={{ zookeeperSslQuorumKeystorePassword }}" } | ||
- { regex: "^ssl.quorum.keyStore.location=", line: "ssl.quorum.keyStore.location={{ zookeeperSslQuorumKeystoreLocation }}" } | ||
- { regex: "^ssl.quorum.trustStore.location=", line: "ssl.quorum.trustStore.location={{ zookeeperSslQuorumTruststoreLocation }}" } | ||
- { regex: "^ssl.quorum.trustStore.password=", line: "ssl.quorum.trustStore.password={{ zookeeperSslQuorumTruststorePassword }}" } | ||
|
||
- name: MigrateToMtls | restarting zookeeper | ||
ansible.builtin.import_role: | ||
name: serviceState | ||
vars: | ||
serviceName: zookeeper | ||
serviceState: restarted | ||
|
||
- name: MigrateToMtls | zookeeper Port Status | ||
ansible.builtin.include_role: | ||
name: portCheck | ||
vars: | ||
PortNumber: "{{ item }}" | ||
PortStatus: started | ||
loop: | ||
- "{{ zookeeperClientPort }}" | ||
|
||
- hosts: localhost | ||
gather_facts: false | ||
tasks: | ||
- name: please check logs of all nodes that "Creating TLS-enabled quorum server socket" message appears in logs file | ||
ansible.builtin.pause: | ||
prompt: "Press enter to confirm or ctrl-c to cancel" | ||
|
||
- hosts: clusterNodes | ||
gather_facts: true | ||
become: true | ||
serial: 1 | ||
tasks: | ||
- name: MigrateToMtls | sslQuourm enabled in zoo.cfg | ||
ansible.builtin.include_role: | ||
name: configure | ||
tasks_from: dynamicConfigs | ||
vars: | ||
- zookeeperConfigFile: zoo.cfg | ||
- zookeeperSslQuorum: true | ||
- zookeeperPortUnification: "true" # force true | ||
|
||
- name: MigrateToMtls | restarting zookeeper | ||
ansible.builtin.import_role: | ||
name: serviceState | ||
vars: | ||
serviceName: zookeeper | ||
serviceState: restarted | ||
|
||
- name: MigrateToMtls | zookeeper Port Status | ||
ansible.builtin.include_role: | ||
name: portCheck | ||
vars: | ||
PortNumber: "{{ item }}" | ||
PortStatus: started | ||
loop: | ||
- "{{ zookeeperClientPort }}" | ||
|
||
- hosts: localhost | ||
gather_facts: false | ||
tasks: | ||
- name: please check logs of all nodes that cluster is working | ||
ansible.builtin.pause: | ||
prompt: "Press enter to confirm or ctrl-c to cancel" | ||
|
||
- hosts: clusterNodes | ||
gather_facts: true | ||
become: true | ||
serial: 1 | ||
tasks: | ||
- name: MigrateToMtls | regenerate zoo.cfg and portUnification disabled | ||
ansible.builtin.include_role: | ||
name: configure | ||
tasks_from: dynamicConfigs | ||
vars: | ||
- zookeeperConfigFile: zoo.cfg | ||
- zookeeperSslQuorum: true | ||
- zookeeperPortUnification: "false" # force false | ||
|
||
- name: MigrateToMtls | restarting zookeeper | ||
ansible.builtin.import_role: | ||
name: serviceState | ||
vars: | ||
serviceName: zookeeper | ||
serviceState: restarted | ||
|
||
- name: MigrateToMtls | zookeeper Port Status | ||
ansible.builtin.include_role: | ||
name: portCheck | ||
vars: | ||
PortNumber: "{{ item }}" | ||
PortStatus: started | ||
loop: | ||
- "{{ zookeeperClientPort }}" | ||
|
||
- hosts: localhost | ||
gather_facts: false | ||
tasks: | ||
- name: please check logs of all nodes that cluster is working | ||
ansible.builtin.debug: | ||
msg: "please set zookeeperSslQuorum=true and zookeeperPortUnification=false in ansible variables for future updates" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
--- | ||
|
||
# Note: | ||
# this is one-time playbook to migrate non-sasl cluster to sasl cluster config | ||
# Ref: https://cwiki.apache.org/confluence/display/ZOOKEEPER/Server-Server+mutual+authentication | ||
|
||
- hosts: clusterNodes | ||
gather_facts: true | ||
become: true | ||
serial: 1 | ||
tasks: | ||
- name: MigrateToSasL | regenerate jaas.conf | ||
ansible.builtin.include_role: | ||
name: configure | ||
tasks_from: dynamicConfigs | ||
vars: | ||
- zookeeperConfigFile: jaas.conf | ||
|
||
- name: MigrateToSasL | regenerate java.env to enable jaas.conf | ||
ansible.builtin.include_role: | ||
name: configure | ||
tasks_from: dynamicConfigs | ||
vars: | ||
- zookeeperConfigFile: java.env | ||
- zookeeperQuorumAuthEnableSasl: true | ||
|
||
- name: MigrateToSasL | enableSasl in zoo.cfg | ||
ansible.builtin.lineinfile: | ||
path: "{{ zookeeperInstallDir }}/zookeeper-{{ zookeeperVersion }}/conf/zoo.cfg" | ||
regexp: "^quorum.auth.enableSasl=" | ||
line: "quorum.auth.enableSasl=true" | ||
|
||
- name: MigrateToSasL | restarting zookeeper | ||
ansible.builtin.import_role: | ||
name: serviceState | ||
vars: | ||
serviceName: zookeeper | ||
serviceState: restarted | ||
|
||
- name: MigrateToSasL | zookeeper Port Status | ||
ansible.builtin.include_role: | ||
name: portCheck | ||
vars: | ||
PortNumber: "{{ item }}" | ||
PortStatus: started | ||
loop: | ||
- "{{ zookeeperClientPort }}" | ||
|
||
- hosts: clusterNodes | ||
gather_facts: true | ||
become: true | ||
serial: 1 | ||
tasks: | ||
- name: MigrateToSasL | learnerRequireSasl in zoo.cfg | ||
ansible.builtin.lineinfile: | ||
path: "{{ zookeeperInstallDir }}/zookeeper-{{ zookeeperVersion }}/conf/zoo.cfg" | ||
regexp: "^quorum.auth.learnerRequireSasl=" | ||
line: "quorum.auth.learnerRequireSasl=true" | ||
|
||
- name: MigrateToSasL | restarting zookeeper | ||
ansible.builtin.import_role: | ||
name: serviceState | ||
vars: | ||
serviceName: zookeeper | ||
serviceState: restarted | ||
|
||
- name: MigrateToSasL | zookeeper Port Status | ||
ansible.builtin.include_role: | ||
name: portCheck | ||
vars: | ||
PortNumber: "{{ item }}" | ||
PortStatus: started | ||
loop: | ||
- "{{ zookeeperClientPort }}" | ||
|
||
- hosts: clusterNodes | ||
gather_facts: true | ||
become: true | ||
serial: 1 | ||
tasks: | ||
- name: MigrateToSasL | regenerate zoo.cfg with all parameters | ||
ansible.builtin.include_role: | ||
name: configure | ||
tasks_from: dynamicConfigs | ||
vars: | ||
- zookeeperConfigFile: zoo.cfg | ||
- zookeeperQuorumAuthEnableSasl: true | ||
|
||
- name: MigrateToSasL | restarting zookeeper | ||
ansible.builtin.import_role: | ||
name: serviceState | ||
vars: | ||
serviceName: zookeeper | ||
serviceState: restarted | ||
|
||
- name: MigrateToSasL | zookeeper Port Status | ||
ansible.builtin.include_role: | ||
name: portCheck | ||
vars: | ||
PortNumber: "{{ item }}" | ||
PortStatus: started | ||
loop: | ||
- "{{ zookeeperClientPort }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.