Skip to main content

The Infrahub Installation Role in the OpsMill Infrahub Ansible Collection allows you to install and configure Infrahub using Docker and systemd.

Overview

This role automates the installation and configuration of Infrahub by:

  • Setting up the required directory structure
  • Configuring Docker Compose
  • Installing and configuring systemd services
  • Managing Infrahub configuration

Requirements

This role requires:

  • Docker Engine with Docker Compose v2 to be installed
  • Root or sudo access for systemd service installation (on the target server)

Role variables

VariableTypeDefaultDescription
install_infrahub_versionstrVersion of Infrahub to install. Can be any Docker image tag name.
install_infrahub_urlstrhttps://infrahub.opsmill.ioURL from where to fetch the Infrahub docker-compose file.
install_infrahub_install_directorystr/opt/infrahubInstall directory for the Infrahub files (docker-compose and configuration file).
install_infrahub_configdictEnvironment variables to pass as configuration for Infrahub.
install_infrahub_docker_projectstrinfrahubDocker project name to use when starting Infrahub.
install_infrahub_docker_pull_imagesbooltrueWhether to pull the required Docker images.
install_infrahub_setup_systemdbooltrueWhether to install the systemd service for Infrahub.
install_infrahub_systemd_directorystr/etc/systemd/system/Where to install the systemd service unit file.
install_infrahub_systemd_service_statestrrestartedTarget state of the systemd service. Can be used to avoid starting Infrahub during the role's execution.

Installation example

For a basic installation with default settings:

install_infrahub_minimal.yml
- name: Install Infrahub
hosts: infrahub_servers
become: true

roles:
- role: opsmill.infrahub.install
vars:
install_infrahub_version: "latest"

Usage

To install Infrahub, use:

ansible-playbook install_infrahub.yml -i inventory.yml