Skip to content

Commit e772bb6

Browse files
committed
Deleted double usage of sudo and apt-get update. Also adding gitlab-runner now with Ansible´s user module. Tags corrected additionally.
1 parent 59df977 commit e772bb6

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

gitlab-runner.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,14 @@
3434

3535
# Register Gitlab Runner
3636
- name: Unregister all previously used Gitlab Runners
37-
shell: "sudo gitlab-runner unregister --all-runners"
37+
shell: "gitlab-runner unregister --all-runners"
3838

3939
- name: Add gitlab-runner user to docker group
40-
shell: "sudo usermod -aG docker gitlab-runner"
40+
user:
41+
name: gitlab-runner
42+
groups: docker
43+
append: yes
44+
become: true
4145

4246
# see https://docs.gitlab.com/ce/ci/docker/using_docker_images.html#register-docker-runner
4347
# and this for non-interactive mode:

install-gitlab.yml

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
---
22
# See https://about.gitlab.com/installation/#ubuntu for the installation docs
33
# all the necessary steps are executed in this script here
4-
- name: Update apt and autoremove
5-
apt:
6-
update_cache: yes
7-
cache_valid_time: 3600
8-
autoremove: yes
94

105
- name: Install curl, openssh-server, ca-certificates & postfix
116
apt:
@@ -19,11 +14,9 @@
1914
- name: Add the GitLab package repository
2015
shell: "curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash"
2116

22-
- name: Update apt and autoremove
17+
- name: Update apt
2318
apt:
2419
update_cache: yes
25-
cache_valid_time: 3600
26-
autoremove: yes
2720

2821
- name: Install Gitlab with Omnibus-Installer
2922
apt:

prepare-gitlab.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
gitlab_runner_count: 5
1010

1111
tasks:
12-
1312
- name: Update apt
1413
apt:
1514
update_cache: yes
@@ -26,15 +25,15 @@
2625

2726
- name: Install Gitlab on Linux node
2827
import_tasks: install-gitlab.yml
29-
tags: install_gitlab
28+
tags: gitlab
3029

3130
- name: Configure Gitlab Container Registry
3231
import_tasks: configure-gitlab-registry.yml
33-
tags: configure_registry
32+
tags: registry
3433

3534
- name: Install & Register Gitlab Runner for Docker
3635
import_tasks: gitlab-runner.yml
37-
tags: gitlab_runner
36+
tags: runner
3837

3938
- name: Congratulations!
4039
debug:

0 commit comments

Comments
 (0)