Skip to content

Ansible role to automate the installation and configuration of Gitlab

License

Notifications You must be signed in to change notification settings

matthiasdeblock/gitlab-role

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gitlab Role

An Ansible role to automate the installation and configuration of Gitlab on CentOS6/7.

Requirements

None

Variables

gitlab_version: 10.3.2

gitlab_gpg_key: https://packages.gitlab.com/gpg.key
gitlab_repo_url: 'https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/config_file.repo?os={{ ansible_distribution }}&dist={{ ansible_distribution_major_version }}'
gitlab_api_root: api/v4

Gitlab API and Access Tokens

Open Issue: Ability to manage Personal Access Tokens through the API

The only way to generate Personal Access Tokens is through the web UI. As such, there is no way to automate the private token necessary to use the API to create projects and configure user ssh keys.

Ok, thanks to a comment from Elvis Stansvik gitlab-rails runner can be used to generate a private token that can be used to automate calls to the Gitlab API. The role will revoke this private token at the end of the role play.

Note that his token is set to revoke after a day, should the playbook fail before this task is ran.

Of course, relying on gitlab-rails runner is SLOW....

Example Playbooks

- hosts: all
  roles:
    - { role: gitlab-role }

Testing

The Vagrantfile can be used to provision a default CentOS7 install using the ansible role

vagrant up

The Gitlab install is accessible at http://127.0.0.1:8000

Alternatively, you can use vagrant to provision the VM and ansible to provision the role

vagrant up --no-provision
ansible-playbook --inventory inventory \
                 --user vagrant \
                 --private-key /home/${USER}/.vagrant.d/insecure_private_key \
                 playbook.yml

You will have to create an inventory file and configure Virtualbox Networking for a local ansible-playbook to access and provision the guest VM...

License

The MIT License (MIT)

Copyright (c) 2018 Brydon Cheyney

About

Ansible role to automate the installation and configuration of Gitlab

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published