Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable yaml aliases #578

Merged
merged 2 commits into from
Nov 13, 2023
Merged

Enable yaml aliases #578

merged 2 commits into from
Nov 13, 2023

Conversation

mdkent
Copy link
Member

@mdkent mdkent commented Nov 11, 2023

Enable aliases for more exotic templating situations.

This is super useful for D.R.Y. when configuring a number of roles and you hit the limits of what's reasonable with ERB.

One example is configuring roles based on datacenters and wanting to pass a specific env var to each, eg:

chicago_defaults: &chicago_defaults
  env:
    DC: "chi"
ashburn_defaults: &ashburn_defaults
  env:
    DC: "ash"

service: app
image: dhh/app
servers:
  web:
    <<: *chicago_defaults
    hosts:
      - 1.1.1.1
      - 1.1.1.2
  workers:
    cmd: bin/jobs
    <<: *chicago_defaults
    hosts:
      - 1.1.1.3
      - 1.1.1.4
   
  web_ashburn:
    <<: *ashburn_defaults
    hosts:
      - 2.1.1.1
      - 2.1.1.2
  workers_ashburn:
    cmd: bin/jobs
    <<: *ashburn_defaults
    hosts:
      - 2.1.1.3
      - 2.1.1.4

This can be done explicitly, but depending on the number of env vars, roles and hosts involved it quickly unwieldy.

I'd prefer to support this but not encourage it as it definitely cranks up the complexity.

@mdkent mdkent force-pushed the enable-yaml-aliases branch 3 times, most recently from fa894f3 to acabb07 Compare November 12, 2023 01:24
This is super useful for DRY when configuring a number of roles and you
hit the limits of what's reasonable with ERB.
@mdkent mdkent force-pushed the enable-yaml-aliases branch from acabb07 to ed58ce6 Compare November 12, 2023 01:26
@mdkent mdkent requested a review from djmb November 12, 2023 17:07
@djmb djmb merged commit 80cc0c2 into main Nov 13, 2023
6 checks passed
@djmb djmb deleted the enable-yaml-aliases branch November 13, 2023 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants