簡體   English   中英

AWS opsworks上的Chef 12腳本無法安裝jenkins

[英]chef 12 script on AWS opsworks failing to install jenkins

我有以下廚師12腳本,我正在aws opsworks上運行以安裝jenkins。 我從以下站點獲得它: https : //wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu當我運行它時,它失敗並顯示以下錯誤:

execute 'add jenkins source to apt' do
    command "wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -"
end


file '/etc/apt/sources.list.d/jenkins.list' do
    content 'deb http://pkg.jenkins.io/debian-stable binary/'
end

execute 'update apt-get' do
    command 'apt-get update'
end


package 'install Jenkins' do
    package_name "jenkins"
end

package 'install nginx' do
    package_name 'nginx'
end

file '/etc/nginx/sites-enabled/default' do
    action :delete
end

cookbook_file '/etc/nginx/sites-available/jenkins' do
    source 'jenkins'
end

link '/etc/nginx/sites-enabled/jenkins' do
    to '/etc/nginx/sites-available/jenkins'
    link_type :symbolic
end

service 'nginx' do
    action :restart
end

service 'jenkins' do
    action :restart
end

當我在運行ubuntu 14.04的c4.4xlarge圖像上運行執行配方時,出現以下錯誤

Setting up jenkins (2.32.1) ...
* Starting Jenkins Continuous Integration Server jenkins
...fail!
Setting up libnss3-nssdb (2:3.26.2-0ubuntu0.14.04.3) ...

STDERR: invoke-rc.d: initscript jenkins, action "start" failed.
dpkg: error processing package jenkins (--configure):
subprocess installed post-installation script returned error exit status 7
Errors were encountered while processing:
jenkins
E: Sub-process /usr/bin/dpkg returned an error code (1)
---- End output of apt-get -q -y install jenkins=2.32.1 ----
Ran apt-get -q -y install jenkins=2.32.1 returned 100

Resource Declaration:
---------------------
# In /var/chef/runs/55bf900b-16e6-4573-9948-8571284d80e7/local-mode-cache/cache/cookbooks/jenkins/recipes/default.rb

16: package 'install Jenkins' do
17:     package_name "jenkins"
18: end
19: 

Compiled Resource:
------------------
# Declared in /var/chef/runs/55bf900b-16e6-4573-9948-8571284d80e7/local-mode-cache/cache/cookbooks/jenkins/recipes/default.rb:16:in `from_file'

apt_package("install Jenkins") do
package_name "jenkins"
action [:install]
retries 0
retry_delay 2
default_guard_interpreter :default
declared_type :package
cookbook_name "jenkins"
recipe_name "default"
end

Platform:
---------
x86_64-linux

[2017-02-01T03:10:08+00:00] INFO: Running queued delayed notifications before re-raising exception
[2017-02-01T03:10:08+00:00] ERROR: Running exception handlers
[2017-02-01T03:10:08+00:00] ERROR: Exception handlers complete
[2017-02-01T03:10:08+00:00] FATAL: Stacktrace dumped to /var/chef/runs/55bf900b-16e6-4573-9948-8571284d80e7/local-mode-cache/cache/chef-stacktrace.out
[2017-02-01T03:10:08+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2017-02-01T03:10:08+00:00] ERROR: apt_package[install Jenkins] (jenkins::default line 16) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '100'

我不確定詹金斯為什么無法開始。 當我在同一實例上運行兩次配方時,它第二次成功。 非常感謝您的幫助,因為這是我的第一個Chef腳本。

事實證明答案在Chef stacktrace文件中。 apt-get進程運行兩次,並且在安裝軟件包步驟中無法訪問dpkg中的鎖定文件。 更改

execute 'update apt-get' do
    command 'apt-get update'
end


package 'install Jenkins' do
    package_name "jenkins"
end

apt_update 'all platforms' do
    action :update
end

apt_package 'jenkins' do
  action :install
end

解決了這個問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM