File tree Expand file tree Collapse file tree 5 files changed +79
-0
lines changed Expand file tree Collapse file tree 5 files changed +79
-0
lines changed Original file line number Diff line number Diff line change 66#
77# $autosign_file:: File to use for salt autosign
88#
9+ # $autosign_key_file:: File to use for salt autosign via grains
10+ #
911# $user:: User to run salt commands under
1012#
1113# $api:: Use Salt API
2830#
2931class foreman_proxy::plugin::salt (
3032 Stdlib::Absolutepath $autosign_file = $foreman_proxy::plugin::salt::params::autosign_file,
33+ Stdlib::Absolutepath $autosign_key_file = $foreman_proxy::plugin::salt::params::autosign_key_file,
3134 Boolean $enabled = $foreman_proxy::plugin::salt::params::enabled,
3235 Foreman_proxy::ListenOn $listen_on = $foreman_proxy::plugin::salt::params::listen_on,
3336 String $user = $foreman_proxy::plugin::salt::params::user,
3841 String $api_password = $foreman_proxy::plugin::salt::params::api_password,
3942 Optional[Stdlib::Absolutepath] $saltfile = $foreman_proxy::plugin::salt::params::saltfile,
4043) inherits foreman_proxy::plugin::salt::params {
44+ $foreman_ssl_cert = pick($foreman_proxy::foreman_ssl_cert , $foreman_proxy::ssl_cert )
45+ $foreman_ssl_key = pick($foreman_proxy::foreman_ssl_key , $foreman_proxy::ssl_key )
46+ $reactor_path = ' /usr/share/foreman-proxy/salt/reactors'
47+
4148 foreman_proxy::plugin::module { 'salt' :
4249 enabled => $enabled ,
4350 listen_on => $listen_on ,
4451 }
52+
53+ file {"${foreman_proxy::etc}/salt/master.d" :
54+ ensure => directory ,
55+ mode => ' 0755' ,
56+ }
57+ file {"${foreman_proxy::etc}/salt/master.d/foreman.conf" :
58+ ensure => file ,
59+ content => template (' foreman_proxy/plugin/salt_master.conf.erb' ),
60+ owner => ' root' ,
61+ mode => ' 0640' ,
62+ }
4563}
Original file line number Diff line number Diff line change 66 $enabled = true
77 $listen_on = ' https'
88 $autosign_file = " ${foreman_proxy::params::etc} /salt/autosign.conf"
9+ $autosign_grains_dir = ' /var/lib/foreman-proxy/salt/grains'
10+ $autosign_key_file = " ${autosign_grains_dir} /autosign_key"
911 $user = ' root'
1012
1113 $api = false
Original file line number Diff line number Diff line change 2424 let :params do {
2525 :user => 'example' ,
2626 :autosign_file => '/etc/salt/example.conf' ,
27+ :autosign_key_file => '/var/lib/foreman-proxy/salt/grains/autosign_key' ,
2728 :api => true ,
2829 :api_url => 'http://foreman.example.com' ,
2930 :api_auth => 'ldap' ,
3637 should contain_file ( '/etc/foreman-proxy/settings.d/salt.yml' ) .
3738 with_content ( %r{:salt_command_user: example} ) .
3839 with_content ( %r{:autosign_file: /etc/salt/example.conf} ) .
40+ with_content ( %r{:autosign_key_file: /var/lib/foreman-proxy/salt/grains/autosign_key} ) .
3941 with_content ( %r{:use_api: true} ) .
4042 with_content ( %r{:api_url: http://foreman.example.com} ) .
4143 with_content ( %r{:api_auth: ldap} ) .
Original file line number Diff line number Diff line change 11---
22:enabled: <%= @module_enabled %>
33:autosign_file: <%= scope.lookupvar('::foreman_proxy::plugin::salt::autosign_file') %>
4+ :autosign_key_file: <%= scope.lookupvar('::foreman_proxy::plugin::salt::autosign_key_file') %>
45:salt_command_user: <%= scope.lookupvar('::foreman_proxy::plugin::salt::user') %>
56# Some features require using the Salt API - such as listing environments and retrieving state info
67:use_api: <%= scope.lookupvar('::foreman_proxy::plugin::salt::api') %>
Original file line number Diff line number Diff line change 1+ # /etc/salt/master.d/foreman.config Master configuration
2+ #
3+ # This file summarizes configurations for the salt-master.
4+ # Have a look at the [Foreman Salt Plugin Documentation](https://theforeman.org/plugins/foreman_salt/) for detailed explanations.
5+ #
6+ # After editing this file, run the following command to active the changes:
7+ # systemctl restart salt-master
8+
9+
10+ ##
11+ # Autosign
12+ autosign_grains_dir: <%= scope.lookupvar('foreman_proxy::plugin::salt::autosign_grains_dir') %>
13+ autosign_file: <%= scope.lookupvar('foreman_proxy::plugin::salt::autosign_file') %>
14+ # Uncomment the next line to make use of the autosign host name file (not recommended)
15+ # permissive_pki_access: True
16+
17+
18+ ##
19+ # Node classifier
20+ master_tops:
21+ ext_nodes: /usr/bin/foreman-node
22+
23+
24+ ##
25+ # Pillar data access
26+ ext_pillar:
27+ - puppet: /usr/bin/foreman-node
28+
29+
30+ ##
31+ # Salt API access
32+ external_auth:
33+ <%= scope.lookupvar('foreman_proxy::plugin::salt::api_auth') %> :
34+ <%= scope.lookupvar('foreman_proxy::plugin::salt::api_username') %> :
35+ - '@runner'
36+
37+ rest_cherrypy:
38+ port: 9191
39+ ssl_key: <%= @foreman_ssl_key %>
40+ ssl_crt: <%= @foreman_ssl_cert %>
41+
42+
43+ ##
44+ # Remote execution provider
45+ publisher_acl:
46+ foreman-proxy:
47+ - state.template_str
48+
49+
50+ ##
51+ # Reactors
52+ reactor:
53+ - 'salt/auth': # Autosign reactor
54+ - <%= @reactor_path %> /foreman_minion_auth.sls
55+ - 'salt/job/*/ret/*': # Report reactor
56+ - <%= @reactor_path %> /foreman_report_upload.sls
You can’t perform that action at this time.
0 commit comments