Skip to content

Commit abc23ef

Browse files
committed
feat(gitlab_runner): init project
0 parents  commit abc23ef

File tree

13 files changed

+661
-0
lines changed

13 files changed

+661
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.vagrant/*
2+
ubuntu-xenial-16.04-cloudimg-console.log

LICENCE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
MIT License
2+
3+
Copyright (c) 2018 wikitops
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Ansible : Playbook Gitlab Runner
2+
3+
The aim of this project is to deploy a simple Gitlab Runner instance on Vagrant.
4+
5+
## Getting Started
6+
7+
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
8+
9+
### Prerequisites
10+
11+
What things you need to run this Ansible playbook :
12+
13+
* [Vagrant](https://www.vagrantup.com/docs/installation/) must be installed on your computer
14+
* Update the Vagrant file based on your computer (CPU, memory), if needed
15+
* You must have download the ubuntu Xenial64 vagrant box :
16+
17+
```
18+
vagrant box add https://app.vagrantup.com/ubuntu/boxes/xenial64
19+
```
20+
* If you want to register the Gitlab Runner, you have to get a token from your Gitlab server and configure it in the playbook file
21+
22+
### Usage
23+
24+
A good point with Vagrant is that you can create, update and destroy all architecture easily with some commands.
25+
26+
Be aware that you need to be in the Vagrant directory to be able to run the commands.
27+
28+
#### Build Environment
29+
30+
Vagrant needs to init the project to run and build it :
31+
32+
```
33+
vagrant up
34+
```
35+
36+
After build, you can check which virtual machine Vagrant has created :
37+
38+
```
39+
vagrant status
40+
```
41+
42+
If all run like it is expected, you should see something like this :
43+
44+
```
45+
$ vagrant status
46+
47+
Current machine states:
48+
49+
runner01 running (virtualbox)
50+
```
51+
52+
#### Deployment
53+
54+
To deploy the Gitlab Runner instance, you just have to run the Ansible playbook gitlab-runner.yml with this command :
55+
56+
```
57+
ansible-playbook gitlab-runner.yml
58+
```
59+
60+
If everything run as expected, the runner should be register on your Gitlab server.
61+
62+
#### Destroy
63+
64+
To destroy on what Vagrant has created, just run this command :
65+
66+
```
67+
vagrant destroy
68+
```
69+
70+
## Author
71+
72+
Member of Wikitops : https://www.wikitops.io/
73+
74+
## Licence
75+
76+
This project is licensed under the Apache License, Version 2.0. For the full text of the license, see the LICENSE file.

Vagrantfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
Vagrant.configure("2") do |config|
5+
6+
config.vm.box = "ubuntu/xenial64"
7+
8+
# Gitlab Runner
9+
(1..1).each do |i|
10+
config.vm.provider "virtualbox" do |vb|
11+
vb.memory = 2048
12+
vb.cpus = 2
13+
end
14+
15+
config.vm.define "runner0#{i}" do |master|
16+
master.vm.hostname = "runner0#{i}"
17+
master.vm.network "private_network", ip: "10.0.4.3#{i}"
18+
end
19+
end
20+
21+
# Provision
22+
config.vm.provision "shell", path: "provision.sh"
23+
config.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "/home/vagrant/.ssh/authorized_keys"
24+
25+
end

0 commit comments

Comments
 (0)