Contents

Ansible template for automated GitLab server setup in Docker container

 

  • What will you get?
    • Fully working ansible docker system that’s being setted up within 2-3 minutes.

Requirements:

Before you will start working with this ansible template you need to make sure that you have all of the listed things below:

– A server with Ubuntu 16.04 Xenial installed. 2Gb RAM is recommended minimum for GitLab.

– Ansible 2.3 installed on your local machine.

– Public ssh key to connect to the server.

– Installed and configured Docker. Below you can see a simple command for Docker service setup:

– Python-minimal installed on the target server. Command to setup:

– Custom SSH port on the server, as port 22 will be exposed outside. Command to configure:

– DNS records for GitLab and Registry:

Step 1: Preparation to playbook launch

Before the playbook launch with the ansible role of GitLab setup, we need to prepare the variables and develop the playbook itself. Let’s create directory and necessary files on your local machine:

Playbook:

Config file:

Host file:

Requirements requirements.yml:

Step 2: Execution of the playbook

To start we need to setup dependencies:

After that we can proceed directly to the launch:

Password change is required after that:

GitLab Community edition screenshot

We login in GitLab using credentials:

user : root

password: the one you’ve set up before.

WOOHOO! You’re in!

Welcome to GitLab page screenshot

 

Moreover, if you’re curious about how to use Docker you can refer to our guide about top docker commands. It will help you gain confidence in using all the docker commands. Use this article as a how-to guide to practice regularly and docker commands will become second nature to you.

The Author

Pavel Konobeyev

Tags

automation
automation server
Continuous Delivery
Continuous Integration
DevOp
Docker
server