Skip to content

Commit

Permalink
Fixes #37835 - Add user and netapi to Salt config
Browse files Browse the repository at this point in the history
* Set user for running Salt Master service due to 3006 changes
  https://docs.saltproject.io/en/3006/topics/releases/3006.0.html#linux-packaging-salt-master-salt-user-and-group

Salt API

* Add netapi_enable_clients explicitly due to 3006 changes
  https://docs.saltproject.io/en/master/topics/netapi/netapi-enable-clients.html#select-client-interfaces-to-enable
* Add api_interfaces parameter to enable configuration of API
  accessibility. However, smart_proxy_salt utilizes only
  the "runner" API interface.
  • Loading branch information
bastian-src committed Sep 20, 2024
1 parent 32de4bd commit 6f7d347
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
3 changes: 3 additions & 0 deletions manifests/plugin/salt.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#
# $api_password:: Salt API password
#
# $api_interfaces:: Salt API interfaces
#
# $saltfile:: Path to Saltfile
#
# === Advanced parameters:
Expand All @@ -42,6 +44,7 @@
String $api_auth = $foreman_proxy::plugin::salt::params::api_auth,
String $api_username = $foreman_proxy::plugin::salt::params::api_username,
String $api_password = $foreman_proxy::plugin::salt::params::api_password,
Array[String] $api_interfaces = $foreman_proxy::plugin::salt::params::api_interfaces,
Optional[Stdlib::Absolutepath] $saltfile = $foreman_proxy::plugin::salt::params::saltfile,
) inherits foreman_proxy::plugin::salt::params {
$foreman_ssl_cert = pick($foreman_proxy::foreman_ssl_cert, $foreman_proxy::ssl_cert)
Expand Down
1 change: 1 addition & 0 deletions manifests/plugin/salt/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
$api_auth = 'pam'
$api_username = 'saltuser'
$api_password = 'saltpassword'
$api_interfaces = ['runner']
$saltfile = undef
}
20 changes: 20 additions & 0 deletions spec/classes/foreman_proxy__plugin__salt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@
:content => /:enabled: https/
})
end

it 'should configure master.d/foreman.conf' do

Check failure on line 22 in spec/classes/foreman_proxy__plugin__salt_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

