summaryrefslogtreecommitdiffstats
path: root/ci/ansible/roles/common/tasks/main.yml
blob: d6bef823e2a65d22798a3bc3d69dc04564738693 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
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

- 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