Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ansible: fix some issues #380

Merged
merged 1 commit into from
Jun 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions curve-ansible/clean_curve_sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
hosts: client
gather_facts: no
any_errors_fatal: true
become: "{{ sudo_or_not | bool }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should add sudo_or_not and other related fields inclient.ini file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should add sudo_or_not and other related fields inclient.ini file.

this pr has included the field 'https://github.com/opencurve/curve/pull/370/files'

tags:
- prepare
roles:
Expand Down
1 change: 1 addition & 0 deletions curve-ansible/clean_nebd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
hosts: client
gather_facts: no
any_errors_fatal: true
become: "{{ sudo_or_not | bool }}"
tags:
- prepare
roles:
Expand Down
5 changes: 4 additions & 1 deletion curve-ansible/common_tasks/check_chunkserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,13 @@
that:
- firmware_version.stdout|version_compare('24.3.0-0050', '>=')

- name: get chunkserver number
include_tasks: "get_chunkserver_number.yml"

- name: check the disk schedule algorithm
shell: cat /sys/block/sd*/queue/scheduler | grep "\[noop\]" | wc -l
register: result
failed_when: result.stdout | int != chunkserver_num
failed_when: result.stdout | int < chunkserver_num | int

- name: check if the disk cache closed
shell: sudo /sbin/hdparm -W /dev/sd* | grep "write-caching"
Expand Down
30 changes: 30 additions & 0 deletions curve-ansible/common_tasks/get_chunkserver_number.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
#
# Copyright (c) 2021 NetEase Inc.
#
# Licensed 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.
#
# Get chunkserver number

- name: get chunkserver number not get disk automatically
set_fact:
chunkserver_num: "{{ disk_list | length }}"
when: not auto_get_disk_list | bool

- name: get chunkserver number get disk automatically
block:
- shell: echo '{{ get_disk_list_cmd }} | wc -l'
register: result
- set_fact:
chunkserver_num: "{{ result.stdout }}"
when: auto_get_disk_list | bool
8 changes: 8 additions & 0 deletions curve-ansible/common_tasks/install_with_yum_apt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,15 @@
register: result
- name: install lib with yum
shell: sudo yum -y install {{ yum_lib_name }}
register: install_result
when: result.rc != 0
- name: install latest repository
shell: sudo yum -y install https://extras.getpagespeed.com/release-latest.rpm
register: repository
when: install_result.rc != 0
- name: retry install
shell: sudo yum -y install {{ yum_lib_name }}
when: install_result.rc != 0 and repository.rc != 0
when:
- "'CentOS' in distro"

Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
# limitations under the License.
#

- name: get chunkserver number
include_tasks: "common_tasks/get_chunkserver_number.yml"

- name: clean chunkserver dat
vars:
end_seq: "{{ chunkserver_num | int - 1}}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
# limitations under the License.
#

- name: get chunkserver number
include_tasks: "common_tasks/get_chunkserver_number.yml"

- name: clean data under data dir
vars:
end_seq: "{{ chunkserver_num | int - 1}}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
- name: clear data dir
shell: sudo rm -rf {{ chunkserver_data_dir }}/chunkserver*

- name: get chunkserver number
include_tasks: "common_tasks/get_chunkserver_number.yml"

- name: create data dir and log dir for each chunkserver
vars:
end_seq: "{{ chunkserver_num | int - 1}}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,13 @@
- name: set backup true
set_fact:
backup: true
- name: check config file exist
stat:
path: "{{ conf_path }}"
register: file_status
- name: backup config file
shell: sudo cp {{ conf_path }} {{ conf_path }}.bak
when: backup is defined
when: backup is defined and file_status.stat.exists
- name: mv config file
shell: sudo mv /tmp/{{ template_name }} {{ conf_path }}
- name: diff two files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,43 +15,45 @@
# limitations under the License.
#

- name: install libunwind
vars:
apt_lib_name: libunwind8
yum_lib_name: libunwind
include_tasks: common_tasks/install_with_yum_apt.yml

- name: install libunwind-dev
vars:
apt_lib_name: libunwind8-dev
yum_lib_name: libunwind-devel
include_tasks: common_tasks/install_with_yum_apt.yml

- name: install bzip2
vars:
apt_lib_name: bzip2
yum_lib_name: bzip2
include_tasks: common_tasks/install_with_yum_apt.yml
- name: install package via deb
include_tasks: "install_deb_package.yml"
when: install_with_deb | bool

- name: install jemalloc
vars:
lib_name: jemalloc
download_url: "{{ jemalloc_download_url }}"
include_tasks: install_jemalloc.yml

- name: install psmisc
vars:
apt_lib_name: psmisc
yum_lib_name: psmisc
include_tasks: common_tasks/install_with_yum_apt.yml
when: chunkserver_format_disk | bool

- name: install chunkserver bin
vars:
remote_dir_name: "{{ curve_bin_dir }}"
local_file_path: "{{ local_chunkserver_package_path }}/bin/"
file_mode: 0755
include_tasks: copy_file_to_remote.yml
- name: install package via tar
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not install the same as
incluede_tasks: "install_tar_package.yml"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not install the same as
incluede_tasks: "install_tar_package.yml"?

because install via tar package do different things based on installed package name. So can not give a unified task.

