Skip to content

Commit

Permalink
Merge pull request #22 from bai-charisu/fix-ansible
Browse files Browse the repository at this point in the history
fix: curvefsTool and curve-ansible for centos
  • Loading branch information
opencurveadmin authored Jul 21, 2020
2 parents 27fc975 + 014f52f commit 4b93038
Show file tree
Hide file tree
Showing 23 changed files with 178 additions and 112 deletions.
7 changes: 6 additions & 1 deletion curve-ansible/client.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ localhost ansible_ssh_host=127.0.0.1
localhost ansible_ssh_host=127.0.0.1

[client:vars]
ansible_ssh_port=1046
nebd_package_version="1.0.2+e3fa47f"
nbd_package_version=""
sdk_package_version="0.0.6.1+160be351"
Expand All @@ -27,3 +26,9 @@ mds_port=6666
[all:vars]
need_confirm=true
need_update_config=true
curve_bin_dir=/usr/bin
curve_lib_dir=/usr/lib
curve_include_dir=/usr/include
curvefs_dir=/usr/curvefs
ansible_ssh_port=22
lib_install_prefix=/usr/local
32 changes: 0 additions & 32 deletions curve-ansible/roles/generate_config/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,38 +241,6 @@ etcd_proxy_dial_timeout: 1000
etcd_proxy_write_timeout: 5000
etcd_proxy_read_timeout: 0

etcd_client_transport_security:
# Path to the client server TLS cert file.
cert-file:

# Path to the client server TLS key file.
key-file:

# Enable client cert authentication.
client-cert-auth: false

# Path to the client server TLS trusted CA cert file.
trusted-ca-file:

# Client TLS using generated certificates
auto-tls: false

etcd_peer_transport_security:
# Path to the peer server TLS cert file.
cert-file:

# Path to the peer server TLS key file.
key-file:

# Enable peer client cert authentication.
client-cert-auth: false

# Path to the peer server TLS trusted CA cert file.
trusted-ca-file:

# Peer TLS using generated certificates.
auto-tls: false

etcd_debug: false

etcd_logger: zap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,6 @@ proxy-write-timeout: {{ etcd_proxy_write_timeout }}
# Time (in milliseconds) for a read to timeout.
proxy-read-timeout: {{ etcd_proxy_read_timeout }}

client-transport-security: {{ etcd_client_transport_security }}

peer-transport-security: {{ etcd_peer_transport_security }}

# Enable debug-level logging for etcd.
debug: {{ etcd_debug }}

Expand Down
26 changes: 8 additions & 18 deletions curve-ansible/roles/install_package/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,45 +17,35 @@

install_with_deb: false
tmp_dir: /tmp/curve-ansible-tmp-files
curve_bin_dir: /usr/bin
curve_lib_dir: /usr/lib
curve_include_dir: /usr/include
curvefs_dir: /usr/curvefs
local_mds_package_path: ../curve-mds
mds_remote_tmp_dir: /tmp/mds
mds_bin_dir: /usr/bin
mds_lib_dir: /usr/lib
mds_log_dir: /data/log/curve/mds
local_chunkserver_package_path: ../curve-chunkserver
chunkserver_bin_dir: /usr/bin
local_aws_sdk_package_path: ../aws-sdk
aws_sdk_lib_dir: /usr/lib
aws_sdk_include_dir: /usr/include
local_curve_sdk_package_path: ../curve-sdk
curve_sdk_bin_dir: /usr/bin
curve_sdk_lib_dir: /usr/lib
curve_sdk_include_dir: /usr/include
curve_sdk_curvefs_dir: /usr/curvefs
local_nebd_package_path: ../../nebd-package
nebd_bin_dir: /usr/bin
nebd_lib_dir: /usr/lib
local_nbd_package_path: ../../nbd-package
nbd_bin_dir: /usr/bin
snapshot_bin_dir: /usr/bin
snapshot_clone_server_log_dir: /data/log/curve/snapshotclone
snapshotcloneserver_bin_dir: /usr/bin
local_snapshotcloneserver_package_path: ../curve-snapshotcloneserver
snapshotcloneserver_lib_dir: /usr/lib

