blob: 8d70c0b49597b7212182537e9d1f486b4cbf540c (
plain)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
# Copyright (c) 2019 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM centos:7
MAINTAINER csit-dev <csit-dev@lists.fd.io>
LABEL Description="CSIT cobbler service image."
LABEL Version="0.1"
# Build arguments
ARG cobbler_sys_pass
ARG cobbler_web_pass
ARG cobbler_ip_addr
ARG cobbler_http_port=60080
ARG cobbler_https_port=60443
# Install dependencies
RUN yum -y install epel-release \
&& yum -y install \
cobbler \
cobbler-web \
fence-agents \
python-pip \
curl \
dhcp \
bind \
file \
debmirror \
net-tools \
rsync \
pykickstart \
supervisor \
wget \
which \
&& yum clean all \
&& rm -rf /var/cache/yum
# Workaround for Cobbler 2.8.4 bug
RUN pip2.7 install -U django==1.9.13
# Copy CSIT configration
COPY supervisord/supervisord.conf /etc/supervisord.conf
COPY etc/cobbler/dhcp.template /etc/cobbler/dhcp.template
COPY var/lib/cobbler/kickstarts/* /var/lib/cobbler/kickstarts/
COPY etc/httpd/conf.d/cobbler_web.conf /etc/httpd/conf.d/cobbler_web.conf
RUN sed -i \
-e "/^default_password_crypted/ s|:.*$|: \"${cobbler_sys_pass}\"|" \
-e "/^next_server:/ s/:.*$/: ${cobbler_ip_addr}/" \
-e "/^server/ s/:.*$/: ${cobbler_ip_addr}/" \
-e "/^http_port:/ s/:.*$/: ${cobbler_http_port}/" \
-e "/^pxe_just_once:/ s/:.*$/: 1/" \
-e "/^manage_dhcp:/ s/:.*$/: 1/" \
/etc/cobbler/settings \
&& sed -i "s/service %s restart/supervisorctl restart %s/g" \
/usr/lib/python2.7/site-packages/cobbler/modules/sync_post_restart_services.py \
&& sed -i "s/Listen 80/Listen ${cobbler_http_port}/g" \
/etc/httpd/conf/httpd.conf \
&& sed -i "s/Listen 443 https/Listen ${cobbler_https_port} https/g" \
/etc/httpd/conf.d/ssl.conf
# Change Cobbler WEB password
RUN echo -n "cobbler:Cobbler:${cobbler_web_pass}" \
| md5sum \
| cut -d' ' -f1 \
| xargs printf "%s:%s:%s\n" cobbler Cobbler > "/etc/cobbler/users.digest"
# Create Cobbler directories
RUN mkdir -p /var/lib/cobbler/config/distros.d \
&& mkdir -p /var/lib/cobbler/config/files.d \
&& mkdir -p /var/lib/cobbler/config/images.d \
&& mkdir -p /var/lib/cobbler/config/mgmtclasses.d \
&& mkdir -p /var/lib/cobbler/config/packages.d \
&& mkdir -p /var/lib/cobbler/config/profiles.d \
&& mkdir -p /var/lib/cobbler/config/repos.d \
&& mkdir -p /var/lib/cobbler/config/systems.d \
&& mkdir -p /var/www/cobbler/links/ \
&& touch /usr/share/cobbler/web/cobbler.wsgi
# Expose TFTP WWW COBBLER
EXPOSE 69
EXPOSE $cobbler_http_port
EXPOSE $cobbler_https_port
EXPOSE 25151
ENTRYPOINT /usr/bin/supervisord -c /etc/supervisord.conf
|