### Example Docker Installation Command Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/admin/lifecycle/install/install-docker.md This example demonstrates how to install DRP as a container, specifying a custom restart policy, network namespace, and an environment variable to change the metrics port. ```bash ./install.sh install --container --container-restart=always --container-netns=host --container-env="RS_METRICS_PORT=8888" ``` -------------------------------- ### Install DRP with Default Settings Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/admin/lifecycle/install/install-sh.md Fetches and executes the install.sh script to install DRP with default settings. This is the simplest way to get started. ```bash curl -fsSL get.rebar.digital/stable | bash -s -- install --bootstrap --universal ``` -------------------------------- ### Setup Golang and Build Tools Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/developers/plugins/plugin.md Installs Git, sets up the Go workspace, downloads and extracts the Go binary, and configures environment variables for Go development. ```shell sudo yum -y install git mkdir $HOME/go wget https://dl.google.com/go/go1.23.2.linux-amd64.tar.gz tar -xzvf go1.23.2.linux-amd64.tar.gz sudo mv go /usr/local/ export GOROOT=/usr/local/go export GOPATH=$HOME/go export PATH=$GOPATH/bin:$GOROOT/bin:$PATH ``` -------------------------------- ### Example Workflow Chain Map for Linux Installations Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/operators/provisioning/os/universal_linux_provision.md This example demonstrates a typical workflow chain map configuration for Linux installations. It defines the sequence of workflows a machine will traverse during the installation process. ```shell # Example workflow chain map for Linux Installations linux-install: universal-discover: universal-hardware universal-hardware: universal-burnin universal-burnin: universal-linux-install universal-linux-install: universal-runbook # the below are NOT installable Workflows, they are included here # for completeness sake of the chain maps full set of values universal-start: universal-runbook universal-maintenance: universal-discover universal-rebuild: universal-discover ``` -------------------------------- ### Install Plugin Provider from Catalog Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/developers/plugins/index.md Installs a plugin provider from the RackN catalog, downloading the necessary binary. For example, installing the 'callback' plugin. ```bash # Install a plugin provider (downloads the binary) drpcli catalog install callback ``` -------------------------------- ### Complete Bash Task Example Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/developers/automation/tasks/bash-tasks.md A comprehensive example of a bash task YAML, demonstrating best practices for installation, configuration, idempotency, and success reporting. ```yaml --- Name: "example-configure-service" Description: "Install and configure an example service" Documentation: | Installs the example-svc package and configures it based on DRP parameters. Idempotent: skips installation if already present. Requires the `example/config-url` parameter to be set. RequiredParams: - example/config-url OptionalParams: - example/service-port # Defined with default: 8080 - rs-debug-enable Meta: icon: "cogs" color: "blue" title: "Example Content" feature-flags: "sane-exit-codes" Templates: - Name: "example-configure-service.sh" Meta: OS: "linux" Contents: | #!/usr/bin/env bash {{ template "prelude.tmpl" . }} CONFIG_URL="{{ .Param "example/config-url" }}" # example/service-port has a default of 8080 in its param definition, # so no ParamExists check is needed here. PORT="{{ .Param "example/service-port" }}" # Idempotency check if command -v example-svc &>/dev/null; then job_info "example-svc already installed, checking config..." else job_info "Installing example-svc..." install example-svc fi # Configure the service job_info "Configuring example-svc with URL=$CONFIG_URL port=$PORT" cat > /etc/example-svc/config.yaml < os: [] installSource: true securitySource: true url: http://:8091//install/ ``` -------------------------------- ### Example URL for CentOS/RedHat Kickstart Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/resources/kb/kb-00031.md This is an example URL to render the 'compute.ks' file for CentOS or RedHat systems. ```http http://10.10.10.10:8091/machines/7f65279a-7e5c-4e69-af40-dd01af4c5667/compute.ks ``` -------------------------------- ### Quick Install Command Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/admin/lifecycle/install/install.md This command downloads and executes the install.sh script for a universal installation. ```bash curl -fsSL get.rebar.digital/stable | bash -s -- install --universal ``` -------------------------------- ### Install Packages Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/developers/automation/tasks/bash-tasks.md Install multiple packages using the prelude's cross-distro installer. ```bash install curl wget jq ``` -------------------------------- ### Create Symbolic Links for drpcli Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/developers/cli/usage.md This example shows how to create symbolic links for the drpcli binary, assuming an isolated install mode. Ensure the binaries are in your PATH. ```shell ln -s $HOME/bin/linux/amd64/dr-provision $HOME/bin/ ln -s $HOME/bin/linux/amd64/drpcli $HOME/bin/ ``` -------------------------------- ### Get API Info with User Security Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/developers/api/dev-curl.md This example demonstrates how to authenticate and retrieve API information using basic username and password security. ```shell curl --user rocketskates:r0cketsk8ts --insecure https//[endpoint url]/api/v3/info ``` -------------------------------- ### Expand Install Repositories Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/resources/models/content/repo.md Use this snippet to expand repositories for OS installation. It iterates through the InstallRepos context. ```go-template {{range $repo := .InstallRepos}}{{$repo.Install}}{{end}} ``` -------------------------------- ### Install azkeyvault Plugin Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/admin/secrets/azure.md Installs the azkeyvault plugin from the DRP catalog. ```bash drpcli catalog item install azkeyvault ``` -------------------------------- ### Install createrepo Tool Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/operators/provisioning/hardware/hw-repo.md Installs the `createrepo` utility required for building RPM repositories on a Linux system. ```bash yum install createrepo -y ``` -------------------------------- ### Example Script Call Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/developers/cli/basic-scripting.md Demonstrates how to execute the complete provisioning script, including setting the RS_TOKEN environment variable. ```bash RS_TOKEN=$(drpcli users token rocketskates ttl 7200 | jq -r .Token) \ ./provision.sh ubuntu-22-04-install ``` -------------------------------- ### Example Usage of VM Creation Script Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/admin/lifecycle/environments/kvm.md Demonstrates how to execute the create-vm.sh script to provision a KVM virtual machine with a specific name. ```bash $HOME/create-vm.sh vm-test-01 ``` -------------------------------- ### Dynamic Boot File Selection using Golang Templates Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/resources/models/networking/subnet.md This example demonstrates how to dynamically select a boot file based on DHCP request options using Golang templates. It checks for specific option types (77 and 93) to determine whether to serve an iPXE, legacy BIOS, or UEFI boot image. ```go {{if (eq (index . 77) "iPXE") }}default.ipxe{{else if (eq (index . 93) "0") }}ipxe.pxe{{else}}ipxe.efi{{end}} ``` -------------------------------- ### Example URL for Ubuntu 20.04+ Autoinstall User Data Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/resources/kb/kb-00031.md This is an example URL to render the 'user-data' file for Ubuntu 20.04 and newer systems using autoinstall. ```http http://10.10.10.10:8091/machines/7f65279a-7e5c-4e69-af40-dd01af4c5667/autoinstall/user-data ``` -------------------------------- ### Create Test Machine and Run Workflow Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/resources/kb/kb-00080.md Create a Machine with the specified context and run the 'hello-world' workflow from the 'dev-library' content pack to test the context container. ```bash ### assumes CTX is still set in the environment to the name of the context (eg 'govc') # create a Machine backed by the new Context: drpcli machines create '{ "Name": "'$CTX'-test", "Meta": { "BaseContext": "'$CTX'" } }' # install the 'dev-library' content if not installed already drpcli catalog item install dev-library # set the new Machine to run the 'hello-world' workflow drpcli machines workflow Name:$CTX-test hello-world ``` -------------------------------- ### Expected `oc get nodes` Output Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/operators/provisioning/application/openshift/openshift-deploy-tutorial.md Example output for the `oc get nodes` command on a 3+3 cluster, showing the status, roles, age, and version of each node. ```text NAME STATUS ROLES AGE VERSION cp-machine-1 Ready control-plane,master 71m v1.34.2 cp-machine-2 Ready control-plane,master 71m v1.34.2 cp-machine-3 Ready control-plane,master 43m v1.34.2 worker-machine-1 Ready worker 44m v1.34.2 worker-machine-2 Ready worker 44m v1.34.2 worker-machine-3 Ready worker 45m v1.34.2 ``` -------------------------------- ### Start drpcli Agent Service Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/resources/kb/kb-00077.md Starts the drpcli agent service using the installed configuration. Ensure the Machine Object is correctly configured in the DRP Endpoint to avoid unintended workflows. ```bash sudo drpcli agent start ``` -------------------------------- ### Install Ubuntu WSL Instance Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/admin/lifecycle/environments/hyper-v-simple.md Install a new WSL instance running Ubuntu. Follow the prompts to create your user account. ```sh wsl --install -d ubuntu ``` -------------------------------- ### Install Digital Rebar with Terraform Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/admin/lifecycle/install/install-cloud.md This example shows how to download a cloud-specific Terraform plan and apply it to provision and install Digital Rebar. It demonstrates overriding default username and password variables. ```bash # replace with the cloud provider TF file from above curl -o main.tf https://gitlab.com/rackn/provision/-/raw/v4/integrations/terraform/aws.tf terraform init terraform apply -var="drp_username=rackn" -var="drp_password=myHardP4ssword" ``` ```bash terraform apply -var="drp_username=rackn" -var="drp_password=myHardP4ssword" ``` -------------------------------- ### Development Install Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/admin/lifecycle/install/install-sh.md Suitable for local development or lab environments. Note that the 'tip' version is for active development and not production-ready. ```bash curl -fsSL get.rebar.digital/stable | bash -s -- install \ --bootstrap \ --universal \ --startup ``` -------------------------------- ### Kickstart Template for Package Repositories Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/operators/provisioning/os/os-configuration.md This Go template example shows how to dynamically configure package repositories in a kickstart template by iterating over machine parameters. ```go # In a kickstart template {{range .Param "package-repositories" -}} repo --name="{{.Tag}}" --baseurl="{{.URL}}" {{if .GPGKey}}--gpgkey="{{.GPGKey}}"{{end}} {{end}} ``` -------------------------------- ### Install vm-bridge.sh Script Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/admin/lifecycle/environments/kvm.md Installs the vm-bridge.sh script, which configures DRP Endpoint as a router and NAT Masquerading host for VMs. Ensure equivalent setup if using other firewall services like firewalld. ```bash curl -fsSL https://raw.githubusercontent.com/digitalrebar/provision/v4/tools/vm-bridge.sh -o install.sh | bash -s -- ``` -------------------------------- ### Setting Up Local Repository and Branch Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/resources/kb/kb-00047.md This snippet covers the initial steps of cloning the repository, setting up upstream remote, and creating a new feature branch for your contributions. ```bash mkdir digitalrebar && cd digitalrebar git clone https://github.com/##YOUR GH USERNAME##/provision.git cd provision git remote add upstream https://gitlab.com/rackn/provision.git git checkout -b kb-interesting-thing ``` -------------------------------- ### Example Content Package Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/resources/models/system/content.md This YAML defines a basic content package named 'BasicStore' with boot environments for both unknown and known machines, including PXELinux and iPXE templates. ```yaml --- meta: Author: "" CodeSource: "" Color: "" Copyright: "" Description: Default objects that must be present DisplayName: "" DocUrl: "" Documentation: "" Icon: "" License: "" Name: BasicStore Order: "" Overwritable: true Prerequisites: "" RequiredFeatures: "" Source: "" Tags: "" Type: basic Version: 3.12.0 Writable: false sections: bootenvs: ignore: Available: false BootParams: "" Bundle: BasicStore Description: The boot environment you should use to have unknown machines boot off their local hard drive Documentation: "" Endpoint: "" Errors: [] Initrds: [] Kernel: "" Meta: color: green feature-flags: change-stage-v2 icon: circle thin title: Digital Rebar Provision Name: ignore OS: Codename: "" Family: "" IsoFile: "" IsoSha256: "" IsoUrl: "" Name: ignore SupportedArchitectures: {} Version: "" OnlyUnknown: true OptionalParams: [] ReadOnly: false RequiredParams: [] Templates: - Contents: | DEFAULT local PROMPT 0 TIMEOUT 10 LABEL local {{.Param "pxelinux-local-boot"}} ID: "" Meta: null Name: pxelinux Path: pxelinux.cfg/default - Contents: | #!ipxe chain {{.ProvisionerURL}}/${netX/mac}.ipxe && exit || goto chainip :chainip chain tftp://{{.ProvisionerAddress}}/${netX/ip}.ipxe || exit ID: "" Meta: null Name: ipxe Path: default.ipxe Validated: false local: Available: false BootParams: "" Bundle: BasicStore Description: The boot environment you should use to have known machines boot off their local hard drive Documentation: "" Endpoint: "" Errors: [] Initrds: [] Kernel: "" Meta: color: green feature-flags: change-stage-v2 icon: radio title: Digital Rebar Provision Name: local OS: Codename: "" Family: "" IsoFile: "" IsoSha256: "" IsoUrl: "" Name: local SupportedArchitectures: {} Version: "" OnlyUnknown: false OptionalParams: [] ReadOnly: false RequiredParams: [] Templates: - Contents: | DEFAULT local PROMPT 0 TIMEOUT 10 LABEL local {{.Param "pxelinux-local-boot"}} ID: "" Meta: null Name: pxelinux Path: pxelinux.cfg/{{.Machine.HexAddress}} - Contents: | #!ipxe exit ID: "" Meta: null Name: ipxe Path: '{{.Machine.Address}}.ipxe' - Contents: | DEFAULT local PROMPT 0 TIMEOUT 10 LABEL local {{.Param "pxelinux-local-boot"}} ID: "" Meta: null Name: pxelinux-mac Path: pxelinux.cfg/{{.Machine.MacAddr "pxelinux"}} - Contents: | #!ipxe exit ID: "" Meta: null Name: ipxe-mac Path: '{{.Machine.MacAddr "ipxe"}}.ipxe' Validated: false params: pxelinux-local-boot: Available: false Bundle: BasicStore Description: The method pxelinux should use to try to boot to the local disk Documentation: |2- ``` -------------------------------- ### Example DRP Dynamic Inventory JSON Output Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/developers/integrations/ansible.md An example of the JSON output generated by the DRP dynamic inventory script for a K3s install in AWS. Note that this output format may differ from standard Ansible documentation. ```json { "node": { "hosts": [ "ip-172-31-28-34.us-west-2.compute.internal", "ip-172-31-30-174.us-west-2.compute.internal" ], "vars": {} }, "all": { "hosts": [ "ip-172-31-28-34.us-west-2.compute.internal", "ip-172-31-22-153.us-west-2.compute.internal", "ip-172-31-30-174.us-west-2.compute.internal" ] }, "_meta": { "rebar_profile": "all_machines", "rebar_user": "rocketskates", "hostvars": { "ip-172-31-30-174.us-west-2.compute.internal": { "cloud/public-ipv4": "18.236.144.191", "cloud/provider": "AWS", "detected-bios-mode": "legacy-bios", "rebar_uuid": "9646b873-0ecf-4cbe-94eb-c1deb2e20167", "ansible_user": "centos", "cloud/placement/availability-zone": "us-west-2b", "cloud/public-hostname": "ec2-18-236-144-191.us-west-2.compute.amazonaws.com", "cloud/instance-type": "t2.xlarge", "cloud/instance-id": "i-0c0ef4821c536246f", "ansible_host": "18.236.144.191" }, "ip-172-31-28-34.us-west-2.compute.internal": { "cloud/public-ipv4": "34.222.134.226", "cloud/provider": "AWS", "detected-bios-mode": "legacy-bios", "rebar_uuid": "245468dc-b61b-471d-ac90-127165a51cb3", "ansible_user": "centos", "cloud/placement/availability-zone": "us-west-2b", "cloud/public-hostname": "ec2-34-222-134-226.us-west-2.compute.amazonaws.com", "cloud/instance-type": "t2.xlarge", "cloud/instance-id": "i-040fd5ebdcc3908b3", "ansible_host": "34.222.134.226" }, "ip-172-31-22-153.us-west-2.compute.internal": { "cloud/public-ipv4": "34.221.97.235", "cloud/provider": "AWS", "detected-bios-mode": "legacy-bios", "rebar_uuid": "5556adcf-46d4-41e4-9e6c-c379f5edb743", "ansible_user": "centos", "cloud/placement/availability-zone": "us-west-2b", "cloud/public-hostname": "ec2-34-221-97-235.us-west-2.compute.amazonaws.com", "cloud/instance-type": "t2.xlarge", "cloud/instance-id": "i-01db8e5ccc14d98c0", "ansible_host": "34.221.97.235" } }, "rebar_url": "https://34.222.216.7:8092" }, "k3s-cluster": { "hosts": [], "children": [ "master", "node" ], "vars": {} }, "master": { "hosts": [ "ip-172-31-22-153.us-west-2.compute.internal" ], "vars": {} } } ``` -------------------------------- ### Deploy ACM to OpenShift Cluster Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/operators/provisioning/application/openshift/advanced-features/acm.md Get the cluster UUID and create a work order to run the ACM installation blueprint. ```bash # Get cluster UUID CLUSTER_UUID=$(drpcli clusters show demo | jq -r .Uuid) # Create work order to run ACM installation blueprint drpcli clusters work_order on $CLUSTER_UUID drpcli clusters work_order add $CLUSTER_UUID openshift-cluster-acm-install ``` -------------------------------- ### Manage Libvirt Networks for DHCP Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/resources/kb/kb-00003.md Commands to install libvirt-client, list, edit, destroy, and start libvirt networks to remove DHCP conflicts. ```bash # if you don't have virsh, you'll need to install it sudo yum install -y libvirt-client # find the active networks (lkely default) sudo virsh net-list # in editor - remove all dhcp elements from section sudo virsh net-edit # remove the network sudo virsh net-destroy # reset the system sudo virsh net-start ``` -------------------------------- ### LVM and Partitioning Example for Rootfs Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/operators/provisioning/os/eikon.md Illustrates a detailed rootfs plan using LVM, including GPT partitioning, VFAT for EFI, XFS for boot and root, and swap. Use 'size: REST' to fill remaining space and 'ptype: LVM2_member' to assign partitions to LVM. ```yaml eikon/plan: disks: - name: disk1 path: /dev/sda ptable: gpt grub_device: true partitions: - name: part1 id: 1 ptype: vfat size: 1G fs: name: fs1 fstype: vfat mount: /boot/efi - name: part2 id: 2 ptype: xfs size: 1G fs: name: fs2 fstype: xfs mount: /boot - name: part3 id: 3 size: 17G ptype: LVM2_member vgs: - name: vg1 pvs: - part3 lvs: - name: lv1 size: 14G fs: name: fs3 fstype: xfs mount: / - name: lv2 size: 1G fs: name: fs5 fstype: swap images: - url: "{{ .ProvisionerURL }}/files/images/eikon/alma10.tar.zst" type: tar-zst checksum: ``` -------------------------------- ### Execute MTLS Setup Script Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/admin/auth/cert.md Demonstrates how to make the MTLS setup script executable and run it with the system's IP address and hostname as arguments. This initiates the certificate generation process. ```shell chmod +x setup-mtls.sh ./setup-mtls.sh 1.2.3.4 myhost.company.com ``` -------------------------------- ### Complete Python API Check Task Example Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/developers/automation/tasks/python-tasks.md This comprehensive example defines a DRP task that checks an external API endpoint using Python. It includes parameter passing, error handling, and storing results back into DRP. Ensure 'requests' library is installed. ```yaml --- Name: "example-python-api-check" Description: "Check an external API endpoint using Python" Documentation: | Validates connectivity to an external API endpoint and records the result as a machine parameter. RequiredParams: - example/api-endpoint OptionalParams: - example/api-timeout - rs-debug-enable Meta: icon: "python" color: "blue" title: "Example Content" feature-flags: "sane-exit-codes" Templates: - Name: "api-check.py" Path: "/tmp/api-check.py" Contents: | #!/usr/bin/env python3 import sys, os, json, subprocess endpoint = "{{ .Param "example/api-endpoint" }}" {{ if .ParamExists "example/api-timeout" }} timeout = {{ .Param "example/api-timeout" }} {{ else }} timeout = 30 {{ end }} try: import requests resp = requests.get(endpoint, timeout=timeout) resp.raise_for_status() print(f"INFO: API check passed: {resp.status_code}") # Store result back in DRP subprocess.run([ "drpcli", "machines", "set", os.environ["RS_UUID"], "param", "example/api-status", "to", json.dumps({"status": "ok", "code": resp.status_code}) ], check=True) sys.exit(0) except Exception as e: print(f"FATAL: API check failed: {e}") sys.exit(1) - Name: "example-python-api-check.sh" Meta: OS: "linux" Contents: | #!/usr/bin/env bash {{ template "prelude.tmpl" . }} install python3 python3-pip pip3 install requests 2>/dev/null || true python3 /tmp/api-check.py exit $? ``` -------------------------------- ### Install Digital Rebar with Cloud IP Detection Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/admin/lifecycle/install/install-cloud.md This script retrieves the public IPv4 address using cloud-specific metadata services and then installs the Digital Rebar 'tip' version. It's designed for AWS but includes commented-out examples for Google, Azure, and Digital Ocean. ```bash #!/usr/bin/env bash # AWS specific API call value=$(curl -sfL http://169.254.169.254/latest/meta-data/public-ipv4) # Google: value=$(curl -sfL -H "Metadata-Flavor: Google" http://metadata/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip) # Azure: value=$(curl -H Metadata:true --noproxy "*" "http://169.254.169.254/metadata/instance/network/interface/0/ipv4/ipAddress/0/publicIpAddress?api-version=2021-05-01&format=text") # Digital Ocean: value=$(curl -sfL http://169.254.169.254/metadata/v1/interfaces/public/0/ipv4/address) curl -fsSL get.rebar.digital/stable | sudo bash -s -- install --universal --version=tip --ipaddr=$value ``` -------------------------------- ### Create KVM VM with virt-install Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/admin/lifecycle/environments/kvm.md Use virt-install to create a KVM virtual machine with specified resources, disk, network, and graphics configuration. This example configures the VM for PXE boot. ```bash virt-install \ --name=winders --ram=4096 --cpu host --hvm --vcpus=2 \ --os-type=windows --os-variant=win10 \ --disk /var/lib/libvirt/images/winders.qcow2,size=80,bus=virtio \ --pxe --network bridge=kvm-test,model=virtio \ --graphics vnc,listen=127.0.0.1,password=foobar --check all=off & ``` -------------------------------- ### Create a Reservation with DHCP Options and Next Server Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/developers/cli/examples/reservation.md This command demonstrates creating a reservation with additional DHCP options and specifying the Next Server for booting. ```shell drpcli reservations create '{ "Addr": "1.1.1.5", "Token": "08:01:27:33:77:de", "Strategy": "MAC", "NextServer": "1.1.1.2", "Options": [ { "Code": 44, "Value": "1.1.1.1" } ] }' ``` -------------------------------- ### Initialize Production Profile Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/developers/cli/configuration.md Set up the initial configuration for a production environment by creating a `.drpclirc` file with specific settings. ```shell # Start by configuring your production environment cat > ~/.drpclirc << 'EOF' RS_ENDPOINT=https://prod-drp.example.com:8092 RS_USERNAME=admin RS_PASSWORD=prod_password RS_FORMAT=json EOF ``` -------------------------------- ### Custom Cloud-Init User-Data Preserving Agent Startup Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/operators/provisioning/os/eikon.md Example of a custom cloud-init user-data that includes the necessary command to start the DRP agent, along with a custom command. ```yaml cloud-init/user-data: | #cloud-config runcmd: - 'powershell -noexit -file /eikon-win-agent.ps1' - 'your-custom-command-here' ``` -------------------------------- ### Get DRP Service Version Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/resources/kb/kb-00088.md Use this command to retrieve the currently running DRP service version. This is useful for confirming successful upgrades or identifying the installed version. ```bash drpcli info get | jq -r '.version' ``` -------------------------------- ### Example: Bootstrap Initial Leader Node Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/admin/ha/configure.md This example demonstrates bootstrapping the initial leader node into a single-node cluster with specific HA configurations. Ensure the RS_ENDPOINT is correctly set for drpcli communication. ```bash drpcli system ha enroll https://192.168.1.10:8092 rocketskates r0cketsk8ts\ ConsensusAddr 192.168.1.10:8093\ VirtInterface ens34\ VirtInterfaceScript /usr/local/bin/drp_virt_interface.sh\ HaID drp_ha_test\ LoadBalanced false\ VirtAddr 192.168.1.100/24 ``` -------------------------------- ### Initialize and Run Plugin Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/developers/plugins/plugin.md This snippet shows the main function required to initialize and run a plugin using the plugin wrapper. It requires the plugin name, description, version, plugin provider model, and plugin implementation. ```go package main //go:generate sh -c "cd content ; drpcli contents bundle ../content.go" import ( "fmt" "os" "github.com/VictorLowther/jsonpatch2/utils" "gitlab.com/rackn/logger" "gitlab.com/rackn/provision/v4/api" "gitlab.com/rackn/provision/v4/models" "gitlab.com/rackn/provision/v4/plugin" ) func main() { plugin.InitApp("incrementer", "Increments a parameter on a machine", version, &def, &Plugin{}) err := plugin.App.Execute() if err != nil { os.Exit(1) } } ``` -------------------------------- ### Authenticate and Get API Info with Token Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/developers/api/dev-curl.md This snippet shows how to obtain an authentication token and then use it to query API information. Ensure you have jq installed for token parsing. ```shell export RS_TOKEN=$(./drpcli users token [username] | jq -r .Token) curl -H "Authorization: Bearer $RS_TOKEN" --insecure https//[endpoint url]/api/v3/info ``` -------------------------------- ### Get Webhook URL for a Trigger Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/resources/models/execution/trigger_provider.md Retrieves the webhook URL for a specific trigger instance. This is useful for configuring external services to send data to the trigger. Requires `jq` to be installed. ```bash drpcli triggers show my-trigger | jq -r '.Meta.URL' ``` -------------------------------- ### Get Detailed License Information Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/admin/licensing/index.md Retrieves detailed information about the installed license, including a list of features and their expiry dates. Use this to check feature validity and renewal warnings. ```bash drpcli system license get ``` -------------------------------- ### Example Upgrade Failure Error Messages Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/resources/kb/kb-00088.md These messages indicate that the DRP upgrade process failed because it could not write new binaries to the root-owned directory. This typically occurs when DRP is installed as a non-root user. ```text active node failed self upgrade: Error staging /var/lib/dr-provision/tftpboot/drp-upgrade/bin/linux/amd64/dr-provision: open /usr/local/bin/.dr-provision.new.part: permission denied Error staging /var/lib/dr-provision/tftpboot/drp-upgrade/bin/linux/amd64/drpcli: open /usr/local/bin/.drpcli.new.part: permission denied ``` -------------------------------- ### Get DRP Base Root and Working Directory from Systemd Service Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/resources/kb/kb-00088.md This command retrieves DRP environment variables, including the WorkingDirectory and RS_BASE_ROOT, from the systemd service unit. This is useful for determining the DRP home directory, especially on non-default installations. ```bash sudo systemctl cat dr-provision | grep -E 'WorkingDirectory|RS_BASE_ROOT' ``` -------------------------------- ### Example Agent Activity Log Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/resources/kb/kb-00077.md Shows an example of the expected output in the Machine Object's activity tab after the 'hello-world' workflow has executed successfully. ```text Command running >>>>>>>>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<<<<<<<<< Hello World - the date is: Fri Apr 22 16:10:08 PDT 2022 This machines name is: fuji The 'hello world' message has been set to: Hello World >>>>>>>>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<<<<<<<<< Command exited with status 0 ``` -------------------------------- ### Example Batch Object Configuration Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/operators/extensions/batch-operations.md This YAML defines a batch object for creating and managing batch operations. It specifies templates for setup, work order execution, and completion, filtering by cluster tags and defining iteration and filtering parameters for machines. ```yaml --- SetupWorkOrderTemplate: Blueprint: batch-run Filter: "cluster/tags=In(event-worker-pool)" Params: batch/iterator: "Uuid" batch/iterator-param: "scan/machine-uuid" batch/filter-type: machines batch/filter: "Params.scannable=Eq(true)" batch/limit: 10000 batch/order: sort=scan/last-scan-time WorkOrderTemplate: Blueprint: audit-scan-me-simple Filter: "cluster/tags=In(event-worker-pool)" PostWorkOrderTemplate: Blueprint: audit-complete-simple Filter: "cluster/tags=In(event-worker-pool)" ``` -------------------------------- ### Configure GitHub Webhook Trigger Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/resources/models/execution/trigger_provider.md Integrate with external services like GitHub using webhook providers. This example shows how to set up a trigger for GitHub push events to rebuild content. It includes steps to get the webhook URL and configure it in GitHub repository settings. ```bash # Get the webhook URL drpcli triggers show github-content-rebuild | jq -r '.Meta.URL' # Configure in GitHub repository settings: # Settings > Webhooks > Add webhook # Payload URL: https://drp-endpoint/api/v3/triggers/github-content-rebuild # Content type: application/json # Events: Push events ``` ```bash drpcli triggers create - <": "< ... redacted for brevity ... >" }, "Tasks": [ "stage:discover", "bootenv:sledgehammer", "enforce-sledgehammer", "set-machine-ip-in-sledgehammer", "reserve-dhcp-address", "ssh-access", "stage:universal-discover-start-callback", "callback-task", "stage:universal-discover-pre-flexiflow", "flexiflow-start", "flexiflow-stop", "stage:universal-discover", "universal-discover", "stage:raid-reset", "raid-reset", "stage:raid-enable-encryption", "raid-tools-install", "raid-enable-encryption", "stage:shred", "shred", "stage:raid-reset", "raid-reset", "stage:universal-discover-post-flexiflow", "flexiflow-start", "flexiflow-stop", "stage:universal-discover-classification", "classify-stage-list-start", "classify-stage-list-stop", "stage:universal-discover-post-validation", "validation-start", "validation-stop", "stage:universal-discover-complete-callback", "callback-task", "stage:universal-chain-workflow", "universal-chain-workflow", "stage:complete-nobootenv" ], "CurrentTask": -1, "RetryTaskAttempt": 0, "TaskErrorStacks": [], "Runnable": true, "Secret": "tQXvI8wWV2am27fq", "OS": "centos-8", "HardwareAddrs": [ "00:00:00:51:01:00", "3e:6a:da:eb:d8:76" ], "Workflow": "universal-discover", "Arch": "amd64", "Locked": false, "Context": "", "Fingerprint": { "SSNHash": "", "CSNHash": "", "CloudInstanceID": "", "SystemUUID": "", "MemoryIds": [] }, "Pool": "default", "PoolAllocated": false, "PoolStatus": "Free", "WorkflowComplete": false } ``` -------------------------------- ### Verify Plugin Provider Installation Source: https://gitlab.com/rackn/docs/-/blob/v4/core/src/developers/plugins/index.md Verifies that a plugin provider has been successfully installed by listing all installed providers. ```bash # Verify the provider is installed drpcli plugin_providers list | jq -r '.[].Name' ```