local_snapshotcloneserver_nginx_package_path: ../curve-nginx
snapshotcloneserver_nginx_dir: /etc/curve/nginx

local_tool_package_path: ../curve-tools
tool_bin_dir: /usr/bin


etcd_download_url: https://github.com/etcd-io/etcd/releases/download
etcd_version: v3.4.0
etcd_download_dir: /tmp
install_etcd_dir: /usr/bin

lib_download_dir: /tmp
download_dir: /tmp
libunwind_download_url: http://download.savannah.gnu.org/releases/libunwind/libunwind-1.1.tar.gz
jemalloc_download_url: https://github.com/jemalloc/jemalloc/releases/download/jemalloc-3.6.0.tar.bz2
jemalloc_download_url: https://github.com/jemalloc/jemalloc/releases/download/3.6.0/jemalloc-3.6.0.tar.bz2
lib_install_prefix: /usr/local
libnl_download_url: http://www.infradead.org/~tgr/libnl/files/libnl-3.2.25.tar.gz
daemon_download_url: http://libslack.org/daemon/download/daemon-0.6.4.tar.gz
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
#
# Copyright (c) 2020 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.
#

- name: determine if lib installed
ignore_errors: true
shell: /sbin/ldconfig -p | grep {{ lib_name }}
register: ldconfig_res

- name: set lib_installed
set_fact:
lib_installed: true
when: ldconfig_res.stdout != ""
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@

- name: install aws-sdk lib
vars:
remote_dir_name: "{{ aws_sdk_lib_dir }}"
remote_dir_name: "{{ curve_lib_dir }}"
local_file_path: "{{ local_aws_sdk_package_path }}/lib/"
file_mode: 0644
include_tasks: copy_file_to_remote.yml

- name: install aws-sdk include
vars:
remote_dir_name: "{{ aws_sdk_include_dir }}"
remote_dir_name: "{{ curve_include_dir }}"
local_file_path: "{{ local_aws_sdk_package_path }}/include/"
file_mode: 0644
include_tasks: copy_file_to_remote.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,26 @@
- name: install libunwind
vars:
lib_name: libunwind
lib_download_url: "{{ libunwind_download_url }}"
download_url: "{{ libunwind_download_url }}"
include_tasks: install_lib_with_source_code.yml

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

- name: install chunkserver bin
vars:
remote_dir_name: "{{ chunkserver_bin_dir }}"
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: generate chunkserver_ctl.sh
vars:
enable_chunkfilepool: "{{ chunkserver_format_disk }}"
jemalloc_path: "{{ lib_install_prefix }}/lib/libjemalloc.so.1"
template: src=chunkserver_ctl.sh.j2 dest={{ deploy_dir }}/chunkserver_ctl.sh mode=0755

- name: generate chunkserver_deploy.sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,19 @@
- name: install libuuid
include_tasks: install_libuuid.yml

- name: install daemon
include_tasks: install_daemon.yml

- name: install mds bin
vars:
remote_dir_name: "{{ mds_bin_dir }}"
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: "{{ mds_lib_dir }}"
remote_dir_name: "{{ curve_lib_dir }}"
local_file_path: "{{ local_mds_package_path }}/lib/"
file_mode: 0644
include_tasks: copy_file_to_remote.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

- name: install nbd bin
vars:
remote_dir_name: "{{ nbd_bin_dir }}"
remote_dir_name: "{{ curve_bin_dir }}"
local_file_path: "{{ local_nbd_package_path }}/bin/"
file_mode: 0755
include_tasks: copy_file_to_remote.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,28 @@

- name: install curve-sdk bin
vars:
remote_dir_name: "{{ curve_sdk_bin_dir }}"
remote_dir_name: "{{ curve_bin_dir }}"
local_file_path: "{{ local_curve_sdk_package_path }}/bin/"
file_mode: 0755
include_tasks: copy_file_to_remote.yml

