rocketmq-ansible/roles/namesrv/tasks/main.yml (37 lines of code) (raw):
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: check namesrv deploy directory
stat:
path: "{{ rocketmq_deploy_path }}/rocketmq"
register: deploy_directory
- debug:
msg: "{{ deploy_directory }}"
- name: download Apache Rocketmq
unarchive:
src: "{{ rocketmq_download_url }}"
dest: "{{ rocketmq_deploy_path }}"
remote_src: yes
mode: 0750
when: deploy_directory.stat.exists == False
- name: rename namesrv deploy directory
shell: cd {{ rocketmq_deploy_path }}; if [ ! -d "rocketmq" ]; then mv rocketmq-* rocketmq; fi
- name: modify namesrv log path
template:
src: logback_namesrv.xml.j2
dest: "{{ rocketmq_deploy_path }}/rocketmq/conf/logback_namesrv.xml"
- name: add namesrv boot mechanism
template:
src: mqnamesrv.service
dest: /usr/lib/systemd/system
mode: 0750
- name: check namesrv status
shell: source /etc/profile && jps | grep NamesrvStartup | wc -l
register: check_status
- debug:
msg: "{{ check_status }}"
- name: start namesrv
shell: |
source /etc/profile
systemctl disable mqnamesrv
systemctl enable mqnamesrv
systemctl stop mqnamesrv
systemctl start mqnamesrv
when: check_status.stdout|int == 0