foreman_puppet 5.0.0 → 5.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -7
  3. data/Rakefile +0 -5
  4. data/app/graphgl/foreman_puppet/types/environment.rb +1 -4
  5. data/app/graphgl/foreman_puppet/types/puppetclass.rb +1 -4
  6. data/app/models/concerns/foreman_puppet/extensions/host.rb +1 -1
  7. data/app/models/foreman_puppet/puppetclass.rb +2 -2
  8. data/app/views/foreman_puppet/environments/welcome.html.erb +5 -0
  9. data/app/views/foreman_puppet/puppetclass_lookup_keys/welcome.html.erb +1 -1
  10. data/app/views/foreman_puppet/puppetclasses/_selected_classes.html.erb +1 -1
  11. data/app/views/hosts/select_multiple_puppet_proxy.html.erb +5 -0
  12. data/app/views/provisioning_templates/temp/autoyast_orcharhino_finish.erb +31 -0
  13. data/app/views/provisioning_templates/temp/preseed_orcharhino_finish.erb +90 -0
  14. data/app/views/provisioning_templates/temp/provision/autoyast_orcharhino_default.erb +336 -0
  15. data/app/views/provisioning_templates/temp/snippet/_or_al_client.erb +32 -0
  16. data/app/views/provisioning_templates/temp/snippet/_or_deb_client.erb +175 -0
  17. data/app/views/provisioning_templates/temp/snippet/_or_ol_client.erb +37 -0
  18. data/app/views/provisioning_templates/temp/snippet/_or_sles_client.erb +85 -0
  19. data/lib/foreman_puppet/register.rb +1 -1
  20. data/lib/foreman_puppet/version.rb +1 -1
  21. data/lib/tasks/foreman_puppet_tasks.rake +0 -10
  22. data/locale/ca/LC_MESSAGES/foreman_puppet.mo +0 -0
  23. data/locale/ca/foreman_puppet.edit.po +1221 -0
  24. data/locale/ca/foreman_puppet.po +44 -8
  25. data/locale/ca/foreman_puppet.po.time_stamp +0 -0
  26. data/locale/cs_CZ/LC_MESSAGES/foreman_puppet.mo +0 -0
  27. data/locale/cs_CZ/foreman_puppet.edit.po +1208 -0
  28. data/locale/cs_CZ/foreman_puppet.po +45 -9
  29. data/locale/cs_CZ/foreman_puppet.po.time_stamp +0 -0
  30. data/locale/de/LC_MESSAGES/foreman_puppet.mo +0 -0
  31. data/locale/de/foreman_puppet.edit.po +1300 -0
  32. data/locale/de/foreman_puppet.po +49 -13
  33. data/locale/de/foreman_puppet.po.time_stamp +0 -0
  34. data/locale/en/LC_MESSAGES/foreman_puppet.mo +0 -0
  35. data/locale/en/foreman_puppet.edit.po +998 -0
  36. data/locale/en/foreman_puppet.po +42 -6
  37. data/locale/en/foreman_puppet.po.time_stamp +0 -0
  38. data/locale/en/foreman_puppet.pox +0 -0
  39. data/locale/en_GB/LC_MESSAGES/foreman_puppet.mo +0 -0
  40. data/locale/en_GB/foreman_puppet.edit.po +1197 -0
  41. data/locale/en_GB/foreman_puppet.po +44 -8
  42. data/locale/en_GB/foreman_puppet.po.time_stamp +0 -0
  43. data/locale/es/LC_MESSAGES/foreman_puppet.mo +0 -0
  44. data/locale/es/foreman_puppet.edit.po +1275 -0
  45. data/locale/es/foreman_puppet.po +77 -39
  46. data/locale/es/foreman_puppet.po.time_stamp +0 -0
  47. data/locale/foreman_puppet.pot +81 -25
  48. data/locale/fr/LC_MESSAGES/foreman_puppet.mo +0 -0
  49. data/locale/fr/foreman_puppet.edit.po +1290 -0
  50. data/locale/fr/foreman_puppet.po +67 -28
  51. data/locale/fr/foreman_puppet.po.time_stamp +0 -0
  52. data/locale/gl/LC_MESSAGES/foreman_puppet.mo +0 -0
  53. data/locale/gl/foreman_puppet.edit.po +1203 -0
  54. data/locale/gl/foreman_puppet.po +44 -8
  55. data/locale/gl/foreman_puppet.po.time_stamp +0 -0
  56. data/locale/it/LC_MESSAGES/foreman_puppet.mo +0 -0
  57. data/locale/it/foreman_puppet.edit.po +1233 -0
  58. data/locale/it/foreman_puppet.po +47 -10
  59. data/locale/it/foreman_puppet.po.time_stamp +0 -0
  60. data/locale/ja/LC_MESSAGES/foreman_puppet.mo +0 -0
  61. data/locale/ja/foreman_puppet.edit.po +1223 -0
  62. data/locale/ja/foreman_puppet.po +60 -24
  63. data/locale/ja/foreman_puppet.po.time_stamp +0 -0
  64. data/locale/ka/LC_MESSAGES/foreman_puppet.mo +0 -0
  65. data/locale/ka/foreman_puppet.po +875 -0
  66. data/locale/ko/LC_MESSAGES/foreman_puppet.mo +0 -0
  67. data/locale/ko/foreman_puppet.edit.po +1197 -0
  68. data/locale/ko/foreman_puppet.po +45 -9
  69. data/locale/ko/foreman_puppet.po.time_stamp +0 -0
  70. data/locale/messages.mo +0 -0
  71. data/locale/nl_NL/LC_MESSAGES/foreman_puppet.mo +0 -0
  72. data/locale/nl_NL/foreman_puppet.edit.po +1228 -0
  73. data/locale/nl_NL/foreman_puppet.po +44 -8
  74. data/locale/nl_NL/foreman_puppet.po.time_stamp +0 -0
  75. data/locale/pl/LC_MESSAGES/foreman_puppet.mo +0 -0
  76. data/locale/pl/foreman_puppet.edit.po +1238 -0
  77. data/locale/pl/foreman_puppet.po +45 -9
  78. data/locale/pl/foreman_puppet.po.time_stamp +0 -0
  79. data/locale/pt_BR/LC_MESSAGES/foreman_puppet.mo +0 -0
  80. data/locale/pt_BR/foreman_puppet.edit.po +1281 -0
  81. data/locale/pt_BR/foreman_puppet.po +78 -41
  82. data/locale/pt_BR/foreman_puppet.po.time_stamp +0 -0
  83. data/locale/ru/LC_MESSAGES/foreman_puppet.mo +0 -0
  84. data/locale/ru/foreman_puppet.edit.po +1240 -0
  85. data/locale/ru/foreman_puppet.po +45 -9
  86. data/locale/ru/foreman_puppet.po.time_stamp +0 -0
  87. data/locale/sv_SE/LC_MESSAGES/foreman_puppet.mo +0 -0
  88. data/locale/sv_SE/foreman_puppet.edit.po +1205 -0
  89. data/locale/sv_SE/foreman_puppet.po +44 -8
  90. data/locale/sv_SE/foreman_puppet.po.time_stamp +0 -0
  91. data/locale/zh_CN/LC_MESSAGES/foreman_puppet.mo +0 -0
  92. data/locale/zh_CN/foreman_puppet.edit.po +1212 -0
  93. data/locale/zh_CN/foreman_puppet.po +65 -29
  94. data/locale/zh_CN/foreman_puppet.po.time_stamp +0 -0
  95. data/locale/zh_TW/LC_MESSAGES/foreman_puppet.mo +0 -0
  96. data/locale/zh_TW/foreman_puppet.edit.po +1197 -0
  97. data/locale/zh_TW/foreman_puppet.po +45 -9
  98. data/locale/zh_TW/foreman_puppet.po.time_stamp +0 -0
  99. data/package.json +7 -7
  100. data/test/graphql/mutations/hosts/create_mutation_test.rb +1 -2
  101. data/test/unit/foreman_puppet/global_id_test.rb +13 -0
  102. data/webpack/src/Components/Environments/Welcome.js +25 -6
  103. data/webpack/src/Extends/Host/PuppetTab/index.js +2 -0
  104. metadata +108 -58
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ad8bedb9a6b0aa20d769da8ad51d57891e3c77da03ed70f2a90cdf9fe7af3ffa
4
- data.tar.gz: 17d3af41d610400ba081936f7b151d9329ae26b1fd311c81eaf5925a23366841
3
+ metadata.gz: cd8fd7cb3c5cba9fcc4687c4cf5d283c5bf7dbb9710daf3a103e77920caae6dd
4
+ data.tar.gz: 7da5ff9d5fcb48da2dc4a8c0aab53723cdd3a0d50cc70a92208679999cdd2e00
5
5
  SHA512:
