diff options
author | leonwang <wanghui71@huawei.com> | 2018-02-23 15:01:06 +0000 |
---|---|---|
committer | leonwang <wanghui71@huawei.com> | 2018-02-23 15:01:14 +0000 |
commit | b9f16e2669ff5a0cde006951ffec5dff84ac29df (patch) | |
tree | 68fb97c133f6ffc7a46bbc988941955b35d91af2 /ci/ansible/roles/common | |
parent | 561c0708b78eed8120b90f0221cd66730c9e8a74 (diff) |
Update opensds ansible
This patch is designed for solving some problems below:
- Sync the latest code with opensds community
- Enable containerized deployment in ansible script
- Fix some bugs in port conflicts of etcd deployment
Change-Id: Id48906b91c08b3a98e6fc3d8d424a1cd2b11f2be
Signed-off-by: leonwang <wanghui71@huawei.com>
Diffstat (limited to 'ci/ansible/roles/common')
-rwxr-xr-x[-rw-r--r--] | ci/ansible/roles/common/tasks/main.yml | 256 |
1 files changed, 121 insertions, 135 deletions
diff --git a/ci/ansible/roles/common/tasks/main.yml b/ci/ansible/roles/common/tasks/main.yml index 7c9a49a..d6bef82 100644..100755 --- a/ci/ansible/roles/common/tasks/main.yml +++ b/ci/ansible/roles/common/tasks/main.yml @@ -1,135 +1,121 @@ ----
-# 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 {{ golang_download_url }} -P /opt/
- tar xvf /opt/{{ golang_tarball }} -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"
+--- +# 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 {{ golang_download_url }} -P /opt/ + tar xvf /opt/{{ golang_tarball }} -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 + +- pip: + name: docker-py + when: container_enabled == true + +- 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 |