From f2a357bdcb7915cd0a2d4a63a98fe8d24e7e3973 Mon Sep 17 00:00:00 2001
From: Harold Barker <git@haroldbarker.co.uk>
Date: Fri, 12 Feb 2016 17:53:23 +0000
Subject: [PATCH] Install GitLab Runner for RedHat

---
 tasks/install-redhat.yml                      | 19 +++++++++++++++++++
 tasks/main.yml                                |  4 +++-
 .../runner_gitlab-ci-multi-runner.repo.j2     | 19 +++++++++++++++++++
 3 files changed, 41 insertions(+), 1 deletion(-)
 create mode 100644 tasks/install-redhat.yml
 create mode 100644 templates/runner_gitlab-ci-multi-runner.repo.j2

diff --git a/tasks/install-redhat.yml b/tasks/install-redhat.yml
new file mode 100644
index 0000000..c875d22
--- /dev/null
+++ b/tasks/install-redhat.yml
@@ -0,0 +1,19 @@
+---
+- name: Install GitLab Runner dependencies
+  yum:
+    name: '{{ item }}'
+    state: present
+  with_items:
+    - pygpgme
+    - yum-utils
+
+- name: Add GitLab Runner rpm repo
+  template:
+    src: runner_gitlab-ci-multi-runner.repo.j2
+    dest: /etc/yum.repos.d/runner_gitlab-ci-multi-runner.repo
+
+- name: Install GitLab Runner
+  yum:
+    name: gitlab-ci-multi-runner
+    state: latest
+    update_cache: yes
diff --git a/tasks/main.yml b/tasks/main.yml
index 1151123..d0904b5 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -1,2 +1,4 @@
 ---
-# tasks file for gitlab-runner
+- name: Install GitLab Runner (RedHat)
+  include: install-redhat.yml
+  when: ansible_os_family == 'RedHat'
diff --git a/templates/runner_gitlab-ci-multi-runner.repo.j2 b/templates/runner_gitlab-ci-multi-runner.repo.j2
new file mode 100644
index 0000000..6964c0a
--- /dev/null
+++ b/templates/runner_gitlab-ci-multi-runner.repo.j2
@@ -0,0 +1,19 @@
+[runner_gitlab-ci-multi-runner]
+name=runner_gitlab-ci-multi-runner
+baseurl=https://packages.gitlab.com/runner/gitlab-ci-multi-runner/el/{{ ansible_distribution_major_version }}/$basearch
+repo_gpgcheck=1
+gpgcheck=0
+enabled=1
+gpgkey=https://packages.gitlab.com/gpg.key
+sslverify=1
+sslcacert=/etc/pki/tls/certs/ca-bundle.crt
+
+[runner_gitlab-ci-multi-runner-source]
+name=runner_gitlab-ci-multi-runner-source
+baseurl=https://packages.gitlab.com/runner/gitlab-ci-multi-runner/el/{{ ansible_distribution_major_version }}/SRPMS
+repo_gpgcheck=1
+gpgcheck=0
+enabled=1
+gpgkey=https://packages.gitlab.com/gpg.key
+sslverify=1
+sslcacert=/etc/pki/tls/certs/ca-bundle.crt
-- 
GitLab