daee059374bad17bb2b860dd3f36e4f4d948a02c
[stor4nfv.git] / ci / ansible / roles / common / tasks / main.yml
1 # Copyright (c) 2018 Huawei Technologies Co., Ltd. All Rights Reserved.\r
2 #\r
3 # Licensed under the Apache License, Version 2.0 (the "License");\r
4 # you may not use this file except in compliance with the License.\r
5 # You may obtain a copy of the License at\r
6 #\r
7 #     http://www.apache.org/licenses/LICENSE-2.0\r
8 #\r
9 # Unless required by applicable law or agreed to in writing, software\r
10 # distributed under the License is distributed on an "AS IS" BASIS,\r
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
12 # See the License for the specific language governing permissions and\r
13 # limitations under the License.\r
14 \r
15 ---\r
16 - name: set script dir permissions\r
17   file:\r
18     path: ./script\r
19     mode: 0755\r
20     recurse: yes\r
21   ignore_errors: yes\r
22   become: yes\r
23     \r
24 - name: check ansible version\r
25   shell: "{{ item }}"\r
26   with_items:\r
27     - bash ./script/check_ansible_version.sh\r
28   become: yes\r
29 \r
30 - name: run the equivalent of "apt-get update" as a separate step\r
31   apt:\r
32     update_cache: yes\r
33 \r
34 - name: install make, gcc and pip external packages\r
35   apt:\r
36     name: "{{ item }}"\r
37     state: present\r
38   with_items:\r
39     - make\r
40     - gcc\r
41     - python-pip\r
42 \r
43 - name: create opensds work directory if it doesn't exist\r
44   file:\r
45     path: "{{ item }}"\r
46     state: directory\r
47     mode: 0755\r
48   with_items:\r
49     - "{{ opensds_work_dir }}"\r
50     - "{{ opensds_config_dir }}"\r
51     - "{{ opensds_driver_config_dir }}"\r
52     - "{{ opensds_log_dir }}"\r
53 \r
54 - name: include scenarios/repository.yml when installing from repository\r
55   include: scenarios/repository.yml\r
56   when: install_from == "repository"\r
57 \r
58 - name: include scenarios/release.yml when installing from release\r
59   include: scenarios/release.yml\r
60   when: install_from == "release"\r
61 \r
62 - name: include scenarios/container.yml when installing from container\r
63   include: scenarios/container.yml\r
64   when: install_from == "container"\r
65 \r
66 - name: copy config templates into opensds global config folder\r
67   copy:\r
68     src: ../../../../conf/\r
69     dest: "{{ opensds_config_dir }}"\r
70 \r
71 - name: configure opensds global info\r
72   shell: |\r
73     cat > opensds.conf <<OPENSDS_GLOABL_CONFIG_DOC\r
74     [osdslet]\r
75     api_endpoint = {{ controller_endpoint }}\r
76     graceful = True\r
77     log_file = {{ controller_log_file }}\r
78     socket_order = inc\r
79     auth_strategy = {{ opensds_auth_strategy }}\r
80 \r
81     [osdsdock]\r
82     api_endpoint = {{ dock_endpoint }}\r
83     log_file = {{ dock_log_file }}\r
84     # Choose the type of dock resource, only support 'provisioner' and 'attacher'.\r
85     dock_type = {{ dock_type }}\r
86     # Specify which backends should be enabled, sample,ceph,cinder,lvm and so on.\r
87     enabled_backends = {{ enabled_backend }}\r
88 \r
89     [database]\r
90     endpoint = {{ db_endpoint }}\r
91     driver = {{ db_driver }}\r
92   args:\r
93     chdir: "{{ opensds_config_dir }}"\r
94   ignore_errors: yes\r
95 \r
96 - name: include nbp-installer role if nbp_plugin_type != hotpot_only\r
97   include_role:\r
98     name: nbp-installer\r
99   when: nbp_plugin_type != "hotpot_only"\r