From a360411cb8c775dffa24a4157cec2b566cbde6f3 Mon Sep 17 00:00:00 2001 From: Harry Huang Date: Tue, 7 Nov 2017 15:30:51 +0800 Subject: Add compass-docker-compose 1. Add ansible for docker compose containerized compass 2. deploy/conf/compass.conf no longer specify image tags for runtime. build.yaml now is added into compass tarball to be the only place determine image tags 3. This patch is based on patch: https://gerrit.opnfv.org/gerrit/#/c/47393/ use merged compass-tasks 4. Tempoarily using private docker repo for compass-tasks. Switch to opnfv repo when patch https://gerrit.opnfv.org/gerrit/#/c/47329/ is merged 5. Modify ansible callback module accrodingly Change-Id: I0728a9002a1cc7804c9e8f13bd1afdccb684a159 Signed-off-by: Harry Huang --- util/docker-compose/roles/compass/files/pipework | 443 ++++++++++ .../roles/compass/files/prepare_ansible.sh | 8 + .../roles/compass/files/preseed_post_anamon | 80 ++ .../roles/compass/files/switch_list.conf | 3 + .../roles/compass/files/up_containers.sh | 3 + util/docker-compose/roles/compass/tasks/main.yml | 139 +++ .../roles/compass/templates/cobbler.conf.j2 | 9 + .../roles/compass/templates/dhcp.template.j2 | 97 ++ .../roles/compass/templates/distro_signatures.json | 974 +++++++++++++++++++++ .../roles/compass/templates/docker-compose.yml.j2 | 103 +++ .../roles/compass/templates/machine_list.conf.j2 | 14 + .../roles/compass/templates/named.template.j2 | 31 + .../roles/compass/templates/prepare_ansible.sh.j2 | 8 + .../roles/compass/templates/settings.j2 | 450 ++++++++++ .../roles/compass/templates/zone.template.j2 | 17 + 15 files changed, 2379 insertions(+) create mode 100755 util/docker-compose/roles/compass/files/pipework create mode 100755 util/docker-compose/roles/compass/files/prepare_ansible.sh create mode 100755 util/docker-compose/roles/compass/files/preseed_post_anamon create mode 100755 util/docker-compose/roles/compass/files/switch_list.conf create mode 100755 util/docker-compose/roles/compass/files/up_containers.sh create mode 100755 util/docker-compose/roles/compass/tasks/main.yml create mode 100755 util/docker-compose/roles/compass/templates/cobbler.conf.j2 create mode 100755 util/docker-compose/roles/compass/templates/dhcp.template.j2 create mode 100755 util/docker-compose/roles/compass/templates/distro_signatures.json create mode 100755 util/docker-compose/roles/compass/templates/docker-compose.yml.j2 create mode 100755 util/docker-compose/roles/compass/templates/machine_list.conf.j2 create mode 100755 util/docker-compose/roles/compass/templates/named.template.j2 create mode 100755 util/docker-compose/roles/compass/templates/prepare_ansible.sh.j2 create mode 100755 util/docker-compose/roles/compass/templates/settings.j2 create mode 100755 util/docker-compose/roles/compass/templates/zone.template.j2 (limited to 'util/docker-compose/roles/compass') diff --git a/util/docker-compose/roles/compass/files/pipework b/util/docker-compose/roles/compass/files/pipework new file mode 100755 index 00000000..6d796fc4 --- /dev/null +++ b/util/docker-compose/roles/compass/files/pipework @@ -0,0 +1,443 @@ +#!/bin/sh +# This script is jpetazzo's work. The only reason for its +# existence in the repo is to saving a working copy in case +# the original one gets deleted. +# +# This code should (try to) follow Google's Shell Style Guide +# (https://google-styleguide.googlecode.com/svn/trunk/shell.xml) +set -e + +case "$1" in + --wait) + WAIT=1 + ;; + --direct-phys) + DIRECT_PHYS=1 + shift + ;; +esac + +IFNAME=$1 + +# default value set further down if not set here +CONTAINER_IFNAME= +if [ "$2" = "-i" ]; then + CONTAINER_IFNAME=$3 + shift 2 +fi + +if [ "$2" = "-l" ]; then + LOCAL_IFNAME=$3 + shift 2 +fi + +#inet or inet6 +FAMILY_FLAG="-4" +if [ "$2" = "-a" ]; then + FAMILY_FLAG="-$3" + shift 2 +fi + +GUESTNAME=$2 +IPADDR=$3 +MACADDR=$4 + +case "$MACADDR" in + *@*) + VLAN="${MACADDR#*@}" + VLAN="${VLAN%%@*}" + MACADDR="${MACADDR%%@*}" + ;; + *) + VLAN= + ;; +esac + +# did they ask to generate a custom MACADDR? +# generate the unique string +case "$MACADDR" in + U:*) + macunique="${MACADDR#*:}" + # now generate a 48-bit hash string from $macunique + MACADDR=$(echo $macunique|md5sum|sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/') + ;; +esac + + +[ "$IPADDR" ] || [ "$WAIT" ] || { + echo "Syntax:" + echo "pipework [-i containerinterface] [-l localinterfacename] [-a addressfamily] /[@default_gateway] [macaddr][@vlan]" + echo "pipework [-i containerinterface] [-l localinterfacename] dhcp [macaddr][@vlan]" + echo "pipework route " + echo "pipework --wait [-i containerinterface]" + exit 1 +} + +# Succeed if the given utility is installed. Fail otherwise. +# For explanations about `which` vs `type` vs `command`, see: +# http://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script/677212#677212 +# (Thanks to @chenhanxiao for pointing this out!) +installed () { + command -v "$1" >/dev/null 2>&1 +} + +# Google Styleguide says error messages should go to standard error. +warn () { + echo "$@" >&2 +} +die () { + status="$1" + shift + warn "$@" + exit "$status" +} + +# First step: determine type of first argument (bridge, physical interface...), +# Unless "--wait" is set (then skip the whole section) +if [ -z "$WAIT" ]; then + if [ -d "/sys/class/net/$IFNAME" ] + then + if [ -d "/sys/class/net/$IFNAME/bridge" ]; then + IFTYPE=bridge + BRTYPE=linux + elif installed ovs-vsctl && ovs-vsctl list-br|grep -q "^${IFNAME}$"; then + IFTYPE=bridge + BRTYPE=openvswitch + elif [ "$(cat "/sys/class/net/$IFNAME/type")" -eq 32 ]; then # InfiniBand IPoIB interface type 32 + IFTYPE=ipoib + # The IPoIB kernel module is fussy, set device name to ib0 if not overridden + CONTAINER_IFNAME=${CONTAINER_IFNAME:-ib0} + PKEY=$VLAN + else IFTYPE=phys + fi + else + case "$IFNAME" in + br*) + IFTYPE=bridge + BRTYPE=linux + ;; + ovs*) + if ! installed ovs-vsctl; then + die 1 "Need OVS installed on the system to create an ovs bridge" + fi + IFTYPE=bridge + BRTYPE=openvswitch + ;; + route*) + IFTYPE=route + ;; + dummy*) + IFTYPE=dummy + ;; + *) die 1 "I do not know how to setup interface $IFNAME." ;; + esac + fi +fi + +# Set the default container interface name to eth1 if not already set +CONTAINER_IFNAME=${CONTAINER_IFNAME:-eth1} + +[ "$WAIT" ] && { + while true; do + # This first method works even without `ip` or `ifconfig` installed, + # but doesn't work on older kernels (e.g. CentOS 6.X). See #128. + grep -q '^1$' "/sys/class/net/$CONTAINER_IFNAME/carrier" && break + # This method hopefully works on those older kernels. + ip link ls dev "$CONTAINER_IFNAME" && break + sleep 1 + done > /dev/null 2>&1 + exit 0 +} + +[ "$IFTYPE" = bridge ] && [ "$BRTYPE" = linux ] && [ "$VLAN" ] && { + die 1 "VLAN configuration currently unsupported for Linux bridge." +} + +[ "$IFTYPE" = ipoib ] && [ "$MACADDR" ] && { + die 1 "MACADDR configuration unsupported for IPoIB interfaces." +} + +# Second step: find the guest (for now, we only support LXC containers) +while read _ mnt fstype options _; do + [ "$fstype" != "cgroup" ] && continue + echo "$options" | grep -qw devices || continue + CGROUPMNT=$mnt +done < /proc/mounts + +[ "$CGROUPMNT" ] || { + die 1 "Could not locate cgroup mount point." +} + +# Try to find a cgroup matching exactly the provided name. +N=$(find "$CGROUPMNT" -name "$GUESTNAME" | wc -l) +case "$N" in + 0) + # If we didn't find anything, try to lookup the container with Docker. + if installed docker; then + RETRIES=3 + while [ "$RETRIES" -gt 0 ]; do + DOCKERPID=$(docker inspect --format='{{ .State.Pid }}' "$GUESTNAME") + [ "$DOCKERPID" != 0 ] && break + sleep 1 + RETRIES=$((RETRIES - 1)) + done + + [ "$DOCKERPID" = 0 ] && { + die 1 "Docker inspect returned invalid PID 0" + } + + [ "$DOCKERPID" = "" ] && { + die 1 "Container $GUESTNAME not found, and unknown to Docker." + } + else + die 1 "Container $GUESTNAME not found, and Docker not installed." + fi + ;; + 1) true ;; + *) die 1 "Found more than one container matching $GUESTNAME." ;; +esac + +# only check IPADDR if we are not in a route mode +[ "$IFTYPE" != route ] && { + case "$IPADDR" in + # Let's check first if the user asked for DHCP allocation. + dhcp|dhcp:*) + # Use Docker-specific strategy to run the DHCP client + # from the busybox image, in the network namespace of + # the container. + if ! [ "$DOCKERPID" ]; then + warn "You asked for a Docker-specific DHCP method." + warn "However, $GUESTNAME doesn't seem to be a Docker container." + warn "Try to replace 'dhcp' with another option?" + die 1 "Aborting." + fi + DHCP_CLIENT=${IPADDR%%:*} + ;; + udhcpc|udhcpc:*|udhcpc-f|udhcpc-f:*|dhcpcd|dhcpcd:*|dhclient|dhclient:*|dhclient-f|dhclient-f:*) + DHCP_CLIENT=${IPADDR%%:*} + # did they ask for the client to remain? + DHCP_FOREGROUND= + [ "${DHCP_CLIENT: -2}" = '-f' ] && { + DHCP_FOREGROUND=true + } + DHCP_CLIENT=${DHCP_CLIENT%-f} + if ! installed "$DHCP_CLIENT"; then + die 1 "You asked for DHCP client $DHCP_CLIENT, but I can't find it." + fi + ;; + # Alright, no DHCP? Then let's see if we have a subnet *and* gateway. + */*@*) + GATEWAY="${IPADDR#*@}" GATEWAY="${GATEWAY%%@*}" + IPADDR="${IPADDR%%@*}" + ;; + # No gateway? We need at least a subnet, anyway! + */*) : ;; + # ... No? Then stop right here. + *) + warn "The IP address should include a netmask." + die 1 "Maybe you meant $IPADDR/24 ?" + ;; + esac +} + +# If a DHCP method was specified, extract the DHCP options. +if [ "$DHCP_CLIENT" ]; then + case "$IPADDR" in + *:*) DHCP_OPTIONS="${IPADDR#*:}" ;; + esac +fi + +if [ "$DOCKERPID" ]; then + NSPID=$DOCKERPID +else + NSPID=$(head -n 1 "$(find "$CGROUPMNT" -name "$GUESTNAME" | head -n 1)/tasks") + [ "$NSPID" ] || { + # it is an alternative way to get the pid + NSPID=$(lxc-info -n "$GUESTNAME" | grep PID | grep -Eo '[0-9]+') + [ "$NSPID" ] || { + die 1 "Could not find a process inside container $GUESTNAME." + } + } +fi + +# Check if an incompatible VLAN device already exists +[ "$IFTYPE" = phys ] && [ "$VLAN" ] && [ -d "/sys/class/net/$IFNAME.VLAN" ] && { + ip -d link show "$IFNAME.$VLAN" | grep -q "vlan.*id $VLAN" || { + die 1 "$IFNAME.VLAN already exists but is not a VLAN device for tag $VLAN" + } +} + +[ ! -d /var/run/netns ] && mkdir -p /var/run/netns +rm -f "/var/run/netns/$NSPID" +ln -s "/proc/$NSPID/ns/net" "/var/run/netns/$NSPID" + +# Check if we need to create a bridge. +[ "$IFTYPE" = bridge ] && [ ! -d "/sys/class/net/$IFNAME" ] && { + [ "$BRTYPE" = linux ] && { + (ip link add dev "$IFNAME" type bridge > /dev/null 2>&1) || (brctl addbr "$IFNAME") + ip link set "$IFNAME" up + } + [ "$BRTYPE" = openvswitch ] && { + ovs-vsctl add-br "$IFNAME" + } +} + +[ "$IFTYPE" != "route" ] && [ "$IFTYPE" != "dummy" ] && MTU=$(ip link show "$IFNAME" | awk '{print $5}') + +# If it's a bridge, we need to create a veth pair +[ "$IFTYPE" = bridge ] && { + if [ -z "$LOCAL_IFNAME" ]; then + LOCAL_IFNAME="v${CONTAINER_IFNAME}pl${NSPID}" + fi + GUEST_IFNAME="v${CONTAINER_IFNAME}pg${NSPID}" + # Does the link already exist? + if ip link show "$LOCAL_IFNAME" >/dev/null 2>&1; then + # link exists, is it in use? + if ip link show "$LOCAL_IFNAME" up | grep -q "UP"; then + echo "Link $LOCAL_IFNAME exists and is up" + exit 1 + fi + # delete the link so we can re-add it afterwards + ip link del "$LOCAL_IFNAME" + fi + ip link add name "$LOCAL_IFNAME" mtu "$MTU" type veth peer name "$GUEST_IFNAME" mtu "$MTU" + case "$BRTYPE" in + linux) + (ip link set "$LOCAL_IFNAME" master "$IFNAME" > /dev/null 2>&1) || (brctl addif "$IFNAME" "$LOCAL_IFNAME") + ;; + openvswitch) + if ! ovs-vsctl list-ports "$IFNAME" | grep -q "^${LOCAL_IFNAME}$"; then + ovs-vsctl add-port "$IFNAME" "$LOCAL_IFNAME" ${VLAN:+tag="$VLAN"} + fi + ;; + esac + ip link set "$LOCAL_IFNAME" up +} + +# If it's a physical interface, create a macvlan subinterface +[ "$IFTYPE" = phys ] && { + [ "$VLAN" ] && { + [ ! -d "/sys/class/net/${IFNAME}.${VLAN}" ] && { + ip link add link "$IFNAME" name "$IFNAME.$VLAN" mtu "$MTU" type vlan id "$VLAN" + } + ip link set "$IFNAME" up + IFNAME=$IFNAME.$VLAN + } + + if [ ! -z "$DIRECT_PHYS" ]; then + GUEST_IFNAME=$IFNAME + else + GUEST_IFNAME=ph$NSPID$CONTAINER_IFNAME + ip link add link "$IFNAME" dev "$GUEST_IFNAME" mtu "$MTU" type macvlan mode bridge + fi + + ip link set "$IFNAME" up +} + +# If it's an IPoIB interface, create a virtual IPoIB interface (the IPoIB +# equivalent of a macvlan device) +# +# Note: no macvlan subinterface nor Ethernet bridge can be created on top of an +# IPoIB interface. InfiniBand is not Ethernet. IPoIB is an IP layer on top of +# InfiniBand, without an intermediate Ethernet layer. +[ "$IFTYPE" = ipoib ] && { + GUEST_IFNAME="${IFNAME}.${NSPID}" + + # If a partition key is provided, use it + [ "$PKEY" ] && { + GUEST_IFNAME="${IFNAME}.${PKEY}.${NSPID}" + PKEY="pkey 0x$PKEY" + } + + ip link add link "$IFNAME" name "$GUEST_IFNAME" type ipoib $PKEY + ip link set "$IFNAME" up +} + +# If its a dummy interface, create a dummy interface. +[ "$IFTYPE" = dummy ] && { + GUEST_IFNAME=du$NSPID$CONTAINER_IFNAME + ip link add dev "$GUEST_IFNAME" type dummy +} + +# If the `route` command was specified ... +if [ "$IFTYPE" = route ]; then + # ... discard the first two arguments and pass the rest to the route command. + shift 2 + ip netns exec "$NSPID" ip route "$@" +else + # Otherwise, run normally. + ip link set "$GUEST_IFNAME" netns "$NSPID" + ip netns exec "$NSPID" ip link set "$GUEST_IFNAME" name "$CONTAINER_IFNAME" + [ "$MACADDR" ] && ip netns exec "$NSPID" ip link set dev "$CONTAINER_IFNAME" address "$MACADDR" + + # When using any of the DHCP methods, we start a DHCP client in the + # network namespace of the container. With the 'dhcp' method, the + # client used is taken from the Docker busybox image (therefore + # requiring no specific client installed on the host). Other methods + # use a locally installed client. + case "$DHCP_CLIENT" in + dhcp) + docker run -d --net container:$GUESTNAME --cap-add NET_ADMIN \ + busybox udhcpc -i "$CONTAINER_IFNAME" -x "hostname:$GUESTNAME" \ + $DHCP_OPTIONS \ + >/dev/null + ;; + udhcpc) + DHCP_Q="-q" + [ "$DHCP_FOREGROUND" ] && { + DHCP_OPTIONS="$DHCP_OPTIONS -f" + } + ip netns exec "$NSPID" "$DHCP_CLIENT" -qi "$CONTAINER_IFNAME" \ + -x "hostname:$GUESTNAME" \ + -p "/var/run/udhcpc.$GUESTNAME.pid" \ + $DHCP_OPTIONS + [ ! "$DHCP_FOREGROUND" ] && { + rm "/var/run/udhcpc.$GUESTNAME.pid" + } + ;; + dhclient) + ip netns exec "$NSPID" "$DHCP_CLIENT" "$CONTAINER_IFNAME" \ + -pf "/var/run/dhclient.$GUESTNAME.pid" \ + -lf "/etc/dhclient/dhclient.$GUESTNAME.leases" \ + $DHCP_OPTIONS + # kill dhclient after get ip address to prevent device be used after container close + [ ! "$DHCP_FOREGROUND" ] && { + kill "$(cat "/var/run/dhclient.$GUESTNAME.pid")" + rm "/var/run/dhclient.$GUESTNAME.pid" + } + ;; + dhcpcd) + ip netns exec "$NSPID" "$DHCP_CLIENT" -q "$CONTAINER_IFNAME" -h "$GUESTNAME" + ;; + "") + if installed ipcalc; then + eval $(ipcalc -b $IPADDR) + ip netns exec "$NSPID" ip "$FAMILY_FLAG" addr add "$IPADDR" brd "$BROADCAST" dev "$CONTAINER_IFNAME" + else + ip netns exec "$NSPID" ip "$FAMILY_FLAG" addr add "$IPADDR" dev "$CONTAINER_IFNAME" + fi + + [ "$GATEWAY" ] && { + ip netns exec "$NSPID" ip "$FAMILY_FLAG" route delete default >/dev/null 2>&1 && true + } + ip netns exec "$NSPID" ip "$FAMILY_FLAG" link set "$CONTAINER_IFNAME" up + [ "$GATEWAY" ] && { + ip netns exec "$NSPID" ip "$FAMILY_FLAG" route get "$GATEWAY" >/dev/null 2>&1 || \ + ip netns exec "$NSPID" ip "$FAMILY_FLAG" route add "$GATEWAY/32" dev "$CONTAINER_IFNAME" + ip netns exec "$NSPID" ip "$FAMILY_FLAG" route replace default via "$GATEWAY" dev "$CONTAINER_IFNAME" + } + ;; + esac + + # Give our ARP neighbors a nudge about the new interface + if installed arping; then + IPADDR=$(echo "$IPADDR" | cut -d/ -f1) + ip netns exec "$NSPID" arping -c 1 -A -I "$CONTAINER_IFNAME" "$IPADDR" > /dev/null 2>&1 || true + else + echo "Warning: arping not found; interface may not be immediately reachable" + fi +fi +# Remove NSPID to avoid `ip netns` catch it. +rm -f "/var/run/netns/$NSPID" + +# vim: set tabstop=2 shiftwidth=2 softtabstop=2 expandtab : diff --git a/util/docker-compose/roles/compass/files/prepare_ansible.sh b/util/docker-compose/roles/compass/files/prepare_ansible.sh new file mode 100755 index 00000000..031333c8 --- /dev/null +++ b/util/docker-compose/roles/compass/files/prepare_ansible.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +for i in `ls /root/compass4nfv/deploy/adapters/ansible | grep "openstack_"`; do + mkdir -p /root/docker_compose/ansible/$i + cp -rf /root/compass4nfv/deploy/adapters/ansible/openstack/* /root/docker_compose/ansible/$i + cp -rf /root/compass4nfv/deploy/adapters/ansible/$i /root/docker_compose/ansible/ +done +cp -rf /root/compass4nfv/deploy/adapters/ansible/roles /root/docker_compose/ansible/ diff --git a/util/docker-compose/roles/compass/files/preseed_post_anamon b/util/docker-compose/roles/compass/files/preseed_post_anamon new file mode 100755 index 00000000..b4c85253 --- /dev/null +++ b/util/docker-compose/roles/compass/files/preseed_post_anamon @@ -0,0 +1,80 @@ +#if $str($getVar('anamon_enabled','')) == "1" + +## install anamon script + #if $getVar("compass_server", "") != "" +wget -O /usr/local/sbin/anamon "http://$compass_server:$http_port/cobbler/aux/anamon" + #else +wget -O /usr/local/sbin/anamon "http://$server:$http_port/cobbler/aux/anamon" + #end if +## install anamon system service +cat << EOF > /etc/init.d/anamon.init +#raw +#!/bin/bash +## BEGIN INIT INFO +# Provides: anamon.init +# Default-Start: 3 5 +# Default-Stop: 0 1 2 4 6 +# Required-Start: $network +# Short-Description: Starts the cobbler anamon boot notification program +# Description: anamon runs the first time a machine is booted after +# installation. +## END INIT INFO + +# +# anamon.init: Starts the cobbler post-install boot notification program +# +# chkconfig: 35 95 95 +# +# description: anamon runs the first time a machine is booted after +# installation. +# +#end raw +cd /var/log/installer +gunzip initial-status.gz +cd - +#if $getVar("compass_server","") != "" +/usr/local/sbin/anamon --watchfile "/var/log/installer/syslog /var/log/installer/hardware-summary /var/log/installer/initial-status /var/log/installer/status" --name $name --server $compass_server --port $http_port --exit +#else +/usr/local/sbin/anamon --watchfile "/var/log/installer/syslog /var/log/installer/hardware-summary /var/log/installer/initial-status /var/log/installer/status" --name $name --server $server --port $http_port --exit +#end if +update-rc.d -f anamon remove +mv /etc/init.d/anamon.init /tmp/anamon.init +EOF + +## adjust permissions +chmod 755 /etc/init.d/anamon.init /usr/local/sbin/anamon +test -d /selinux && restorecon /etc/init.d/anamon.init /usr/local/sbin/anamon + +## enable the script +update-rc.d anamon.init defaults 95 95 +#end if + +## place start-up script for updating os state +#if $getVar('compass_server', '') != "" + #set srv = $getVar('compass_server','') +#else + #set srv = $getVar('server','') +#end if +cat << EOF > /etc/init.d/set_state +#raw +#!/bin/bash +# Provides: set_state +# Default-Start: 3 5 +# Default-Stop: 0 1 2 4 6 +# Required-Start: $network $ssh +# Short-Description: Notifies the os installation is finished +# Description: set_state runs the first time a machine is booted after +# installation. +#end raw +wget -O /tmp/os_state --post-data='{"ready": true}' --header=Content-Type:application/json "http://$srv:5050/api/hosts/${host_id}/state_internal" +update-rc.d -f set_state remove +mv /etc/init.d/set_state /tmp/set_state +EOF + +## adjust permissions +chmod 755 /etc/init.d/set_state +test -d /selinux && restorecon /etc/init.d/set_state + +update-rc.d set_state defaults 99 99 + +echo "compass_server=$server" >> /etc/compass.conf diff --git a/util/docker-compose/roles/compass/files/switch_list.conf b/util/docker-compose/roles/compass/files/switch_list.conf new file mode 100755 index 00000000..21c46c0a --- /dev/null +++ b/util/docker-compose/roles/compass/files/switch_list.conf @@ -0,0 +1,3 @@ +SWITCH_LIST = [ + '127.0.0.1' +] diff --git a/util/docker-compose/roles/compass/files/up_containers.sh b/util/docker-compose/roles/compass/files/up_containers.sh new file mode 100755 index 00000000..9aca591a --- /dev/null +++ b/util/docker-compose/roles/compass/files/up_containers.sh @@ -0,0 +1,3 @@ +#!/bin/bash +cd /root/docker_compose +docker-compose up diff --git a/util/docker-compose/roles/compass/tasks/main.yml b/util/docker-compose/roles/compass/tasks/main.yml new file mode 100755 index 00000000..9ee7902e --- /dev/null +++ b/util/docker-compose/roles/compass/tasks/main.yml @@ -0,0 +1,139 @@ +--- +- include_vars: "{{ compass_dists_dir }}/build.yaml" + +- set_fact: + image_name: "{{ item.name | regex_replace('-', '_') }}" + image_repo: "{{ item.url }}" + with_items: "{{ packages }}" + when: item.name in compose_images + register: compass_images + +- name: generate compose_images.yml + copy: + dest: "{{ compass_dists_dir }}/compose_images.yml" + content: | + {% set image_dict = {} %} + {% for item in compass_images.results %} + {% if "ansible_facts" in item %} + {% set facts = item.ansible_facts %} + {% set _ = image_dict.update({facts.image_name: facts.image_repo}) %} + {% endif %} + {% endfor %} + {% for key in image_dict %} + {{ key }}: {{ image_dict[key] }} + {% endfor %} + +- include_vars: "{{ compass_dists_dir }}/compose_images.yml" + +- name: get jumphost ip + shell: | + external_nic=`ip route |grep '^default'|awk '{print $5F}'|sed -n '1p'` + host_ip=`ifconfig $external_nic | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'` + echo $host_ip + register: external_ip + +- name: fix name.service + shell: | + if [ ! -f "/etc/apparmor.d/disable/usr.sbin.named" ]; then + ln -s /etc/apparmor.d/usr.sbin.named /etc/apparmor.d/disable/ + apparmor_parser -R /etc/apparmor.d/usr.sbin.named + fi + +- name: render docker-compose file + template: + src: docker-compose.yml.j2 + dest: "{{ docker_compose_dir }}/docker-compose.yml" + +- name: docker-compose down + shell: docker-compose down + args: + chdir: "{{ docker_compose_dir }}" + +- name: load docker images + shell: | + images=$(ls "{{ compass_dists_dir }}" | grep .*.tar) + for image in $images + do + docker load -i "{{ compass_dists_dir }}/$image" + done + +- name: copy files + shell: + cp -rf "{{ item }}" "{{ docker_compose_dir }}" + with_items: + - "{{ compass_dir }}/deploy/adapters/ansible" + - "{{ compass_dir }}/deploy/compass_conf" + - "{{ compass_dir }}/deploy/adapters/cobbler" + +- name: retrieve plugins list + command: "ls {{ compass_dir }}/plugins/" + register: plugin_list + +- name: copy plugins roles + copy: + src: "{{ compass_dir }}/plugins/{{ item }}/roles/" + dest: "{{ docker_compose_dir }}/ansible/roles/" + with_items: "{{ plugin_list.stdout_lines }}" + when: item != 'template' + +- name: chmod directory + file: + dest: "{{ item }}" + mode: 0755 + with_items: + - "{{ compass_dir }}/deploy/adapters/ansible" + - "{{ compass_dir }}/deploy/compass_conf" + - "{{ compass_dir }}/deploy/adapters/cobbler" + +- name: copy ansible scripts into ansible folder + shell: | + for i in `ls "{{ docker_compose_dir }}/ansible" | grep "openstack_"`; do + cp -rf "{{ docker_compose_dir }}"/ansible/openstack/* \ + "{{ docker_compose_dir }}"/ansible/$i + done + +- name: create run dir + file: + path: "{{ docker_compose_dir }}/ansible/run" + state: directory + +- name: render cobbler + template: + src: "{{ item }}.j2" + dest: "{{ docker_compose_dir }}/compass_conf/os_installer/{{ item }}" + with_items: + - cobbler.conf + +- name: docker-compose up + shell: docker-compose up -d + args: + chdir: "{{ docker_compose_dir }}" + +- name: create compass db tables + shell: | + sleep 3; \ + docker exec compass-deck bash -c "/opt/compass/bin/manage_db.py createdb" + register: result1 + until: result1.rc == 0 + retries: 10 + delay: 2 + tags: + - redploy + +- name: add ansible callback + shell: | + docker cp "{{ item }}" \ + compass-deck:/root/compass-deck/bin/ansible_callbacks + docker cp "{{ item }}" \ + compass-tasks:/opt/ansible_callbacks + with_items: + - "{{ compass_dir }}/deploy/status_callback.py" + - "{{ compass_dir }}/deploy/playbook_done.py" + +- name: rm ansible run + shell: | + docker exec compass-tasks bash -c "rm -rf /var/ansible/run/*" + +- name: start httpd service + shell: | + docker exec compass-deck bash -c "systemctl start httpd" diff --git a/util/docker-compose/roles/compass/templates/cobbler.conf.j2 b/util/docker-compose/roles/compass/templates/cobbler.conf.j2 new file mode 100755 index 00000000..5cc86e8e --- /dev/null +++ b/util/docker-compose/roles/compass/templates/cobbler.conf.j2 @@ -0,0 +1,9 @@ +NAME = 'cobbler' +INSTANCE_NAME = 'cobbler' +SETTINGS = { + 'cobbler_url': 'http://{{ host_ip }}/cobbler_api', + 'credentials': { + 'username': 'cobbler', + 'password': 'cobbler' + } +} diff --git a/util/docker-compose/roles/compass/templates/dhcp.template.j2 b/util/docker-compose/roles/compass/templates/dhcp.template.j2 new file mode 100755 index 00000000..0665f2fe --- /dev/null +++ b/util/docker-compose/roles/compass/templates/dhcp.template.j2 @@ -0,0 +1,97 @@ +# ****************************************************************** +# Cobbler managed dhcpd.conf file +# +# generated from cobbler dhcp.conf template ($date) +# Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes +# in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be +# overwritten. +# +# ****************************************************************** + +ddns-update-style interim; + +allow booting; +allow bootp; +deny unknown-clients; +local-address {{ host_ip }}; +log-facility local6; + +ignore client-updates; +set vendorclass = option vendor-class-identifier; + +option pxe-system-type code 93 = unsigned integer 16; +option space pxelinux; +option pxelinux.magic code 208 = string; +option pxelinux.configfile code 209 = text; +option pxelinux.pathprefix code 210 = text; +option pxelinux.reboottime code 211 = unsigned integer 32; + +subnet {{ install_subnet }} netmask {{ install_netmask }} { + option routers {{ host_ip }}; + option domain-name-servers {{ host_ip }}; + option subnet-mask {{ install_netmask }}; + range dynamic-bootp {{ install_ip_range }}; + default-lease-time 21600; + max-lease-time 43200; + next-server {{ host_ip }}; + class "pxeclients" { + match if substring (option vendor-class-identifier, 0, 9) = "PXEClient"; + if option pxe-system-type = 00:02 { + filename "ia64/elilo.efi"; + } else if option pxe-system-type = 00:06 { + filename "grub/grub-x86.efi"; + } else if option pxe-system-type = 00:07 { + filename "grub/grub-x86_64.efi"; + } else { + filename "pxelinux.0"; + } + } + +} + +#for dhcp_tag in $dhcp_tags.keys(): + ## group could be subnet if your dhcp tags line up with your subnets + ## or really any valid dhcpd.conf construct ... if you only use the + ## default dhcp tag in cobbler, the group block can be deleted for a + ## flat configuration +# group for Cobbler DHCP tag: $dhcp_tag +group { + #for mac in $dhcp_tags[$dhcp_tag].keys(): + #set iface = $dhcp_tags[$dhcp_tag][$mac] + host $iface.name { + hardware ethernet $mac; + site-option-space "pxelinux"; + option pxelinux.magic f1:00:74:7e; + if exists dhcp-parameter-request-list { + # Always send the PXELINUX options (specified in hexadecimal) + option dhcp-parameter-request-list = concat(option dhcp-parameter-request-list,d0,d1,d2,d3); + } + option pxelinux.reboottime 30; + #if $iface.hostname: + option host-name "$iface.hostname"; + #end if + #if $iface.netmask: + option subnet-mask $iface.netmask; + #end if + #if $iface.gateway: + option routers $iface.gateway; + #end if + #if $iface.enable_gpxe: + if exists user-class and option user-class = "gPXE" { + filename "http://$cobbler_server/cblr/svc/op/gpxe/system/$iface.owner"; + } else if exists user-class and option user-class = "iPXE" { + filename "http://$cobbler_server/cblr/svc/op/gpxe/system/$iface.owner"; + } else { + filename "undionly.kpxe"; + } + #else + filename "$iface.filename"; + #end if + ## Cobbler defaults to $next_server, but some users + ## may like to use $iface.system.server for proxied setups + next-server $next_server; + ## next-server $iface.next_server; + } + #end for +} +#end for diff --git a/util/docker-compose/roles/compass/templates/distro_signatures.json b/util/docker-compose/roles/compass/templates/distro_signatures.json new file mode 100755 index 00000000..e6991816 --- /dev/null +++ b/util/docker-compose/roles/compass/templates/distro_signatures.json @@ -0,0 +1,974 @@ +{"breeds": + { + "redhat": { + "rhel4": { + "signatures":["RedHat/RPMS","CentOS/RPMS"], + "version_file":"(redhat|sl|centos)-release-4(AS|WS|ES)[\\.-]+(.*)\\.rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*).rpm", + "kernel_arch_regex":null, + "supported_arches":["i386","x86_64","ppc","ppc64"], + "supported_repo_breeds":["rsync", "rhn", "yum"], + "kernel_file":"vmlinuz(.*)", + "initrd_file":"initrd(.*)\\.img", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample.ks", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + }, + "rhel5": { + "signatures":["RedHat","Server","CentOS","Client"], + "version_file":"(redhat|sl|centos)-release-5([^\\.][\\w]*)?[\\.-]+(.*)\\.rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*).rpm", + "kernel_arch_regex":null, + "supported_arches":["i386","x86_64","ppc","ppc64"], + "supported_repo_breeds":["rsync", "rhn", "yum"], + "kernel_file":"vmlinuz(.*)", + "initrd_file":"initrd(.*)\\.img", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample.ks", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + }, + "rhel6": { + "signatures":["Packages"], + "version_file":"(redhat|sl|slf|centos|oraclelinux)-release-(?!notes)([\\w]*-)*6(Server)*[\\.-]+(.*)\\.rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*).rpm", + "kernel_arch_regex":null, + "supported_arches":["i386","x86_64","ppc","ppc64"], + "supported_repo_breeds":["rsync", "rhn", "yum"], + "kernel_file":"vmlinuz(.*)", + "initrd_file":"initrd(.*)\\.img", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_end.ks", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + }, + "rhel7": { + "signatures":["Packages"], + "version_file":"(redhat|sl|slf|centos|oraclelinux)-release-(?!notes)([\\w]*-)*7(Server)*[\\.-]+(.*)\\.rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*).rpm", + "kernel_arch_regex":null, + "supported_arches":["i386","x86_64","ppc","ppc64"], + "supported_repo_breeds":["rsync", "rhn", "yum"], + "kernel_file":"vmlinuz(.*)", + "initrd_file":"initrd(.*)\\.img", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_end.ks", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + }, + "fedora16": { + "signatures":["Packages"], + "version_file":"(fedora)-release-16-(.*)\\.noarch\\.rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*)\\.rpm", + "kernel_arch_regex":null, + "supported_arches":["i386","x86_64","ppc","ppc64"], + "supported_repo_breeds":["rsync", "rhn", "yum"], + "kernel_file":"vmlinuz(.*)", + "initrd_file":"initrd(.*)\\.img", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_end.ks", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + }, + "fedora17": { + "signatures":["Packages"], + "version_file":"(fedora)-release-17-(.*)\\.noarch\\.rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*)\\.rpm", + "kernel_arch_regex":null, + "supported_arches":["i386","x86_64","ppc","ppc64"], + "supported_repo_breeds":["rsync", "rhn", "yum"], + "kernel_file":"vmlinuz(.*)", + "initrd_file":"initrd(.*)\\.img", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_end.ks", + "kernel_options":"repo=$tree", + "kernel_options_post":"", + "boot_files":[] + }, + "fedora18": { + "signatures":["Packages"], + "version_file":"(fedora)-release-18-(.*)\\.noarch\\.rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*)\\.rpm", + "kernel_arch_regex":null, + "supported_arches":["i386","x86_64","ppc","ppc64"], + "supported_repo_breeds":["rsync", "rhn", "yum"], + "kernel_file":"vmlinuz(.*)", + "initrd_file":"initrd(.*)\\.img", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_end.ks", + "kernel_options":"repo=$tree", + "kernel_options_post":"", + "boot_files":[] + }, + "fedora19": { + "signatures":["Packages"], + "version_file":"(fedora)-release-19-(.*)\\.noarch\\.rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*)\\.rpm", + "kernel_arch_regex":null, + "supported_arches":["i386","x86_64","ppc","ppc64"], + "supported_repo_breeds":["rsync", "rhn", "yum"], + "kernel_file":"vmlinuz(.*)", + "initrd_file":"initrd(.*)\\.img", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_end.ks", + "kernel_options":"repo=$tree", + "kernel_options_post":"", + "boot_files":[] + }, + "fedora20": { + "signatures":["Packages"], + "version_file":"(fedora)-release-20-(.*)\\.noarch\\.rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*)\\.rpm", + "kernel_arch_regex":null, + "supported_arches":["i386","x86_64","ppc","ppc64"], + "supported_repo_breeds":["rsync", "rhn", "yum"], + "kernel_file":"vmlinuz(.*)", + "initrd_file":"initrd(.*)\\.img", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_end.ks", + "kernel_options":"repo=$tree", + "kernel_options_post":"", + "boot_files":[] + }, + "fedora21": { + "signatures":["Packages"], + "version_file":"(fedora)-release-21-(.*)\\.noarch\\.rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*)\\.rpm", + "kernel_arch_regex":null, + "supported_arches":["i386","x86_64","ppc","ppc64"], + "supported_repo_breeds":["rsync", "rhn", "yum"], + "kernel_file":"vmlinuz(.*)", + "initrd_file":"initrd(.*)\\.img", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_end.ks", + "kernel_options":"repo=$tree", + "kernel_options_post":"", + "boot_files":[] + }, + "fedora22": { + "signatures":["Packages"], + "version_file":"(fedora)-release-22-(.*)\\.noarch\\.rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*)\\.rpm", + "kernel_arch_regex":null, + "supported_arches":["i386","x86_64","ppc","ppc64","ppc64le"], + "supported_repo_breeds":["rsync", "rhn", "yum"], + "kernel_file":"vmlinuz(.*)", + "initrd_file":"initrd(.*)\\.img", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_end.ks", + "kernel_options":"repo=$tree", + "kernel_options_post":"", + "boot_files":[] + }, + "fedora23": { + "signatures":["Packages"], + "version_file":"(fedora)-release-23-(.*)\\.noarch\\.rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*)\\.rpm", + "kernel_arch_regex":null, + "supported_arches":["i386","x86_64","ppc","ppc64","ppc64le"], + "supported_repo_breeds":["rsync", "rhn", "yum"], + "kernel_file":"vmlinuz(.*)", + "initrd_file":"initrd(.*)\\.img", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_end.ks", + "kernel_options":"repo=$tree", + "kernel_options_post":"", + "boot_files":[] + }, + "cloudlinux6": { + "signatures":["Packages"], + "version_file":"(cloudlinux)-release-(.*)\\.rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*).rpm", + "kernel_arch_regex":null, + "supported_arches":["i386","x86_64","ppc","ppc64"], + "supported_repo_breeds":["rsync", "rhn", "yum"], + "kernel_file":"vmlinuz(.*)", + "initrd_file":"initrd(.*)\\.img", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_end.ks", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + } + }, + "debian": { + "squeeze": { + "signatures":["dists"], + "version_file":"Release", + "version_file_regex":"Codename: squeeze", + "kernel_arch":"linux-headers-(.*)\\.deb", + "kernel_arch_regex":null, + "supported_arches":["i386","amd64"], + "supported_repo_breeds":["apt"], + "kernel_file":"vmlinuz(.*)", + "initrd_file":"initrd(.*)\\.gz", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample.seed", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + }, + "wheezy": { + "signatures":["dists"], + "version_file":"Release", + "version_file_regex":"Codename: wheezy", + "kernel_arch":"linux-headers-(.*)\\.deb", + "kernel_arch_regex":null, + "supported_arches":["i386","amd64"], + "supported_repo_breeds":["apt"], + "kernel_file":"vmlinuz(.*)", + "initrd_file":"initrd(.*)\\.gz", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample.seed", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + }, + "jessie": { + "signatures":["dists"], + "version_file":"Release", + "version_file_regex":"Codename: jessie", + "kernel_arch":"linux-headers-(.*)\\.deb", + "kernel_arch_regex":null, + "supported_arches":["i386","amd64"], + "supported_repo_breeds":["apt"], + "kernel_file":"vmlinuz(.*)", + "initrd_file":"initrd(.*)\\.gz", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample.seed", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + }, + "stretch": { + "signatures":["dists"], + "version_file":"Release", + "version_file_regex":"Codename: stretch", + "kernel_arch":"linux-headers-(.*)\\.deb", + "kernel_arch_regex":null, + "supported_arches":["i386","amd64"], + "supported_repo_breeds":["apt"], + "kernel_file":"vmlinuz(.*)", + "initrd_file":"initrd(.*)\\.gz", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample.seed", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + } + }, + "ubuntu": { + "lucid": { + "signatures":["dists", ".disk"], + "version_file":"Release|mini-info", + "version_file_regex":"Codename: lucid|Ubuntu 10.04", + "kernel_arch":"linux-headers-(.*)\\.deb", + "kernel_arch_regex":null, + "supported_arches":["i386","amd64"], + "supported_repo_breeds":["apt"], + "kernel_file":"linux(.*)", + "initrd_file":"initrd(.*)\\.gz", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample.seed", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + }, + "oneiric": { + "signatures":["dists", ".disk"], + "version_file":"Release|mini-info", + "version_file_regex":"Codename: oneiric|Ubuntu 11.10", + "kernel_arch":"linux-headers-(.*)\\.deb", + "kernel_arch_regex":null, + "supported_arches":["i386","amd64"], + "supported_repo_breeds":["apt"], + "kernel_file":"linux(.*)", + "initrd_file":"initrd(.*)\\.gz", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample.seed", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + }, + "precise": { + "signatures":["dists", ".disk"], + "version_file":"Release|mini-info", + "version_file_regex":"Codename: precise|Ubuntu 12.04", + "kernel_arch":"linux-headers-(.*)\\.deb", + "kernel_arch_regex":null, + "supported_arches":["i386","amd64"], + "supported_repo_breeds":["apt"], + "kernel_file":"linux(.*)", + "initrd_file":"initrd(.*)\\.gz", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample.seed", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + }, + "quantal": { + "signatures":["dists", ".disk"], + "version_file":"Release|mini-info", + "version_file_regex":"Codename: quantal|Ubuntu 12.10", + "kernel_arch":"linux-headers-(.*)\\.deb", + "kernel_arch_regex":null, + "supported_arches":["i386","amd64"], + "supported_repo_breeds":["apt"], + "kernel_file":"linux(.*)", + "initrd_file":"initrd(.*)\\.gz", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample.seed", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + }, + "raring": { + "signatures":["dists", ".disk"], + "version_file":"Release|mini-info", + "version_file_regex":"Codename: raring|Ubuntu 13.04", + "kernel_arch":"linux-headers-(.*)\\.deb", + "kernel_arch_regex":null, + "supported_arches":["i386","amd64"], + "supported_repo_breeds":["apt"], + "kernel_file":"linux(.*)", + "initrd_file":"initrd(.*)\\.gz", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample.seed", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + }, + "saucy": { + "signatures":["dists", ".disk"], + "version_file":"Release|mini-info", + "version_file_regex":"Codename: saucy|Ubuntu 13.10", + "kernel_arch":"linux-headers-(.*)\\.deb", + "kernel_arch_regex":null, + "supported_arches":["i386","amd64"], + "supported_repo_breeds":["apt"], + "kernel_file":"linux(.*)", + "initrd_file":"initrd(.*)\\.gz", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample.seed", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + }, + "trusty": { + "signatures":["dists", ".disk"], + "version_file":"Release|mini-info", + "version_file_regex":"Codename: trusty|Ubuntu 14.04", + "kernel_arch":"linux-headers-(.*)\\.deb", + "kernel_arch_regex":null, + "supported_arches":["i386","amd64"], + "supported_repo_breeds":["apt"], + "kernel_file":"linux(.*)", + "initrd_file":"initrd(.*)\\.gz", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample.seed", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + }, + "vivid": { + "signatures":["dists", ".disk"], + "version_file":"Release|mini-info", + "version_file_regex":"Codename: vivid|Ubuntu 15.04", + "kernel_arch":"linux-headers-(.*)\\.deb", + "kernel_arch_regex":null, + "supported_arches":["i386","amd64"], + "supported_repo_breeds":["apt"], + "kernel_file":"linux(.*)", + "initrd_file":"initrd(.*)\\.gz", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample.seed", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + }, + "wily": { + "signatures":["dists", ".disk"], + "version_file":"Release|mini-info", + "version_file_regex":"Codename: wily|Ubuntu 15.10", + "kernel_arch":"linux-headers-(.*)\\.deb", + "kernel_arch_regex":null, + "supported_arches":["i386","amd64"], + "supported_repo_breeds":["apt"], + "kernel_file":"linux(.*)", + "initrd_file":"initrd(.*)\\.gz", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample.seed", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + }, + "xenial": { + "signatures":["dists", ".disk"], + "version_file":"Release|mini-info", + "version_file_regex":"Codename: xenial|Ubuntu 16.04", + "kernel_arch":"linux-headers-(.*)\\.deb", + "kernel_arch_regex":null, + "supported_arches":["i386","amd64"], + "supported_repo_breeds":["apt"], + "kernel_file":"linux(.*)", + "initrd_file":"initrd(.*)\\.gz", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample.seed", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + } + }, + "suse": { + "opensuse11.2": { + "signatures":["suse"], + "version_file":"openSUSE-release-11.2-(.*).rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*)\\.rpm", + "kernel_arch_regex":null, + "supported_arches":["i386","i586","x86_64"], + "supported_repo_breeds":["yum"], + "kernel_file":"(linux|vmlinuz(.*))", + "initrd_file":"initrd(.*)", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_autoyast.xml", + "kernel_options":"install=$tree", + "kernel_options_post":"", + "boot_files":[] + }, + "opensuse11.3": { + "signatures":["suse"], + "version_file":"openSUSE-release-11.3-(.*).rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*)\\.rpm", + "kernel_arch_regex":null, + "supported_arches":["i386","i586","x86_64"], + "supported_repo_breeds":["yum"], + "kernel_file":"(linux|vmlinuz(.*))", + "initrd_file":"initrd(.*)", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_autoyast.xml", + "kernel_options":"install=$tree", + "kernel_options_post":"", + "boot_files":[] + }, + "opensuse11.4": { + "signatures":["suse"], + "version_file":"openSUSE-release-11.4-(.*).rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*)\\.rpm", + "kernel_arch_regex":null, + "supported_arches":["i386","i586","x86_64"], + "supported_repo_breeds":["yum"], + "kernel_file":"(linux|vmlinuz(.*))", + "initrd_file":"initrd(.*)", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_autoyast.xml", + "kernel_options":"install=$tree", + "kernel_options_post":"", + "boot_files":[] + }, + "opensuse12.1": { + "signatures":["suse"], + "version_file":"openSUSE-release-12.1-(.*).rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*)\\.rpm", + "kernel_arch_regex":null, + "supported_arches":["i386","i586","x86_64"], + "supported_repo_breeds":["yum"], + "kernel_file":"(linux|vmlinuz(.*))", + "initrd_file":"initrd(.*)", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_autoyast.xml", + "kernel_options":"install=$tree", + "kernel_options_post":"", + "boot_files":[] + }, + "opensuse12.2": { + "signatures":["suse"], + "version_file":"openSUSE-release-12.2-(.*).rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*)\\.rpm", + "kernel_arch_regex":null, + "supported_arches":["i386","i586","x86_64"], + "supported_repo_breeds":["yum"], + "kernel_file":"(linux|vmlinuz(.*))", + "initrd_file":"initrd(.*)", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_autoyast.xml", + "kernel_options":"install=$tree", + "kernel_options_post":"", + "boot_files":[] + }, + "opensuse12.3": { + "signatures":["suse"], + "version_file":"openSUSE-release-12.3-(.*).rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*)\\.rpm", + "kernel_arch_regex":null, + "supported_arches":["i386","i586","x86_64"], + "supported_repo_breeds":["yum"], + "kernel_file":"(linux|vmlinuz(.*))", + "initrd_file":"initrd(.*)", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_autoyast.xml", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + }, + "opensuse13.1": { + "signatures":["suse"], + "version_file":"openSUSE-release-13.1-(.*).rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*)\\.rpm", + "kernel_arch_regex":null, + "supported_arches":["i386","i586","x86_64"], + "supported_repo_breeds":["yum"], + "kernel_file":"(linux|vmlinuz(.*))", + "initrd_file":"initrd(.*)", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_autoyast.xml", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + }, + "opensuse13.2": { + "signatures":["suse"], + "version_file":"openSUSE-release-13.2-(.*).rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*)\\.rpm", + "kernel_arch_regex":null, + "supported_arches":["i386","i586","x86_64"], + "supported_repo_breeds":["yum"], + "kernel_file":"(linux|vmlinuz(.*))", + "initrd_file":"initrd(.*)", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_autoyast.xml", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + }, + "sles10": { + "signatures":["suse"], + "version_file":"sles-release-10-(.*).rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*)\\.rpm", + "kernel_arch_regex":null, + "supported_arches":["i386","i586","x86_64","ppc64"], + "supported_repo_breeds":["yum"], + "kernel_file":"linux[64.gz]?", + "initrd_file":"initrd[64]?", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_autoyast.xml", + "kernel_options":"install=$tree", + "kernel_options_post":"", + "boot_files":[] + }, + "sles11": { + "signatures":["suse"], + "version_file":"sles-release-11-(.*).rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*)\\.rpm", + "kernel_arch_regex":null, + "supported_arches":["i386","i586","x86_64","ppc64"], + "supported_repo_breeds":["yum"], + "kernel_file":"linux[64.gz]?", + "initrd_file":"initrd[64]?", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_autoyast.xml", + "kernel_options":"install=$tree", + "kernel_options_post":"", + "boot_files":[] + }, + "sles11sp1": { + "signatures":["suse"], + "version_file":"sles-release-11.1-(.*).rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*)\\.rpm", + "kernel_arch_regex":null, + "supported_arches":["i386","i586","x86_64","ppc64"], + "supported_repo_breeds":["yum"], + "kernel_file":"linux[64.gz]?", + "initrd_file":"initrd[64]?", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_autoyast.xml", + "kernel_options":"install=$tree", + "kernel_options_post":"", + "boot_files":[] + }, + "sles11sp2": { + "signatures":["suse"], + "version_file":"sles-release-11.2-(.*).rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*)\\.rpm", + "kernel_arch_regex":null, + "supported_arches":["i386","i586","x86_64","ppc64"], + "supported_repo_breeds":["yum"], + "kernel_file":"linux[64.gz]?", + "initrd_file":"initrd[64]?", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_autoyast.xml", + "kernel_options":"install=$tree", + "kernel_options_post":"", + "boot_files":[] + }, + "sles11sp3": { + "signatures":["suse"], + "version_file":"sles-release-11.3-(.*).rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*)\\.rpm", + "kernel_arch_regex":null, + "supported_arches":["i386","i586","x86_64","ppc64"], + "supported_repo_breeds":["yum"], + "kernel_file":"linux[64.gz]?", + "initrd_file":"initrd[64]?", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_autoyast.xml", + "kernel_options":"install=$tree", + "kernel_options_post":"", + "boot_files":[] + }, + "sles11sp4": { + "signatures":["suse"], + "version_file":"sles-release-11.4-(.*).rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*)\\.rpm", + "kernel_arch_regex":null, + "supported_arches":["i386","i586","x86_64","ppc64"], + "supported_repo_breeds":["yum"], + "kernel_file":"linux[64.gz]?", + "initrd_file":"initrd[64]?", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_autoyast.xml", + "kernel_options":"install=$tree", + "kernel_options_post":"", + "boot_files":[] + }, + "sles12": { + "signatures":["suse"], + "version_file":"(sles|SLES-for-VMware)-release-12-(.*).rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*)\\.rpm", + "kernel_arch_regex":null, + "supported_arches":["i386","i586","x86_64","ppc64"], + "supported_repo_breeds":["yum"], + "kernel_file":"linux[64.gz]?", + "initrd_file":"initrd[64]?", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_autoyast.xml", + "kernel_options":"install=$tree", + "kernel_options_post":"", + "boot_files":[] + } + }, + "vmware": { + "esx4": { + "signatures":["VMware/RPMS"], + "version_file":"vmware-esx-vmware-release-(.*)\\.rpm", + "version_file_regex":null, + "kernel_arch":"kernel-(.*)\\.x86_64\\.rpm", + "kernel_arch_regex":null, + "supported_arches":["x86_64"], + "supported_repo_breeds":["yum"], + "kernel_file":"vmlinuz", + "initrd_file":"initrd\\.img", + "isolinux_ok":true, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_esx4.ks", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + }, + "esxi4": { + "signatures":["imagedd.bz2"], + "version_file":"vmkernel\\.gz", + "version_file_regex":"^.*ESXi 4.1\\.(\\d)+ \\[Releasebuild-([\\d]+)\\].*$", + "kernel_arch":"vmkernel\\.gz", + "kernel_arch_regex":"^.*SystemVsiCpuArch.*(X86_64).*$", + "supported_arches":["x86_64"], + "supported_repo_breeds":[], + "kernel_file":"mboot\\.c32", + "initrd_file":"vmkboot\\.gz", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_esxi4.ks", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":["vmkernel.gz","sys.vgz","cim.vgz","ienviron.vgz","install.vgz"] + }, + "esxi5": { + "signatures":["tboot.b00"], + "version_file":"s\\.v00", + "version_file_regex":"^.*ESXi 5\\.0\\.(.*)build-([\\d]+).*$", + "kernel_arch":"tools\\.t00", + "kernel_arch_regex":"^.*(x86_64).*$", + "supported_arches":["x86_64"], + "supported_repo_breeds":[], + "kernel_file":"mboot\\.c32", + "initrd_file":"imgpayld\\.tgz", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_esxi5.ks", + "kernel_options":"", + "kernel_options_post":"", + "template_files":"/etc/cobbler/pxe/bootcfg_esxi5.template=$local_img_path/cobbler-boot.cfg", + "boot_files":["*.*"] + }, + "esxi51": { + "signatures":["tboot.b00"], + "version_file":"s\\.v00", + "version_file_regex":"^.*ESXi 5\\.1\\.(.*)build-([\\d]+).*$", + "kernel_arch":"tools\\.t00", + "kernel_arch_regex":"^.*(x86_64).*$", + "supported_arches":["x86_64"], + "supported_repo_breeds":[], + "kernel_file":"mboot\\.c32", + "initrd_file":"imgpayld\\.tgz", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_esxi5.ks", + "kernel_options":"", + "kernel_options_post":"", + "template_files":"/etc/cobbler/pxe/bootcfg_esxi51.template=$local_img_path/cobbler-boot.cfg", + "boot_files":["*.*"] + }, + "esxi55": { + "signatures":["tboot.b00"], + "version_file":"s\\.v00", + "version_file_regex":"^.*ESXi 5\\.5\\.(.*)build-([\\d]+).*$", + "kernel_arch":"tools\\.t00", + "kernel_arch_regex":"^.*(x86_64).*$", + "supported_arches":["x86_64"], + "supported_repo_breeds":[], + "kernel_file":"mboot\\.c32", + "initrd_file":"imgpayld\\.tgz", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_esxi5.ks", + "kernel_options":"", + "kernel_options_post":"", + "template_files":"/etc/cobbler/pxe/bootcfg_esxi55.template=$local_img_path/cobbler-boot.cfg", + "boot_files":["*.*"] + }, + "esxi60": { + "signatures":["tboot.b00"], + "version_file":"s\\.v00", + "version_file_regex":"^.*ESXi 6\\.0\\.(.*)build-([\\d]+).*$", + "kernel_arch":"tools\\.t00", + "kernel_arch_regex":"^.*(x86_64).*$", + "supported_arches":["x86_64"], + "supported_repo_breeds":[], + "kernel_file":"mboot\\.c32", + "initrd_file":"imgpayld\\.tgz", + "isolinux_ok":false, + "default_kickstart":"/var/lib/cobbler/kickstarts/sample_esxi5.ks", + "kernel_options":"", + "kernel_options_post":"", + "template_files":"/etc/cobbler/pxe/bootcfg_esxi60.template=$local_img_path/cobbler-boot.cfg", + "boot_files":["*.*"] + } + }, + "freebsd": { + "8.2": { + "signatures":["boot"], + "version_file":"8\\.2-RELEASE", + "version_file_regex":null, + "kernel_arch":"device\\.hints", + "kernel_arch_regex":"^.*FreeBSD: src/sys/(.*)/conf/GENERIC\\.hints.*$", + "supported_arches":["i386","amd64"], + "supported_repo_breeds":[], + "kernel_file":"pxeboot(.*)", + "initrd_file":"mfsroot\\.gz", + "isolinux_ok":false, + "default_kickstart":"", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + }, + "8.3": { + "signatures":["boot"], + "version_file":"8\\.3-RELEASE", + "version_file_regex":null, + "kernel_arch":"device\\.hints", + "kernel_arch_regex":"^.*FreeBSD: src/sys/(.*)/conf/GENERIC\\.hints.*$", + "supported_arches":["i386","amd64"], + "supported_repo_breeds":[], + "kernel_file":"pxeboot(.*)", + "initrd_file":"mfsroot\\.gz", + "isolinux_ok":false, + "default_kickstart":"", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + }, + "8.4": { + "signatures":["boot"], + "version_file":"8\\.4-RELEASE", + "version_file_regex":null, + "kernel_arch":"device\\.hints", + "kernel_arch_regex":"^.*FreeBSD: src/sys/(.*)/conf/GENERIC\\.hints.*$", + "supported_arches":["i386","amd64"], + "supported_repo_breeds":[], + "kernel_file":"pxeboot(.*)", + "initrd_file":"mfsroot\\.gz", + "isolinux_ok":false, + "default_kickstart":"", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + }, + "9.0": { + "signatures":["boot"], + "version_file":"device\\.hints", + "version_file_regex":"^.*FreeBSD: release/9.0(.*)/sys/(.*)/conf/GENERIC.hints.*$", + "kernel_arch":"device\\.hints", + "kernel_arch_regex":"^.*FreeBSD: release/9.0(.*)/sys/(.*)/conf/GENERIC.hints.*$", + "supported_arches":["i386","amd64"], + "supported_repo_breeds":[], + "kernel_file":"pxeboot(.*)", + "initrd_file":"mbr", + "isolinux_ok":false, + "default_kickstart":"", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + }, + "10.0": { + "signatures":["release"], + "version_file":"10\\.0\\-RELEASE", + "version_file_regex":null, + "kernel_arch":"device\\.hints", + "kernel_arch_regex":null, + "supported_arches":["i386","amd64"], + "supported_repo_breeds":[], + "kernel_file":"base.txz", + "initrd_file":"base.txz", + "isolinux_ok":false, + "default_kickstart":"", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + } + }, + "xen": { + "xcp16": { + "signatures":["packages.main"], + "version_file":"^XS-REPOSITORY$", + "version_file_regex":"^.*product=\"XCP\" version=\"1\\.6\\.([0-9]+)\".*$", + "kernel_arch":"xen\\.gz", + "kernel_arch_regex":"^.*(x86_64).*$", + "supported_arches":["x86_64"], + "supported_repo_breeds":[], + "kernel_file":"vmlinuz", + "initrd_file":"xen\\.gz", + "isolinux_ok":false, + "default_kickstart":"", + "kernel_options":"dom0_max_vcpus=1-2 dom0_mem=max:752M,752M", + "kernel_options_post":"", + "boot_files":["install.img"] + }, + "xenserver620": { + "signatures":["packages.xenserver"], + "version_file":"^XS-REPOSITORY$", + "version_file_regex":"^.*product=\"XenServer\" version=\"6\\.2\\.([0-9]+)\".*$", + "kernel_arch":"xen\\.gz", + "kernel_arch_regex":"^.*(x86_64).*$", + "supported_arches":["x86_64"], + "supported_repo_breeds":[], + "kernel_file":"mboot\\.c32", + "initrd_file":"xen\\.gz", + "isolinux_ok":false, + "default_kickstart":"", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":["install.img"] + }, + "xenserver650": { + "signatures":["packages.xenserver"], + "version_file":"^XS-REPOSITORY$", + "version_file_regex":"^.*product=\"XenServer\" version=\"6\\.5\\.([0-9]+)\".*$", + "kernel_arch":"xen\\.gz", + "kernel_arch_regex":"^.*(x86_64).*$", + "supported_arches":["x86_64"], + "supported_repo_breeds":[], + "kernel_file":"mboot\\.c32", + "initrd_file":"xen\\.gz", + "isolinux_ok":false, + "default_kickstart":"", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":["install.img"] + } + }, + "unix": { + }, + "windows": { + }, + "nexenta": { + "4": { + "signatures":["boot"], + "version_file": "platform", + "version_file_regex": null, + "supported_arches":["x86_64"], + "supported_repo_breeds":["apt"], + "kernel_file":"platform/i86pc/kernel/amd64/unix", + "initrd_file":"platform/i86pc/amd64/miniroot", + "kernel_arch": "", + "kernel_arch_regex": null, + "isolinux_ok":false, + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[], + "default_kickstart":"" + } + }, + "generic": { + "generic26": { + "signatures":[], + "version_file":"", + "version_file_regex":"", + "kernel_arch":"", + "kernel_arch_regex":"", + "supported_arches":["i386","x86_64"], + "supported_repo_breeds":[], + "kernel_file":"", + "initrd_file":"", + "isolinux_ok":false, + "default_kickstart":"", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + }, + "virtio26": { + "signatures":[], + "version_file":"", + "version_file_regex":"", + "kernel_arch":"", + "kernel_arch_regex":"", + "supported_arches":["i386","x86_64"], + "supported_repo_breeds":[], + "kernel_file":"", + "initrd_file":"", + "isolinux_ok":false, + "default_kickstart":"", + "kernel_options":"", + "kernel_options_post":"", + "boot_files":[] + } + } + } +} diff --git a/util/docker-compose/roles/compass/templates/docker-compose.yml.j2 b/util/docker-compose/roles/compass/templates/docker-compose.yml.j2 new file mode 100755 index 00000000..7fc8ea3a --- /dev/null +++ b/util/docker-compose/roles/compass/templates/docker-compose.yml.j2 @@ -0,0 +1,103 @@ +version: '2' + +services: +{% if compass_db is defined %} + compass-db: + container_name: compass-db + hostname: compass-db + privileged: true + expose: + - 3306 + tty: true + image: {{ compass_db }} + stdin_open: true + command: + - /sbin/entrypoint.sh +{% endif %} + +{% if compass_mq is defined %} + compass-mq: + container_name: compass-mq + hostname: compass-mq + privileged: true + expose: + - 5672 + tty: true + image: {{ compass_mq }} + stdin_open: true +{% endif %} + +{% if compass_tasks is defined %} + compass-tasks: + container_name: compass-tasks + hostname: compass-tasks + privileged: true + image: {{ compass_tasks }} + links: + - compass-mq + - compass-cobbler + depends_on: + - compass-mq + - compass-cobbler + stdin_open: true + volumes: + - {{ docker_compose_dir }}/compass_conf:/etc/compass + - {{ docker_compose_dir }}/ansible:/var/ansible + command: + - /usr/local/bin/start.sh +{% endif %} + +{% if compass_deck is defined %} + compass-deck: + container_name: compass-deck + hostname: compass-deck + privileged: true + image: {{ compass_deck }} + ports: + - {{ host_ip }}:{{ deck_port }}:80/tcp + - {{ external_ip.stdout }}:{{ deck_port }}:80/tcp + tty: true + links: + - compass-db + - compass-mq + depends_on: + - compass-db + - compass-mq + stdin_open: true + volumes: + - {{ docker_compose_dir }}/compass_conf:/etc/compass + command: + - /sbin/init + - /usr/local/bin/start.sh +{% endif %} + +{% if compass_cobbler is defined %} + compass-cobbler: + container_name: compass-cobbler + hostname: compass-cobbler + network_mode: host + privileged: true + image: {{ compass_cobbler }} + ports: + - {{ host_ip }}:80:80/tcp + - {{ host_ip }}:69:69 + - {{ host_ip }}:443:443/tcp + - {{ host_ip }}:25151:25151/tcp + - {{ host_ip }}:67:67/tcp + volumes: + - {{ docker_compose_dir }}/cobbler:/root/cobbler + command: + - /sbin/init +{% endif %} + +{% if compass_repo is defined %} + compass-repo: + container_name: compass-repo + hostname: compass-repo + privileged: true + image: {{ compass_repo }} + ports: + - {{ host_ip }}:{{ repo_port }}:80/tcp + tty: true + stdin_open: true +{% endif %} diff --git a/util/docker-compose/roles/compass/templates/machine_list.conf.j2 b/util/docker-compose/roles/compass/templates/machine_list.conf.j2 new file mode 100755 index 00000000..d85f74d0 --- /dev/null +++ b/util/docker-compose/roles/compass/templates/machine_list.conf.j2 @@ -0,0 +1,14 @@ +MACHINE_LIST = [ + { + '127.0.0.1': [ +{% set port_num = 200 %} +{% for mac in mac_addresses %} + { + 'port': '{{ port_num }}', + 'mac': '{{ mac }}', + 'vlan': 0 + }, +{% endfor %} + ] + } +] diff --git a/util/docker-compose/roles/compass/templates/named.template.j2 b/util/docker-compose/roles/compass/templates/named.template.j2 new file mode 100755 index 00000000..0cf76225 --- /dev/null +++ b/util/docker-compose/roles/compass/templates/named.template.j2 @@ -0,0 +1,31 @@ +options { + listen-on port 53 { {{ host_ip }}; }; + directory "/var/named"; + dump-file "/var/named/data/cache_dump.db"; + statistics-file "/var/named/data/named_stats.txt"; + memstatistics-file "/var/named/data/named_mem_stats.txt"; + allow-query { 127.0.0.0/8; {{ install_subnet }}/{{ install_prefix }}; }; + recursion yes; +}; + +logging { + channel default_debug { + file "data/named.run"; + severity dynamic; + }; +}; + +#for $zone in $forward_zones +zone "${zone}." { + type master; + file "$zone"; +}; + +#end for +#for $zone, $arpa in $reverse_zones +zone "${arpa}." { + type master; + file "$zone"; +}; + +#end for diff --git a/util/docker-compose/roles/compass/templates/prepare_ansible.sh.j2 b/util/docker-compose/roles/compass/templates/prepare_ansible.sh.j2 new file mode 100755 index 00000000..e0de1253 --- /dev/null +++ b/util/docker-compose/roles/compass/templates/prepare_ansible.sh.j2 @@ -0,0 +1,8 @@ +#!/bin/bash + +for i in `ls {{ compass_adapter_dir }}/ansible | grep "openstack_"`; do + mkdir -p {{ docker_compose_dir }}/ansible/$i + cp -rf {{ compass_adapter_dir }}/ansible/openstack/* {{ docker_compose_dir }}/ansible/$i + cp -rf {{ compass_adapter_dir }}/ansible/$i {{ docker_compose_dir }}/ansible/ +done +cp -rf {{ compass_adapter_dir }}/ansible/roles {{ docker_compose_dir }}/ansible/ diff --git a/util/docker-compose/roles/compass/templates/settings.j2 b/util/docker-compose/roles/compass/templates/settings.j2 new file mode 100755 index 00000000..9e4a7390 --- /dev/null +++ b/util/docker-compose/roles/compass/templates/settings.j2 @@ -0,0 +1,450 @@ +--- +# cobbler settings file +# restart cobblerd and run "cobbler sync" after making changes +# This config file is in YAML 1.0 format +# see http://yaml.org +# ========================================================== +# if 1, cobbler will allow insertions of system records that duplicate +# the --dns-name information of other system records. In general, +# this is undesirable and should be left 0. +allow_duplicate_hostnames: 0 + +# if 1, cobbler will allow insertions of system records that duplicate +# the ip address information of other system records. In general, +# this is undesirable and should be left 0. +allow_duplicate_ips: 0 + +# if 1, cobbler will allow insertions of system records that duplicate +# the mac address information of other system records. In general, +# this is undesirable. +allow_duplicate_macs: 0 + +# if 1, cobbler will allow settings to be changed dynamically without +# a restart of the cobblerd daemon. You can only change this variable +# by manually editing the settings file, and you MUST restart cobblerd +# after changing it. +allow_dynamic_settings: 0 + +# by default, installs are *not* set to send installation logs to the cobbler +# # # server. With 'anamon_enabled', kickstart templates may use the pre_anamon +# # # snippet to allow remote live monitoring of their installations from the +# # # cobbler server. Installation logs will be stored under +# # # /var/log/cobbler/anamon/. NOTE: This does allow an xmlrpc call to send logs +# # # to this directory, without authentication, so enable only if you are +# # # ok with this limitation. +anamon_enabled: 1 + +# If using authn_pam in the modules.conf, this can be configured +# to change the PAM service authentication will be tested against. +# The default value is "login". +authn_pam_service: "login" + +# Email out a report when cobbler finishes installing a system. +# enabled: set to 1 to turn this feature on +# sender: optional +# email: which addresses to email +# smtp_server: used to specify another server for an MTA +# subject: use the default subject unless overridden +build_reporting_enabled: 0 +build_reporting_sender: "" +build_reporting_email: [ 'root@localhost' ] +build_reporting_smtp_server: "localhost" +build_reporting_subject: "" + +# Cheetah-language kickstart templates can import Python modules. +# while this is a useful feature, it is not safe to allow them to +# import anything they want. This whitelists which modules can be +# imported through Cheetah. Users can expand this as needed but +# should never allow modules such as subprocess or those that +# allow access to the filesystem as Cheetah templates are evaluated +# by cobblerd as code. +cheetah_import_whitelist: + - "random" + - "re" + - "time" + +# Default createrepo_flags to use for new repositories. If you have +# createrepo >= 0.4.10, consider "-c cache --update -C", which can +# dramatically improve your "cobbler reposync" time. "-s sha" +# enables working with Fedora repos from F11/F12 from EL-4 or +# EL-5 without python-hashlib installed (which is not available +# on EL-4) +createrepo_flags: "-c cache -s sha" + +# if no kickstart is specified to profile add, use this template +default_kickstart: /var/lib/cobbler/kickstarts/default.ks + +# configure all installed systems to use these nameservers by default +# unless defined differently in the profile. For DHCP configurations +# you probably do /not/ want to supply this. +default_name_servers: ['10.1.10.15'] + +# if using the authz_ownership module (see the Wiki), objects +# created without specifying an owner are assigned to this +# owner and/or group. Can be a comma seperated list. +default_ownership: + - "admin" + +# cobbler has various sample kickstart templates stored +# in /var/lib/cobbler/kickstarts/. This controls +# what install (root) password is set up for those +# systems that reference this variable. The factory +# default is "cobbler" and cobbler check will warn if +# this is not changed. +# The simplest way to change the password is to run +# openssl passwd -1 +# and put the output between the "" below. +default_password_crypted: "$1$huawei$9OkoVJwO4W8vavlXd1bUS/" + +# the default template type to use in the absence of any +# other detected template. If you do not specify the template +# with '#template=' on the first line of your +# templates/snippets, cobbler will assume try to use the +# following template engine to parse the templates. +# +# Current valid values are: cheetah, jinja2 +default_template_type: "cheetah" + +# for libvirt based installs in koan, if no virt bridge +# is specified, which bridge do we try? For EL 4/5 hosts +# this should be xenbr0, for all versions of Fedora, try +# "virbr0". This can be overriden on a per-profile +# basis or at the koan command line though this saves +# typing to just set it here to the most common option. +default_virt_bridge: xenbr0 + +# use this as the default disk size for virt guests (GB) +default_virt_file_size: 5 + +# use this as the default memory size for virt guests (MB) +default_virt_ram: 512 + +# if koan is invoked without --virt-type and no virt-type +# is set on the profile/system, what virtualization type +# should be assumed? Values: xenpv, xenfv, qemu, vmware +# (NOTE: this does not change what virt_type is chosen by import) +default_virt_type: xenpv + +# enable gPXE booting? Enabling this option will cause cobbler +# to copy the undionly.kpxe file to the tftp root directory, +# and if a profile/system is configured to boot via gpxe it will +# chain load off pxelinux.0. +# Default: 0 +enable_gpxe: 0 + +# controls whether cobbler will add each new profile entry to the default +# PXE boot menu. This can be over-ridden on a per-profile +# basis when adding/editing profiles with --enable-menu=0/1. Users +# should ordinarily leave this setting enabled unless they are concerned +# with accidental reinstalls from users who select an entry at the PXE +# boot menu. Adding a password to the boot menus templates +# may also be a good solution to prevent unwanted reinstallations +enable_menu: 0 + +# enable Func-integration? This makes sure each installed machine is set up +# to use func out of the box, which is a powerful way to script and control +# remote machines. +# Func lives at http://fedorahosted.org/func +# read more at https://github.com/cobbler/cobbler/wiki/Func-integration +# you will need to mirror Fedora/EPEL packages for this feature, so see +# https://github.com/cobbler/cobbler/wiki/Manage-yum-repos if you want cobbler +# to help you with this +func_auto_setup: 0 +func_master: overlord.example.org + +# change this port if Apache is not running plaintext on port +# 80. Most people can leave this alone. +http_port: 80 + +# kernel options that should be present in every cobbler installation. +# kernel options can also be applied at the distro/profile/system +# level. +kernel_options: + ksdevice: bootif + lang: ' ' + text: ~ + +# s390 systems require additional kernel options in addition to the +# above defaults +kernel_options_s390x: + RUNKS: 1 + ramdisk_size: 40000 + root: /dev/ram0 + ro: ~ + ip: off + vnc: ~ + +# configuration options if using the authn_ldap module. See the +# the Wiki for details. This can be ignored if you are not using +# LDAP for WebUI/XMLRPC authentication. +ldap_server: "ldap.example.com" +ldap_base_dn: "DC=example,DC=com" +ldap_port: 389 +ldap_tls: 1 +ldap_anonymous_bind: 1 +ldap_search_bind_dn: '' +ldap_search_passwd: '' +ldap_search_prefix: 'uid=' +ldap_tls_cacertfile: '' +ldap_tls_keyfile: '' +ldap_tls_certfile: '' + +# cobbler has a feature that allows for integration with config management +# systems such as Puppet. The following parameters work in conjunction with +# --mgmt-classes and are described in furhter detail at: +# https://github.com/cobbler/cobbler/wiki/Using-cobbler-with-a-configuration-management-system +mgmt_classes: [] +mgmt_parameters: + from_cobbler: 1 + +# if enabled, this setting ensures that puppet is installed during +# machine provision, a client certificate is generated and a +# certificate signing request is made with the puppet master server +puppet_auto_setup: 0 + +# when puppet starts on a system after installation it needs to have +# its certificate signed by the puppet master server. Enabling the +# following feature will ensure that the puppet server signs the +# certificate after installation if the puppet master server is +# running on the same machine as cobbler. This requires +# puppet_auto_setup above to be enabled +sign_puppet_certs_automatically: 0 + +# location of the puppet executable, used for revoking certificates +puppetca_path: "/usr/bin/puppet" + +# when a puppet managed machine is reinstalled it is necessary to +# remove the puppet certificate from the puppet master server before a +# new certificate is signed (see above). Enabling the following +# feature will ensure that the certificate for the machine to be +# installed is removed from the puppet master server if the puppet +# master server is running on the same machine as cobbler. This +# requires puppet_auto_setup above to be enabled +remove_old_puppet_certs_automatically: 0 + +# choose a --server argument when running puppetd/puppet agent during kickstart +#puppet_server: 'puppet' + +# let cobbler know that you're using a newer version of puppet +# choose version 3 to use: 'puppet agent'; version 2 uses status quo: 'puppetd' +#puppet_version: 2 + +# choose whether to enable puppet parameterized classes or not. +# puppet versions prior to 2.6.5 do not support parameters +#puppet_parameterized_classes: 1 + +# set to 1 to enable Cobbler's DHCP management features. +# the choice of DHCP management engine is in /etc/cobbler/modules.conf +manage_dhcp: 1 + +# set to 1 to enable Cobbler's DNS management features. +# the choice of DNS mangement engine is in /etc/cobbler/modules.conf +manage_dns: 1 + +# set to path of bind chroot to create bind-chroot compatible bind +# configuration files. This should be automatically detected. +bind_chroot_path: "" + +# set to the ip address of the master bind DNS server for creating secondary +# bind configuration files +bind_master: 127.0.0.1 + +# set to 1 to enable Cobbler's TFTP management features. +# the choice of TFTP mangement engine is in /etc/cobbler/modules.conf +manage_tftpd: 1 + +# set to 1 to enable Cobbler's RSYNC management features. +manage_rsync: 0 + +# if using BIND (named) for DNS management in /etc/cobbler/modules.conf +# and manage_dns is enabled (above), this lists which zones are managed +# See the Wiki (https://github.com/cobbler/cobbler/wiki/Dns-management) for more info +manage_forward_zones: ['ods.com'] +manage_reverse_zones: [] + +# if using cobbler with manage_dhcp, put the IP address +# of the cobbler server here so that PXE booting guests can find it +# if you do not set this correctly, this will be manifested in TFTP open timeouts. +next_server: {{ host_ip }} + +# settings for power management features. optional. +# see https://github.com/cobbler/cobbler/wiki/Power-management to learn more +# choices (refer to codes.py): +# apc_snmp bladecenter bullpap drac ether_wake ilo integrity +# ipmilan ipmitool lpar rsa virsh wti +power_management_default_type: 'ipmitool' + +# the commands used by the power management module are sourced +# from what directory? +power_template_dir: "/etc/cobbler/power" + +# if this setting is set to 1, cobbler systems that pxe boot +# will request at the end of their installation to toggle the +# --netboot-enabled record in the cobbler system record. This eliminates +# the potential for a PXE boot loop if the system is set to PXE +# first in it's BIOS order. Enable this if PXE is first in your BIOS +# boot order, otherwise leave this disabled. See the manpage +# for --netboot-enabled. +pxe_just_once: 1 + +# the templates used for PXE config generation are sourced +# from what directory? +pxe_template_dir: "/etc/cobbler/pxe" + +# Path to where system consoles are +consoles: "/var/consoles" + +# Are you using a Red Hat management platform in addition to Cobbler? +# Cobbler can help you register to it. Choose one of the following: +# "off" : I'm not using Red Hat Network, Satellite, or Spacewalk +# "hosted" : I'm using Red Hat Network +# "site" : I'm using Red Hat Satellite Server or Spacewalk +# You will also want to read: https://github.com/cobbler/cobbler/wiki/Tips-for-RHN +redhat_management_type: "off" + +# if redhat_management_type is enabled, choose your server +# "management.example.org" : For Satellite or Spacewalk +# "xmlrpc.rhn.redhat.com" : For Red Hat Network +# This setting is also used by the code that supports using Spacewalk/Satellite users/passwords +# within Cobbler Web and Cobbler XMLRPC. Using RHN Hosted for this is not supported. +# This feature can be used even if redhat_management_type is off, you just have +# to have authn_spacewalk selected in modules.conf +redhat_management_server: "xmlrpc.rhn.redhat.com" + +# specify the default Red Hat authorization key to use to register +# system. If left blank, no registration will be attempted. Similarly +# you can set the --redhat-management-key to blank on any system to +# keep it from trying to register. +redhat_management_key: "" + +# if using authn_spacewalk in modules.conf to let cobbler authenticate +# against Satellite/Spacewalk's auth system, by default it will not allow per user +# access into Cobbler Web and Cobbler XMLRPC. +# in order to permit this, the following setting must be enabled HOWEVER +# doing so will permit all Spacewalk/Satellite users of certain types to edit all +# of cobbler's configuration. +# these roles are: config_admin and org_admin +# users should turn this on only if they want this behavior and +# do not have a cross-multi-org seperation concern. If you have +# a single org in your satellite, it's probably safe to turn this +# on and then you can use CobblerWeb alongside a Satellite install. +redhat_management_permissive: 0 + +# if set to 1, allows /usr/bin/cobbler-register (part of the koan package) +# to be used to remotely add new cobbler system records to cobbler. +# this effectively allows for registration of new hardware from system +# records. +register_new_installs: 0 + +# Flags to use for yum's reposync. If your version of yum reposync +# does not support -l, you may need to remove that option. +reposync_flags: "-l -n -d" + +# These options will be used for an rsync initiated by cobbler replicate +replicate_rsync_options: "-avzH" + +# when DHCP and DNS management are enabled, cobbler sync can automatically +# restart those services to apply changes. The exception for this is +# if using ISC for DHCP, then omapi eliminates the need for a restart. +# omapi, however, is experimental and not recommended for most configurations. +# If DHCP and DNS are going to be managed, but hosted on a box that +# is not on this server, disable restarts here and write some other +# script to ensure that the config files get copied/rsynced to the destination +# box. This can be done by modifying the restart services trigger. +# Note that if manage_dhcp and manage_dns are disabled, the respective +# parameter will have no effect. Most users should not need to change +# this. +restart_dns: 1 +restart_dhcp: 1 + +# install triggers are scripts in /var/lib/cobbler/triggers/install +# that are triggered in kickstart pre and post sections. Any +# executable script in those directories is run. They can be used +# to send email or perform other actions. They are currently +# run as root so if you do not need this functionality you can +# disable it, though this will also disable "cobbler status" which +# uses a logging trigger to audit install progress. +run_install_triggers: 1 + +# enables a trigger which version controls all changes to /var/lib/cobbler +# when add, edit, or sync events are performed. This can be used +# to revert to previous database versions, generate RSS feeds, or for +# other auditing or backup purposes. "git" and "hg" are currently suported, +# but git is the recommend SCM for use with this feature. +scm_track_enabled: 0 +scm_track_mode: "git" + +# this is the address of the cobbler server -- as it is used +# by systems during the install process, it must be the address +# or hostname of the system as those systems can see the server. +# if you have a server that appears differently to different subnets +# (dual homed, etc), you need to read the --server-override section +# of the manpage for how that works. +server: {{ host_ip }} + +# If set to 1, all commands will be forced to use the localhost address +# instead of using the above value which can force commands like +# cobbler sync to open a connection to a remote address if one is in the +# configuration and would traceback. +client_use_localhost: 0 + +# If set to 1, all commands to the API (not directly to the XMLRPC +# server) will go over HTTPS instead of plaintext. Be sure to change +# the http_port setting to the correct value for the web server +client_use_https: 0 + +# this is a directory of files that cobbler uses to make +# templating easier. See the Wiki for more information. Changing +# this directory should not be required. +snippetsdir: /var/lib/cobbler/snippets + +# Normally if a kickstart is specified at a remote location, this +# URL will be passed directly to the kickstarting system, thus bypassing +# the usual snippet templating Cobbler does for local kickstart files. If +# this option is enabled, Cobbler will fetch the file contents internally +# and serve a templated version of the file to the client. +template_remote_kickstarts: 0 + +# should new profiles for virtual machines default to auto booting with the physical host when the physical host reboots? +# this can be overridden on each profile or system object. +virt_auto_boot: 1 + +# cobbler's web directory. Don't change this setting -- see the +# Wiki on "relocating your cobbler install" if your /var partition +# is not large enough. +webdir: /var/www/cobbler + +# cobbler's public XMLRPC listens on this port. Change this only +# if absolutely needed, as you'll have to start supplying a new +# port option to koan if it is not the default. +xmlrpc_port: 25151 + +# "cobbler repo add" commands set cobbler up with repository +# information that can be used during kickstart and is automatically +# set up in the cobbler kickstart templates. By default, these +# are only available at install time. To make these repositories +# usable on installed systems (since cobbler makes a very convient) +# mirror, set this to 1. Most users can safely set this to 1. Users +# who have a dual homed cobbler server, or are installing laptops that +# will not always have access to the cobbler server may wish to leave +# this as 0. In that case, the cobbler mirrored yum repos are still +# accessable at http://cobbler.example.org/cblr/repo_mirror and yum +# configuration can still be done manually. This is just a shortcut. +yum_post_install_mirror: 1 + +# the default yum priority for all the distros. This is only used +# if yum-priorities plugin is used. 1=maximum. Tweak with caution. +yum_distro_priority: 1 + +# Flags to use for yumdownloader. Not all versions may support +# --resolve. +yumdownloader_flags: "--resolve" + +# sort and indent JSON output to make it more human-readable +serializer_pretty_json: 0 + +# replication rsync options for distros, kickstarts, snippets set to override default value of "-avzH" +replicate_rsync_options: "-avzH" + +# replication rsync options for repos set to override default value of "-avzH" +replicate_repo_rsync_options: "-avzH" diff --git a/util/docker-compose/roles/compass/templates/zone.template.j2 b/util/docker-compose/roles/compass/templates/zone.template.j2 new file mode 100755 index 00000000..ea67b739 --- /dev/null +++ b/util/docker-compose/roles/compass/templates/zone.template.j2 @@ -0,0 +1,17 @@ +\$TTL 300 +@ IN SOA $cobbler_server. nobody.example.com. ( + $serial ; Serial + 600 ; Refresh + 1800 ; Retry + 604800 ; Expire + 300 ; TTL + ) + + IN NS $cobbler_server. + + +$cname_record + +$host_record +compass-250-41 IN A {{ host_ip }} +metrics IN A {{ host_ip }} -- cgit 1.2.3-korg