Infrahub by OpsMill acts as a central hub to manage the data, templates and playbooks that powers your infrastructure. At its heart, Infrahub is built on 3 fundamental pillars:
- A Flexible Schema: A model of the infrastructure and the relation between the objects in the model, that's easily extensible.
- Version Control: Natively integrated into the graph database which opens up some new capabilities like branching, diffing, and merging data directly in the database.
- Unified Storage: By combining a graph database and git, Infrahub stores data and code needed to manage the infrastructure.
This repository is demoing the key Infrahub features for an example with servers, Load Balancer and VIP. Infrahub generates configurations that ansible deploys.
You can run this demo on your pc using docker, or using Github Codespaces.
export INFRAHUB_ADDRESS="http://localhost:8000"
export INFRAHUB_API_TOKEN="06438eb2-8019-4776-878c-0941b1f1d1ec"
poetry install --no-interaction --no-ansi --no-root
poetry run invoke start
This will create :
- Basics data (Account, Organization, ASN, and Tags)
- Locations data (Locations, and Prefixes)
- Servers data (VIP, Frontend and Load Balancers)
- Resource Managers (Prefix, IP and Number pools)
poetry run invoke load-schema load-data
Note
Reference the Infrahub documentation for the multiple ways this can be done.
mutation AddCredential {
CorePasswordCredentialCreate(
data: {
name: {value: "my-git-credential"},
username: {value: "<GITHUB_USERNAME>"},
password: {value: "<GITHUB_TOKEN>"}
}
) {
ok
object {
hfid
}
}
}
mutation AddRepository{
CoreRepositoryCreate(
data: {
name: { value: "infrahub-demo-vip-and-lb" }
location: { value: "https://github.com/GITHUB_USER/infrahub-demo-vip-and-lb.git" }
# The HFID return from the previous mutation. Will be the name of the credentials
credential: { hfid: "my-git-credential" }
}
) {
ok
object {
id
}
}
}