add publish-local
authorLorin Hochstein <lhochstein@netflix.com>
Sun, 5 Feb 2017 21:28:50 +0000 (13:28 -0800)
committerLorin Hochstein <lhochstein@netflix.com>
Sun, 5 Feb 2017 21:29:05 +0000 (13:29 -0800)
ch13/Makefile
ch13/publish-local.yml [new file with mode: 0644]

index 6dff512..e5d5212 100644 (file)
@@ -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 (file)
index 0000000..c07eceb
--- /dev/null
@@ -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