summaryrefslogtreecommitdiff
path: root/roles
diff options
context:
space:
mode:
Diffstat (limited to 'roles')
-rw-r--r--roles/contexts/fretlink/defaults/main.yml2
-rw-r--r--roles/contexts/fretlink/files/docker/mongo_hacker/Dockerfile10
-rwxr-xr-xroles/contexts/fretlink/files/workdir/start2
-rw-r--r--roles/contexts/fretlink/tasks/main.yml27
4 files changed, 40 insertions, 1 deletions
diff --git a/roles/contexts/fretlink/defaults/main.yml b/roles/contexts/fretlink/defaults/main.yml
index 101c9aa..078e3da 100644
--- a/roles/contexts/fretlink/defaults/main.yml
+++ b/roles/contexts/fretlink/defaults/main.yml
@@ -14,3 +14,5 @@ zeal_roles:
14 - Rust 14 - Rust
15 - Vim 15 - Vim
16 - XSLT 16 - XSLT
17docker_images:
18 - ["mongo", "3.6-hacker", "mongo_hacker"]
diff --git a/roles/contexts/fretlink/files/docker/mongo_hacker/Dockerfile b/roles/contexts/fretlink/files/docker/mongo_hacker/Dockerfile
new file mode 100644
index 0000000..019e159
--- /dev/null
+++ b/roles/contexts/fretlink/files/docker/mongo_hacker/Dockerfile
@@ -0,0 +1,10 @@
1FROM mongo:3.6
2
3RUN apt-get update \
4 && apt-get install -y git \
5 && apt-get install -y build-essential \
6 && git clone --depth=1 https://github.com/TylerBrock/mongo-hacker.git \
7 && rm -rf ~/.mongorc.js \
8 && cd mongo-hacker \
9 && make install
10
diff --git a/roles/contexts/fretlink/files/workdir/start b/roles/contexts/fretlink/files/workdir/start
index 911c28d..b587efe 100755
--- a/roles/contexts/fretlink/files/workdir/start
+++ b/roles/contexts/fretlink/files/workdir/start
@@ -27,7 +27,7 @@ function start_app() {
27 trap 'make stop' EXIT 27 trap 'make stop' EXIT
28 28
29 if ! docker top mongo_container 2>/dev/null; then 29 if ! docker top mongo_container 2>/dev/null; then
30 docker run -d --name mongo_container -p 27017:27017 --rm -v $(pwd)/appdata:/data/db mongo:3.6 30 docker run -d --name mongo_container -p 27017:27017 --rm -v $(pwd)/appdata:/data/db mongo:3.6-hacker
31 echo "Waiting until mongo is started" 31 echo "Waiting until mongo is started"
32 sleep 10 32 sleep 10
33 fi 33 fi
diff --git a/roles/contexts/fretlink/tasks/main.yml b/roles/contexts/fretlink/tasks/main.yml
index ce69e02..99d39b3 100644
--- a/roles/contexts/fretlink/tasks/main.yml
+++ b/roles/contexts/fretlink/tasks/main.yml
@@ -111,3 +111,30 @@
111 dest: "$XDG_DATA_HOME/bash_completion/_{{ item }}" 111 dest: "$XDG_DATA_HOME/bash_completion/_{{ item }}"
112 loop: 112 loop:
113 - fl_tmux_dev 113 - fl_tmux_dev
114- name: docker images
115 block:
116 - name: check missing docker images
117 register: docker_missing_images
118 shell: '[ -n "$(docker image ls -q {{ item.0 }}:{{ item.1 }})" ] || echo "missing"'
119 loop: "{{ docker_images }}"
120 check_mode: no
121 changed_when: docker_missing_images.stdout != ""
122 - name: Ask for Docker images
123 when: docker_missing_images.changed
124 pause:
125 prompt: "install Fretlink Docker images ? [y/N]"
126 register: docker_install_images
127 check_mode: no
128 - name: install custom docker images
129 when: item.2 is not none and docker_missing_images.changed and docker_install_images.user_input.startswith("y")
130 docker_image:
131 path: "./roles/contexts/fretlink/files/docker/{{ item.2 }}"
132 tag: "{{ item.1 }}"
133 name: "{{ item.0 }}"
134 loop: "{{ docker_images }}"
135 - name: install repository docker images
136 when: item.2 is none and docker_missing_images.changed and docker_install_images.user_input.startswith("y")
137 docker_image:
138 tag: "{{ item.1 }}"
139 name: "{{ item.0 }}"
140 loop: "{{ docker_images }}"