Skip to content

Conditional execution of dotbot directive based on the system hostname

License

Notifications You must be signed in to change notification settings

johnlettman/dotbot-ifhostname

Repository files navigation

Dotbot Hostname Conditional Plugin
dotbot-ifhostname

License Programming Language CI Results Code Coverage

A plugin for conditional execution of Dotbot directives based on the hostname of the machine.

Inspired by dotbot-if and dotbot-ifplatform.

Prerequisites

This is a plugin for Dotbot, requiring it to be available.

Installation

  1. Add dotbot-ifhostname as a submodule to your dotfiles repository:
git submodule add https://github.com/johnlettman/dotbot-ifhostname.git
  1. Pass the CLI argument --plugin-dir path/to/dotbot-ifhostname when executing the dotbot command.

Usage

Add the ifhostname directive to the Dotbot YAML configuration file to conditionally execute the directives:

- ifhostname:
  hostname: computer-a
  met:
  - shell:
    - echo on computer A!

- ifhostname:
  hostname: computer-b
  met:
  - shell:
    - echo on computer B!
  unmet:
  - shell:
    - echo this isn't computer B!

Details

The following configuration options are available for the ifhostname directive:

Option Required Description
hostname Yes The hostname to match against.
met No Directives to execute when the hostname matches.
unmet No Directives to execute when the hostname does not match.

About

Conditional execution of dotbot directive based on the system hostname

Topics

Resources

License

Stars

Watchers

Forks