ALPHA: wire is a tool to deploy nixos systems wire.althaea.zone/
at stable 102 lines 1.9 kB view raw view rendered
1--- 2comment: true 3title: Target Nodes 4description: Tags, nodes, and how to target them with wire Tool. 5--- 6 7# Target Nodes 8 9{{ $frontmatter.description }} 10 11## Targeting Specific Nodes 12 13`wire apply --on` without an `@` prefix interprets as a literal node name. For 14example: 15 16```sh 17$ wire apply switch --on node-a,node-b 18``` 19 20Will switch-to-configuration on node a, and node b. 21 22## Reading from Stdin 23 24Passing `--on -` will read whitespace-separated nodes and tags from stdin. This 25can be combined with normal `--on` usage. 26 27For example: 28 29```sh 30$ echo "node-a node-b" | wire apply --on @other --on - 31``` 32 33Will apply on `node-a`, `node-b`, and all nodes with the tag `@other`. 34 35## Tag Basics 36 37Nodes can have _tags_, which allows you to easily target multiple, related 38nodes for deployment. 39 40```nix:line-numbers{9,13,17,21} [hive.nix] 41let 42 sources = import ./npins; 43 wire = import sources.wire; 44in wire.makeHive { 45 meta.nixpkgs = import sources.nixpkgs { }; 46 47 node-1 = { 48 # ... 49 deployment.tags = ["cloud"]; 50 }; 51 node-2 = { 52 # ... 53 deployment.tags = ["cloud", "virtual"]; 54 }; 55 node-3 = { 56 # ... 57 deployment.tags = ["on-prem"]; 58 }; 59 node-4 = { 60 # ... 61 deployment.tags = ["virtual"]; 62 }; 63 node-5 = { 64 # Untagged 65 }; 66} 67``` 68 69To target all nodes with a specific tag, prefix tags with an `@`. 70For example, to deploy only nodes with the `cloud` tag, use 71 72```sh 73$ wire apply --on @cloud 74``` 75 76## Further Examples 77 78::: info 79 80Other operations such as an `--ignore` argument are unimplemented as of wire `v0.2.0`. 81 82::: 83 84### Mixing Tags with Node Names 85 86You can mix tags and node names with `--on`: 87 88```sh 89$ wire apply --on @cloud --on node-5 90``` 91 92This will deploy all nodes in `@cloud`, alongside the node `node-5`. 93 94### Targeting Many Tags (Union) 95 96You can specify many tags together: 97 98```sh 99$ wire apply --on @cloud @on-prem 100``` 101 102This is a union between `@cloud` and `@on-prem`.