Showing with 200 additions and 277 deletions.
  1. +16 −0 CHANGELOG.md
  2. +1 −1 Gemfile
  3. +2 −0 README.md
  4. +7 −25 manifests/config.pp
  5. +4 −0 manifests/globals.pp
  6. +9 −22 manifests/init.pp
  7. +1 −1 manifests/install.pp
  8. +15 −32 manifests/params.pp
  9. +3 −3 manifests/plugin.pp
  10. +1 −1 manifests/plugin/ansible.pp
  11. +1 −1 manifests/plugin/ansible/params.pp
  12. +1 −9 manifests/plugin/ansible/runner.pp
  13. +2 −2 manifests/plugin/discovery.pp
  14. +1 −1 manifests/plugin/dns/powerdns.pp
  15. +1 −2 manifests/plugin/pulp.pp
  16. +0 −1 manifests/plugin/remote_execution/script.pp
  17. +1 −2 manifests/plugin/remote_execution/ssh_user.pp
  18. +1 −2 manifests/plugin/remote_execution/ssh_user/params.pp
  19. +2 −2 manifests/plugin/salt.pp
  20. +19 −17 manifests/proxydhcp.pp
  21. +15 −12 manifests/proxydns.pp
  22. +3 −3 manifests/remote_file.pp
  23. +1 −1 manifests/settings_file.pp
  24. +1 −1 manifests/tftp.pp
  25. +1 −1 manifests/tftp/netboot.pp
  26. +1 −10 metadata.json
  27. +1 −2 spec/acceptance/journald_spec.rb
  28. +1 −4 spec/classes/foreman_proxy__plugin__ansible_spec.rb
  29. +8 −2 spec/classes/foreman_proxy__plugin__dns__powerdns_spec.rb
  30. +25 −22 spec/classes/foreman_proxy__proxydhcp__spec.rb
  31. +21 −21 spec/classes/foreman_proxy__proxydns__spec.rb
  32. +17 −40 spec/classes/foreman_proxy__spec.rb
  33. +10 −10 spec/defines/foreman_proxy_plugin_spec.rb
  34. +2 −0 spec/spec_helper.rb
  35. +1 −1 spec/spec_helper_acceptance.rb
  36. +2 −2 spec/support/plugin.rb
  37. +2 −2 templates/puppetca.yml.erb
  38. +0 −2 templates/sudo.erb
  39. +0 −17 templates/sudo_augeas.erb
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## [23.0.0](https://github.com/theforeman/puppet-foreman_proxy/tree/23.0.0) (2022-08-04)

