Skip to content
Draft
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .packit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ upstream_tag_template: "{version}"

actions:
post-upstream-clone:
- "wget https://raw.githubusercontent.com/theforeman/foreman-packaging/rpm/develop/packages/foreman/foreman-installer/foreman-installer.spec -O foreman-installer.spec"
- "wget https://raw.githubusercontent.com/evgeni/foreman-packaging/ansible-installer/packages/foreman/foreman-installer/foreman-installer.spec -O foreman-installer.spec"
get-current-version:
- "sed 's/-develop//' VERSION"
create-archive:
Expand Down
4 changes: 2 additions & 2 deletions Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ mod 'theforeman/puppet', :git => 'https://github.com/theforeman/pu

# Top-level katello modules
mod 'katello/foreman_proxy_content', :git => 'https://github.com/theforeman/puppet-foreman_proxy_content'
mod 'katello/certs', :git => 'https://github.com/theforeman/puppet-certs'
mod 'katello/katello', :git => 'https://github.com/theforeman/puppet-katello'
mod 'katello/certs', :git => 'https://github.com/ehelms/puppet-certs', branch: 'add-generate'
mod 'katello/katello', :git => 'https://github.com/theforeman/puppet-katello', branch: 'headless-frankenstein'
53 changes: 52 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ task :modules => "#{BUILDDIR}/modules"
if BUILD_KATELLO
SCENARIOS = ['foreman', 'foreman-proxy-content', 'katello'].freeze
CERTS_SCENARIOS = ['foreman-proxy-certs'].freeze
NEW_CERTS_SCENARIOS = ['foreman-certs'].freeze
else
SCENARIOS = ['foreman'].freeze
CERTS_SCENARIOS = [].freeze
NEW_CERTS_SCENARIOS = [].freeze
end

exporter_dirs = ENV['PATH'].split(':').push('/usr/bin', ENV['KAFO_EXPORTER'])
Expand Down Expand Up @@ -136,6 +138,33 @@ CERTS_SCENARIOS.each do |scenario|
end
end

NEW_CERTS_SCENARIOS.each do |scenario|
config = "foreman_certs/config/#{scenario}.yaml"
file "#{BUILDDIR}/#{scenario}.yaml" => [config, BUILDDIR] do |t|
cp t.prerequisites.first, t.name

scenario_config_replacements = {
'answer_file' => "#{DATADIR}/foreman-installer/foreman-certs/scenarios.d/#{scenario}-answers.yaml",
'installer_dir' => "#{DATADIR}/foreman-installer/foreman-certs",
'log_dir' => "#{LOGDIR}/foreman-installer",
'module_dirs' => "#{DATADIR}/foreman-installer/modules",
'parser_cache_path' => "#{DATADIR}/foreman-installer/parser_cache/#{scenario}.yaml",
}

scenario_config_replacements.each do |setting, value|
sh format('sed -i "s#\(.*%s:\).*#\1 %s#" %s', setting, value, t.name)
end
end

file "#{BUILDDIR}/parser_cache/#{scenario}.yaml" => [config, "#{BUILDDIR}/modules", "#{BUILDDIR}/parser_cache"] do |t|
sh "#{exporter}/kafo-export-params -c #{t.prerequisites.first} -f parsercache --no-parser-cache -o #{t.name}"
end

file "#{BUILDDIR}/#{scenario}-options.asciidoc" => [config, "#{BUILDDIR}/parser_cache/#{scenario}.yaml"] do |t|
sh "#{exporter}/kafo-export-params -c #{t.prerequisites.first} -f asciidoc -o #{t.name}"
end
end

file "#{BUILDDIR}/foreman-installer" => 'bin/foreman-installer' do |t|
cp t.prerequisites[0], t.name
sh format('sed -i "s#\(^.*CONFIG_DIR = \).*#CONFIG_DIR = %s#" %s', "'#{SYSCONFDIR}/foreman-installer/scenarios.d/'", t.name)
Expand All @@ -147,6 +176,11 @@ file "#{BUILDDIR}/foreman-proxy-certs-generate" => 'bin/foreman-proxy-certs-gene
sh format('sed -i "s#^.*\(LAST_SCENARIO_PATH = \).*#\1%s#" %s', "'#{SYSCONFDIR}/foreman-installer/scenarios.d/last_scenario.yaml'", t.name)
end

file "#{BUILDDIR}/foreman-certs" => 'bin/foreman-certs' do |t|
cp t.prerequisites[0], t.name
sh format('sed -i "s#^.*\(CONFIG_DIR = \).*#\1%s#" %s', "'#{DATADIR}/foreman-installer/foreman-certs/scenarios.d/'", t.name)
end

