需要你的帮助,当我试图通过Ansible playbook安装Jenkins时,它会返回以下问题
Extracting templates from packages: 100%
Found an incorrect Java version
Java version found:
java version "1.7.0_131"
OpenJDK Runtime Environment (IcedTea 2.6.9) (7u131-2.6.9-0ubuntu0.14.04.2)
OpenJDK 64-Bit Server VM (build 24.131-b00, mixed mode)
Aborting
invoke-rc.d: initscript jenkins, action "start" failed.
dpkg: error processing package jenkins (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
jenkins
E: Sub-process /usr/bin/dpkg returned an error code (1)
我真的不知道从哪里开始。感谢
答案 0 :(得分:2)
Jenkins现在需要java 8,你需要在此之前为你的游戏添加一个任务,以确保你获得java 8。
- name: Install jdk version 8
package:
name: openjdk-8-jdk
state: present
您可能还希望将正确的java链接设置为操作系统默认值,以防您最终安装了多个安装,并使用以下代码。
- name: Select openjdk 8 as system default java
alternatives:
name: java
path: /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
如果您是从某个角色运行此角色,请将其插入角色定义本身之前的pre-tasks:
部分。
答案 1 :(得分:0)
您可以尝试安装java8:
- name: Ensure the webupd8 launchpad apt repository key is present
apt_key:
id: 0xC2518248EEA14886
keyserver: keyserver.ubuntu.com
state: present
- name: Add Oracle Java Repository
apt_repository:
repo: 'ppa:webupd8team/java'
- name: Accept Java 8 License
debconf:
name: 'oracle-java8-installer'
question: 'shared/accepted-oracle-license-v1-1'
value: 'true'
vtype: 'select'
- name: Install Oracle Java 8
apt:
name: {{item}}
state: latest
with_items:
- oracle-java8-installer
- ca-certificates
- oracle-java8-set-default