Skip to content

manytask/infrastructure

Repository files navigation

Manytask infrastructure setup with Ansible

Overview

This repository contains Ansible playbooks to setup a Manytask infrastructure.
All, one or several of the following services can be installed:

  • GitLab server - setup self-hosted GitLab instance \w docker registry, etc.
  • Web server - setup server to host the Manytask web application in a docker.
  • GitLab Runner - setup self-hosted GitLab CI runner(s) to run CI/CD jobs from self-hosted GitLab server (for students' jobs).
  • GitHub Runner - setup self-hosted GitHub Actions runner(s) to run CI/CD jobs from github.com (for private repos).

Note: GitLab and GitHub runners can be installed on the same server.

Prerequisites

  • Debian-based OS on target machine (for GitLab instance and its runners).
  • Ansible installed on your control machine.
    # Optional: Create a virtual environment
    python -m venv .venv
    source .venv/bin/activate
    # Install Ansible
    python -m pip install -r requirements.txt
  • Load all ansible roles required for the playbooks:
    ansible-galaxy install -r requirements.yml
  • SSH access to all the servers you want to manage with Sudo privileges.

Setup

  1. Edit the inventory.ini file to match your infrastructure.
  2. Edit the vars/main.yml file to match your infrastructure.
  • For github runner, you need to provide a github-runner registration token. You can find it in your github repository settings. Repo -> Settings -> Actions -> Runners -> New self-hosted runner -> Copy the registration token.
  • For GitLab runner, you need to provide password for root account.
  • You need hostname associated with your GitLab instance IP.
  1. Run the playbooks you want:
ansible-playbook -i inventory.ini playbooks/gitlab.yml
ansible-playbook -i inventory.ini playbooks/web.yml
ansible-playbook -i inventory.ini playbooks/github_runner.yml
ansible-playbook -i inventory.ini playbooks/gitlab_runner.yml
  1. If you want to use Google Cloud Platform for installation, you need to follow instruction in GCP guide.

Development

  1. Install Ansible in a virtual environment:
python -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
  1. Make changes to the playbooks.

  2. Validate playbooks syntax:

ansible-playbook --syntax-check -i inventory.ini playbooks/TODO.yml
  1. Lint playbooks:
yamllint .
ansible-lint
  1. Make PR - the github actions pipeline will be executed automatically to check linting, run playbooks and check idempotency.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages