-
Notifications
You must be signed in to change notification settings - Fork 1k
Fixes #38877 - Add Agama installer templates (SLES16) #10747
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
Open
sbernhard
wants to merge
1
commit into
theforeman:develop
Choose a base branch
from
ATIX-AG:fix_38877
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,108
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
app/views/unattended/partition_tables_templates/agama_default.erb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| <%# | ||
| kind: ptable | ||
| name: Agama default | ||
| model: Ptable | ||
| oses: | ||
| - OpenSUSE | ||
| - SLES | ||
| %> | ||
| <% | ||
| pxe_loader = @host.pxe_loader || '' | ||
| -%> | ||
|
|
||
| "drives": [ | ||
| { | ||
| "search": "*", | ||
| "partitions": [ | ||
| { | ||
| "search": "*", | ||
| "delete": true | ||
| }, | ||
| { | ||
| "filesystem": { "path": "/boot", "type": "ext4", "name": "boot" }, | ||
| "size": { "min": "2 GiB", "max": "4 GiB" } | ||
| }, | ||
| <%- if pxe_loader.include?('UEFI') -%> | ||
| { | ||
| "filesystem": { "path": "/boot/efi", "type": "vfat", "name": "vfat" }, | ||
| "size": "1 GiB" | ||
| }, | ||
| <%- end -%> | ||
| { | ||
| "generate": "default" | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "boot": { | ||
| "configure": false | ||
| } |
61 changes: 61 additions & 0 deletions
61
app/views/unattended/partition_tables_templates/agama_lvm.erb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| <%# | ||
| kind: ptable | ||
| name: Agama LVM | ||
| model: Ptable | ||
| oses: | ||
| - OpenSUSE | ||
| - SLES | ||
| %> | ||
| <% | ||
| pxe_loader = @host.pxe_loader || '' | ||
| -%> | ||
|
|
||
| "boot": { "configure": false }, | ||
| "drives": [ | ||
| { | ||
| "alias": "disk", | ||
| "search": "*", | ||
| "partitions": [ | ||
| { | ||
| "search": "*", | ||
| "delete": true | ||
| }, | ||
| <%- if pxe_loader.include?('UEFI') -%> | ||
| { | ||
| "filesystem": { "path": "/boot/efi", "type": "vfat" }, | ||
| "size": "1 GiB" | ||
| }, | ||
| <%- else -%> | ||
| { | ||
| "filesystem": { "path": "/boot/", "type": "ext4" }, | ||
| "size": "2 GiB" | ||
| }, | ||
| <%- end -%> | ||
| { | ||
| "alias": "pv", | ||
| "id": "lvm", | ||
| "size": { "min": "20 GiB" } | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "volumeGroups": [ | ||
| { | ||
| "name": "system", | ||
| "physicalVolumes": [ "pv" ], | ||
| "logicalVolumes": [ | ||
| { | ||
| "filesystem": { "path": "/", "type": "ext4", "name": "root" }, | ||
| "size": { "min": "10 GiB" } | ||
| }, | ||
| { | ||
| "filesystem": { "path": "/var", "type": "ext4", "name": "var" }, | ||
| "size": { "min": "2 GiB", "max": "10 GiB" } | ||
| }, | ||
| { | ||
| "filesystem": { "path": "swap", "type": "swap", "name": "swap" }, | ||
| "size": { "min": "1 GiB", "max": "8 GiB" } | ||
| } | ||
| ] | ||
| } | ||
| ] |
61 changes: 61 additions & 0 deletions
61
app/views/unattended/provisioning_templates/PXEGrub2/agama_default_pxegrub2.erb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| <%# | ||
| kind: PXEGrub2 | ||
| name: Agama default PXEGrub2 | ||
| model: ProvisioningTemplate | ||
| oses: | ||
| - OpenSUSE | ||
| - SLES | ||
| description: | | ||
| The template to render PXEGrub2 bootloader configuration for Agama based distributions. | ||
| The output is deployed on the host's subnet TFTP proxy. | ||
| -%> | ||
| # This file was deployed via '<%= template_name %>' template | ||
| <% | ||
| if !@host.pxe_loader_efi? | ||
| linuxcmd = "linux" | ||
| initrdcmd = "initrd" | ||
| else | ||
| linuxcmd = "linuxefi" | ||
| initrdcmd = "initrdefi" | ||
| end | ||
| kernel_options = snippet('agama_kernel_options').strip | ||
| -%> | ||
|
|
||
| set default=<%= host_param('default_grub_install_entry') || 0 %> | ||
| set timeout=<%= host_param('loader_timeout') || 10 %> | ||
|
|
||
| menuentry '<%= template_name %>' { | ||
| <%= linuxcmd %> <%= @kernel %> <%= kernel_options %> | ||
| <%= initrdcmd %> <%= @initrd %> | ||
| } | ||
|
|
||
| <% | ||
| # Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1811561 and https://bugzilla.redhat.com/show_bug.cgi?id=1842893 | ||
| subnet = @host.provision_interface.subnet || @host.provision_interface.subnet6 | ||
| if subnet && subnet.httpboot | ||
| proxy_http_port = subnet.httpboot.httpboot_http_port | ||
| proxy_https_port = subnet.httpboot.httpboot_https_port | ||
| # Workaround for "no DNS server configured" https://bugzilla.redhat.com/show_bug.cgi?id=1842509 | ||
| proxy_host = dns_lookup(subnet.httpboot.hostname) | ||
| -%> | ||
| <% if proxy_http_port -%> | ||
| menuentry '<%= template_name %> EFI HTTP' --id efi_http { | ||
| <%= linuxcmd %> (http,<%= proxy_host %>:<%= proxy_http_port %>)/httpboot/<%= @kernel %> <%= kernel_options %> | ||
| <%= initrdcmd %> (http,<%= proxy_host %>:<%= proxy_http_port %>)/httpboot/<%= @initrd %> | ||
| } | ||
| <% else -%> | ||
| # Smart proxy does not have HTTPBoot feature with HTTP port enabled, skipping EFI HTTP boot menu entry | ||
| <% end -%> | ||
|
|
||
| <% if proxy_https_port -%> | ||
| menuentry '<%= template_name %> EFI HTTPS' --id efi_https { | ||
| <%= linuxcmd %> (https,<%= proxy_host %>:<%= proxy_https_port %>)/httpboot/<%= @kernel %> <%= kernel_options %> | ||
| <%= initrdcmd %> (https,<%= proxy_host %>:<%= proxy_https_port %>)/httpboot/<%= @initrd %> | ||
| } | ||
| <% else -%> | ||
| # Smart proxy does not have HTTPBoot feature with HTTPS port enabled, skipping EFI HTTPS boot menu entry | ||
| <% end -%> | ||
|
|
||
| <% end %> | ||
|
|
||
| <%= snippet_if_exists(template_name + " custom menu") %> |
15 changes: 15 additions & 0 deletions
15
app/views/unattended/provisioning_templates/PXELinux/agama_default_pxelinux.erb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <%# | ||
| kind: PXELinux | ||
| name: Agama default PXELinux | ||
| model: ProvisioningTemplate | ||
| oses: | ||
| - OpenSUSE | ||
| - SLES | ||
| description: | | ||
| The template to render PXELinux bootloader configuration for SLES and OpenSUSE distributions. | ||
| The output is deployed on the host's subnet TFTP proxy. | ||
| -%> | ||
| DEFAULT linux | ||
| LABEL linux | ||
| KERNEL <%= @kernel %> | ||
| APPEND initrd=<%= @initrd %> <%= snippet("agama_kernel_options").strip %> |
46 changes: 46 additions & 0 deletions
46
app/views/unattended/provisioning_templates/finish/agama_default_finish.erb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| <%# | ||
| kind: finish | ||
| name: Agama default finish | ||
| model: ProvisioningTemplate | ||
| oses: | ||
| - OpenSUSE | ||
| - SLES | ||
| -%> | ||
| <% | ||
| pm_set = @host.puppet_server.present? | ||
| puppet_enabled = pm_set || host_param_true?('force-puppet') | ||
| salt_enabled = host_param('salt_master') ? true : false | ||
| -%> | ||
|
|
||
| /usr/bin/hostnamectl set-hostname <%= @host.name %> | ||
|
|
||
| <%= snippet_if_exists(template_name + " custom pre") -%> | ||
|
|
||
| <%- if plugin_present?('katello') && host_param('kt_activation_keys') -%> | ||
| <%= snippet_if_exists("sles_register") -%> | ||
| <% end -%> | ||
|
|
||
| <%= snippet('remote_execution_ssh_keys') -%> | ||
|
|
||
| <% if plugin_present?('katello') && host_param_true?('enable-remote-execution-pull') -%> | ||
| <%= save_to_file('/root/remote_execution_pull_setup.sh', snippet('remote_execution_pull_setup'), verbatim: true) %> | ||
| chmod +x /root/remote_execution_pull_setup.sh | ||
| /root/remote_execution_pull_setup.sh | ||
| <% end -%> | ||
|
|
||
| <%= snippet "blacklist_kernel_modules" -%> | ||
|
|
||
| <% if puppet_enabled -%> | ||
| <%= snippet 'puppet_setup' -%> | ||
| <% end -%> | ||
|
|
||
| <% if salt_enabled -%> | ||
| <%= snippet 'saltstack_setup' -%> | ||
| <% end -%> | ||
|
|
||
| <%= snippet 'eject_cdrom' -%> | ||
|
|
||
| <%= snippet_if_exists(template_name + " custom post") -%> | ||
|
|
||
| # Mark the build as finished | ||
| <%= snippet 'built' -%> | ||
26 changes: 26 additions & 0 deletions
26
app/views/unattended/provisioning_templates/iPXE/agama_default_ipxe.erb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| #!gpxe | ||
| <%# | ||
| kind: iPXE | ||
| name: Agama default iPXE | ||
| model: ProvisioningTemplate | ||
| oses: | ||
| - SLES | ||
| - OpenSUSE | ||
| description: | | ||
| The template to render iPXE installation script for SLES and OpenSUSE | ||
| The output is deployed on the host's subnet TFTP proxy. | ||
| See https://ipxe.org/scripting for more details | ||
| -%> | ||
| echo Trying to ping Gateway: ${netX/gateway} | ||
| ping --count 1 ${netX/gateway} || echo Ping to Gateway failed or ping command not available. | ||
| echo Trying to ping DNS: ${netX/dns} | ||
| ping --count 1 ${netX/dns} || echo Ping to DNS failed or ping command not available. | ||
|
|
||
| <% boot_files_uris = @host.operatingsystem.boot_files_uri(medium_provider) -%> | ||
| <% kernel = boot_files_uris[0] -%> | ||
| <% initrd = boot_files_uris[1] -%> | ||
|
|
||
| <% subnet = @host.subnet -%> | ||
| kernel <%= kernel %> initrd=initrd.img <%= snippet("agama_kernel_options").strip %> | ||
| initrd <%= initrd %> | ||
| boot |
132 changes: 132 additions & 0 deletions
132
app/views/unattended/provisioning_templates/provision/agama_sles_default.erb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| <%# | ||
| kind: provision | ||
| name: Agama sles default | ||
| model: ProvisioningTemplate | ||
| oses: | ||
| - OpenSUSE | ||
| - SLES | ||
| -%> | ||
| <% | ||
| os_major = @host.operatingsystem.major.to_i | ||
| os_minor = @host.operatingsystem.minor.to_i | ||
| pm_set = @host.puppet_server.present? | ||
| puppet_enabled = pm_set || host_param_true?('force-puppet') | ||
| salt_enabled = host_param('salt_master') ? true : false | ||
| -%> | ||
| { | ||
| "product": { | ||
| "id": "SLES" | ||
| }, | ||
| "hostname": { | ||
| "static": "<%= @host.name %>" | ||
| }, | ||
| "root": { | ||
| "hashedPassword": true, | ||
| "password": "<%= root_pass %>" | ||
| }, | ||
| "localization": { | ||
| "language": "en_US.UTF-8", | ||
| "keyboard": "us", | ||
| "timezone": "<%= host_param('time-zone') || 'Europe/London' %>" | ||
| }, | ||
| "software": { | ||
| "packages": ["openssh", "wget"] | ||
| }, | ||
| "network": { | ||
| "connections": [ | ||
| <%= indent(8, skip1: true) { snippet('agama_network_setup') } %> | ||
| ] | ||
| }, | ||
| "storage": { | ||
| <%= indent(8, skip1: true) { @host.diskLayout } %> | ||
| }, | ||
| "scripts": { | ||
| "post": [ | ||
| { | ||
| "name": "enable-sshd", | ||
| "chroot": true, | ||
| "content": ||| | ||
| #!/usr/bin/bash | ||
| systemctl enable sshd.service | ||
| ||| | ||
| }, | ||
| { | ||
| "name": "eject-cdrom", | ||
| "chroot": true, | ||
| "content": ||| | ||
| # eject bootdisk if this is requested provisioning method | ||
| <%= indent(20, skip1: true) { snippet 'eject_cdrom' } -%> | ||
|
|
||
| ||| | ||
| }, | ||
| { | ||
| "name": "foreman-finish", | ||
| "chroot": true, | ||
| "content": ||| | ||
| #!/usr/bin/bash | ||
| <%- if host_param('http-proxy') -%> | ||
| export http_proxy="http://<%= host_param('http-proxy') %>:<%= host_param('http-proxy-port') -%>" | ||
| <%- if host_param('noproxy') -%> | ||
| export no_proxy="<%= host_param('http-proxy') %> <%= host_param('noproxy') -%>" | ||
| <%- end -%> | ||
| <%- end -%> | ||
| <%= indent(20, skip1: true) { snippet_if_exists(template_name + " custom finish pre") } -%> | ||
| <%- if plugin_present?('katello') && host_param('kt_activation_keys') -%> | ||
| <%= indent(20, skip1: true) { snippet_if_exists("sles_register") } -%> | ||
| <%- end -%> | ||
|
|
||
| <%= indent(20, skip1: true) { snippet "blacklist_kernel_modules" } -%> | ||
|
|
||
| # Fix agama vs puppet/salt cleaning the /etc/resolv.conf | ||
| # https://github.com/agama-project/agama/issues/2911 | ||
| cp /etc/resolv.conf /etc/resolv.conf.backup | ||
|
|
||
| <%- if puppet_enabled -%> | ||
| <%= indent(20, skip1: true) { snippet 'puppet_setup' } -%> | ||
| # Fix agama vs puppet/salt cleaning the /etc/resolv.conf | ||
| # https://github.com/agama-project/agama/issues/2911 | ||
| cat /etc/resolv.conf.backup >/etc/resolv.conf | ||
| <%- end -%> | ||
|
|
||
| <%- if salt_enabled -%> | ||
| <%= indent(20, skip1: true) { snippet 'saltstack_setup' } -%> | ||
| # Fix agama vs puppet/salt cleaning the /etc/resolv.conf | ||
| # https://github.com/agama-project/agama/issues/2911 | ||
| cat /etc/resolv.conf.backup >/etc/resolv.conf | ||
sbernhard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <%- end -%> | ||
|
|
||
| <%= indent(20, skip1: true) { snippet_if_exists(template_name + " custom finish post") } -%> | ||
|
|
||
| rm -f /etc/resolv.conf.backup | ||
| echo "End of foreman-finish script" | ||
| ||| | ||
| }, | ||
| { | ||
| "name": "built", | ||
| "content": ||| | ||
| # Let foreman know that the build is complete | ||
| <%= indent(20, skip1: true) { snippet 'built' } -%> | ||
|
|
||
| ||| | ||
| } | ||
| ], | ||
| "init": [ | ||
| { | ||
| "name": "foreman-init", | ||
| "content": ||| | ||
| #!/usr/bin/bash | ||
| <%= indent(20, skip1: true) { snippet_if_exists(template_name + " custom init pre") } -%> | ||
| <%= indent(20, skip1: true) { snippet('remote_execution_ssh_keys') } -%> | ||
| <%- if plugin_present?('katello') && host_param_true?('enable-remote-execution-pull') -%> | ||
| <%= indent(20, skip1: true) { save_to_file('/root/remote_execution_pull_setup.sh', snippet('remote_execution_pull_setup'), verbatim: true) } %> | ||
| chmod +x /root/remote_execution_pull_setup.sh | ||
| /root/remote_execution_pull_setup.sh | ||
| <%- end -%> | ||
| <%= indent(20, skip1: true) { snippet_if_exists(template_name + " custom init post") } -%> | ||
|
|
||
| echo "End of foreman-init script" | ||
| ||| | ||
| } | ||
| ] | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.