From 538d47dbaf263efb5b0a0ff03e940bf832f557e7 Mon Sep 17 00:00:00 2001 From: Anton Medvedev Date: Sun, 7 Nov 2021 22:15:17 +0100 Subject: [PATCH] Update hosts.md --- docs/hosts.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/docs/hosts.md b/docs/hosts.md index 7b00c189..e5561d0f 100644 --- a/docs/hosts.md +++ b/docs/hosts.md @@ -87,3 +87,39 @@ Host * |`setLabels` | Key-value pairs for host selector. | |`setSshArguments` | For example, `['-o UserKnownHostsFile=/dev/null']` | +## Multiple hosts + +You can pass multiple hosts to the host function: + +```php +host('example.org', 'deployer.org', ...) + ->setRemoteUser('anton'); +``` + +## Host ranges + +If you have a lot of hosts following similar patterns, you can describe them +like this rather than listing each hostname: + +```php +host('www[01:50].example.org'); +``` + +For numeric patterns, leading zeros can be included or removed, as desired. +Ranges are inclusive. + +You can also define alphabetic ranges: + +```php +host('db[a:f].example.org'); +``` + +## Localhost + +A special function [localhost()](api.md#localhost) defines a special local host. +Deployer will not connect to this host and will execute commands locally. + +```php +localhost(); // Alias and hostname will be "localhost". +localhost('ci'); // Alias is "ci", hostname is "localhost". +```