From d47cef0006b93680a8b5b77772154d7644ebbcb5 Mon Sep 17 00:00:00 2001 From: Kristian Lyngstol Date: Tue, 20 Sep 2016 19:41:56 +0200 Subject: DOCKER + ANSIBLE == PAIN (also: graphite) 3 hours. THREE HOURS. The extra "Expose" statements are to workaround an issue introduced in Ansible 2.1 with the addition of the docker_* modules that replaces the "docker" module. THREEEEEEE HOURS. The graphite container is so far not ued for anything, but is provided to get things rolling. It does do persistent storage, but obviously not the way I originally wanted. Because persistent storage with docker is a pile of frozen piss. --- ansible/playbook-test.yml | 17 +++++++++++++---- ansible/roles/basics/tasks/main.yml | 16 ++++++++++++---- 2 files changed, 25 insertions(+), 8 deletions(-) (limited to 'ansible') diff --git a/ansible/playbook-test.yml b/ansible/playbook-test.yml index f110435..bf8a735 100644 --- a/ansible/playbook-test.yml +++ b/ansible/playbook-test.yml @@ -7,17 +7,26 @@ vars: - images: - name: "gondul-db-test" + volumes: [ "{{ pwd.stdout }}/:/opt/gondul" ] links: [] ports: [] + - name: "gondul-graphite-test" + volumes: [ "{{ pwd.stdout }}/:/opt/gondul" , "{{ pwd.stdout }}/data/graphite:/var/lib/graphite" ] + links: [] + ports: [] + - name: "gondul-collector-test" + volumes: [ "{{ pwd.stdout }}/:/opt/gondul" ] + links: [ "gondul-db-test:db" ] + ports: [] - name: "gondul-front-test" + volumes: [ "{{ pwd.stdout }}/:/opt/gondul" ] links: [ "gondul-db-test:db" ] ports: "{{ front_ports }}" - name: "gondul-varnish-test" - links: [ "gondul-front-test:gondul-front" ] + volumes: [ "{{ pwd.stdout }}/:/opt/gondul" ] + links: [ "gondul-front-test:gondul-front", "gondul-graphite-test:gondul-graphite" ] ports: "{{ varnish_ports }}" - - name: "gondul-collector-test" - links: [ "gondul-db-test:db" ] - ports: [] - name: "gondul-snmp-test" + volumes: [ "{{ pwd.stdout }}/:/opt/gondul" ] links: [ "gondul-db-test:db" ] ports: [] diff --git a/ansible/roles/basics/tasks/main.yml b/ansible/roles/basics/tasks/main.yml index 0497833..6a92a19 100644 --- a/ansible/roles/basics/tasks/main.yml +++ b/ansible/roles/basics/tasks/main.yml @@ -2,14 +2,18 @@ register: pwd tags: - build + - stop - start - test - name: make all docker_image: state: present + docker_api_version: 1.18 name: "{{ item.name }}" dockerfile: build/test/{{ item.name }}.Dockerfile path: "{{ pwd.stdout }}" + force: true + rm: false with_items: "{{ images }}" tags: - build @@ -17,6 +21,7 @@ - name: stop all docker: name: "{{ item.name }}" + docker_api_version: 1.18 state: stopped image: "{{ item.name }}" stop_timeout: 2 @@ -25,14 +30,17 @@ - stop - name: start all - docker: + docker_container: name: "{{ item.name }}" image: "{{ item.name }}" + docker_api_version: 1.18 state: started - net: bridge - ports: "{{ item.ports }}" + network_mode: bridge + recreate: true + restart: true + published_ports: "{{ item.ports }}" links: "{{ item.links }}" - volumes: [ "{{ pwd.stdout }}/:/opt/gondul" ] + volumes: "{{ item.volumes }}" with_items: "{{ images }}" tags: - start -- cgit v1.2.3