diff --git a/.fixtures.yml b/.fixtures.yml
index 0dff5ed6..1ec5f595 100644
--- a/.fixtures.yml
+++ b/.fixtures.yml
@@ -19,7 +19,9 @@ fixtures:
certs: "https://github.com/theforeman/puppet-certs.git"
qpid: "https://github.com/theforeman/puppet-qpid.git"
pulp: "https://github.com/theforeman/puppet-pulp.git"
- pulpcore: "https://github.com/theforeman/puppet-pulpcore.git"
+ pulpcore:
+ repo: "https://github.com/ekohl/puppet-pulpcore.git"
+ branch: "apache-management"
postgresql: "https://github.com/puppetlabs/puppetlabs-postgresql"
redis: "https://github.com/voxpupuli/puppet-redis"
mongodb: "https://github.com/voxpupuli/puppet-mongodb.git"
diff --git a/manifests/init.pp b/manifests/init.pp
index 87154c88..29da2b3c 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -187,6 +187,9 @@
$foreman_url = $foreman_proxy::foreman_base_url
$reverse_proxy_real = $pulp or $reverse_proxy
+ # TODO: doesn't allow deploying a Pulp non-mirror without Foreman
+ $shared_with_foreman_vhost = ($pulpcore and !$pulpcore_mirror) or $pulp_master
+
$rhsm_port = $reverse_proxy_real ? {
true => $reverse_proxy_port,
false => 443
@@ -331,13 +334,33 @@
}
}
- if $pulpcore and !$pulpcore_mirror {
- include foreman::config::apache
+ if $pulpcore {
+ if $shared_with_foreman_vhost {
+ include foreman::config::apache
+ $servername = $foreman::config::apache::servername
+ $priority = $foreman::config::apache::priority
+ $apache_http_vhost = 'foreman'
+ $apache_https_vhost = 'foreman-ssl'
+ Class['foreman::config::apache'] -> Class['pulpcore::apache']
+ } elsif $pulp and $pulp::manage_httpd {
+ $servername = $facts['networking']['fqdn']
+ $priority = '05'
+ $apache_http_vhost = 'pulp-http'
+ $apache_https_vhost = 'pulp-https'
+ Class['pulp::apache'] -> Class['pulpcore::apache']
+ } else {
+ $servername = undef
+ $priority = undef
+ $apache_http_vhost = undef
+ $apache_https_vhost = undef
+ }
class { 'pulpcore':
- remote_user_environ_name => 'HTTP_REMOTE_USER',
- manage_apache => false,
- servername => $foreman::config::apache::servername,
+ apache_http_vhost => $apache_http_vhost,
+ apache_https_vhost => $apache_https_vhost,
+ apache_vhost_priority => $priority,
+ servername => $servername,
+ static_url => '/pulp/assets/',
postgresql_manage_db => $pulpcore_manage_postgresql,
postgresql_db_host => $pulpcore_postgresql_host,
postgresql_db_port => $pulpcore_postgresql_port,
@@ -370,32 +393,13 @@
}
include pulpcore::plugin::container
- include pulpcore::plugin::file
- include pulpcore::plugin::rpm
- include pulpcore::plugin::certguard
-
- foreman::config::apache::fragment { 'pulpcore':
- content => template('foreman_proxy_content/pulpcore-content-apache.conf.erb'),
- ssl_content => template(
- 'foreman_proxy_content/pulpcore-api-apache.conf.erb',
- 'foreman_proxy_content/pulpcore-content-apache.conf.erb',
- 'foreman_proxy_content/pulpcore-docker-apache.conf.erb'
- ),
- }
-
- if $proxy_pulp_isos_to_pulpcore {
- foreman::config::apache::fragment { 'pulpcore-isos':
- content => template('foreman_proxy_content/pulpcore-isos-apache.conf.erb'),
- ssl_content => template('foreman_proxy_content/pulpcore-isos-apache.conf.erb'),
- }
+ class { 'pulpcore::plugin::file':
+ use_pulp2_content_route => $proxy_pulp_isos_to_pulpcore,
}
-
- if $proxy_pulp_yum_to_pulpcore {
- foreman::config::apache::fragment { 'pulpcore-yum':
- content => template('foreman_proxy_content/pulpcore-yum-apache.conf.erb'),
- ssl_content => template('foreman_proxy_content/pulpcore-yum-apache.conf.erb'),
- }
+ class { 'pulpcore::plugin::rpm':
+ use_pulp2_content_route => $proxy_pulp_yum_to_pulpcore,
}
+ include pulpcore::plugin::certguard
}
if $puppet {
diff --git a/manifests/pub_dir.pp b/manifests/pub_dir.pp
index b9d49a60..e5cabfa7 100644
--- a/manifests/pub_dir.pp
+++ b/manifests/pub_dir.pp
@@ -16,7 +16,7 @@
ensure_packages('katello-client-bootstrap')
- if ($foreman_proxy_content::pulpcore or $foreman_proxy_content::pulp_master) {
+ if $foreman_proxy_content::shared_with_foreman_vhost {
include foreman::config::apache
foreman::config::apache::fragment { 'pub_dir':
diff --git a/spec/classes/foreman_proxy_content_spec.rb b/spec/classes/foreman_proxy_content_spec.rb
index ae200d19..f700a7e3 100644
--- a/spec/classes/foreman_proxy_content_spec.rb
+++ b/spec/classes/foreman_proxy_content_spec.rb
@@ -71,17 +71,11 @@ class { 'foreman_proxy::plugin::pulp':
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('foreman_proxy_content::pub_dir') }
- it { is_expected.to contain_class('pulpcore').with(manage_apache: false).that_comes_before('Class[foreman_proxy::plugin::pulp]') }
-
it do
- is_expected.to contain_foreman__config__apache__fragment('pulpcore')
- .with_ssl_content(%r{ProxyPass /pulp/api/v3 http://127\.0\.0\.1:24817/pulp/api/v3})
- .with_ssl_content(%r{ProxyPass /pulp/content http://127\.0\.0\.1:24816/pulp/content})
- .with_ssl_content(%r{ProxyPass /pulpcore_registry/v2/ http://127\.0\.0\.1:24817/v2/})
- .with_ssl_content(%r{ProxyPass /pulp/container/ http://127\.0\.0\.1:24816/pulp/container/})
- .with_content(%r{ProxyPass /pulp/content http://127\.0\.0\.1:24816/pulp/content})
- is_expected.to contain_foreman__config__apache__fragment('pulpcore-isos')
- .with_content(%r{ProxyPass /pulp/isos http://127\.0\.0\.1:24816/pulp/content})
+ is_expected.to contain_class('pulpcore')
+ .with(apache_http_vhost: 'foreman')
+ .with(apache_https_vhost: 'foreman-ssl')
+ .that_comes_before('Class[foreman_proxy::plugin::pulp]')
end
end
@@ -182,7 +176,7 @@ class { 'foreman_proxy::plugin::pulp':
end
it { is_expected.to compile.with_all_deps }
- it { is_expected.to contain_class('pulpcore').with(manage_apache: false) }
+ it { is_expected.to contain_class('pulpcore') }
it do
is_expected.to contain_class('pulpcore::plugin::migration')
diff --git a/templates/pulpcore-api-apache.conf.erb b/templates/pulpcore-api-apache.conf.erb
deleted file mode 100644
index e289bc44..00000000
--- a/templates/pulpcore-api-apache.conf.erb
+++ /dev/null
@@ -1,7 +0,0 @@
- ProxyPass <%= scope['pulpcore::apache::api_path'] %> <%= scope['pulpcore::apache::api_url'] %>
- ProxyPassReverse <%= scope['pulpcore::apache::api_path'] %> <%= scope['pulpcore::apache::api_url'] %>
-
- >
- RequestHeader set REMOTE_USER ""
- RequestHeader set REMOTE_USER "%{SSL_CLIENT_S_DN_CN}s" env=SSL_CLIENT_S_DN
-
diff --git a/templates/pulpcore-content-apache.conf.erb b/templates/pulpcore-content-apache.conf.erb
deleted file mode 100644
index 5f0df325..00000000
--- a/templates/pulpcore-content-apache.conf.erb
+++ /dev/null
@@ -1,7 +0,0 @@
-ProxyPass <%= scope['pulpcore::apache::content_path'] %> <%= scope['pulpcore::apache::content_url'] %>
-ProxyPassReverse <%= scope['pulpcore::apache::content_path'] %> <%= scope['pulpcore::apache::content_url'] %>
-
->
-RequestHeader unset X-CLIENT-CERT
-RequestHeader set X-CLIENT-CERT "%{SSL_CLIENT_CERT}s"
-
diff --git a/templates/pulpcore-docker-apache.conf.erb b/templates/pulpcore-docker-apache.conf.erb
deleted file mode 100644
index 3d864ed4..00000000
--- a/templates/pulpcore-docker-apache.conf.erb
+++ /dev/null
@@ -1,10 +0,0 @@
-
- RequestHeader set REMOTE_USER ""
- RequestHeader set REMOTE_USER "%{SSL_CLIENT_S_DN_CN}s" env=SSL_CLIENT_S_DN
-
-
-ProxyPass /pulpcore_registry/v2/ http://<%= scope['pulpcore::api_host'] %>:<%= scope['pulpcore::api_port']%>/v2/
-ProxyPassReverse /pulpcore_registry/v2/ http://<%= scope['pulpcore::api_host'] %>:<%= scope['pulpcore::api_port'] %>/v2/
-
-ProxyPass /pulp/container/ http://<%= scope['pulpcore::content_host'] %>:<%= scope['pulpcore::content_port']%>/pulp/container/
-ProxyPassReverse /pulp/container/ http://<%= scope['pulpcore::content_host'] %>:<%= scope['pulpcore::content_port'] %>/pulp/container
diff --git a/templates/pulpcore-isos-apache.conf.erb b/templates/pulpcore-isos-apache.conf.erb
deleted file mode 100644
index 5760e0e6..00000000
--- a/templates/pulpcore-isos-apache.conf.erb
+++ /dev/null
@@ -1,7 +0,0 @@
-ProxyPass /pulp/isos <%= scope['pulpcore::apache::content_url'] %>
-ProxyPassReverse /pulp/isos <%= scope['pulpcore::apache::content_url'] %>
-
-
-RequestHeader unset X-CLIENT-CERT
-RequestHeader set X-CLIENT-CERT "%{SSL_CLIENT_CERT}s"
-
diff --git a/templates/pulpcore-yum-apache.conf.erb b/templates/pulpcore-yum-apache.conf.erb
deleted file mode 100644
index d0b0fc6a..00000000
--- a/templates/pulpcore-yum-apache.conf.erb
+++ /dev/null
@@ -1,7 +0,0 @@
-ProxyPass /pulp/repos <%= scope['pulpcore::apache::content_url'] %>
-ProxyPassReverse /pulp/repos <%= scope['pulpcore::apache::content_url'] %>
-
-
-RequestHeader unset X-CLIENT-CERT
-RequestHeader set X-CLIENT-CERT "%{SSL_CLIENT_CERT}s"
-