Update the latest version of ansible script
[stor4nfv.git] / ci / ansible / roles / osdsdock / 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: include scenarios/lvm.yml\r
17   include: scenarios/lvm.yml\r
18   when: enabled_backend == "lvm"\r
19 \r
20 - name: include scenarios/ceph.yml\r
21   include: scenarios/ceph.yml\r
22   when: enabled_backend == "ceph"\r
23 \r
24 - name: include scenarios/cinder.yml\r
25   include: scenarios/cinder.yml\r
26   when: enabled_backend == "cinder" and use_cinder_standalone == false\r
27 \r
28 - name: include scenarios/cinder_standalone.yml\r
29   include: scenarios/cinder_standalone.yml\r
30   when: enabled_backend == "cinder" and use_cinder_standalone == true\r
31 \r
32 - name: run osdsdock daemon service\r
33   shell:\r
34     cmd: |\r
35       i=0\r
36       while\r
37         i="$((i+1))"\r
38         [ "$i" -lt 4 ]\r
39       do\r
40         nohup bin/osdsdock > osdsdock.out 2> osdsdock.err < /dev/null &\r
41         sleep 5\r
42         ps aux | grep osdsdock | grep -v grep && break\r
43       done\r
44   args:\r
45     chdir: "{{ opensds_work_dir }}"\r
46   when: install_from != "container"\r
47 \r
48 - name: run osdsdock containerized service\r
49   docker_container:\r
50     name: osdsdock\r
51     image: "{{ dock_docker_image }}"\r
52     state: started\r
53     network_mode: host\r
54     privileged: true\r
55     volumes:\r
56     - "/etc/opensds:/etc/opensds"\r
57     - "/etc/ceph:/etc/ceph"\r
58     - "/dev/:/dev/"\r
59     - "/run/:/run/:shared"\r
60     - "/etc/localtime:/etc/localtime:ro"\r
61     - "/lib/modules:/lib/modules:ro"\r
62   when: install_from == "container"\r