Networking
authorLorin Hochstein <lhochstein@netflix.com>
Tue, 7 Feb 2017 05:00:32 +0000 (21:00 -0800)
committerLorin Hochstein <lhochstein@netflix.com>
Tue, 7 Feb 2017 05:00:32 +0000 (21:00 -0800)
ch13/deploy.yml

index 914f4e3..4fc2ff4 100644 (file)
     database_host: "{{ groups['postgres'][0] }}"
     data_dir: /data/ghostdata
     certs_dir: /data/certs
+    net_name: ghostnet
   tasks:
+    - name: create network
+      docker_network: "name={{ net_name }}"
     - name: create ghostdata directory
       file:
         path: "{{ data_dir }}"
@@ -71,6 +74,8 @@
         image: ghost
         volumes:
           - "{{ data_dir }}:/var/lib/ghost"
+        networks:
+          - name: "{{ net_name }}"
     - name: create certs directory
       file:
         path: "{{ certs_dir }}"
       docker_container:
         name: nginx_ghost
         image: ansiblebook/nginx-ghost
-        links:
-          - ghost
+        networks:
+          - name: "{{ net_name }}"
+            links:
+              - ghost
         ports:
           - "0.0.0.0:80:80"
           - "0.0.0.0:443:443"