From a70a43d21346ca0f280430b4d81e545640d0650d Mon Sep 17 00:00:00 2001
From: Romain CABASSOT <romain.cabassot@magellium.fr>
Date: Tue, 8 Aug 2017 09:48:30 +0200
Subject: [PATCH] Added docker executor 'privileged' configurable option.

---
 defaults/main.yml      |  3 +++
 tasks/global-setup.yml | 14 ++++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/defaults/main.yml b/defaults/main.yml
index 77a5373..b6dc981 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -14,3 +14,6 @@ gitlab_runner_executor: 'shell'
 gitlab_runner_docker_image: ''
 # Runner tags
 gitlab_runner_tags: []
+# Docker privileged mode
+gitlab_runner_docker_privileged: false
+
diff --git a/tasks/global-setup.yml b/tasks/global-setup.yml
index 0c141ff..b573ab7 100644
--- a/tasks/global-setup.yml
+++ b/tasks/global-setup.yml
@@ -2,6 +2,16 @@
 - name: Set concurrent option
   lineinfile:
     dest: /etc/gitlab-runner/config.toml
-    regexp: ^concurrent =
-    line: concurrent = {{ gitlab_runner_concurrent }}
+    regexp: '^(\s*)concurrent ='
+    line: '\1concurrent = {{ gitlab_runner_concurrent }}'
     state: present
+    backrefs: yes
+
+- name: Set docker privileged option
+  lineinfile:
+    dest: /etc/gitlab-runner/config.toml
+    regexp: '^(\s*)privileged ='
+    line: '\1privileged = {{ gitlab_runner_docker_privileged | lower}}'
+    state: present
+    backrefs: yes
+
-- 
GitLab