summaryrefslogtreecommitdiff
path: root/global/overlay/etc/puppet/modules/sunet/templates
diff options
context:
space:
mode:
authorLeif Johansson <leifj@sunet.se>2015-05-09 17:02:05 +0200
committerLeif Johansson <leifj@sunet.se>2015-05-09 17:02:05 +0200
commit8a67b007b3d36864ac70a9182b0e5273411de83e (patch)
tree44e3295b5217ac0c02fa9ef05f632f2f0a2c8e44 /global/overlay/etc/puppet/modules/sunet/templates
parentcc36f13b80cbfe812218eaf94054ca0a3f1bb3b7 (diff)
switch to sunet modulect-ops-2015-05-09-v01
Diffstat (limited to 'global/overlay/etc/puppet/modules/sunet/templates')
-rwxr-xr-xglobal/overlay/etc/puppet/modules/sunet/templates/dockerhost/20unbound.erb78
-rw-r--r--global/overlay/etc/puppet/modules/sunet/templates/dockerhost/logrotate_docker-containers.erb7
-rw-r--r--global/overlay/etc/puppet/modules/sunet/templates/dockerhost/unbound_docker.conf.erb5
3 files changed, 0 insertions, 90 deletions
diff --git a/global/overlay/etc/puppet/modules/sunet/templates/dockerhost/20unbound.erb b/global/overlay/etc/puppet/modules/sunet/templates/dockerhost/20unbound.erb
deleted file mode 100755
index 204e97c..0000000
--- a/global/overlay/etc/puppet/modules/sunet/templates/dockerhost/20unbound.erb
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/bin/bash
-#
-# This script registers/removes docker containers IP addresses
-# from the local unbound resolver in the post-start / pre-stop actions.
-#
-# For action pre-start, it checks if there is a CID file that needs to be
-# cleaned away to not prevent the new container from starting.
-#
-
-# sunet_docker_pre-post: CID d05a0842ce1700ee3328d42ccf5c2f29cc3d71fa6dcc6a72f994f8d032453be7
-# sunet_docker_pre-post: ACTION pre-stop
-# sunet_docker_pre-post: IMAGE docker.sunet.se/eduid/eduid-mm-service
-# sunet_docker_pre-post: NAME eduid-mm-service
-#for e in "CID" "ACTION" "IMAGE" "NAME"; do
-# logger -t sunet_docker_pre-post "$e `printenv $e`"
-#done
-
-logtag="sunet_docker_pre-post[$ACTION]"
-logger -t "${logtag}" "$NAME ($IMAGE), CID: '$CID'"
-
-if [ "x$ACTION" = "xpre-start" ]; then
- if [ -f "${CIDFILE}" ]; then
- # Clean away the CID file in pre-start if the container is in fact not running
- docker inspect "${CID}" 2>/dev/null || (
- logger -t "${logtag}" "Removing left-over CID file '${CIDFILE}' (CID ${CID})";
- rm -f "${CIDFILE}"
- )
- fi
-
- # Remove any stopped container with this name to prevent the docker start script
- # from just restarting that one (instead of starting the currently tagged image,
- # which might be newer than the one used by the old container)
- docker inspect "${NAME}" && docker rm "${NAME}"
- exit 0
-fi
-
-if [ "x${CID}" = "x" ]; then
- CID=$(docker inspect --format '{{ .Id }}' "${NAME}" 2>/dev/null)
-
- if [ "x${CID}" = "x" ]; then
- # sometimes containers start slow...
- for retry in 1 2 3 4 5; do
- sleep 1
- logger -t "${logtag}" "Retrying CID lookup for ${NAME}"
- CID=$(docker inspect --format '{{ .Id }}' "${NAME}" 2>/dev/null)
- if [ "x${CID}" != "x" ]; then
- break
- fi
- done
- fi
-
- if [ "x${CID}" = "x" ]; then
- logger -t "${logtag}" "No CID provided or found! Aborting."
- exit 0
- fi
-
- logger -t "${logtag}" "Found CID ${CID} using docker inspect on '${NAME}'"
-fi
-
-# Remove registered name.
-# XXX this does NOT handle multiple instances of the same image running on
-# a single Docker host!
-logger -t "${logtag}" "Un-registering ${NAME}.docker"
-unbound-control local_data_remove "${NAME}.docker." > /dev/null
-
-# If it is a container starting up, register it's IP address
-if [ "x$ACTION" = "xpost-start" ]; then
- ip=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' "${CID}" 2>/dev/null)
- if [ "x${ip}" = "x" ]; then
- logger -t "${logtag}" "Failed to get IP from CID ${CID}. Aborting."
- exit 0
- fi
- unbound-control local_data "${NAME}.docker. 60 IN A ${ip}" > /dev/null
- # Register reverse pointer - there is no local_data_ptr command unfortunately
- ptr=$(echo "${ip}" | awk -F . '{print $4"."$3"."$2"."$1".in-addr.arpa."}')
- unbound-control local_data "${ptr} 60 IN PTR ${NAME}.docker."
- logger -t "${logtag}" "Registered ${NAME}.docker at ${ip}"
-fi
diff --git a/global/overlay/etc/puppet/modules/sunet/templates/dockerhost/logrotate_docker-containers.erb b/global/overlay/etc/puppet/modules/sunet/templates/dockerhost/logrotate_docker-containers.erb
deleted file mode 100644
index 6cf5fe9..0000000
--- a/global/overlay/etc/puppet/modules/sunet/templates/dockerhost/logrotate_docker-containers.erb
+++ /dev/null
@@ -1,7 +0,0 @@
-/var/lib/docker/containers/*/*.log {
- rotate 7
- daily
- compress
- delaycompress
- copytruncate
-}
diff --git a/global/overlay/etc/puppet/modules/sunet/templates/dockerhost/unbound_docker.conf.erb b/global/overlay/etc/puppet/modules/sunet/templates/dockerhost/unbound_docker.conf.erb
deleted file mode 100644
index f6bb382..0000000
--- a/global/overlay/etc/puppet/modules/sunet/templates/dockerhost/unbound_docker.conf.erb
+++ /dev/null
@@ -1,5 +0,0 @@
-server:
- local-zone: docker. static
- interface: 127.0.0.1
- interface: 172.17.42.1
- access-control: 172.16.0.0/12 allow