aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Lyngstol <kly@kly.no>2016-09-20 19:41:56 +0200
committerKristian Lyngstol <kly@kly.no>2016-09-20 19:41:56 +0200
commitd47cef0006b93680a8b5b77772154d7644ebbcb5 (patch)
tree9742451c69e8c80b71e7daa06c20919ff5ae6015
parent0cc5566a5629253794e60763c573752cbe4bcf93 (diff)
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.
-rw-r--r--ansible/playbook-test.yml17
-rw-r--r--ansible/roles/basics/tasks/main.yml16
-rwxr-xr-xbuild/test/dummy-graphite.start9
-rw-r--r--build/test/gondul-collector-test.Dockerfile1
-rw-r--r--build/test/gondul-graphite-test.Dockerfile13
-rw-r--r--build/test/gondul-snmp-test.Dockerfile1
6 files changed, 49 insertions, 8 deletions
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
diff --git a/build/test/dummy-graphite.start b/build/test/dummy-graphite.start
new file mode 100755
index 0000000..992928e
--- /dev/null
+++ b/build/test/dummy-graphite.start
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+if [ ! -r /var/lib/graphite/graphite.db ]; then
+ graphite-manage migrate
+ graphite-manage createsuperuser --noinput --username=admin --email root@localhost.localdomain
+ chown -R _graphite:_graphite /var/lib/graphite/
+fi
+service apache2 start
+service carbon-cache start
+while true; do sleep 10; done
diff --git a/build/test/gondul-collector-test.Dockerfile b/build/test/gondul-collector-test.Dockerfile
index 0af8f75..c778c24 100644
--- a/build/test/gondul-collector-test.Dockerfile
+++ b/build/test/gondul-collector-test.Dockerfile
@@ -15,3 +15,4 @@ RUN apt-get -y install \
perl-modules
RUN mkdir -p /opt/gondul
CMD /opt/gondul/collectors/ping.pl
+EXPOSE 1111
diff --git a/build/test/gondul-graphite-test.Dockerfile b/build/test/gondul-graphite-test.Dockerfile
new file mode 100644
index 0000000..5ac187e
--- /dev/null
+++ b/build/test/gondul-graphite-test.Dockerfile
@@ -0,0 +1,13 @@
+FROM debian:jessie
+RUN DEBIAN_FRONTEND=noninteractive apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y graphite-carbon graphite-web apache2
+RUN apt-get install -y libapache2-mod-wsgi
+RUN cp /usr/share/graphite-web/apache2-graphite.conf /etc/apache2/sites-available/graphite-web.conf
+RUN a2ensite graphite-web
+RUN a2dissite 000-default
+RUN a2enmod wsgi
+RUN sed -i 's/false/true/g' /etc/default/graphite-carbon
+ADD build/test/dummy-graphite.start /dummy-graphite.start
+EXPOSE 80
+EXPOSE 2003
+CMD /dummy-graphite.start
+VOLUME /var/lib/graphite
diff --git a/build/test/gondul-snmp-test.Dockerfile b/build/test/gondul-snmp-test.Dockerfile
index a99a943..3491831 100644
--- a/build/test/gondul-snmp-test.Dockerfile
+++ b/build/test/gondul-snmp-test.Dockerfile
@@ -18,3 +18,4 @@ RUN apt-get -y install \
RUN mkdir -p /opt/gondul
COPY build/test/snmpd.conf /etc/snmp/
CMD /opt/gondul/build/test/snmpfetch-misc.sh
+EXPOSE 1111