6
- metadata.gz: a87e47f5a35f3a45bb6ac4a77f591ee0b85c37f6736972afd97559d35f4c752a7647c0958b3f7a131ef45b75b54b0f1f2cc104b6a6e4d78a847162a54de73d8f
7
- data.tar.gz: 3a9c0f4ef48ce2e69e46dd1bbe54a488911e9d97261429f2d6d1f01fb48f53679a651beebb5e94a6bcc1c8159319241d260e342327ff018b9e9c3c8f1bb93281
6
+ metadata.gz: 3c098607d4b7e3ac1a57624d74e004f70f8df8d706acbee598c02451d2795d2a055ea93e2fdf243e72c9421b1748c925df94e4ada0b3f1af9296d6543abe53bd
7
+ data.tar.gz: c436c2bdabcf5ed80dcc137c86119f6d72a854711c0bc9e4c21e3573633246d2f50cdc53291ea6e0e68c1ee54edabaeb41d31366c1c0d1aea7d964c5e3573fff
data/README.md CHANGED
@@ -31,17 +31,15 @@ Some features will remain in core:
31
31
 
32
32
  ## Compatibility
33
33
 
34
- Foreman 3.0 will be the first release where the Puppet functionality is mostly extracted.
35
- Therefore, this plugin is only required for 3.0 and onwards.
36
- You can install it on Foreman 2.5 to prepare for the Foreman update.
37
-
38
34
  |Foreman version|Plugin version|Notes |