file "#{BUILDDIR}/katello-certs-check" => 'bin/katello-certs-check' do |t|
cp t.prerequisites[0], t.name
end
Expand Down Expand Up @@ -212,6 +246,7 @@ namespace :build do

if BUILD_KATELLO
task :base => [
"#{BUILDDIR}/foreman-certs",
"#{BUILDDIR}/foreman-proxy-certs-generate",
"#{BUILDDIR}/katello-certs-check",
]
Expand All @@ -235,9 +270,16 @@ namespace :build do
"#{BUILDDIR}/parser_cache/#{scenario}.yaml",
]
end].flatten

task :new_certs_scenarios => [NEW_CERTS_SCENARIOS.map do |scenario|
[
"#{BUILDDIR}/#{scenario}.yaml",
"#{BUILDDIR}/parser_cache/#{scenario}.yaml",
]
end].flatten
end

task :build => ['build:base', 'build:scenarios', 'build:certs_scenarios']
task :build => ['build:base', 'build:scenarios', 'build:certs_scenarios', 'build:new_certs_scenarios']

task :install => :build do
mkdir_p "#{DATADIR}/foreman-installer"
Expand All @@ -262,6 +304,14 @@ task :install => :build do
cp "katello_certs/config/#{scenario}-answers.yaml", "#{DATADIR}/foreman-installer/katello-certs/scenarios.d/#{scenario}-answers.yaml"
end

if NEW_CERTS_SCENARIOS.any?
mkdir_p "#{DATADIR}/foreman-installer/foreman-certs/scenarios.d"
end
NEW_CERTS_SCENARIOS.each do |scenario|
cp "#{BUILDDIR}/#{scenario}.yaml", "#{DATADIR}/foreman-installer/foreman-certs/scenarios.d/#{scenario}.yaml"
cp "foreman_certs/config/#{scenario}-answers.yaml", "#{DATADIR}/foreman-installer/foreman-certs/scenarios.d/#{scenario}-answers.yaml"
end

cp_r "#{BUILDDIR}/modules", "#{DATADIR}/foreman-installer", :preserve => true
cp_r "#{BUILDDIR}/parser_cache", "#{DATADIR}/foreman-installer"

Expand All @@ -272,6 +322,7 @@ task :install => :build do
install "#{BUILDDIR}/foreman-installer", "#{SBINDIR}/foreman-installer", :mode => 0o755, :verbose => true

if BUILD_KATELLO
install "#{BUILDDIR}/foreman-certs", "#{SBINDIR}/foreman-certs", :mode => 0o755, :verbose => true
install "#{BUILDDIR}/foreman-proxy-certs-generate", "#{SBINDIR}/foreman-proxy-certs-generate", :mode => 0o755, :verbose => true
install "#{BUILDDIR}/katello-certs-check", "#{SBINDIR}/katello-certs-check", :mode => 0o755, :verbose => true
end
Expand Down
9 changes: 9 additions & 0 deletions bin/foreman-certs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env ruby
require 'rubygems'
require 'kafo'

CONFIG_DIR = './foreman_certs/config/'.freeze
LAST_SCENARIO_PATH = './config/last_scenario.yaml'.freeze

