-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker_flask.yml
55 lines (48 loc) · 1.22 KB
/
docker_flask.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---
- name: "Docker Container Creation"
hosts: all
become: yes
vars:
- imageName: "anandgopinath/flask:latest"
- containerName: "web"
- ports: "80:5000"
tasks:
- name: "Docker Installation"
shell: amazon-linux-extras install docker -y
- name: "Package Installation"
yum:
name:
- python-pip
state: present
- name: "Installing Docker extension"
pip:
name: docker-py
- name: "Docker service Enable/Restart"
service:
name: docker
state: restarted
enabled: true
register: dockerValue
- name: "Restarting and Enabling docker"
when: dockerValue.changed
service:
name: docker
state: restarted
enabled: true
- name: "Install Docker-Python"
pip:
name: docker-py
state: latest
- name: "Pulling httpd Docker Image"
docker_image:
name: "{{imageName}}"
source: pull
state: present
- name: "Creating Docker Container"
docker_container:
name: "{{containerName}}"
detach: yes
image: "{{imageName}}"
ports: "{{ports}}"
restart_policy: always
state: started