-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTask-10(DockerWebServer)
68 lines (56 loc) · 2.18 KB
/
Task-10(DockerWebServer)
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
67
68
- hosts: localhost
gather_facts: false
tasks:
- name: creating yum repository for docker
yum_repository:
name: "docker"
description: "docker repo"
baseurl: "https://download.docker.com/linux/centos/7/x86_64/stable/" stable/"
gpgcheck: no
- name: download docker-ce
command: "yum install docker-ce -y --nobest"
- name: start docker service
service:
name: "docker"
state: started
enabled: yes
- name: install python36
package:
name: "python36"
state: present
- name: install docker python library
pip:
name: docker-py
- name: httpd image pulling
docker_image:
name: "httpd"
source: pull
- name: creating a directory
file:
path: "/myfolder"
state: directory
- name: creating a file
file:
path: "/myfolder/index.html"
state: file
- name: add contents into the previous file created
copy:
dest: "/myfolder/index.html"
content: "<br/><marquee><h1>This is my new WebPage</h1></marquee> quee><br/>"
- name: start the container
docker_container:
name: "myweb"
image: "httpd"
volumes:
- "/myfolder:/usr/local/apache2/htdocs/"
ports:
- "8081:80"
expose:
- "8081"
state: started
- name: stop firewall
service:
name: "firewalld"
state: stopped
# cd /myfolder/
# touch index.html