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

Remove poise-service #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
default['rundeck_bridge']['gem']['name'] = 'chef-rundeck'
default['rundeck_bridge']['gem']['version'] = nil
#<> Location of chef-rundeck gem binary
default['rundeck_bridge']['binary'] = '/opt/chef/embedded/bin/chef-rundeck'
default['rundeck_bridge']['binary'] = ::File.join(Gem.bindir, 'chef-rundeck')
#<> IP to bind the bridge to
default['rundeck_bridge']['options']['host'] = '0.0.0.0'
#<> Port the bridge listens to
Expand All @@ -22,12 +22,3 @@
default['rundeck_bridge']['options']['partial-search'] = 'true'
#<> Default username attribute for the node element in the generated resource xml
default['rundeck_bridge']['options']['username'] = 'rundeck'


# Service setup (Using 'poise')
default['rundeck_bridge']['poise_service']['options'] = {
upstart: {
},
systemd: {
}
}
1 change: 0 additions & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
supports 'centos'

depends 'chef-client'
depends 'poise-service'

suggests 'rundeck-server'
suggests 'rundeck-node'
2 changes: 1 addition & 1 deletion recipes/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
group 'root'
mode '0644'
content 'log_level :info'
notifies :restart, 'poise_service[chef-rundeck]'
notifies :restart, 'systemd_unit[chef-rundeck.service]'
end
7 changes: 4 additions & 3 deletions recipes/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
# Recipe: install
#

# Poise will create the User/Group but not the 'home' directory
poise_service_user node['rundeck_bridge']['user'] do
group node['rundeck_bridge']['group']

user node['rundeck_bridge']['user'] do
home node['rundeck_bridge']['home']
group node['rundeck_bridge']['group']
end
Expand All @@ -28,5 +29,5 @@
# Install chef-rundeck in chef as it requires chef
chef_gem node['rundeck_bridge']['gem']['name'] do
compile_time false
version node['rundeck_bridge']['gem']['version']
version node['rundeck_bridge']['gem']['version'] unless node['rundeck_bridge']['gem']['version'].nil?
end
40 changes: 14 additions & 26 deletions recipes/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,18 @@
node['rundeck_bridge']['options'].map { |key, value| "--#{key} #{value}" },
].join(' ')


# Overwrite and update the command
# (Workaround for Upstart and logs)
node['rundeck_bridge']['poise_service']['options'].each do |k, v|
case k
when 'upstart'
node.default['rundeck_bridge']['poise_service']['options'][k]['command'] = "#{command} 2>&1 > #{node['rundeck_bridge']['home']}/server.log"
when 'systemd'
node.default['rundeck_bridge']['poise_service']['options'][k]['command'] = command
else
fail "Unsupported init service #{k}"
end
end


# Define the chef-rundeck service
#
poise_service 'chef-rundeck' do
# Common setup for every providers
user node['rundeck_bridge']['user']
directory node['rundeck_bridge']['home']

# Per init provider options
node['rundeck_bridge']['poise_service']['options'].each do |k, v|
options k, v
end if node['rundeck_bridge']['poise_service']['options']
systemd_unit 'chef-rundeck.service' do
action %i[create enable]
content(Unit: {
Description: 'chef-rundeck',
},
Service: {
Environment: '',
ExecStart: command,
ExecReload: '/bin/kill -HUP $MAINPID',
KillSignal: 'TERM',
User: 'chef-rundeck',
WorkingDirectory: '/var/log/chef-rundeck',
Restart: 'on-failure',
},)
end