39
35
  |---------------|--------------|------------------------------------------|
40
- | >= 3.3 | ~> 4.0 | Required |
41
- | >= 3.2 | ~> 3.0 | Required |
36
+ | >= 3.5 | ~> 5.0 | Required |
37
+ | ~> 3.4 | ~> 4.1 | Required |
38
+ | ~> 3.3 | ~> 4.0 | Required |
39
+ | ~> 3.2 | ~> 3.0 | Required |
42
40
  | ~> 3.1 | ~> 2.0 | Required |
43
41
  | ~> 3.0 | ~> 1.0 | Required |
44
- | >= 2.5 | ~> 0.1 | Optional; replaces Core features |
42
+ | ~> 2.5 | ~> 0.1 | Optional; replaces Core features |
45
43
  | < 2.5 | - | Not supported (functionality is in Core) |
46
44
 
47
45
  ## Installation
data/Rakefile CHANGED
@@ -14,8 +14,6 @@ load 'rails/tasks/engine.rake'
14
14
  Bundler::GemHelper.install_tasks
15
15
 
16
16
  require 'rake/testtask'
17
- require 'rspec/core'
18
- require 'rspec/core/rake_task'
19
17
 
20
18
  Rake::TestTask.new(test: 'app:db:test:prepare') do |t|
21
19
  t.libs << 'test'
@@ -25,7 +23,4 @@ Rake::TestTask.new(test: 'app:db:test:prepare') do |t|
25
23
  t.verbose = false
26
24
  end
27
25
 
28
- desc 'Run all specs in spec directory (excluding plugin specs)'
29
- RSpec::Core::RakeTask.new(spec: 'app:db:test:prepare')
30
-
31
26
  task default: :test
@@ -1,6 +1,7 @@
1
1
  module ForemanPuppet
2
2
  module Types
3
3
  class Environment < ::Types::BaseObject
4
+ graphql_name 'ForemanPuppet_Environment'
4
5
  model_class ForemanPuppet::Environment
5
6
  description 'An Environment'
6
7
 
@@ -11,10 +12,6 @@ module ForemanPuppet
11
12
  has_many :locations, ::Types::Location
12
13
  has_many :organizations, ::Types::Organization
13
14
  has_many :puppetclasses, ForemanPuppet::Types::Puppetclass
14
-
15
- def self.graphql_definition
16
- super.tap { |type| type.instance_variable_set(:@name, 'ForemanPuppet::Environment') }
17
- end
18
15
  end
19
16
  end
20
17
  end
@@ -1,6 +1,7 @@
1
1
  module ForemanPuppet
2
2
  module Types
3
3
  class Puppetclass < ::Types::BaseObject
4
+ graphql_name 'ForemanPuppet_Puppetclass'
4
5
  model_class ForemanPuppet::Puppetclass
5
6
  description 'A Puppetclass'
6
7
 
@@ -11,10 +12,6 @@ module ForemanPuppet
11
12
  has_many :environments, ForemanPuppet::Types::Environment
12
13
  has_many :locations, ::Types::Location
13
14
  has_many :organizations, ::Types::Organization
14
-
15
- def self.graphql_definition
16
- super.tap { |type| type.instance_variable_set(:@name, 'ForemanPuppet::Puppetclass') }
17
- end
18
15
  end
19
16
  end
20
17
  end
@@ -30,7 +30,7 @@ module ForemanPuppet
30
30
  def search_by_puppetclass(_key, operator, value)
31
31
  conditions = sanitize_sql_for_conditions(["puppetclasses.name #{operator} ?", value_to_sql(operator, value)])
32
32
  config_group_ids = ForemanPuppet::ConfigGroup.joins(:puppetclasses).where(conditions).pluck(:id)
33
- host_ids = ::Host.authorized(:view_hosts, Host).joins(puppet: :puppetclasses).where(conditions).distinct.pluck(:id)
33
+ host_ids = ::Host.authorized(:view_hosts).joins(puppet: :puppetclasses).where(conditions).distinct.pluck(:id)
34
34
  host_ids += ForemanPuppet::HostConfigGroup
35
35
  .where(host_type: 'ForemanPuppet::HostPuppetFacet')
36
36
  .where(config_group_id: config_group_ids)
@@ -15,8 +15,8 @@ module ForemanPuppet
15
15
  before_destroy EnsureNotUsedBy.new(:hosts, :hostgroups)
16
16
  has_many :environment_classes, dependent: :destroy, inverse_of: :puppetclass
