Initial commit

This commit is contained in:
Sonny Bakker 2020-11-07 21:26:04 +01:00
commit 70c8393f0b
13 changed files with 185 additions and 0 deletions

View file

@ -0,0 +1,8 @@
default_user: "sonny"
gitlab_repo: "deb https://packages.gitlab.com/runner/gitlab-runner/debian/ buster main"
gitlab_runner_gpg: "https://packages.gitlab.com/runner/gitlab-runner/gpgkey"
docker_repo: "deb https://download.docker.com/linux/debian buster stable"
docker_gpg: "https://download.docker.com/linux/debian/gpg"
docker_gpg_id: "0EBFCD88"

View file

@ -0,0 +1,5 @@
- name: restart gitlab-runner
systemd:
name: gitlab-runner
state: restarted
enabled: yes

View file

@ -0,0 +1,16 @@
dependencies:
- common
galaxy_info:
author: sonny
description: "Gitlab-runner installation"
license: "license GPLv3"
min_ansible_version: 2.7
issue_tracker_url: "https://git.fudiggity.nl/ansible/gitlab-runner/-/issues"
platforms:
- name: Debian
versions:
- buster
galaxy_tags:
- development
- system

View file

@ -0,0 +1,62 @@
- include_role:
name: common
tasks_from: "network.yml"
- include_role:
name: common
tasks_from: "host.yml"
- name: copy apt preference file
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: root
group: root
mode: "0600"
loop:
- {
src: "apt-pin.j2",
dest: "/etc/apt/preferences.d/pin-gitlab-runner.pref",
}
- name: Add docker gpg key
apt_key:
id: "{{ docker_gpg_id }}"
url: "{{ docker_gpg }}"
validate_certs: yes
state: present
- name: Add gitlab-runner gpg key
apt_key:
url: "{{ gitlab_runner_gpg }}"
validate_certs: yes
state: present
- name: Add docker repo
apt_repository:
repo: "{{ docker_repo }}"
validate_certs: yes
state: present
- name: Add gitlab-runner repo
apt_repository:
repo: "{{ gitlab_repo }}"
validate_certs: yes
state: present
- name: install packages # noqa 403
apt:
name:
- gitlab-runner
- docker-ce
- docker-ce-cli
- containerd.io
update_cache: true
state: latest
notify:
- restart gitlab-runner
- meta: flush_handlers
# see https://gitlab.com/gitlab-org/gitlab-runner/issues/305
- name: ensure docker is restarted
service: name=docker state=restarted enabled=yes

View file

@ -0,0 +1,6 @@
# {{ ansible_managed }} {{ ansible_date_time.time }} {{ ansible_date_time.date }}
Explanation: Prefer GitLab provided packages over the Debian native ones
Package: gitlab-runner
Pin: origin packages.gitlab.com
Pin-Priority: 1001