diff options
author | leonwang <wanghui71@huawei.com> | 2018-01-10 03:44:46 +0000 |
---|---|---|
committer | leonwang <wanghui71@huawei.com> | 2018-01-10 08:43:38 +0000 |
commit | 64df7bc3bc70d49153409436b411fb327691a4d5 (patch) | |
tree | c078dda45831938f0268e66f774390b4079309c7 /ci/ansible/roles/common/tasks | |
parent | 0786fde30eba926b097617dea9ca4683ac2fa1b7 (diff) |
Push zealand version of opensds ansible as base-code of Stor4NFV
As we discussed on last meeting, the installer script of stor4nfv
will be based on opensds ansible, so in this patch I download the
first release (zealand) of opensds code and push the ansible script
into stor4nfv repo so that we don't need to modify opensds code.
Please be free to ask if you have any question.
Change-Id: I7b50729977b195fa64e8d9a09f415d9f3329d71f
Signed-off-by: leonwang <wanghui71@huawei.com>
Diffstat (limited to 'ci/ansible/roles/common/tasks')
-rw-r--r-- | ci/ansible/roles/common/tasks/main.yml | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/ci/ansible/roles/common/tasks/main.yml b/ci/ansible/roles/common/tasks/main.yml new file mode 100644 index 0000000..20f5381 --- /dev/null +++ b/ci/ansible/roles/common/tasks/main.yml @@ -0,0 +1,135 @@ +---
+# If we can't get golang installed before any module is used we will fail
+# so just try what we can to get it installed
+- name: check for golang
+ stat:
+ path: /usr/local/go
+ ignore_errors: yes
+ register: systemgolang
+
+- name: install golang for debian based systems
+ shell:
+ cmd: |
+ set -e
+ set -x
+
+ wget https://storage.googleapis.com/golang/go1.9.linux-amd64.tar.gz
+ tar xvf go1.9.linux-amd64.tar.gz -C /usr/local/
+ cat >> /etc/profile <<GOLANG__CONFIG_DOC
+ export GOROOT=/usr/local/go
+ export GOPATH=\$HOME/gopath
+ export PATH=\$PATH:\$GOROOT/bin:\$GOPATH/bin
+ GOLANG__CONFIG_DOC
+
+ executable: /bin/bash
+ ignore_errors: yes
+ when:
+ - systemgolang.stat.exists is undefined or systemgolang.stat.exists == false
+
+- name: Run the equivalent of "apt-get update" as a separate step
+ apt:
+ update_cache: yes
+
+- name: install librados-dev external package
+ apt:
+ name: librados-dev
+
+- name: install librbd-dev external package
+ apt:
+ name: librbd-dev
+
+- name: check for opensds source code existed
+ stat:
+ path: "{{ opensds_root_dir }}"
+ ignore_errors: yes
+ register: opensdsexisted
+
+- name: download opensds source code
+ git:
+ repo: "{{ remote_url }}"
+ dest: "{{ opensds_root_dir }}"
+ when:
+ - opensdsexisted.stat.exists is undefined or opensdsexisted.stat.exists == false
+
+- name: check for opensds binary file existed
+ stat:
+ path: "{{ opensds_build_dir }}"
+ ignore_errors: yes
+ register: opensdsbuilt
+
+- name: build opensds binary file
+ shell: . /etc/profile; make
+ args:
+ chdir: "{{ opensds_root_dir }}"
+ when:
+ - opensdsbuilt.stat.exists is undefined or opensdsbuilt.stat.exists == false
+
+- name: create opensds global config directory if it doesn't exist
+ file:
+ path: "{{ opensds_config_dir }}/driver"
+ state: directory
+ mode: 0755
+
+- name: create opensds log directory if it doesn't exist
+ file:
+ path: "{{ opensds_log_dir }}"
+ state: directory
+ mode: 0755
+
+- name: configure opensds global info
+ shell: |
+ cat > opensds.conf <<OPENSDS_GLOABL_CONFIG_DOC
+ [osdslet]
+ api_endpoint = {{ controller_endpoint }}
+ graceful = True
+ log_file = {{ controller_log_file }}
+ socket_order = inc
+
+ [osdsdock]
+ api_endpoint = {{ dock_endpoint }}
+ log_file = {{ dock_log_file }}
+ # Specify which backends should be enabled, sample,ceph,cinder,lvm and so on.
+ enabled_backends = {{ enabled_backend }}
+
+ [lvm]
+ name = {{ lvm_name }}
+ description = {{ lvm_description }}
+ driver_name = {{ lvm_driver_name }}
+ config_path = {{ lvm_config_path }}
+
+ [ceph]
+ name = {{ ceph_name }}
+ description = {{ ceph_description }}
+ driver_name = {{ ceph_driver_name }}
+ config_path = {{ ceph_config_path }}
+
+ [cinder]
+ name = {{ cinder_name }}
+ description = {{ cinder_description }}
+ driver_name = {{ cinder_driver_name }}
+ config_path = {{ cinder_config_path }}
+
+ [database]
+ endpoint = {{ db_endpoint }}
+ driver = {{ db_driver }}
+ args:
+ chdir: "{{ opensds_config_dir }}"
+ ignore_errors: yes
+
+- name: copy opensds lvm backend file if specify lvm backend
+ copy:
+ src: ../../../group_vars/lvm/lvm.yaml
+ dest: "{{ lvm_config_path }}"
+ when: enabled_backend == "lvm"
+
+- name: copy opensds ceph backend file if specify ceph backend
+ copy:
+ src: ../../../group_vars/ceph/ceph.yaml
+ dest: "{{ ceph_config_path }}"
+ when: enabled_backend == "ceph"
+
+- name: copy opensds cinder backend file if specify cinder backend
+ copy:
+ src: ../../../group_vars/cinder/cinder.yaml
+ dest: "{{ cinder_config_path }}"
+ when: enabled_backend == "cinder"
|