17
17
  has_many :environments, -> { distinct }, through: :environment_classes
18
- has_many :organizations, -> { distinct.reorder(nil) }, through: :environments
19
- has_many :locations, -> { distinct.reorder(nil) }, through: :environments
18
+ has_many :organizations, -> { distinct.reorder(:id) }, through: :environments
19
+ has_many :locations, -> { distinct.reorder(:id) }, through: :environments
20
20
 
21
21
  # rubocop:disable Rails/HasAndBelongsToMany
22
22
  has_and_belongs_to_many :operatingsystems
@@ -1,4 +1,9 @@
1
1
  <% content_for(:title, _("Puppet environments")) %>
2
+ <%= breadcrumbs(:switchable => false,
3
+ :items => [
4
+ { :caption => _('Puppet Environments'), :url => environments_path },
5
+ { caption: @page_header }
6
+ ]) %>
2
7
 
3
8
  <%= webpacked_plugins_js_for :foreman_puppet %>
4
9
  <%= react_component('WelcomeEnv', {canCreate: authorized_for(action: :new)}) %>
@@ -7,5 +7,5 @@
7
7
  :iconType => 'fa',
8
8
  :header => _('Smart Class Parameters'),
9
9
  :description => description,
10
- :documentation => { :url => documentation_url("4.2.5ParameterizedClasses") },
10
+ :documentation => { :url => documentation_url("4.2.5SmartMatchers") },
11
11
  }) %>
@@ -1,4 +1,4 @@
1
- <%= content_tag :li, id: "selected_puppetclass_#{klass.id}", class: [dom_class(klass, 'selected'), cycle('even', 'odd'), ('unavailable' unless klass.environments.include?(@environment))] do %>
1
+ <%= content_tag :li, id: "selected_puppetclass_#{klass.id}", class: [dom_class(klass, 'selected'), cycle('even', 'odd'), ('unavailable' unless klass.environments.include?(obj.environment.present? ? obj.environment : @environment))] do %>
2
2
  <%= link_to_remove_puppetclass(klass, obj) %>
3
3
  <%= hidden_field_tag "#{resource_type}[puppetclass_ids][]", klass.id %>
4
4
  <% end %>
