Revision 9e19ae18
Added by Dominic Cleal over 11 years ago
- ID 9e19ae181f17f09626b7227955d9ee64b816d534
generate_answers.rb | ||
---|---|---|
def save_or_run_and_exit
|
||
# If the foreman_installer module exists then just use it. Otherwise, ask.
|
||
$modulepath = File.exists?("#{File.dirname(__FILE__)}/foreman_installer") ? File.dirname(__FILE__) : ask("<%= color('Where are the installer Puppet modules?', :question) %>")
|
||
if agree("\n<%= color('Do you want to run Puppet now with these settings?', :question) %> (y/n)", false)
|
||
system("echo include foreman_installer | sudo puppet apply --modulepath #{$modulepath} -v")
|
||
if Process::UID.eid == 0 && agree("\n<%= color('Do you want to run Puppet now with these settings?', :question) %> (y/n)", false)
|
||
system("echo include foreman_installer | puppet apply --modulepath #{$modulepath} -v")
|
||
parting_message
|
||
else
|
||
parting_message
|
||
... | ... | |
def parting_message
|
||
File.open($outfile, 'w') {|f| f.write(YAML.dump($output)) }
|
||
say("\n Okay, you're all set! Check <%= color('#{$outfile}', :cyan) %> for your config.")
|
||
say("\n You can apply it in the future with:")
|
||
say("\n You can apply it in the future as root with:")
|
||
say(" echo include foreman_installer | puppet apply --modulepath #{$modulepath} -v")
|
||
exit 0
|
||
end
|
Also available in: Unified diff
Remove sudo requirement from generate_answers, only run Puppet if root