Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue - Run PingFed as a service #2

Open
ChefMadeEasy opened this issue Jan 30, 2017 · 1 comment
Open

Issue - Run PingFed as a service #2

ChefMadeEasy opened this issue Jan 30, 2017 · 1 comment

Comments

@ChefMadeEasy
Copy link

     Greetings Scott,

I've downloaded your cookbook as-is and ran it on rhel 7, all looks good except the last step that runs PingFederate as a service. Any recommendations on how to fix this issue?
Thanks much!

=========
Error executing action enable on resource 'service[pingfederate]'

       Mixlib::ShellOut::ShellCommandFailed
       ------------------------------------
       Expected process to exit with [0], but received '1'
       ---- Begin output of /bin/systemctl --system enable pingfederate ----
       STDOUT: 
       STDERR: Failed to execute operation: Access denied
       ---- End output of /bin/systemctl --system enable pingfederate ----
       Ran /bin/systemctl --system enable pingfederate returned 1
       
       Resource Declaration:
       ---------------------
       # In /tmp/kitchen/cache/cookbooks/pingfederate/recipes/pingfederate.rb
       
       101: service 'pingfederate' do
       102:   action [:enable]
       103: end
@scottymarshall
Copy link
Owner

My bad. I did not test on RHEL 7, only 6.

You just need to setup the service using the systemd resource instead of the service resource. If you want to add it to the cookbook, go for it. Take a look at the "systemd" cookbook: https://github.com/nathwill/chef-systemd

I have used it before for a private cookbook for installing bamboo, and its pretty simple. Here's an example:

systemd_service 'bamboo' do
  description 'Atlassian Bamboo'
  after %w( network.target syslog.target )
  install do
    wanted_by 'multi-user.target'
  end
  service do
    exec_start "#{node['jmh_bamboo']['install']['current']}/bin/start-bamboo.sh"
    exec_stop "#{node['jmh_bamboo']['install']['current']}/bin/stop-bamboo.sh"
    user node['jmh_bamboo']['run_as']
    group node['jmh_bamboo']['run_as']
    type 'forking'
  end
  # only_if { ::File.open('/proc/1/comm').gets.chomp == 'systemd' } # systemd
   only_if { node['platform_version'].start_with?('7.') } # systemd
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants