87ea8161116f082ece96e6cda63d557efe3ad420
[stor4nfv.git] / ci / ansible / roles / osdslet / 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: run osdslet daemon service\r
17   shell:\r
18     cmd: |\r
19       i=0\r
20       while\r
21         i="$((i+1))"\r
22         [ "$i" -lt 4 ]\r
23       do\r
24         nohup bin/osdslet > osdslet.out 2> osdslet.err < /dev/null &\r
25         sleep 5\r
26         ps aux | grep osdslet | grep -v grep && break\r
27       done\r
28   args:\r
29     chdir: "{{ opensds_work_dir }}"\r
30   when: container_enabled == false\r
31 \r
32 - name: run osdslet containerized service\r
33   docker_container:\r
34     name: osdslet\r
35     image: opensdsio/opensds-controller:latest\r
36     state: started\r
37     network_mode: host\r
38     volumes:\r
39     - "/etc/opensds/:/etc/opensds"\r
40   when: container_enabled == true\r