From: Lorin Hochstein Date: Sun, 5 Feb 2017 05:04:09 +0000 (-0800) Subject: Support for publishing to registry X-Git-Url: https://git.halfball.org/?a=commitdiff_plain;h=7a5c15ee281068c6cb2b7ee179caa40768c65f32;p=ansiblebook.git Support for publishing to registry --- diff --git a/ch13/Makefile b/ch13/Makefile index afa97c8..6dff512 100644 --- a/ch13/Makefile +++ b/ch13/Makefile @@ -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 index 0000000..655f3bd --- /dev/null +++ b/ch13/build.yml @@ -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 diff --git a/ch13/docker-compose.yml b/ch13/docker-compose.yml index 1fe5512..2c43b4a 100644 --- a/ch13/docker-compose.yml +++ b/ch13/docker-compose.yml @@ -1,7 +1,7 @@ version: '2' services: nginx: - image: nginx-ghost + image: ansiblebook/nginx-ghost ports: - "8000:80" - "8443:443" diff --git a/ch13/ghost.yml b/ch13/ghost.yml index ec93e35..c57910c 100644 --- a/ch13/ghost.yml +++ b/ch13/ghost.yml @@ -5,7 +5,7 @@ tasks: - name: create Nginx image docker_image: - name: nginx-ghost + name: ansiblebook/nginx-ghost path: nginx - name: create certs command: > diff --git a/ch13/publish.yml b/ch13/publish.yml index 9e3330a..3173454 100644 --- a/ch13/publish.yml +++ b/ch13/publish.yml @@ -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