From f03a3f2cd087773fe7b5e604918ca753a21a35b6 Mon Sep 17 00:00:00 2001 From: Lorin Hochstein Date: Sun, 5 Feb 2017 13:28:50 -0800 Subject: [PATCH] add publish-local --- ch13/Makefile | 5 ++++- ch13/publish-local.yml | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 ch13/publish-local.yml diff --git a/ch13/Makefile b/ch13/Makefile index 6dff512..e5d5212 100644 --- a/ch13/Makefile +++ b/ch13/Makefile @@ -1,4 +1,7 @@ -.PHONY: start publish build +.PHONY: start publish build local + +local: + ansible-playbook publish-local.yml publish: build ansible-playbook publish.yml diff --git a/ch13/publish-local.yml b/ch13/publish-local.yml new file mode 100644 index 0000000..c07eceb --- /dev/null +++ b/ch13/publish-local.yml @@ -0,0 +1,20 @@ +- name: publish images to local docker registry + hosts: localhost + gather_facts: False + vars: + repo_port: 5000 + repo: "localhost:{{repo_port}}" + image: ansiblebook/nginx-ghost + tasks: + - name: start a registry locally + docker_container: + name: registry + image: registry:2 + ports: "{{ repo_port }}:5000" + - debug: + msg: name={{ image }} repo={{ repo }}/{{ image }} + - name: tag the nginx-ghost image to the repository + docker_image: + name: "{{ image }}" + repository: "{{ repo }}/{{ image }}" + push: yes -- 2.44.0