foreman_proxy::plugin::salt on debian-11-x86_64 with default settings should configure master.d/foreman.conf Failure/Error: should contain_file('/etc/salt/master.d/foreman.conf'). with_content(%r{autosign_grains_dir: /var/lib/foreman-proxy/salt/grains}). with_content(%r{autosign_file: /etc/salt/autosign.conf}). with_content(%r{user: root}). with_content(%r{netapi_enable_clients:\n - runner}). with_content(%r{external_auth:\n - pam\n - \'@runner\'}) expected that the catalogue would contain File[/etc/salt/master.d/foreman.conf] with content set to /external_auth:\n - pam\n - \'@runner\'/ but it is set to "# /etc/salt/master.d/foreman.config Master configuration\n#\n# This file summarizes configurations for the salt-master.\n# Have a look at the [Foreman Salt Plugin Documentation](https://theforeman.org/plugins/foreman_salt/) for detailed explanations.\n#\n# After editing this file, run the following command to active the changes:\n# systemctl restart salt-master\n\n\n##\n# Autosign\nautosign_grains_dir: /var/lib/foreman-proxy/salt/grains\nautosign_file: /etc/salt/autosign.conf\n# Uncomment the next line to make use of the autosign host name file (not recommended)\n# permissive_pki_access: True\n\n\n##\n# Salt Master service user\nuser: root\n\n\n##\n# Node classifier\nmaster_tops:\n ext_nodes: /usr/bin/foreman-node\n\n\n##\n# Pillar data access\next_pillar:\n - puppet: /usr/bin/foreman-node\n\n\n##\n# Salt API access\nexternal_auth:\n pam:\n saltuser:\n - '@runner'\n\nrest_cherrypy:\n port: 9191\n ssl_key: /etc/puppetlabs/puppet/ssl/private_keys/foo.example.com.pem\n ssl_crt: /etc/puppetlabs/puppet/ssl/certs/foo.example.com.pem\n\nnetapi_enable_clients:\n - runner\n\n\n##\n# Remote execution provider\npublisher_acl:\n foreman-proxy:\n - state.template_str\n\n\n##\n# Reactors\nreactor:\n - 'salt/auth': # Autosign reactor\n - /usr/share/foreman-proxy/salt/reactors/foreman_minion_auth.sls\n - 'salt/job/*/ret/*': # Report reactor\n - /usr/share/foreman-proxy/salt/reactors/foreman_report_upload.sls\n" Diff: @@ -1,64 +1,127 @@ -(?-mix:external_auth:\n - pam\n - \'@runner\') +# /etc/salt/master.d/foreman.config Master configuration +# +# This file summarizes configurations for the salt-master. +# Have a look at the [Foreman Salt Plugin Documentation](https://theforeman.org/plugins/foreman_salt/) for detailed explanations. +# +# After editing this file, run the following command to active the changes: +# systemctl restart salt-master + + +## +# Autosign +autosign_grains_dir: /var/lib/foreman-proxy/salt/grains +autosign_file: /etc/salt/autosign.conf +# Uncomment the next line to make use of the autosign host name file (not recommended) +# permissive_pki_access: True + + +## +# Salt Master service user +user: root + + +## +# Node classifier +master_tops: + ext_nodes: /usr/bin/foreman-node + + +## +# Pillar data access +ext_pillar: + - puppet: /usr/bin/foreman-node + + +## +# Salt API access +external_auth: + pam: + saltuser: + - '@runner' + +rest_cherrypy: + port: 9191 + ssl_key: /etc/puppetlabs/puppet/ssl/private_keys/foo.example.com.pem + ssl_crt: /etc/puppetlabs/puppet/ssl/certs/foo.example.com.pem + +netapi_enable_clients: + - runner + + +## +# Remote execution provider +publisher_acl: + foreman-proxy: + - state.template_str + + +## +# Reactors +reactor: + - 'salt/auth': # Autosign reactor + - /usr/share/foreman-proxy/salt/reactors/foreman_minion_auth.sls + - 'salt/job/*/ret/*': # Report reactor + - /usr/share/foreman-proxy/salt/reactors/foreman_report_upload.sls

Check failure on line 22 in spec/classes/foreman_proxy__plugin__salt_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

foreman_proxy::plugin::salt on redhat-8-x86_64 with default settings should configure master.d/foreman.conf Failure/Error: should contain_file('/etc/salt/master.d/foreman.conf'). with_content(%r{autosign_grains_dir: /var/lib/foreman-proxy/salt/grains}). with_content(%r{autosign_file: /etc/salt/autosign.conf}). with_content(%r{user: root}). with_content(%r{netapi_enable_clients:\n - runner}). with_content(%r{external_auth:\n - pam\n - \'@runner\'}) expected that the catalogue would contain File[/etc/salt/master.d/foreman.conf] with content set to /external_auth:\n - pam\n - \'@runner\'/ but it is set to "# /etc/salt/master.d/foreman.config Master configuration\n#\n# This file summarizes configurations for the salt-master.\n# Have a look at the [Foreman Salt Plugin Documentation](https://theforeman.org/plugins/foreman_salt/) for detailed explanations.\n#\n# After editing this file, run the following command to active the changes:\n# systemctl restart salt-master\n\n\n##\n# Autosign\nautosign_grains_dir: /var/lib/foreman-proxy/salt/grains\nautosign_file: /etc/salt/autosign.conf\n# Uncomment the next line to make use of the autosign host name file (not recommended)\n# permissive_pki_access: True\n\n\n##\n# Salt Master service user\nuser: root\n\n\n##\n# Node classifier\nmaster_tops:\n ext_nodes: /usr/bin/foreman-node\n\n\n##\n# Pillar data access\next_pillar:\n - puppet: /usr/bin/foreman-node\n\n\n##\n# Salt API access\nexternal_auth:\n pam:\n saltuser:\n - '@runner'\n\nrest_cherrypy:\n port: 9191\n ssl_key: /etc/puppetlabs/puppet/ssl/private_keys/foo.example.com.pem\n ssl_crt: /etc/puppetlabs/puppet/ssl/certs/foo.example.com.pem\n\nnetapi_enable_clients:\n - runner\n\n\n##\n# Remote execution provider\npublisher_acl:\n foreman-proxy:\n - state.template_str\n\n\n##\n# Reactors\nreactor:\n - 'salt/auth': # Autosign reactor\n - /usr/share/foreman-proxy/salt/reactors/foreman_minion_auth.sls\n - 'salt/job/*/ret/*': # Report reactor\n - /usr/share/foreman-proxy/salt/reactors/foreman_report_upload.sls\n" Diff: @@ -1,64 +1,127 @@ -(?-mix:external_auth:\n - pam\n - \'@runner\') +# /etc/salt/master.d/foreman.config Master configuration +# +# This file summarizes configurations for the salt-master. +# Have a look at the [Foreman Salt Plugin Documentation](https://theforeman.org/plugins/foreman_salt/) for detailed explanations. +# +# After editing this file, run the following command to active the changes: +# systemctl restart salt-master + + +## +# Autosign +autosign_grains_dir: /var/lib/foreman-proxy/salt/grains +autosign_file: /etc/salt/autosign.conf +# Uncomment the next line to make use of the autosign host name file (not recommended) +# permissive_pki_access: True + + +## +# Salt Master service user +user: root + + +## +# Node classifier +master_tops: + ext_nodes: /usr/bin/foreman-node + + +## +# Pillar data access +ext_pillar: + - puppet: /usr/bin/foreman-node + + +## +# Salt API access +external_auth: + pam: + saltuser: + - '@runner' + +rest_cherrypy: + port: 9191 + ssl_key: /etc/puppetlabs/puppet/ssl/private_keys/foo.example.com.pem + ssl_crt: /etc/puppetlabs/puppet/ssl/certs/foo.example.com.pem + +netapi_enable_clients: + - runner + + +## +# Remote execution provider +publisher_acl: + foreman-proxy: + - state.template_str + + +## +# Reactors +reactor: + - 'salt/auth': # Autosign reactor + - /usr/share/foreman-proxy/salt/reactors/foreman_minion_auth.sls + - 'salt/job/*/ret/*': # Report reactor + - /usr/share/foreman-proxy/salt/reactors/foreman_report_upload.sls

Check failure on line 22 in spec/classes/foreman_proxy__plugin__salt_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

foreman_proxy::plugin::salt on debian-11-x86_64 with default settings should configure master.d/foreman.conf Failure/Error: should contain_file('/etc/salt/master.d/foreman.conf'). with_content(%r{autosign_grains_dir: /var/lib/foreman-proxy/salt/grains}). with_content(%r{autosign_file: /etc/salt/autosign.conf}). with_content(%r{user: root}). with_content(%r{netapi_enable_clients:\n - runner}). with_content(%r{external_auth:\n - pam\n - \'@runner\'}) expected that the catalogue would contain File[/etc/salt/master.d/foreman.conf] with content set to /external_auth:\n - pam\n - \'@runner\'/ but it is set to "# /etc/salt/master.d/foreman.config Master configuration\n#\n# This file summarizes configurations for the salt-master.\n# Have a look at the [Foreman Salt Plugin Documentation](https://theforeman.org/plugins/foreman_salt/) for detailed explanations.\n#\n# After editing this file, run the following command to active the changes:\n# systemctl restart salt-master\n\n\n##\n# Autosign\nautosign_grains_dir: /var/lib/foreman-proxy/salt/grains\nautosign_file: /etc/salt/autosign.conf\n# Uncomment the next line to make use of the autosign host name file (not recommended)\n# permissive_pki_access: True\n\n\n##\n# Salt Master service user\nuser: root\n\n\n##\n# Node classifier\nmaster_tops:\n ext_nodes: /usr/bin/foreman-node\n\n\n##\n# Pillar data access\next_pillar:\n - puppet: /usr/bin/foreman-node\n\n\n##\n# Salt API access\nexternal_auth:\n pam:\n saltuser:\n - '@runner'\n\nrest_cherrypy:\n port: 9191\n ssl_key: /etc/puppetlabs/puppet/ssl/private_keys/foo.example.com.pem\n ssl_crt: /etc/puppetlabs/puppet/ssl/certs/foo.example.com.pem\n\nnetapi_enable_clients:\n - runner\n\n\n##\n# Remote execution provider\npublisher_acl:\n foreman-proxy:\n - state.template_str\n\n\n##\n# Reactors\nreactor:\n - 'salt/auth': # Autosign reactor\n - /usr/share/foreman-proxy/salt/reactors/foreman_minion_auth.sls\n - 'salt/job/*/ret/*': # Report reactor\n - /usr/share/foreman-proxy/salt/reactors/foreman_report_upload.sls\n" Diff: @@ -1,64 +1,127 @@ -(?-mix:external_auth:\n - pam\n - \'@runner\') +# /etc/salt/master.d/foreman.config Master configuration +# +# This file summarizes configurations for the salt-master. +# Have a look at the [Foreman Salt Plugin Documentation](https://theforeman.org/plugins/foreman_salt/) for detailed explanations. +# +# After editing this file, run the following command to active the changes: +# systemctl restart salt-master + + +## +# Autosign +autosign_grains_dir: /var/lib/foreman-proxy/salt/grains +autosign_file: /etc/salt/autosign.conf +# Uncomment the next line to make use of the autosign host name file (not recommended) +# permissive_pki_access: True + + +## +# Salt Master service user +user: root + + +## +# Node classifier +master_tops: + ext_nodes: /usr/bin/foreman-node + + +## +# Pillar data access +ext_pillar: + - puppet: /usr/bin/foreman-node + + +## +# Salt API access +external_auth: + pam: + saltuser: + - '@runner' + +rest_cherrypy: + port: 9191 + ssl_key: /etc/puppetlabs/puppet/ssl/private_keys/foo.example.com.pem + ssl_crt: /etc/puppetlabs/puppet/ssl/certs/foo.example.com.pem + +netapi_enable_clients: + - runner + + +## +# Remote execution provider +publisher_acl: + foreman-proxy: + - state.template_str + + +## +# Reactors +reactor: + - 'salt/auth': # Autosign reactor + - /usr/share/foreman-proxy/salt/reactors/foreman_minion_auth.sls + - 'salt/job/*/ret/*': # Report reactor + - /usr/share/foreman-proxy/salt/reactors/foreman_report_upload.sls

Check failure on line 22 in spec/classes/foreman_proxy__plugin__salt_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

foreman_proxy::plugin::salt on redhat-8-x86_64 with default settings should configure master.d/foreman.conf Failure/Error: should contain_file('/etc/salt/master.d/foreman.conf'). with_content(%r{autosign_grains_dir: /var/lib/foreman-proxy/salt/grains}). with_content(%r{autosign_file: /etc/salt/autosign.conf}). with_content(%r{user: root}). with_content(%r{netapi_enable_clients:\n - runner}). with_content(%r{external_auth:\n - pam\n - \'@runner\'}) expected that the catalogue would contain File[/etc/salt/master.d/foreman.conf] with content set to /external_auth:\n - pam\n - \'@runner\'/ but it is set to "# /etc/salt/master.d/foreman.config Master configuration\n#\n# This file summarizes configurations for the salt-master.\n# Have a look at the [Foreman Salt Plugin Documentation](https://theforeman.org/plugins/foreman_salt/) for detailed explanations.\n#\n# After editing this file, run the following command to active the changes:\n# systemctl restart salt-master\n\n\n##\n# Autosign\nautosign_grains_dir: /var/lib/foreman-proxy/salt/grains\nautosign_file: /etc/salt/autosign.conf\n# Uncomment the next line to make use of the autosign host name file (not recommended)\n# permissive_pki_access: True\n\n\n##\n# Salt Master service user\nuser: root\n\n\n##\n# Node classifier\nmaster_tops:\n ext_nodes: /usr/bin/foreman-node\n\n\n##\n# Pillar data access\next_pillar:\n - puppet: /usr/bin/foreman-node\n\n\n##\n# Salt API access\nexternal_auth:\n pam:\n saltuser:\n - '@runner'\n\nrest_cherrypy:\n port: 9191\n ssl_key: /etc/puppetlabs/puppet/ssl/private_keys/foo.example.com.pem\n ssl_crt: /etc/puppetlabs/puppet/ssl/certs/foo.example.com.pem\n\nnetapi_enable_clients:\n - runner\n\n\n##\n# Remote execution provider\npublisher_acl:\n foreman-proxy:\n - state.template_str\n\n\n##\n# Reactors\nreactor:\n - 'salt/auth': # Autosign reactor\n - /usr/share/foreman-proxy/salt/reactors/foreman_minion_auth.sls\n - 'salt/job/*/ret/*': # Report reactor\n - /usr/share/foreman-proxy/salt/reactors/foreman_report_upload.sls\n" Diff: @@ -1,64 +1,127 @@ -(?-mix:external_auth:\n - pam\n - \'@runner\') +# /etc/salt/master.d/foreman.config Master configuration +# +# This file summarizes configurations for the salt-master. +# Have a look at the [Foreman Salt Plugin Documentation](https://theforeman.org/plugins/foreman_salt/) for detailed explanations. +# +# After editing this file, run the following command to active the changes: +# systemctl restart salt-master + + +## +# Autosign +autosign_grains_dir: /var/lib/foreman-proxy/salt/grains +autosign_file: /etc/salt/autosign.conf +# Uncomment the next line to make use of the autosign host name file (not recommended) +# permissive_pki_access: True + + +## +# Salt Master service user +user: root + + +## +# Node classifier +master_tops: + ext_nodes: /usr/bin/foreman-node + + +## +# Pillar data access +ext_pillar: + - puppet: /usr/bin/foreman-node + + +## +# Salt API access +external_auth: + pam: + saltuser: + - '@runner' + +rest_cherrypy: + port: 9191 + ssl_key: /etc/puppetlabs/puppet/ssl/private_keys/foo.example.com.pem + ssl_crt: /etc/puppetlabs/puppet/ssl/certs/foo.example.com.pem + +netapi_enable_clients: + - runner + + +## +# Remote execution provider +publisher_acl: + foreman-proxy: + - state.template_str + + +## +# Reactors +reactor: + - 'salt/auth': # Autosign reactor + - /usr/share/foreman-proxy/salt/reactors/foreman_minion_auth.sls + - 'salt/job/*/ret/*': # Report reactor + - /usr/share/foreman-proxy/salt/reactors/foreman_report_upload.sls
should contain_file('/etc/salt/master.d/foreman.conf').
with_content(%r{autosign_grains_dir: /var/lib/foreman-proxy/salt/grains}).
with_content(%r{autosign_file: /etc/salt/autosign.conf}).
with_content(%r{user: root}).
with_content(%r{netapi_enable_clients:\n - runner}).
with_content(%r{external_auth:\n - pam\n - \'@runner\'})
end
end

describe 'with overwritten parameters' do
Expand All @@ -30,6 +39,7 @@
:api_auth => 'ldap',
:api_username => 'saltapi',
:api_password => 'letmein',
:api_interfaces => ['runner', 'local', 'ssh', 'wheel'],
:saltfile => '/etc/salt/Saltfile',
} end

Expand All @@ -45,6 +55,16 @@
with_content(%r{:api_password: letmein}).
with_content(%r{:saltfile: /etc/salt/Saltfile})
end

it 'should change master.d/foreman.conf parameters' do

Check failure on line 59 in spec/classes/foreman_proxy__plugin__salt_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

foreman_proxy::plugin::salt on debian-11-x86_64 with overwritten parameters should change master.d/foreman.conf parameters Failure/Error: should contain_file('/etc/salt/master.d/foreman.conf'). with_content(%r{user: example}). with_content(%r{autosign_grains_dir: /var/lib/foreman-proxy/salt/grains}). with_content(%r{autosign_file: /etc/salt/example.conf}). with_content(%r{user: root}). with_content(%r{netapi_enable_clients:\n - runner\n - local\n - ssh\n - wheel}). with_content(%r{external_auth:\n - ldap\n - \'@runner\'}) expected that the catalogue would contain File[/etc/salt/master.d/foreman.conf] with content set to /user: root/ but it is set to "# /etc/salt/master.d/foreman.config Master configuration\n#\n# This file summarizes configurations for the salt-master.\n# Have a look at the [Foreman Salt Plugin Documentation](https://theforeman.org/plugins/foreman_salt/) for detailed explanations.\n#\n# After editing this file, run the following command to active the changes:\n# systemctl restart salt-master\n\n\n##\n# Autosign\nautosign_grains_dir: /var/lib/foreman-proxy/salt/grains\nautosign_file: /etc/salt/example.conf\n# Uncomment the next line to make use of the autosign host name file (not recommended)\n# permissive_pki_access: True\n\n\n##\n# Salt Master service user\nuser: example\n\n\n##\n# Node classifier\nmaster_tops:\n ext_nodes: /usr/bin/foreman-node\n\n\n##\n# Pillar data access\next_pillar:\n - puppet: /usr/bin/foreman-node\n\n\n##\n# Salt API access\nexternal_auth:\n ldap:\n saltapi:\n - '@runner'\n\nrest_cherrypy:\n port: 9191\n ssl_key: /etc/puppetlabs/puppet/ssl/private_keys/foo.example.com.pem\n ssl_crt: /etc/puppetlabs/puppet/ssl/certs/foo.example.com.pem\n\nnetapi_enable_clients:\n - runner\n - local\n - ssh\n - wheel\n\n\n##\n# Remote execution provider\npublisher_acl:\n foreman-proxy:\n - state.template_str\n\n\n##\n# Reactors\nreactor:\n - 'salt/auth': # Autosign reactor\n - /usr/share/foreman-proxy/salt/reactors/foreman_minion_auth.sls\n - 'salt/job/*/ret/*': # Report reactor\n - /usr/share/foreman-proxy/salt/reactors/foreman_report_upload.sls\n", and parameter content set to /external_auth:\n - ldap\n - \'@runner\'/ but it is set to "# /etc/salt/master.d/foreman.config Master configuration\n#\n# This file summarizes configurations for the salt-master.\n# Have a look at the [Foreman Salt Plugin Documentation](https://theforeman.org/plugins/foreman_salt/) for detailed explanations.\n#\n# After editing this file, run the following command to active the changes:\n# systemctl restart salt-master\n\n\n##\n# Autosign\nautosign_grains_dir: /var/lib/foreman-proxy/salt/grains\nautosign_file: /etc/salt/example.conf\n# Uncomment the next line to make use of the autosign host name file (not recommended)\n# permissive_pki_access: True\n\n\n##\n# Salt Master service user\nuser: example\n\n\n##\n# Node classifier\nmaster_tops:\n ext_nodes: /usr/bin/foreman-node\n\n\n##\n# Pillar data access\next_pillar:\n - puppet: /usr/bin/foreman-node\n\n\n##\n# Salt API access\nexternal_auth:\n ldap:\n saltapi:\n - '@runner'\n\nrest_cherrypy:\n port: 9191\n ssl_key: /etc/puppetlabs/puppet/ssl/private_keys/foo.example.com.pem\n ssl_crt: /etc/puppetlabs/puppet/ssl/certs/foo.example.com.pem\n\nnetapi_enable_clients:\n - runner\n - local\n - ssh\n - wheel\n\n\n##\n# Remote execution provider\npublisher_acl:\n foreman-proxy:\n - state.template_str\n\n\n##\n# Reactors\nreactor:\n - 'salt/auth': # Autosign reactor\n - /usr/share/foreman-proxy/salt/reactors/foreman_minion_auth.sls\n - 'salt/job/*/ret/*': # Report reactor\n - /usr/share/foreman-proxy/salt/reactors/foreman_report_upload.sls\n" Diff: @@ -1,4 +1,137 @@ -(?-mix:user: root) +# /etc/salt/master.d/foreman.config Master configuration +# +# This file summarizes configurations for the salt-master. +# Have a look at the [Foreman Salt Plugin Documentation](https://theforeman.org/plugins/foreman_salt/) for detailed explanations. +# +# After editing this fil

Check failure on line 59 in spec/classes/foreman_proxy__plugin__salt_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

foreman_proxy::plugin::salt on redhat-8-x86_64 with overwritten parameters should change master.d/foreman.conf parameters Failure/Error: should contain_file('/etc/salt/master.d/foreman.conf'). with_content(%r{user: example}). with_content(%r{autosign_grains_dir: /var/lib/foreman-proxy/salt/grains}). with_content(%r{autosign_file: /etc/salt/example.conf}). with_content(%r{user: root}). with_content(%r{netapi_enable_clients:\n - runner\n - local\n - ssh\n - wheel}). with_content(%r{external_auth:\n - ldap\n - \'@runner\'}) expected that the catalogue would contain File[/etc/salt/master.d/foreman.conf] with content set to /user: root/ but it is set to "# /etc/salt/master.d/foreman.config Master configuration\n#\n# This file summarizes configurations for the salt-master.\n# Have a look at the [Foreman Salt Plugin Documentation](https://theforeman.org/plugins/foreman_salt/) for detailed explanations.\n#\n# After editing this file, run the following command to active the changes:\n# systemctl restart salt-master\n\n\n##\n# Autosign\nautosign_grains_dir: /var/lib/foreman-proxy/salt/grains\nautosign_file: /etc/salt/example.conf\n# Uncomment the next line to make use of the autosign host name file (not recommended)\n# permissive_pki_access: True\n\n\n##\n# Salt Master service user\nuser: example\n\n\n##\n# Node classifier\nmaster_tops:\n ext_nodes: /usr/bin/foreman-node\n\n\n##\n# Pillar data access\next_pillar:\n - puppet: /usr/bin/foreman-node\n\n\n##\n# Salt API access\nexternal_auth:\n ldap:\n saltapi:\n - '@runner'\n\nrest_cherrypy:\n port: 9191\n ssl_key: /etc/puppetlabs/puppet/ssl/private_keys/foo.example.com.pem\n ssl_crt: /etc/puppetlabs/puppet/ssl/certs/foo.example.com.pem\n\nnetapi_enable_clients:\n - runner\n - local\n - ssh\n - wheel\n\n\n##\n# Remote execution provider\npublisher_acl:\n foreman-proxy:\n - state.template_str\n\n\n##\n# Reactors\nreactor:\n - 'salt/auth': # Autosign reactor\n - /usr/share/foreman-proxy/salt/reactors/foreman_minion_auth.sls\n - 'salt/job/*/ret/*': # Report reactor\n - /usr/share/foreman-proxy/salt/reactors/foreman_report_upload.sls\n", and parameter content set to /external_auth:\n - ldap\n - \'@runner\'/ but it is set to "# /etc/salt/master.d/foreman.config Master configuration\n#\n# This file summarizes configurations for the salt-master.\n# Have a look at the [Foreman Salt Plugin Documentation](https://theforeman.org/plugins/foreman_salt/) for detailed explanations.\n#\n# After editing this file, run the following command to active the changes:\n# systemctl restart salt-master\n\n\n##\n# Autosign\nautosign_grains_dir: /var/lib/foreman-proxy/salt/grains\nautosign_file: /etc/salt/example.conf\n# Uncomment the next line to make use of the autosign host name file (not recommended)\n# permissive_pki_access: True\n\n\n##\n# Salt Master service user\nuser: example\n\n\n##\n# Node classifier\nmaster_tops:\n ext_nodes: /usr/bin/foreman-node\n\n\n##\n# Pillar data access\next_pillar:\n - puppet: /usr/bin/foreman-node\n\n\n##\n# Salt API access\nexternal_auth:\n ldap:\n saltapi:\n - '@runner'\n\nrest_cherrypy:\n port: 9191\n ssl_key: /etc/puppetlabs/puppet/ssl/private_keys/foo.example.com.pem\n ssl_crt: /etc/puppetlabs/puppet/ssl/certs/foo.example.com.pem\n\nnetapi_enable_clients:\n - runner\n - local\n - ssh\n - wheel\n\n\n##\n# Remote execution provider\npublisher_acl:\n foreman-proxy:\n - state.template_str\n\n\n##\n# Reactors\nreactor:\n - 'salt/auth': # Autosign reactor\n - /usr/share/foreman-proxy/salt/reactors/foreman_minion_auth.sls\n - 'salt/job/*/ret/*': # Report reactor\n - /usr/share/foreman-proxy/salt/reactors/foreman_report_upload.sls\n" Diff: @@ -1,4 +1,137 @@ -(?-mix:user: root) +# /etc/salt/master.d/foreman.config Master configuration +# +# This file summarizes configurations for the salt-master. +# Have a look at the [Foreman Salt Plugin Documentation](https://theforeman.org/plugins/foreman_salt/) for detailed explanations. +# +# After editing this file

Check failure on line 59 in spec/classes/foreman_proxy__plugin__salt_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

foreman_proxy::plugin::salt on debian-11-x86_64 with overwritten parameters should change master.d/foreman.conf parameters Failure/Error: should contain_file('/etc/salt/master.d/foreman.conf'). with_content(%r{user: example}). with_content(%r{autosign_grains_dir: /var/lib/foreman-proxy/salt/grains}). with_content(%r{autosign_file: /etc/salt/example.conf}). with_content(%r{user: root}). with_content(%r{netapi_enable_clients:\n - runner\n - local\n - ssh\n - wheel}). with_content(%r{external_auth:\n - ldap\n - \'@runner\'}) expected that the catalogue would contain File[/etc/salt/master.d/foreman.conf] with content set to /user: root/ but it is set to "# /etc/salt/master.d/foreman.config Master configuration\n#\n# This file summarizes configurations for the salt-master.\n# Have a look at the [Foreman Salt Plugin Documentation](https://theforeman.org/plugins/foreman_salt/) for detailed explanations.\n#\n# After editing this file, run the following command to active the changes:\n# systemctl restart salt-master\n\n\n##\n# Autosign\nautosign_grains_dir: /var/lib/foreman-proxy/salt/grains\nautosign_file: /etc/salt/example.conf\n# Uncomment the next line to make use of the autosign host name file (not recommended)\n# permissive_pki_access: True\n\n\n##\n# Salt Master service user\nuser: example\n\n\n##\n# Node classifier\nmaster_tops:\n ext_nodes: /usr/bin/foreman-node\n\n\n##\n# Pillar data access\next_pillar:\n - puppet: /usr/bin/foreman-node\n\n\n##\n# Salt API access\nexternal_auth:\n ldap:\n saltapi:\n - '@runner'\n\nrest_cherrypy:\n port: 9191\n ssl_key: /etc/puppetlabs/puppet/ssl/private_keys/foo.example.com.pem\n ssl_crt: /etc/puppetlabs/puppet/ssl/certs/foo.example.com.pem\n\nnetapi_enable_clients:\n - runner\n - local\n - ssh\n - wheel\n\n\n##\n# Remote execution provider\npublisher_acl:\n foreman-proxy:\n - state.template_str\n\n\n##\n# Reactors\nreactor:\n - 'salt/auth': # Autosign reactor\n - /usr/share/foreman-proxy/salt/reactors/foreman_minion_auth.sls\n - 'salt/job/*/ret/*': # Report reactor\n - /usr/share/foreman-proxy/salt/reactors/foreman_report_upload.sls\n", and parameter content set to /external_auth:\n - ldap\n - \'@runner\'/ but it is set to "# /etc/salt/master.d/foreman.config Master configuration\n#\n# This file summarizes configurations for the salt-master.\n# Have a look at the [Foreman Salt Plugin Documentation](https://theforeman.org/plugins/foreman_salt/) for detailed explanations.\n#\n# After editing this file, run the following command to active the changes:\n# systemctl restart salt-master\n\n\n##\n# Autosign\nautosign_grains_dir: /var/lib/foreman-proxy/salt/grains\nautosign_file: /etc/salt/example.conf\n# Uncomment the next line to make use of the autosign host name file (not recommended)\n# permissive_pki_access: True\n\n\n##\n# Salt Master service user\nuser: example\n\n\n##\n# Node classifier\nmaster_tops:\n ext_nodes: /usr/bin/foreman-node\n\n\n##\n# Pillar data access\next_pillar:\n - puppet: /usr/bin/foreman-node\n\n\n##\n# Salt API access\nexternal_auth:\n ldap:\n saltapi:\n - '@runner'\n\nrest_cherrypy:\n port: 9191\n ssl_key: /etc/puppetlabs/puppet/ssl/private_keys/foo.example.com.pem\n ssl_crt: /etc/puppetlabs/puppet/ssl/certs/foo.example.com.pem\n\nnetapi_enable_clients:\n - runner\n - local\n - ssh\n - wheel\n\n\n##\n# Remote execution provider\npublisher_acl:\n foreman-proxy:\n - state.template_str\n\n\n##\n# Reactors\nreactor:\n - 'salt/auth': # Autosign reactor\n - /usr/share/foreman-proxy/salt/reactors/foreman_minion_auth.sls\n - 'salt/job/*/ret/*': # Report reactor\n - /usr/share/foreman-proxy/salt/reactors/foreman_report_upload.sls\n" Diff: @@ -1,4 +1,137 @@ -(?-mix:user: root) +# /etc/salt/master.d/foreman.config Master configuration +# +# This file summarizes configurations for the salt-master. +# Have a look at the [Foreman Salt Plugin Documentation](https://theforeman.org/plugins/foreman_salt/) for detailed explanations. +# +# After editing this fil

Check failure on line 59 in spec/classes/foreman_proxy__plugin__salt_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

foreman_proxy::plugin::salt on redhat-8-x86_64 with overwritten parameters should change master.d/foreman.conf parameters Failure/Error: should contain_file('/etc/salt/master.d/foreman.conf'). with_content(%r{user: example}). with_content(%r{autosign_grains_dir: /var/lib/foreman-proxy/salt/grains}). with_content(%r{autosign_file: /etc/salt/example.conf}). with_content(%r{user: root}). with_content(%r{netapi_enable_clients:\n - runner\n - local\n - ssh\n - wheel}). with_content(%r{external_auth:\n - ldap\n - \'@runner\'}) expected that the catalogue would contain File[/etc/salt/master.d/foreman.conf] with content set to /user: root/ but it is set to "# /etc/salt/master.d/foreman.config Master configuration\n#\n# This file summarizes configurations for the salt-master.\n# Have a look at the [Foreman Salt Plugin Documentation](https://theforeman.org/plugins/foreman_salt/) for detailed explanations.\n#\n# After editing this file, run the following command to active the changes:\n# systemctl restart salt-master\n\n\n##\n# Autosign\nautosign_grains_dir: /var/lib/foreman-proxy/salt/grains\nautosign_file: /etc/salt/example.conf\n# Uncomment the next line to make use of the autosign host name file (not recommended)\n# permissive_pki_access: True\n\n\n##\n# Salt Master service user\nuser: example\n\n\n##\n# Node classifier\nmaster_tops:\n ext_nodes: /usr/bin/foreman-node\n\n\n##\n# Pillar data access\next_pillar:\n - puppet: /usr/bin/foreman-node\n\n\n##\n# Salt API access\nexternal_auth:\n ldap:\n saltapi:\n - '@runner'\n\nrest_cherrypy:\n port: 9191\n ssl_key: /etc/puppetlabs/puppet/ssl/private_keys/foo.example.com.pem\n ssl_crt: /etc/puppetlabs/puppet/ssl/certs/foo.example.com.pem\n\nnetapi_enable_clients:\n - runner\n - local\n - ssh\n - wheel\n\n\n##\n# Remote execution provider\npublisher_acl:\n foreman-proxy:\n - state.template_str\n\n\n##\n# Reactors\nreactor:\n - 'salt/auth': # Autosign reactor\n - /usr/share/foreman-proxy/salt/reactors/foreman_minion_auth.sls\n - 'salt/job/*/ret/*': # Report reactor\n - /usr/share/foreman-proxy/salt/reactors/foreman_report_upload.sls\n", and parameter content set to /external_auth:\n - ldap\n - \'@runner\'/ but it is set to "# /etc/salt/master.d/foreman.config Master configuration\n#\n# This file summarizes configurations for the salt-master.\n# Have a look at the [Foreman Salt Plugin Documentation](https://theforeman.org/plugins/foreman_salt/) for detailed explanations.\n#\n# After editing this file, run the following command to active the changes:\n# systemctl restart salt-master\n\n\n##\n# Autosign\nautosign_grains_dir: /var/lib/foreman-proxy/salt/grains\nautosign_file: /etc/salt/example.conf\n# Uncomment the next line to make use of the autosign host name file (not recommended)\n# permissive_pki_access: True\n\n\n##\n# Salt Master service user\nuser: example\n\n\n##\n# Node classifier\nmaster_tops:\n ext_nodes: /usr/bin/foreman-node\n\n\n##\n# Pillar data access\next_pillar:\n - puppet: /usr/bin/foreman-node\n\n\n##\n# Salt API access\nexternal_auth:\n ldap:\n saltapi:\n - '@runner'\n\nrest_cherrypy:\n port: 9191\n ssl_key: /etc/puppetlabs/puppet/ssl/private_keys/foo.example.com.pem\n ssl_crt: /etc/puppetlabs/puppet/ssl/certs/foo.example.com.pem\n\nnetapi_enable_clients:\n - runner\n - local\n - ssh\n - wheel\n\n\n##\n# Remote execution provider\npublisher_acl:\n foreman-proxy:\n - state.template_str\n\n\n##\n# Reactors\nreactor:\n - 'salt/auth': # Autosign reactor\n - /usr/share/foreman-proxy/salt/reactors/foreman_minion_auth.sls\n - 'salt/job/*/ret/*': # Report reactor\n - /usr/share/foreman-proxy/salt/reactors/foreman_report_upload.sls\n" Diff: @@ -1,4 +1,137 @@ -(?-mix:user: root) +# /etc/salt/master.d/foreman.config Master configuration +# +# This file summarizes configurations for the salt-master. +# Have a look at the [Foreman Salt Plugin Documentation](https://theforeman.org/plugins/foreman_salt/) for detailed explanations. +# +# After editing this file
should contain_file('/etc/salt/master.d/foreman.conf').
with_content(%r{user: example}).
with_content(%r{autosign_grains_dir: /var/lib/foreman-proxy/salt/grains}).
with_content(%r{autosign_file: /etc/salt/example.conf}).
with_content(%r{user: root}).
with_content(%r{netapi_enable_clients:\n - runner\n - local\n - ssh\n - wheel}).
with_content(%r{external_auth:\n - ldap\n - \'@runner\'})
end
end
end
end
Expand Down
12 changes: 12 additions & 0 deletions templates/plugin/salt_master.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ autosign_file: <%= scope.lookupvar('foreman_proxy::plugin::salt::autosign_file')
# permissive_pki_access: True


##
# Salt Master service user
user: <%= scope.lookupvar('::foreman_proxy::plugin::salt::user') %>


##
# Node classifier
master_tops:
Expand All @@ -39,6 +44,13 @@ rest_cherrypy:
ssl_key: <%= @foreman_ssl_key %>
ssl_crt: <%= @foreman_ssl_cert %>
<% if scope.lookupvar('foreman_proxy::plugin::salt::api_interfaces').any? -%>
netapi_enable_clients:
<%- scope.lookupvar('foreman_proxy::plugin::salt::api_interfaces').each do |api_item| -%>
- <%= api_item %>
<%- end -%>
<% end -%>


##
# Remote execution provider
Expand Down

0 comments on commit 6f7d347

Please sign in to comment.