Hi there, On Wed, 2017-05-24 at 09:02 -0700, nokrite wrote: > Hello together, > > i have a question about the architecture design of foreman, wich i > dont understand from a users perspective. > Why does foreman support only one provisioning user data template per > operating system? I dont really understand the benefit from this, > because i have some scenarios in my head, where it could be useful > while provisioning a new host to chooese between different user data > templates.
It is possible to have multiple templates for an OS. The choice on the OS edit page simple sets the *default* one. However, it's not immediately obvious, so you can be forgiven for missing it ;) If you go to a particular template, and go to the Association tab, after you've assigned the appropriate OSs to the template you'll see a button marked "Valid host group and environment combinations". This alows you to specify conditions for matching this template to a host, based on Hostgroup and/or Environment. Thus you could have: * Preseed default - default in the OS page * Preseed (Production) - matched if env == production * Preseed (Webservers) - matched if production and in the Web group and so on. This gives you flexibilty to choose templates based on the needs of your individual hosts - just put them into a specific group or env and click Resolve Templates to check it matched. > I want to give two simple scenarios: > > 1. I want to provisioning image based from a vmware template per > foreman-vmware with a user data template. So maybe i want > sometimes provisioning a host without static ip configuration and > other times i want to provisioning with a static ip configuration. In > this screnario i always have to edit the adapter settings in the user > data template before i go to create a new host. Because if i have > adapter settings in the user data template who expect ip adresses and > so on, the provisioning process over vmware will fail if iam not > providing this in foreman. If i want the host just get a random ip > adress from the dhcp server and dont set it static, i have to kick > the static adapter settings out of the user data template before > creating a new host. In addition to multiple templates, you can always use ERB to add conditionals to templates, based on host parameters: <% if @host.params['staic-ip'] == 'yup' %> do static stuff <% end %> Which allows your users to add little bits on an opt-in basis (I think our default netowrking templates already have an option for static IPs). You could also use configuration management to do most of the big changes once the host is provisioned. 2. Another thing is, if i have multiple environments. I install over > the user data template for example over powershell command the > windows puppet agent. Also define there in wich environment i want > to provisioning over installation arguments from the puppet agent msi > file. So that meens that i always have to edit the user data template > when i want to change the environment before creating a new host. > Because in the new host dialouge i can choose the environment, but > the agent dosent care and always use "production" if i didnt provide > other environments over installation arguments. Again, you want to use ERB to provide this kind of data, our default templates do this for you (see https://github.com/theforeman/community- templates/blob/develop/provisioning_templates/snippet/puppet.conf.erb#L 47 for how we set the environment). > For me it would be the best if i just choose in the "new host"- > dialogue image based provisioning" and after i choose my operating > system and click on "resolve" he return me a list of different user > data templates for my needs and not only always one. So that every > user can chooese what they need at that moment. The main answer here is that the Host new/edit page is *waaay* too complicated already, and adding more selectors won't help. It'd be lovely to redesign it, if there was time :) Greg -- You received this message because you are subscribed to the Google Groups "foreman-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
