- name: check broker deploy directory | |
stat: | |
path: "{{ rocketmq_deploy_path }}/rocketmq" | |
register: deploy_directory | |
- debug: | |
msg: "{{ deploy_directory }}" | |
- name: download rocketmq | |
unarchive: | |
src: "{{ rocketmq_download_url }}" | |
dest: "{{ rocketmq_deploy_path }}" | |
remote_src: yes | |
mode: 0750 | |
when: deploy_directory.stat.exists == False | |
- name: rename rocketmq dir name | |
shell: cd {{ rocketmq_deploy_path }}; if [ ! -d "rocketmq" ]; then mv rocketmq-* rocketmq; fi | |
- name: modify broker log path | |
template: | |
src: logback_broker.xml.j2 | |
dest: "{{ rocketmq_deploy_path }}/rocketmq/conf/logback_broker.xml" | |
- name: modify broker config | |
template: | |
src: broker.conf.j2 | |
dest: "{{ rocketmq_deploy_path }}/rocketmq/conf/broker.conf" | |
- name: copy broker service script | |
template: | |
src: mqbroker.service | |
dest: /usr/lib/systemd/system | |
mode: 0750 | |
- name: check broker process | |
shell: source /etc/profile && jps | grep BrokerStartup | wc -l | |
register: check_status | |
- debug: | |
msg: "{{ check_status }}" | |
- name: optimize os | |
shell: source /etc/profile && sh {{ rocketmq_deploy_path }}/rocketmq/bin/os.sh | |
when: deploy_directory.stat.exists == False | |
- name: start broker | |
shell: | | |
source /etc/profile | |
systemctl disable mqbroker | |
systemctl enable mqbroker | |
systemctl stop mqbroker | |
systemctl start mqbroker | |
when: check_status.stdout|int == 0 |