-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.yml
36 lines (32 loc) · 937 Bytes
/
main.yml
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
---
- name: "Deploy tomcat server with sample app"
hosts: host1
connection: local
tasks:
- name: "Check if app is already running"
script: /usr/local/bin/pytest
register: test_result
ignore_errors: true
- name: "Build - Run - Test container"
block:
- name: "Build Docker image from Dockerfile"
docker_image:
name: sample
build:
path: docker
pull: yes
source: build
state: present
#such line
- name: "Running the container"
docker_container:
name: sample
image: sample:latest
ports:
- "8080:8080"
state: started
- name: "Wait few seconds till application is up"
command: sleep 5
- name: "Make sure app is running"
script: /usr/local/bin/pytest
when: test_result is failed