-
-
Notifications
You must be signed in to change notification settings - Fork 156
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
Are defaults applied per file or globally? #52
Comments
Actually the FYI, my current personal workflow about
|
That sounds like a good flow but it has the downside of listing inheritance as a host. Maybe make them |
What do you think about:
i.e:
defaults:
...
includes:
- ~/.ssh/assh.d/*.yml
- /etc/assh.yml
templates:
idrsa-hosts:
IdentityFile: ~/.ssh/id_rsa
bob-hosts:
User: bob
sam-hosts:
User: sam
Port: 23
controlmaster-hosts:
ControlMaster: auto
ControlPath: ~/tmp/%h-%p-%r.sock
ControlPersist: yes
file-templates:
- bob-hosts
- idrsa-hosts
hosts:
abc-server: # inherits from controlmaster-hosts, bob-hosts, idrsa-hosts
HostName: 1.2.3.4
Inherits:
- controlmaster-hosts
def-server: #inherits from bob-hosts, idrsa-hosts
HostName: 5.6.7.8
file-templates:
- sam-hosts
- idrsa-hosts
hosts:
ghi-server: # inherits from contromaster-hosts, sam-hosts, idrsa-hosts
Inherits:
- controlmaster-hosts
HostName: 2.3.4.5
jkl-server: # inherits from sam-hosts, idrsa-hosts
HostName: 6.7.8.9
hosts:
mno-server: # inherits from idrsa-hosts
Inherits:
- idrsa-hosts
HostName: 3.4.5.6
pqr-server: # no inheritance
HostName: 7.8.9.10 |
I think ~/.ssh/assh.d/sam.yml # define file specific templates
file-templates:
shared-template:
User: file-specific-user
# apply it together with other templates
file-defaults:
Inherits:
- sam-hosts
- idrsa-hosts
- shared-template
hosts:
ghi-server: # inherits from contromaster-hosts, sam-hosts, idrsa-hosts _&_ shared-template
Inherits:
- controlmaster-hosts
HostName: 2.3.4.5
jkl-server: # inherits from sam-hosts, idrsa-hosts _&_ shared-template
HostName: 6.7.8.9 The only important think to consider is that the rules of precedence should be very clear. For instance if two templates define What do you think? |
I also prefer your But I'm more to keep templates globally scoped, it will be a real pain to manage privacy of templates in my structures, it may also be useful later if I add some helpers to list the templates or to create host graphs for instance # define prefixed templates (the templates may be moved in other files too)
templates:
sam-shared-template: # manually prefixed template, but still shared globally
User: file-specific-user
# apply it together with other templates
file-defaults:
Inherits:
- sam-hosts # global template from another file
- idrsa-hosts # global template from another file
- sam-shared-template # global template from this file
hosts:
ghi-server: # inherits from contromaster-hosts, sam-hosts, idrsa-hosts _&_ sam-shared-template
Inherits:
- controlmaster-hosts
HostName: 2.3.4.5
jkl-server: # inherits from sam-hosts, idrsa-hosts _&_ sam-shared-template
HostName: 6.7.8.9 |
You mention that the templates can be moved to another file. So if I can have multiple definitions of |
Yes, every sections may exists in any files and multiple times I will add an exception: the |
👍 |
Templates are now handled, I still need to handle the |
Great, let me know if you want some testing once everything's merged. I'll be happy to take a look locally to see how things work. Cheers. |
Ok, thanks :) |
+1 This would be excellent to shorten the rules and subconfigs! Any chance to have that released soon? |
Hi,
I was wondering if the
defaults
section is global when used inside an included file. For instance I have aproduction.yml
file included in the main config, if I put a global section there will it overwrite or merge the global defaults in the top config file? Or will it apply "globally" to the configuration file where it's written? I assume it's global and I would instead have to use a host definition and then inherit, but just checking for clarity. :)Thanks!
The text was updated successfully, but these errors were encountered: