Skip to content

Ephemeral lab instance

Use case: stand up a heavily customized, disposable test instance with the widest possible settings surface — including Rails-only settings that have no API — and keep going when a particular setting cannot land. The all preset adds the Rails transport (here running gitlab-rails inside a Kubernetes toolbox pod), and compatible mode records a structured skip and continues instead of failing the run.

ansible-playbook -i localhost, examples/lab-ephemeral.yml

Source: examples/lab-ephemeral.yml

---
# Use case: stand up a heavily-customized ephemeral test instance.
# Wants maximum surface (including Rails-only settings) and to keep going even
# when a setting cannot be applied — so it uses the `all` preset and
# `compatible` mode (record a skip and continue, rather than fail the run).
#
#   ansible-playbook -i localhost, examples/lab-ephemeral.yml
#
# Here the Rails transport runs gitlab-rails inside a Kubernetes toolbox pod
# instead of over SSH.
- name: Provision ephemeral lab instance settings
  hosts: localhost
  gather_facts: false
  connection: local
  vars:
    gitlab_settings_target:
      url: https://gitlab.lab.example.com
      auth:
        type: personal_access_token
        token: "{{ vault_lab_admin_token }}"
      rails_strategy: kubernetes_toolbox
      kubernetes:
        namespace: gitlab
        context: lab-cluster
        toolbox_selector: app=toolbox,release=gitlab
    gitlab_settings_backend: all
    # Starting a lab must not require perfection: unappliable settings skip and
    # are reported, and the whole run still succeeds.
    gitlab_settings_mode: compatible
    # Persist the coverage manifest (which transport served each op, or why it
    # skipped) for review.
    gitlab_settings_output_file: /tmp/gitlab-lab-result.json
  tasks:
    - name: Apply the full lab configuration
      ansible.builtin.include_role:
        name: primetheus.gitlab_settings
        tasks_from: apply
      vars:
        gitlab_settings_instance:
          application:
            account:
              signup_enabled: true
            defaults:
              default_project_visibility: internal
        gitlab_settings_groups:
          - path: lab
            saml_provider:
              enabled: false
            work_item_types:
              - name: Experiment
                icon_name: rocket