priestjim / chef-rundeck Goto Github PK
View Code? Open in Web Editor NEWA Chef cookbook for the remote administration tool Rundeck
License: Other
A Chef cookbook for the remote administration tool Rundeck
License: Other
It will be great if this cookbook will be published to Chef supermarket.
There is another cookbook with same name already published there(one I really don't like).
A new name can be something like: rundeck-by-priestjim
or priestjim-rundeck
The cookbook should depend on the apt cookbook or somehow test kitchen should run apt-get update
so package installs don't fail in this manner.
Tail from kitchen test
:
...
Not Found [IP: 91.189.91.15 80]
Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/o/openjdk-6/openjdk-6-jdk_6b27-1.12.6-1ubuntu0.12.04.4_amd64.deb 404 Not Found [IP: 91.189.91.15 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
---- End output of apt-get -q -y install openjdk-6-jdk=6b27-1.12.6-1ubuntu0.12.04.4 ----
Ran apt-get -q -y install openjdk-6-jdk=6b27-1.12.6-1ubuntu0.12.04.4 returned 100
[2014-03-13T05:07:09+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
>>>>>> Converge failed on instance <default-ubuntu-1204>.
>>>>>> Please see .kitchen/logs/default-ubuntu-1204.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [sudo -E chef-solo --config /tmp/kitchen/solo.rb --json-attributes /tmp/kitchen/dna.json --log_level info]
>>>>>> ----------------------
Our rundeck is hanging on jobs for days due to socketRead0 see below.
I'm going to add the following to the rundeck profile erb in order to attempt to kill such hanging processes after say, 12 hours (it will be an attribute).
sun.net.client.defaultReadTimeout
https://docs.oracle.com/javase/8/docs/technotes/guides/net/properties.html
"WinRM output reader for command [2B856BD0-D831-4BB9-A154-184286605B6A]" daemon prio=10 tid=0x00007f5d4477c800 nid=0x1267 runnable [0x00007f5d7996d000
]
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:152)
at java.net.SocketInputStream.read(SocketInputStream.java:122)
at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:166)
at org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:90)
at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:281)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:92)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:62)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:254)
at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:289)
at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:252)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.receiveResponseHeader(ManagedClientConnectionImpl.java:191)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:300)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:127)
at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:712)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:517)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
at com.xebialabs.overthere.cifs.winrm.WinRmClient.doSendRequest(WinRmClient.java:421)
at com.xebialabs.overthere.cifs.winrm.WinRmClient.access$100(WinRmClient.java:102)
at com.xebialabs.overthere.cifs.winrm.WinRmClient$PrivilegedSendMessage.run(WinRmClient.java:393)
at com.xebialabs.overthere.cifs.winrm.WinRmClient$PrivilegedSendMessage.run(WinRmClient.java:382)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:415)
at com.xebialabs.overthere.cifs.winrm.WinRmClient.runPrivileged(WinRmClient.java:368)
at com.xebialabs.overthere.cifs.winrm.WinRmClient.sendRequest(WinRmClient.java:352)
at com.xebialabs.overthere.cifs.winrm.WinRmClient.receiveOutput(WinRmClient.java:191)
at com.xebialabs.overthere.cifs.winrm.CifsWinRmConnection$2.run(CifsWinRmConnection.java:156)```
Over at https://github.com/balanced-cookbooks/rundeck I've rebuilt this cookbook on top of the Poise structure (resource based, etc). This allows things like creating jobs via a resource:
rundeck_job 'example' do
source 'example.yml.erb'
options do
project node['myapp']['project']
env node.chef_environment
end
end
Would you be interested in merging this with your repo?
end
Hi,
I've started to try and use this cookbook however I can't for the life of my work out the formats for the various databags - is there any chance you can publish a "dummy" item for each bag?
Thanks,
PF.
This is returned via the provider when trying to update/change the admin user's password by node attribute.
Because https://github.com/priestjim/chef-rundeck/blob/master/recipes/default.rb#L171 has no mechanism to use :update
instead of :create
there is no way to use the update action without modifying the cookbook's hardcoded action.
Work out the best solution for this issue:
[2014-03-12T01:03:33+00:00] INFO: remote_file[/var/chef/cache/rundeck-2.0.1-1-GA.deb] sending install action to dpkg_package[/var/chef/cache/rundeck-2.0.1-1-GA.deb] (delayed)
================================================================================
Error executing action `install` on resource 'dpkg_package[/var/chef/cache/rundeck-2.0.1-1-GA.deb]'
================================================================================
Chef::Exceptions::Exec
----------------------
dpkg -i /var/chef/cache/rundeck-2.0.1-1-GA.deb returned 1, expected 0
Resource Declaration:
---------------------
# In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/rundeck/recipes/default.rb
39: dpkg_package "#{Chef::Config['file_cache_path']}/rundeck-#{node['rundeck']['deb_version']}.deb" do
40: action :nothing
41: notifies :delete, 'file[/etc/rundeck/realm.properties]'
42: end
43:
Compiled Resource:
------------------
# Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/rundeck/recipes/default.rb:39:in `from_file'
dpkg_package("/var/chef/cache/rundeck-2.0.1-1-GA.deb") do
provider Chef::Provider::Package::Dpkg
action [:nothing]
retries 0
retry_delay 2
package_name "/var/chef/cache/rundeck-2.0.1-1-GA.deb"
source "/var/chef/cache/rundeck-2.0.1-1-GA.deb"
version "2.0.1"
cookbook_name :rundeck
recipe_name "default"
end
[2014-03-12T02:14:03+00:00] ERROR: Running exception handlers
[2014-03-12T02:14:03+00:00] ERROR: Exception handlers complete
[2014-03-12T02:14:03+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2014-03-12T02:14:06+00:00] ERROR: dpkg_package[/var/chef/cache/rundeck-2.0.1-1-GA.deb] (rundeck::default line 39) had an error: Chef::Exceptions::Exec: dpkg -i /var/chef/cache/rundeck-2.0.1-1-GA.deb returned 1, expected 0
[2014-03-12T02:14:09+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
The non-zero is due to:
vagrant@rundeck:~$ sudo -i dpkg -i /var/chef/cache/rundeck-2.0.1-1-GA.deb
(Reading database ... 70149 files and directories currently installed.)
Preparing to replace rundeck 2.0.1 (using .../cache/rundeck-2.0.1-1-GA.deb) ...
Unpacking replacement rundeck ...
Setting up rundeck (2.0.1) ...
Configuration file `/etc/rundeck/framework.properties'
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
*** framework.properties (Y/I/N/O/D/Z) [default=N] ?
At the least I believe this pkg resource should notify create/update of the template resource for framework.properties config file. I assume we probably want to ensure the default action or avoid this state.
Is it on the roadmap to create LWRP's for rundeck job and project creation?
I am trying to write some test_kitchen/serverspec tests for my wrapper cookbook that I use internally. I am running into issues with the rundeck::default.rb recipe around likes 91.
Here we check for chef_solo as I don't believe there is good way to check chef_zero. This results in compilation failure when running with chef_zero as it attempts to search the in memory chef server for data bag items that do not exist.
recipients = if Chef::Config[:solo]
'root'
elsif node['rundeck']['partial_search']
partial_search(
node['rundeck']['mail']['recipients_data_bag'],
node['rundeck']['mail']['recipients_query'],
:keys => node['rundeck']['mail']['recipients_keys']
).map {|u| u[node['rundeck']['mail']['recipients_keys'].keys.first] }.
join(',')
else
search(node['rundeck']['mail']['recipients_data_bag'], node['rundeck']['mail']['recipients_query']).
map {|u| eval("u#{node['rundeck']['mail']['recipients_field']}") }.
join(',')
end
I have switched to using chef_solo for now, but would prefer using chef_zero in the future. Not entirely sure the best way to handle it. I have thought about adding an attribute that we can just set true/false to tell it weather to search or not but I am not crazy about that, just not sure of another way at the moment.
recipients = if Chef::Config[:solo] || node['rundeck']['test_run']
I am suggesting a change to how the the cookbook handles the stub files around line 159. This section of code below handles files that have a need to be changed given an implementation. Using the wrapper cookbook model this creates an additional dependency on the chef-rewind gem.
# Stub files from the cookbook, override with chef-rewind
%w{ log4j.properties jaas-loginmodule.conf apitoken.aclpolicy admin.aclpolicy }.each do |cf|
cookbook_file "/etc/rundeck/#{cf}" do
source cf
owner 'rundeck'
group 'rundeck'
mode 00644
action :create
end
end
With a rather simple change we can remove the need for that dependency. I am proposing moving that array's data into an attribute. By doing that, you can then easily override the value from your wrapper cookbook removing files you will manage in your wrapper cookbook without the need for an additional dependency on the chef-rewind gem. I actually believe this approach is more scale-able as well.
I am going to be making this change locally and playing around with it. I wanted to get an issue up here to start discussion and get some thoughts before I submitted a pull request with this change.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.