diff options
author | heluwei <heluwei@huawei.com> | 2017-09-22 15:51:29 +0800 |
---|---|---|
committer | heluwei <heluwei@huawei.com> | 2018-01-06 20:48:16 +0800 |
commit | bf51c0e84ddf5d8abc59fefb49e39de5f874eab4 (patch) | |
tree | e4f4a9301b24ad4ab5e94af2307116a1ebec30b6 /src/spdk/ansible | |
parent | eb2d77147b52fcaf9267dc6157b63aef7e7afbca (diff) |
Add script files of test and spdk-ansible for SPDK
The runtest.py file and the spdk-ansible are submitted. The runtest.py
file is used to execute the scripts of test to validate whether the
SPDK is available. The spdk-ansible is used to install SPDK by the
ansible tool.
Change-Id: I9eca7fb5cfcd2dcf718a0ef99d0ced5f962fd92a
Signed-off-by: heluwei <heluwei@huawei.com>
Diffstat (limited to 'src/spdk/ansible')
-rw-r--r-- | src/spdk/ansible/README.md | 36 | ||||
-rw-r--r-- | src/spdk/ansible/group_vars/common.yml | 21 | ||||
-rw-r--r-- | src/spdk/ansible/site.yml | 11 | ||||
-rw-r--r-- | src/spdk/ansible/tasks/install.yml | 33 |
4 files changed, 101 insertions, 0 deletions
diff --git a/src/spdk/ansible/README.md b/src/spdk/ansible/README.md new file mode 100644 index 0000000..20299a7 --- /dev/null +++ b/src/spdk/ansible/README.md @@ -0,0 +1,36 @@ +# spdk-ansible: deploy spdk +## Install ssh server + sudo apt-get install openssh-server + + if you use root to run spdk-ansible, you should open the file of + /etc/ssh/sshd_config and modify: + PermitRootLogin yes + sudo /etc/init.d/ssh restart + + generate ssh-token: + ssh-keygen -t rsa + ssh-copy-id -i ~/.ssh/id_rsa.pub <romte_ip(eg: username@hostName or username@hostIp)> + +## Install the ansible tool: + sudo add-apt-repository ppa:ansible/ansible + sudo apt-get update + sudo apt-get install ansible + +## Configure Inventory, default in /etc/ansible/hosts: + [spdk_server] + your_host_name or your_host_ip + +## Check if the hosts could be reached: + ansible all -m ping + +## Download spdk-ansible + git clone https://github.com/hellowaywewe/spdk-ansible.git + +## configure spdk-ansible + Configure common.yml according to required vars. + Configure site.yml according to required tasks. + +## Run ansible playbook: (under spdk-ansible root directory) + ansible-playbook site.yml --extra-vars "ansible_sudo_pass=your_user_password" + if you use root to run,you can execute directly: + ansible-playbook site.yml diff --git a/src/spdk/ansible/group_vars/common.yml b/src/spdk/ansible/group_vars/common.yml new file mode 100644 index 0000000..bf72caf --- /dev/null +++ b/src/spdk/ansible/group_vars/common.yml @@ -0,0 +1,21 @@ +########### +# GENERAL # +########### + + +remote_url: https://github.com/spdk/spdk.git + +user_dir: /home/wewe + +ceph_dir: /home/wewe/ceph + +# when SPDK is installed independently, set enabled_install: spdk_alone +# if not, set enabled_install: ceph_spdk +enabled_install: spdk_alone + +# when enabled_install == "spdk_alone",set spdk_dir: /home/<your_user_name>/spdk. +# when enabled_install == "ceph_spdk",set spdk_dir: /home/<your_uesr_name>/ceph/src/spdk +spdk_dir: /home/wewe/spdk + +#system_version include: Ubuntu, Debian, entos, Fedora, FreeBSD +system_version: Ubuntu diff --git a/src/spdk/ansible/site.yml b/src/spdk/ansible/site.yml new file mode 100644 index 0000000..4742181 --- /dev/null +++ b/src/spdk/ansible/site.yml @@ -0,0 +1,11 @@ +--- + +- name: install spdk + become: True + hosts: all + gather_facts: False + vars_files: + - group_vars/common.yml + tasks: + - include_tasks: tasks/install.yml + diff --git a/src/spdk/ansible/tasks/install.yml b/src/spdk/ansible/tasks/install.yml new file mode 100644 index 0000000..7957ba8 --- /dev/null +++ b/src/spdk/ansible/tasks/install.yml @@ -0,0 +1,33 @@ +--- +- name: download spdk source code + shell: git clone "{{ remote_url }}" + args: + chdir: "{{ user_dir }}" + when: enabled_install == "spdk_alone" + +- name: download spdk source code into ceph + shell: git submodule update --init src/spdk + args: + chdir: "{{ ceph_dir }}" + when: enabled_install == "ceph_spdk" + +- name: Install the spdk dependency packages + shell: sudo ./scripts/pkgdep.sh + args: + chdir: "{{ spdk_dir }}" + +- name: Download dpdk + raw: cd {{ spdk_dir }} && sudo git submodule update --init + +### deploy spdk in Ubuntu, Debian, Centos, Fedora +- name: deploy the spdk + raw: ((cd {{ spdk_dir }}/dpdk && make install T=x86_64-native-linuxapp-gcc DESTDIR=./) && (cd {{ spdk_dir }} && ./configure --with-dpdk=./dpdk/x86_64-native-linuxapp-gcc)) && (cd {{ spdk_dir }} && make) + when: + - (system_version == 'Ubuntu' or system_version == 'Debian') or (system_version == 'Centos' or system_version == 'Fedora') + + +### deploy spdk in FreeBSD +- name: deploy the spdk + raw: ((cd {{ spdk_dir }}/dpdk && gmake install T=x86_64-native-linuxapp-gcc DESTDIR=./) && (cd {{ spdk_dir }} && ./configure --with-dpdk=./dpdk/x86_64-native-linuxapp-gcc)) && (cd {{ spdk_dir }} && gmake) + when: + - system_version == 'FreeBSD' |