Add ansible target

This commit is contained in:
jalr 2018-03-22 20:54:50 +01:00
parent c6313d9848
commit ceeb370d39
2 changed files with 26 additions and 0 deletions

View file

@ -8,6 +8,9 @@ CWD=$(abspath $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST))))))
COMPRESSION_LEVEL ?= 5
ANSIBLE_LIMIT ?= qemumachine
ANSIBLE_TAGS ?=
qemu_ifname_br = brlabsync
qemu_ifname_tap = taplabsync
qemu_hostname = qemumachine
@ -71,6 +74,25 @@ images/debian-stretch.torrent: images
"$(DOCKER_IMAGE)" \
debian-stretch
.PHONY: ansible
ansible:
docker run \
--rm \
-v "${PWD}/packer/ansible:/ansible" \
-e "user=`id -u`" \
-e "group=`id -g`" \
-e "ANNOUNCE=$(ANNOUNCE)" \
-e "WEBSEED=$(WEBSEED)" \
-e "TASK=ansible" \
-v "${SSH_AUTH_SOCK}:/var/run/ssh_auth_sock" \
-e "SSH_AUTH_SOCK=/var/run/ssh_auth_sock" \
"$(DOCKER_IMAGE)" \
-i inventories \
$(if $(ANSIBLE_TAGS),-t $(ANSIBLE_TAGS),) \
-l $(ANSIBLE_LIMIT) \
--ssh-extra-args="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" \
playbook.yml
# updates the initramfs
# only used for development
images/debian-stretch.initramfs.dev: tmp/initramfs-extracted/debian-stretch packer/initramfs/labsync

View file

@ -88,4 +88,8 @@ fi
if [ -z "$TASK" ] || [ "$TASK" == "torrent" ]; then
make_torrent "$NAME.squashfs"
fi
if [ "$TASK" == "ansible" ]; then
cd /ansible
/usr/bin/ansible-playbook "$@"
fi