diff --git a/doc/Kadeploy.pdf b/doc/Kadeploy.pdf index 5edc635ae7b7ef9eb898c21f5e367b44c3c268e7..31f478e93dbbc27256fa5d1240a60c452bf8b913 100644 Binary files a/doc/Kadeploy.pdf and b/doc/Kadeploy.pdf differ diff --git a/doc/Kadeploy.tex b/doc/Kadeploy.tex index d5159350f93e7f43570ef78d08f2511300edfa99..42a640f30ec0ca137801584fee210519710da2b7 100644 --- a/doc/Kadeploy.tex +++ b/doc/Kadeploy.tex @@ -746,7 +746,10 @@ external: \item \ypath{/network/vlan} \begin{itemize} \item \yfieldd{hostname\_suffix}{String}{""} this specifies the suffix to add to the hostname to define the hostname in the given VLAN. The pattern VLAN\_ID can be used in the definition, it is replaced at the runtime. + \item \yfieldd{default\_id}{String}{"DEFAULT"} The default VLAN id. No suffix is added to the hostname when this id is used. \item \yfieldd{set\_cmd}{String}{""} command to launch in order to put a set of nodes in a VLAN. The patterns NODES, USER and VLAN\_ID can be used. + \item \yfieldd{script}{String}{""} script to launch in order to put a set of nodes in a VLAN. You can use Kadeploy3 environment variables (see section \ref{sec:env_vars}) in this script. + \item \yfieldd{allow\_failure}{Boolean}{true} Keep going if there is a failure when setting the nodes in the default VLAN. A failure on setting the node in a specified VLAN (with the ``--vlan`` option) will allways result in a failure in the deployment. \end{itemize} \item \ypath{/network/ports} diff --git a/lib/kadeploy3/server/config.rb b/lib/kadeploy3/server/config.rb index 3699d232440f0fc448a3927216cad4156c8ab5e1..521a85a25621fd50c3c84bf4e002658bc7fc0575 100644 --- a/lib/kadeploy3/server/config.rb +++ b/lib/kadeploy3/server/config.rb @@ -215,6 +215,7 @@ module Configuration attr_reader :end_of_reboot_hook attr_reader :end_of_power_hook attr_reader :vlan_hostname_suffix + attr_reader :vlan_default_id attr_reader :allow_vlan_failure attr_reader :set_vlan_cmd attr_reader :set_vlan_script @@ -282,6 +283,7 @@ module Configuration cp.parse('network', false) do cp.parse('vlan') do |inf| @vlan_hostname_suffix = cp.value('hostname_suffix', String, '') + @vlan_default_id = cp.value('default_id', String, 'DEFAULT') @allow_vlan_failure = cp.value('allow_failure', [TrueClass, FalseClass], true) @set_vlan_cmd = cp.value('set_cmd', String, '', { :type => 'file', :command => true, diff --git a/lib/kadeploy3/server/kaworkflow.rb b/lib/kadeploy3/server/kaworkflow.rb index 8a42bf7db2a22a3b68d7d416034b17686bebbabb..3f9ff4cd22c8e8ae79dac5b8c414363d7bbca3a7 100644 --- a/lib/kadeploy3/server/kaworkflow.rb +++ b/lib/kadeploy3/server/kaworkflow.rb @@ -186,9 +186,13 @@ module Kaworkflow dns = Resolv::DNS.new context.vlan_addr = {} context.nodelist.each do |hostname| - host, domain = hostname.split('.', 2) - vlan_hostname = "#{host}#{context.config.common.vlan_hostname_suffix}.#{domain}" - vlan_hostname.gsub!('VLAN_ID', context.vlan_id) + if context.config.common.vlan_default_id == context.vlan_id + vlan_hostname = hostname + else + host, domain = hostname.split('.', 2) + vlan_hostname = "#{host}#{context.config.common.vlan_hostname_suffix}.#{domain}" + vlan_hostname.gsub!('VLAN_ID', context.vlan_id) + end begin context.vlan_addr[hostname] = dns.getaddress(vlan_hostname).to_s