- name: install curve-sdk lib
vars:
remote_dir_name: "{{ curve_sdk_lib_dir }}"
remote_dir_name: "{{ curve_lib_dir }}"
local_file_path: "{{ local_curve_sdk_package_path }}/lib/"
file_mode: 0644
include_tasks: copy_file_to_remote.yml

- name: install curve-sdk include
vars:
remote_dir_name: "{{ curve_sdk_include_dir }}"
remote_dir_name: "{{ curve_include_dir }}"
local_file_path: "{{ local_curve_sdk_package_path }}/include/"
file_mode: 0644
include_tasks: copy_file_to_remote.yml

- name: install curve-sdk curvefs
vars:
remote_dir_name: "{{ curve_sdk_curvefs_dir }}"
remote_dir_name: "{{ curvefs_dir }}"
local_file_path: "{{ local_curve_sdk_package_path }}/curvefs/"
file_mode: 0644
include_tasks: copy_file_to_remote.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,19 @@
- name: install libuuid
include_tasks: install_libuuid.yml

- name: install daemon
include_tasks: install_daemon.yml

- name: install snapshotcloneserver bin
vars:
remote_dir_name: "{{ snapshotcloneserver_bin_dir }}"
remote_dir_name: "{{ curve_bin_dir }}"
local_file_path: "{{ local_snapshotcloneserver_package_path }}/bin/"
file_mode: 0755
include_tasks: copy_file_to_remote.yml

- name: install snapshotcloneserver lib
vars:
remote_dir_name: "{{ snapshotcloneserver_lib_dir}}"
remote_dir_name: "{{ curve_lib_dir}}"
local_file_path: "{{ local_snapshotcloneserver_package_path }}/lib/"
file_mode: 0644
include_tasks: copy_file_to_remote.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

- name: install tool bin
vars:
remote_dir_name: "{{ tool_bin_dir }}"
remote_dir_name: "{{ curve_bin_dir }}"
local_file_path: "{{ local_tool_package_path }}/bin/"
file_mode: 0755
include_tasks: copy_file_to_remote.yml
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
#
# Copyright (c) 2020 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.
#

- name: determine if daemon installed
ignore_errors: true
shell: daemon --version
register: daemon_res

- name: set daemon_installed
set_fact:
daemon_installed: true
when: daemon_res.rc == 0

- name: install lib if not installed
vars:
download_url: "{{ daemon_download_url }}"
include_tasks: install_with_source_code.yml
when: not daemon_installed
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
register: etcd_version_res
when: stat_etcd_res.stat.exists

- name: install daemon
include_tasks: install_daemon.yml

- name: install etcd if etcd not installed or version not match
block:
- name: download etcd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,16 @@
shell: /sbin/ldconfig -p | grep {{ lib_name }}
register: ldconfig_res

- name: set lib_installed
- name: set lib_installed true
set_fact:
lib_installed: true
when: ldconfig_res.stdout != ""

- name: install lib when not installed
block:
- name: download lib
get_url:
url: "{{ download_url }}"
dest: "{{ lib_download_dir }}"
validate_certs: no
timeout: 60
register: get_url_result
until: not get_url_result.failed
retries: 5
delay: 3

- name: unarchive lib
unarchive:
remote_src: true
list_files: true
src: "{{ get_url_result.dest }}"
dest: "{{ lib_download_dir }}"
register: unarchive_result

- name: get unarcive dir
shell: echo "{{ get_url_result.dest }}" | awk -F "." '{print $1}'
- name: set lib_installed false
set_fact:
lib_installed: false
when: ldconfig_res.stdout == ""

- name: install lib
shell: >
chdir="{{ lib_download_dir }}/{{ unarchive_result.files[0] }}"
./configure && make && sudo make install
- name: install lib if not installed
include_tasks: install_with_source_code.yml
when: not lib_installed
Loading

0 comments on commit 4b93038

Please sign in to comment.