block:
- name: install libunwind
vars:
apt_lib_name: libunwind8
yum_lib_name: libunwind
include_tasks: common_tasks/install_with_yum_apt.yml
- name: install libunwind-dev
vars:
apt_lib_name: libunwind8-dev
yum_lib_name: libunwind-devel
include_tasks: common_tasks/install_with_yum_apt.yml
- name: install bzip2
vars:
apt_lib_name: bzip2
yum_lib_name: bzip2
include_tasks: common_tasks/install_with_yum_apt.yml
- name: install jemalloc
vars:
lib_name: jemalloc
download_url: "{{ jemalloc_download_url }}"
include_tasks: install_jemalloc.yml
- name: install psmisc
vars:
apt_lib_name: psmisc
yum_lib_name: psmisc
include_tasks: common_tasks/install_with_yum_apt.yml
when: chunkserver_format_disk | bool
- name: install chunkserver bin
vars:
remote_dir_name: "{{ curve_bin_dir }}"
local_file_path: "{{ local_chunkserver_package_path }}/bin/"
file_mode: 0755
include_tasks: copy_file_to_remote.yml
when: not install_with_deb | bool

- name: generate chunkserver_ctl.sh
vars:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,46 +15,47 @@
# limitations under the License.
#

- name: install libunwind
vars:
apt_lib_name: libunwind8
yum_lib_name: libunwind
include_tasks: common_tasks/install_with_yum_apt.yml

- name: install libunwind-dev
vars:
apt_lib_name: libunwind8-dev
yum_lib_name: libunwind-devel
include_tasks: common_tasks/install_with_yum_apt.yml

- name: install libuuid
vars:
apt_lib_name: libuuid1
yum_lib_name: libuuid
include_tasks: common_tasks/install_with_yum_apt.yml

- name: install libuuid-dev
vars:
apt_lib_name: uuid-dev
yum_lib_name: libuuid-devel
include_tasks: common_tasks/install_with_yum_apt.yml

- name: install daemon
include_tasks: install_daemon.yml

- name: install mds bin
vars:
remote_dir_name: "{{ curve_bin_dir }}"
local_file_path: "{{ local_mds_package_path }}/bin/"
file_mode: 0755
include_tasks: copy_file_to_remote.yml

- name: install mds lib
vars:
remote_dir_name: "{{ curve_lib_dir }}"
local_file_path: "{{ local_mds_package_path }}/lib/"
file_mode: 0644
include_tasks: copy_file_to_remote.yml
- name: install package via deb
include_tasks: "install_deb_package.yml"
when: install_with_deb | bool

- name: install package via tar
block:
- name: install libunwind
vars:
apt_lib_name: libunwind8
yum_lib_name: libunwind
include_tasks: common_tasks/install_with_yum_apt.yml
- name: install libunwind-dev
vars:
apt_lib_name: libunwind8-dev
yum_lib_name: libunwind-devel
include_tasks: common_tasks/install_with_yum_apt.yml
- name: install libuuid
vars:
apt_lib_name: libuuid1
yum_lib_name: libuuid
include_tasks: common_tasks/install_with_yum_apt.yml
- name: install libuuid-dev
vars:
apt_lib_name: uuid-dev
yum_lib_name: libuuid-devel
include_tasks: common_tasks/install_with_yum_apt.yml
- name: install daemon
include_tasks: install_daemon.yml
- name: install mds bin
vars:
remote_dir_name: "{{ curve_bin_dir }}"
local_file_path: "{{ local_mds_package_path }}/bin/"
file_mode: 0755
include_tasks: copy_file_to_remote.yml
- name: install mds lib
vars:
remote_dir_name: "{{ curve_lib_dir }}"
local_file_path: "{{ local_mds_package_path }}/lib/"
file_mode: 0644
include_tasks: copy_file_to_remote.yml
when: not install_with_deb | bool

- name: generate mds-daemon.sh
template: src=mds-daemon.sh.j2 dest={{ deploy_dir }}/mds-daemon.sh mode=0755
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@
# limitations under the License.
#

- name: pull prom/prometheus:latest
shell: sudo docker image pull prom/prometheus:latest
- name: install package via deb
include_tasks: "install_deb_package.yml"
when: install_with_deb | bool

- name: pull grafana/grafana:latest
shell: sudo docker image pull grafana/grafana:latest

- name: promoon/reporter:latest
shell: sudo docker image pull promoon/reporter:latest

- name: install jq
vars:
apt_lib_name: jq
yum_lib_name: jq
include_tasks: common_tasks/install_with_yum_apt.yml

- name: install monitor work space
vars:
remote_dir_name: "{{ monitor_work_dir }}"
local_file_path: "{{ local_monitor_package_path }}/"
file_mode: 0777
include_tasks: copy_file_to_remote.yml

- name: generate curve-monitor.sh
template: src=curve-monitor.sh.j2 dest={{ deploy_dir }}/curve-monitor.sh mode=0755
- name: install package via tar
block:
- name: pull prom/prometheus:latest
shell: sudo docker image pull prom/prometheus:latest
- name: pull grafana/grafana:latest
shell: sudo docker image pull grafana/grafana:latest
- name: promoon/reporter:latest
shell: sudo docker image pull promoon/reporter:latest
- name: install jq
vars:
apt_lib_name: jq
yum_lib_name: jq
include_tasks: common_tasks/install_with_yum_apt.yml
- name: install monitor work space
vars:
remote_dir_name: "{{ monitor_work_dir }}"
local_file_path: "{{ local_monitor_package_path }}/"
file_mode: 0777
include_tasks: copy_file_to_remote.yml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The task genrate curve-monitor.sh lost.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The task genrate curve-monitor.sh lost.

because the 'curve-monitor.sh' has included in debain and tar pacages, so don't need creat again.

when: not install_with_deb | bool
Loading