summaryrefslogtreecommitdiffstats
path: root/ci/ansible/roles/common/tasks/main.yml
blob: 14a28d30392e6cc162d18475174594d811894b71 (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
# Copyright (c) 2018 Huawei Technologies Co., Ltd. All Rights Reserved.
#
# 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: set script dir permissions
  file:
    path: ./script
    mode: 0755
    recurse: yes
  ignore_errors: yes
  become: yes
    
- name: check ansible version
  shell: "{{ item }}"
  with_items:
    - bash ./script/check_ansible_version.sh
  become: yes

- name: run the equivalent of "apt-get update" as a separate step
  apt:
    update_cache: yes

- name: install system packages
  package:
    name: "{{ item }}"
    state: present
  with_items:
    - make
    - gcc
    - python-pip

- name: install Red Hat system packages
  package:
    name: "{{ item }}"
    state: present
  with_items:
    - librados-devel
    - librbd-devel
  when: ansible_os_family == "RedHat"

- name: install Ubuntu system packages
  package:
    name: "{{ item }}"
    state: present
  with_items:
    - librados-dev
    - librbd-dev
  when: ansible_os_family == "Debian"

- name: create opensds work directory if it doesn't exist
  file:
    path: "{{ item }}"
    state: directory
    mode: 0755
  with_items:
    - "{{ opensds_work_dir }}"
    - "{{ opensds_config_dir }}"
    - "{{ opensds_driver_config_dir }}"
    - "{{ opensds_log_dir }}"

- name: include scenarios/repository.yml when installing from repository
  include: scenarios/repository.yml
  when: install_from == "repository"

- name: include scenarios/release.yml when installing from release
  include: scenarios/release.yml
  when: install_from == "release"

- name: include scenarios/container.yml when installing from container
  include: scenarios/container.yml
  when: install_from == "container"

- name: copy config templates into opensds global config folder
  copy:
    src: ../../../../conf/
    dest: "{{ opensds_config_dir }}"

- 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
    auth_strategy = {{ opensds_auth_strategy }}

    [osdsdock]
    api_endpoint = {{ dock_endpoint }}
    log_file = {{ dock_log_file }}
    # Choose the type of dock resource, only support 'provisioner' and 'attacher'.
    dock_type = {{ dock_type }}
    # Specify which backends should be enabled, sample,ceph,cinder,lvm and so on.
    enabled_backends = {{ enabled_backend }}

    [database]
    endpoint = {{ db_endpoint }}
    driver = {{ db_driver }}
  args:
    chdir: "{{ opensds_config_dir }}"
  ignore_errors: yes

- name: include nbp-installer role if nbp_plugin_type != hotpot_only
  include_role:
    name: nbp-installer
  when: nbp_plugin_type != "hotpot_only"