1 # Copyright (c) 2019 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
6 # http://www.apache.org/licenses/LICENSE-2.0
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
16 MAINTAINER csit-dev <csit-dev@lists.fd.io>
17 LABEL Description="CSIT cobbler service image."
24 ARG cobbler_http_port=60080
25 ARG cobbler_https_port=60443
27 # Install dependencies
28 RUN yum -y install epel-release \
46 && rm -rf /var/cache/yum
48 # Workaround for Cobbler 2.8.4 bug
49 RUN pip2.7 install -U django==1.9.13
51 # Copy CSIT configration
52 COPY supervisord/supervisord.conf /etc/supervisord.conf
53 COPY etc/cobbler/dhcp.template /etc/cobbler/dhcp.template
54 COPY var/lib/cobbler/kickstarts/* /var/lib/cobbler/kickstarts/
55 COPY etc/httpd/conf.d/cobbler_web.conf /etc/httpd/conf.d/cobbler_web.conf
58 -e "/^default_password_crypted/ s|:.*$|: \"${cobbler_sys_pass}\"|" \
59 -e "/^next_server:/ s/:.*$/: ${cobbler_ip_addr}/" \
60 -e "/^server/ s/:.*$/: ${cobbler_ip_addr}/" \
61 -e "/^http_port:/ s/:.*$/: ${cobbler_http_port}/" \
62 -e "/^pxe_just_once:/ s/:.*$/: 1/" \
63 -e "/^manage_dhcp:/ s/:.*$/: 1/" \
64 /etc/cobbler/settings \
65 && sed -i "s/service %s restart/supervisorctl restart %s/g" \
66 /usr/lib/python2.7/site-packages/cobbler/modules/sync_post_restart_services.py \
67 && sed -i "s/Listen 80/Listen ${cobbler_http_port}/g" \
68 /etc/httpd/conf/httpd.conf \
69 && sed -i "s/Listen 443 https/Listen ${cobbler_https_port} https/g" \
70 /etc/httpd/conf.d/ssl.conf
72 # Change Cobbler WEB password
73 RUN echo -n "cobbler:Cobbler:${cobbler_web_pass}" \
76 | xargs printf "%s:%s:%s\n" cobbler Cobbler > "/etc/cobbler/users.digest"
78 # Create Cobbler directories
79 RUN mkdir -p /var/lib/cobbler/config/distros.d \
80 && mkdir -p /var/lib/cobbler/config/files.d \
81 && mkdir -p /var/lib/cobbler/config/images.d \
82 && mkdir -p /var/lib/cobbler/config/mgmtclasses.d \
83 && mkdir -p /var/lib/cobbler/config/packages.d \
84 && mkdir -p /var/lib/cobbler/config/profiles.d \
85 && mkdir -p /var/lib/cobbler/config/repos.d \
86 && mkdir -p /var/lib/cobbler/config/systems.d \
87 && mkdir -p /var/www/cobbler/links/ \
88 && touch /usr/share/cobbler/web/cobbler.wsgi
90 # Expose TFTP WWW COBBLER
92 EXPOSE $cobbler_http_port
93 EXPOSE $cobbler_https_port
96 ENTRYPOINT /usr/bin/supervisord -c /etc/supervisord.conf