Host specific env with tags

Allow hosts to be tagged so we can have host specific env variables.

We might want host specific env variables for things like datacenter
specific tags or testing GC settings on a specific host.

Right now you either need to set up a separate role, or have the app
be host aware.

Now you can define tag env variables and assign those to hosts.

For example:
```
servers:
  - 1.1.1.1
  - 1.1.1.2: tag1
  - 1.1.1.2: tag2
  - 1.1.1.3: [ tag1, tag2 ]
env_tags:
  tag1:
    ENV1: value1
  tag2:
    ENV2: value2
```

The tag env supports the full env format, allowing you to set secret and
clear values.
This commit is contained in:
Donal McBreen
2024-05-02 10:36:15 +01:00
parent 3c8428504d
commit 6d062ce271
21 changed files with 334 additions and 69 deletions

29
test/fixtures/deploy_with_env_tags.yml vendored Normal file
View File

@@ -0,0 +1,29 @@
service: app
image: dhh/app
servers:
web:
- 1.1.1.1: site1
- 1.1.1.2: [ site1 experimental ]
- 1.2.1.1: site2
- 1.2.1.2: site2
workers:
- 1.1.1.3: site1
- 1.1.1.4: site1
- 1.2.1.3: site2
- 1.2.1.4: [ site2 experimental ]
env:
clear:
TEST: "root"
EXPERIMENT: "disabled"
env_tags:
site1:
SITE: site1
site2:
SITE: site2
experimental:
env:
EXPERIMENT: "enabled"
registry:
username: user
password: pw