-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathpkr-ansible.yml
38 lines (38 loc) · 1011 Bytes
/
pkr-ansible.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
---
- name: "Docker Container For Python-Flask"
hosts: all
become: yes
vars:
- image_name: "Mention-Image-Name"
- container_name: "Mention-Container-Name"
- ports: "8081:5000"
tasks:
- name: "Installing PIP"
yum:
name:
- pip
- git
state: present
- name: "Dependency Install dokcer-py"
pip:
name: docker-py
state: present
- name: "Installing Docker"
shell: amazon-linux-extras install docker -y
- name: "Docker Service Starting / Enabling"
service:
name: docker
state: restarted
enabled: true
- name: "Pulling httpd Docker Image"
docker_image:
name: "{{image_name}}"
source: pull
- name: "Creating Docker Container"
docker_container:
name: "{{container_name}}"
detach: yes
restart_policy: always
image: "{{image_name}}"
ports: "{{ports}}"
state: started