Initial commit
This commit is contained in:
commit
70c8393f0b
13 changed files with 185 additions and 0 deletions
6
roles/.gitignore
vendored
Normal file
6
roles/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# ignore all external roles and files in the roles dir
|
||||
/*
|
||||
|
||||
!.gitignore
|
||||
!requirements.yml
|
||||
!gitlab_runner*/
|
||||
8
roles/gitlab_runner/defaults/main.yml
Normal file
8
roles/gitlab_runner/defaults/main.yml
Normal 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"
|
||||
5
roles/gitlab_runner/handlers/main.yml
Normal file
5
roles/gitlab_runner/handlers/main.yml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
- name: restart gitlab-runner
|
||||
systemd:
|
||||
name: gitlab-runner
|
||||
state: restarted
|
||||
enabled: yes
|
||||
16
roles/gitlab_runner/meta/main.yml
Normal file
16
roles/gitlab_runner/meta/main.yml
Normal 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
|
||||
62
roles/gitlab_runner/tasks/main.yml
Normal file
62
roles/gitlab_runner/tasks/main.yml
Normal 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
|
||||
6
roles/gitlab_runner/templates/apt-pin.j2
Normal file
6
roles/gitlab_runner/templates/apt-pin.j2
Normal 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
|
||||
4
roles/requirements.yml
Normal file
4
roles/requirements.yml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
- src: git+https://git.fudiggity.nl/ansible/common.git
|
||||
name: common
|
||||
version: master
|
||||
scm: git
|
||||
Reference in a new issue