@result = Kafo::KafoConfigure.run
exit((@result.nil? || @result.exit_code == 2) ? 0 : @result.exit_code)
74 changes: 0 additions & 74 deletions config/katello-answers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,78 +9,6 @@
#
# See params.pp in each class for what options are available
---
certs:
group: foreman
foreman:
client_ssl_ca: /etc/foreman/proxy_ca.pem
client_ssl_cert: /etc/foreman/client_cert.pem
client_ssl_key: /etc/foreman/client_key.pem
initial_location: Default Location
initial_organization: Default Organization
server_ssl_ca: /etc/pki/katello/certs/katello-default-ca.crt
server_ssl_cert: /etc/pki/katello/certs/katello-apache.crt
server_ssl_chain: /etc/pki/katello/certs/katello-server-ca.crt
server_ssl_crl: ""
server_ssl_key: /etc/pki/katello/private/katello-apache.key
foreman::cli: true
foreman::cli::ansible: false
foreman::cli::azure: false
foreman::cli::bootdisk: false
foreman::cli::discovery: false
foreman::cli::google: false
foreman::cli::katello: true
foreman::cli::kubevirt: false
foreman::cli::openscap: false
foreman::cli::puppet: false
foreman::cli::remote_execution: true
foreman::cli::resource_quota: false
foreman::cli::rh_cloud: false
foreman::cli::ssh: false
foreman::cli::tasks: false
foreman::cli::templates: false
foreman::cli::virt_who_configure: false
foreman::cli::webhooks: false
foreman::compute::ec2: false
foreman::compute::libvirt: false
foreman::compute::openstack: false
foreman::compute::ovirt: false
foreman::compute::vmware: false
foreman::plugin::acd: false
foreman::plugin::ansible: false
foreman::plugin::azure: false
foreman::plugin::bootdisk: false
foreman::plugin::default_hostgroup: false
foreman::plugin::dhcp_browser: false
foreman::plugin::discovery: false
foreman::plugin::dlm: false
foreman::plugin::expire_hosts: false
foreman::plugin::git_templates: false
foreman::plugin::google: false
foreman::plugin::hdm: false
foreman::plugin::kernel_care: false
foreman::plugin::kubevirt: false
foreman::plugin::leapp: false
foreman::plugin::monitoring: false
foreman::plugin::netbox: false
foreman::plugin::openscap: false
foreman::plugin::proxmox: false
foreman::plugin::puppet: false
foreman::plugin::puppetdb: false
foreman::plugin::remote_execution: true
foreman::plugin::remote_execution::cockpit: false
foreman::plugin::rescue: false
foreman::plugin::resource_quota: false
foreman::plugin::rh_cloud: false
foreman::plugin::salt: false
foreman::plugin::scc_manager: false
foreman::plugin::snapshot_management: false
foreman::plugin::statistics: false
foreman::plugin::tasks: true
foreman::plugin::templates: false
foreman::plugin::vault: false
foreman::plugin::virt_who_configure: false
foreman::plugin::webhooks: false
foreman::plugin::wreckingball: false
foreman_proxy:
foreman_ssl_ca: /etc/foreman-proxy/foreman_ssl_ca.pem
foreman_ssl_cert: /etc/foreman-proxy/foreman_ssl_cert.pem
Expand All @@ -106,7 +34,5 @@ foreman_proxy::plugin::openscap: false
foreman_proxy::plugin::remote_execution::script: false
foreman_proxy::plugin::salt: false
foreman_proxy::plugin::shellhooks: false
foreman_proxy_content: true
katello: true
puppet: false
apache::mod::status: false
3 changes: 3 additions & 0 deletions config/katello.migrations/250226000000-frankenstein.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
answers.delete_if do |key, _value|
['foreman', 'foreman_proxy_content', 'apache::mod::status'].include?(key) || key.start_with?('foreman::')
end
4 changes: 0 additions & 4 deletions config/katello.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@
tuning: 'default'

:order:
- certs
- foreman
- katello
- foreman_proxy
- foreman_proxy::plugin::pulp
- foreman_proxy_content
- puppet

# If using the Debian ruby-kafo package, uncomment this
Expand Down
7 changes: 7 additions & 0 deletions foreman_certs/config/foreman-certs-answers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
certs:
generate: true
regenerate: true
deploy: false
group: foreman
ssl_build_dir: /home/ehelms/workspace/upstream/installer/foreman-installer/_ssl_build
certs::generate: true
27 changes: 27 additions & 0 deletions foreman_certs/config/foreman-certs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
:answer_file: "./foreman_certs/config/foreman-certs-answers.yaml"
:color_of_background: :dark
:colors: true
:custom: {}
:description: Generate Foreman certificates
:dont_save_answers: true
:enabled: true
:facts: {}
:hook_dirs: []
:installer_dir: "./foreman_certs"
:log_dir: "./_build/"
:log_level: :debug
:log_name: foreman-certs.log
:low_priority_modules: []
:mapping: {}
:module_dirs: "./_build/modules"
:name: foreman-certs
:no_prefix: true
:order:
- certs
- certs::generate
:parser_cache_path: "./_build/parser_cache/foreman-certs.yaml"
:skip_puppet_version_check: false
:store_dir: ''
:verbose: false
:verbose_log_level: debug
11 changes: 0 additions & 11 deletions hooks/pre/33-pulpcore_assets_permissions.rb

This file was deleted.

13 changes: 0 additions & 13 deletions hooks/pre/34-pulpcore_directory_layout.rb

This file was deleted.

2 changes: 1 addition & 1 deletion hooks/pre_commit/13-tuning.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
EXIT_INSUFFICIENT_MEMORY = 103

current_tuning = get_custom_fact(TUNING_FACT)
if module_enabled?('foreman')
if module_enabled?('foreman') || module_enabled?('katello')
new_tuning = app_value(:tuning)
else
new_tuning = current_tuning
Expand Down
12 changes: 0 additions & 12 deletions hooks/pre_commit/33-pulpcore_assets_permissions.rb

This file was deleted.

Loading