-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker_conf.yml
66 lines (57 loc) · 1.39 KB
/
docker_conf.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
56
57
58
59
60
61
62
63
64
65
66
- hosts: "all"
tasks:
- name: Configuring Docker Repository
yum_repository:
name: Docker
description: "Docker Repo"
baseurl: "https://download.docker.com/linux/centos/docker-ce.repo"
gpgcheck: no
register: x
- name: Checking Configuration Status
debug:
var: x.failed
- name: Installing Docker
package:
name: "docker-ce-18.06.3.ce-3.el7.x86_64"
state: present
register: y
- name: Checking Install Status
debug:
var: y.failed
- name: Starting Docker Daemon
service:
name: docker
state: started
enabled: yes
when: y.failed == false
- name: Install
command: "pip install docker-py"
- name: Pull a Docker Image
docker_image:
name: httpd
tag: latest
source: pull
register: z
- name: Checking Pull Status
debug:
var: z
- name: Creating a Persistent Volume Dir
file:
path: "/root/pv"
state: directory
- name: Copying the HTML code in the Directory
copy:
src: "/root/Desktop/index.html"
dest: "/root/pv"
- name: Launching an HTTPD Container
when: z.failed == false
docker_container:
name: apache-server
image: httpd
state: started
exposed_ports:
- "80"
ports:
- "8888:80"
volumes:
- /root/pv:/usr/local/apache2/htdocs