Add clean target
authorLorin Hochstein <lhochstein@netflix.com>
Tue, 7 Feb 2017 05:44:06 +0000 (21:44 -0800)
committerLorin Hochstein <lhochstein@netflix.com>
Tue, 7 Feb 2017 05:44:06 +0000 (21:44 -0800)
ch13/Makefile
ch13/clean.yml [new file with mode: 0644]

index 6eaba46..797a362 100644 (file)
@@ -21,6 +21,8 @@ build:
 start:
        ansible-playbook ghost.yml
 
+clean:
+       ansible-playbook clean.yml
 
 # Generate self-signed certs for localhost
 ssl: certs/nginx.crt certs/nginx.key
diff --git a/ch13/clean.yml b/ch13/clean.yml
new file mode 100644 (file)
index 0000000..a1c02c9
--- /dev/null
@@ -0,0 +1,19 @@
+- name: remove all ghost containers and networks
+  hosts: ghost
+  become: True
+  gather_facts: False
+  tasks:
+    - name: remove containers
+      docker_container:
+        name: "{{ item }}"
+        state: absent
+      with_items:
+        - nginx_ghost
+        - ghost
+    - name: remove network
+      docker_network:
+        name: ghostnet
+        state: absent
+
+
+