[Full Changelog](https://github.com/theforeman/puppet-foreman_proxy/compare/22.1.3...23.0.0)

**Breaking changes:**

- Refs [\#35184](https://projects.theforeman.org/issues/35184) - Drop puppetca\_http\_api provider [\#768](https://github.com/theforeman/puppet-foreman_proxy/pull/768) ([ekohl](https://github.com/ekohl))
- Drop EL7 support [\#767](https://github.com/theforeman/puppet-foreman_proxy/pull/767) ([ekohl](https://github.com/ekohl))
- drop support for Debian 10 Buster [\#766](https://github.com/theforeman/puppet-foreman_proxy/pull/766) ([evgeni](https://github.com/evgeni))

**Implemented enhancements:**

- Use modern networking facts & correct data types on IPs [\#764](https://github.com/theforeman/puppet-foreman_proxy/pull/764) ([ekohl](https://github.com/ekohl))
- Update to voxpupuli-test 5 [\#763](https://github.com/theforeman/puppet-foreman_proxy/pull/763) ([ekohl](https://github.com/ekohl))
- add foreman::shell param [\#742](https://github.com/theforeman/puppet-foreman_proxy/pull/742) ([jhoblitt](https://github.com/jhoblitt))

## [22.1.3](https://github.com/theforeman/puppet-foreman_proxy/tree/22.1.3) (2022-05-11)

[Full Changelog](https://github.com/theforeman/puppet-foreman_proxy/compare/22.1.2...22.1.3)
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ gem 'puppet-lint-param-docs', '>= 1.3.0', {"groups"=>["test"]}
gem 'puppet-lint-spaceship_operator_without_tag-check', {"groups"=>["test"]}
gem 'puppet-lint-strict_indent-check', {"groups"=>["test"]}
gem 'puppet-lint-undef_in_function-check', {"groups"=>["test"]}
gem 'voxpupuli-test', '~> 1.4', {"groups"=>["test"]}
gem 'voxpupuli-test', '~> 5.0', {"groups"=>["test"]}
gem 'github_changelog_generator', '>= 1.15.0', {"groups"=>["development"]}
gem 'puppet_metadata', '~> 1.3'
gem 'puppet-blacksmith', '>= 6.0.0', {"groups"=>["development"]}
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Part of the Foreman installer: <https://github.com/theforeman/foreman-installer>

| Module version | Proxy versions | Notes |
|----------------|----------------|-----------------------------------------------------|
| 23.x | 3.4 and newer | See compatibility notes in its README for 3.1-3.3 |
| 22.x | 3.3 and newer | See compatibility notes in its README for 3.1-3.3 |
| 21.x | 3.1 and 3.2 | |
| 20.x | 3.1 and 3.2 | See compatibility notes in its README for 2.3-3.0 |
Expand All @@ -26,6 +27,7 @@ Part of the Foreman installer: <https://github.com/theforeman/foreman-installer>
| 2.x | 1.5 - 1.10 | |
| 1.x | 1.4 and older | |

* 23.x dropped EL7 support. 3.1 and newer work on EL8.
* 22.x renamed foreman_proxy::plugin::remote_execution::ssh to foreman_proxy::plugin::remote_execution::script as the feature within the plugin has changed from SSH to Script.
* 20.x started to register as a Smart Proxy host. This requires Foreman 3.1. When using an older Foreman, set `$register_in_foreman` to false. This does require manual registration then.
* 18.x switched to running `smart_proxy_dynflow` as part of `foreman-proxy` service by default. On EL* distributions and Foreman < 2.5, `foreman_proxy::plugin::dynflow::external_core` needs to be explicitly set to `true`.
Expand Down
32 changes: 7 additions & 25 deletions manifests/config.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# @summary Configure the foreman proxy
# @api private
class foreman_proxy::config {

# Ensure SSL certs from the puppetmaster are available
# Relationship is duplicated there as defined() is parse-order dependent
if $foreman_proxy::ssl and defined(Class['puppet::server::config']) {
Expand Down Expand Up @@ -90,7 +89,11 @@
contain foreman_proxy::module::puppetca
foreman_proxy::provider { ['puppetca_hostname_whitelisting', 'puppetca_token_whitelisting']:
}
foreman_proxy::provider { ['puppetca_http_api', 'puppetca_puppet_cert']:
foreman_proxy::provider { 'puppetca_http_api':
}
# Foreman Proxy 3.4 dropped puppetca_puppet_cert
foreman_proxy::provider { 'puppetca_puppet_cert':
ensure => absent,
}

contain foreman_proxy::module::realm
Expand All @@ -105,29 +108,8 @@

contain foreman_proxy::module::registration

if $foreman_proxy::puppetca or $foreman_proxy::puppet {
$uses_sudo = $foreman_proxy::puppetca and versioncmp($facts['puppetversion'], '6.0') < 0

if $foreman_proxy::use_sudoersd {
if $uses_sudo and $foreman_proxy::manage_sudoersd {
ensure_resource('file', "${foreman_proxy::sudoers}.d", {'ensure' => 'directory'})
}

file { "${foreman_proxy::sudoers}.d/foreman-proxy":
ensure => bool2str($uses_sudo, 'file', 'absent'),
owner => 'root',
group => 0,
mode => '0440',
content => template('foreman_proxy/sudo.erb'),
}
} elsif $foreman_proxy::use_sudoers {
augeas { 'sudo-foreman-proxy':
context => "/files${foreman_proxy::sudoers}",
changes => template('foreman_proxy/sudo_augeas.erb'),
}
}
} else {
# The puppet-agent (puppet 4 AIO package) doesn't create a puppet user and group
unless $foreman_proxy::puppetca or $foreman_proxy::puppet {
# The puppet-agent doesn't create a puppet user and group
# but the foreman proxy still needs to be able to read the agent's private key
if $foreman_proxy::manage_puppet_group and $foreman_proxy::ssl {
if !defined(Group[$foreman_proxy::puppet_group]) {
Expand Down
4 changes: 4 additions & 0 deletions manifests/globals.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@
# @param tftp_syslinux_filenames
# Syslinux files to install on TFTP (full paths)
#
# @param shell
# Shell of foreman-proxy user
#
class foreman_proxy::globals (
Optional[String] $user = undef,
Optional[String] $group = undef,
Optional[Stdlib::Absolutepath] $dir = undef,
Enum['latest', 'present', 'installed', 'absent'] $plugin_version = 'installed',
Optional[Array[Stdlib::Absolutepath]] $tftp_syslinux_filenames = undef,
Optional[Stdlib::Absolutepath] $shell = undef,
) {
}
31 changes: 9 additions & 22 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@
#
# $trusted_hosts:: Only hosts listed will be permitted, empty array to disable authorization
#
# $manage_sudoersd:: Whether to manage File['/etc/sudoers.d'] or not. When reusing this module, this may be
# disabled to let a dedicated sudo module manage it instead.
#
# $use_sudoersd:: Add a file to /etc/sudoers.d (true).
#
# $use_sudoers:: Add contents to /etc/sudoers (true). This is ignored if $use_sudoersd is true.
#
# $puppetca:: Enable Puppet CA feature
#
# $puppetca_listen_on:: Protocols for the Puppet CA feature to listen on
Expand All @@ -65,8 +58,6 @@
#
# $puppetdir:: Puppet var directory
#
# $puppetca_cmd:: Puppet CA command to be allowed in sudoers
#
# $puppet_group:: Groups of Foreman proxy user
#
# $autosignfile:: Hostname-Whitelisting only: Location of puppets autosign.conf
Expand Down Expand Up @@ -308,14 +299,10 @@
Array[String] $trusted_hosts = $foreman_proxy::params::trusted_hosts,
Array[String] $ssl_disabled_ciphers = [],
Array[String] $tls_disabled_versions = [],
Boolean $manage_sudoersd = true,
Boolean $use_sudoersd = true,
Boolean $use_sudoers = true,
Boolean $puppetca = true,
Foreman_proxy::ListenOn $puppetca_listen_on = 'https',
Stdlib::Absolutepath $ssldir = $foreman_proxy::params::ssldir,
Stdlib::Absolutepath $puppetdir = $foreman_proxy::params::puppetdir,
String $puppetca_cmd = $foreman_proxy::params::puppetca_cmd,
String $puppet_group = 'puppet',
String $puppetca_provider = 'puppetca_hostname_whitelisting',
Stdlib::Absolutepath $autosignfile = $foreman_proxy::params::autosignfile,
Expand Down Expand Up @@ -360,12 +347,12 @@
Array[String] $dhcp_additional_interfaces = [],
Optional[String] $dhcp_gateway = undef,
Variant[Undef, Boolean, String] $dhcp_range = undef,
Optional[String] $dhcp_pxeserver = undef,
Optional[Stdlib::IP::Address::V4::Nosubnet] $dhcp_pxeserver = undef,
String $dhcp_pxefilename = 'pxelinux.0',
Optional[String[1]] $dhcp_ipxefilename = undef,
Boolean $dhcp_ipxe_bootstrap = false,
Optional[String] $dhcp_network = undef,
Optional[String] $dhcp_netmask = undef,
Optional[Stdlib::IP::Address::V4::Nosubnet] $dhcp_network = undef,
Optional[Stdlib::IP::Address::V4::Nosubnet] $dhcp_netmask = undef,
String $dhcp_nameservers = 'default',
String $dhcp_server = '127.0.0.1',
Stdlib::Absolutepath $dhcp_config = $foreman_proxy::params::dhcp_config,
Expand All @@ -376,12 +363,12 @@
Optional[String] $dhcp_peer_address = undef,
Enum['standalone', 'primary', 'secondary'] $dhcp_node_type = 'standalone',
Optional[String] $dhcp_failover_address = $foreman_proxy::params::dhcp_failover_address,
Optional[Stdlib::Port] $dhcp_failover_port = 519,
Optional[Integer[0]] $dhcp_max_response_delay = 30,
Optional[Integer[0]] $dhcp_max_unacked_updates = 10,
Optional[Integer[0]] $dhcp_mclt = 300,
Optional[Integer[0, 255]] $dhcp_load_split = 255,
Optional[Integer[0]] $dhcp_load_balance = 3,
Stdlib::Port $dhcp_failover_port = 519,
Integer[0] $dhcp_max_response_delay = 30,
Integer[0] $dhcp_max_unacked_updates = 10,
Integer[0] $dhcp_mclt = 300,
Integer[0, 255] $dhcp_load_split = 255,
Integer[0] $dhcp_load_balance = 3,
Boolean $dhcp_manage_acls = $foreman_proxy::params::dhcp_manage_acls,
Boolean $dns = false,
Foreman_proxy::ListenOn $dns_listen_on = 'https',
Expand Down
2 changes: 1 addition & 1 deletion manifests/install.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# @summary Install the foreman proxy
# @api private
class foreman_proxy::install {
package {'foreman-proxy':
package { 'foreman-proxy':
ensure => $foreman_proxy::version,
}

Expand Down
47 changes: 15 additions & 32 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@

case $facts['os']['family'] {
'RedHat': {
if versioncmp($facts['os']['release']['major'], '7') <= 0 {
$ruby_package_prefix = 'tfm-rubygem-'
} else {
$ruby_package_prefix = 'rubygem-'
}
$ruby_package_prefix = 'rubygem-'
$plugin_prefix = "${ruby_package_prefix}smart_proxy_"

$dir = pick($foreman_proxy::globals::dir, '/usr/share/foreman-proxy')
$etc = '/etc'
$shell = '/bin/false'
$shell = pick($foreman_proxy::globals::shell, '/bin/false')
$user = pick($foreman_proxy::globals::user, 'foreman-proxy')
$group = pick($foreman_proxy::globals::group, 'foreman-proxy')

Expand All @@ -25,34 +21,24 @@
$keyfile = '/etc/rndc.key'
$nsupdate = 'bind-utils'

if versioncmp($facts['os']['release']['major'], '7') <= 0 {
$_tftp_syslinux_filenames = [
'/usr/share/syslinux/chain.c32',
'/usr/share/syslinux/mboot.c32',
'/usr/share/syslinux/menu.c32',
'/usr/share/syslinux/memdisk',
'/usr/share/syslinux/pxelinux.0',
]
} else {
$_tftp_syslinux_filenames = [
'/usr/share/syslinux/chain.c32',
'/usr/share/syslinux/ldlinux.c32',
'/usr/share/syslinux/libcom32.c32',
'/usr/share/syslinux/libutil.c32',
'/usr/share/syslinux/mboot.c32',
'/usr/share/syslinux/menu.c32',
'/usr/share/syslinux/memdisk',
'/usr/share/syslinux/pxelinux.0',
]
}
$_tftp_syslinux_filenames = [
'/usr/share/syslinux/chain.c32',
'/usr/share/syslinux/ldlinux.c32',
'/usr/share/syslinux/libcom32.c32',
'/usr/share/syslinux/libutil.c32',
'/usr/share/syslinux/mboot.c32',
'/usr/share/syslinux/menu.c32',
'/usr/share/syslinux/memdisk',
'/usr/share/syslinux/pxelinux.0',
]
}
'Debian': {
$ruby_package_prefix = 'ruby-'
$plugin_prefix = "${ruby_package_prefix}smart-proxy-"

$dir = pick($foreman_proxy::globals::dir, '/usr/share/foreman-proxy')
$etc = '/etc'
$shell = '/bin/false'
$shell = pick($foreman_proxy::globals::shell, '/bin/false')
$user = pick($foreman_proxy::globals::user, 'foreman-proxy')
$group = pick($foreman_proxy::globals::group, 'foreman-proxy')

Expand Down Expand Up @@ -80,7 +66,7 @@

$dir = pick($foreman_proxy::globals::dir, '/usr/local/share/foreman-proxy')
$etc = '/usr/local/etc'
$shell = '/usr/bin/false'
$shell = pick($foreman_proxy::globals::shell, '/usr/bin/false')
$user = pick($foreman_proxy::globals::user, 'foreman_proxy')
$group = pick($foreman_proxy::globals::group, 'foreman_proxy')

Expand Down Expand Up @@ -144,13 +130,10 @@
# Only hosts listed will be permitted, empty array to disable authorization
$trusted_hosts = [$lower_fqdn]

$sudoers = "${etc}/sudoers"

# puppet settings
$puppet_url = "https://${facts['networking']['fqdn']}:8140"

# puppetca settings
$puppetca_cmd = "${puppet_cmd} cert"
$autosignfile = "${puppetdir}/autosign.conf"

# Template settings
Expand All @@ -166,7 +149,7 @@
} else {
$dhcp_option_domain = []
}
$dhcp_failover_address = fact('ipaddress')
$dhcp_failover_address = fact('networking.ip')

# DNS settings - requires optional DNS puppet module
$dns_interface = pick(fact('networking.primary'), 'eth0')
Expand Down
6 changes: 3 additions & 3 deletions manifests/plugin.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# @param package
# The package to install. Underscores are replaced with dashes on Debian
#
define foreman_proxy::plugin(
$version = $foreman_proxy::params::plugin_version,
$package = "${foreman_proxy::params::plugin_prefix}${title}",
define foreman_proxy::plugin (
String[1] $version = $foreman_proxy::params::plugin_version,
String[1] $package = "${foreman_proxy::params::plugin_prefix}${title}",
) {
# Debian gem2deb converts underscores to hyphens
case $facts['os']['family'] {
Expand Down
2 changes: 1 addition & 1 deletion manifests/plugin/ansible.pp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
$foreman_ssl_ca = pick($foreman_proxy::foreman_ssl_ca, $foreman_proxy::ssl_ca)
$proxy_url = $foreman_proxy::real_registered_proxy_url

file {"${foreman_proxy::config_dir}/ansible.cfg":
file { "${foreman_proxy::config_dir}/ansible.cfg":
ensure => file,
content => template('foreman_proxy/plugin/ansible.cfg.erb'),
owner => 'root',
Expand Down
2 changes: 1 addition & 1 deletion manifests/plugin/ansible/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
} else {
$callback = 'foreman'
}
$manage_runner_repo = true
$manage_runner_repo = false
$runner_package_name = 'python3-ansible-runner'
}
default: {
Expand Down
10 changes: 1 addition & 9 deletions manifests/plugin/ansible/runner.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,12 @@
#
# $package_name:: Name of the package to install to provide 'ansible-runner' command
#
class foreman_proxy::plugin::ansible::runner(
class foreman_proxy::plugin::ansible::runner (
Boolean $manage_runner_repo = $foreman_proxy::plugin::ansible::manage_runner_repo,
String $package_name = $foreman_proxy::plugin::ansible::runner_package_name,
) {

if $manage_runner_repo {
case $facts['os']['family'] {
'Debian': {
include apt
apt::source { 'ansible-runner':
ensure => absent,
}
}
'RedHat': {
yumrepo { 'ansible-runner':
descr => 'Ansible runner',
Expand All @@ -36,5 +29,4 @@
package { $package_name:
ensure => 'installed',
}

}
4 changes: 2 additions & 2 deletions manifests/plugin/discovery.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
Stdlib::HTTPUrl $source_url = $foreman_proxy::plugin::discovery::params::source_url,
String $image_name = $foreman_proxy::plugin::discovery::params::image_name,
) inherits foreman_proxy::plugin::discovery::params {
foreman_proxy::plugin {'discovery':
foreman_proxy::plugin { 'discovery':
}

foreman_proxy::feature { 'Discovery': }

if $install_images {
$tftp_root_clean = regsubst($tftp_root, '/$', '')

foreman_proxy::remote_file {"${tftp_root_clean}/boot/${image_name}":
foreman_proxy::remote_file { "${tftp_root_clean}/boot/${image_name}":
remote_location => "${source_url}${image_name}",
mode => '0644',
} ~> exec { "untar ${image_name}":
Expand Down
2 changes: 1 addition & 1 deletion manifests/plugin/dns/powerdns.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
# The REST API key
#
class foreman_proxy::plugin::dns::powerdns (
String $rest_api_key,
Stdlib::HTTPUrl $rest_url = 'http://localhost:8081/api/v1/servers/localhost',
String $rest_api_key = '', # lint:ignore:empty_string_assignment
) {
foreman_proxy::plugin::provider { 'dns_powerdns':
}
Expand Down
3 changes: 1 addition & 2 deletions manifests/plugin/pulp.pp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
Array[String[1], 1] $client_authentication = ['client_certificate'],
Stdlib::HTTPUrl $rhsm_url = $foreman_proxy::plugin::pulp::params::rhsm_url,
) inherits foreman_proxy::plugin::pulp::params {

foreman_proxy::plugin {'pulp':
foreman_proxy::plugin { 'pulp':
version => $version,
}
-> [
Expand Down
1 change: 0 additions & 1 deletion manifests/plugin/remote_execution/script.pp
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,4 @@
}

Class['foreman_proxy::config'] ~> Class['foreman_proxy::plugin::remote_execution::mosquitto']

}
Loading