19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'app/lib/actions/foreman_pipeline/job/create_host.rb', line 19
def run
hostgroup = Hostgroup.find(input[:hostgroup_id])
location = Location.where(:name => "foreman_pipeline").first
host = ::Host::Managed.new(
name: input[:name],
hostgroup: hostgroup,
build: true,
managed: true,
enabled: true,
environment: hostgroup.environment,
compute_resource_id: input.fetch(:compute_resource_id),
compute_attributes: input[:compute_attributes],
puppet_proxy: hostgroup.puppet_proxy,
puppet_ca_proxy: hostgroup.puppet_ca_proxy,
organization_id: input[:options][:org_id],
location: location
)
organization_param
keys_param
host.apply_compute_profile(InterfaceMerge.new)
host.save!
jenkins_pubkey_param_for host
host.power.start
output.update host: { id: host.id,
name: host.name,
ip: host.ip,
mac: host.mac,
params: host.params }
end
|