Support for publishing to registry
authorLorin Hochstein <lhochstein@netflix.com>
Sun, 5 Feb 2017 05:04:09 +0000 (21:04 -0800)
committerLorin Hochstein <lhochstein@netflix.com>
Sun, 5 Feb 2017 05:04:09 +0000 (21:04 -0800)
ch13/Makefile
ch13/build.yml [new file with mode: 0644]
ch13/docker-compose.yml
ch13/ghost.yml
ch13/publish.yml

index afa97c8..6dff512 100644 (file)
@@ -1,10 +1,14 @@
-.PHONY: start publish
+.PHONY: start publish build
+
+publish: build
+       ansible-playbook publish.yml
+
+build:
+       ansible-playbook build.yml
 
 start:
        ansible-playbook ghost.yml
 
-publish:
-       ansible-playbook publish.yml
 
 # Generate self-signed certs for localhost
 ssl: certs/nginx.crt certs/nginx.key
diff --git a/ch13/build.yml b/ch13/build.yml
new file mode 100644 (file)
index 0000000..655f3bd
--- /dev/null
@@ -0,0 +1,9 @@
+---
+- name: Run Ghost locally
+  hosts: localhost
+  gather_facts: False
+  tasks:
+    - name: create Nginx image
+      docker_image:
+        name: ansiblebook/nginx-ghost
+        path: nginx
index 1fe5512..2c43b4a 100644 (file)
@@ -1,7 +1,7 @@
 version: '2'
 services:
   nginx:
-    image: nginx-ghost
+    image: ansiblebook/nginx-ghost
     ports:
       - "8000:80"
       - "8443:443"
index ec93e35..c57910c 100644 (file)
@@ -5,7 +5,7 @@
   tasks:
     - name: create Nginx image
       docker_image:
-        name: nginx-ghost
+        name: ansiblebook/nginx-ghost
         path: nginx
     - name: create certs
       command: >
index 9e3330a..3173454 100644 (file)
@@ -1,9 +1,23 @@
 - name: publish images to docker hub
   hosts: localhost
   gather_facts: False
+  vars_prompt:
+    - name: username
+      prompt: Enter Docker Registry username
+      private: no
+    - name: email
+      prompt: Enter Docker Registry email
+      private: no
+    - name: password
+      prompt: Enter Docker Registry password
+      private: yes
   tasks:
+    - name: authenticate with repository
+      docker_login:
+        username: "{{ username }}"
+        email: "{{ email }}"
+        password: "{{ password }}"
     - name: push image up
       docker_image:
-        name: nginx-ghost
-        repository: lorin/nginx-ghost
+        name: ansiblebook/nginx-ghost
         push: yes