@@ -0,0 +1,5 @@
1
+ <%= render 'selected_hosts', :hosts => @hosts %>
2
+
3
+ <%= form_for :proxy, :url => foreman_puppet.update_multiple_puppet_proxy_hosts_path(:host_ids => params[:host_ids]) do |f| %>
4
+ <%= multiple_proxy_select(f, 'Puppet') %>
5
+ <% end %>
@@ -0,0 +1,31 @@
1
+ <%#
2
+ kind: finish
3
+ name: AutoYaST orcharhino finish
4
+ model: ProvisioningTemplate
5
+ oses:
6
+ - SLES
7
+ -%>
8
+ <%
9
+ pm_set = @host.puppet_server.present?
10
+ puppet_enabled = pm_set || host_param_true?('force-puppet')
11
+ salt_enabled = host_param('salt_master').present?
12
+ -%>
13
+
14
+ /usr/bin/hostnamectl set-hostname <%= @host.name %>
15
+
16
+ <%= snippet 'or_sles_client' %>
17
+
18
+ <%= snippet('remote_execution_ssh_keys') %>
19
+
20
+ <%= snippet "blacklist_kernel_modules" %>
21
+
22
+ <% if puppet_enabled -%>
23
+ <%= snippet 'puppet_setup' %>
24
+ <% end -%>
25
+
26
+ <% if salt_enabled %>
27
+ <%= snippet 'saltstack_setup' %>
28
+ <% end -%>
29
+
30
+ <%= snippet 'eject_cdrom' -%>
31
+ <%= snippet 'built' %>
@@ -0,0 +1,90 @@
1
+ <%#
2
+ kind: finish
3
+ name: Preseed orcharhino finish
4
+ model: ProvisioningTemplate
5
+ oses:
6
+ - Debian
7
+ - Ubuntu
8
+ %>
9
+
10
+ export DEBIAN_FRONTEND=noninteractive
11
+
12
+ <% if @host.provision_method == 'image' -%>
13
+ <%# Cloud instances frequently have incorrect hosts data %>
14
+ <%= snippet 'fix_hosts' %>
15
+ <% end -%>
16
+
17
+ <% if @host.operatingsystem.name == "Ubuntu" && @host.operatingsystem.major.to_i > 20 || (@host.operatingsystem.major.to_i == 20 && @host.operatingsystem.minor.to_i >= 3) -%>
18
+ <%# Set hostname for Ubuntu Autoinstall %>
19
+ hostnamectl set-hostname <%= @host.name %>
20
+ <% end -%>
21
+
22
+ <%
23
+ pm_set = @host.puppet_server.present?
24
+ puppet_enabled = pm_set || host_param_true?('force-puppet')
25
+ salt_enabled = host_param('salt_master').present?
26
+ chef_enabled = @host.respond_to?(:chef_proxy) && @host.chef_proxy
27
+ apt_install = 'apt -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y install'
28
+ %>
29
+
30
+ <% subnet = @host.subnet -%>
31
+ <% if subnet.respond_to?(:dhcp_boot_mode?) -%>
32
+ <% dhcp = subnet.dhcp_boot_mode? && !@static -%>
33
+ <% else -%>
34
+ <% dhcp = !@static -%>
35
+ <% end -%>
36
+ <%= snippet_if_exists(template_name + " custom pre") -%>
37
+ <% unless dhcp -%>
38
+ # host and domain name need setting as these values may have come from dhcp if pxe booting
39
+ /bin/sed -i "s/^search.*$/search <%= @host.domain %>/g" /etc/resolv.conf
40
+ /bin/sed -i "s/.*dns-search.*/\tdns-search <%= @host.domain %>/g" /etc/network/interfaces
41
+ /bin/sed -i "s/^<%= @host.ip %>.*/<%= @host.ip %>\t<%= @host.shortname %>.<%= @host.domain %>\t<%= @host.shortname %>/g" /etc/hosts
42
+ /bin/echo <%= @host.shortname %> > /etc/hostname
43
+ /bin/hostname <%= @host.shortname %>.<%= @host.domain %>
44
+ <% end -%>
45
+
46
+ <%= snippet_if_exists(template_name + " custom snippet") %>
47
+ <% if host_enc['parameters']['realm'] && @host.realm && @host.realm.realm_type == 'FreeIPA' -%>
48
+ <%= snippet 'freeipa_register' %>
49
+ <% end -%>
50
+
51
+ <%= snippet 'or_deb_client' %>
52
+
53
+ <%= snippet('remote_execution_ssh_keys') %>
54
+
55
+ <%= snippet "blacklist_kernel_modules" %>
56
+
57
+ <%= snippet_if_exists(template_name + " custom post") -%>
58
+
59
+ <% unless host_param('kernel_parameters').nil? -%>
60
+ # Allow overriding the default kernel parameters
61
+ sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT=".*"/GRUB_CMDLINE_LINUX_DEFAULT="<%= host_param('kernel_parameters') %>"/g' /etc/default/grub && update-grub
62
+
63
+ <% end -%>
64
+ <% if chef_enabled %>
65
+ <%= snippet 'chef_client' %>
66
+ <% end -%>
67
+
68
+ <% if puppet_enabled %>
69
+ <% if @host.operatingsystem.name != "Ubuntu" %>
70
+ <% if host_param_true?('enable-puppetlabs-repo') || host_param_true?('enable-puppetlabs-puppet6-repo') || host_param_true?('enable-puppetlabs-puppet5-repo') -%>
71
+ <%= snippet 'puppetlabs_repo' %>
72
+ <% end -%>
73
+ <% end -%>
74
+ <%= snippet 'puppet_setup' %>
75
+ <% end -%>
76
+
77
+ <% if salt_enabled %>
78
+ <%= snippet 'saltstack_setup' %>
79
+ <% end -%>
80
+
81
+ <%= snippet 'preseed_networking_setup' %>
82
+ <%= snippet 'efibootmgr_netboot' %>
83
+
84
+ <%= apt_install %> openssh-client
85
+ sed -i -e "/PermitRootLogin/d" /etc/ssh/sshd_config
86
+ echo "PermitRootLogin Yes" >> /etc/ssh/sshd_config
87
+ systemctl restart sshd
88
+
89
+ <%= snippet 'eject_cdrom' -%>
90
+ <%= snippet 'built' %>
@@ -0,0 +1,336 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <%#
3
+ kind: provision
4
+ name: AutoYaST orcharhino default
5
+ model: ProvisioningTemplate
6
+ oses:
7
+ - SLES
8
+ -%>
9
+ <%
10
+ os_major = @host.operatingsystem.major.to_i
11
+ os_minor = @host.operatingsystem.minor.to_i
12
+ pm_set = @host.puppet_server.present?
13
+ puppet_enabled = pm_set || host_param_true?('force-puppet')
14
+ salt_enabled = host_param('salt_master').present?
15
+
16
+ primary_interface_identifier = @host.primary_interface.identifier.blank? ? 'eth0' : @host.primary_interface.identifier
17
+ primary_interface_subnet = @host.primary_interface.subnet
18
+ -%>
19
+ <!DOCTYPE profile>
20
+ <profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns">
21
+ <general>
22
+ <mode>
23
+ <confirm config:type="boolean">false</confirm>
24
+ <final_reboot config:type="boolean">true</final_reboot>
25
+ </mode>
26
+ </general>
27
+ <networking>
28
+ <dns>
29
+ <hostname><%= @host.name %></hostname>
30
+ <% unless primary_interface_subnet.dhcp_boot_mode? -%>
31
+ <dhcp_hostname config:type="boolean">false</dhcp_hostname>
32
+ <% if os_major < 12 -%>
33
+ <dhcp_resolv config:type="boolean">false</dhcp_resolv>
34
+ <% end -%>
35
+ <% if @host.domain -%>
36
+ <domain><%= @host.domain -%></domain>
37
+ <% end -%>
38
+ <% if primary_interface_subnet.dns_primary.present? -%>
39
+ <nameservers config:type="list">
40
+ <nameserver><%= primary_interface_subnet.dns_primary -%></nameserver>
41
+ <% if primary_interface_subnet.dns_secondary.present? -%>
42
+ <nameserver><%= primary_interface_subnet.dns_secondary -%></nameserver>
43
+ <% end -%>
44
+ </nameservers>
45
+ <% end -%>
46
+ <% else -%>
47
+ <resolv_conf_policy>auto</resolv_conf_policy>
48
+ <% end -%>
49
+ <% if @host.domain -%>
50
+ <searchlist config:type="list">
51
+ <search><%= @host.domain %></search>
52
+ </searchlist>
53
+ <% end -%>
54
+ </dns>
55
+ <interfaces config:type="list">
56
+ <%
57
+ @host.managed_interfaces.each do |interface|
58
+ next if !interface.managed? || interface.subnet.nil? || interface.ip.nil?
59
+ dhcp = interface.subnet.dhcp_boot_mode?
60
+ -%>
61
+ <% if dhcp -%>
62
+ <interface>
63
+ <bootproto>dhcp</bootproto>
64
+ <device><%= interface.primary ? primary_interface_identifier : interface.identifier -%></device>
65
+ <startmode>auto</startmode>
66
+ <usercontrol>no</usercontrol>
67
+ </interface>
68
+ <% else -%>
69
+ <interface>
70
+ <bootproto>static</bootproto>
71
+ <device><%= interface.primary ? primary_interface_identifier : interface.identifier -%></device>
72
+ <ipaddr><%= interface.ip -%></ipaddr>
73
+ <netmask><%= interface.subnet.mask -%></netmask>
74
+ <startmode>onboot</startmode>
75
+ <usercontrol>no</usercontrol>
76
+ </interface>
77
+ <% end -%>
78
+ <% end -%>
79
+ </interfaces>
80
+ <% unless primary_interface_subnet.dhcp_boot_mode? -%>
81
+ <routing>
82
+ <routes config:type="list">
83
+ <route>
84
+ <destination>default</destination>
85
+ <device><%= primary_interface_identifier -%></device>
86
+ <gateway><%= primary_interface_subnet.gateway -%></gateway>
87
+ <netmask><%= primary_interface_subnet.mask -%></netmask>
88
+ </route>
89
+ </routes>
90
+ </routing>
91
+ <% end -%>
92
+ </networking>
93
+ <% if host_param('http-proxy') -%>
94
+ <proxy>
95
+ <enabled config:type="boolean">true</enabled>
96
+ <http_proxy>http://<%= host_param('http-proxy') %>:<%= host_param('http-proxy-port') %></http_proxy>
97
+ <https_proxy>http://<%= host_param('http-proxy') %>:<%= host_param('http-proxy-port') %></https_proxy>
98
+ <% if host_param('noproxy') -%>
99
+ <no_proxy>localhost 127.0.0.1 <%= host_param('http-proxy') %> <%= host_param('noproxy') %></no_proxy>
100
+ <% else -%>
101
+ <no_proxy>localhost 127.0.0.1 <%= host_param('http-proxy') %></no_proxy>
102
+ <% end -%>
103
+ </proxy>
104
+ <% end -%>
105
+ <% if os_major >= 15 -%>
106
+ <ntp-client>
107
+ <ntp_policy>auto</ntp_policy>
108
+ <ntp_servers config:type="list">
109
+ <ntp_server>
110
+ <address><%= host_param('ntp-server') || '0.opensuse.pool.ntp.org' %></address>
111
+ <iburst config:type="boolean">false</iburst>
112
+ <offline config:type="boolean">true</offline>
113
+ </ntp_server>
114
+ </ntp_servers>
115
+ <ntp_sync>15</ntp_sync>
116
+ </ntp-client>
117
+ <% else -%>
118
+ <ntp-client>
119
+ <configure_dhcp config:type="boolean">false</configure_dhcp>
120
+ <peers config:type="list">
121
+ <peer>
122
+ <address><%= host_param('ntp-server') || '0.opensuse.pool.ntp.org' %></address>
123
+ <initial_sync config:type="boolean">true</initial_sync>
124
+ <options></options>
125
+ <type>server</type>
126
+ </peer>
127
+ </peers>
128
+ <start_at_boot config:type="boolean">true</start_at_boot>
129
+ <start_in_chroot config:type="boolean">true</start_in_chroot>
130
+ </ntp-client>
131
+ <% end -%>
132
+ <% if ! @dynamic -%>
133
+ <%= @host.diskLayout %>
134
+ <% end -%>
135
+ <% if os_major >= 15 -%>
136
+ <services-manager>
137
+ <default_target>multi-user</default_target>
138
+ <services>
139
+ <enable config:type="list">
140
+ <service>sshd</service>
141
+ </enable>
142
+ </services>
143
+ </services-manager>
144
+ <% else -%>
145
+ <runlevel>
146
+ <default>3</default>
147
+ <services config:type="list">
148
+ <service>
149
+ <service_name>sshd</service_name>
150
+ <service_status>enable</service_status>
151
+ </service>
152
+ </services>
153
+ </runlevel>
154
+ <% end -%>
155
+ <software>
156
+ <% if os_major >= 15 -%>
157
+ <products config:type="list">
158
+ <product>SLES</product>
159
+ </products>
160
+ <patterns config:type="list">
161
+ <pattern>enhanced_base</pattern>
162
+ </patterns>
163
+ <% else -%>
164
+ <patterns config:type="list">
165
+ <pattern>base</pattern>
166
+ <% if os_major >= 14 -%>
167
+ <pattern>enhanced_base</pattern>
168
+ <pattern>sw_management</pattern>
169
+ <pattern>yast2_basis</pattern>
170
+ <% end -%>
171
+ </patterns>
172
+ <% end -%>
173
+ <packages config:type="list">
174
+ <package>lsb-release</package>
175
+ <package>openssh</package>
176
+ </packages>
177
+ </software>
178
+ <% if host_param('http-proxy') -%>
179
+ <sysconfig config:type="list" >
180
+ <sysconfig_entry>
181
+ <sysconfig_key>PROXY_ENABLED</sysconfig_key>
182
+ <sysconfig_path>/etc/sysconfig/proxy</sysconfig_path>
183
+ <sysconfig_value>yes</sysconfig_value>
184
+ </sysconfig_entry>
185
+ <sysconfig_entry>
186
+ <sysconfig_key>HTTPS_PROXY</sysconfig_key>
187
+ <sysconfig_path>/etc/sysconfig/proxy</sysconfig_path>
188
+ <sysconfig_value>http://<%= host_param('http-proxy') %>:<%= host_param('http-proxy-port') %></sysconfig_value>
189
+ </sysconfig_entry>
190
+ <sysconfig_entry>
191
+ <sysconfig_key>HTTP_PROXY</sysconfig_key>
192
+ <sysconfig_path>/etc/sysconfig/proxy</sysconfig_path>
193
+ <sysconfig_value>http://<%= host_param('http-proxy') %>:<%= host_param('http-proxy-port') %></sysconfig_value>
194
+ </sysconfig_entry>
195
+ <sysconfig_entry>
196
+ <sysconfig_key>GOPHER_PROXY</sysconfig_key>
197
+ <sysconfig_path>/etc/sysconfig/proxy</sysconfig_path>
198
+ <sysconfig_value>http://<%= host_param('http-proxy') %>:3128</sysconfig_value>
199
+ </sysconfig_entry>
200
+ <sysconfig_entry>
201
+ <sysconfig_key>NO_PROXY</sysconfig_key>
202
+ <sysconfig_path>/etc/sysconfig/proxy</sysconfig_path>
203
+ <% if host_param('noproxy') -%>
204
+ <sysconfig_value>localhost, 127.0.0.1, <%= host_param('http-proxy') %>, <%= host_param('noproxy').split(' ').join(', ') %></sysconfig_value>
205
+ <% else -%>
206
+ <sysconfig_value>localhost, 127.0.0.1 </sysconfig_value>
207
+ <% end -%>
208
+ </sysconfig_entry>
209
+ </sysconfig>
210
+ <% end -%>
211
+ <users config:type="list">
212
+ <user>
213
+ <username>root</username>
214
+ <encrypted config:type="boolean">true</encrypted>
215
+ <fullname>root</fullname>
216
+ <gid>0</gid>
217
+ <home>/root</home>
218
+ <shell>/bin/bash</shell>
219
+ <uid>0</uid>
220
+ <user_password><%= root_pass %></user_password>
221
+ </user>
222
+ </users>
223
+ <scripts>
224
+ <% if @dynamic -%>
225
+ <pre-scripts config:type="list">
226
+ <script>
227
+ <debug config:type="boolean">true</debug>
228
+ <filename>pre_disklayout</filename>
229
+ <interpreter>shell</interpreter>
230
+ <source><![CDATA[
231
+ <%= @host.diskLayout %>
232
+ ]]>
233
+ </source>
234
+ </script>
235
+ </pre-scripts>
236
+ <% end -%>
237
+ <chroot-scripts config:type="list">
238
+ <script>
239
+ <filename>cp-resolv.sh</filename>
240
+ <chrooted config:type="boolean">false</chrooted>
241
+ <interpreter>shell</interpreter>
242
+ <notification>Copying resolv.conf into chroot ...</notification>
243
+ <source><![CDATA[
244
+ cp /etc/resolv.conf /mnt/etc
245
+ ]]>
246
+ </source>
247
+ </script>
248
+ <script>
249
+ <filename>foreman.sh</filename>
250
+ <chrooted config:type="boolean">true</chrooted>
251
+ <interpreter>shell</interpreter>
252
+ <notification>Setting up Foreman ...</notification>
253
+ <source><![CDATA[
254
+ /bin/hostname <%= @host.name %>
255
+
256
+ <%= snippet 'eject_cdrom' -%>
257
+ <%= snippet 'built' %>
258
+
259
+ rm /etc/resolv.conf
260
+ ]]>
261
+ </source>
262
+ </script>
263
+ </chroot-scripts>
264
+
265
+ <init-scripts config:type="list">
266
+ <script>
267
+ <filename>post-foreman.sh</filename>
268
+ <source><![CDATA[
269
+
270
+ <% if host_param('http-proxy') -%>
271
+ export http_proxy="http://<%= host_param('http-proxy') %>:<%= host_param('http-proxy-port') %>"
272
+ <% if host_param('noproxy') -%>
273
+ export no_proxy="<%= host_param('http-proxy') %> <%= host_param('noproxy') %>"
274
+ <% end -%>
275
+ <% end -%>
276
+
277
+ <%= snippet 'or_sles_client' %>
278
+
279
+ <%= snippet('remote_execution_ssh_keys') %>
280
+
281
+ <%= snippet "blacklist_kernel_modules" %>
282
+
283
+ <% if puppet_enabled -%>
284
+ <%= snippet 'puppet_setup' %>
285
+ <% end -%>
286
+
287
+ <% if salt_enabled %>
288
+ <%= snippet 'saltstack_setup' %>
289
+ <% end -%>
290
+ ]]>
291
+ </source>
292
+ </script>
293
+ </init-scripts>
294
+ </scripts>
295
+ <% if os_major >= 15 -%>
296
+ <firewall>
297
+ <enable_firewall config:type="boolean">true</enable_firewall>
298
+ <log_denied_packets>off</log_denied_packets>
299
+ <default_zone>public</default_zone>
300
+ <zones config:type="list">
301
+ <zone>
302
+ <name>public</name>
303
+ <services config:type="list">
304
+ <service>ssh</service>
305
+ <service>dhcpv6-client</service>
306
+ </services>
307
+ </zone>
308
+ </zones>
309
+ </firewall>
310
+ <% end -%>
311
+ <keyboard>
312
+ <keymap>english-us</keymap>
313
+ </keyboard>
314
+ <timezone>
315
+ <hwclock>UTC</hwclock>
316
+ <timezone><%= host_param('time-zone') || 'Etc/UTC' %></timezone>
317
+ </timezone>
318
+ <add-on>
319
+ <add_on_products config:type="list">
320
+ <% if os_major >= 15 -%>
321
+ <listentry>
322
+ <media_url><%= host_param('sle-module-basesystem-url') %></media_url>
323
+ <product_dir>/Module-Basesystem</product_dir>
324
+ <product>sle-module-basesystem</product>
325
+ </listentry>
326
+ <% if os_minor >= 1 and os_minor < 4 -%>
327
+ <listentry>
328
+ <media_url><%= host_param('sle-module-basesystem-url') %></media_url>
329
+ <product_dir>/Module-Python2</product_dir>
330
+ <product>sle-module-python2</product>
331
+ </listentry>
332
+ <% end -%>
333
+ <% end -%>
334
+ </add_on_products>
335
+ </add-on>
336
+ </profile>
@@ -0,0 +1,32 @@
1
+ <%#
2
+ kind: snippet
3
+ name: or_al_client
4
+ model: ProvisioningTemplate
5
+ snippet: true
6
+ description: This snippet prepares the registration to orcharhino on a Amazon Linux host
7
+ -%>
8
+ <%-
9
+ os_major = @host.operatingsystem.major.to_i
10
+
11
+ if !host_param('or_client_repo_url').nil?
12
+ or_client_repo_url = host_param('or_client_repo_url')
13
+ elsif !host_param('or_amazonlinux_client_repo_prefix').nil?
14
+ or_client_repo_url = host_param('or_amazonlinux_client_repo_prefix') + os_major.to_s
15
+ else
16
+ or_client_repo_url = nil
17
+ end
18
+ %>
19
+ <%- if !or_client_repo_url.nil? %>
20
+ # Install dependencies which are required later on while installing the subscription-manager
21
+ yum install -y python-inotify python-setuptools
22
+
23
+ cat << EOF > /etc/yum.repos.d/or_al_client.repo
24
+ [orcharhino_AmazonLinux_Client_<%= os_major %>]
25
+ name=orcharhino Amazon Linux Client
26
+ baseurl="<%= or_client_repo_url %>"
27
+ gpgcheck=0
28
+ enabled=1
29
+ priority=5
30
+ EOF
31
+
32
+ <%- end %>