Skip to content
This repository was archived by the owner on Oct 7, 2025. It is now read-only.

Infrastructure repository

Greg Harvey edited this page Jan 14, 2025 · 11 revisions

The way we usually manage "infrastructures", which are logically separate sets of servers and services with a cloud or hosting provider, is by keeping playbooks and variables unique to the elements of that infrastructure in its own Git repository, typically on the controller server.

Create an infra repo

Firstly, we need to create the new repository on our GitLab server:

  1. In a web browser go to your GitLab installation, for example https://gitlab.controller.acme.com/, and login - instructions here, step 3
  2. Click on Groups on the left menu
  3. Click the New group button on the right, then Create group
    • we recommend you name it Infras and leave it private - this is where we will store our "infra" repositories
  4. On the next page click New project -> Create a blank project
    • we recommend you name it something sensible and recognisable, beginning with infra, leave it private and do not create a README
    • for this example we will use infra-main-website

At this point you should have a new repository at https://gitlab.controller.acme.com/infras/infra-main-website (obviously with your controller server URL, not our example one).

Seed your infra repository.

We have a template repository for an AWS account. To use it:

  1. Still in GitLab, as stated in the README for the template, create a global environment variable called ENV in Admin -> Settings -> CI/CD -> Variables
  2. Go to our templates repository, click the green Code button and click Download ZIP
  3. Create a folder on your computer where you want to keep your repository and copy the contents of the extracted NETWORK folder into it
    • Be sure to get all the hidden files!
    • You can delete README.md if you wish
  4. As stated in the README for the template, find and replace all instances of these strings:
    • SHORTNAME - your infrastructure name
    • CIDR_BASE - your VPC CIDR base for IPv4 addressing

Example:

# do this within your infra repo folder
find ./ -type f -exec sed -i -e 's/SHORTNAME/main-website/g' {} \;
find ./ -type f -exec sed -i -e 's/CIDR_BASE/10.0/g' {} \;
  1. Back in GitLab, add an SSH key by clicking the Add SSH key button in the banner, if you have not already done so
  2. On your project page, follow the Push an existing folder instructions on your project front page, but use the branch name apply

Create a GitLab runner

Before we can orchestrate any builds on our server we need to create a runner.

TODO - move this

Your options are pretty limitless, so we will focus on two main areas:

  • How to build your first remote server using ce-provision
  • How to configure ce-provision to manage your AWS account(s)

Configuring the controller to build itself

TODO

Building your first server

TODO

Configuring the controller to orchestrate AWS with Ansible

TODO

Clone this wiki locally