Update the latest version of ansible script
[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 system packages\r
35   package:\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: install Red Hat system packages\r
44   package:\r
45     name: "{{ item }}"\r
46     state: present\r
47   with_items:\r
48     - librados-devel\r
49     - librbd-devel\r
50   when: ansible_os_family == "RedHat"\r
51 \r
52 - name: install Ubuntu system packages\r
53   package:\r
54     name: "{{ item }}"\r
55     state: present\r
56   with_items:\r
57     - librados-dev\r
58     - librbd-dev\r
59   when: ansible_os_family == "Debian"\r
60 \r
61 - name: create opensds work directory if it doesn't exist\r
62   file:\r
63     path: "{{ item }}"\r
64     state: directory\r
65     mode: 0755\r
66   with_items:\r
67     - "{{ opensds_work_dir }}"\r
68     - "{{ opensds_config_dir }}"\r
69     - "{{ opensds_driver_config_dir }}"\r
70     - "{{ opensds_log_dir }}"\r
71 \r
72 - name: include scenarios/repository.yml when installing from repository\r
73   include: scenarios/repository.yml\r
74   when: install_from == "repository"\r
75 \r
76 - name: include scenarios/release.yml when installing from release\r
77   include: scenarios/release.yml\r
78   when: install_from == "release"\r
79 \r
80 - name: include scenarios/container.yml when installing from container\r
81   include: scenarios/container.yml\r
82   when: install_from == "container"\r
83 \r
84 - name: copy config templates into opensds global config folder\r
85   copy:\r
86     src: ../../../../conf/\r
87     dest: "{{ opensds_config_dir }}"\r
88 \r
89 - name: configure opensds global info\r
90   shell: |\r
91     cat > opensds.conf <<OPENSDS_GLOABL_CONFIG_DOC\r
92     [osdslet]\r
93     api_endpoint = {{ controller_endpoint }}\r
94     graceful = True\r
95     log_file = {{ controller_log_file }}\r
96     socket_order = inc\r
97     auth_strategy = {{ opensds_auth_strategy }}\r
98 \r
99     [osdsdock]\r
100     api_endpoint = {{ dock_endpoint }}\r
101     log_file = {{ dock_log_file }}\r
102     # Choose the type of dock resource, only support 'provisioner' and 'attacher'.\r
103     dock_type = {{ dock_type }}\r
104     # Specify which backends should be enabled, sample,ceph,cinder,lvm and so on.\r
105     enabled_backends = {{ enabled_backend }}\r
106 \r
107     [database]\r
108     endpoint = {{ db_endpoint }}\r
109     driver = {{ db_driver }}\r
110   args:\r
111     chdir: "{{ opensds_config_dir }}"\r
112   ignore_errors: yes\r
113 \r
114 - name: include nbp-installer role if nbp_plugin_type != hotpot_only\r
115   include_role:\r
116     name: nbp-installer\r
117   when: nbp_plugin_type != "hotpot_only"\r